2004-09-29 Andrew Cagney <cagney@gnu.org>
[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
8b9cf735 198 if test "$ac_cv_search_waddstr" != 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.
8b9cf735 344AC_SEARCH_LIBS(waddstr, [ncurses cursesX curses])
4f0be353 345
8b9cf735 346if test "$ac_cv_search_waddstr" = no; then
4f0be353
MK
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)
8b9cf735 470AC_CHECK_FUNCS(wborder)
97bf5e38 471
086ec9eb
MK
472# Check the return and argument types of ptrace. No canned test for
473# this, so roll our own.
474gdb_ptrace_headers='
475#if HAVE_SYS_TYPES_H
476# include <sys/types.h>
477#endif
478#if HAVE_SYS_PTRACE_H
479# include <sys/ptrace.h>
480#endif
481#if HAVE_UNISTD_H
482# include <unistd.h>
483#endif
484'
485# There is no point in checking if we don't have a prototype.
486gcc_AC_CHECK_DECLS(ptrace, , [
487 : ${gdb_cv_func_ptrace_ret='int'}
488 : ${gdb_cv_func_ptrace_args='int,int,long,long'}
489], $gdb_ptrace_headers)
490# Check return type.
491AC_CACHE_CHECK([return type of ptrace], gdb_cv_func_ptrace_ret,
492 AC_TRY_COMPILE($gdb_ptrace_headers,
5885ab49
MK
493 [extern int ptrace ();],
494 gdb_cv_func_ptrace_ret='int',
495 gdb_cv_func_ptrace_ret='long'))
086ec9eb
MK
496AC_DEFINE_UNQUOTED(PTRACE_TYPE_RET, $gdb_cv_func_ptrace_ret,
497 [Define as the return type of ptrace.])
498# Check argument types.
499AC_CACHE_CHECK([types of arguments for ptrace], gdb_cv_func_ptrace_args, [
500for gdb_arg1 in 'int' 'long'; do
501 for gdb_arg2 in 'pid_t' 'int' 'long'; do
502 for gdb_arg3 in 'int *' 'caddr_t' 'int' 'long'; do
503 for gdb_arg4 in 'int' 'long'; do
504 AC_TRY_COMPILE($gdb_ptrace_headers, [
505extern $gdb_cv_func_ptrace_ret
506 ptrace ($gdb_arg1, $gdb_arg2, $gdb_arg3, $gdb_arg4);
507], [gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4";
508 break 4;])
509 for gdb_arg5 in 'int *' 'int' 'long'; do
510 AC_TRY_COMPILE($gdb_ptrace_headers, [
511extern $gdb_cv_func_ptrace_ret
512 ptrace ($gdb_arg1, $gdb_arg2, $gdb_arg3, $gdb_arg4, $gdb_arg5);
513], [
514gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4,$gdb_arg5";
515 break 5;])
516 done
517 done
518 done
519 done
520done
521# Provide a safe default value.
522: ${gdb_cv_func_ptrace_args='int,int,long,long'}
523])
524ac_save_IFS=$IFS; IFS=','
525set dummy `echo "$gdb_cv_func_ptrace_args" | sed 's/\*/\*/g'`
526IFS=$ac_save_IFS
527shift
64218d3e 528AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG3, $[3],
086ec9eb
MK
529 [Define to the type of arg 3 for ptrace.])
530if test -n "$[5]"; then
64218d3e 531 AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG5, $[5],
086ec9eb
MK
532 [Define to the type of arg 5 for ptrace.])
533fi
534
72473524
DJ
535dnl AC_FUNC_SETPGRP does not work when cross compiling
536dnl Instead, assume we will have a prototype for setpgrp if cross compiling.
537if test "$cross_compiling" = no; then
538 AC_FUNC_SETPGRP
539else
540 AC_CACHE_CHECK([whether setpgrp takes no argument], ac_cv_func_setpgrp_void,
541 [AC_TRY_COMPILE([
542#include <unistd.h>
543], [
544 if (setpgrp(1,1) == -1)
545 exit (0);
546 else
547 exit (1);
548], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes)])
549if test $ac_cv_func_setpgrp_void = yes; then
550 AC_DEFINE(SETPGRP_VOID, 1)
551fi
552fi
c906108c 553
2b2d558c
MK
554# Check if sigsetjmp is available. Using AC_CHECK_FUNCS won't do
555# since sigsetjmp might only be defined as a macro.
556AC_CACHE_CHECK([for sigsetjmp], gdb_cv_func_sigsetjmp,
557[AC_TRY_COMPILE([
558#include <setjmp.h>
559], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);],
560gdb_cv_func_sigsetjmp=yes, gdb_cv_func_sigsetjmp=no)])
561if test $gdb_cv_func_sigsetjmp = yes; then
562 AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available. ])
563fi
564
06825bd1
MK
565# Assume we'll default to using the included libiberty regex.
566gdb_use_included_regex=yes
567
568# However, if the system regex is GNU regex, then default to *not*
569# using the included regex.
570AC_CACHE_CHECK(
571 [for GNU regex],
572 [gdb_cv_have_gnu_regex],
573 [AC_TRY_COMPILE(
574 [#include <gnu-versions.h>],
575 [#define REGEX_INTERFACE_VERSION 1
576#if _GNU_REGEX_INTERFACE_VERSION != REGEX_INTERFACE_VERSION
577# error "Version mismatch"
578#endif],
579 gdb_cv_have_gnu_regex=yes,
580 gdb_cv_have_gnu_regex=no)])
581if test $gdb_cv_have_gnu_regex = yes; then
582 gdb_use_included_regex=no
583fi
584
585AC_ARG_WITH(included-regex,
586 [ --without-included-regex don't use included regex; this is the default
587 on systems with version 2 of the GNU C library
588 (use with caution on other system)],
589 gdb_with_regex=$withval,
590 gdb_with_regex=$gdb_use_included_regex)
591if test "$gdb_with_regex" = yes; then
592 AC_DEFINE(USE_INCLUDED_REGEX, 1,
593 [Define to 1 if the regex included in libiberty should be used.])
594fi
595
70f9f479
MK
596# See if <sys/proc.h> defines `struct thread' with a td_pcb member.
597AC_CACHE_CHECK([for td_pcb in struct thread], gdb_cv_struct_thread_td_pcb,
d15be926
MK
598[AC_TRY_COMPILE([#include <sys/param.h>
599#include <sys/proc.h>], [struct thread td; td.td_pcb;],
70f9f479
MK
600gdb_cv_struct_thread_td_pcb=yes, gdb_cv_struct_thread_td_pcb=no)])
601if test $gdb_cv_struct_thread_td_pcb = yes; then
602 AC_DEFINE(HAVE_STRUCT_THREAD_TD_PCB, 1,
603 [Define to 1 if your system has td_pcb in struct thread.])
604fi
605
da7d81e3
NW
606# See if <sys/lwp.h> defines `struct lwp`.
607AC_CACHE_CHECK([for struct lwp], gdb_cv_struct_lwp,
608[AC_TRY_COMPILE([#include <sys/param.h>
609#include <sys/lwp.h>], [struct lwp l;],
610gdb_cv_struct_lwp=yes, gdb_cv_struct_lwp=no)])
611if test $gdb_cv_struct_lwp = yes; then
612 AC_DEFINE(HAVE_STRUCT_LWP, 1,
613 [Define to 1 if your system has struct lwp.])
614fi
615
78434e59
MK
616# See if <machine/reg.h> degines `struct reg'.
617AC_CACHE_CHECK([for struct reg in machine/reg.h], gdb_cv_struct_reg,
618[AC_TRY_COMPILE([#include <sys/types.h>
619#include <machine/reg.h>], [struct reg r;],
620gdb_cv_struct_reg=yes, gdb_cv_struct_reg=no)])
621if test $gdb_cv_struct_reg = yes; then
622 AC_DEFINE(HAVE_STRUCT_REG, 1,
623 [Define to 1 if your system has struct reg in <machine/reg.h>.])
624fi
625
0afdd437 626# See if <machine/reg.h> supports the %fs and %gs i386 segment registers.
7dfa765c 627# Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'.
422ea4b8 628AC_CACHE_CHECK([for r_fs in struct reg], gdb_cv_struct_reg_r_fs,
7dfa765c 629[AC_TRY_COMPILE([#include <machine/reg.h>], [struct reg r; r.r_fs;],
422ea4b8
MK
630gdb_cv_struct_reg_r_fs=yes, gdb_cv_struct_reg_r_fs=no)])
631if test $gdb_cv_struct_reg_r_fs = yes; then
632 AC_DEFINE(HAVE_STRUCT_REG_R_FS)
7dfa765c 633fi
422ea4b8 634AC_CACHE_CHECK([for r_gs in struct reg], gdb_cv_struct_reg_r_gs,
7dfa765c 635[AC_TRY_COMPILE([#include <machine/reg.h>], [struct reg r; r.r_gs;],
422ea4b8
MK
636gdb_cv_struct_reg_r_gs=yes, gdb_cv_struct_reg_r_gs=no)])
637if test $gdb_cv_struct_reg_r_gs = yes; then
638 AC_DEFINE(HAVE_STRUCT_REG_R_GS)
7dfa765c
MK
639fi
640
0afdd437 641# See if <sys/ptrace.h> provides the PTRACE_GETREGS request.
f60300e7
MK
642AC_MSG_CHECKING(for PTRACE_GETREGS)
643AC_CACHE_VAL(gdb_cv_have_ptrace_getregs,
644[AC_TRY_COMPILE([#include <sys/ptrace.h>],
645 [PTRACE_GETREGS;],
646 [gdb_cv_have_ptrace_getregs=yes],
647 [gdb_cv_have_ptrace_getregs=no])])
648AC_MSG_RESULT($gdb_cv_have_ptrace_getregs)
649if test $gdb_cv_have_ptrace_getregs = yes; then
650 AC_DEFINE(HAVE_PTRACE_GETREGS)
651fi
652
0afdd437 653# See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request.
6ce2ac0b
MK
654AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
655AC_CACHE_VAL(gdb_cv_have_ptrace_getfpxregs,
5c44784c 656[AC_TRY_COMPILE([#include <sys/ptrace.h>],
6ce2ac0b
MK
657 [PTRACE_GETFPXREGS;],
658 [gdb_cv_have_ptrace_getfpxregs=yes],
659 [gdb_cv_have_ptrace_getfpxregs=no])])
660AC_MSG_RESULT($gdb_cv_have_ptrace_getfpxregs)
661if test $gdb_cv_have_ptrace_getfpxregs = yes; then
662 AC_DEFINE(HAVE_PTRACE_GETFPXREGS)
5c44784c
JM
663fi
664
0afdd437
MK
665# See if <sys/ptrace.h> provides the PT_GETDBREGS request.
666AC_MSG_CHECKING(for PT_GETDBREGS)
667AC_CACHE_VAL(gdb_cv_have_pt_getdbregs,
668[AC_TRY_COMPILE([#include <sys/types.h>
669#include <sys/ptrace.h>],
670 [PT_GETDBREGS;],
671 [gdb_cv_have_pt_getdbregs=yes],
672 [gdb_cv_have_pt_getdbregs=no])])
673AC_MSG_RESULT($gdb_cv_have_pt_getdbregs)
674if test $gdb_cv_have_pt_getdbregs = yes; then
675 AC_DEFINE(HAVE_PT_GETDBREGS)
676fi
677
7e89e357
JT
678# See if <sys/ptrace.h> provides the PT_GETXMMREGS request.
679AC_MSG_CHECKING(for PT_GETXMMREGS)
680AC_CACHE_VAL(gdb_cv_have_pt_getxmmregs,
681[AC_TRY_COMPILE([#include <sys/types.h>
682#include <sys/ptrace.h>],
683 [PT_GETXMMREGS;],
684 [gdb_cv_have_pt_getxmmregs=yes],
685 [gdb_cv_have_pt_getxmmregs=no])])
686AC_MSG_RESULT($gdb_cv_have_pt_getxmmregs)
687if test $gdb_cv_have_pt_getxmmregs = yes; then
688 AC_DEFINE(HAVE_PT_GETXMMREGS)
689fi
690
27ca5dad
MC
691# See if stdint.h provides the uintptr_t type.
692# Autoconf 2.5X has an improved AC_CHECK_TYPE which will simplify this.
693AC_CACHE_CHECK([for uintptr_t in stdint.h], gdb_cv_have_uintptr_t,
694 [AC_TRY_COMPILE(
695 [#include <stdint.h>],
696 [uintptr_t foo = 0;],
697 gdb_cv_have_uintptr_t=yes,
698 gdb_cv_have_uintptr_t=no)])
27ca5dad
MC
699if test $gdb_cv_have_uintptr_t = yes; then
700 AC_DEFINE(HAVE_UINTPTR_T, 1, [Define if <stdint.h> provides the uintptr_t type.])
701fi
0afdd437 702
c906108c
SS
703BFD_NEED_DECLARATION(malloc)
704BFD_NEED_DECLARATION(realloc)
705BFD_NEED_DECLARATION(free)
706BFD_NEED_DECLARATION(strerror)
707BFD_NEED_DECLARATION(strdup)
b83266a0 708BFD_NEED_DECLARATION(strstr)
a4db0f07 709BFD_NEED_DECLARATION(canonicalize_file_name)
c906108c
SS
710
711# The following save_state_t checkery is only necessary for HPUX
712# versions earlier than 10.20. When those fade from memory, this
713# could be expunged. --jsm 1999-03-22
714
715AC_MSG_CHECKING(for HPUX save_state structure)
716AC_EGREP_HEADER(save_state_t, machine/save_state.h,
717 gdb_cv_hpux_savestate=yes, gdb_cv_hpux_savestate=no)
718AC_EGREP_HEADER(ss_wide, machine/save_state.h, gdb_cv_hpux_sswide=yes,
719 gdb_cv_hpux_sswide=no)
720if test $gdb_cv_hpux_savestate = yes
721then
722 AC_DEFINE(HAVE_STRUCT_SAVE_STATE_T, 1)
723fi
724if test $gdb_cv_hpux_sswide = yes
725then
726 AC_DEFINE(HAVE_STRUCT_MEMBER_SS_WIDE, 1)
727fi
728AC_MSG_RESULT($gdb_cv_hpux_sswide)
729
730
731# If we are configured native on GNU/Linux, work around problems with
732# sys/procfs.h
c3f6f71d 733# Also detect which type of /proc is in use, such as for Unixware or Solaris.
c906108c
SS
734
735if test "${target}" = "${host}"; then
736 case "${host}" in
737 i[[3456]]86-*-linux*)
738 AC_DEFINE(START_INFERIOR_TRAPS_EXPECTED,2)
739 AC_DEFINE(sys_quotactl)
740 ;;
596c9d4b
KB
741 ia64-*-aix*)
742 AC_DEFINE(NEW_PROC_API)
743 ;;
1045b512 744 *-*-unixware* | *-*-sysv4.2* | *-*-sysv5* | *-*-interix* )
c3f6f71d
JM
745 AC_DEFINE(NEW_PROC_API)
746 ;;
e7c61be3 747 *-*-solaris2.[[6789]])
c3f6f71d
JM
748 AC_DEFINE(NEW_PROC_API)
749 ;;
c960c18f
AC
750 mips-sgi-irix5*)
751 # Work around <sys/proc.h> needing _KMEMUSER problem on IRIX 5.
752 AC_DEFINE([_KMEMUSER], 1)
753 ;;
c906108c 754 esac
c906108c
SS
755fi
756
757if test "$ac_cv_header_sys_procfs_h" = yes; then
758 BFD_HAVE_SYS_PROCFS_TYPE(pstatus_t)
759 BFD_HAVE_SYS_PROCFS_TYPE(prrun_t)
760 BFD_HAVE_SYS_PROCFS_TYPE(gregset_t)
761 BFD_HAVE_SYS_PROCFS_TYPE(fpregset_t)
83d37ec8
MK
762 BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
763 BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t)
23e04971
MS
764 BFD_HAVE_SYS_PROCFS_TYPE(prgregset32_t)
765 BFD_HAVE_SYS_PROCFS_TYPE(prfpregset32_t)
83d37ec8
MK
766 BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
767 BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
596c9d4b
KB
768 BFD_HAVE_SYS_PROCFS_TYPE(prsysent_t)
769 BFD_HAVE_SYS_PROCFS_TYPE(pr_sigset_t)
770 BFD_HAVE_SYS_PROCFS_TYPE(pr_sigaction64_t)
771 BFD_HAVE_SYS_PROCFS_TYPE(pr_siginfo64_t)
c906108c 772
23e04971 773
d84dd0c5
MK
774 dnl Check for broken prfpregset_t type
775
776 dnl For Linux/i386, glibc 2.1.3 was released with a bogus
777 dnl prfpregset_t type (it's a typedef for the pointer to a struct
778 dnl instead of the struct itself). We detect this here, and work
a3007b6f 779 dnl around it in gdb_proc_service.h.
d84dd0c5
MK
780
781 if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then
782 AC_MSG_CHECKING(whether prfpregset_t type is broken)
783 AC_CACHE_VAL(gdb_cv_prfpregset_t_broken,
784 [AC_TRY_RUN([#include <sys/procfs.h>
785 int main ()
786 {
787 if (sizeof (prfpregset_t) == sizeof (void *))
788 return 1;
789 return 0;
790 }],
791 gdb_cv_prfpregset_t_broken=no,
792 gdb_cv_prfpregset_t_broken=yes,
793 gdb_cv_prfpregset_t_broken=yes)])
794 AC_MSG_RESULT($gdb_cv_prfpregset_t_broken)
795 if test $gdb_cv_prfpregset_t_broken = yes; then
796 AC_DEFINE(PRFPREGSET_T_BROKEN)
797 fi
798 fi
799
c906108c
SS
800 dnl Check for PIOCSET ioctl entry
801
802 AC_MSG_CHECKING(for PIOCSET ioctl entry in sys/procfs.h)
803 AC_CACHE_VAL(gdb_cv_have_procfs_piocset,
804 [AC_TRY_COMPILE([#include <unistd.h>
805#include <sys/types.h>
806#include <sys/procfs.h>
807], [
808 int dummy;;
809 dummy = ioctl(0, PIOCSET, &dummy);
810 ],
811 gdb_cv_have_procfs_piocset=yes, gdb_cv_have_procfs_piocset=no)])
812 AC_MSG_RESULT($gdb_cv_have_procfs_piocset)
813 if test $gdb_cv_have_procfs_piocset = yes; then
814 AC_DEFINE(HAVE_PROCFS_PIOCSET)
815 fi
816fi
817
d45fe813
KB
818dnl For native ports (host == target), check to see what kind of
819dnl legacy link.h support is needed. (See solib-legacy.c.)
820if test ${host} = ${target} ; then
821 dnl Check for struct link_map with l_ members which are indicative
822 dnl of SVR4-like shared libraries
823
824 AC_MSG_CHECKING(for member l_addr in struct link_map)
825 AC_CACHE_VAL(gdb_cv_have_struct_link_map_with_l_members,
826 [AC_TRY_COMPILE([#include <link.h>],
827 [struct link_map lm; (void) lm.l_addr;],
828 gdb_cv_have_struct_link_map_with_l_members=yes,
829 gdb_cv_have_struct_link_map_with_l_members=no)])
830 AC_MSG_RESULT($gdb_cv_have_struct_link_map_with_l_members)
831 if test $gdb_cv_have_struct_link_map_with_l_members = yes; then
832 AC_DEFINE(HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS)
833 fi
834
835 dnl Check for struct link_map with lm_ members which are indicative
836 dnl of SunOS-like shared libraries
837
838 AC_MSG_CHECKING(for member lm_addr in struct link_map)
839 AC_CACHE_VAL(gdb_cv_have_struct_link_map_with_lm_members,
840 [AC_TRY_COMPILE([#include <sys/types.h>
841#include <link.h>],
842 [struct link_map lm; (void) lm.lm_addr;],
843 gdb_cv_have_struct_link_map_with_lm_members=yes,
844 gdb_cv_have_struct_link_map_with_lm_members=no)])
845 AC_MSG_RESULT($gdb_cv_have_struct_link_map_with_lm_members)
846 if test $gdb_cv_have_struct_link_map_with_lm_members = yes; then
847 AC_DEFINE(HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS)
848 fi
849
850 dnl Check for struct so_map with som_ members which are found on
851 dnl some *BSD systems.
852
853 AC_MSG_CHECKING(for member som_addr in struct so_map)
854 AC_CACHE_VAL(gdb_cv_have_struct_so_map_with_som_members,
855 [AC_TRY_COMPILE([#include <sys/types.h>
39812ceb
C
856#ifdef HAVE_NLIST_H
857#include <nlist.h>
858#endif
d45fe813
KB
859#include <link.h>],
860 [struct so_map lm; (void) lm.som_addr;],
861 gdb_cv_have_struct_so_map_with_som_members=yes,
862 gdb_cv_have_struct_so_map_with_som_members=no)])
863 AC_MSG_RESULT($gdb_cv_have_struct_so_map_with_som_members)
864 if test $gdb_cv_have_struct_so_map_with_som_members = yes; then
865 AC_DEFINE(HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS)
866 fi
867
868 dnl Check for struct link_map32 type, which allows a 64-bit Solaris
869 dnl debugger to debug a 32-bit Solaris app with 32-bit shared libraries.
870
871 AC_MSG_CHECKING(for struct link_map32 in sys/link.h)
872 AC_CACHE_VAL(gdb_cv_have_struct_link_map32,
873 [AC_TRY_COMPILE([#define _SYSCALL32
874#include <sys/link.h>], [struct link_map32 l;],
875 gdb_cv_have_struct_link_map32=yes,
876 gdb_cv_have_struct_link_map32=no)])
877 AC_MSG_RESULT($gdb_cv_have_struct_link_map32)
878 if test $gdb_cv_have_struct_link_map32 = yes; then
879 AC_DEFINE(HAVE_STRUCT_LINK_MAP32)
943c9c25 880 AC_DEFINE(_SYSCALL32)
d45fe813
KB
881 fi
882fi
883
c906108c
SS
884dnl See if compiler supports "long long" type.
885
886AC_MSG_CHECKING(for long long support in compiler)
887AC_CACHE_VAL(gdb_cv_c_long_long,
888[AC_TRY_COMPILE(, [
889 extern long long foo;
890 switch (foo & 2) { case 0: return 1; }
891],
892gdb_cv_c_long_long=yes, gdb_cv_c_long_long=no)])
893AC_MSG_RESULT($gdb_cv_c_long_long)
894if test $gdb_cv_c_long_long = yes; then
895 AC_DEFINE(CC_HAS_LONG_LONG)
896fi
897
898dnl See if the compiler and runtime support printing long long
899
900AC_MSG_CHECKING(for long long support in printf)
901AC_CACHE_VAL(gdb_cv_printf_has_long_long,
902[AC_TRY_RUN([
903int main () {
904 char buf[32];
905 long long l = 0;
906 l = (l << 16) + 0x0123;
907 l = (l << 16) + 0x4567;
908 l = (l << 16) + 0x89ab;
909 l = (l << 16) + 0xcdef;
910 sprintf (buf, "0x%016llx", l);
911 return (strcmp ("0x0123456789abcdef", buf));
912}],
913gdb_cv_printf_has_long_long=yes,
914gdb_cv_printf_has_long_long=no,
915gdb_cv_printf_has_long_long=no)])
916if test $gdb_cv_printf_has_long_long = yes; then
917 AC_DEFINE(PRINTF_HAS_LONG_LONG)
918fi
919AC_MSG_RESULT($gdb_cv_printf_has_long_long)
920
921dnl See if compiler supports "long double" type. Can't use AC_C_LONG_DOUBLE
922dnl because autoconf complains about cross-compilation issues. However, this
923dnl code uses the same variables as the macro for compatibility.
924
925AC_MSG_CHECKING(for long double support in compiler)
926AC_CACHE_VAL(ac_cv_c_long_double,
927[AC_TRY_COMPILE(, [long double foo;],
928ac_cv_c_long_double=yes, ac_cv_c_long_double=no)])
929AC_MSG_RESULT($ac_cv_c_long_double)
930if test $ac_cv_c_long_double = yes; then
931 AC_DEFINE(HAVE_LONG_DOUBLE)
932fi
933
934dnl See if the compiler and runtime support printing long doubles
935
936AC_MSG_CHECKING(for long double support in printf)
937AC_CACHE_VAL(gdb_cv_printf_has_long_double,
938[AC_TRY_RUN([
939int main () {
940 char buf[16];
941 long double f = 3.141592653;
942 sprintf (buf, "%Lg", f);
943 return (strncmp ("3.14159", buf, 7));
944}],
945gdb_cv_printf_has_long_double=yes,
946gdb_cv_printf_has_long_double=no,
947gdb_cv_printf_has_long_double=no)])
948if test $gdb_cv_printf_has_long_double = yes; then
949 AC_DEFINE(PRINTF_HAS_LONG_DOUBLE)
950fi
951AC_MSG_RESULT($gdb_cv_printf_has_long_double)
952
953dnl See if the compiler and runtime support scanning long doubles
954
955AC_MSG_CHECKING(for long double support in scanf)
956AC_CACHE_VAL(gdb_cv_scanf_has_long_double,
957[AC_TRY_RUN([
958int main () {
959 char *buf = "3.141592653";
960 long double f = 0;
961 sscanf (buf, "%Lg", &f);
962 return !(f > 3.14159 && f < 3.14160);
963}],
964gdb_cv_scanf_has_long_double=yes,
965gdb_cv_scanf_has_long_double=no,
966gdb_cv_scanf_has_long_double=no)])
967if test $gdb_cv_scanf_has_long_double = yes; then
968 AC_DEFINE(SCANF_HAS_LONG_DOUBLE)
969fi
970AC_MSG_RESULT($gdb_cv_scanf_has_long_double)
971
438013df
AO
972case ${host_os} in
973aix*)
974 AC_CACHE_CHECK([for -bbigtoc option], [gdb_cv_bigtoc], [
975 SAVE_LDFLAGS=$LDFLAGS
976
977 case $GCC in
978 yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
979 *) gdb_cv_bigtoc=-bbigtoc ;;
980 esac
981
982 LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
983 AC_TRY_LINK([], [int i;], [], [gdb_cv_bigtoc=])
ec76baa5 984 LDFLAGS="${SAVE_LDFLAGS}"
438013df
AO
985 ])
986 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} ${gdb_cv_bigtoc}"
987 ;;
988esac
989
c906108c 990
d92419e5
JB
991dnl For certain native configurations, we need to check whether thread
992dnl support can be built in or not.
993dnl
994dnl Note that we only want this if we are both native (host == target),
995dnl and not doing a canadian cross build (build == host).
c906108c
SS
996
997if test ${build} = ${host} -a ${host} = ${target} ; then
998 case ${host_os} in
999 hpux*)
1000 AC_MSG_CHECKING(for HPUX/OSF thread support)
1001 if test -f /usr/include/dce/cma_config.h ; then
1002 if test "$GCC" = "yes" ; then
1003 AC_MSG_RESULT(yes)
1004 AC_DEFINE(HAVE_HPUX_THREAD_SUPPORT)
3483b318 1005 CONFIG_OBS="${CONFIG_OBS} hpux-thread.o"
c906108c
SS
1006 CONFIG_SRCS="${CONFIG_SRCS} hpux-thread.c"
1007 else
1008 AC_MSG_RESULT(no (suppressed because you are not using GCC))
1009 fi
1010 else
1011 AC_MSG_RESULT(no)
1012 fi
1013 ;;
1014 solaris*)
d92419e5
JB
1015 # See if thread_db library is around for Solaris thread debugging.
1016 # Note that we must explicitly test for version 1 of the library
1017 # because version 0 (present on Solaris 2.4 or earlier) doesn't have
1018 # the same API.
c906108c
SS
1019 AC_MSG_CHECKING(for Solaris thread debugging library)
1020 if test -f /usr/lib/libthread_db.so.1 ; then
1021 AC_MSG_RESULT(yes)
1022 AC_DEFINE(HAVE_THREAD_DB_LIB)
3483b318 1023 CONFIG_OBS="${CONFIG_OBS} sol-thread.o"
c906108c
SS
1024 CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c"
1025 AC_CHECK_LIB(dl, dlopen)
1026 if test "$GCC" = "yes" ; then
1027 # The GNU linker requires the -export-dynamic option to make
1028 # all symbols visible in the dynamic symbol table.
1029 hold_ldflags=$LDFLAGS
1030 AC_MSG_CHECKING(for the ld -export-dynamic flag)
1031 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
1032 AC_TRY_LINK(, [int i;], found=yes, found=no)
1033 LDFLAGS=$hold_ldflags
1034 AC_MSG_RESULT($found)
1035 if test $found = yes; then
1036 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Wl,-export-dynamic"
1037 fi
1038 fi
1039 # Sun randomly tweaked the prototypes in <proc_service.h>
1040 # at one point.
1041 AC_MSG_CHECKING(if <proc_service.h> is old)
1042 AC_CACHE_VAL(gdb_cv_proc_service_is_old,[
1043 AC_TRY_COMPILE([
1044 #include <proc_service.h>
1045 ps_err_e ps_pdwrite
1046 (struct ps_prochandle*, psaddr_t, const void*, size_t);
1047 ],, gdb_cv_proc_service_is_old=no,
1048 gdb_cv_proc_service_is_old=yes)
1049 ])
1050 AC_MSG_RESULT($gdb_cv_proc_service_is_old)
1051 if test $gdb_cv_proc_service_is_old = yes; then
1052 AC_DEFINE(PROC_SERVICE_IS_OLD)
1053 fi
1054 else
1055 AC_MSG_RESULT(no)
1056 fi
1057 ;;
d92419e5
JB
1058 aix*)
1059 AC_MSG_CHECKING(for AiX thread debugging library)
1060 AC_CACHE_VAL(gdb_cv_have_aix_thread_debug,
1061 [AC_TRY_COMPILE([#include <sys/pthdebug.h>],
1062 [#ifndef PTHDB_VERSION_3
1063 #error
1064 #endif],
1065 gdb_cv_have_aix_thread_debug=yes,
1066 gdb_cv_have_aix_thread_debug=no)])
1067 AC_MSG_RESULT($gdb_cv_have_aix_thread_debug)
1068 if test $gdb_cv_have_aix_thread_debug = yes; then
1069 CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c"
3483b318 1070 CONFIG_OBS="${CONFIG_OBS} aix-thread.o"
d92419e5
JB
1071 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -lpthdebug"
1072 fi
1073 ;;
c906108c
SS
1074 esac
1075 AC_SUBST(CONFIG_LDFLAGS)
1076fi
1077
3f47be5c
EZ
1078dnl See if we have a thread_db header file that has TD_NOTALLOC.
1079if test "x$ac_cv_header_thread_db_h" = "xyes"; then
1080 AC_CACHE_CHECK([whether <thread_db.h> has TD_NOTALLOC],
1081 gdb_cv_thread_db_h_has_td_notalloc,
1082 AC_TRY_COMPILE(
1083 [#include <thread_db.h>],
1084 [int i = TD_NOTALLOC;],
1085 gdb_cv_thread_db_h_has_td_notalloc=yes,
1086 gdb_cv_thread_db_h_has_td_notalloc=no
1087 )
1088 )
1089fi
1090if test "x$gdb_cv_thread_db_h_has_td_notalloc" = "xyes"; then
1091 AC_DEFINE(THREAD_DB_HAS_TD_NOTALLOC, 1,
1092 [Define if <thread_db.h> has the TD_NOTALLOC error code.])
1093fi
1094
b757528f
JJ
1095dnl See if we have a sys/syscall header file that has __NR_tkill.
1096if test "x$ac_cv_header_sys_syscall_h" = "xyes"; then
1097 AC_CACHE_CHECK([whether <sys/syscall.h> has __NR_tkill],
1098 gdb_cv_sys_syscall_h_has_tkill,
1099 AC_TRY_COMPILE(
1100 [#include <sys/syscall.h>],
1101 [int i = __NR_tkill;],
1102 gdb_cv_sys_syscall_h_has_tkill=yes,
1103 gdb_cv_sys_syscall_h_has_tkill=no
1104 )
1105 )
1106fi
1107dnl See if we can issue tkill syscall.
1108if test "x$gdb_cv_sys_syscall_h_has_tkill" = "xyes" && test "x$ac_cv_func_syscall" = "xyes"; then
1109 AC_DEFINE(HAVE_TKILL_SYSCALL, 1,
1110 [Define if we can use the tkill syscall.])
1111fi
1112
c906108c 1113dnl Handle optional features that can be enabled.
fb40c209 1114
030292b7
DJ
1115AC_ARG_WITH(sysroot,
1116[ --with-sysroot[=DIR] Search for usr/lib et al within DIR.],
1117[
1118 case ${with_sysroot} in
715d1656 1119 yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_alias}/sys-root' ;;
030292b7
DJ
1120 *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
1121 esac
1122
1123 TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
1124
1125 if test "x$exec_prefix" = xNONE; then
1126 if test "x$prefix" = xNONE; then
1127 test_prefix=/usr/local
1128 else
1129 test_prefix=$prefix
1130 fi
1131 else
1132 test_prefix=$exec_prefix
1133 fi
1134 case ${TARGET_SYSTEM_ROOT} in
715d1656
AO
1135 "${test_prefix}"|"${test_prefix}/"*|\
1136 '${exec_prefix}'|'${exec_prefix}/'*)
030292b7
DJ
1137 t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
1138 TARGET_SYSTEM_ROOT_DEFINE="$t"
1139 ;;
1140 esac
1141], [
1142 TARGET_SYSTEM_ROOT=
1143 TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"\"'
1144])
1145AC_SUBST(TARGET_SYSTEM_ROOT)
1146AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
1147
3b851bce
AC
1148# NOTE: Don't add -Wall or -Wunused, they both include
1149# -Wunused-parameter which reports bogus warnings.
1150# NOTE: If you add to this list, remember to update
1151# gdb/doc/gdbint.texinfo.
1decb323 1152build_warnings="-Wimplicit -Wreturn-type -Wcomment -Wtrigraphs \
0f0cffd2 1153-Wformat -Wparentheses -Wpointer-arith -Wuninitialized -Wformat-nonliteral \
4566dfcf 1154-Wunused-label -Wunused-function"
d8038014 1155# Up for debate: -Wswitch -Wcomment -trigraphs -Wtrigraphs
0f0cffd2 1156# -Wunused-function -Wunused-variable -Wunused-value
93d56215 1157# -Wchar-subscripts -Wtraditional -Wshadow -Wcast-qual
d8038014
AC
1158# -Wcast-align -Wwrite-strings -Wconversion -Wstrict-prototypes
1159# -Wmissing-prototypes -Wmissing-declarations -Wredundant-decls
1160# -Woverloaded-virtual -Winline -Werror"
c906108c
SS
1161AC_ARG_ENABLE(build-warnings,
1162[ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
1decb323 1163[case "${enableval}" in
c906108c
SS
1164 yes) ;;
1165 no) build_warnings="-w";;
1166 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1167 build_warnings="${build_warnings} ${t}";;
1168 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1169 build_warnings="${t} ${build_warnings}";;
1170 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
d4f3574e
SS
1171esac
1172if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
746a987d 1173 echo "Setting compiler warning flags = $build_warnings" 6>&1
1decb323 1174fi])dnl
3b851bce
AC
1175AC_ARG_ENABLE(gdb-build-warnings,
1176[ --enable-gdb-build-warnings Enable GDB specific build-time compiler warnings if gcc is used],
1177[case "${enableval}" in
1178 yes) ;;
1179 no) build_warnings="-w";;
1180 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1181 build_warnings="${build_warnings} ${t}";;
1182 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1183 build_warnings="${t} ${build_warnings}";;
1184 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
1185esac
1186if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
1187 echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1
1188fi])dnl
104c1213
JM
1189WARN_CFLAGS=""
1190WERROR_CFLAGS=""
c906108c
SS
1191if test "x${build_warnings}" != x -a "x$GCC" = xyes
1192then
746a987d
AC
1193 AC_MSG_CHECKING(compiler warning flags)
1194 # Separate out the -Werror flag as some files just cannot be
1195 # compiled with it enabled.
1196 for w in ${build_warnings}; do
1197 case $w in
1198 -Werr*) WERROR_CFLAGS=-Werror ;;
1199 *) # Check that GCC accepts it
4536bbc6
AC
1200 saved_CFLAGS="$CFLAGS"
1201 CFLAGS="$CFLAGS $w"
1202 AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
1203 CFLAGS="$saved_CFLAGS"
746a987d
AC
1204 esac
1205 done
1206 AC_MSG_RESULT(${WARN_CFLAGS}${WERROR_CFLAGS})
1decb323 1207fi
c906108c 1208AC_SUBST(WARN_CFLAGS)
104c1213 1209AC_SUBST(WERROR_CFLAGS)
c906108c 1210
7a292a7a
SS
1211# In the Cygwin environment, we need some additional flags.
1212AC_CACHE_CHECK([for cygwin], gdb_cv_os_cygwin,
1213[AC_EGREP_CPP(lose, [
1214#if defined (__CYGWIN__) || defined (__CYGWIN32__)
1215lose
1216#endif],[gdb_cv_os_cygwin=yes],[gdb_cv_os_cygwin=no])])
1217
aff38e61
AC
1218
1219dnl Figure out which of the many generic ser-*.c files the _host_ supports.
1220SER_HARDWIRE="ser-unix.o ser-pipe.o ser-tcp.o"
1221case ${host} in
95cbc983
AC
1222 *go32* ) SER_HARDWIRE=ser-go32.o ;;
1223 *djgpp* ) SER_HARDWIRE=ser-go32.o ;;
aff38e61
AC
1224esac
1225AC_SUBST(SER_HARDWIRE)
1226
cd0fc7c3
SS
1227# libreadline needs libuser32.a in a cygwin environment
1228WIN32LIBS=
1229if test x$gdb_cv_os_cygwin = xyes; then
c5394b80
JM
1230 WIN32LIBS="-luser32"
1231 case "${target}" in
1232 *cygwin*) WIN32LIBS="$WIN32LIBS -limagehlp"
1233 ;;
1234 esac
cd0fc7c3
SS
1235fi
1236AC_SUBST(WIN32LIBS)
7a292a7a 1237
3fc11d3e
JM
1238LIBGUI="../libgui/src/libgui.a"
1239GUI_CFLAGS_X="-I${srcdir}/../libgui/src"
1240AC_SUBST(LIBGUI)
1241AC_SUBST(GUI_CFLAGS_X)
7a292a7a 1242
3fc11d3e
JM
1243WIN32LDAPP=
1244AC_SUBST(WIN32LIBS)
1245AC_SUBST(WIN32LDAPP)
1246
d91670b9
CV
1247case "${host}" in
1248*-*-cygwin*)
1249 configdir="win"
1250 ;;
1251*)
1252 configdir="unix"
1253 ;;
1254esac
3fc11d3e
JM
1255
1256GDBTKLIBS=
1257if test "${enable_gdbtk}" = "yes"; then
1258
d1c3b63a
KS
1259 # Gdbtk must have an absolute path to srcdir in order to run
1260 # properly when not installed.
1261 here=`pwd`
1262 cd ${srcdir}
1263 GDBTK_SRC_DIR=`pwd`
1264 cd $here
1265
3fc11d3e
JM
1266 CY_AC_PATH_TCLCONFIG
1267 if test -z "${no_tcl}"; then
1268 CY_AC_LOAD_TCLCONFIG
1269 CY_AC_PATH_TKCONFIG
1270
dd2504ab
JM
1271 # now look for Tcl library stuff
1272
d91670b9 1273 tcldir="../tcl/${configdir}/"
dd2504ab
JM
1274
1275 TCL_DEPS="${tcldir}${TCL_LIB_FILE}"
1276
3fc11d3e
JM
1277 # If $no_tk is nonempty, then we can't do Tk, and there is no
1278 # point to doing Tcl.
1279 if test -z "${no_tk}"; then
1280 CY_AC_LOAD_TKCONFIG
1281 CY_AC_PATH_TCLH
1282 CY_AC_PATH_TKH
1283 CY_AC_PATH_ITCLH
1284 CY_AC_PATH_ITKH
3fc11d3e 1285
dd2504ab
JM
1286
1287 # now look for Tk library stuff
1288
d91670b9 1289 tkdir="../tk/${configdir}/"
dd2504ab
JM
1290
1291 TK_DEPS="${tkdir}${TK_LIB_FILE}"
1292
3fc11d3e
JM
1293 # now look for Itcl library stuff
1294
1295 CY_AC_PATH_ITCLCONFIG
1296 if test -z "${no_itcl}"; then
b381d62d 1297 CY_AC_LOAD_ITCLCONFIG
3fc11d3e
JM
1298
1299 ITCLLIB="${ITCL_BUILD_LIB_SPEC}"
b381d62d 1300 ITCL_DEPS="${ITCL_LIB_FULL_PATH}"
3fc11d3e
JM
1301 fi
1302
1303
1304 # now look for Itk library stuff
1305 CY_AC_PATH_ITKCONFIG
1306 if test -z "${no_itcl}"; then
1307 CY_AC_LOAD_ITKCONFIG
1308
3fc11d3e 1309 ITKLIB="${ITK_BUILD_LIB_SPEC}"
b381d62d 1310 ITK_DEPS="${ITK_LIB_FULL_PATH}"
3fc11d3e
JM
1311 fi
1312
4226a5a5 1313 ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_GDBTK_CFLAGS)"
3fc11d3e
JM
1314 # Tcl/Tk 8.1 require -fwritable strings. I don't
1315 # know whether 8.2 will or not, but I bet it will.
1316 # I don't have to worry about 7.x since we don't support it.
1317 GDBTK_CFLAGS=""
1318 if test "$GCC" = "yes"; then
1319 if test "$TCL_VERSION" != "8.0" ; then
1320 GDBTK_CFLAGS="-fwritable-strings"
1321 fi
1322 fi
1323
1324 # Include some libraries that Tcl and Tk want.
b2a1bd4f 1325 TCL_LIBS='$(LIBGUI) $(ITCL) $(ITK) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
3fc11d3e
JM
1326 # Yes, the ordering seems wrong here. But it isn't.
1327 # TK_LIBS is the list of libraries that need to be linked
1328 # after Tcl/Tk. Note that this isn't put into LIBS. If it
1329 # were in LIBS then any link tests after this point would
1330 # try to include things like `$(LIBGUI)', which wouldn't work.
1331 GDBTKLIBS="${TCL_LIBS} ${TK_LIBS}"
4226a5a5
FN
1332
1333 CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_GDBTK_OBS)"
1334 CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_GDBTK_DEPS)"
1335 CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_GDBTK_SRCS)"
33f8ca73
AC
1336 CONFIG_ALL="${CONFIG_ALL} all-gdbtk"
1337 CONFIG_CLEAN="${CONFIG_CLEAN} clean-gdbtk"
1338 CONFIG_INSTALL="${CONFIG_INSTALL} install-gdbtk"
1339 CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-gdbtk"
3fc11d3e
JM
1340
1341 if test x$gdb_cv_os_cygwin = xyes; then
1342 WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32"
1343 WIN32LDAPP="-Wl,--subsystem,console"
1344 CONFIG_OBS="${CONFIG_OBS} gdbres.o"
1345 fi
1346 fi
1347 fi
ffc6a242 1348
ffc6a242 1349 configdirs="${configdirs} gdbtk"
3fc11d3e
JM
1350fi
1351
3fc11d3e
JM
1352AC_SUBST(X_CFLAGS)
1353AC_SUBST(X_LDFLAGS)
1354AC_SUBST(X_LIBS)
dd2504ab
JM
1355AC_SUBST(TCL_DEPS)
1356AC_SUBST(TK_DEPS)
3fc11d3e
JM
1357AC_SUBST(ITCLLIB)
1358AC_SUBST(ITCL_DEPS)
1359AC_SUBST(ITKLIB)
1360AC_SUBST(ITK_DEPS)
3fc11d3e
JM
1361AC_SUBST(GDBTKLIBS)
1362AC_SUBST(GDBTK_CFLAGS)
d1c3b63a 1363AC_SUBST(GDBTK_SRC_DIR)
8b93c638 1364
c906108c
SS
1365AC_PATH_X
1366
7a292a7a
SS
1367
1368# Unlike the sim directory, whether a simulator is linked is controlled by
1369# presence of a SIM= and a SIM_OBS= definition in the target '.mt' file.
1370# This code just checks for a few cases where we'd like to ignore those
1371# definitions, even when they're present in the '.mt' file. These cases
1372# are when --disable-sim is specified, or if the simulator directory is
6c5cfe5b 1373# not part of the source tree.
7a292a7a
SS
1374#
1375AC_ARG_ENABLE(sim,
1376[ --enable-sim Link gdb with simulator],
1377[echo "enable_sim = $enable_sim";
1378 echo "enableval = ${enableval}";
1379 case "${enableval}" in
1380 yes) ignore_sim=false ;;
1381 no) ignore_sim=true ;;
1382 *) ignore_sim=false ;;
1383 esac],
1384[ignore_sim=false])
1385
1386if test ! -d "${srcdir}/../sim"; then
1387 ignore_sim=true
1388fi
1389
1390if test "${ignore_sim}" = "true"; then
1391 IGNORE_SIM="SIM="
1392 IGNORE_SIM_OBS="SIM_OBS="
1393else
1394 IGNORE_SIM=""
1395 IGNORE_SIM_OBS=""
1396 AC_DEFINE(WITH_SIM)
1397fi
1398AC_SUBST(IGNORE_SIM)
1399AC_SUBST(IGNORE_SIM_OBS)
1400
c906108c 1401AC_SUBST(ENABLE_CFLAGS)
d28f9cdf 1402AC_SUBST(PROFILE_CFLAGS)
c906108c
SS
1403
1404AC_SUBST(CONFIG_OBS)
1405AC_SUBST(CONFIG_DEPS)
1406AC_SUBST(CONFIG_SRCS)
b3a90332
AC
1407AC_SUBST(CONFIG_ALL)
1408AC_SUBST(CONFIG_CLEAN)
e56ac5c3
AC
1409AC_SUBST(CONFIG_INSTALL)
1410AC_SUBST(CONFIG_UNINSTALL)
c906108c 1411
c35f4ffc
AC
1412# List of host floatformats.
1413AC_DEFINE_UNQUOTED(GDB_HOST_FLOAT_FORMAT,$gdb_host_float_format,[Host float floatformat])
1414AC_DEFINE_UNQUOTED(GDB_HOST_DOUBLE_FORMAT,$gdb_host_double_format,[Host double floatformat])
1415AC_DEFINE_UNQUOTED(GDB_HOST_LONG_DOUBLE_FORMAT,$gdb_host_long_double_format,[Host long double floatformat])
1416
c906108c
SS
1417# target_subdir is used by the testsuite to find the target libraries.
1418target_subdir=
1419if test "${host}" != "${target}"; then
1420 target_subdir="${target_alias}/"
1421fi
1422AC_SUBST(target_subdir)
1423
1424frags=
0dad8a66
MK
1425if test "${target}" = "${host}"; then
1426 host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
1427 if test ! -f ${host_makefile_frag}; then
1428 AC_MSG_ERROR("*** Gdb does not support native target ${host}")
1429 fi
1430 frags="$frags $host_makefile_frag"
1431else
1432 host_makefile_frag=/dev/null
c906108c 1433fi
c906108c
SS
1434
1435target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
1436if test ! -f ${target_makefile_frag}; then
0dad8a66 1437 AC_MSG_ERROR("*** Gdb does not support target ${target}")
c906108c
SS
1438fi
1439frags="$frags $target_makefile_frag"
1440
1441AC_SUBST_FILE(host_makefile_frag)
1442AC_SUBST_FILE(target_makefile_frag)
1443AC_SUBST(frags)
1444
1445changequote(,)dnl
1446hostfile=`sed -n '
1447s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
1448' ${host_makefile_frag}`
1449
1450targetfile=`sed -n '
2c0fc042 1451s/DEPRECATED_TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
c906108c
SS
1452' ${target_makefile_frag}`
1453
c906108c 1454if test "${target}" = "${host}"; then
a85f51e7
DJ
1455# We pick this up from the host configuration file (.mh) because we
1456# do not have a native configuration Makefile fragment.
c906108c
SS
1457nativefile=`sed -n '
1458s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
1459' ${host_makefile_frag}`
c906108c
SS
1460fi
1461changequote([,])
1462
b00a8037
DJ
1463if test x"${gdb_osabi}" != x ; then
1464 AC_DEFINE_UNQUOTED(GDB_OSABI_DEFAULT, $gdb_osabi,
1465 [Define to the default OS ABI for this configuration.])
1466fi
1467
8dcde887
MK
1468# Enable multi-ice-gdb-server.
1469AC_ARG_ENABLE(multi-ice,
1470[ --enable-multi-ice build the multi-ice-gdb-server],
1471 [case $enableval in
1472 yes | no)
1473 ;;
1474 *) AC_MSG_ERROR([bad value $enableval for --enable-multi-ice]) ;;
1475 esac])
1476if test "x$enable_multi_ice" = xyes; then
1477 configdirs="$configdirs multi-ice"
96baa820
JM
1478fi
1479
8dcde887
MK
1480# We only build gdbserver automatically if host and target are the same.
1481if test "x$target" = "x$host"; then
1482 AC_MSG_CHECKING(whether gdbserver is supported on this host)
1483 if test "x$build_gdbserver" = xyes; then
1484 configdirs="$configdirs gdbserver"
1485 AC_MSG_RESULT(yes)
1486 else
1487 AC_MSG_RESULT(no)
1488 fi
a85f51e7
DJ
1489fi
1490
8dcde887 1491AC_CONFIG_SUBDIRS($configdirs)
96baa820 1492
2c0fc042
AC
1493# If hostfile (XM_FILE) and/or targetfile (DEPRECATED_TM_FILE) and/or
1494# nativefile (NAT_FILE) is not set in config/*/*.m[ht] files, we link
1495# to an empty version.
c906108c
SS
1496
1497files=
1498links=
5a2402b8 1499
c906108c 1500rm -f xm.h
5a2402b8 1501xm_h=""
c906108c 1502if test "${hostfile}" != ""; then
5a2402b8 1503 xm_h=xm.h
0f475e27
AC
1504 case "${hostfile}" in
1505 xm-*.h ) GDB_XM_FILE="config/${gdb_host_cpu}/${hostfile}" ;;
1506 * ) GDB_XM_FILE="${hostfile}"
1507 esac
5a2402b8
AC
1508 files="${files} ${GDB_XM_FILE}"
1509 links="${links} xm.h"
b78960be 1510 AC_DEFINE_UNQUOTED(GDB_XM_FILE, "${GDB_XM_FILE}")
c906108c 1511fi
5a2402b8
AC
1512AC_SUBST(xm_h)
1513
c906108c 1514rm -f tm.h
5a2402b8 1515tm_h=""
c906108c 1516if test "${targetfile}" != ""; then
5a2402b8 1517 tm_h=tm.h
0f475e27 1518 case "${targetfile}" in
b8c4aece 1519 tm-*.h ) GDB_TM_FILE="config/${gdb_target_cpu}/${targetfile}" ;;
0f475e27
AC
1520 * ) GDB_TM_FILE="${targetfile}"
1521 esac
5a2402b8
AC
1522 files="${files} ${GDB_TM_FILE}"
1523 links="${links} tm.h"
b78960be 1524 AC_DEFINE_UNQUOTED(GDB_TM_FILE, "${GDB_TM_FILE}")
c906108c 1525fi
5a2402b8
AC
1526AC_SUBST(tm_h)
1527
c906108c 1528rm -f nm.h
5a2402b8 1529nm_h=""
c906108c 1530if test "${nativefile}" != ""; then
5a2402b8 1531 nm_h=nm.h
0f475e27
AC
1532 case "${nativefile}" in
1533 nm-*.h ) GDB_NM_FILE="config/${gdb_host_cpu}/${nativefile}" ;;
1534 * ) GDB_NM_FILE="${nativefile}"
1535 esac
5a2402b8
AC
1536 files="${files} ${GDB_NM_FILE}"
1537 links="${links} nm.h"
b78960be 1538 AC_DEFINE_UNQUOTED(GDB_NM_FILE, "${GDB_NM_FILE}")
c906108c 1539fi
5a2402b8
AC
1540AC_SUBST(nm_h)
1541
c906108c
SS
1542AC_LINK_FILES($files, $links)
1543
1544dnl Check for exe extension set on certain hosts (e.g. Win32)
1545AC_EXEEXT
1546
234b45d4
KB
1547dnl Detect the character set used by this host.
1548
1549dnl At the moment, we just assume it's ISO-8859-1 (which is a
1550dnl superset of ASCII containing the characters needed for French,
1551dnl German, Spanish, Italian, and possibly others), but if were
1552dnl *were* to support any host character sets other than ISO-8859-1,
1553dnl here's where we'd detect it.
1554AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "ISO-8859-1",
1555 [Define to be a string naming the default host character set.])
1556
1557AM_ICONV
1558
ed952ac5 1559AC_OUTPUT(Makefile .gdbinit:gdbinit.in,
c906108c
SS
1560[
1561dnl Autoconf doesn't provide a mechanism for modifying definitions
1562dnl provided by makefile fragments.
1563dnl
c906108c
SS
1564
1565changequote(,)dnl
2c0fc042 1566sed -e '/^DEPRECATED_TM_FILE[ ]*=/s,^DEPRECATED_TM_FILE[ ]*=[ ]*,&config/'"${gdb_target_cpu}"'/,
c906108c
SS
1567/^XM_FILE[ ]*=/s,^XM_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,
1568/^NAT_FILE[ ]*=/s,^NAT_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
1569mv -f Makefile.tmp Makefile
1570changequote([,])dnl
1571
2acceee2 1572
c906108c
SS
1573case x$CONFIG_HEADERS in
1574xconfig.h:config.in)
1575echo > stamp-h ;;
1576esac
1577],
1578[
1579gdb_host_cpu=$gdb_host_cpu
1580gdb_target_cpu=$gdb_target_cpu
1581nativefile=$nativefile
1582])
1583
1584exit 0
This page took 0.408473 seconds and 4 git commands to generate.