1 dnl Autoconf configure script for GDB, the GNU debugger.
2 dnl Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
4 dnl Free Software Foundation, Inc.
6 dnl This file is part of GDB.
8 dnl This program is free software; you can redistribute it and/or modify
9 dnl it under the terms of the GNU General Public License as published by
10 dnl the Free Software Foundation; either version 3 of the License, or
11 dnl (at your option) any later version.
13 dnl This program is distributed in the hope that it will be useful,
14 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
15 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 dnl GNU General Public License for more details.
18 dnl You should have received a copy of the GNU General Public License
19 dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
21 dnl Process this file with autoconf to produce a configure script.
25 AC_CONFIG_HEADER(config.h:config.in)
34 AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
37 dnl List of object files and targets accumulated by configure.
49 dnl Set up for gettext.
50 ZW_GNU_GETTEXT_SISTER_DIR
52 localedir='${datadir}/locale'
55 if test x"$USE_NLS" = xyes; then
56 CONFIG_ALL="$CONFIG_ALL all-po"
57 CONFIG_CLEAN="$CONFIG_CLEAN clean-po"
58 CONFIG_INSTALL="$CONFIG_INSTALL install-po"
59 CONFIG_UNINSTALL="$CONFIG_UNINSTALL uninstall-po"
63 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ])
66 debugdir=${libdir}/debug
68 AC_ARG_WITH(separate-debug-dir,
69 [ --with-separate-debug-dir=path Look for global separate debug info in this path [LIBDIR/debug]],
70 [debugdir="${withval}"])
72 AC_DEFINE_DIR(DEBUGDIR, debugdir,
73 [Global directory for separate debug files. ])
74 #AC_DEFINE_UNQUOTED(DEBUGDIR, "$debugdir"),
76 if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
77 if test "x$prefix" = xNONE; then
78 test_prefix=/usr/local
83 test_prefix=$exec_prefix
86 "${test_prefix}"|"${test_prefix}/"*|\
87 '${exec_prefix}'|'${exec_prefix}/'*)
88 AC_DEFINE(DEBUGDIR_RELOCATABLE, 1, [Define if the debug directory should be relocated when GDB is moved.])
92 AC_CONFIG_SUBDIRS(doc testsuite)
94 # Provide defaults for some variables set by the per-host and per-target
96 gdb_host_obs=posix-hdep.o
98 if test "${target}" = "${host}"; then
104 . $srcdir/configure.host
106 . $srcdir/configure.tgt
108 # Fetch the default architecture and default target vector from BFD.
109 targ=$target; . $srcdir/../bfd/config.bfd
111 # We only want the first architecture, so strip off the others if
112 # there is more than one.
113 targ_archs=`echo $targ_archs | sed 's/ .*//'`
115 if test "x$targ_archs" != x; then
116 AC_DEFINE_UNQUOTED(DEFAULT_BFD_ARCH, $targ_archs,
117 [Define to BFD's default architecture. ])
119 if test "x$targ_defvec" != x; then
120 AC_DEFINE_UNQUOTED(DEFAULT_BFD_VEC, $targ_defvec,
121 [Define to BFD's default target vector. ])
126 # The CLI cannot be disabled yet, but may be in the future.
129 AC_ARG_ENABLE(gdbcli,
130 [ --disable-gdbcli disable command-line interface (CLI)],
135 AC_MSG_ERROR([the command-line interface cannot be disabled yet]) ;;
137 AC_MSG_ERROR([bad value $enableval for --enable-gdbcli]) ;;
140 if test x"$enable_gdbcli" = xyes; then
141 if test -d $srcdir/cli; then
142 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_CLI_OBS)"
143 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_CLI_DEPS)"
144 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_CLI_SRCS)"
145 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_CLI_CFLAGS)"
151 [ --disable-gdbmi disable machine-interface (MI)],
156 AC_MSG_ERROR([bad value $enableval for --enable-gdbmi]) ;;
159 if test x"$enable_gdbmi" = xyes; then
160 if test -d $srcdir/mi; then
161 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_MI_OBS)"
162 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_MI_DEPS)"
163 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_MI_SRCS)"
164 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_MI_CFLAGS)"
170 [ --enable-tui enable full-screen terminal user interface (TUI)],
175 AC_MSG_ERROR([bad value $enableval for --enable-tui]) ;;
176 esac],enable_tui=yes)
180 [ --enable-gdbtk enable gdbtk graphical user interface (GUI)],
185 AC_MSG_ERROR([bad value $enableval for --enable-gdbtk]) ;;
187 [if test -d $srcdir/gdbtk -a -d $srcdir/../itcl; then
192 # We unconditionally disable gdbtk tests on selected platforms.
195 AC_MSG_WARN([gdbtk isn't supported on $host; disabling])
200 AC_ARG_WITH(libunwind,
201 [ --with-libunwind Use libunwind frame unwinding support],
202 [case "${withval}" in
203 yes) enable_libunwind=yes ;;
204 no) enable_libunwind=no ;;
205 *) AC_MSG_ERROR(bad value ${withval} for GDB with-libunwind option) ;;
207 AC_CHECK_HEADERS(libunwind.h)
208 AC_CHECK_HEADERS(libunwind-ia64.h)
209 if test x"$ac_cv_header_libunwind_h" = xyes -a x"$ac_cv_header_libunwind_ia64_h" = xyes; then
210 enable_libunwind=yes;
214 if test x"$enable_libunwind" = xyes; then
215 AC_CHECK_HEADERS(libunwind.h)
216 AC_CHECK_HEADERS(libunwind-ia64.h)
217 AC_DEFINE(HAVE_LIBUNWIND, 1, [Define if libunwind library is being used.])
218 CONFIG_OBS="$CONFIG_OBS libunwind-frame.o"
219 CONFIG_DEPS="$CONFIG_DEPS libunwind-frame.o"
220 CONFIG_SRCS="$CONFIG_SRCS libunwind-frame.c"
224 AC_ARG_ENABLE(profiling,
225 [ --enable-profiling enable profiling of GDB],
230 AC_MSG_ERROR([bad value $enableval for --enable-profile]) ;;
232 [enable_profiling=no])
234 AC_CHECK_FUNCS(monstartup _mcleanup)
235 AC_CACHE_CHECK([for _etext], ac_cv_var__etext,
240 [free (&_etext);], ac_cv_var__etext=yes, ac_cv_var__etext=no)])
241 if test $ac_cv_var__etext = yes; then
242 AC_DEFINE(HAVE__ETEXT, 1,
243 [Define to 1 if your system has the _etext variable. ])
245 AC_CACHE_CHECK([for etext], ac_cv_var_etext,
250 [free (&etext);], ac_cv_var_etext=yes, ac_cv_var_etext=no)])
251 if test $ac_cv_var_etext = yes; then
252 AC_DEFINE(HAVE_ETEXT, 1,
253 [Define to 1 if your system has the etext variable. ])
255 if test "$enable_profiling" = yes ; then
256 if test $ac_cv_func_monstartup = no || test $ac_cv_func__mcleanup = no; then
257 AC_MSG_ERROR(--enable-profiling requires monstartup and _mcleanup)
261 CFLAGS="$CFLAGS $PROFILE_CFLAGS"
263 AC_CACHE_CHECK([whether $CC supports -pg], ac_cv_cc_supports_pg,
264 [AC_TRY_COMPILE([], [int x;], ac_cv_cc_supports_pg=yes,
265 ac_cv_cc_supports_pg=no)])
267 if test $ac_cv_cc_supports_pg = no; then
268 AC_MSG_ERROR(--enable-profiling requires a compiler which supports -pg)
274 # --------------------- #
275 # Checks for programs. #
276 # --------------------- #
284 AC_CHECK_TOOL(AR, ar)
285 AC_CHECK_TOOL(DLLTOOL, dlltool)
286 AC_CHECK_TOOL(WINDRES, windres)
288 # Needed for GNU/Hurd.
289 AC_CHECK_TOOL(MIG, mig)
291 # ---------------------- #
292 # Checks for libraries. #
293 # ---------------------- #
295 # We might need to link with -lm; most simulators need it.
296 AC_CHECK_LIB(m, main)
298 # We need to link with -lw to get `wctype' on Solaris before Solaris
299 # 2.6. Solaris 2.6 and beyond have this function in libc, and have a
300 # libw that some versions of the GNU linker cannot hanle (GNU ld 2.9.1
301 # is known to have this problem). Therefore we avoid libw if we can.
302 AC_CHECK_FUNC(wctype, [],
303 [AC_CHECK_LIB(w, wctype)])
305 # Some systems (e.g. Solaris) have `gethostbyname' in libnsl.
306 AC_SEARCH_LIBS(gethostbyname, nsl)
308 # Some systems (e.g. Solaris) have `socketpair' in libsocket.
309 AC_SEARCH_LIBS(socketpair, socket)
311 # For the TUI, we need enhanced curses functionality.
313 # FIXME: kettenis/20040905: We prefer ncurses over the vendor-supplied
314 # curses library because the latter might not provide all the
315 # functionality we need. However, this leads to problems on systems
316 # where the linker searches /usr/local/lib, but the compiler doesn't
317 # search /usr/local/include, if ncurses is installed in /usr/local. A
318 # default installation of ncurses on alpha*-dec-osf* will lead to such
320 AC_SEARCH_LIBS(waddstr, [ncurses cursesX curses])
322 # On HP/UX we may need libxpdl for dlgetmodinfo (used by solib-pa64.c).
323 AC_SEARCH_LIBS(dlgetmodinfo, [dl xpdl])
325 # Since GDB uses Readline, we need termcap functionality. In many
326 # cases this will be provided by the curses library, but some systems
327 # have a seperate termcap library, or no curses library at all.
331 if test -d $srcdir/libtermcap; then
332 LIBS="../libtermcap/libtermcap.a $LIBS"
333 ac_cv_search_tgetent="../libtermcap/libtermcap.a"
336 ac_cv_search_tgetent="none required"
339 ac_cv_search_tgetent="none required"
340 CONFIG_OBS="$CONFIG_OBS win32-termcap.o"
344 # These are the libraries checked by Readline.
345 AC_SEARCH_LIBS(tgetent, [termcap tinfo curses ncurses])
347 if test "$ac_cv_search_tgetent" = no; then
348 AC_MSG_ERROR([no termcap library found])
351 AC_ARG_WITH([system-readline],
352 [AS_HELP_STRING([--with-system-readline],
353 [use installed readline library])])
355 if test "$with_system_readline" = yes; then
360 READLINE='$(READLINE_DIR)/libreadline.a'
361 READLINE_DEPS='$(READLINE)'
362 READLINE_CFLAGS='-I$(READLINE_SRC)/..'
365 AC_SUBST(READLINE_DEPS)
366 AC_SUBST(READLINE_CFLAGS)
369 AS_HELP_STRING([--with-expat], [include expat support (auto/yes/no)]),
370 [], [with_expat=auto])
371 AC_MSG_CHECKING([whether to use expat])
372 AC_MSG_RESULT([$with_expat])
374 if test "${with_expat}" = no; then
375 AC_MSG_WARN([expat support disabled; some features may be unavailable.])
378 AC_LIB_HAVE_LINKFLAGS([expat], [], [#include "expat.h"],
379 [XML_Parser p = XML_ParserCreate (0);])
380 if test "$HAVE_LIBEXPAT" != yes; then
381 if test "$with_expat" = yes; then
382 AC_MSG_ERROR([expat is missing or unusable])
384 AC_MSG_WARN([expat is missing or unusable; some features may be unavailable.])
388 LIBS="$LIBS $LIBEXPAT"
389 AC_CHECK_FUNCS(XML_StopParser)
394 # ------------------------- #
395 # Checks for header files. #
396 # ------------------------- #
401 AC_CHECK_HEADERS(nlist.h)
402 AC_CHECK_HEADERS(link.h, [], [],
403 [#if HAVE_SYS_TYPES_H
404 # include <sys/types.h>
410 AC_CHECK_HEADERS(machine/reg.h)
411 AC_CHECK_HEADERS(poll.h sys/poll.h)
412 AC_CHECK_HEADERS(proc_service.h thread_db.h gnu/libc-version.h)
413 AC_CHECK_HEADERS(signal.h)
414 AC_CHECK_HEADERS(stddef.h)
415 AC_CHECK_HEADERS(stdlib.h)
416 AC_CHECK_HEADERS(stdint.h)
417 AC_CHECK_HEADERS(string.h memory.h strings.h)
418 AC_CHECK_HEADERS(sys/fault.h)
419 AC_CHECK_HEADERS(sys/file.h)
420 AC_CHECK_HEADERS(sys/filio.h)
421 AC_CHECK_HEADERS(sys/ioctl.h)
422 AC_CHECK_HEADERS(sys/param.h)
423 AC_CHECK_HEADERS(sys/resource.h)
424 AC_CHECK_HEADERS(sys/proc.h, [], [],
425 [#if HAVE_SYS_PARAM_H
426 # include <sys/param.h>
429 AC_CHECK_HEADERS(sys/procfs.h)
430 AC_CHECK_HEADERS(sys/ptrace.h ptrace.h)
431 AC_CHECK_HEADERS(sys/reg.h sys/debugreg.h)
432 AC_CHECK_HEADERS(sys/select.h)
433 AC_CHECK_HEADERS(sys/syscall.h)
434 AC_CHECK_HEADERS(sys/types.h)
435 AC_CHECK_HEADERS(sys/user.h, [], [],
436 [#if HAVE_SYS_PARAM_H
437 # include <sys/param.h>
440 AC_CHECK_HEADERS(sys/wait.h wait.h)
441 AC_CHECK_HEADERS(termios.h termio.h sgtty.h)
442 AC_CHECK_HEADERS(unistd.h)
444 # On Solaris 2.[789], we need to define _MSE_INT_H to avoid a clash
445 # between <widec.h> and <wchar.h> that would cause AC_CHECK_HEADERS to
446 # think that we don't have <curses.h> if we're using GCC.
449 if test "$GCC" = yes; then
450 AC_DEFINE(_MSE_INT_H, 1,
451 [Define to 1 to avoid a clash between <widec.h> and <wchar.h> on
452 Solaris 2.[789] when using GCC. ])
455 AC_CHECK_HEADERS(curses.h cursesX.h ncurses.h ncurses/ncurses.h)
456 AC_CHECK_HEADERS(ncurses/term.h)
457 AC_CHECK_HEADERS(term.h, [], [],
463 # Check for HP/UX 64-bit shared library support
464 AC_CHECK_HEADERS(elf_hp.h)
466 # FIXME: kettenis/20030102: In most cases we include these
467 # unconditionally, so what's the point in checking these?
468 AC_CHECK_HEADERS(ctype.h time.h)
470 # Create a header we can use portably to get the standard integer types.
471 GCC_HEADER_STDINT(gdb_stdint.h)
473 # ------------------------- #
474 # Checks for declarations. #
475 # ------------------------- #
477 AC_CHECK_DECLS([free, malloc, realloc])
478 AC_CHECK_DECLS([strerror, strstr])
479 AC_CHECK_DECLS([getopt, snprintf, vsnprintf])
481 # ----------------------- #
482 # Checks for structures. #
483 # ----------------------- #
485 AC_CHECK_MEMBERS([struct stat.st_blocks])
486 AC_CHECK_MEMBERS([struct stat.st_blksize])
488 # ------------------ #
489 # Checks for types. #
490 # ------------------ #
493 AC_CHECK_TYPES(socklen_t, [], [],
494 [#include <sys/types.h>
495 #include <sys/socket.h>
497 AC_CHECK_TYPES(uintptr_t, [], [], [#include <stdint.h>])
499 # ------------------------------------- #
500 # Checks for compiler characteristics. #
501 # ------------------------------------- #
506 # ------------------------------ #
507 # Checks for library functions. #
508 # ------------------------------ #
513 AC_CHECK_FUNCS(canonicalize_file_name realpath)
514 AC_CHECK_FUNCS(getrusage)
515 AC_CHECK_FUNCS(getuid getgid)
517 AC_CHECK_FUNCS(pread64)
519 AC_CHECK_FUNCS(setpgid setpgrp)
520 AC_CHECK_FUNCS(sigaction sigprocmask sigsetmask)
521 AC_CHECK_FUNCS(socketpair)
522 AC_CHECK_FUNCS(syscall)
523 AC_CHECK_FUNCS(ttrace)
524 AC_CHECK_FUNCS(wborder)
526 # Check the return and argument types of ptrace. No canned test for
527 # this, so roll our own.
530 # include <sys/types.h>
532 #if HAVE_SYS_PTRACE_H
533 # include <sys/ptrace.h>
539 # There is no point in checking if we don't have a prototype.
540 AC_CHECK_DECLS(ptrace, [], [
541 : ${gdb_cv_func_ptrace_ret='int'}
542 : ${gdb_cv_func_ptrace_args='int,int,long,long'}
543 ], $gdb_ptrace_headers)
545 AC_CACHE_CHECK([return type of ptrace], gdb_cv_func_ptrace_ret,
546 AC_TRY_COMPILE($gdb_ptrace_headers,
547 [extern int ptrace ();],
548 gdb_cv_func_ptrace_ret='int',
549 gdb_cv_func_ptrace_ret='long'))
550 AC_DEFINE_UNQUOTED(PTRACE_TYPE_RET, $gdb_cv_func_ptrace_ret,
551 [Define as the return type of ptrace.])
552 # Check argument types.
553 AC_CACHE_CHECK([types of arguments for ptrace], gdb_cv_func_ptrace_args, [
554 for gdb_arg1 in 'int' 'long'; do
555 for gdb_arg2 in 'pid_t' 'int' 'long'; do
556 for gdb_arg3 in 'int *' 'caddr_t' 'int' 'long'; do
557 for gdb_arg4 in 'int' 'long'; do
558 AC_TRY_COMPILE($gdb_ptrace_headers, [
559 extern $gdb_cv_func_ptrace_ret
560 ptrace ($gdb_arg1, $gdb_arg2, $gdb_arg3, $gdb_arg4);
561 ], [gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4";
563 for gdb_arg5 in 'int *' 'int' 'long'; do
564 AC_TRY_COMPILE($gdb_ptrace_headers, [
565 extern $gdb_cv_func_ptrace_ret
566 ptrace ($gdb_arg1, $gdb_arg2, $gdb_arg3, $gdb_arg4, $gdb_arg5);
568 gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4,$gdb_arg5";
575 # Provide a safe default value.
576 : ${gdb_cv_func_ptrace_args='int,int,long,long'}
578 ac_save_IFS=$IFS; IFS=','
579 set dummy `echo "$gdb_cv_func_ptrace_args" | sed 's/\*/\*/g'`
582 AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG3, $[3],
583 [Define to the type of arg 3 for ptrace.])
584 if test -n "$[5]"; then
585 AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG5, $[5],
586 [Define to the type of arg 5 for ptrace.])
589 dnl AC_FUNC_SETPGRP does not work when cross compiling
590 dnl Instead, assume we will have a prototype for setpgrp if cross compiling.
591 if test "$cross_compiling" = no; then
594 AC_CACHE_CHECK([whether setpgrp takes no argument], ac_cv_func_setpgrp_void,
598 if (setpgrp(1,1) == -1)
602 ], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes)])
603 if test $ac_cv_func_setpgrp_void = yes; then
604 AC_DEFINE(SETPGRP_VOID, 1)
608 # Check if sigsetjmp is available. Using AC_CHECK_FUNCS won't do
609 # since sigsetjmp might only be defined as a macro.
610 AC_CACHE_CHECK([for sigsetjmp], gdb_cv_func_sigsetjmp,
613 ], [sigjmp_buf env; while (! sigsetjmp (env, 1)) siglongjmp (env, 1);],
614 gdb_cv_func_sigsetjmp=yes, gdb_cv_func_sigsetjmp=no)])
615 if test $gdb_cv_func_sigsetjmp = yes; then
616 AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available. ])
619 # Assume we'll default to using the included libiberty regex.
620 gdb_use_included_regex=yes
622 # However, if the system regex is GNU regex, then default to *not*
623 # using the included regex.
626 [gdb_cv_have_gnu_regex],
628 [#include <gnu-versions.h>],
629 [#define REGEX_INTERFACE_VERSION 1
630 #if _GNU_REGEX_INTERFACE_VERSION != REGEX_INTERFACE_VERSION
631 # error "Version mismatch"
633 gdb_cv_have_gnu_regex=yes,
634 gdb_cv_have_gnu_regex=no)])
635 if test $gdb_cv_have_gnu_regex = yes; then
636 gdb_use_included_regex=no
639 AC_ARG_WITH(included-regex,
640 [ --without-included-regex don't use included regex; this is the default
641 on systems with version 2 of the GNU C library
642 (use with caution on other system)],
643 gdb_with_regex=$withval,
644 gdb_with_regex=$gdb_use_included_regex)
645 if test "$gdb_with_regex" = yes; then
646 AC_DEFINE(USE_INCLUDED_REGEX, 1,
647 [Define to 1 if the regex included in libiberty should be used.])
650 # Check if <sys/proc.h> defines `struct thread' with a td_pcb member.
651 AC_CHECK_MEMBERS([struct thread.td_pcb], [], [],
652 [#include <sys/param.h>
653 #include <sys/proc.h>
656 # See if <sys/lwp.h> defines `struct lwp`.
657 AC_CACHE_CHECK([for struct lwp], gdb_cv_struct_lwp,
658 [AC_TRY_COMPILE([#include <sys/param.h>
659 #include <sys/lwp.h>], [struct lwp l;],
660 gdb_cv_struct_lwp=yes, gdb_cv_struct_lwp=no)])
661 if test $gdb_cv_struct_lwp = yes; then
662 AC_DEFINE(HAVE_STRUCT_LWP, 1,
663 [Define to 1 if your system has struct lwp.])
666 # See if <machine/reg.h> degines `struct reg'.
667 AC_CACHE_CHECK([for struct reg in machine/reg.h], gdb_cv_struct_reg,
668 [AC_TRY_COMPILE([#include <sys/types.h>
669 #include <machine/reg.h>], [struct reg r;],
670 gdb_cv_struct_reg=yes, gdb_cv_struct_reg=no)])
671 if test $gdb_cv_struct_reg = yes; then
672 AC_DEFINE(HAVE_STRUCT_REG, 1,
673 [Define to 1 if your system has struct reg in <machine/reg.h>.])
676 # See if <machine/reg.h> supports the %fs and %gs i386 segment registers.
677 # Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'.
678 AC_CHECK_MEMBERS([struct reg.r_fs, struct reg.r_gs], [], [],
679 [#include <machine/reg.h>])
681 # See if <sys/ptrace.h> provides the PTRACE_GETREGS request.
682 AC_MSG_CHECKING(for PTRACE_GETREGS)
683 AC_CACHE_VAL(gdb_cv_have_ptrace_getregs,
684 [AC_TRY_COMPILE([#include <sys/ptrace.h>],
686 [gdb_cv_have_ptrace_getregs=yes],
687 [gdb_cv_have_ptrace_getregs=no])])
688 AC_MSG_RESULT($gdb_cv_have_ptrace_getregs)
689 if test $gdb_cv_have_ptrace_getregs = yes; then
690 AC_DEFINE(HAVE_PTRACE_GETREGS, 1,
691 [Define if sys/ptrace.h defines the PTRACE_GETREGS request.])
694 # See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request.
695 AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
696 AC_CACHE_VAL(gdb_cv_have_ptrace_getfpxregs,
697 [AC_TRY_COMPILE([#include <sys/ptrace.h>],
698 [PTRACE_GETFPXREGS;],
699 [gdb_cv_have_ptrace_getfpxregs=yes],
700 [gdb_cv_have_ptrace_getfpxregs=no])])
701 AC_MSG_RESULT($gdb_cv_have_ptrace_getfpxregs)
702 if test $gdb_cv_have_ptrace_getfpxregs = yes; then
703 AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1,
704 [Define if sys/ptrace.h defines the PTRACE_GETFPXREGS request.])
707 # See if <sys/ptrace.h> provides the PT_GETDBREGS request.
708 AC_MSG_CHECKING(for PT_GETDBREGS)
709 AC_CACHE_VAL(gdb_cv_have_pt_getdbregs,
710 [AC_TRY_COMPILE([#include <sys/types.h>
711 #include <sys/ptrace.h>],
713 [gdb_cv_have_pt_getdbregs=yes],
714 [gdb_cv_have_pt_getdbregs=no])])
715 AC_MSG_RESULT($gdb_cv_have_pt_getdbregs)
716 if test $gdb_cv_have_pt_getdbregs = yes; then
717 AC_DEFINE(HAVE_PT_GETDBREGS, 1,
718 [Define if sys/ptrace.h defines the PT_GETDBREGS request.])
721 # See if <sys/ptrace.h> provides the PT_GETXMMREGS request.
722 AC_MSG_CHECKING(for PT_GETXMMREGS)
723 AC_CACHE_VAL(gdb_cv_have_pt_getxmmregs,
724 [AC_TRY_COMPILE([#include <sys/types.h>
725 #include <sys/ptrace.h>],
727 [gdb_cv_have_pt_getxmmregs=yes],
728 [gdb_cv_have_pt_getxmmregs=no])])
729 AC_MSG_RESULT($gdb_cv_have_pt_getxmmregs)
730 if test $gdb_cv_have_pt_getxmmregs = yes; then
731 AC_DEFINE(HAVE_PT_GETXMMREGS, 1,
732 [Define if sys/ptrace.h defines the PT_GETXMMREGS request.])
735 # Detect which type of /proc is in use, such as for Unixware or Solaris.
737 if test "${target}" = "${host}"; then
739 *-*-unixware* | *-*-sysv4.2* | *-*-sysv5* | *-*-interix* )
740 AC_DEFINE(NEW_PROC_API, 1,
741 [Define if you want to use new multi-fd /proc interface
742 (replaces HAVE_MULTIPLE_PROC_FDS as well as other macros).])
744 *-*-solaris2.[[6789]] | *-*-solaris2.1[[0-9]])
745 AC_DEFINE(NEW_PROC_API, 1,
746 [Define if you want to use new multi-fd /proc interface
747 (replaces HAVE_MULTIPLE_PROC_FDS as well as other macros).])
750 # Work around <sys/proc.h> needing _KMEMUSER problem on IRIX 5.
751 AC_DEFINE([_KMEMUSER], 1,
752 [Define to 1 so <sys/proc.h> gets a definition of anon_hdl. Works
753 around a <sys/proc.h> problem on IRIX 5.])
758 if test "$ac_cv_header_sys_procfs_h" = yes; then
759 BFD_HAVE_SYS_PROCFS_TYPE(pstatus_t)
760 BFD_HAVE_SYS_PROCFS_TYPE(prrun_t)
761 BFD_HAVE_SYS_PROCFS_TYPE(gregset_t)
762 BFD_HAVE_SYS_PROCFS_TYPE(fpregset_t)
763 BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
764 BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t)
765 BFD_HAVE_SYS_PROCFS_TYPE(prgregset32_t)
766 BFD_HAVE_SYS_PROCFS_TYPE(prfpregset32_t)
767 BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
768 BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
769 BFD_HAVE_SYS_PROCFS_TYPE(prsysent_t)
770 BFD_HAVE_SYS_PROCFS_TYPE(pr_sigset_t)
771 BFD_HAVE_SYS_PROCFS_TYPE(pr_sigaction64_t)
772 BFD_HAVE_SYS_PROCFS_TYPE(pr_siginfo64_t)
775 dnl Check for broken prfpregset_t type
777 dnl For Linux/i386, glibc 2.1.3 was released with a bogus
778 dnl prfpregset_t type (it's a typedef for the pointer to a struct
779 dnl instead of the struct itself). We detect this here, and work
780 dnl around it in gdb_proc_service.h.
782 if test $bfd_cv_have_sys_procfs_type_prfpregset_t = yes; then
783 AC_MSG_CHECKING(whether prfpregset_t type is broken)
784 AC_CACHE_VAL(gdb_cv_prfpregset_t_broken,
785 [AC_TRY_RUN([#include <sys/procfs.h>
788 if (sizeof (prfpregset_t) == sizeof (void *))
792 gdb_cv_prfpregset_t_broken=no,
793 gdb_cv_prfpregset_t_broken=yes,
794 gdb_cv_prfpregset_t_broken=yes)])
795 AC_MSG_RESULT($gdb_cv_prfpregset_t_broken)
796 if test $gdb_cv_prfpregset_t_broken = yes; then
797 AC_DEFINE(PRFPREGSET_T_BROKEN, 1,
798 [Define if the prfpregset_t type is broken.])
802 dnl Check for PIOCSET ioctl entry
804 AC_MSG_CHECKING(for PIOCSET ioctl entry in sys/procfs.h)
805 AC_CACHE_VAL(gdb_cv_have_procfs_piocset,
806 [AC_TRY_COMPILE([#include <unistd.h>
807 #include <sys/types.h>
808 #include <sys/procfs.h>
811 dummy = ioctl(0, PIOCSET, &dummy);
813 gdb_cv_have_procfs_piocset=yes, gdb_cv_have_procfs_piocset=no)])
814 AC_MSG_RESULT($gdb_cv_have_procfs_piocset)
815 if test $gdb_cv_have_procfs_piocset = yes; then
816 AC_DEFINE(HAVE_PROCFS_PIOCSET, 1,
817 [Define if ioctl argument PIOCSET is available.])
821 dnl For native ports (host == target), check to see what kind of
822 dnl legacy link.h support is needed. (See solib-legacy.c.)
823 if test ${host} = ${target} ; then
824 dnl Check for struct link_map with l_ members which are indicative
825 dnl of SVR4-like shared libraries
827 AC_MSG_CHECKING(for member l_addr in struct link_map)
828 AC_CACHE_VAL(gdb_cv_have_struct_link_map_with_l_members,
829 [AC_TRY_COMPILE([#include <link.h>],
830 [struct link_map lm; (void) lm.l_addr;],
831 gdb_cv_have_struct_link_map_with_l_members=yes,
832 gdb_cv_have_struct_link_map_with_l_members=no)])
833 AC_MSG_RESULT($gdb_cv_have_struct_link_map_with_l_members)
834 if test $gdb_cv_have_struct_link_map_with_l_members = yes; then
835 AC_DEFINE(HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS,1,
836 [Define if <link.h> exists and defines struct link_map which has
837 members with an ``l_'' prefix. (For Solaris, SVR4, and
838 SVR4-like systems.)])
841 dnl Check for struct link_map with lm_ members which are indicative
842 dnl of SunOS-like shared libraries
844 AC_MSG_CHECKING(for member lm_addr in struct link_map)
845 AC_CACHE_VAL(gdb_cv_have_struct_link_map_with_lm_members,
846 [AC_TRY_COMPILE([#include <sys/types.h>
848 [struct link_map lm; (void) lm.lm_addr;],
849 gdb_cv_have_struct_link_map_with_lm_members=yes,
850 gdb_cv_have_struct_link_map_with_lm_members=no)])
851 AC_MSG_RESULT($gdb_cv_have_struct_link_map_with_lm_members)
852 if test $gdb_cv_have_struct_link_map_with_lm_members = yes; then
853 AC_DEFINE(HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS, 1,
854 [Define if <link.h> exists and defines struct link_map which has
855 members with an ``lm_'' prefix. (For SunOS.)])
858 dnl Check for struct so_map with som_ members which are found on
859 dnl some *BSD systems.
861 AC_MSG_CHECKING(for member som_addr in struct so_map)
862 AC_CACHE_VAL(gdb_cv_have_struct_so_map_with_som_members,
863 [AC_TRY_COMPILE([#include <sys/types.h>
868 [struct so_map lm; (void) lm.som_addr;],
869 gdb_cv_have_struct_so_map_with_som_members=yes,
870 gdb_cv_have_struct_so_map_with_som_members=no)])
871 AC_MSG_RESULT($gdb_cv_have_struct_so_map_with_som_members)
872 if test $gdb_cv_have_struct_so_map_with_som_members = yes; then
873 AC_DEFINE(HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS, 1,
874 [Define if <link.h> exists and defines a struct so_map which has
875 members with an ``som_'' prefix. (Found on older *BSD systems.)])
878 dnl Check for struct link_map32 type, which allows a 64-bit Solaris
879 dnl debugger to debug a 32-bit Solaris app with 32-bit shared libraries.
881 AC_MSG_CHECKING(for struct link_map32 in sys/link.h)
882 AC_CACHE_VAL(gdb_cv_have_struct_link_map32,
883 [AC_TRY_COMPILE([#define _SYSCALL32
884 #include <sys/link.h>], [struct link_map32 l;],
885 gdb_cv_have_struct_link_map32=yes,
886 gdb_cv_have_struct_link_map32=no)])
887 AC_MSG_RESULT($gdb_cv_have_struct_link_map32)
888 if test $gdb_cv_have_struct_link_map32 = yes; then
889 AC_DEFINE(HAVE_STRUCT_LINK_MAP32, 1,
890 [Define if <sys/link.h> has struct link_map32])
891 AC_DEFINE(_SYSCALL32, 1,
892 [Define if <sys/link.h> has link_map32 (solaris sparc-64 target)])
896 # Check if the compiler supports the `long long' type.
898 AC_CACHE_CHECK([for long long support in compiler], gdb_cv_c_long_long,
899 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
900 [[extern long long foo;]],
901 [[switch (foo & 2) { case 0: return 1; }]])],
902 gdb_cv_c_long_long=yes,
903 gdb_cv_c_long_long=no)])
904 if test $gdb_cv_c_long_long = yes; then
905 AC_DEFINE(CC_HAS_LONG_LONG, 1,
906 [Define to 1 if the compiler supports long long.])
909 # Check if the compiler and runtime support printing long longs.
911 AC_CACHE_CHECK([for long long support in printf],
912 gdb_cv_printf_has_long_long,
913 [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
916 l = (l << 16) + 0x0123;
917 l = (l << 16) + 0x4567;
918 l = (l << 16) + 0x89ab;
919 l = (l << 16) + 0xcdef;
920 sprintf (buf, "0x%016llx", l);
921 return (strcmp ("0x0123456789abcdef", buf));]])],
922 gdb_cv_printf_has_long_long=yes,
923 gdb_cv_printf_has_long_long=no,
924 gdb_cv_printf_has_long_long=no)])
925 if test $gdb_cv_printf_has_long_long = yes; then
926 AC_DEFINE(PRINTF_HAS_LONG_LONG, 1,
927 [Define to 1 if the "%ll" format works to print long longs.])
930 # Check if the compiler supports the `long double' type. We can't use
931 # AC_C_LONG_DOUBLE because that one does additional checks on the
932 # constants defined in <float.h> that fail on some systems,
933 # e.g. FreeBSD/i386 4.7 and OpenBSD/i386 3.6.
935 AC_CACHE_CHECK([for long double support in compiler], gdb_cv_c_long_double,
936 [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[long double foo;]])],
937 gdb_cv_c_long_double=yes,
938 gdb_cv_c_long_double=no)])
939 if test $gdb_cv_c_long_double = yes; then
940 AC_DEFINE(HAVE_LONG_DOUBLE, 1,
941 [Define to 1 if the compiler supports long double.])
944 # Check if the compiler and runtime support printing long doubles.
946 AC_CACHE_CHECK([for long double support in printf],
947 gdb_cv_printf_has_long_double,
948 [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
950 long double f = 3.141592653;
951 sprintf (buf, "%Lg", f);
952 return (strncmp ("3.14159", buf, 7));]])],
953 gdb_cv_printf_has_long_double=yes,
954 gdb_cv_printf_has_long_double=no,
955 gdb_cv_printf_has_long_double=no)])
956 if test $gdb_cv_printf_has_long_double = yes; then
957 AC_DEFINE(PRINTF_HAS_LONG_DOUBLE, 1,
958 [Define to 1 if the "%Lg" format works to print long doubles.])
961 # Check if the compiler and runtime support scanning long doubles.
963 AC_CACHE_CHECK([for long double support in scanf],
964 gdb_cv_scanf_has_long_double,
965 [AC_RUN_IFELSE([AC_LANG_PROGRAM(
966 [[#include <stdio.h>]],
967 [[char *buf = "3.141592653";
969 sscanf (buf, "%Lg", &f);
970 return !(f > 3.14159 && f < 3.14160);]])],
971 gdb_cv_scanf_has_long_double=yes,
972 gdb_cv_scanf_has_long_double=no,
973 gdb_cv_scanf_has_long_double=no)])
974 if test $gdb_cv_scanf_has_long_double = yes; then
975 AC_DEFINE(SCANF_HAS_LONG_DOUBLE, 1,
976 [Define to 1 if the "%Lg" format works to scan long doubles.])
981 AC_CACHE_CHECK([for -bbigtoc option], [gdb_cv_bigtoc], [
982 SAVE_LDFLAGS=$LDFLAGS
985 yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
986 *) gdb_cv_bigtoc=-bbigtoc ;;
989 LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
990 AC_TRY_LINK([], [int i;], [], [gdb_cv_bigtoc=])
991 LDFLAGS="${SAVE_LDFLAGS}"
993 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} ${gdb_cv_bigtoc}"
998 dnl For certain native configurations, we need to check whether thread
999 dnl support can be built in or not.
1001 dnl Note that we only want this if we are both native (host == target),
1002 dnl and not doing a canadian cross build (build == host).
1004 if test ${build} = ${host} -a ${host} = ${target} ; then
1007 AC_MSG_CHECKING(for HPUX/OSF thread support)
1008 if test -f /usr/include/dce/cma_config.h ; then
1009 if test "$GCC" = "yes" ; then
1011 AC_DEFINE(HAVE_HPUX_THREAD_SUPPORT, 1,
1012 [Define if you have HPUX threads])
1013 CONFIG_OBS="${CONFIG_OBS} hpux-thread.o"
1014 CONFIG_SRCS="${CONFIG_SRCS} hpux-thread.c"
1016 AC_MSG_RESULT(no (suppressed because you are not using GCC))
1023 # See if thread_db library is around for Solaris thread debugging.
1024 # Note that we must explicitly test for version 1 of the library
1025 # because version 0 (present on Solaris 2.4 or earlier) doesn't have
1027 AC_MSG_CHECKING(for Solaris thread debugging library)
1028 if test -f /usr/lib/libthread_db.so.1 ; then
1030 AC_DEFINE(HAVE_THREAD_DB_LIB, 1,
1031 [Define if using Solaris thread debugging.])
1032 CONFIG_OBS="${CONFIG_OBS} sol-thread.o"
1033 CONFIG_SRCS="${CONFIG_SRCS} sol-thread.c"
1034 AC_CHECK_LIB(dl, dlopen)
1035 if test "$GCC" = "yes" ; then
1036 # The GNU linker requires the -export-dynamic option to make
1037 # all symbols visible in the dynamic symbol table.
1038 hold_ldflags=$LDFLAGS
1039 AC_MSG_CHECKING(for the ld -export-dynamic flag)
1040 LDFLAGS="${LDFLAGS} -Wl,-export-dynamic"
1041 AC_TRY_LINK(, [int i;], found=yes, found=no)
1042 LDFLAGS=$hold_ldflags
1043 AC_MSG_RESULT($found)
1044 if test $found = yes; then
1045 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -Wl,-export-dynamic"
1048 # Sun randomly tweaked the prototypes in <proc_service.h>
1050 AC_MSG_CHECKING(if <proc_service.h> is old)
1051 AC_CACHE_VAL(gdb_cv_proc_service_is_old,[
1053 #include <proc_service.h>
1055 (struct ps_prochandle*, psaddr_t, const void*, size_t);
1056 ],, gdb_cv_proc_service_is_old=no,
1057 gdb_cv_proc_service_is_old=yes)
1059 AC_MSG_RESULT($gdb_cv_proc_service_is_old)
1060 if test $gdb_cv_proc_service_is_old = yes; then
1061 AC_DEFINE(PROC_SERVICE_IS_OLD, 1,
1062 [Define if <proc_service.h> on solaris uses int instead of
1063 size_t, and assorted other type changes.])
1070 AC_MSG_CHECKING(for AiX thread debugging library)
1071 AC_CACHE_VAL(gdb_cv_have_aix_thread_debug,
1072 [AC_TRY_COMPILE([#include <sys/pthdebug.h>],
1073 [#ifndef PTHDB_VERSION_3
1076 gdb_cv_have_aix_thread_debug=yes,
1077 gdb_cv_have_aix_thread_debug=no)])
1078 AC_MSG_RESULT($gdb_cv_have_aix_thread_debug)
1079 if test $gdb_cv_have_aix_thread_debug = yes; then
1080 CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c"
1081 CONFIG_OBS="${CONFIG_OBS} aix-thread.o"
1082 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} -lpthdebug"
1086 AC_SUBST(CONFIG_LDFLAGS)
1089 dnl See if we have a thread_db header file that has TD_NOTALLOC and
1090 dnl other error codes.
1091 if test "x$ac_cv_header_thread_db_h" = "xyes"; then
1092 AC_CACHE_CHECK([whether <thread_db.h> has TD_NOTALLOC],
1093 gdb_cv_thread_db_h_has_td_notalloc,
1095 [#include <thread_db.h>],
1096 [int i = TD_NOTALLOC;],
1097 gdb_cv_thread_db_h_has_td_notalloc=yes,
1098 gdb_cv_thread_db_h_has_td_notalloc=no
1101 AC_CACHE_CHECK([whether <thread_db.h> has TD_VERSION],
1102 gdb_cv_thread_db_h_has_td_version,
1104 [#include <thread_db.h>],
1105 [int i = TD_VERSION;],
1106 gdb_cv_thread_db_h_has_td_version=yes,
1107 gdb_cv_thread_db_h_has_td_version=no
1110 AC_CACHE_CHECK([whether <thread_db.h> has TD_NOTLS],
1111 gdb_cv_thread_db_h_has_td_notls,
1113 [#include <thread_db.h>],
1114 [int i = TD_NOTLS;],
1115 gdb_cv_thread_db_h_has_td_notls=yes,
1116 gdb_cv_thread_db_h_has_td_notls=no
1120 if test "x$gdb_cv_thread_db_h_has_td_notalloc" = "xyes"; then
1121 AC_DEFINE(THREAD_DB_HAS_TD_NOTALLOC, 1,
1122 [Define if <thread_db.h> has the TD_NOTALLOC error code.])
1124 if test "x$gdb_cv_thread_db_h_has_td_version" = "xyes"; then
1125 AC_DEFINE(THREAD_DB_HAS_TD_VERSION, 1,
1126 [Define if <thread_db.h> has the TD_VERSION error code.])
1128 if test "x$gdb_cv_thread_db_h_has_td_notls" = "xyes"; then
1129 AC_DEFINE(THREAD_DB_HAS_TD_NOTLS, 1,
1130 [Define if <thread_db.h> has the TD_NOTLS error code.])
1133 dnl See if we have a sys/syscall header file that has __NR_tkill.
1134 if test "x$ac_cv_header_sys_syscall_h" = "xyes"; then
1135 AC_CACHE_CHECK([whether <sys/syscall.h> has __NR_tkill],
1136 gdb_cv_sys_syscall_h_has_tkill,
1138 [#include <sys/syscall.h>],
1139 [int i = __NR_tkill;],
1140 gdb_cv_sys_syscall_h_has_tkill=yes,
1141 gdb_cv_sys_syscall_h_has_tkill=no
1145 dnl See if we can issue tkill syscall.
1146 if test "x$gdb_cv_sys_syscall_h_has_tkill" = "xyes" && test "x$ac_cv_func_syscall" = "xyes"; then
1147 AC_DEFINE(HAVE_TKILL_SYSCALL, 1, [Define if you support the tkill syscall.])
1150 dnl Handle optional features that can be enabled.
1152 AC_ARG_WITH(sysroot,
1153 [ --with-sysroot[=DIR] Search for usr/lib et al within DIR.],
1155 case ${with_sysroot} in
1156 yes) TARGET_SYSTEM_ROOT='${exec_prefix}/${target_alias}/sys-root' ;;
1157 *) TARGET_SYSTEM_ROOT=$with_sysroot ;;
1160 TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"$(TARGET_SYSTEM_ROOT)\"'
1162 if test "x$prefix" = xNONE; then
1163 test_prefix=/usr/local
1167 if test "x$exec_prefix" = xNONE || test "x$exec_prefix" = 'x${prefix}'; then
1168 test_exec_prefix=$test_prefix
1170 test_exec_prefix=$exec_prefix
1172 case ${TARGET_SYSTEM_ROOT} in
1173 "${test_prefix}"|"${test_prefix}/"*|\
1174 "${test_exec_prefix}"|"${test_exec_prefix}/"*|\
1175 '${prefix}'|'${prefix}/'*|\
1176 '${exec_prefix}'|'${exec_prefix}/'*)
1177 t="$TARGET_SYSTEM_ROOT_DEFINE -DTARGET_SYSTEM_ROOT_RELOCATABLE"
1178 TARGET_SYSTEM_ROOT_DEFINE="$t"
1183 TARGET_SYSTEM_ROOT_DEFINE='-DTARGET_SYSTEM_ROOT=\"\"'
1185 AC_SUBST(TARGET_SYSTEM_ROOT)
1186 AC_SUBST(TARGET_SYSTEM_ROOT_DEFINE)
1188 AC_ARG_ENABLE(werror,
1189 [ --enable-werror treat compile warnings as errors],
1190 [case "${enableval}" in
1191 yes | y) ERROR_ON_WARNING="yes" ;;
1192 no | n) ERROR_ON_WARNING="no" ;;
1193 *) AC_MSG_ERROR(bad value ${enableval} for --enable-werror) ;;
1196 # Enable -Werror by default when using gcc
1197 if test "${GCC}" = yes -a -z "${ERROR_ON_WARNING}" ; then
1198 ERROR_ON_WARNING=yes
1202 if test "${ERROR_ON_WARNING}" = yes ; then
1203 WERROR_CFLAGS="-Werror"
1206 # The entries after -Wno-pointer-sign are disabled warnings which may
1207 # be enabled in the future, which can not currently be used to build
1209 # NOTE: If you change this list, remember to update
1210 # gdb/doc/gdbint.texinfo.
1211 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
1212 -Wformat-nonliteral -Wno-pointer-sign \
1213 -Wno-unused -Wno-switch -Wno-char-subscripts"
1215 AC_ARG_ENABLE(build-warnings,
1216 [ --enable-build-warnings Enable build-time compiler warnings if gcc is used],
1217 [case "${enableval}" in
1219 no) build_warnings="-w";;
1220 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1221 build_warnings="${build_warnings} ${t}";;
1222 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1223 build_warnings="${t} ${build_warnings}";;
1224 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
1226 if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
1227 echo "Setting compiler warning flags = $build_warnings" 6>&1
1229 AC_ARG_ENABLE(gdb-build-warnings,
1230 [ --enable-gdb-build-warnings Enable GDB specific build-time compiler warnings if gcc is used],
1231 [case "${enableval}" in
1233 no) build_warnings="-w";;
1234 ,*) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1235 build_warnings="${build_warnings} ${t}";;
1236 *,) t=`echo "${enableval}" | sed -e "s/,/ /g"`
1237 build_warnings="${t} ${build_warnings}";;
1238 *) build_warnings=`echo "${enableval}" | sed -e "s/,/ /g"`;;
1240 if test x"$silent" != x"yes" && test x"$build_warnings" != x""; then
1241 echo "Setting GDB specific compiler warning flags = $build_warnings" 6>&1
1244 if test "x${build_warnings}" != x -a "x$GCC" = xyes
1246 AC_MSG_CHECKING(compiler warning flags)
1247 # Separate out the -Werror flag as some files just cannot be
1248 # compiled with it enabled.
1249 for w in ${build_warnings}; do
1251 -Werr*) WERROR_CFLAGS=-Werror ;;
1252 *) # Check that GCC accepts it
1253 saved_CFLAGS="$CFLAGS"
1255 AC_TRY_COMPILE([],[],WARN_CFLAGS="${WARN_CFLAGS} $w",)
1256 CFLAGS="$saved_CFLAGS"
1259 AC_MSG_RESULT(${WARN_CFLAGS} ${WERROR_CFLAGS})
1261 AC_SUBST(WARN_CFLAGS)
1262 AC_SUBST(WERROR_CFLAGS)
1264 # In the Cygwin environment, we need some additional flags.
1265 AC_CACHE_CHECK([for cygwin], gdb_cv_os_cygwin,
1266 [AC_EGREP_CPP(lose, [
1267 #if defined (__CYGWIN__) || defined (__CYGWIN32__)
1269 #endif],[gdb_cv_os_cygwin=yes],[gdb_cv_os_cygwin=no])])
1272 dnl Figure out which of the many generic ser-*.c files the _host_ supports.
1273 SER_HARDWIRE="ser-base.o ser-unix.o ser-pipe.o ser-tcp.o"
1275 *go32* ) SER_HARDWIRE=ser-go32.o ;;
1276 *djgpp* ) SER_HARDWIRE=ser-go32.o ;;
1277 *mingw32*) SER_HARDWIRE="ser-base.o ser-tcp.o ser-mingw.o" ;;
1279 AC_SUBST(SER_HARDWIRE)
1281 # libreadline needs libuser32.a in a cygwin environment
1283 if test x$gdb_cv_os_cygwin = xyes; then
1284 WIN32LIBS="-luser32"
1286 *cygwin*) WIN32LIBS="$WIN32LIBS -limagehlp"
1291 # The ser-tcp.c module requires sockets.
1294 AC_DEFINE(USE_WIN32API, 1,
1295 [Define if we should use the Windows API, instead of the
1296 POSIX API. On Windows, we use the Windows API when
1297 building for MinGW, but the POSIX API when building
1299 WIN32LIBS="$WIN32LIBS -lws2_32"
1304 # Add ELF support to GDB, but only if BFD includes ELF support.
1306 OLD_LDFLAGS=$LDFLAGS
1308 CFLAGS="$CFLAGS -I${srcdir}/../include -I../bfd -I${srcdir}/../bfd"
1309 LDFLAGS="$LDFLAGS -L../bfd -L../libiberty"
1310 intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
1311 LIBS="$LIBS -lbfd -liberty $intl"
1312 AC_CACHE_CHECK([for ELF support in BFD], gdb_cv_var_elf,
1314 [#include <stdlib.h>
1316 #include "elf-bfd.h"
1318 [bfd *abfd = NULL; bfd_get_elf_phdr_upper_bound (abfd); ],
1319 gdb_cv_var_elf=yes, gdb_cv_var_elf=no)])
1320 if test $gdb_cv_var_elf = yes; then
1321 CONFIG_OBS="$CONFIG_OBS elfread.o"
1322 AC_DEFINE(HAVE_ELF, 1,
1323 [Define if ELF support should be included.])
1326 LDFLAGS=$OLD_LDFLAGS
1329 # Add any host-specific objects to GDB.
1330 CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}"
1332 LIBGUI="../libgui/src/libgui.a"
1333 GUI_CFLAGS_X="-I${srcdir}/../libgui/src"
1335 AC_SUBST(GUI_CFLAGS_X)
1339 AC_SUBST(WIN32LDAPP)
1351 if test "${enable_gdbtk}" = "yes"; then
1353 # Gdbtk must have an absolute path to srcdir in order to run
1354 # properly when not installed.
1360 CY_AC_PATH_TCLCONFIG
1361 if test -z "${no_tcl}"; then
1362 CY_AC_LOAD_TCLCONFIG
1365 # now look for Tcl library stuff
1367 tcldir="../tcl/${configdir}/"
1369 TCL_DEPS="${tcldir}${TCL_LIB_FILE}"
1371 # If $no_tk is nonempty, then we can't do Tk, and there is no
1372 # point to doing Tcl.
1373 if test -z "${no_tk}"; then
1381 # now look for Tk library stuff
1383 tkdir="../tk/${configdir}/"
1385 TK_DEPS="${tkdir}${TK_LIB_FILE}"
1387 # now look for Itcl library stuff
1389 CY_AC_PATH_ITCLCONFIG
1390 if test -z "${no_itcl}"; then
1391 CY_AC_LOAD_ITCLCONFIG
1393 ITCLLIB="${ITCL_BUILD_LIB_SPEC}"
1394 ITCL_DEPS="${ITCL_LIB_FULL_PATH}"
1398 # now look for Itk library stuff
1399 CY_AC_PATH_ITKCONFIG
1400 if test -z "${no_itcl}"; then
1401 CY_AC_LOAD_ITKCONFIG
1403 ITKLIB="${ITK_BUILD_LIB_SPEC}"
1404 ITK_DEPS="${ITK_LIB_FULL_PATH}"
1407 ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_GDBTK_CFLAGS)"
1409 # Include some libraries that Tcl and Tk want.
1410 TCL_LIBS='$(LIBGUI) $(ITCL) $(ITK) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
1411 # Yes, the ordering seems wrong here. But it isn't.
1412 # TK_LIBS is the list of libraries that need to be linked
1413 # after Tcl/Tk. Note that this isn't put into LIBS. If it
1414 # were in LIBS then any link tests after this point would
1415 # try to include things like `$(LIBGUI)', which wouldn't work.
1416 GDBTKLIBS="${TCL_LIBS} ${TK_LIBS}"
1418 CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_GDBTK_OBS)"
1419 CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_GDBTK_DEPS)"
1420 CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_GDBTK_SRCS)"
1421 CONFIG_ALL="${CONFIG_ALL} all-gdbtk"
1422 CONFIG_CLEAN="${CONFIG_CLEAN} clean-gdbtk"
1423 CONFIG_INSTALL="${CONFIG_INSTALL} install-gdbtk"
1424 CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-gdbtk"
1426 if test x$gdb_cv_os_cygwin = xyes; then
1427 WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32"
1428 WIN32LDAPP="-Wl,--subsystem,console"
1429 CONFIG_OBS="${CONFIG_OBS} gdbres.o"
1434 AC_CONFIG_SUBDIRS(gdbtk)
1447 AC_SUBST(GDBTK_CFLAGS)
1448 AC_SUBST(GDBTK_SRC_DIR)
1452 # Check whether we should enable the TUI, but only do so if we really
1454 if test x"$enable_tui" = xyes; then
1455 if test -d $srcdir/tui; then
1456 if test "$ac_cv_search_waddstr" != no; then
1457 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
1458 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
1459 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)"
1460 CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_TUI_INITS)"
1461 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)"
1462 CONFIG_ALL="${CONFIG_ALL} all-tui"
1463 CONFIG_CLEAN="${CONFIG_CLEAN} clean-tui"
1464 CONFIG_INSTALL="${CONFIG_INSTALL} install-tui"
1465 CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-tui"
1467 AC_MSG_WARN([no enhanced curses library found; disabling TUI])
1472 # Unlike the sim directory, whether a simulator is linked is controlled by
1473 # presence of a SIM= and a SIM_OBS= definition in the target '.mt' file.
1474 # This code just checks for a few cases where we'd like to ignore those
1475 # definitions, even when they're present in the '.mt' file. These cases
1476 # are when --disable-sim is specified, or if the simulator directory is
1477 # not part of the source tree.
1480 [ --enable-sim Link gdb with simulator],
1481 [echo "enable_sim = $enable_sim";
1482 echo "enableval = ${enableval}";
1483 case "${enableval}" in
1484 yes) ignore_sim=false ;;
1485 no) ignore_sim=true ;;
1486 *) ignore_sim=false ;;
1490 if test ! -d "${srcdir}/../sim"; then
1494 if test "${ignore_sim}" = "true"; then
1496 IGNORE_SIM_OBS="SIM_OBS="
1500 AC_DEFINE(WITH_SIM, 1, [Define if the simulator is being linked in.])
1502 AC_SUBST(IGNORE_SIM)
1503 AC_SUBST(IGNORE_SIM_OBS)
1505 AC_SUBST(ENABLE_CFLAGS)
1506 AC_SUBST(PROFILE_CFLAGS)
1508 AC_SUBST(CONFIG_OBS)
1509 AC_SUBST(CONFIG_DEPS)
1510 AC_SUBST(CONFIG_SRCS)
1511 AC_SUBST(CONFIG_ALL)
1512 AC_SUBST(CONFIG_CLEAN)
1513 AC_SUBST(CONFIG_INSTALL)
1514 AC_SUBST(CONFIG_UNINSTALL)
1516 # List of host floatformats.
1517 AC_DEFINE_UNQUOTED(GDB_HOST_FLOAT_FORMAT,$gdb_host_float_format,[Host float floatformat])
1518 AC_DEFINE_UNQUOTED(GDB_HOST_DOUBLE_FORMAT,$gdb_host_double_format,[Host double floatformat])
1519 AC_DEFINE_UNQUOTED(GDB_HOST_LONG_DOUBLE_FORMAT,$gdb_host_long_double_format,[Host long double floatformat])
1521 # target_subdir is used by the testsuite to find the target libraries.
1523 if test "${host}" != "${target}"; then
1524 target_subdir="${target_alias}/"
1526 AC_SUBST(target_subdir)
1529 if test "${gdb_native}" = "yes"; then
1530 host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
1531 if test ! -f ${host_makefile_frag}; then
1532 AC_MSG_ERROR("*** Gdb does not support native target ${host}")
1534 frags="$frags $host_makefile_frag"
1536 host_makefile_frag=/dev/null
1539 target_makefile_frag=${srcdir}/config/${gdb_target_cpu}/${gdb_target}.mt
1540 if test ! -f ${target_makefile_frag}; then
1541 AC_MSG_ERROR("*** Gdb does not support target ${target}")
1543 frags="$frags $target_makefile_frag"
1545 AC_SUBST_FILE(host_makefile_frag)
1546 AC_SUBST_FILE(target_makefile_frag)
1551 s/XM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
1552 ' ${host_makefile_frag}`
1554 targetfile=`sed -n '
1555 s/^[ ]*DEPRECATED_TM_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
1556 ' ${target_makefile_frag}`
1558 if test "${gdb_native}" = "yes"; then
1559 # We pick this up from the host configuration file (.mh) because we
1560 # do not have a native configuration Makefile fragment.
1561 nativefile=`sed -n '
1562 s/NAT_FILE[ ]*=[ ]*\([^ ]*\)/\1/p
1563 ' ${host_makefile_frag}`
1567 if test x"${gdb_osabi}" != x ; then
1568 AC_DEFINE_UNQUOTED(GDB_OSABI_DEFAULT, $gdb_osabi,
1569 [Define to the default OS ABI for this configuration.])
1572 # Enable multi-ice-gdb-server.
1573 AC_ARG_ENABLE(multi-ice,
1574 [ --enable-multi-ice build the multi-ice-gdb-server],
1578 *) AC_MSG_ERROR([bad value $enableval for --enable-multi-ice]) ;;
1580 if test "x$enable_multi_ice" = xyes; then
1581 AC_CONFIG_SUBDIRS(multi-ice)
1584 # We only build gdbserver automatically in a native configuration.
1585 if test "$gdb_native" = "yes"; then
1586 AC_MSG_CHECKING(whether gdbserver is supported on this host)
1587 if test "x$build_gdbserver" = xyes; then
1589 AC_CONFIG_SUBDIRS(gdbserver)
1595 # If hostfile (XM_FILE) and/or targetfile (DEPRECATED_TM_FILE) and/or
1596 # nativefile (NAT_FILE) is not set in config/*/*.m[ht] files, we link
1597 # to an empty version.
1604 if test "${hostfile}" != ""; then
1606 case "${hostfile}" in
1607 xm-*.h ) GDB_XM_FILE="config/${gdb_host_cpu}/${hostfile}" ;;
1608 * ) GDB_XM_FILE="${hostfile}"
1610 files="${files} ${GDB_XM_FILE}"
1611 links="${links} xm.h"
1612 AC_DEFINE_UNQUOTED(GDB_XM_FILE, "${GDB_XM_FILE}", [hostfile])
1618 if test "${targetfile}" != ""; then
1620 case "${targetfile}" in
1621 tm-*.h ) GDB_TM_FILE="config/${gdb_target_cpu}/${targetfile}" ;;
1622 * ) GDB_TM_FILE="${targetfile}"
1624 files="${files} ${GDB_TM_FILE}"
1625 links="${links} tm.h"
1626 AC_DEFINE_UNQUOTED(GDB_TM_FILE, "${GDB_TM_FILE}", [targetfile])
1632 if test "${nativefile}" != ""; then
1634 case "${nativefile}" in
1635 nm-*.h ) GDB_NM_FILE="config/${gdb_host_cpu}/${nativefile}" ;;
1636 * ) GDB_NM_FILE="${nativefile}"
1638 files="${files} ${GDB_NM_FILE}"
1639 links="${links} nm.h"
1640 AC_DEFINE_UNQUOTED(GDB_NM_FILE, "${GDB_NM_FILE}", [nativefile])
1644 AC_LINK_FILES($files, $links)
1646 dnl Check for exe extension set on certain hosts (e.g. Win32)
1649 dnl Detect the character set used by this host.
1651 dnl At the moment, we just assume it's ISO-8859-1 (which is a
1652 dnl superset of ASCII containing the characters needed for French,
1653 dnl German, Spanish, Italian, and possibly others), but if were
1654 dnl *were* to support any host character sets other than ISO-8859-1,
1655 dnl here's where we'd detect it.
1656 AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "ISO-8859-1",
1657 [Define to be a string naming the default host character set.])
1661 AC_OUTPUT(Makefile .gdbinit:gdbinit.in,
1663 dnl Autoconf doesn't provide a mechanism for modifying definitions
1664 dnl provided by makefile fragments.
1668 sed -e '/^DEPRECATED_TM_FILE[ ]*=/s,^DEPRECATED_TM_FILE[ ]*=[ ]*,&config/'"${gdb_target_cpu}"'/,
1669 /^XM_FILE[ ]*=/s,^XM_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,
1670 /^NAT_FILE[ ]*=/s,^NAT_FILE[ ]*=[ ]*,&config/'"${gdb_host_cpu}"'/,' <Makefile >Makefile.tmp
1671 mv -f Makefile.tmp Makefile
1675 case x$CONFIG_HEADERS in
1676 xconfig.h:config.in)
1681 gdb_host_cpu=$gdb_host_cpu
1682 gdb_target_cpu=$gdb_target_cpu
1683 nativefile=$nativefile