1 dnl Autoconf configure script for GDB, the GNU debugger.
2 dnl Copyright (C) 1995-2022 Free Software Foundation, Inc.
4 dnl This file is part of GDB.
6 dnl This program is free software; you can redistribute it and/or modify
7 dnl it under the terms of the GNU General Public License as published by
8 dnl the Free Software Foundation; either version 3 of the License, or
9 dnl (at your option) any later version.
11 dnl This program is distributed in the hope that it will be useful,
12 dnl but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 dnl GNU General Public License for more details.
16 dnl You should have received a copy of the GNU General Public License
17 dnl along with this program. If not, see <http://www.gnu.org/licenses/>.
19 dnl Process this file with autoconf to produce a configure script.
22 AC_CONFIG_MACRO_DIRS([.. ../config])
23 AC_CONFIG_SRCDIR([main.c])
24 AC_CONFIG_HEADERS(config.h:config.in, [echo > stamp-h])
30 AC_USE_SYSTEM_EXTENSIONS
36 # Set build, build_cpu, build_vendor and build_os.
39 # Set host, host_cpu, host_vendor, and host_os.
42 # Set target, target_cpu, target_vendor, and target_os.
45 ACX_NONCANONICAL_TARGET
49 # We require libtool to link with the in-tree libtool libraries
52 # ... and we need it soon, since it is used by some of the
53 # link tests in the configure script.
56 # We require a C++11 compiler. Check if one is available, and if
57 # necessary, set CXX_DIALECT to some -std=xxx switch.
58 AX_CXX_COMPILE_STDCXX(11, , mandatory)
60 # Dependency checking.
62 ZW_PROG_COMPILER_DEPENDENCIES([CC])
64 dnl List of object files and targets accumulated by configure.
76 dnl Set up for gettext.
77 ZW_GNU_GETTEXT_SISTER_DIR
79 localedir='${datadir}/locale'
82 if test x"$USE_NLS" = xyes; then
83 CONFIG_ALL="$CONFIG_ALL all-po"
84 CONFIG_CLEAN="$CONFIG_CLEAN clean-po"
85 CONFIG_INSTALL="$CONFIG_INSTALL install-po"
86 CONFIG_UNINSTALL="$CONFIG_UNINSTALL uninstall-po"
90 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ])
93 # We never need to detect it in this sub-configure.
94 # But preserve it for config.status --recheck.
96 [Parent configure detects if it is of sufficient version.])
97 AC_ARG_VAR(MAKEINFOFLAGS,
98 [Parameters for MAKEINFO.])
100 MAKEINFO_EXTRA_FLAGS=""
101 AC_CACHE_CHECK([whether $MAKEINFO supports @click], gdb_cv_have_makeinfo_click,
102 [echo '@clicksequence{a @click{} b}' >conftest.texinfo
103 if eval "$MAKEINFO conftest.texinfo >&5 2>&5"; then
104 gdb_cv_have_makeinfo_click=yes
106 gdb_cv_have_makeinfo_click=no
108 if test x"$gdb_cv_have_makeinfo_click" = xyes; then
109 MAKEINFO_EXTRA_FLAGS="$MAKEINFO_EXTRA_FLAGS -DHAVE_MAKEINFO_CLICK"
111 AC_SUBST(MAKEINFO_EXTRA_FLAGS)
113 GDB_AC_WITH_DIR(DEBUGDIR, separate-debug-dir,
114 [look for global separate debug info in this path @<:@LIBDIR/debug@:>@],
117 # We can't pass paths as command line arguments.
118 # Mingw32 tries to be clever and will convert the paths for us.
119 # For example -DBINDIR="/usr/local/bin" passed on the command line may get
120 # converted to -DBINDIR="E:/msys/mingw32/msys/1.0/local/bin".
121 # This breaks GDB's relocatable path conversions since paths passed in
122 # config.h would not get so translated, the path prefixes no longer match.
123 AC_DEFINE_DIR(BINDIR, bindir, [Directory of programs.])
125 # GDB's datadir relocation
127 GDB_AC_WITH_DIR(GDB_DATADIR, gdb-datadir,
128 [look for global separate data files in this path @<:@DATADIR/gdb@:>@],
131 AC_ARG_WITH(relocated-sources,
132 AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this path for source files]),
133 [reloc_srcdir="${withval}"
134 AC_DEFINE_DIR(RELOC_SRCDIR, reloc_srcdir,
135 [Relocated directory for source files. ])
138 AC_MSG_CHECKING([for default auto-load directory])
139 AC_ARG_WITH(auto-load-dir,
140 AS_HELP_STRING([--with-auto-load-dir=PATH],
141 [directories from which to load auto-loaded scripts @<:@$debugdir:$datadir/auto-load@:>@]),,
142 [with_auto_load_dir='$debugdir:$datadir/auto-load'])
143 escape_dir=`echo $with_auto_load_dir | sed -e 's/[[$]]datadir\>/\\\\\\\\\\\\&/g' -e 's/[[$]]debugdir\>/\\\\\\\\\\\\&/g'`
144 AC_DEFINE_DIR(AUTO_LOAD_DIR, escape_dir,
145 [Directories from which to load auto-loaded scripts.])
146 AC_MSG_RESULT([$with_auto_load_dir])
148 AC_MSG_CHECKING([for default auto-load safe-path])
149 AC_ARG_WITH(auto-load-safe-path,
150 AS_HELP_STRING([--with-auto-load-safe-path=PATH],
151 [directories safe to hold auto-loaded files @<:@--with-auto-load-dir@:>@])
152 AS_HELP_STRING([--without-auto-load-safe-path],
153 [do not restrict auto-loaded files locations]),
154 [if test "$with_auto_load_safe_path" = "no"; then
155 with_auto_load_safe_path="/"
157 [with_auto_load_safe_path="$with_auto_load_dir"])
158 escape_dir=`echo $with_auto_load_safe_path | sed -e 's/[[$]]datadir\>/\\\\\\\\\\\\&/g' -e 's/[[$]]debugdir\>/\\\\\\\\\\\\&/g'`
159 AC_DEFINE_DIR(AUTO_LOAD_SAFE_PATH, escape_dir,
160 [Directories safe to hold auto-loaded files.])
161 AC_MSG_RESULT([$with_auto_load_safe_path])
163 AC_CONFIG_SUBDIRS(testsuite)
165 # Check whether to support alternative target configurations
166 AC_ARG_ENABLE(targets,
167 AS_HELP_STRING([--enable-targets=TARGETS], [alternative target configurations]),
168 [case "${enableval}" in
169 yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
171 no) enable_targets= ;;
172 *) enable_targets=$enableval ;;
177 # Provide defaults for some variables set by the per-host and per-target
179 gdb_host_obs=posix-hdep.o
181 if test "${target}" = "${host}"; then
187 . $srcdir/configure.host
189 # Accumulate some settings from configure.tgt over all enabled targets
193 HAVE_NATIVE_GCORE_TARGET=
195 for targ_alias in `echo $target_alias $enable_targets | sed 's/,/ /g'`
197 if test "$targ_alias" = "all"; then
200 # Canonicalize the secondary target names.
201 result=`$ac_config_sub $targ_alias 2>/dev/null`
202 if test -n "$result"; then
208 . ${srcdir}/configure.tgt
210 AS_IF([test -z "${gdb_target_obs}"],
211 [AC_MSG_ERROR([configuration ${targ} is unsupported.])])
213 # Target-specific object files
214 for i in ${gdb_target_obs}; do
215 case " $TARGET_OBS " in
218 TARGET_OBS="$TARGET_OBS ${i}"
223 # Check whether this target needs 64-bit CORE_ADDR
224 if test x${enable_64_bit_bfd} = xno; then
225 . ${srcdir}/../bfd/config.bfd
228 # Check whether this target is native and supports gcore.
229 if test $gdb_native = yes -a "$targ_alias" = "$target_alias" \
230 && $gdb_have_gcore; then
231 HAVE_NATIVE_GCORE_TARGET=1
236 if test x${all_targets} = xtrue; then
237 if test x${enable_64_bit_bfd} = xyes; then
238 TARGET_OBS='$(ALL_TARGET_OBS) $(ALL_64_TARGET_OBS)'
240 TARGET_OBS='$(ALL_TARGET_OBS)'
245 AC_SUBST(HAVE_NATIVE_GCORE_TARGET)
247 # For other settings, only the main target counts.
250 targ=$target; . ${srcdir}/configure.tgt
252 # Fetch the default architecture and default target vector from BFD.
253 targ=$target; . $srcdir/../bfd/config.bfd
255 # We only want the first architecture, so strip off the others if
256 # there is more than one.
257 targ_archs=`echo $targ_archs | sed 's/ .*//'`
259 if test "x$targ_archs" != x; then
260 AC_DEFINE_UNQUOTED(DEFAULT_BFD_ARCH, $targ_archs,
261 [Define to BFD's default architecture. ])
263 if test "x$targ_defvec" != x; then
264 AC_DEFINE_UNQUOTED(DEFAULT_BFD_VEC, $targ_defvec,
265 [Define to BFD's default target vector. ])
269 AC_ARG_ENABLE([gdbmi],
270 [AS_HELP_STRING([--disable-gdbmi], [disable machine-interface (MI)])],
271 [GDB_CHECK_YES_NO_VAL([$enableval], [--enable-gdbmi])],
273 if test x"$enable_gdbmi" = xyes; then
274 if test -d "$srcdir/mi"; then
275 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_MI_OBS)"
276 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_MI_DEPS)"
277 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_MI_SRCS)"
278 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_MI_CFLAGS)"
284 AS_HELP_STRING([--enable-tui],
285 [enable full-screen terminal user interface (TUI)]),
286 [GDB_CHECK_YES_NO_AUTO_VAL([$enableval], [--enable-tui])],
290 AC_ARG_ENABLE([gdbtk],
291 [AS_HELP_STRING([--enable-gdbtk], [enable gdbtk graphical user interface (GUI)])],
292 [GDB_CHECK_YES_NO_VAL([$enableval], [--enable-gdbtk])],
293 [if test -d "$srcdir/gdbtk"; then
298 # We unconditionally disable gdbtk tests on selected platforms.
301 AC_MSG_WARN([gdbtk isn't supported on $host; disabling])
305 # Handle optional debuginfod support
308 # Libunwind support for ia64.
309 AC_ARG_WITH(libunwind-ia64,
310 AS_HELP_STRING([--with-libunwind-ia64],
311 [use libunwind frame unwinding for ia64 targets]),,
312 [with_libunwind_ia64=auto])
314 # Backward compatibility option.
315 if test "${with_libunwind+set}" = set; then
316 if test x"$with_libunwind_ia64" != xauto; then
318 [option --with-libunwind is deprecated, use --with-libunwind-ia64])
320 AC_MSG_WARN([option --with-libunwind is deprecated, use --with-libunwind-ia64])
321 with_libunwind_ia64="$with_libunwind"
324 case "$with_libunwind_ia64" in
328 AC_CHECK_HEADERS(libunwind-ia64.h)
329 with_libunwind_ia64=$ac_cv_header_libunwind_ia64_h
333 [bad value $with_libunwind_ia64 for GDB --with-libunwind-ia64 option])
337 if test x"$with_libunwind_ia64" = xyes; then
338 AC_CHECK_HEADERS(libunwind-ia64.h)
339 if test x"$ac_cv_header_libunwind_ia64_h" != xyes; then
340 AC_MSG_ERROR([GDB option --with-libunwind-ia64 requires libunwind-ia64.h])
342 CONFIG_OBS="$CONFIG_OBS ia64-libunwind-tdep.o"
343 CONFIG_DEPS="$CONFIG_DEPS ia64-libunwind-tdep.o"
344 CONFIG_SRCS="$CONFIG_SRCS ia64-libunwind-tdep.c"
348 AC_ARG_WITH(curses, AS_HELP_STRING([--with-curses], [use the curses library instead of the termcap library]), opt_curses=$withval)
351 if test "$opt_curses" = "yes"; then
356 AC_ARG_ENABLE([profiling],
357 [AS_HELP_STRING([--enable-profiling], [enable profiling of GDB])],
358 [GDB_CHECK_YES_NO_VAL([$enableval], [--enable-profiling])],
359 [enable_profiling=no])
361 AC_CHECK_FUNCS(monstartup _mcleanup)
368 extern char _etext;],
371 [ac_cv_var__etext=yes],
372 [ac_cv_var__etext=no]
375 if test "$ac_cv_var__etext" = yes; then
376 AC_DEFINE(HAVE__ETEXT, 1,
377 [Define to 1 if your system has the _etext variable. ])
388 [ac_cv_var_etext=yes],
392 if test "$ac_cv_var_etext" = yes; then
393 AC_DEFINE(HAVE_ETEXT, 1,
394 [Define to 1 if your system has the etext variable. ])
396 if test "$enable_profiling" = yes ; then
397 if test "$ac_cv_func_monstartup" = no || test "$ac_cv_func__mcleanup" = no; then
398 AC_MSG_ERROR(--enable-profiling requires monstartup and _mcleanup)
402 CFLAGS="$CFLAGS $PROFILE_CFLAGS"
405 [whether $CC supports -pg],
406 [ac_cv_cc_supports_pg],
408 [AC_LANG_PROGRAM([], [int x;])],
409 [ac_cv_cc_supports_pg=yes],
410 [ac_cv_cc_supports_pg=no]
414 if test "$ac_cv_cc_supports_pg" = no; then
415 AC_MSG_ERROR(--enable-profiling requires a compiler which supports -pg)
422 AC_ARG_ENABLE([codesign],
423 AS_HELP_STRING([--enable-codesign=CERT],
424 [sign gdb with 'codesign -s CERT']),
425 [CODESIGN_CERT=$enableval])
426 AC_SUBST([CODESIGN_CERT])
428 ACX_PKGVERSION([GDB])
429 ACX_BUGURL([https://www.gnu.org/software/gdb/bugs/])
430 AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
431 AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
433 # --------------------- #
434 # Checks for programs. #
435 # --------------------- #
443 AC_CHECK_TOOL(AR, ar)
444 AC_CHECK_TOOL(DLLTOOL, dlltool)
445 AC_CHECK_TOOL(WINDRES, windres)
449 # Needed for GNU Hurd hosts.
450 AC_CHECK_TOOL(MIG, mig)
451 if test x"$MIG" = x; then
452 AC_MSG_ERROR([MIG not found but required for $host hosts])
457 # ---------------------- #
458 # Checks for libraries. #
459 # ---------------------- #
461 # We might need to link with -lm; most simulators need it.
462 AC_CHECK_LIB(m, main)
464 # Some systems (e.g. Solaris) have `gethostbyname' in libnsl.
465 AC_SEARCH_LIBS(gethostbyname, nsl)
467 # Some systems (e.g. Solaris) have `socketpair' in libsocket.
468 AC_SEARCH_LIBS(socketpair, socket)
470 # Link in zlib/zstd if we can. This allows us to read compressed debug
477 # GDB may fork/exec the iconv program to get the list of supported character
478 # sets. Allow the user to specify where to find it.
479 # There are several factors affecting the choice of option name:
480 # - There is already --with-libiconv-prefix but we can't use it, it specifies
481 # the build-time location of libiconv files.
482 # - The program we need to find is iconv, which comes with glibc. The user
483 # doesn't necessarily have libiconv installed. Therefore naming this
484 # --with-libiconv-foo feels wrong.
485 # - We want the path to be relocatable, but GDB_AC_DEFINE_RELOCATABLE is
486 # defined to work on directories not files (though it really doesn't know
488 # - Calling this --with-iconv-prefix is perceived to cause too much confusion
489 # with --with-libiconv-prefix.
490 # Putting these together is why the option name is --with-iconv-bin.
492 AC_ARG_WITH(iconv-bin,
493 AS_HELP_STRING([--with-iconv-bin=PATH], [specify where to find the iconv program]),
494 [iconv_bin="${withval}"
495 AC_DEFINE_UNQUOTED([ICONV_BIN], ["${iconv_bin}"],
496 [Path of directory of iconv program.])
497 GDB_AC_DEFINE_RELOCATABLE(ICONV_BIN, iconv, ${iconv_bin})
500 # For the TUI, we need enhanced curses functionality.
501 if test x"$enable_tui" != xno; then
506 if test x"$prefer_curses" = xyes; then
507 # FIXME: kettenis/20040905: We prefer ncurses over the vendor-supplied
508 # curses library because the latter might not provide all the
509 # functionality we need. However, this leads to problems on systems
510 # where the linker searches /usr/local/lib, but the compiler doesn't
511 # search /usr/local/include, if ncurses is installed in /usr/local. A
512 # default installation of ncurses on alpha*-dec-osf* will lead to such
514 AC_SEARCH_LIBS(waddstr, [ncursesw ncurses cursesX curses])
516 if test "$ac_cv_search_waddstr" != no; then
521 # Check whether we should enable the TUI, but only do so if we really
523 if test x"$enable_tui" != xno; then
524 if test -d "$srcdir/tui"; then
525 if test "$curses_found" != no; then
526 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
527 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
528 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)"
529 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)"
531 if test x"$enable_tui" = xyes; then
532 AC_MSG_ERROR([no enhanced curses library found; disable TUI])
534 AC_MSG_WARN([no enhanced curses library found; disabling TUI])
540 # Since GDB uses Readline, we need termcap functionality. In many
541 # cases this will be provided by the curses library, but some systems
542 # have a separate termcap library, or no curses library at all.
546 if test -d "$srcdir/libtermcap"; then
547 LIBS="../libtermcap/libtermcap.a $LIBS"
548 ac_cv_search_tgetent="../libtermcap/libtermcap.a"
551 ac_cv_search_tgetent="none required"
555 # These are the libraries checked by Readline.
556 AC_SEARCH_LIBS(tgetent, [termcap tinfow tinfo curses ncursesw ncurses])
558 if test "$ac_cv_search_tgetent" = no; then
559 CONFIG_OBS="$CONFIG_OBS stub-termcap.o"
562 AC_ARG_WITH([system-readline],
563 [AS_HELP_STRING([--with-system-readline],
564 [use installed readline library])])
566 if test "$with_system_readline" = yes; then
567 AC_CHECK_HEADERS(readline/readline.h, [readline_h=yes], [readline_h=no])
568 if test "$readline_h" = "no"; then
569 AC_MSG_ERROR([readline development packages are probably missing])
572 [whether system readline is new enough],
573 [gdb_cv_readline_ok],
577 #include <readline/readline.h>],
578 [#if RL_VERSION_MAJOR < 7
579 # error "readline version 7 required"
582 [gdb_cv_readline_ok=yes],
583 [gdb_cv_readline_ok=no]
586 if test "$gdb_cv_readline_ok" != yes; then
587 AC_MSG_ERROR([system readline is not new enough])
593 READLINE_TEXI_INCFLAG=
595 READLINE='$(READLINE_DIR)/libreadline.a'
596 READLINE_DEPS='$(READLINE)'
597 READLINE_CFLAGS='-I$(READLINE_SRC)/..'
598 READLINE_TEXI_INCFLAG='-I $(READLINE_DIR)'
601 AC_SUBST(READLINE_DEPS)
602 AC_SUBST(READLINE_CFLAGS)
603 AC_SUBST(READLINE_TEXI_INCFLAG)
605 # Generate jit-reader.h
607 # This is typedeffed to GDB_CORE_ADDR in jit-reader.h
610 AC_CHECK_SIZEOF(unsigned long long)
611 AC_CHECK_SIZEOF(unsigned long)
612 AC_CHECK_SIZEOF(unsigned __int128)
614 if test "x${ac_cv_sizeof_unsigned_long}" = "x8"; then
615 TARGET_PTR="unsigned long"
616 elif test "x${ac_cv_sizeof_unsigned_long_long}" = "x8"; then
617 TARGET_PTR="unsigned long long"
618 elif test "x${ac_cv_sizeof_unsigned___int128}" = "x16"; then
619 TARGET_PTR="unsigned __int128"
621 TARGET_PTR="unsigned long"
625 AC_CONFIG_FILES([jit-reader.h:jit-reader.in])
627 AC_SEARCH_LIBS(dlopen, dl)
629 GDB_AC_WITH_DIR([JIT_READER_DIR], [jit-reader-dir],
630 [directory to load the JIT readers from],
634 AS_HELP_STRING([--with-expat], [include expat support (auto/yes/no)]),
635 [], [with_expat=auto])
636 AC_MSG_CHECKING([whether to use expat])
637 AC_MSG_RESULT([$with_expat])
639 if test "${with_expat}" = no; then
640 AC_MSG_WARN([expat support disabled; some features may be unavailable.])
643 AC_LIB_HAVE_LINKFLAGS([expat], [], [#include "expat.h"],
644 [XML_Parser p = XML_ParserCreate (0);])
645 if test "$HAVE_LIBEXPAT" != yes; then
646 if test "$with_expat" = yes; then
647 AC_MSG_ERROR([expat is missing or unusable])
649 AC_MSG_WARN([expat is missing or unusable; some features may be unavailable.])
653 LIBS="$LIBS $LIBEXPAT"
654 AC_CHECK_FUNCS(XML_StopParser)
659 AC_ARG_VAR(GMPLIBS,[How to link GMP])
660 AC_ARG_VAR(GMPINC,[How to find GMP include files])
662 # --------------------- #
663 # Check for libpython. #
664 # --------------------- #
666 dnl Utility to simplify finding libpython.
667 dnl $1 = the shell variable to assign the result to
668 dnl If libpython is found we store $version here.
669 dnl $2 = additional flags to add to CPPFLAGS
670 dnl $3 = additional flags to add to LIBS
672 AC_DEFUN([AC_TRY_LIBPYTHON],
674 define([have_libpython_var],$1)
677 AC_MSG_CHECKING([for python])
678 save_CPPFLAGS=$CPPFLAGS
680 CPPFLAGS="$CPPFLAGS $new_CPPFLAGS"
681 LIBS="$new_LIBS $LIBS"
682 found_usable_python=no
683 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "Python.h"]],
685 #if PY_MAJOR_VERSION != 3
686 # error "We only support Python 3"
690 [have_libpython_var=yes
691 found_usable_python=yes
692 PYTHON_CPPFLAGS=$new_CPPFLAGS
693 PYTHON_LIBS=$new_LIBS])
694 CPPFLAGS=$save_CPPFLAGS
696 AC_MSG_RESULT([${found_usable_python}])
699 dnl There are several different values for --with-python:
701 dnl no - Don't include python support.
702 dnl yes - Include python support, error if it's missing.
703 dnl If we find python in $PATH, use it to fetch configure options,
704 dnl otherwise assume the compiler can find it with no help from us.
705 dnl auto - Same as "yes", but if python is missing from the system,
706 dnl fall back to "no".
707 dnl /path/to/python/exec-prefix -
708 dnl Use the python located in this directory.
709 dnl If /path/to/python/exec-prefix/bin/python exists, use it to find
710 dnl the compilation parameters. Otherwise use
711 dnl -I/path/to/python/exec-prefix/include,
712 dnl -L/path/to/python/exec-prefix/lib.
713 dnl NOTE: This case is historical. It is what was done for 7.0/7.1
714 dnl but is deprecated.
715 dnl /path/to/python/executable -
716 dnl Run python-config.py with this version of python to fetch the
717 dnl compilation parameters.
718 dnl NOTE: This needn't be the real python executable.
719 dnl In a cross-compilation scenario (build != host), this could be
720 dnl a shell script that provides what python-config.py provides for
721 dnl --ldflags, --includes, --exec-prefix.
722 dnl python-executable -
723 dnl Find python-executable in $PATH, and then handle the same as
724 dnl /path/to/python/executable.
726 dnl If a python program is specified, it is used to run python-config.py and
727 dnl is passed --ldflags, --includes, --exec-prefix.
730 AS_HELP_STRING([--with-python@<:@=PYTHON@:>@], [include python support (auto/yes/no/<python-program>)]),
731 [], [with_python=auto])
732 AC_MSG_CHECKING([whether to use python])
733 AC_MSG_RESULT([$with_python])
735 if test "${with_python}" = no; then
736 AC_MSG_WARN([python support disabled; some features may be unavailable.])
739 case "${with_python}" in
740 [[\\/]]* | ?:[[\\/]]*)
741 if test -d "${with_python}"; then
742 # Assume the python binary is ${with_python}/bin/python.
743 python_prog="${with_python}/bin/python"
745 # If python does not exit ${with_python}/bin, then try in
746 # ${with_python}. On Windows/MinGW, this is where the Python
748 if test ! -x "${python_prog}"; then
749 python_prog="${with_python}/python"
752 if test ! -x "${python_prog}"; then
753 # Fall back to gdb 7.0/7.1 behaviour.
755 python_prefix=${with_python}
757 elif test -x "${with_python}"; then
758 # While we can't run python compiled for $host (unless host == build),
759 # the user could write a script that provides the needed information,
760 # so we support that.
761 python_prog=${with_python}
764 AC_MSG_ERROR(invalid value for --with-python)
768 # Disallow --with-python=foo/bar.
769 AC_MSG_ERROR(invalid value for --with-python)
772 # The user has either specified auto, yes, or the name of the python
773 # program assumed to be in $PATH.
775 case "${with_python}" in
777 if test "${build}" = "${host}"; then
778 # Look first for 'python', then 'python3'.
779 AC_PATH_PROGS(python_prog_path, [python python3], missing)
780 if test "${python_prog_path}" = missing; then
783 python_prog=${python_prog_path}
786 # Not much we can do except assume the cross-compiler will find the
792 # While we can't run python compiled for $host (unless host == build),
793 # the user could write a script that provides the needed information,
794 # so we support that.
795 python_prog="${with_python}"
796 AC_PATH_PROG(python_prog_path, ${python_prog}, missing)
797 if test "${python_prog_path}" = missing; then
798 AC_MSG_ERROR(unable to find python program ${python_prog})
804 if test "${python_prog}" != missing; then
805 # We have a python program to use, but it may be too old.
806 # Don't flag an error for --with-python=auto (the default).
807 have_python_config=yes
808 python_includes=`${python_prog} ${srcdir}/python/python-config.py --includes`
809 if test $? != 0; then
810 have_python_config=failed
811 if test "${with_python}" != auto; then
812 AC_MSG_ERROR(failure running python-config --includes)
815 python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
816 if test $? != 0; then
817 have_python_config=failed
818 if test "${with_python}" != auto; then
819 AC_MSG_ERROR(failure running python-config --ldflags)
822 python_prefix=`${python_prog} ${srcdir}/python/python-config.py --exec-prefix`
823 if test $? != 0; then
824 have_python_config=failed
825 if test "${with_python}" != auto; then
826 AC_MSG_ERROR(failure running python-config --exec-prefix)
830 # We do not have a python executable we can use to determine where
831 # to find the Python headers and libs. We cannot guess the include
832 # path from the python_prefix either, because that include path
833 # depends on the Python version. So, there is nothing much we can
834 # do except assume that the compiler will be able to find those files.
837 have_python_config=no
840 # If we have python-config, only try the configuration it provides.
841 # Otherwise fallback on the old way of trying different versions of
845 if test "${have_python_config}" = yes; then
846 AC_TRY_LIBPYTHON(have_libpython,
847 ${python_includes}, ${python_libs})
850 if test "${have_libpython}" = no; then
851 case "${with_python}" in
853 AC_MSG_ERROR([python is missing or unusable])
856 AC_MSG_WARN([python is missing or unusable; some features may be unavailable.])
859 AC_MSG_ERROR([no usable python found at ${with_python}])
863 if test -n "${python_prefix}"; then
864 AC_DEFINE_UNQUOTED(WITH_PYTHON_PATH, "${python_prefix}",
865 [Define if --with-python provides a path, either directly or via python-config.py --exec-prefix.])
866 GDB_AC_DEFINE_RELOCATABLE(PYTHON_PATH, python, ${python_prefix})
871 dnl Use --with-python-libdir to control where GDB looks for the Python
874 dnl If this is not given then the default will be based on the value
875 dnl passed to --with-python, which is in the python_prefix variable.
876 dnl If the --with-python option wasn't given then the default value in
877 dnl python_prefix is based on running the 'gdb/python/python-config
878 dnl --exec-prefix' script.
879 AC_ARG_WITH(python-libdir,
880 AS_HELP_STRING([--with-python-libdir@<:@=DIR@:>@], [search for python's libraries in DIR]),
882 # If no python libdir is specified then select one based on
883 # python's prefix path.
884 if test -n "${python_prefix}"; then
885 with_python_libdir=${python_prefix}/lib
889 if test "${have_libpython}" != no; then
890 AC_DEFINE(HAVE_PYTHON, 1, [Define if Python interpreter is being linked in.])
891 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)"
892 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_PYTHON_DEPS)"
893 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_PYTHON_SRCS)"
894 CONFIG_INSTALL="$CONFIG_INSTALL install-python"
895 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)"
897 if test -n "${with_python_libdir}"; then
898 AC_DEFINE_UNQUOTED(WITH_PYTHON_LIBDIR, "${with_python_libdir}",
899 [Directory containing Python's standard libraries from --with-python-libdir.])
900 GDB_AC_DEFINE_RELOCATABLE(PYTHON_LIBDIR, [python lib], ${with_python_libdir})
903 # Flags needed to compile Python code (taken from python-config --cflags).
904 # We cannot call python-config directly because it will output whatever was
905 # used when compiling the Python interpreter itself, including flags which
906 # would make the python-related objects be compiled differently from the
907 # rest of GDB (e.g., -O2 and -fPIC).
908 if test "${GCC}" = yes; then
909 tentative_python_cflags="-fno-strict-aliasing -fwrapv"
910 # Python headers recommend -DNDEBUG, but it's unclear if that just
911 # refers to building Python itself. In release mode, though, it
912 # doesn't hurt for the Python code in gdb to follow.
913 $development || tentative_python_cflags="$tentative_python_cflags -DNDEBUG"
916 if test "x${tentative_python_cflags}" != x; then
917 AC_MSG_CHECKING(compiler flags for python code)
918 for flag in ${tentative_python_cflags}; do
919 # Check that the compiler accepts it
920 saved_CFLAGS="$CFLAGS"
921 CFLAGS="$CFLAGS $flag"
923 [AC_LANG_PROGRAM([], [])],
924 [PYTHON_CFLAGS="${PYTHON_CFLAGS} $flag"],
927 CFLAGS="$saved_CFLAGS"
929 AC_MSG_RESULT(${PYTHON_CFLAGS})
932 # On x64 Windows, Python's include headers, and pyconfig.h in
933 # particular, rely on MS_WIN64 macro to detect that it's a 64bit
934 # version of Windows. Unfortunately, MS_WIN64 is only defined if
935 # _MSC_VER, a Microsoft-specific macro, is defined. So, when
936 # building on x64 Windows with GCC, we define MS_WIN64 ourselves.
937 # The issue was reported to the Python community, but still isn't
938 # solved as of 2012-10-02 (http://bugs.python.org/issue4709).
942 if test "${GCC}" = yes; then
943 CPPFLAGS="$CPPFLAGS -DMS_WIN64"
948 # Even if Python support is not compiled in, we need to have this file
949 # included so that the "python" command, et.al., still exists.
950 CONFIG_OBS="$CONFIG_OBS python/python.o"
951 CONFIG_SRCS="$CONFIG_SRCS python/python.c"
954 # Work around Python http://bugs.python.org/issue10112. See also
955 # http://bugs.python.org/issue11410, otherwise -Wl,--dynamic-list has
956 # no effect. Note that the only test after this that uses Python is
957 # the -rdynamic/-Wl,--dynamic-list test, and we do want that one to be
958 # run without -export-dynamic too.
959 PYTHON_LIBS=`echo $PYTHON_LIBS | sed -e 's/-Xlinker -export-dynamic//'`
961 AC_SUBST(PYTHON_CFLAGS)
962 AC_SUBST(PYTHON_CPPFLAGS)
963 AC_SUBST(PYTHON_LIBS)
964 AM_CONDITIONAL(HAVE_PYTHON, test "${have_libpython}" != no)
966 # -------------------- #
967 # Check for libguile. #
968 # -------------------- #
970 dnl Utility to simplify finding libguile.
971 dnl $1 = pkg-config-program
972 dnl $2 = space-separate list of guile versions to try
973 dnl $3 = yes|no, indicating whether to flag errors or ignore them
974 dnl $4 = the shell variable to assign the result to
975 dnl If libguile is found we store "yes" here.
977 AC_DEFUN([AC_TRY_LIBGUILE],
980 guile_version_list=$2
982 define([have_libguile_var],$4)
983 found_usable_guile=checking
984 AC_MSG_CHECKING([for usable guile from ${pkg_config}])
985 for guile_version in ${guile_version_list}; do
986 ${pkg_config} --exists ${guile_version} 2>/dev/null
987 if test $? != 0; then
990 dnl pkg-config says the package exists, so if we get an error now,
992 new_CPPFLAGS=`${pkg_config} --cflags ${guile_version}`
993 if test $? != 0; then
994 AC_MSG_ERROR([failure running pkg-config --cflags ${guile_version}])
996 new_LIBS=`${pkg_config} --libs ${guile_version}`
997 if test $? != 0; then
998 AC_MSG_ERROR([failure running pkg-config --libs ${guile_version}])
1000 dnl If we get this far, great.
1001 found_usable_guile=${guile_version}
1004 if test "${found_usable_guile}" = "checking"; then
1005 if test "${flag_errors}" = "yes"; then
1006 AC_MSG_ERROR([unable to find usable guile version from "${guile_version_list}"])
1008 found_usable_guile=no
1011 dnl One final sanity check.
1012 dnl The user could have said --with-guile=python-2.7.
1013 if test "${found_usable_guile}" != no; then
1014 save_CPPFLAGS=$CPPFLAGS
1016 CPPFLAGS="$CPPFLAGS $new_CPPFLAGS"
1017 LIBS="$LIBS $new_LIBS"
1018 AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "libguile.h"]],
1019 [[scm_init_guile ();]])],
1020 [have_libguile_var=yes
1021 GUILE_CPPFLAGS=$new_CPPFLAGS
1022 GUILE_LIBS=$new_LIBS],
1023 [found_usable_guile=no])
1024 dnl scm_set_automatic_finalization_enabled added in Guile 2.2.
1025 AC_CHECK_FUNC(scm_set_automatic_finalization_enabled,
1026 AC_DEFINE(HAVE_GUILE_MANUAL_FINALIZATION, 1,
1027 [Define if Guile supports manual finalization.])
1029 CPPFLAGS=$save_CPPFLAGS
1031 if test "${found_usable_guile}" = no; then
1032 if test "${flag_errors}" = yes; then
1033 AC_MSG_FAILURE([linking guile version ${guile_version} test program failed])
1037 AC_MSG_RESULT([${found_usable_guile}])
1040 dnl There are several different values for --with-guile:
1042 dnl no - Don't include guile support.
1043 dnl yes - Include guile support, error if it's missing.
1044 dnl The pkg-config program must be in $PATH.
1045 dnl auto - Same as "yes", but if guile is missing from the system,
1046 dnl fall back to "no".
1047 dnl guile-version [guile-version-choice-2 ...] -
1048 dnl A space-separated list of guile package versions to try.
1049 dnl These are passed to pkg-config as-is.
1050 dnl E.g., guile-2.0 or guile-2.2-uninstalled
1051 dnl This requires making sure PKG_CONFIG_PATH is set appropriately.
1052 dnl /path/to/pkg-config -
1053 dnl Use this pkg-config program.
1054 dnl NOTE: This needn't be the "real" pkg-config program.
1055 dnl It could be a shell script. It is invoked as:
1056 dnl pkg-config --exists $version
1057 dnl pkg-config --cflags $version
1058 dnl pkg-config --libs $version
1059 dnl pkg-config --variable guild $version
1060 dnl The script will be called with $version having each value in
1061 dnl $try_guile_versions until --exists indicates success.
1064 AS_HELP_STRING([--with-guile@<:@=GUILE@:>@], [include guile support (auto/yes/no/<guile-version>/<pkg-config-program>)]),
1065 [], [with_guile=auto])
1066 AC_MSG_CHECKING([whether to use guile])
1067 AC_MSG_RESULT([$with_guile])
1069 dnl We check guile with pkg-config.
1070 AC_PATH_PROG(pkg_config_prog_path, pkg-config, missing)
1072 try_guile_versions="guile-3.0 guile-2.2 guile-2.0"
1074 case "${with_guile}" in
1076 AC_MSG_WARN([guile support disabled; some features will be unavailable.])
1079 if test "${pkg_config_prog_path}" = "missing"; then
1080 AC_MSG_WARN([pkg-config not found, guile support disabled])
1082 AC_TRY_LIBGUILE(${pkg_config_prog_path}, ${try_guile_versions}, no, have_libguile)
1086 if test "${pkg_config_prog_path}" = "missing"; then
1087 AC_MSG_ERROR([pkg-config not found])
1089 AC_TRY_LIBGUILE(${pkg_config_prog_path}, ${try_guile_versions}, yes, have_libguile)
1091 [[\\/]]* | ?:[[\\/]]*)
1092 if test -x "${with_guile}"; then
1093 AC_TRY_LIBGUILE(${with_guile}, ${try_guile_versions}, yes, have_libguile)
1095 AC_MSG_ERROR([Guile config program not executable: ${with_guile}])
1099 # Disallow --with=guile="" and --with-guile=foo/bar.
1100 AC_MSG_ERROR([invalid value for --with-guile])
1103 # A space separate list of guile versions to try, in order.
1104 if test "${pkg_config_prog_path}" = "missing"; then
1105 AC_MSG_ERROR([pkg-config not found])
1107 AC_TRY_LIBGUILE(${pkg_config_prog_path}, ${with_guile}, yes, have_libguile)
1111 if test "${have_libguile}" != no; then
1112 dnl Get the name of the 'guild' program.
1113 case "${with_guile}" in
1114 [[\\/]]* | ?:[[\\/]]*)
1115 GDB_GUILE_PROGRAM_NAMES(["${with_guile}"], ["${guile_version}"])
1118 GDB_GUILE_PROGRAM_NAMES(["${pkg_config_prog_path}"], ["${guile_version}"])
1122 dnl Make sure guild can handle this host.
1123 GDB_TRY_GUILD([$srcdir/guile/lib/gdb/support.scm])
1124 dnl If not, disable guile support.
1125 if test "$ac_cv_guild_ok" = no; then
1127 AC_MSG_WARN(disabling guile support, $GUILD fails compiling for $host)
1131 if test "${have_libguile}" != no; then
1132 AC_DEFINE(HAVE_GUILE, 1, [Define if Guile interpreter is being linked in.])
1133 CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_GUILE_OBS)"
1134 CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_GUILE_DEPS)"
1135 CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_GUILE_SRCS)"
1136 CONFIG_INSTALL="$CONFIG_INSTALL install-guile"
1137 ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_GUILE_CFLAGS)"
1139 dnl The 'scm_new_smob' function appeared in Guile 2.0.6.
1141 save_CPPFLAGS="$CPPFLAGS"
1143 CPPFLAGS="$GUILE_CPPFLAGS"
1144 AC_CHECK_FUNCS([scm_new_smob])
1146 CPPFLAGS="$save_CPPFLAGS"
1148 # Even if Guile support is not compiled in, we need to have these files
1150 CONFIG_OBS="$CONFIG_OBS guile/guile.o"
1151 CONFIG_SRCS="$CONFIG_SRCS guile/guile.c"
1153 AC_SUBST(GUILE_CPPFLAGS)
1154 AC_SUBST(GUILE_LIBS)
1155 AM_CONDITIONAL(HAVE_GUILE, test "${have_libguile}" != no)
1157 # ---------------------------- #
1158 # Check for source highlight. #
1159 # ---------------------------- #
1164 AC_ARG_ENABLE([source-highlight],
1165 [AS_HELP_STRING([--enable-source-highlight],
1166 [enable source-highlight for source listings])],
1167 [GDB_CHECK_YES_NO_AUTO_VAL([$enableval], [--enable-source-highlight])],
1168 [enable_source_highlight=auto])
1170 if test "${enable_source_highlight}" != "no"; then
1171 AC_MSG_CHECKING([for the source-highlight library])
1172 if test "${pkg_config_prog_path}" = "missing"; then
1173 AC_MSG_RESULT([no - pkg-config not found])
1174 if test "${enable_source_highlight}" = "yes"; then
1175 AC_MSG_ERROR([pkg-config was not found in your system])
1178 if ${pkg_config_prog_path} --exists source-highlight; then
1181 AC_MSG_ERROR([source highlight is incompatible with -static-libstdc++; dnl
1182 either use --disable-source-highlight or dnl
1183 --without-static-standard-libraries])
1187 srchigh_pkg_cflags=`${pkg_config_prog_path} --cflags source-highlight`
1188 srchigh_pkg_libs=`${pkg_config_prog_path} --libs source-highlight`
1190 # Now that we have found a source-highlight library, check if we can use
1191 # it. In particular, we're trying to detect the situation that the
1192 # library is using the new libstdc++ library abi ( see
1193 # https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html )
1194 # while the compiler being used to compile gdb is using the old abi.
1195 # Such a situation will result in an undefined reference to
1196 # srchilite::SourceHighlight::SourceHighlight(std::string const&).
1197 # This situation can occur for instance when using a source highlight
1198 # library compiled with g++ 7.5.0 while building gdb with g++ 4.8.5.
1200 save_CXXFLAGS="$CXXFLAGS"
1202 CXXFLAGS="$CXXFLAGS $srchigh_pkg_cflags"
1203 LIBS="$LIBS $srchigh_pkg_libs"
1206 [#include <srchilite/sourcehighlight.h>],
1207 [std::string outlang = "esc.outlang";
1208 new srchilite::SourceHighlight (outlang);]
1210 [have_usable_source_highlight=yes],
1211 [have_usable_source_highlight=no]
1213 CXXFLAGS="$save_CXXFLAGS"
1217 if test "${have_usable_source_highlight}" = "yes"; then
1218 AC_DEFINE([HAVE_SOURCE_HIGHLIGHT], 1,
1219 [Define to 1 if the source-highlight library is available])
1220 AC_MSG_RESULT([yes])
1221 SRCHIGH_CFLAGS="$srchigh_pkg_cflags"
1222 SRCHIGH_LIBS="$srchigh_pkg_libs"
1225 if test "${enable_source_highlight}" = "yes"; then
1226 AC_MSG_ERROR([source-highlight in your system could not be used])
1231 if test "${enable_source_highlight}" = "yes"; then
1232 AC_MSG_ERROR([source-highlight was not found in your system])
1237 AC_SUBST(SRCHIGH_LIBS)
1238 AC_SUBST(SRCHIGH_CFLAGS)
1240 # ------------------------- #
1241 # Checks for header files. #
1242 # ------------------------- #
1245 # elf_hp.h is for HP/UX 64-bit shared library support.
1246 AC_CHECK_HEADERS([nlist.h machine/reg.h \
1248 sys/file.h sys/filio.h sys/ioctl.h sys/param.h \
1249 sys/procctl.h sys/resource.h sys/ptrace.h ptrace.h \
1250 sys/reg.h sys/debugreg.h \
1251 termios.h elf_hp.h])
1252 AC_CHECK_HEADERS(sys/user.h, [], [],
1253 [#if HAVE_SYS_PARAM_H
1254 # include <sys/param.h>
1258 AC_CHECK_HEADERS(curses.h cursesX.h ncurses.h ncursesw/ncurses.h ncurses/ncurses.h ncurses/term.h)
1259 AC_CHECK_HEADERS(term.h, [], [],
1261 # include <curses.h>
1265 AC_CHECK_HEADERS([sys/socket.h])
1266 AC_CHECK_HEADERS([ws2tcpip.h])
1267 AC_CHECK_HEADERS([execinfo.h])
1269 # ------------------------- #
1270 # Checks for declarations. #
1271 # ------------------------- #
1275 AC_CHECK_DECLS([snprintf])
1278 # ------------------ #
1279 # Checks for types. #
1280 # ------------------ #
1282 AC_CHECK_TYPES(socklen_t, [], [],
1283 [#include <sys/types.h>
1284 #if HAVE_SYS_SOCKET_H
1285 # include <sys/socket.h>
1286 #elif HAVE_WS2TCPIP_H
1287 # include <ws2tcpip.h>
1291 # ------------------------------------- #
1292 # Checks for compiler characteristics. #
1293 # ------------------------------------- #
1299 # ------------------------------ #
1300 # Checks for library functions. #
1301 # ------------------------------ #
1303 AC_CHECK_FUNCS([getuid getgid \
1304 pipe pread pread64 pwrite resize_term \
1306 sigaction sigsetmask socketpair \
1307 ttrace wborder wresize setlocale iconvlist libiconvlist btowc \
1308 setrlimit getrlimit posix_madvise waitpid \
1309 use_default_colors])
1313 # Check the return and argument types of ptrace.
1316 dnl AC_FUNC_SETPGRP does not work when cross compiling
1317 dnl Instead, assume we will have a prototype for setpgrp if cross compiling.
1318 if test "$cross_compiling" = no; then
1322 [whether setpgrp takes no argument],
1323 [ac_cv_func_setpgrp_void],
1326 [#include <unistd.h>],
1327 [if (setpgrp(1,1) == -1)
1332 [ac_cv_func_setpgrp_void=no],
1333 [ac_cv_func_setpgrp_void=yes]
1336 if test "$ac_cv_func_setpgrp_void" = yes; then
1337 AC_DEFINE(SETPGRP_VOID, 1)
1341 # Check if <sys/proc.h> defines `struct thread' with a td_pcb member.
1342 AC_CHECK_MEMBERS([struct thread.td_pcb], [], [],
1343 [#include <sys/param.h>
1344 #include <sys/proc.h>
1347 # See if <sys/lwp.h> defines `struct lwp`.
1350 [gdb_cv_struct_lwp],
1353 [#include <sys/param.h>
1355 #include <sys/lwp.h>],
1358 [gdb_cv_struct_lwp=yes],
1359 [gdb_cv_struct_lwp=no]
1362 if test "$gdb_cv_struct_lwp" = yes; then
1363 AC_DEFINE(HAVE_STRUCT_LWP, 1,
1364 [Define to 1 if your system has struct lwp.])
1367 # See if <machine/reg.h> degines `struct reg'.
1369 [for struct reg in machine/reg.h],
1370 [gdb_cv_struct_reg],
1373 [#include <sys/types.h>
1374 #include <machine/reg.h>],
1377 [gdb_cv_struct_reg=yes],
1378 [gdb_cv_struct_reg=no]
1381 if test "$gdb_cv_struct_reg" = yes; then
1382 AC_DEFINE(HAVE_STRUCT_REG, 1,
1383 [Define to 1 if your system has struct reg in <machine/reg.h>.])
1386 # See if <machine/reg.h> supports the %fs and %gs i386 segment registers.
1387 # Older i386 BSD's don't have the r_fs and r_gs members of `struct reg'.
1388 AC_CHECK_MEMBERS([struct reg.r_fs, struct reg.r_gs], [], [],
1389 [#include <sys/types.h>
1390 #include <machine/reg.h>])
1392 # See if <sys/ptrace.h> provides the PTRACE_GETREGS request.
1393 AC_MSG_CHECKING(for PTRACE_GETREGS)
1395 [gdb_cv_have_ptrace_getregs],
1397 [AC_LANG_PROGRAM([#include <sys/ptrace.h>], [PTRACE_GETREGS;])],
1398 [gdb_cv_have_ptrace_getregs=yes],
1399 [gdb_cv_have_ptrace_getregs=no]
1402 AC_MSG_RESULT($gdb_cv_have_ptrace_getregs)
1403 if test "$gdb_cv_have_ptrace_getregs" = yes; then
1404 AC_DEFINE(HAVE_PTRACE_GETREGS, 1,
1405 [Define if sys/ptrace.h defines the PTRACE_GETREGS request.])
1408 # See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request.
1409 AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
1411 [gdb_cv_have_ptrace_getfpxregs],
1413 [AC_LANG_PROGRAM([#include <sys/ptrace.h>], [PTRACE_GETFPXREGS;])],
1414 [gdb_cv_have_ptrace_getfpxregs=yes],
1415 [gdb_cv_have_ptrace_getfpxregs=no]
1418 AC_MSG_RESULT($gdb_cv_have_ptrace_getfpxregs)
1419 if test "$gdb_cv_have_ptrace_getfpxregs" = yes; then
1420 AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1,
1421 [Define if sys/ptrace.h defines the PTRACE_GETFPXREGS request.])
1424 # See if <sys/ptrace.h> provides the PT_GETDBREGS request.
1425 AC_MSG_CHECKING(for PT_GETDBREGS)
1427 [gdb_cv_have_pt_getdbregs],
1430 [#include <sys/types.h>
1431 #include <sys/ptrace.h>],
1434 [gdb_cv_have_pt_getdbregs=yes],
1435 [gdb_cv_have_pt_getdbregs=no]
1438 AC_MSG_RESULT($gdb_cv_have_pt_getdbregs)
1439 if test "$gdb_cv_have_pt_getdbregs" = yes; then
1440 AC_DEFINE(HAVE_PT_GETDBREGS, 1,
1441 [Define if sys/ptrace.h defines the PT_GETDBREGS request.])
1444 # See if <sys/ptrace.h> supports LWP names on FreeBSD
1445 # Older FreeBSD versions don't have the pl_tdname member of
1446 # `struct ptrace_lwpinfo'.
1447 AC_CHECK_MEMBERS([struct ptrace_lwpinfo.pl_tdname], [], [],
1448 [#include <sys/ptrace.h>])
1450 # See if <sys/ptrace.h> supports syscall fields on FreeBSD. The
1451 # pl_syscall_code member of `struct ptrace_lwpinfo' was added in
1453 AC_CHECK_MEMBERS([struct ptrace_lwpinfo.pl_syscall_code], [], [],
1454 [#include <sys/ptrace.h>])
1456 # Check if the compiler supports the `long long' type.
1458 AC_CACHE_CHECK([for long long support in compiler], gdb_cv_c_long_long,
1459 [AC_COMPILE_IFELSE([AC_LANG_PROGRAM(
1460 [[extern long long foo;]],
1461 [[switch (foo & 2) { case 0: return 1; }]])],
1462 gdb_cv_c_long_long=yes,
1463 gdb_cv_c_long_long=no)])
1464 if test "$gdb_cv_c_long_long" != yes; then
1465 # libdecnumber requires long long.
1466 AC_MSG_ERROR([Compiler must support long long for GDB.])
1469 # Check if the compiler and runtime support printing decfloats.
1471 AC_CACHE_CHECK([for decfloat support in printf],
1472 gdb_cv_printf_has_decfloat,
1473 [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
1475 _Decimal32 d32 = 1.2345df;
1476 _Decimal64 d64 = 1.2345dd;
1477 _Decimal128 d128 = 1.2345dl;
1478 sprintf (buf, "Decimal32: %H\nDecimal64: %D\nDecimal128: %DD", d32, d64, d128);
1479 return (strcmp ("Decimal32: 1.2345\nDecimal64: 1.2345\nDecimal128: 1.2345", buf));]])],
1480 gdb_cv_printf_has_decfloat=yes,
1481 gdb_cv_printf_has_decfloat=no,
1482 gdb_cv_printf_has_decfloat=no)])
1483 if test "$gdb_cv_printf_has_decfloat" = yes; then
1484 AC_DEFINE(PRINTF_HAS_DECFLOAT, 1,
1485 [Define to 1 if the "%H, %D and %DD" formats work to print decfloats.])
1488 # Check if the compiler supports the `long double' type. We can't use
1489 # AC_C_LONG_DOUBLE because that one does additional checks on the
1490 # constants defined in <float.h> that fail on some systems,
1491 # e.g. FreeBSD/i386 4.7 and OpenBSD/i386 3.6.
1493 AC_CACHE_CHECK([for long double support in compiler], gdb_cv_c_long_double,
1494 [AC_COMPILE_IFELSE([AC_LANG_SOURCE([[long double foo;]])],
1495 gdb_cv_c_long_double=yes,
1496 gdb_cv_c_long_double=no)])
1497 if test "$gdb_cv_c_long_double" = yes; then
1498 AC_DEFINE(HAVE_LONG_DOUBLE, 1,
1499 [Define to 1 if the compiler supports long double.])
1502 # Check if the compiler and runtime support printing long doubles.
1504 AC_CACHE_CHECK([for long double support in printf],
1505 gdb_cv_printf_has_long_double,
1506 [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
1508 long double f = 3.141592653;
1509 sprintf (buf, "%Lg", f);
1510 return (strncmp ("3.14159", buf, 7));]])],
1511 gdb_cv_printf_has_long_double=yes,
1512 gdb_cv_printf_has_long_double=no,
1513 gdb_cv_printf_has_long_double=no)])
1514 if test "$gdb_cv_printf_has_long_double" = yes; then
1515 AC_DEFINE(PRINTF_HAS_LONG_DOUBLE, 1,
1516 [Define to 1 if the "%Lg" format works to print long doubles.])
1519 # Check if the compiler and runtime support scanning long doubles.
1521 AC_CACHE_CHECK([for long double support in scanf],
1522 gdb_cv_scanf_has_long_double,
1523 [AC_RUN_IFELSE([AC_LANG_PROGRAM(
1524 [[#include <stdio.h>]],
1525 [[char *buf = "3.141592653";
1527 sscanf (buf, "%Lg", &f);
1528 return !(f > 3.14159 && f < 3.14160);]])],
1529 gdb_cv_scanf_has_long_double=yes,
1530 gdb_cv_scanf_has_long_double=no,
1531 gdb_cv_scanf_has_long_double=no)])
1532 if test "$gdb_cv_scanf_has_long_double" = yes; then
1533 AC_DEFINE(SCANF_HAS_LONG_DOUBLE, 1,
1534 [Define to 1 if the "%Lg" format works to scan long doubles.])
1540 [for -bbigtoc option], [gdb_cv_bigtoc],
1541 [SAVE_LDFLAGS=$LDFLAGS
1544 yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
1545 *) gdb_cv_bigtoc=-bbigtoc ;;
1548 LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
1550 [AC_LANG_PROGRAM([], [int i;])],
1554 LDFLAGS="${SAVE_LDFLAGS}"]
1556 CONFIG_LDFLAGS="${CONFIG_LDFLAGS} ${gdb_cv_bigtoc}"
1560 AC_MSG_CHECKING(for the dynamic export flag)
1562 if test "${gdb_native}" = yes; then
1563 # The dynamically loaded libthread_db needs access to symbols in the gdb
1564 # executable. Older GNU ld supports --export-dynamic but --dynamic-list
1565 # may not be supported there.
1566 old_LDFLAGS="$LDFLAGS"
1567 # Older GNU ld supports --export-dynamic but --dynamic-list it does not.
1568 RDYNAMIC="-Wl,--dynamic-list=${srcdir}/proc-service.list"
1569 LDFLAGS="$LDFLAGS $RDYNAMIC"
1570 if test "${have_libpython}" = no; then
1572 [AC_LANG_PROGRAM([], [])],
1573 [dynamic_list=true],
1577 # Workaround http://bugs.python.org/issue4434 where static
1578 # libpythonX.Y.a would get its symbols required for
1579 # pythonX.Y/lib-dynload/*.so modules hidden by -Wl,--dynamic-list.
1580 # Problem does not happen for the recommended libpythonX.Y.so linkage.
1582 # Note the workaround for Python
1583 # http://bugs.python.org/issue10112 earlier has removed
1584 # -export-dynamic from PYTHON_LIBS. That's exactly what we want
1585 # here too, as otherwise it'd make this -Wl,--dynamic-list test
1587 old_CFLAGS="$CFLAGS"
1588 CFLAGS="$CFLAGS $PYTHON_CFLAGS"
1590 LIBS="$LIBS $PYTHON_LIBS"
1591 old_CPPFLAGS="$CPPFLAGS"
1592 CPPFLAGS="$CPPFLAGS $PYTHON_CPPFLAGS"
1595 [#include "Python.h"],
1598 err = PyRun_SimpleString ("import ctypes\n");
1600 return err == 0 ? 0 : 1;])],
1601 [dynamic_list=true], [], [true])
1603 CFLAGS="$old_CFLAGS"
1604 CPPFLAGS="$old_CPPFLAGS"
1606 LDFLAGS="$old_LDFLAGS"
1608 if $dynamic_list; then
1609 found="-Wl,--dynamic-list"
1610 RDYNAMIC='-Wl,--dynamic-list=$(srcdir)/proc-service.list'
1613 RDYNAMIC="-rdynamic"
1616 AC_MSG_RESULT($found)
1619 [whether execinfo.h backtrace is available],
1620 gdb_cv_execinfo_backtrace,
1624 #include <execinfo.h>
1629 f = backtrace (b, 2);
1630 backtrace_symbols_fd (b, f, 2);
1632 [gdb_cv_execinfo_backtrace=yes],
1633 [gdb_cv_execinfo_backtrace=no])])
1634 if test "$gdb_cv_execinfo_backtrace" = yes; then
1635 AC_DEFINE(HAVE_EXECINFO_BACKTRACE, 1,
1636 [Define to 1 if execinfo.h backtrace functions are available.])
1639 dnl For certain native configurations, we need to check whether thread
1640 dnl support can be built in or not.
1642 dnl Note that we only want this if we are both native (host == target),
1643 dnl and not doing a canadian cross build (build == host).
1645 if test "${build}" = "${host}" -a "${host}" = "${target}" ; then
1648 AC_MSG_CHECKING(for AiX thread debugging library)
1650 [gdb_cv_have_aix_thread_debug],
1653 [#include <sys/pthdebug.h>],
1654 [#ifndef PTHDB_VERSION_3
1658 [gdb_cv_have_aix_thread_debug=yes],
1659 [gdb_cv_have_aix_thread_debug=no]
1662 AC_MSG_RESULT($gdb_cv_have_aix_thread_debug)
1663 if test "$gdb_cv_have_aix_thread_debug" = yes; then
1664 CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c"
1665 CONFIG_OBS="${CONFIG_OBS} aix-thread.o"
1666 LIBS="$LIBS -lpthdebug"
1668 # Older versions of AIX do not provide the declaration for
1669 # the getthrds function (it appears that it was introduced
1671 AC_CHECK_DECLS(getthrds, [], [], [[#include <procinfo.h>]])
1675 AC_SUBST(CONFIG_LDFLAGS)
1678 dnl See if we have a thread_db header file that has TD_NOTALLOC and
1679 dnl other error codes.
1680 if test "x$ac_cv_header_thread_db_h" = "xyes"; then
1682 [whether <thread_db.h> has TD_NOTALLOC],
1683 [gdb_cv_thread_db_h_has_td_notalloc],
1686 [#include <thread_db.h>],
1687 [int i = TD_NOTALLOC;]
1689 [gdb_cv_thread_db_h_has_td_notalloc=yes],
1690 [gdb_cv_thread_db_h_has_td_notalloc=no]
1695 [whether <thread_db.h> has TD_VERSION],
1696 [gdb_cv_thread_db_h_has_td_version],
1699 [#include <thread_db.h>],
1700 [int i = TD_VERSION;]
1702 [gdb_cv_thread_db_h_has_td_version=yes],
1703 [gdb_cv_thread_db_h_has_td_version=no]
1708 [whether <thread_db.h> has TD_NOTLS],
1709 [gdb_cv_thread_db_h_has_td_notls],
1712 [#include <thread_db.h>],
1715 [gdb_cv_thread_db_h_has_td_notls=yes],
1716 [gdb_cv_thread_db_h_has_td_notls=no]
1720 if test "x$gdb_cv_thread_db_h_has_td_notalloc" = "xyes"; then
1721 AC_DEFINE(THREAD_DB_HAS_TD_NOTALLOC, 1,
1722 [Define if <thread_db.h> has the TD_NOTALLOC error code.])
1724 if test "x$gdb_cv_thread_db_h_has_td_version" = "xyes"; then
1725 AC_DEFINE(THREAD_DB_HAS_TD_VERSION, 1,
1726 [Define if <thread_db.h> has the TD_VERSION error code.])
1728 if test "x$gdb_cv_thread_db_h_has_td_notls" = "xyes"; then
1729 AC_DEFINE(THREAD_DB_HAS_TD_NOTLS, 1,
1730 [Define if <thread_db.h> has the TD_NOTLS error code.])
1733 dnl Set the host's .gdbinit filename.
1742 AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.])
1744 dnl Set the host's .gdbearlyinit filename
1745 AC_DEFINE_UNQUOTED(GDBEARLYINIT,".gdbearlyinit",[The .gdbearlyinit filename.])
1747 dnl Handle optional features that can be enabled.
1749 # Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
1750 # except that the argument to --with-sysroot is optional.
1751 # --with-sysroot (or --with-sysroot=yes) sets the default sysroot path.
1752 if test "x$with_sysroot" = xyes; then
1753 with_sysroot="${exec_prefix}/${target_alias}/sys-root"
1755 AC_ARG_WITH(sysroot,
1756 AS_HELP_STRING([--with-sysroot@<:@=DIR@:>@],
1757 [search for usr/lib et al within DIR]),
1758 [TARGET_SYSTEM_ROOT=$withval], [TARGET_SYSTEM_ROOT=])
1759 AC_DEFINE_DIR(TARGET_SYSTEM_ROOT, TARGET_SYSTEM_ROOT,
1760 [search for usr/lib et al within DIR])
1761 AC_SUBST(TARGET_SYSTEM_ROOT)
1762 GDB_AC_DEFINE_RELOCATABLE(TARGET_SYSTEM_ROOT, sysroot, ${ac_define_dir})
1764 GDB_AC_WITH_DIR(SYSTEM_GDBINIT, system-gdbinit,
1765 [automatically load a system-wide gdbinit file],
1767 GDB_AC_WITH_DIR(SYSTEM_GDBINIT_DIR, system-gdbinit-dir,
1768 [automatically load system-wide gdbinit files from this directory],
1771 AM_GDB_COMPILER_TYPE
1775 # In the Cygwin environment, we need some additional flags.
1776 AC_CACHE_CHECK([for cygwin], gdb_cv_os_cygwin,
1777 [AC_EGREP_CPP(^lose$, [
1778 #if defined (__CYGWIN__) || defined (__CYGWIN32__)
1780 #endif],[gdb_cv_os_cygwin=yes],[gdb_cv_os_cygwin=no])])
1783 dnl Figure out which of the many generic ser-*.c files the _host_ supports.
1784 SER_HARDWIRE="ser-base.o ser-unix.o ser-pipe.o ser-tcp.o"
1786 *go32* ) SER_HARDWIRE=ser-go32.o ;;
1787 *djgpp* ) SER_HARDWIRE=ser-go32.o ;;
1788 *mingw32*) SER_HARDWIRE="ser-base.o ser-tcp.o ser-mingw.o" ;;
1789 *) SER_HARDWIRE="$SER_HARDWIRE ser-uds.o" ;;
1791 AC_SUBST(SER_HARDWIRE)
1793 # libreadline needs libuser32.a in a cygwin environment
1795 if test x"$gdb_cv_os_cygwin" = xyes; then
1796 WIN32LIBS="-luser32"
1798 *cygwin*) WIN32LIBS="$WIN32LIBS -limagehlp"
1803 # The ser-tcp.c module requires sockets.
1804 # Note that WIN32APILIBS is set by GDB_AC_COMMON.
1805 WIN32LIBS="$WIN32LIBS $WIN32APILIBS"
1807 # Add ELF support to GDB, but only if BFD includes ELF support.
1808 GDB_AC_CHECK_BFD([for ELF support in BFD], gdb_cv_var_elf,
1809 [bfd_get_elf_phdr_upper_bound (NULL)], elf-bfd.h)
1810 if test "$gdb_cv_var_elf" = yes; then
1811 CONFIG_OBS="$CONFIG_OBS elfread.o stap-probe.o dtrace-probe.o \
1812 gcore-elf.o elf-none-tdep.o"
1813 AC_DEFINE(HAVE_ELF, 1,
1814 [Define if ELF support should be included.])
1815 # -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
1816 if test "$plugins" = "yes"; then
1817 AC_SEARCH_LIBS(dlopen, dl)
1821 # Add macho support to GDB, but only if BFD includes it.
1822 GDB_AC_CHECK_BFD([for Mach-O support in BFD], gdb_cv_var_macho,
1823 [bfd_mach_o_lookup_command (NULL, 0, NULL)], mach-o.h)
1824 if test "$gdb_cv_var_macho" = yes; then
1825 CONFIG_OBS="$CONFIG_OBS machoread.o"
1828 # Add any host-specific objects to GDB.
1829 CONFIG_OBS="${CONFIG_OBS} ${gdb_host_obs}"
1831 # If building on ELF, look for lzma support for embedded compressed debug info.
1832 if test "$gdb_cv_var_elf" = yes; then
1834 AS_HELP_STRING([--with-lzma], [support lzma compression (auto/yes/no)]),
1835 [], [with_lzma=auto])
1836 AC_MSG_CHECKING([whether to use lzma])
1837 AC_MSG_RESULT([$with_lzma])
1839 if test "${with_lzma}" != no; then
1840 AC_LIB_HAVE_LINKFLAGS([lzma], [], [#include "lzma.h"],
1841 [lzma_index_iter iter;
1842 lzma_index_iter_init (&iter, 0);
1843 lzma_mf_is_supported (LZMA_MF_HC3);])
1844 if test "$HAVE_LIBLZMA" != yes; then
1845 if test "$with_lzma" = yes; then
1846 AC_MSG_ERROR([missing liblzma for --with-lzma])
1852 LIBGUI="../libgui/src/libgui.a"
1853 GUI_CFLAGS_X="-I${srcdir}/../libgui/src"
1855 AC_SUBST(GUI_CFLAGS_X)
1859 AC_SUBST(WIN32LDAPP)
1862 *-*-cygwin* | *-*-mingw* )
1871 if test "${enable_gdbtk}" = "yes"; then
1873 # Gdbtk must have an absolute path to srcdir in order to run
1874 # properly when not installed.
1882 # If $no_tk is nonempty, then we can't do Tk, and there is no
1883 # point to doing Tcl.
1886 if test -z "${no_tcl}" -a -z "${no_tk}"; then
1889 # Check for in-tree tcl
1896 if test "${TCL_SRC_DIR}" = "${topdir}/tcl"; then
1900 # Find Tcl private headers
1901 if test x"${intree}" = xno; then
1902 CY_AC_TCL_PRIVATE_HEADERS
1903 TCL_INCLUDE="${TCL_INCLUDE_SPEC} ${TCL_PRIVATE_INCLUDE}"
1904 TCL_LIBRARY="${TCL_LIB_SPEC}"
1907 # If building tcl in the same src tree, private headers
1908 # are not needed, but we need to be sure to use the right
1910 TCL_INCLUDE="-I${TCL_SRC_DIR}/generic"
1911 TCL_LIBRARY="${TCL_BUILD_LIB_SPEC}"
1912 TCL_DEPS="../tcl/${configdir}${TCL_LIB_FILE}"
1914 AC_SUBST(TCL_INCLUDE)
1915 AC_SUBST(TCL_LIBRARY)
1920 # Check for in-tree Tk
1922 if test "${TK_SRC_DIR}" = "${topdir}/tk"; then
1926 # Find Tk private headers
1927 if test x"${intree}" = xno; then
1928 CY_AC_TK_PRIVATE_HEADERS
1929 TK_INCLUDE="${TK_INCLUDE_SPEC} ${TK_PRIVATE_INCLUDE}"
1930 TK_LIBRARY=${TK_LIB_SPEC}
1933 TK_INCLUDE="-I${TK_SRC_DIR}/generic"
1934 TK_LIBRARY="${TK_BUILD_LIB_SPEC}"
1935 TK_DEPS="../tk/${configdir}/${TK_LIB_FILE}"
1937 AC_SUBST(TK_INCLUDE)
1938 AC_SUBST(TK_LIBRARY)
1940 AC_SUBST(TK_XINCLUDES)
1942 ENABLE_CFLAGS="${ENABLE_CFLAGS} \$(SUBDIR_GDBTK_CFLAGS)"
1944 # Include some libraries that Tcl and Tk want.
1945 TCL_LIBS='$(LIBGUI) $(TK) $(TCL) $(X11_LDFLAGS) $(X11_LIBS)'
1946 # Yes, the ordering seems wrong here. But it isn't.
1947 # TK_LIBS is the list of libraries that need to be linked
1948 # after Tcl/Tk. Note that this isn't put into LIBS. If it
1949 # were in LIBS then any link tests after this point would
1950 # try to include things like `$(LIBGUI)', which wouldn't work.
1951 GDBTKLIBS="${TCL_LIBS} ${TK_LIBS}"
1953 CONFIG_OBS="${CONFIG_OBS} \$(SUBDIR_GDBTK_OBS)"
1954 CONFIG_DEPS="${CONFIG_DEPS} \$(SUBDIR_GDBTK_DEPS)"
1955 CONFIG_SRCS="${CONFIG_SRCS} \$(SUBDIR_GDBTK_SRCS)"
1956 CONFIG_ALL="${CONFIG_ALL} all-gdbtk"
1957 CONFIG_CLEAN="${CONFIG_CLEAN} clean-gdbtk"
1958 CONFIG_INSTALL="${CONFIG_INSTALL} install-gdbtk"
1959 CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-gdbtk"
1961 if test x"$gdb_cv_os_cygwin" = xyes; then
1962 WIN32LIBS="${WIN32LIBS} -lshell32 -lgdi32 -lcomdlg32 -ladvapi32"
1963 WIN32LDAPP="-Wl,--subsystem,console"
1964 CONFIG_OBS="${CONFIG_OBS} gdbres.o"
1967 AC_CONFIG_SUBDIRS(gdbtk)
1975 AC_SUBST(GDBTK_CFLAGS)
1976 AC_SUBST(GDBTK_SRC_DIR)
1980 # Unlike the sim directory, whether a simulator is linked is controlled by
1981 # presence of a gdb_sim definition in the target configure.tgt entry.
1982 # This code just checks for a few cases where we'd like to ignore those
1983 # definitions, even when they're present in the '.mt' file. These cases
1984 # are when --disable-sim is specified, or if the simulator directory is
1985 # not part of the source tree.
1988 AS_HELP_STRING([--enable-sim], [link gdb with simulator]),
1989 [echo "enable_sim = $enable_sim";
1990 echo "enableval = ${enableval}";
1991 case "${enableval}" in
1992 yes) ignore_sim=false ;;
1993 no) ignore_sim=true ;;
1994 *) ignore_sim=false ;;
1998 if test ! -d "${srcdir}/../sim"; then
2004 if test "${ignore_sim}" = "false"; then
2005 if test x"${gdb_sim}" != x ; then
2007 SIM_OBS="remote-sim.o"
2009 # Some tdep code should only be compiled in when the ppc sim is
2010 # built. PR sim/13418.
2013 AC_DEFINE(WITH_PPC_SIM, 1, [Define if the PPC simulator is being linked in.])
2021 AC_SUBST(ENABLE_CFLAGS)
2022 AC_SUBST(PROFILE_CFLAGS)
2024 AC_SUBST(CONFIG_OBS)
2025 AC_SUBST(CONFIG_DEPS)
2026 AC_SUBST(CONFIG_SRCS)
2027 AC_SUBST(CONFIG_ALL)
2028 AC_SUBST(CONFIG_CLEAN)
2029 AC_SUBST(CONFIG_INSTALL)
2030 AC_SUBST(CONFIG_UNINSTALL)
2032 # List of host floatformats.
2033 AC_DEFINE_UNQUOTED(GDB_HOST_FLOAT_FORMAT,$gdb_host_float_format,[Host float floatformat])
2034 AC_DEFINE_UNQUOTED(GDB_HOST_DOUBLE_FORMAT,$gdb_host_double_format,[Host double floatformat])
2035 AC_DEFINE_UNQUOTED(GDB_HOST_LONG_DOUBLE_FORMAT,$gdb_host_long_double_format,[Host long double floatformat])
2037 # target_subdir is used by the testsuite to find the target libraries.
2039 if test "${host}" != "${target}"; then
2040 target_subdir="${target_alias}/"
2042 AC_SUBST(target_subdir)
2044 # Import nat definitions.
2045 nat_makefile_frag=/dev/null
2046 if test "${gdb_native}" = "yes"; then
2047 . ${srcdir}/configure.nat
2048 nativefile=$NAT_FILE
2052 AC_SUBST(NATDEPFILES)
2057 AC_SUBST(NAT_GENERATED_FILES)
2058 AC_SUBST(HAVE_NATIVE_GCORE_HOST)
2059 AC_SUBST_FILE(nat_makefile_frag)
2061 if test x"${gdb_osabi}" != x ; then
2062 AC_DEFINE_UNQUOTED(GDB_OSABI_DEFAULT, $gdb_osabi,
2063 [Define to the default OS ABI for this configuration.])
2066 # Setup possible use of libbacktrace.
2067 AC_ARG_ENABLE([libbacktrace],
2068 [AS_HELP_STRING([--enable-libbacktrace],
2069 [use libbacktrace to write a backtrace after a fatal signal.])],
2070 [GDB_CHECK_YES_NO_VAL([$enableval], [--enable-libbacktrace])],
2071 [enable_libbacktrace=yes])
2073 if test "${enable_libbacktrace}" = "yes"; then
2074 LIBBACKTRACE_INC="-I$srcdir/../libbacktrace/ -I../libbacktrace/"
2075 LIBBACKTRACE_LIB=../libbacktrace/libbacktrace.la
2076 AC_DEFINE(HAVE_LIBBACKTRACE, 1, [Define if libbacktrace is being used.])
2082 AC_SUBST(LIBBACKTRACE_INC)
2083 AC_SUBST(LIBBACKTRACE_LIB)
2085 # Check for babeltrace and babeltrace-ctf
2086 AC_ARG_WITH(babeltrace,
2087 AS_HELP_STRING([--with-babeltrace], [include babeltrace support (auto/yes/no)]),
2088 [], [with_babeltrace=auto])
2089 AC_MSG_CHECKING([whether to use babeltrace])
2090 AC_MSG_RESULT([$with_babeltrace])
2092 if test "x$with_babeltrace" = "xno"; then
2093 AC_MSG_WARN([babletrace support disabled; GDB is unable to read CTF data.])
2095 # Append -Werror to CFLAGS so that configure can catch the warning
2096 # "assignment from incompatible pointer type", which is related to
2097 # the babeltrace change from 1.0.3 to 1.1.0. Babeltrace 1.1.0 works
2098 # in GDB, while babeltrace 1.0.3 is broken.
2099 # AC_LIB_HAVE_LINKFLAGS may modify CPPFLAGS in it, so it should be
2100 # safe to save and restore CFLAGS here.
2101 saved_CFLAGS=$CFLAGS
2102 CFLAGS="$CFLAGS -Werror"
2103 AC_LIB_HAVE_LINKFLAGS([babeltrace], [babeltrace-ctf],
2104 [#include <babeltrace/babeltrace.h>
2105 #include <babeltrace/ctf/events.h>
2106 #include <babeltrace/ctf/iterator.h>],
2107 [struct bt_iter_pos *pos = bt_iter_get_pos (bt_ctf_get_iter (NULL));
2108 struct bt_ctf_event *event = NULL;
2109 const struct bt_definition *scope;
2111 pos->type = BT_SEEK_BEGIN;
2112 bt_iter_set_pos (bt_ctf_get_iter (NULL), pos);
2113 scope = bt_ctf_get_top_level_scope (event,
2114 BT_STREAM_EVENT_HEADER);
2115 bt_ctf_get_uint64 (bt_ctf_get_field (event, scope, "id"));
2117 CFLAGS=$saved_CFLAGS
2119 if test "$HAVE_LIBBABELTRACE" != yes; then
2120 if test "$with_babeltrace" = yes; then
2121 AC_MSG_ERROR([babeltrace is missing or unusable])
2123 AC_MSG_WARN([babeltrace is missing or unusable; GDB is unable to read CTF data.])
2130 AS_HELP_STRING([--with-xxhash], [use libxxhash for hashing (faster) (auto/yes/no)]),
2131 [], [with_xxhash=auto])
2133 GCC_ENABLE([libctf], [yes], [], [Handle .ctf type-info sections])
2134 if test "${enable_libctf}" = yes; then
2135 AC_DEFINE(ENABLE_LIBCTF, 1, [Handle .ctf type-info sections])
2136 LIBCTF="../libctf/libctf.la"
2137 CTF_DEPS="../libctf/libctf.la"
2145 # If nativefile (NAT_FILE) is not set in configure.nat, we link to an
2148 if test "x$with_xxhash" != "xno"; then
2149 AC_LIB_HAVE_LINKFLAGS([xxhash], [],
2150 [#include <xxhash.h>],
2151 [XXH32("foo", 3, 0);
2153 if test "$HAVE_LIBXXHASH" != yes; then
2154 if test "$with_xxhash" = yes; then
2155 AC_MSG_ERROR([xxhash is missing or unusable])
2158 if test "x$with_xxhash" = "xauto"; then
2159 with_xxhash="$HAVE_LIBXXHASH"
2163 AC_MSG_CHECKING([whether to use xxhash])
2164 AC_MSG_RESULT([$with_xxhash])
2168 if test "${nativefile}" != ""; then
2169 case "${nativefile}" in
2170 nm-*.h ) GDB_NM_FILE="config/${gdb_host_cpu}/${nativefile}" ;;
2171 * ) GDB_NM_FILE="${nativefile}"
2173 AC_CONFIG_LINKS([nm.h:$GDB_NM_FILE], [echo > stamp-nmh],
2174 [GDB_NM_FILE=$GDB_NM_FILE])
2175 AC_DEFINE_UNQUOTED(GDB_NM_FILE, "${GDB_NM_FILE}", [nativefile])
2178 AC_SUBST(GDB_NM_FILE)
2181 dnl Add dependency for xsltproc if building with maintainer-mode enabled.
2182 AC_PATH_PROGS(XSLTPROC, xsltproc, missing)
2183 if test "x$USE_MAINTAINER_MODE" = xyes; then
2184 if test "${XSLTPROC}" = missing; then
2185 AC_MSG_ERROR(unable to find xsltproc. maintainer-mode requires xsltproc.)
2190 dnl Check for exe extension set on certain hosts (e.g. Win32)
2193 dnl Detect the character set used by this host.
2194 dnl At the moment, we just assume it's UTF-8.
2195 AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "UTF-8",
2196 [Define to be a string naming the default host character set.])
2199 CONFIG_OBS="$CONFIG_OBS \$(SELFTESTS_OBS)"
2200 CONFIG_SRCS="$CONFIG_SRCS \$(SELFTESTS_SRCS)"
2203 GDB_AC_TRANSFORM([gdb], [GDB_TRANSFORM_NAME])
2204 GDB_AC_TRANSFORM([gcore], [GCORE_TRANSFORM_NAME])
2205 AC_CONFIG_FILES([gcore], [chmod +x gcore])
2206 AC_CONFIG_FILES([Makefile gdb-gdb.gdb gdb-gdb.py doc/Makefile data-directory/Makefile])