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