* language.c (language_gdbarch_post_init): Fix off-by one error.
[deliverable/binutils-gdb.git] / gdb / configure.in
CommitLineData
c906108c 1dnl Autoconf configure script for GDB, the GNU debugger.
0f0cffd2 2dnl Copyright 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
b6ba6518 3dnl Free Software Foundation, Inc.
c906108c
SS
4dnl
5dnl This file is part of GDB.
6dnl
7dnl This program is free software; you can redistribute it and/or modify
8dnl it under the terms of the GNU General Public License as published by
9dnl the Free Software Foundation; either version 2 of the License, or
10dnl (at your option) any later version.
11dnl
12dnl This program is distributed in the hope that it will be useful,
13dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
14dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15dnl GNU General Public License for more details.
16dnl
17dnl You should have received a copy of the GNU General Public License
18dnl along with this program; if not, write to the Free Software
19dnl Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20
21dnl Process this file with autoconf to produce a configure script.
22
23AC_PREREQ(2.13)dnl
24AC_INIT(main.c)
25AC_CONFIG_HEADER(config.h:config.in)
413ccac7 26AM_MAINTAINER_MODE
c906108c
SS
27
28AC_PROG_CC
14abd0fb 29AC_GNU_SOURCE
c906108c
SS
30AC_AIX
31AC_ISC_POSIX
32AM_PROG_CC_STDC
33
34AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
35AC_CANONICAL_SYSTEM
36
8bb2c122
MK
37# FIXME: kettenis/20030102: The AC_PROG_RANLIB from Autoconf 2.13
38# doesn't support cross-compilation, but the one from Autoconf 2.5x
39# does. Override RANLIB here (i.e. before running AC_PROG_RANLIB) to
40# deal with the lossage. Note that CY_GNU_GETTEXT currently calls
f6e85fc8 41# AC_PROG_RANLIB. This can be removed when we switch to Autoconf
8bb2c122
MK
42# 2.5x.
43AC_CHECK_TOOL(RANLIB, ranlib, :)
44
ddc9cd0f
AC
45dnl List of object files and targets accumulated by configure.
46
47CONFIG_OBS=
48CONFIG_DEPS=
49CONFIG_SRCS=
50ENABLE_CFLAGS=
51
52CONFIG_ALL=
53CONFIG_CLEAN=
54CONFIG_INSTALL=
55CONFIG_UNINSTALL=
56
0fbb3da7 57dnl Set up for gettext. PACKAGE is used when we call bindtextdomain.
ddc9cd0f 58
c906108c 59CY_GNU_GETTEXT
ddc9cd0f
AC
60
61localedir='${datadir}/locale'
62AC_SUBST(localedir)
63
64if test "x$POSUB" != x; then
65
66 dnl Lifted from GCC's config/gettext.m4.
67 AC_MSG_CHECKING(for catalogs to be installed)
68 # Look for .po and .gmo files in the source directory.
69 CATALOGS= AC_SUBST(CATALOGS)
70 XLINGUAS=
71 for cat in $srcdir/po/*.gmo $srcdir/po/*.po; do
72 # If there aren't any .gmo files the shell will give us the
73 # literal string "../path/to/srcdir/po/*.gmo" which has to be
74 # weeded out.
75 case "$cat" in *\**)
76 continue;;
77 esac
78 # The quadruple backslash is collapsed to a double backslash
79 # by the backticks, then collapsed again by the double quotes,
80 # leaving us with one backslash in the sed expression (right
81 # before the dot that mustn't act as a wildcard).
82 cat=`echo $cat | sed -e "s!$srcdir/!!" -e "s!\\\\.po!.gmo!"`
83 lang=`echo $cat | sed -e 's!po/!!' -e "s!\\\\.gmo!!"`
84 # The user is allowed to set LINGUAS to a list of languages to
85 # install catalogs for. If it's empty that means "all of them."
86 if test "x$LINGUAS" = x; then
87 CATALOGS="$CATALOGS $cat"
88 XLINGUAS="$XLINGUAS $lang"
89 else
90 case "$LINGUAS" in *$lang*)
91 CATALOGS="$CATALOGS $cat"
92 XLINGUAS="$XLINGUAS $lang"
93 ;;
94 esac
95 fi
96 done
97 LINGUAS="$XLINGUAS"
98 AC_MSG_RESULT($LINGUAS)
99
100 CONFIG_ALL="$CONFIG_ALL all-po"
101 CONFIG_CLEAN="$CONFIG_CLEAN clean-po"
102 CONFIG_INSTALL="$CONFIG_INSTALL install-po"
103 CONFIG_UNINSTALL="$CONFIG_UNINSTALL uninstall-po"
104fi
105
106PACKAGE=gdb
107AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ])
108AC_SUBST(PACKAGE)
0fbb3da7 109
5b5d99cf
JB
110debugdir=${libdir}/debug
111
112AC_ARG_WITH(separate-debug-dir,
113[ --with-separate-debug-dir=path Look for global separate debug info in this path [LIBDIR/debug]],
114[debugdir="${withval}"])
115
116AC_DEFINE_DIR(DEBUGDIR, debugdir,
117 [Global directory for separate debug files. ])
118#AC_DEFINE_UNQUOTED(DEBUGDIR, "$debugdir"),
c906108c 119
8dcde887
MK
120AC_CONFIG_SUBDIRS(doc testsuite)
121configdirs=
96baa820 122
27e9bf90 123. $srcdir/configure.host
c906108c 124
27e9bf90 125. $srcdir/configure.tgt
c906108c 126
27e9bf90
MK
127# Fetch the default architecture and default target vector from BFD.
128targ=$target; . $srcdir/../bfd/config.bfd
5c8cc331 129
27e9bf90
MK
130# We only want the first architecture, so strip off the others if
131# there is more than one.
132targ_archs=`echo $targ_archs | sed 's/ .*//'`
5c8cc331 133
27e9bf90
MK
134if test "x$targ_archs" != x; then
135 AC_DEFINE_UNQUOTED(DEFAULT_BFD_ARCH, $targ_archs,
136 [Define to BFD's default architecture. ])
1ba607ad 137fi
27e9bf90
MK
138if test "x$targ_defvec" != x; then
139 AC_DEFINE_UNQUOTED(DEFAULT_BFD_VEC, $targ_defvec,
140 [Define to BFD's default target vector. ])
1ba607ad
AC
141fi
142
8bb2c122
MK
143AC_ARG_PROGRAM
144
627af7ea
MK
145# The CLI cannot be disabled yet, but may be in the future.
146
147# Enable CLI.
148AC_ARG_ENABLE(gdbcli,
149[ --disable-gdbcli disable command-line interface (CLI)],
150 [case $enableval in
151 yes)
152 ;;
153 no)
154 AC_MSG_ERROR([the command-line interface cannot be disabled yet]) ;;
155 *)
156 AC_MSG_ERROR([bad value $enableval for --enable-gdbcli]) ;;
157 esac],
158 [enable_gdbcli=yes])
159if test x"$enable_gdbcli" = xyes; then
160 if test -d $srcdir/cli; then
161 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_CLI_OBS)"
162 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_CLI_DEPS)"
163 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_CLI_SRCS)"
627af7ea 164 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_CLI_CFLAGS)"
627af7ea
MK
165 fi
166fi
167
168# Enable MI.
169AC_ARG_ENABLE(gdbmi,
170[ --disable-gdbmi disable machine-interface (MI)],
171 [case $enableval in
172 yes | no)
173 ;;
174 *)
175 AC_MSG_ERROR([bad value $enableval for --enable-gdbmi]) ;;
176 esac],
177 [enable_gdbmi=yes])
178if test x"$enable_gdbmi" = xyes; then
179 if test -d $srcdir/mi; then
180 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_MI_OBS)"
181 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_MI_DEPS)"
182 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_MI_SRCS)"
627af7ea 183 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_MI_CFLAGS)"
627af7ea
MK
184 fi
185fi
186
287c1a40
MK
187# Enable TUI.
188AC_ARG_ENABLE(tui,
189[ --enable-tui enable full-screen terminal user interface (TUI)],
190 [case $enableval in
191 yes | no)
192 ;;
193 *)
194 AC_MSG_ERROR([bad value $enableval for --enable-tui]) ;;
c324d747 195 esac],enable_tui=yes)
287c1a40
MK
196if test x"$enable_tui" = xyes; then
197 if test -d $srcdir/tui; then
4f0be353 198 if test "$ac_cv_search_mvwaddstr" != no; then
c324d747
AC
199 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
200 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
201 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)"
202 CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_TUI_INITS)"
203 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)"
226361c4
AC
204 CONFIG_ALL="${CONFIG_ALL} all-tui"
205 CONFIG_CLEAN="${CONFIG_CLEAN} clean-tui"
206 CONFIG_INSTALL="${CONFIG_INSTALL} install-tui"
207 CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-tui"
c324d747 208 fi
287c1a40
MK
209 fi
210fi
211
8ee53726
MK
212# Enable gdbtk.
213AC_ARG_ENABLE(gdbtk,
d28f9cdf 214[ --enable-gdbtk enable gdbtk graphical user interface (GUI)],
8ee53726
MK
215 [case $enableval in
216 yes | no)
217 ;;
218 *)
219 AC_MSG_ERROR([bad value $enableval for --enable-gdbtk]) ;;
220 esac],
221 [if test -d $srcdir/gdbtk; then
222 enable_gdbtk=yes
223 else
224 enable_gdbtk=no
225 fi])
226# We unconditionally disable gdbtk tests on selected platforms.
227case $host_os in
228 go32* | windows*)
229 AC_MSG_WARN([gdbtk isn't supported on $host; disabling])
230 enable_gdbtk=no ;;
231esac
232
0e5d83e3
JJ
233# Libunwind support.
234AC_ARG_WITH(libunwind,
235[ --with-libunwind Use libunwind frame unwinding support],
236[case "${withval}" in
237 yes) enable_libunwind=yes ;;
238 no) enable_libunwind=no ;;
239 *) AC_MSG_ERROR(bad value ${withval} for GDB with-libunwind option) ;;
240esac],[
241 AC_CHECK_HEADERS(libunwind.h)
242 AC_CHECK_HEADERS(libunwind-ia64.h)
243 if test x"$ac_cv_header_libunwind_h" = xyes -a x"$ac_cv_header_libunwind_ia64_h" = xyes; then
244 enable_libunwind=yes;
245 fi
246])
247
248if test x"$enable_libunwind" = xyes; then
249 AC_CHECK_HEADERS(libunwind.h)
250 AC_CHECK_HEADERS(libunwind-ia64.h)
251 AC_DEFINE(HAVE_LIBUNWIND, 1)
252 CONFIG_OBS="$CONFIG_OBS libunwind-frame.o"
253 CONFIG_DEPS="$CONFIG_DEPS libunwind-frame.o"
254 CONFIG_SRCS="$CONFIG_SRCS libunwind-frame.c"
255fi
256
d28f9cdf
DJ
257# Profiling support.
258AC_ARG_ENABLE(profiling,
259[ --enable-profiling enable profiling of GDB],
260 [case $enableval in
261 yes | no)
262 ;;
263 *)
264 AC_MSG_ERROR([bad value $enableval for --enable-profile]) ;;
265 esac],
266 [enable_profiling=no])
267
d9feb4e7 268AC_CHECK_FUNCS(monstartup _mcleanup)
b0b1c2c0
MK
269AC_CACHE_CHECK([for _etext], ac_cv_var__etext,
270[AC_TRY_LINK(
271[#include <stdlib.h>
272extern char _etext;
273],
274[free (&_etext);], ac_cv_var__etext=yes, ac_cv_var__etext=no)])
275if test $ac_cv_var__etext = yes; then
276 AC_DEFINE(HAVE__ETEXT, 1,
277 [Define to 1 if your system has the _etext variable. ])
278fi
d28f9cdf 279if test "$enable_profiling" = yes ; then
d9feb4e7
DJ
280 if test $ac_cv_func_monstartup = no || test $ac_cv_func__mcleanup = no; then
281 AC_MSG_ERROR(--enable-profiling requires monstartup and _mcleanup)
282 fi
d28f9cdf
DJ
283 PROFILE_CFLAGS=-pg
284 OLD_CFLAGS="$CFLAGS"
285 CFLAGS="$CFLAGS $PROFILE_CFLAGS"
286
d9feb4e7
DJ
287 AC_CACHE_CHECK([whether $CC supports -pg], ac_cv_cc_supports_pg,
288 [AC_TRY_COMPILE([], [int x;], ac_cv_cc_supports_pg=yes,
289 ac_cv_cc_supports_pg=no)])
d28f9cdf 290
d9feb4e7
DJ
291 if test $ac_cv_cc_supports_pg = no; then
292 AC_MSG_ERROR(--enable-profiling requires a compiler which supports -pg)
293 fi
d28f9cdf
DJ
294
295 CFLAGS="$OLD_CFLAGS"
296fi
297
8bb2c122
MK
298# --------------------- #
299# Checks for programs. #
300# --------------------- #
301
7a292a7a 302AC_PROG_AWK
c906108c 303AC_PROG_INSTALL
8bb2c122
MK
304AC_PROG_LN_S
305AC_PROG_RANLIB
306AC_PROG_YACC
307
c906108c 308AC_CHECK_TOOL(AR, ar)
95ca63c4
CF
309AC_CHECK_TOOL(DLLTOOL, dlltool)
310AC_CHECK_TOOL(WINDRES, windres)
c906108c 311
8bb2c122 312# Needed for GNU/Hurd.
75c6e08a
MK
313AC_CHECK_TOOL(MIG, mig)
314
9a156167
MK
315# ---------------------- #
316# Checks for libraries. #
317# ---------------------- #
318
319# We might need to link with -lm; most simulators need it.
320AC_CHECK_LIB(m, main)
321
322# We need to link with -lw to get `wctype' on Solaris before Solaris
323# 2.6. Solaris 2.6 and beyond have this function in libc, and have a
324# libw that some versions of the GNU linker cannot hanle (GNU ld 2.9.1
325# is known to have this problem). Therefore we avoid libw if we can.
326AC_CHECK_FUNC(wctype, [],
327 [AC_CHECK_LIB(w, wctype)])
328
c890192f
MK
329# Some systems (e.g. Solaris) have `gethostbyname' in libnsl.
330AC_SEARCH_LIBS(gethostbyname, nsl)
331
9a156167
MK
332# Some systems (e.g. Solaris) have `socketpair' in libsocket.
333AC_SEARCH_LIBS(socketpair, socket)
334
4f0be353
MK
335# For the TUI, we need enhanced curses functionality.
336#
337# FIXME: kettenis/20040905: We prefer ncurses over the vendor-supplied
338# curses library because the latter might not provide all the
339# functionality we need. However, this leads to problems on systems
340# where the linker searches /usr/local/lib, but the compiler doesn't
341# search /usr/local/include, if ncurses is installed in /usr/local. A
342# default installation of ncurses on alpha*-dec-osf* will lead to such
343# a situation.
344AC_SEARCH_LIBS(mvwaddstr, [ncurses cursesX curses])
345
346if test "$ac_cv_search_mvwaddstr" = no; then
347 AC_MSG_WARN([no curses library found])
348fi
349
350# Since GDB uses Readline, we need termcap functionality. In many
351# cases this will be provided by the curses library, but some systems
352# have a seperate termcap library, or no curses library at all.
287c1a40
MK
353
354case $host_os in
355 cygwin*)
356 if test -d $srcdir/libtermcap; then
357 LIBS="../libtermcap/libtermcap.a $LIBS"
358 ac_cv_search_tgetent="../libtermcap/libtermcap.a"
359 fi ;;
228a417c 360 go32* | *djgpp*)
287c1a40
MK
361 ac_cv_search_tgetent="none required"
362 ;;
287c1a40
MK
363esac
364
4f0be353
MK
365# These are the libraries checked by Readline.
366AC_SEARCH_LIBS(tgetent, [termcap tinfo curses ncurses])
287c1a40
MK
367
368if test "$ac_cv_search_tgetent" = no; then
369 AC_MSG_ERROR([no termcap library found])
370fi
371
5ee754fc
MK
372# ------------------------- #
373# Checks for header files. #
374# ------------------------- #
c906108c 375
9608ab8b 376AC_HEADER_DIRENT
5ee754fc 377AC_HEADER_STAT
c906108c 378AC_HEADER_STDC
5ee754fc 379AC_CHECK_HEADERS(link.h)
78434e59 380AC_CHECK_HEADERS(machine/reg.h)
5ee754fc
MK
381AC_CHECK_HEADERS(nlist.h)
382AC_CHECK_HEADERS(poll.h sys/poll.h)
a2f23071 383AC_CHECK_HEADERS(proc_service.h thread_db.h gnu/libc-version.h)
5ee754fc
MK
384AC_CHECK_HEADERS(stddef.h)
385AC_CHECK_HEADERS(stdlib.h)
386AC_CHECK_HEADERS(stdint.h)
387AC_CHECK_HEADERS(string.h memory.h strings.h)
388AC_CHECK_HEADERS(sys/fault.h)
389AC_CHECK_HEADERS(sys/file.h)
390AC_CHECK_HEADERS(sys/filio.h)
391AC_CHECK_HEADERS(sys/ioctl.h)
392AC_CHECK_HEADERS(sys/param.h)
393AC_CHECK_HEADERS(sys/proc.h)
394AC_CHECK_HEADERS(sys/procfs.h)
395AC_CHECK_HEADERS(sys/ptrace.h ptrace.h)
396AC_CHECK_HEADERS(sys/reg.h sys/debugreg.h)
397AC_CHECK_HEADERS(sys/select.h)
398AC_CHECK_HEADERS(sys/syscall.h)
086ec9eb 399AC_CHECK_HEADERS(sys/types.h)
5ee754fc
MK
400AC_CHECK_HEADERS(sys/user.h)
401AC_CHECK_HEADERS(sys/wait.h wait.h)
402AC_CHECK_HEADERS(termios.h termio.h sgtty.h)
403AC_CHECK_HEADERS(unistd.h)
404
b1d19a62 405# On Solaris 2.[789], we need to define _MSE_INT_H to avoid a clash
5ee754fc
MK
406# between <widec.h> and <wchar.h> that would cause AC_CHECK_HEADERS to
407# think that we don't have <curses.h> if we're using GCC.
408case $host_os in
b1d19a62 409 solaris2.[[789]])
5ee754fc
MK
410 if test "$GCC" = yes; then
411 AC_DEFINE(_MSE_INT_H, 1,
412 [[Define to 1 to avoid a clash between <widec.h> and <wchar.h> on
b1d19a62 413 Solaris 2.[789] when using GCC. ]])
5ee754fc
MK
414 fi ;;
415esac
a6ed5501 416AC_CHECK_HEADERS(curses.h cursesX.h ncurses.h ncurses/ncurses.h term.h)
5ee754fc
MK
417
418# FIXME: kettenis/20030102: In most cases we include these
419# unconditionally, so what's the point in checking these?
420AC_CHECK_HEADERS(ctype.h time.h)
421
40a7debc
EZ
422dnl Check for struct stat with an st_blocks member
423AC_MSG_CHECKING(for member st_blocks in struct stat)
424AC_CACHE_VAL(gdb_cv_have_struct_stat_with_st_blocks_member,
425 [AC_TRY_COMPILE([#include <sys/types.h>
426#include <sys/stat.h>],
427 [struct stat st; (void) st.st_blocks;],
428 gdb_cv_have_struct_stat_with_st_blocks_member=yes,
429 gdb_cv_have_struct_stat_with_st_blocks_member=no)])
430AC_MSG_RESULT($gdb_cv_have_struct_stat_with_st_blocks_member)
431if test $gdb_cv_have_struct_stat_with_st_blocks_member = yes; then
432 AC_DEFINE(HAVE_STRUCT_STAT_ST_BLOCKS)
433fi
086ec9eb 434
b9362cc7
AC
435# ------------------------- #
436# Checks for declarations. #
437# ------------------------- #
438
439gcc_AC_CHECK_DECLS(getopt)
440
5ee754fc
MK
441# ------------------ #
442# Checks for types. #
443# ------------------ #
c906108c 444
5ee754fc
MK
445AC_TYPE_SIGNAL
446
447# ------------------------------------- #
448# Checks for compiler characteristics. #
449# ------------------------------------- #
c906108c
SS
450
451AC_C_CONST
bce58c09 452AC_C_INLINE
c906108c 453
5ee754fc
MK
454# ------------------------------ #
455# Checks for library functions. #
456# ------------------------------ #
457
c906108c 458AC_FUNC_ALLOCA
97bf5e38 459AC_FUNC_MMAP
46711df8 460AC_FUNC_VFORK
97bf5e38
MK
461AC_CHECK_FUNCS(canonicalize_file_name realpath)
462AC_CHECK_FUNCS(poll)
14abd0fb 463AC_CHECK_FUNCS(pread64)
97bf5e38
MK
464AC_CHECK_FUNCS(sbrk)
465AC_CHECK_FUNCS(setpgid setpgrp)
e1ea1d75 466AC_CHECK_FUNCS(sigaction sigprocmask sigsetmask)
97bf5e38 467AC_CHECK_FUNCS(socketpair)
b757528f 468AC_CHECK_FUNCS(syscall)
bcb3dc3d 469AC_CHECK_FUNCS(ttrace)
97bf5e38 470
086ec9eb
MK
471# Check the return and argument types of ptrace. No canned test for
472# this, so roll our own.
473gdb_ptrace_headers='
474#if HAVE_SYS_TYPES_H
475# include <sys/types.h>
476#endif
477#if HAVE_SYS_PTRACE_H
478# include <sys/ptrace.h>
479#endif
480#if HAVE_UNISTD_H
481# include <unistd.h>
482#endif
483'
484# There is no point in checking if we don't have a prototype.
485gcc_AC_CHECK_DECLS(ptrace, , [
486 : ${gdb_cv_func_ptrace_ret='int'}
487 : ${gdb_cv_func_ptrace_args='int,int,long,long'}
488], $gdb_ptrace_headers)
489# Check return type.
490AC_CACHE_CHECK([return type of ptrace], gdb_cv_func_ptrace_ret,
491 AC_TRY_COMPILE($gdb_ptrace_headers,
5885ab49
MK
492 [extern int ptrace ();],
493 gdb_cv_func_ptrace_ret='int',
494 gdb_cv_func_ptrace_ret='long'))
086ec9eb
MK
495AC_DEFINE_UNQUOTED(PTRACE_TYPE_RET, $gdb_cv_func_ptrace_ret,
496 [Define as the return type of ptrace.])
497# Check argument types.
498AC_CACHE_CHECK([types of arguments for ptrace], gdb_cv_func_ptrace_args, [
499for gdb_arg1 in 'int' 'long'; do
500 for gdb_arg2 in 'pid_t' 'int' 'long'; do
501 for gdb_arg3 in 'int *' 'caddr_t' 'int' 'long'; do
502 for gdb_arg4 in 'int' 'long'; do
503 AC_TRY_COMPILE($gdb_ptrace_headers, [
504extern $gdb_cv_func_ptrace_ret
505 ptrace ($gdb_arg1, $gdb_arg2, $gdb_arg3, $gdb_arg4);
506], [gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4";
507 break 4;])
508 for gdb_arg5 in 'int *' 'int' 'long'; do
509 AC_TRY_COMPILE($gdb_ptrace_headers, [
510extern $gdb_cv_func_ptrace_ret
511 ptrace ($gdb_arg1, $gdb_arg2, $gdb_arg3, $gdb_arg4, $gdb_arg5);
512], [
513gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4,$gdb_arg5";
514 break 5;])
515 done
516 done
517 done
518 done
519done
520# Provide a safe default value.
521: ${gdb_cv_func_ptrace_args='int,int,long,long'}
522])
523ac_save_IFS=$IFS; IFS=','
524set dummy `echo "$gdb_cv_func_ptrace_args" | sed 's/\*/\*/g'`
525IFS=$ac_save_IFS
526shift
64218d3e 527AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG3, $[3],
086ec9eb
MK
528 [Define to the type of arg 3 for ptrace.])
529if test -n "$[5]"; then
64218d3e 530 AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG5, $[5],
086ec9eb
MK
531 [Define to the type of arg 5 for ptrace.])
532fi
533
72473524
DJ
534dnl AC_FUNC_SETPGRP does not work when cross compiling
535dnl Instead, assume we will have a prototype for setpgrp if cross compiling.
536if test "$cross_compiling" = no; then
537 AC_FUNC_SETPGRP
538else
539 AC_CACHE_CHECK([whether setpgrp takes no argument], ac_cv_func_setpgrp_void,
540 [AC_TRY_COMPILE([
541#include <unistd.h>
542], [
543 if (setpgrp(1,1) == -1)
544 exit (0);
545 else
546 exit (1);
547], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes)])
548if test $ac_cv_func_setpgrp_void = yes; then
549 AC_DEFINE(SETPGRP_VOID, 1)
550fi
551fi
c906108c 552
2b2d558c
MK
553# Check if sigsetjmp is available. Using AC_CHECK_FUNCS won't do
554# since sigsetjmp might only be defined as a macro.
555AC_CACHE_CHECK([for sigsetjmp], gdb_cv_func_sigsetjmp,
556[AC_TRY_COMPILE([
557#include <setjmp.h>
558], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);],
559gdb_cv_func_sigsetjmp=yes, gdb_cv_func_sigsetjmp=no)])
560if test $gdb_cv_func_sigsetjmp = yes; then
561 AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available. ])
562fi
563
06825bd1
MK
564# Assume we'll default to using the included libiberty regex.
565gdb_use_included_regex=yes
566
567# However, if the system regex is GNU regex, then default to *not*
568# using the included regex.
569AC_CACHE_CHECK(
570 [for GNU regex],
571 [gdb_cv_have_gnu_regex],
572 [AC_TRY_COMPILE(
573 [#include <gnu-versions.h>],
574 [#define REGEX_INTERFACE_VERSION 1
575#if _GNU_REGEX_INTERFACE_VERSION != REGEX_INTERFACE_VERSION
576# error "Version mismatch"
577#endif],
578 gdb_cv_have_gnu_regex=yes,
579 gdb_cv_have_gnu_regex=no)])
580if test $gdb_cv_have_gnu_regex = yes; then
581 gdb_use_included_regex=no
582fi
583
584AC_ARG_WITH(included-regex,
585 [ --without-included-regex don't use included regex; this is the default
586 on systems with version 2 of the GNU C library
587 (use with caution on other system)],
588 gdb_with_regex=$withval,
589 gdb_with_regex=$gdb_use_included_regex)
590if test "$gdb_with_regex" = yes; then
591 AC_DEFINE(USE_INCLUDED_REGEX, 1,
592 [Define to 1 if the regex included in libiberty should be used.])
593fi
594
70f9f479
MK
595# See if <sys/proc.h> defines `struct thread' with a td_pcb member.
596AC_CACHE_CHECK([for td_pcb in struct thread], gdb_cv_struct_thread_td_pcb,
d15be926
MK
597[AC_TRY_COMPILE([#include <sys/param.h>
598#include <sys/proc.h>], [struct thread td; td.td_pcb;],
70f9f479
MK
599gdb_cv_struct_thread_td_pcb=yes, gdb_cv_struct_thread_td_pcb=no)])
600if test $gdb_cv_struct_thread_td_pcb = yes; then
601 AC_DEFINE(HAVE_STRUCT_THREAD_TD_PCB, 1,
602 [Define to 1 if your system has td_pcb in struct thread.])
603fi
604
da7d81e3
NW
605# See if <sys/lwp.h> defines `struct lwp`.
606AC_CACHE_CHECK([for struct lwp], gdb_cv_struct_lwp,
607[AC_TRY_COMPILE([#include <sys/param.h>
608#include <sys/lwp.h>], [struct lwp l;],
609gdb_cv_struct_lwp=yes, gdb_cv_struct_lwp=no)])
610if test $gdb_cv_struct_lwp = yes; then
611 AC_DEFINE(HAVE_STRUCT_LWP, 1,
612 [Define to 1 if your system has struct lwp.])
613fi
614
78434e59
MK
615# See if <machine/reg.h> degines `struct reg'.
616AC_CACHE_CHECK([for struct reg in machine/reg.h], gdb_cv_struct_reg,
617[AC_TRY_COMPILE([#include <sys/types.h>
618#include <machine/reg.h>], [struct reg r;],
619gdb_cv_struct_reg=yes, gdb_cv_struct_reg=no)])
620if test $gdb_cv_struct_reg = yes; then
621 AC_DEFINE(HAVE_STRUCT_REG, 1,
622 [Define to 1 if your system has struct reg in <machine/reg.h>.])
623fi
624
0afdd437 625# See if <machine/reg.h> supports the %fs and %gs i386 segment registers.
7dfa765c 626# Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'.
422ea4b8 627AC_CACHE_CHECK([for r_fs in struct reg], gdb_cv_struct_reg_r_fs,
7dfa765c 628[AC_TRY_COMPILE([#include <machine/reg.h>], [struct reg r; r.r_fs;],
422ea4b8
MK
629gdb_cv_struct_reg_r_fs=yes, gdb_cv_struct_reg_r_fs=no)])
630if test $gdb_cv_struct_reg_r_fs = yes; then
631 AC_DEFINE(HAVE_STRUCT_REG_R_FS)
7dfa765c 632fi
422ea4b8 633AC_CACHE_CHECK([for r_gs in struct reg], gdb_cv_struct_reg_r_gs,
7dfa765c 634[AC_TRY_COMPILE([#include <machine/reg.h>], [struct reg r; r.r_gs;],
422ea4b8
MK
635gdb_cv_struct_reg_r_gs=yes, gdb_cv_struct_reg_r_gs=no)])
636if test $gdb_cv_struct_reg_r_gs = yes; then
637 AC_DEFINE(HAVE_STRUCT_REG_R_GS)
7dfa765c
MK
638fi
639
0afdd437 640# See if <sys/ptrace.h> provides the PTRACE_GETREGS request.
f60300e7
MK
641AC_MSG_CHECKING(for PTRACE_GETREGS)
642AC_CACHE_VAL(gdb_cv_have_ptrace_getregs,
643[AC_TRY_COMPILE([#include <sys/ptrace.h>],
644 [PTRACE_GETREGS;],
645 [gdb_cv_have_ptrace_getregs=yes],
646 [gdb_cv_have_ptrace_getregs=no])])
647AC_MSG_RESULT($gdb_cv_have_ptrace_getregs)
648if test $gdb_cv_have_ptrace_getregs = yes; then
649 AC_DEFINE(HAVE_PTRACE_GETREGS)
650fi
651
0afdd437 652# See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request.
6ce2ac0b
MK
653AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
654AC_CACHE_VAL(gdb_cv_have_ptrace_getfpxregs,
5c44784c 655[AC_TRY_COMPILE([#include <sys/ptrace.h>],
6ce2ac0b
MK
656 [PTRACE_GETFPXREGS;],
657 [gdb_cv_have_ptrace_getfpxregs=yes],
658 [gdb_cv_have_ptrace_getfpxregs=no])])
659AC_MSG_RESULT($gdb_cv_have_ptrace_getfpxregs)
660if test $gdb_cv_have_ptrace_getfpxregs = yes; then
661 AC_DEFINE(HAVE_PTRACE_GETFPXREGS)
5c44784c
JM
662fi
663
0afdd437
MK
664# See if <sys/ptrace.h> provides the PT_GETDBREGS request.
665AC_MSG_CHECKING(for PT_GETDBREGS)
666AC_CACHE_VAL(gdb_cv_have_pt_getdbregs,
667[AC_TRY_COMPILE([#include <sys/types.h>
668#include <sys/ptrace.h>],
669 [PT_GETDBREGS;],
670 [gdb_cv_have_pt_getdbregs=yes],
671 [gdb_cv_have_pt_getdbregs=no])])
672AC_MSG_RESULT($gdb_cv_have_pt_getdbregs)
673if test $gdb_cv_have_pt_getdbregs = yes; then
674 AC_DEFINE(HAVE_PT_GETDBREGS)
675fi
676
7e89e357
JT
677# See if <sys/ptrace.h> provides the PT_GETXMMREGS request.
678AC_MSG_CHECKING(for PT_GETXMMREGS)
679AC_CACHE_VAL(gdb_cv_have_pt_getxmmregs,
680[AC_TRY_COMPILE([#include <sys/types.h>
681#include <sys/ptrace.h>],
682 [PT_GETXMMREGS;],
683 [gdb_cv_have_pt_getxmmregs=yes],
684 [gdb_cv_have_pt_getxmmregs=no])])
685AC_MSG_RESULT($gdb_cv_have_pt_getxmmregs)
686if test $gdb_cv_have_pt_getxmmregs = yes; then
687 AC_DEFINE(HAVE_PT_GETXMMREGS)
688fi
689
27ca5dad
MC
690# See if stdint.h provides the uintptr_t type.
691# Autoconf 2.5X has an improved AC_CHECK_TYPE which will simplify this.
692AC_CACHE_CHECK([for uintptr_t in stdint.h], gdb_cv_have_uintptr_t,
693 [AC_TRY_COMPILE(
694 [#include <stdint.h>],
695 [uintptr_t foo = 0;],
696 gdb_cv_have_uintptr_t=yes,
697 gdb_cv_have_uintptr_t=no)])
27ca5dad
MC
698if test $gdb_cv_have_uintptr_t = yes; then
699 AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if <stdint.h> provides the uintptr_t type.])
700fi
0afdd437 701
c906108c
SS
702BFD_NEED_DECLARATION(malloc)
703BFD_NEED_DECLARATION(realloc)
704BFD_NEED_DECLARATION(free)
705BFD_NEED_DECLARATION(strerror)
706BFD_NEED_DECLARATION(strdup)
b83266a0 707BFD_NEED_DECLARATION(strstr)
a4db0f07 708BFD_NEED_DECLARATION(canonicalize_file_name)
c906108c
SS
709
710# The following save_state_t checkery is only necessary for HPUX
711# versions earlier than 10.20. When those fade from memory, this
712# could be expunged. --jsm 1999-03-22
713
714AC_MSG_CHECKING(for HPUX save_state structure)
715AC_EGREP_HEADER(save_state_t, machine/save_state.h,
716 gdb_cv_hpux_savestate=yes, gdb_cv_hpux_savestate=no)
717AC_EGREP_HEADER(ss_wide, machine/save_state.h, gdb_cv_hpux_sswide=yes,
718 gdb_cv_hpux_sswide=no)
719if test $gdb_cv_hpux_savestate = yes
720then
721 AC_DEFINE(HAVE_STRUCT_SAVE_STATE_T, 1)
722fi
723if test $gdb_cv_hpux_sswide = yes
724then
725 AC_DEFINE(HAVE_STRUCT_MEMBER_SS_WIDE, 1)
726fi
727AC_MSG_RESULT($gdb_cv_hpux_sswide)
728
729
730# If we are configured native on GNU/Linux, work around problems with
731# sys/procfs.h
c3f6f71d 732# Also detect which type of /proc is in use, such as for Unixware or Solaris.
c906108c
SS
733
734if test "${target}" = "${host}"; then
735 case "${host}" in
736 i[[3456]]86-*-linux*)
737 AC_DEFINE(START_INFERIOR_TRAPS_EXPECTED,2)
738 AC_DEFINE(sys_quotactl)
739 ;;
596c9d4b
KB
740 ia64-*-aix*)
741 AC_DEFINE(NEW_PROC_API)
742 ;;
1045b512 743 *-*-unixware* | *-*-sysv4.2* | *-*-sysv5* | *-*-interix* )
c3f6f71d
JM
744 AC_DEFINE(NEW_PROC_API)
745 ;;
e7c61be3 746 *-*-solaris2.[[6789]])
c3f6f71d
JM
747 AC_DEFINE(NEW_PROC_API)
748 ;;
c960c18f
AC
749 mips-sgi-irix5*)
750 # Work around <sys/proc.h> needing _KMEMUSER problem on IRIX 5.
751 AC_DEFINE([_KMEMUSER], 1)
752 ;;
c906108c 753 esac
c906108c
SS
754fi
755
756if test "$ac_cv_header_sys_procfs_h" = yes; then
757 BFD_HAVE_SYS_PROCFS_TYPE(pstatus_t)
758 BFD_HAVE_SYS_PROCFS_TYPE(prrun_t)
759 BFD_HAVE_SYS_PROCFS_TYPE(gregset_t)
760 BFD_HAVE_SYS_PROCFS_TYPE(fpregset_t)
83d37ec8
MK
761 BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
762 BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t)
23e04971
MS
763 BFD_HAVE_SYS_PROCFS_TYPE(prgregset32_t)
764 BFD_HAVE_SYS_PROCFS_TYPE(prfpregset32_t)
83d37ec8
MK
765 BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
766 BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
596c9d4b
KB
767 BFD_HAVE_SYS_PROCFS_TYPE(prsysent_t)
768 BFD_HAVE_SYS_PROCFS_TYPE(pr_sigset_t)
769 BFD_HAVE_SYS_PROCFS_TYPE(pr_sigaction64_t)
770 BFD_HAVE_SYS_PROCFS_TYPE(pr_siginfo64_t)
c906108c 771
23e04971 772
d84dd0c5
MK
773 dnl Check for broken prfpregset_t type
774
775 dnl For Linux/i386, glibc 2.1.3 was released with a bogus
776 dnl prfpregset_t type (it's a typedef for the pointer to a struct
777 dnl instead of the struct itself). We detect this here, and work
a3007b6f 778 dnl around it in gdb_proc_service.h.
d84dd0c5
MK
779
780 if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then
781 AC_MSG_CHECKING(whether prfpregset_t type is broken)
782 AC_CACHE_VAL(gdb_cv_prfpregset_t_broken,
783 [AC_TRY_RUN([#include <sys/procfs.h>
784 int main ()
785 {
786 if (sizeof (prfpregset_t) == sizeof (void *))
787 return 1;
788 return 0;
789 }],
790 gdb_cv_prfpregset_t_broken=no,
791 gdb_cv_prfpregset_t_broken=yes,
792 gdb_cv_prfpregset_t_broken=yes)])
793 AC_MSG_RESULT($gdb_cv_prfpregset_t_broken)
794 if test $gdb_cv_prfpregset_t_broken = yes; then
795 AC_DEFINE(PRFPREGSET_T_BROKEN)
796 fi
797 fi
798
c906108c
SS
799 dnl Check for PIOCSET ioctl entry
800
801 AC_MSG_CHECKING(for PIOCSET ioctl entry in sys/procfs.h)
802 AC_CACHE_VAL(gdb_cv_have_procfs_piocset,
803 [AC_TRY_COMPILE([#include <unistd.h>
804#include <sys/types.h>
805#include <sys/procfs.h>
806], [
807 int dummy;;
808 dummy = ioctl(0, PIOCSET, &dummy);
809 ],
810 gdb_cv_have_procfs_piocset=yes, gdb_cv_have_procfs_piocset=no)])
811 AC_MSG_RESULT($gdb_cv_have_procfs_piocset)
812 if test $gdb_cv_have_procfs_piocset = yes; then
813 AC_DEFINE(HAVE_PROCFS_PIOCSET)
814 fi
815fi
816
d45fe813
KB
817dnl For native ports (host == target), check to see what kind of
818dnl legacy link.h support is needed. (See solib-legacy.c.)
819if test ${host} = ${target} ; then
820 dnl Check for struct link_map with l_ members which are indicative
821 dnl of SVR4-like shared libraries
822
823 AC_MSG_CHECKING(for member l_addr in struct link_map)
824 AC_CACHE_VAL(gdb_cv_have_struct_link_map_with_l_members,
825 [AC_TRY_COMPILE([#include <link.h>],
826 [struct link_map lm; (void) lm.l_addr;],
827 gdb_cv_have_struct_link_map_with_l_members=yes,
828 gdb_cv_have_struct_link_map_with_l_members=no)])
829 AC_MSG_RESULT($gdb_cv_have_struct_link_map_with_l_members)
830 if test $gdb_cv_have_struct_link_map_with_l_members = yes; then
831 AC_DEFINE(HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS)
832 fi
833
834 dnl Check for struct link_map with lm_ members which are indicative
835 dnl of SunOS-like shared libraries
836
837 AC_MSG_CHECKING(for member lm_addr in struct link_map)
838 AC_CACHE_VAL(gdb_cv_have_struct_link_map_with_lm_members,
839 [AC_TRY_COMPILE([#include <sys/types.h>
840#include <link.h>],
841 [struct link_map lm; (void) lm.lm_addr;],
842 gdb_cv_have_struct_link_map_with_lm_members=yes,
843 gdb_cv_have_struct_link_map_with_lm_members=no)])
844 AC_MSG_RESULT($gdb_cv_have_struct_link_map_with_lm_members)
845 if test $gdb_cv_have_struct_link_map_with_lm_members = yes; then
846 AC_DEFINE(HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS)
847 fi
848
849 dnl Check for struct so_map with som_ members which are found on
850 dnl some *BSD systems.
851
852 AC_MSG_CHECKING(for member som_addr in struct so_map)
853 AC_CACHE_VAL(gdb_cv_have_struct_so_map_with_som_members,
854 [AC_TRY_COMPILE([#include <sys/types.h>
39812ceb
C
855#ifdef HAVE_NLIST_H
856#include <nlist.h>
857#endif
d45fe813
KB
858#include <link.h>],
859 [struct so_map lm; (void) lm.som_addr;],
860 gdb_cv_have_struct_so_map_with_som_members=yes,
861 gdb_cv_have_struct_so_map_with_som_members=no)])
862 AC_MSG_RESULT($gdb_cv_have_struct_so_map_with_som_members)
863 if test $gdb_cv_have_struct_so_map_with_som_members = yes; then
864 AC_DEFINE(HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS)
865 fi
866
867 dnl Check for struct link_map32 type, which allows a 64-bit Solaris
868 dnl debugger to debug a 32-bit Solaris app with 32-bit shared libraries.
869
870 AC_MSG_CHECKING(for struct link_map32 in sys/link.h)
871 AC_CACHE_VAL(gdb_cv_have_struct_link_map32,
872 [AC_TRY_COMPILE([#define _SYSCALL32
873#include <sys/link.h>], [struct link_map32 l;],
874 gdb_cv_have_struct_link_map32=yes,
875 gdb_cv_have_struct_link_map32=no)])
876 AC_MSG_RESULT($gdb_cv_have_struct_link_map32)
877 if test $gdb_cv_have_struct_link_map32 = yes; then
878 AC_DEFINE(HAVE_STRUCT_LINK_MAP32)
943c9c25 879 AC_DEFINE(_SYSCALL32)
d45fe813
KB
880 fi
881fi
882
c906108c
SS
883dnl See if compiler supports "long long" type.
884
885AC_MSG_CHECKING(for long long support in compiler)
886AC_CACHE_VAL(gdb_cv_c_long_long,
887[AC_TRY_COMPILE(, [
888 extern long long foo;
889 switch (foo & 2) { case 0: return 1; }
890],
891gdb_cv_c_long_long=yes, gdb_cv_c_long_long=no)])
892AC_MSG_RESULT($gdb_cv_c_long_long)
893if test $gdb_cv_c_long_long = yes; then
894 AC_DEFINE(CC_HAS_LONG_LONG)
895fi
896
897dnl See if the compiler and runtime support printing long long
898
899AC_MSG_CHECKING(for long long support in printf)
900AC_CACHE_VAL(gdb_cv_printf_has_long_long,
901[AC_TRY_RUN([
902int main () {
903 char buf[32];
904 long long l = 0;
905 l = (l << 16) + 0x0123;
906 l = (l << 16) + 0x4567;
907 l = (l << 16) + 0x89ab;
908 l = (l << 16) + 0xcdef;
909 sprintf (buf, "0x%016llx", l);
910 return (strcmp ("0x0123456789abcdef", buf));
911}],
912gdb_cv_printf_has_long_long=yes,
913gdb_cv_printf_has_long_long=no,
914gdb_cv_printf_has_long_long=no)])
915if test $gdb_cv_printf_has_long_long = yes; then
916 AC_DEFINE(PRINTF_HAS_LONG_LONG)
917fi
918AC_MSG_RESULT($gdb_cv_printf_has_long_long)
919
920dnl See if compiler supports "long double" type. Can't use AC_C_LONG_DOUBLE
921dnl because autoconf complains about cross-compilation issues. However, this
922dnl code uses the same variables as the macro for compatibility.
923
924AC_MSG_CHECKING(for long double support in compiler)
925AC_CACHE_VAL(ac_cv_c_long_double,
926[AC_TRY_COMPILE(, [long double foo;],
927ac_cv_c_long_double=yes, ac_cv_c_long_double=no)])
928AC_MSG_RESULT($ac_cv_c_long_double)
929if test $ac_cv_c_long_double = yes; then
930 AC_DEFINE(HAVE_LONG_DOUBLE)
931fi
932
933dnl See if the compiler and runtime support printing long doubles
934
935AC_MSG_CHECKING(for long double support in printf)
936AC_CACHE_VAL(gdb_cv_printf_has_long_double,
937[AC_TRY_RUN([
938int main () {
939 char buf[16];
940 long double f = 3.141592653;
941 sprintf (buf, "%Lg", f);
942 return (strncmp ("3.14159", buf, 7));
943}],
944gdb_cv_printf_has_long_double=yes,
945gdb_cv_printf_has_long_double=no,
946gdb_cv_printf_has_long_double=no)])
947if test $gdb_cv_printf_has_long_double = yes; then
948 AC_DEFINE(PRINTF_HAS_LONG_DOUBLE)
949fi
950AC_MSG_RESULT($gdb_cv_printf_has_long_double)
951
952dnl See if the compiler and runtime support scanning long doubles
953
954AC_MSG_CHECKING(for long double support in scanf)
955AC_CACHE_VAL(gdb_cv_scanf_has_long_double,
956[AC_TRY_RUN([
957int main () {
958 char *buf = "3.141592653";
959 long double f = 0;
960 sscanf (buf, "%Lg", &f);
961 return !(f > 3.14159 && f < 3.14160);
962}],
963gdb_cv_scanf_has_long_double=yes,
964gdb_cv_scanf_has_long_double=no,
965gdb_cv_scanf_has_long_double=no)])
966if test $gdb_cv_scanf_has_long_double = yes; then
967 AC_DEFINE(SCANF_HAS_LONG_DOUBLE)
968fi
969AC_MSG_RESULT($gdb_cv_scanf_has_long_double)
970
438013df
AO
971case ${host_os} in
972aix*)
973 AC_CACHE_CHECK([for -bbigtoc option], [gdb_cv_bigtoc], [
974 SAVE_LDFLAGS=$LDFLAGS
975
976 case $GCC in
977 yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
978 *) gdb_cv_bigtoc=-bbigtoc ;;
979 esac
980
981 LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
982 AC_TRY_LINK([], [int i;], [], [gdb_cv_bigtoc=])
ec76baa5 983 LDFLAGS="${SAVE_LDFLAGS}"
438013df
AO
984 ])
985 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} ${gdb_cv_bigtoc}"
986 ;;
987esac
988
c906108c 989
d92419e5
JB
990dnl For certain native configurations, we need to check whether thread
991dnl support can be built in or not.
992dnl
993dnl Note that we only want this if we are both native (host == target),
994dnl and not doing a canadian cross build (build == host).
c906108c
SS
995
996if test ${build} = ${host} -a ${host} = ${target} ; then
997 case ${host_os} in
998 hpux*)
999 AC_MSG_CHECKING(for HPUX/OSF thread support)
1000 if test -f /usr/include/dce/cma_config.h ; then
1001 if test "$GCC" = "yes" ; then
1002 AC_MSG_RESULT(yes)
1003 AC_DEFINE(HAVE_HPUX_THREAD_SUPPORT)
3483b318 1004 CONFIG_OBS="${CONFIG_OBS} hpux-thread.o"
c906108c
SS
1005 CONFIG_SRCS="${CONFIG_SRCS} hpux-thread.c"
1006 else
1007 AC_MSG_RESULT(no (suppressed because you are not using GCC))
1008 fi
1009 else
1010 AC_MSG_RESULT(no)
1011 fi
1012 ;;
1013 solaris*)
d92419e5
JB
1014 # See if thread_db library is around for Solaris thread debugging.
1015 # Note that we must explicitly test for version 1 of the library
1016 # because version 0 (present on Solaris 2.4 or earlier) doesn't have
1017 # the same API.
c906108c
SS
1018 AC_MSG_CHECKING(for Solaris thread debugging library)
1019 if test -f /usr/lib/libthread_db.so.1 ; then
1020 AC_MSG_RESULT(yes)
1021 AC_DEFINE(HAVE_THREAD_DB_LIB)
3483b318 1022 CONFIG_OBS="${CONFIG_OBS} sol-thread.o"
c906108c
SS
1023 CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c"
1024 AC_CHECK_LIB(dl, dlopen)
1025 if test "$GCC" = "yes" ; then
1026 # The GNU linker requires the -export-dynamic option to make
1027 # all symbols visible in the dynamic symbol table.
1028 hold_ldflags=$LDFLAGS
1029 AC_MSG_CHECKING(for the ld -export-dynamic flag)
1030 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
1031 AC_TRY_LINK(, [int i;], found=yes, found=no)
1032 LDFLAGS=$hold_ldflags
1033 AC_MSG_RESULT($found)
1034 if test $found = yes; then
1035 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Wl,-export-dynamic"
1036 fi
1037 fi
1038 # Sun randomly tweaked the prototypes in <proc_service.h>
1039 # at one point.
1040 AC_MSG_CHECKING(if <proc_service.h> is old)
1041 AC_CACHE_VAL(gdb_cv_proc_service_is_old,[
1042 AC_TRY_COMPILE([
1043 #include <proc_service.h>
1044 ps_err_e ps_pdwrite
1045 (struct ps_prochandle*, psaddr_t, const void*, size_t);
1046 ],, gdb_cv_proc_service_is_old=no,
1047 gdb_cv_proc_service_is_old=yes)
1048 ])
1049 AC_MSG_RESULT($gdb_cv_proc_service_is_old)
1050 if test $gdb_cv_proc_service_is_old = yes; then
1051 AC_DEFINE(PROC_SERVICE_IS_OLD)
1052 fi
1053 else
1054 AC_MSG_RESULT(no)
1055 fi
1056 ;;
d92419e5
JB
1057 aix*)
1058 AC_MSG_CHECKING(for AiX thread debugging library)
1059 AC_CACHE_VAL(gdb_cv_have_aix_thread_debug,
1060 [AC_TRY_COMPILE([#include <sys/pthdebug.h>],
1061 [#ifndef PTHDB_VERSION_3
1062 #error
1063 #endif],
1064 gdb_cv_have_aix_thread_debug=yes,
1065 gdb_cv_have_aix_thread_debug=no)])
1066 AC_MSG_RESULT($gdb_cv_have_aix_thread_debug)
1067 if test $gdb_cv_have_aix_thread_debug = yes; then
1068 CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c"
3483b318 1069 CONFIG_OBS="${CONFIG_OBS} aix-thread.o"
d92419e5
JB
1070 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -lpthdebug"
1071 fi
1072 ;;
c906108c
SS
1073 esac
1074 AC_SUBST(CONFIG_LDFLAGS)
1075fi
1076
3f47be5c
EZ
1077dnl See if we have a thread_db header file that has TD_NOTALLOC.
1078if test "x$ac_cv_header_thread_db_h" = "xyes"; then
1079 AC_CACHE_CHECK([whether <thread_db.h> has TD_NOTALLOC],
1080 gdb_cv_thread_db_h_has_td_notalloc,
1081 AC_TRY_COMPILE(
1082 [#include <thread_db.h>],
1083 [int i = TD_NOTALLOC;],
1084 gdb_cv_thread_db_h_has_td_notalloc=yes,
1085 gdb_cv_thread_db_h_has_td_notalloc=no
1086 )
1087 )
1088fi
1089if test "x$gdb_cv_thread_db_h_has_td_notalloc" = "xyes"; then
1090 AC_DEFINE(THREAD_DB_HAS_TD_NOTALLOC, 1,
1091 [Define if <thread_db.h> has the TD_NOTALLOC error code.])
1092fi
1093
b757528f
JJ
1094dnl See if we have a sys/syscall header file that has __NR_tkill.
1095if test "x$ac_cv_header_sys_syscall_h" = "xyes"; then
1096 AC_CACHE_CHECK([whether <sys/syscall.h> has __NR_tkill],
1097 gdb_cv_sys_syscall_h_has_tkill,
1098 AC_TRY_COMPILE(
1099 [#include <sys/syscall.h>],
1100 [int i = __NR_tkill;],
1101 gdb_cv_sys_syscall_h_has_tkill=yes,
1102 gdb_cv_sys_syscall_h_has_tkill=no
1103 )
1104 )
1105fi
1106dnl See if we can issue tkill syscall.
1107if test "x$gdb_cv_sys_syscall_h_has_tkill" = "xyes" && test "x$ac_cv_func_syscall" = "xyes"; then
1108 AC_DEFINE(HAVE_TKILL_SYSCALL, 1,
1109 [Define if we can use the tkill syscall.])
1110fi
1111
c906108c 1112dnl Handle optional features that can be enabled.
fb40c209 1113
030292b7
DJ
1114AC_ARG_WITH(sysroot,
1115[ --with-sysroot[=DIR] Search for usr/lib et al within DIR.],
1116[
1117 case ${with_sysroot} in
715d1656 1118 yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_alias}/sys-root' ;;
030292b7
DJ
1119 *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
1120 esac
1121
1122 TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
1123
1124 if test "x$exec_prefix" = xNONE; then
1125 if test "x$prefix" = xNONE; then
1126 test_prefix=/usr/local
1127 else
1128 test_prefix=$prefix
1129 fi
1130 else
1131 test_prefix=$exec_prefix
1132 fi
1133 case ${TARGET_SYSTEM_ROOT} in
715d1656
AO
1134 "${test_prefix}"|"${test_prefix}/"*|\
1135 '${exec_prefix}'|'${exec_prefix}/'*)
030292b7
DJ
1136 t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
1137 TARGET_SYSTEM_ROOT_DEFINE="$t"
1138 ;;
1139 esac
1140], [
1141 TARGET_SYSTEM_ROOT=
1142 TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"\"'
1143])
1144AC_SUBST(TARGET_SYSTEM_ROOT)
1145AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
1146
3b851bce
AC
1147# NOTE: Don't add -Wall or -Wunused, they both include
1148# -Wunused-parameter which reports bogus warnings.
1149# NOTE: If you add to this list, remember to update
1150# gdb/doc/gdbint.texinfo.
1decb323 1151build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
0f0cffd2 1152-Wformat -Wparentheses -Wpointer-arith -Wuninitialized -Wformat-nonliteral \
4566dfcf 1153-Wunused-label -Wunused-function"
d8038014 1154# Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs
0f0cffd2 1155# -Wunused-function -Wunused-variable -Wunused-value
93d56215 1156# -Wchar-subscripts -Wtraditional -Wshadow -Wcast-qual
d8038014
AC
1157# -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes
1158# -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls
1159# -Woverloaded-virtual -Winline -Werror"
c906108c
SS
1160AC_ARG_ENABLE(build-warnings,
1161[ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
1decb323 1162[case "${enableval}" in
c906108c
SS
1163 yes) ;;
1164 no) build_warnings="-w";;
1165 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1166 build_warnings="${build_warnings} ${t}";;
1167 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1168 build_warnings="${t} ${build_warnings}";;
1169 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
d4f3574e
SS
1170esac
1171if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
746a987d 1172 echo "Setting compiler warning flags = $build_warnings" 6>&1
1decb323 1173fi])dnl
3b851bce
AC
1174AC_ARG_ENABLE(gdb-build-warnings,
1175[ --enable-gdb-build-warnings Enable GDB specific build-time compiler warnings if gcc is used],
1176[case "${enableval}" in
1177 yes) ;;
1178 no) build_warnings="-w";;
1179 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1180 build_warnings="${build_warnings} ${t}";;
1181 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1182 build_warnings="${t} ${build_warnings}";;
1183 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
1184esac
1185if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
1186 echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1
1187fi])dnl
104c1213
JM
1188WARN_CFLAGS=""
1189WERROR_CFLAGS=""
c906108c
SS
1190if test "x${build_warnings}" != x -a "x$GCC" = xyes
1191then
746a987d
AC
1192 AC_MSG_CHECKING(compiler warning flags)
1193 # Separate out the -Werror flag as some files just cannot be
1194 # compiled with it enabled.
1195 for w in ${build_warnings}; do
1196 case $w in
1197 -Werr*) WERROR_CFLAGS=-Werror ;;
1198 *) # Check that GCC accepts it
4536bbc6
AC
1199 saved_CFLAGS="$CFLAGS"
1200 CFLAGS="$CFLAGS $w"
1201 AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
1202 CFLAGS="$saved_CFLAGS"
746a987d
AC
1203 esac
1204 done
1205 AC_MSG_RESULT(${WARN_CFLAGS}${WERROR_CFLAGS})
1decb323 1206fi
c906108c 1207AC_SUBST(WARN_CFLAGS)
104c1213 1208AC_SUBST(WERROR_CFLAGS)
c906108c 1209
7a292a7a
SS
1210# In the Cygwin environment, we need some additional flags.
1211AC_CACHE_CHECK([for cygwin], gdb_cv_os_cygwin,
1212[AC_EGREP_CPP(lose, [
1213#if defined (__CYGWIN__) || defined (__CYGWIN32__)
1214lose
1215#endif],[gdb_cv_os_cygwin=yes],[gdb_cv_os_cygwin=no])])
1216
aff38e61
AC
1217
1218dnl Figure out which of the many generic ser-*.c files the _host_ supports.
1219SER_HARDWIRE="ser-unix.o ser-pipe.o ser-tcp.o"
1220case ${host} in
95cbc983
AC
1221 *go32* ) SER_HARDWIRE=ser-go32.o ;;
1222 *djgpp* ) SER_HARDWIRE=ser-go32.o ;;
aff38e61
AC
1223esac
1224AC_SUBST(SER_HARDWIRE)
1225
cd0fc7c3
SS
1226# libreadline needs libuser32.a in a cygwin environment
1227WIN32LIBS=
1228if test x$gdb_cv_os_cygwin = xyes; then
c5394b80
JM
1229 WIN32LIBS="-luser32"
1230 case "${target}" in
1231 *cygwin*) WIN32LIBS="$WIN32LIBS -limagehlp"
1232 ;;
1233 esac
cd0fc7c3
SS
1234fi
1235AC_SUBST(WIN32LIBS)
7a292a7a 1236
3fc11d3e
JM
1237LIBGUI="../libgui/src/libgui.a"
1238GUI_CFLAGS_X="-I${srcdir}/../libgui/src"
1239AC_SUBST(LIBGUI)
1240AC_SUBST(GUI_CFLAGS_X)
7a292a7a 1241
3fc11d3e
JM
1242WIN32LDAPP=
1243AC_SUBST(WIN32LIBS)
1244AC_SUBST(WIN32LDAPP)
1245
d91670b9
CV
1246case "${host}" in
1247*-*-cygwin*)
1248 configdir="win"
1249 ;;
1250*)
1251 configdir="unix"
1252 ;;
1253esac
3fc11d3e
JM
1254
1255GDBTKLIBS=
1256if test "${enable_gdbtk}" = "yes"; then
1257
d1c3b63a
KS
1258 # Gdbtk must have an absolute path to srcdir in order to run
1259 # properly when not installed.
1260 here=`pwd`
1261 cd ${srcdir}
1262 GDBTK_SRC_DIR=`pwd`
1263 cd $here
1264
3fc11d3e
JM
1265 CY_AC_PATH_TCLCONFIG
1266 if test -z "${no_tcl}"; then
1267 CY_AC_LOAD_TCLCONFIG
1268 CY_AC_PATH_TKCONFIG
1269
dd2504ab
JM
1270 # now look for Tcl library stuff
1271
d91670b9 1272 tcldir="../tcl/${configdir}/"
dd2504ab
JM
1273
1274 TCL_DEPS="${tcldir}${TCL_LIB_FILE}"
1275
3fc11d3e
JM
1276 # If $no_tk is nonempty, then we can't do Tk, and there is no
1277 # point to doing Tcl.
1278 if test -z "${no_tk}"; then
1279 CY_AC_LOAD_TKCONFIG
1280 CY_AC_PATH_TCLH
1281 CY_AC_PATH_TKH
1282 CY_AC_PATH_ITCLH
1283 CY_AC_PATH_ITKH
3fc11d3e 1284
dd2504ab
JM
1285
1286 # now look for Tk library stuff
1287
d91670b9 1288 tkdir="../tk/${configdir}/"
dd2504ab
JM
1289
1290 TK_DEPS="${tkdir}${TK_LIB_FILE}"
1291
3fc11d3e
JM
1292 # now look for Itcl library stuff
1293
1294 CY_AC_PATH_ITCLCONFIG
1295 if test -z "${no_itcl}"; then
b381d62d 1296 CY_AC_LOAD_ITCLCONFIG
3fc11d3e
JM
1297
1298 ITCLLIB="${ITCL_BUILD_LIB_SPEC}"
b381d62d 1299 ITCL_DEPS="${ITCL_LIB_FULL_PATH}"
3fc11d3e
JM
1300 fi
1301
1302
1303 # now look for Itk library stuff
1304 CY_AC_PATH_ITKCONFIG
1305 if test -z "${no_itcl}"; then
1306 CY_AC_LOAD_ITKCONFIG
1307
3fc11d3e 1308 ITKLIB="${ITK_BUILD_LIB_SPEC}"
b381d62d 1309 ITK_DEPS="${ITK_LIB_FULL_PATH}"
3fc11d3e
JM
1310 fi
1311
4226a5a5 1312 ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_GDBTK_CFLAGS)"
3fc11d3e
JM
1313 # Tcl/Tk 8.1 require -fwritable strings. I don't
1314 # know whether 8.2 will or not, but I bet it will.
1315 # I don't have to worry about 7.x since we don't support it.
1316 GDBTK_CFLAGS=""
1317 if test "$GCC" = "yes"; then
1318 if test "$TCL_VERSION" != "8.0" ; then
1319 GDBTK_CFLAGS="-fwritable-strings"
1320 fi
1321 fi
1322
1323 # Include some libraries that Tcl and Tk want.
b2a1bd4f 1324 TCL_LIBS='$(LIBGUI) $(ITCL) $(ITK) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
3fc11d3e
JM
1325 # Yes, the ordering seems wrong here. But it isn't.
1326 # TK_LIBS is the list of libraries that need to be linked
1327 # after Tcl/Tk. Note that this isn't put into LIBS. If it
1328 # were in LIBS then any link tests after this point would
1329 # try to include things like `$(LIBGUI)', which wouldn't work.
1330 GDBTKLIBS="${TCL_LIBS} ${TK_LIBS}"
4226a5a5
FN
1331
1332 CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_GDBTK_OBS)"
1333 CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_GDBTK_DEPS)"
1334 CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_GDBTK_SRCS)"
33f8ca73
AC
1335 CONFIG_ALL="${CONFIG_ALL} all-gdbtk"
1336 CONFIG_CLEAN="${CONFIG_CLEAN} clean-gdbtk"
1337 CONFIG_INSTALL="${CONFIG_INSTALL} install-gdbtk"
1338 CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-gdbtk"
3fc11d3e
JM
1339
1340 if test x$gdb_cv_os_cygwin = xyes; then
1341 WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32"
1342 WIN32LDAPP="-Wl,--subsystem,console"
1343 CONFIG_OBS="${CONFIG_OBS} gdbres.o"
1344 fi
1345 fi
1346 fi
ffc6a242 1347
ffc6a242 1348 configdirs="${configdirs} gdbtk"
3fc11d3e
JM
1349fi
1350
3fc11d3e
JM
1351AC_SUBST(X_CFLAGS)
1352AC_SUBST(X_LDFLAGS)
1353AC_SUBST(X_LIBS)
dd2504ab
JM
1354AC_SUBST(TCL_DEPS)
1355AC_SUBST(TK_DEPS)
3fc11d3e
JM
1356AC_SUBST(ITCLLIB)
1357AC_SUBST(ITCL_DEPS)
1358AC_SUBST(ITKLIB)
1359AC_SUBST(ITK_DEPS)
3fc11d3e
JM
1360AC_SUBST(GDBTKLIBS)
1361AC_SUBST(GDBTK_CFLAGS)
d1c3b63a 1362AC_SUBST(GDBTK_SRC_DIR)
8b93c638 1363
c906108c
SS
1364AC_PATH_X
1365
7a292a7a
SS
1366
1367# Unlike the sim directory, whether a simulator is linked is controlled by
1368# presence of a SIM= and a SIM_OBS= definition in the target '.mt' file.
1369# This code just checks for a few cases where we'd like to ignore those
1370# definitions, even when they're present in the '.mt' file. These cases
1371# are when --disable-sim is specified, or if the simulator directory is
6c5cfe5b 1372# not part of the source tree.
7a292a7a
SS
1373#
1374AC_ARG_ENABLE(sim,
1375[ --enable-sim Link gdb with simulator],
1376[echo "enable_sim = $enable_sim";
1377 echo "enableval = ${enableval}";
1378 case "${enableval}" in
1379 yes) ignore_sim=false ;;
1380 no) ignore_sim=true ;;
1381 *) ignore_sim=false ;;
1382 esac],
1383[ignore_sim=false])
1384
1385if test ! -d "${srcdir}/../sim"; then
1386 ignore_sim=true
1387fi
1388
1389if test "${ignore_sim}" = "true"; then
1390 IGNORE_SIM="SIM="
1391 IGNORE_SIM_OBS="SIM_OBS="
1392else
1393 IGNORE_SIM=""
1394 IGNORE_SIM_OBS=""
1395 AC_DEFINE(WITH_SIM)
1396fi
1397AC_SUBST(IGNORE_SIM)
1398AC_SUBST(IGNORE_SIM_OBS)
1399
c906108c 1400AC_SUBST(ENABLE_CFLAGS)
d28f9cdf 1401AC_SUBST(PROFILE_CFLAGS)
c906108c
SS
1402
1403AC_SUBST(CONFIG_OBS)
1404AC_SUBST(CONFIG_DEPS)
1405AC_SUBST(CONFIG_SRCS)
b3a90332
AC
1406AC_SUBST(CONFIG_ALL)
1407AC_SUBST(CONFIG_CLEAN)
e56ac5c3
AC
1408AC_SUBST(CONFIG_INSTALL)
1409AC_SUBST(CONFIG_UNINSTALL)
c906108c 1410
c35f4ffc
AC
1411# List of host floatformats.
1412AC_DEFINE_UNQUOTED(GDB_HOST_FLOAT_FORMAT,$gdb_host_float_format,[Host float floatformat])
1413AC_DEFINE_UNQUOTED(GDB_HOST_DOUBLE_FORMAT,$gdb_host_double_format,[Host double floatformat])
1414AC_DEFINE_UNQUOTED(GDB_HOST_LONG_DOUBLE_FORMAT,$gdb_host_long_double_format,[Host long double floatformat])
1415
c906108c
SS
1416# target_subdir is used by the testsuite to find the target libraries.
1417target_subdir=
1418if test "${host}" != "${target}"; then
1419 target_subdir="${target_alias}/"
1420fi
1421AC_SUBST(target_subdir)
1422
1423frags=
1424host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
1425if test ! -f ${host_makefile_frag}; then
7fd60527
AC
1426 # When building a native debuger the .mh file containing things
1427 # like NATDEPFILES is needed. Cross debuggers don't need .mh
1428 # since it no longer contains anything useful.
1429 if test "${target}" = "${host}"; then
1430 AC_MSG_ERROR("*** Gdb does not support native target ${host}")
1431 else
1432 host_makefile_frag=/dev/null
1433 fi
c906108c
SS
1434fi
1435frags="$frags $host_makefile_frag"
1436
1437target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
1438if test ! -f ${target_makefile_frag}; then
1439AC_MSG_ERROR("*** Gdb does not support target ${target}")
1440fi
1441frags="$frags $target_makefile_frag"
1442
1443AC_SUBST_FILE(host_makefile_frag)
1444AC_SUBST_FILE(target_makefile_frag)
1445AC_SUBST(frags)
1446
1447changequote(,)dnl
1448hostfile=`sed -n '
1449s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
1450' ${host_makefile_frag}`
1451
1452targetfile=`sed -n '
2c0fc042 1453s/DEPRECATED_TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
c906108c
SS
1454' ${target_makefile_frag}`
1455
c906108c 1456if test "${target}" = "${host}"; then
a85f51e7
DJ
1457# We pick this up from the host configuration file (.mh) because we
1458# do not have a native configuration Makefile fragment.
c906108c
SS
1459nativefile=`sed -n '
1460s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
1461' ${host_makefile_frag}`
c906108c
SS
1462fi
1463changequote([,])
1464
b00a8037
DJ
1465if test x"${gdb_osabi}" != x ; then
1466 AC_DEFINE_UNQUOTED(GDB_OSABI_DEFAULT, $gdb_osabi,
1467 [Define to the default OS ABI for this configuration.])
1468fi
1469
8dcde887
MK
1470# Enable multi-ice-gdb-server.
1471AC_ARG_ENABLE(multi-ice,
1472[ --enable-multi-ice build the multi-ice-gdb-server],
1473 [case $enableval in
1474 yes | no)
1475 ;;
1476 *) AC_MSG_ERROR([bad value $enableval for --enable-multi-ice]) ;;
1477 esac])
1478if test "x$enable_multi_ice" = xyes; then
1479 configdirs="$configdirs multi-ice"
96baa820
JM
1480fi
1481
8dcde887
MK
1482# We only build gdbserver automatically if host and target are the same.
1483if test "x$target" = "x$host"; then
1484 AC_MSG_CHECKING(whether gdbserver is supported on this host)
1485 if test "x$build_gdbserver" = xyes; then
1486 configdirs="$configdirs gdbserver"
1487 AC_MSG_RESULT(yes)
1488 else
1489 AC_MSG_RESULT(no)
1490 fi
a85f51e7
DJ
1491fi
1492
8dcde887 1493AC_CONFIG_SUBDIRS($configdirs)
96baa820 1494
2c0fc042
AC
1495# If hostfile (XM_FILE) and/or targetfile (DEPRECATED_TM_FILE) and/or
1496# nativefile (NAT_FILE) is not set in config/*/*.m[ht] files, we link
1497# to an empty version.
c906108c
SS
1498
1499files=
1500links=
5a2402b8 1501
c906108c 1502rm -f xm.h
5a2402b8 1503xm_h=""
c906108c 1504if test "${hostfile}" != ""; then
5a2402b8 1505 xm_h=xm.h
0f475e27
AC
1506 case "${hostfile}" in
1507 xm-*.h ) GDB_XM_FILE="config/${gdb_host_cpu}/${hostfile}" ;;
1508 * ) GDB_XM_FILE="${hostfile}"
1509 esac
5a2402b8
AC
1510 files="${files} ${GDB_XM_FILE}"
1511 links="${links} xm.h"
b78960be 1512 AC_DEFINE_UNQUOTED(GDB_XM_FILE, "${GDB_XM_FILE}")
c906108c 1513fi
5a2402b8
AC
1514AC_SUBST(xm_h)
1515
c906108c 1516rm -f tm.h
5a2402b8 1517tm_h=""
c906108c 1518if test "${targetfile}" != ""; then
5a2402b8 1519 tm_h=tm.h
0f475e27 1520 case "${targetfile}" in
b8c4aece 1521 tm-*.h ) GDB_TM_FILE="config/${gdb_target_cpu}/${targetfile}" ;;
0f475e27
AC
1522 * ) GDB_TM_FILE="${targetfile}"
1523 esac
5a2402b8
AC
1524 files="${files} ${GDB_TM_FILE}"
1525 links="${links} tm.h"
b78960be 1526 AC_DEFINE_UNQUOTED(GDB_TM_FILE, "${GDB_TM_FILE}")
c906108c 1527fi
5a2402b8
AC
1528AC_SUBST(tm_h)
1529
c906108c 1530rm -f nm.h
5a2402b8 1531nm_h=""
c906108c 1532if test "${nativefile}" != ""; then
5a2402b8 1533 nm_h=nm.h
0f475e27
AC
1534 case "${nativefile}" in
1535 nm-*.h ) GDB_NM_FILE="config/${gdb_host_cpu}/${nativefile}" ;;
1536 * ) GDB_NM_FILE="${nativefile}"
1537 esac
5a2402b8
AC
1538 files="${files} ${GDB_NM_FILE}"
1539 links="${links} nm.h"
b78960be 1540 AC_DEFINE_UNQUOTED(GDB_NM_FILE, "${GDB_NM_FILE}")
c906108c 1541fi
5a2402b8
AC
1542AC_SUBST(nm_h)
1543
c906108c
SS
1544AC_LINK_FILES($files, $links)
1545
1546dnl Check for exe extension set on certain hosts (e.g. Win32)
1547AC_EXEEXT
1548
234b45d4
KB
1549dnl Detect the character set used by this host.
1550
1551dnl At the moment, we just assume it's ISO-8859-1 (which is a
1552dnl superset of ASCII containing the characters needed for French,
1553dnl German, Spanish, Italian, and possibly others), but if were
1554dnl *were* to support any host character sets other than ISO-8859-1,
1555dnl here's where we'd detect it.
1556AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "ISO-8859-1",
1557 [Define to be a string naming the default host character set.])
1558
1559AM_ICONV
1560
ed952ac5 1561AC_OUTPUT(Makefile .gdbinit:gdbinit.in,
c906108c
SS
1562[
1563dnl Autoconf doesn't provide a mechanism for modifying definitions
1564dnl provided by makefile fragments.
1565dnl
7ee6d7eb 1566if test "${nativefile}" = ""; then
c4620205 1567 < Makefile \
e27da16d
JT
1568 sed -e '/^NATDEPFILES[[ ]]*=.*\\$/,/[[^\\]]$/s/^/# /' \
1569 -e '/^NATDEPFILES[[ ]]*=/s/^/# /' \
c4620205
JB
1570 | sed -e '/^\(NATDEPFILES[[ ]]*[[+]]=[[ ]]*\)/s//# \1/' \
1571 > Makefile.tem
c906108c
SS
1572mv -f Makefile.tem Makefile
1573fi
1574
1575changequote(,)dnl
2c0fc042 1576sed -e '/^DEPRECATED_TM_FILE[ ]*=/s,^DEPRECATED_TM_FILE[ ]*=[ ]*,&config/'"${gdb_target_cpu}"'/,
c906108c
SS
1577/^XM_FILE[ ]*=/s,^XM_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,
1578/^NAT_FILE[ ]*=/s,^NAT_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
1579mv -f Makefile.tmp Makefile
1580changequote([,])dnl
1581
2acceee2 1582
c906108c
SS
1583case x$CONFIG_HEADERS in
1584xconfig.h:config.in)
1585echo > stamp-h ;;
1586esac
1587],
1588[
1589gdb_host_cpu=$gdb_host_cpu
1590gdb_target_cpu=$gdb_target_cpu
1591nativefile=$nativefile
1592])
1593
1594exit 0
This page took 0.417263 seconds and 4 git commands to generate.