dnl Autoconf configure script for GDB, the GNU debugger.
-dnl Copyright (C) 1995-2020 Free Software Foundation, Inc.
+dnl Copyright (C) 1995-2022 Free Software Foundation, Inc.
dnl
dnl This file is part of GDB.
dnl
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(main.c)
+AC_INIT
+AC_CONFIG_MACRO_DIRS([../config])
+AC_CONFIG_SRCDIR([main.c])
AC_CONFIG_HEADERS(config.h:config.in, [echo > stamp-h])
AM_MAINTAINER_MODE
-# Set the 'development' global.
-. $srcdir/../bfd/development.sh
-
AC_PROG_CC
AC_PROG_CXX
AC_USE_SYSTEM_EXTENSIONS
ACX_LARGEFILE
-AM_PROG_CC_STDC
AM_PROG_INSTALL_STRIP
AC_CONFIG_AUX_DIR(..)
-AC_CANONICAL_SYSTEM
+
+# Set build, build_cpu, build_vendor and build_os.
+AC_CANONICAL_BUILD
+
+# Set host, host_cpu, host_vendor, and host_os.
+AC_CANONICAL_HOST
+
+# Set target, target_cpu, target_vendor, and target_os.
+AC_CANONICAL_TARGET
+
+ACX_NONCANONICAL_TARGET
+
AC_ARG_PROGRAM
# We require a C++11 compiler. Check if one is available, and if
AC_ARG_ENABLE(targets,
AS_HELP_STRING([--enable-targets=TARGETS], [alternative target configurations]),
[case "${enableval}" in
- yes | "") AC_ERROR(enable-targets option must specify target names or 'all')
+ yes | "") AC_MSG_ERROR(enable-targets option must specify target names or 'all')
;;
no) enable_targets= ;;
*) enable_targets=$enableval ;;
esac])
-# Check whether to enable 64-bit support on 32-bit hosts
-AC_ARG_ENABLE(64-bit-bfd,
-AS_HELP_STRING([--enable-64-bit-bfd], [64-bit support (on hosts with narrower word sizes)]),
-[case "${enableval}" in
- yes) want64=true ;;
- no) want64=false ;;
- *) AC_MSG_ERROR(bad value ${enableval} for 64-bit-bfd option) ;;
-esac],[want64=false])dnl
+BFD_64_BIT
# Provide defaults for some variables set by the per-host and per-target
# configuration.
done
# Check whether this target needs 64-bit CORE_ADDR
- if test x${want64} = xfalse; then
+ if test x${enable_64_bit_bfd} = xno; then
. ${srcdir}/../bfd/config.bfd
fi
done
if test x${all_targets} = xtrue; then
-
- # We want all 64-bit targets if we either:
- # - run on a 64-bit host or
- # - already require 64-bit support for some other target or
- # - the --enable-64-bit-bfd option was supplied
- # Otherwise we only support all 32-bit targets.
- #
- # NOTE: This test must be in sync with the corresponding
- # tests in BFD!
-
- if test x${want64} = xfalse; then
- AC_CHECK_SIZEOF(long)
- if test "x${ac_cv_sizeof_long}" = "x8"; then
- want64=true
- fi
- fi
- if test x${want64} = xtrue; then
+ if test x${enable_64_bit_bfd} = xyes; then
TARGET_OBS='$(ALL_TARGET_OBS) $(ALL_64_TARGET_OBS)'
else
TARGET_OBS='$(ALL_TARGET_OBS)'
# For other settings, only the main target counts.
gdb_sim=
gdb_osabi=
-build_gdbserver=
targ=$target; . ${srcdir}/configure.tgt
# Fetch the default architecture and default target vector from BFD.
enable_gdbtk=no ;;
esac
-# Libunwind support for ia64.
+# Handle optional debuginfod support
+AC_DEBUGINFOD
+# Libunwind support for ia64.
AC_ARG_WITH(libunwind-ia64,
AS_HELP_STRING([--with-libunwind-ia64],
[use libunwind frame unwinding for ia64 targets]),,
[enable_profiling=no])
AC_CHECK_FUNCS(monstartup _mcleanup)
-AC_CACHE_CHECK([for _etext], ac_cv_var__etext,
-[AC_TRY_LINK(
-[#include <stdlib.h>
-extern char _etext;
-],
-[free (&_etext);], ac_cv_var__etext=yes, ac_cv_var__etext=no)])
+AC_CACHE_CHECK(
+ [for _etext],
+ [ac_cv_var__etext],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <stdlib.h>
+ extern char _etext;],
+ [free (&_etext);]
+ )],
+ [ac_cv_var__etext=yes],
+ [ac_cv_var__etext=no]
+ )]
+)
if test "$ac_cv_var__etext" = yes; then
AC_DEFINE(HAVE__ETEXT, 1,
[Define to 1 if your system has the _etext variable. ])
fi
-AC_CACHE_CHECK([for etext], ac_cv_var_etext,
-[AC_TRY_LINK(
-[#include <stdlib.h>
-extern char etext;
-],
-[free (&etext);], ac_cv_var_etext=yes, ac_cv_var_etext=no)])
+AC_CACHE_CHECK(
+ [for etext],
+ [ac_cv_var_etext],
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <stdlib.h>
+ extern char etext;],
+ [free (&etext);]
+ )],
+ [ac_cv_var_etext=yes],
+ [ac_cv_var_etext=no]
+ )]
+)
if test "$ac_cv_var_etext" = yes; then
AC_DEFINE(HAVE_ETEXT, 1,
[Define to 1 if your system has the etext variable. ])
OLD_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $PROFILE_CFLAGS"
- AC_CACHE_CHECK([whether $CC supports -pg], ac_cv_cc_supports_pg,
- [AC_TRY_COMPILE([], [int x;], ac_cv_cc_supports_pg=yes,
- ac_cv_cc_supports_pg=no)])
+ AC_CACHE_CHECK(
+ [whether $CC supports -pg],
+ [ac_cv_cc_supports_pg],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([], [int x;])],
+ [ac_cv_cc_supports_pg=yes],
+ [ac_cv_cc_supports_pg=no]
+ )]
+ )
if test "$ac_cv_cc_supports_pg" = no; then
AC_MSG_ERROR(--enable-profiling requires a compiler which supports -pg)
AC_SUBST([CODESIGN_CERT])
ACX_PKGVERSION([GDB])
-ACX_BUGURL([http://www.gnu.org/software/gdb/bugs/])
+ACX_BUGURL([https://www.gnu.org/software/gdb/bugs/])
AC_DEFINE_UNQUOTED([PKGVERSION], ["$PKGVERSION"], [Additional package description])
AC_DEFINE_UNQUOTED([REPORT_BUGS_TO], ["$REPORT_BUGS_TO"], [Bug reporting address])
# Link in zlib if we can. This allows us to read compressed debug sections.
AM_ZLIB
-# On FreeBSD we may need libutil for kinfo_getvmmap (used by fbsd-nat.c).
-# On GNU/kFreeBSD systems, FreeBSD libutil is renamed to libutil-freebsd.
-AC_SEARCH_LIBS(kinfo_getvmmap, util util-freebsd,
- [AC_DEFINE(HAVE_KINFO_GETVMMAP, 1,
- [Define to 1 if your system has the kinfo_getvmmap function. ])])
-
-# fbsd-nat.c can also use kinfo_getfile.
-AC_SEARCH_LIBS(kinfo_getfile, util util-freebsd,
- [AC_DEFINE(HAVE_KINFO_GETFILE, 1,
- [Define to 1 if your system has the kinfo_getfile function. ])])
-
AM_ICONV
# GDB may fork/exec the iconv program to get the list of supported character
[use installed readline library])])
if test "$with_system_readline" = yes; then
- AC_CACHE_CHECK([whether system readline is new enough],
- [gdb_cv_readline_ok],
- [AC_TRY_COMPILE(
- [#include <stdio.h>
-#include <readline/readline.h>],
- [#if RL_VERSION_MAJOR < 7
-# error "readline version 7 required"
-#endif],
- gdb_cv_readline_ok=yes,
- gdb_cv_readline_ok=no)])
+ AC_CHECK_HEADERS(readline/readline.h, [readline_h=yes], [readline_h=no])
+ if test "$readline_h" = "no"; then
+ AC_MSG_ERROR([readline development packages are probably missing])
+ fi
+ AC_CACHE_CHECK(
+ [whether system readline is new enough],
+ [gdb_cv_readline_ok],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <stdio.h>
+ #include <readline/readline.h>],
+ [#if RL_VERSION_MAJOR < 7
+ # error "readline version 7 required"
+ #endif]
+ )],
+ [gdb_cv_readline_ok=yes],
+ [gdb_cv_readline_ok=no]
+ )]
+ )
if test "$gdb_cv_readline_ok" != yes; then
AC_MSG_ERROR([system readline is not new enough])
fi
fi
fi
+# Verify that we have a usable GMP library.
+AC_LIB_HAVE_LINKFLAGS([gmp], [], [#include <gmp.h>],
+ [mpz_t n;
+ mpz_init (n);])
+if test "$HAVE_LIBGMP" != yes; then
+ AC_MSG_ERROR([GMP is missing or unusable])
+fi
+
AC_ARG_WITH(mpfr,
AS_HELP_STRING([--with-mpfr], [include MPFR support (auto/yes/no)]),
[], [with_mpfr=auto])
python_prog=${with_python}
python_prefix=
else
- AC_ERROR(invalid value for --with-python)
+ AC_MSG_ERROR(invalid value for --with-python)
fi
;;
*/*)
# Disallow --with-python=foo/bar.
- AC_ERROR(invalid value for --with-python)
+ AC_MSG_ERROR(invalid value for --with-python)
;;
*)
# The user has either specified auto, yes, or the name of the python
python_prog="${with_python}"
AC_PATH_PROG(python_prog_path, ${python_prog}, missing)
if test "${python_prog_path}" = missing; then
- AC_ERROR(unable to find python program ${python_prog})
+ AC_MSG_ERROR(unable to find python program ${python_prog})
fi
;;
esac
if test $? != 0; then
have_python_config=failed
if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --includes)
+ AC_MSG_ERROR(failure running python-config --includes)
fi
fi
python_libs=`${python_prog} ${srcdir}/python/python-config.py --ldflags`
if test $? != 0; then
have_python_config=failed
if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --ldflags)
+ AC_MSG_ERROR(failure running python-config --ldflags)
fi
fi
python_prefix=`${python_prog} ${srcdir}/python/python-config.py --exec-prefix`
if test $? != 0; then
have_python_config=failed
if test "${with_python}" != auto; then
- AC_ERROR(failure running python-config --exec-prefix)
+ AC_MSG_ERROR(failure running python-config --exec-prefix)
fi
fi
else
fi
fi
+dnl Use --with-python-libdir to control where GDB looks for the Python
+dnl libraries.
+dnl
+dnl If this is not given then the default will be based on the value
+dnl passed to --with-python, which is in the python_prefix variable.
+dnl If the --with-python option wasn't given then the default value in
+dnl python_prefix is based on running the 'gdb/python/python-config
+dnl --exec-prefix' script.
+AC_ARG_WITH(python-libdir,
+ AS_HELP_STRING([--with-python-libdir@<:@=DIR@:>@], [search for python's libraries in DIR]),
+ [],[
+ # If no python libdir is specified then select one based on
+ # python's prefix path.
+ if test -n "${python_prefix}"; then
+ with_python_libdir=${python_prefix}/lib
+ fi
+ ])
+
if test "${have_libpython}" != no; then
AC_DEFINE(HAVE_PYTHON, 1, [Define if Python interpreter is being linked in.])
CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_PYTHON_OBS)"
CONFIG_INSTALL="$CONFIG_INSTALL install-python"
ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_PYTHON_CFLAGS)"
+ if test -n "${with_python_libdir}"; then
+ AC_DEFINE_UNQUOTED(WITH_PYTHON_LIBDIR, "${with_python_libdir}",
+ [Directory containing Python's standard libraries from --with-python-libdir.])
+ GDB_AC_DEFINE_RELOCATABLE(PYTHON_LIBDIR, [python lib], ${with_python_libdir})
+ fi
+
# Flags needed to compile Python code (taken from python-config --cflags).
# We cannot call python-config directly because it will output whatever was
# used when compiling the Python interpreter itself, including flags which
# Check that the compiler accepts it
saved_CFLAGS="$CFLAGS"
CFLAGS="$CFLAGS $flag"
- AC_TRY_COMPILE([],[],PYTHON_CFLAGS="${PYTHON_CFLAGS} $flag",)
+ AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([], [])],
+ [PYTHON_CFLAGS="${PYTHON_CFLAGS} $flag"],
+ []
+ )
CFLAGS="$saved_CFLAGS"
done
AC_MSG_RESULT(${PYTHON_CFLAGS})
dnl We check guile with pkg-config.
AC_PATH_PROG(pkg_config_prog_path, pkg-config, missing)
-try_guile_versions="guile-2.0"
+try_guile_versions="guile-3.0 guile-2.2 guile-2.0"
have_libguile=no
case "${with_guile}" in
no)
AC_MSG_ERROR([pkg-config was not found in your system])
fi
else
- case "$LDFLAGS" in
- *static-libstdc*)
- AC_MSG_ERROR([source highlight is incompatible with -static-libstdc++; dnl
+ if ${pkg_config_prog_path} --exists source-highlight; then
+ case "$LDFLAGS" in
+ *static-libstdc*)
+ AC_MSG_ERROR([source highlight is incompatible with -static-libstdc++; dnl
either use --disable-source-highlight or dnl
--without-static-standard-libraries])
- ;;
- esac
-
- if ${pkg_config_prog_path} --exists source-highlight; then
- SRCHIGH_CFLAGS=`${pkg_config_prog_path} --cflags source-highlight`
- SRCHIGH_LIBS=`${pkg_config_prog_path} --libs source-highlight`
- AC_DEFINE([HAVE_SOURCE_HIGHLIGHT], 1,
- [Define to 1 if the source-highlight library is available])
- AC_MSG_RESULT([yes])
+ ;;
+ esac
+
+ srchigh_pkg_cflags=`${pkg_config_prog_path} --cflags source-highlight`
+ srchigh_pkg_libs=`${pkg_config_prog_path} --libs source-highlight`
+
+ # Now that we have found a source-highlight library, check if we can use
+ # it. In particular, we're trying to detect the situation that the
+ # library is using the new libstdc++ library abi ( see
+ # https://gcc.gnu.org/onlinedocs/libstdc++/manual/using_dual_abi.html )
+ # while the compiler being used to compile gdb is using the old abi.
+ # Such a situation will result in an undefined reference to
+ # srchilite::SourceHighlight::SourceHighlight(std::string const&).
+ # This situation can occur for instance when using a source highlight
+ # library compiled with g++ 7.5.0 while building gdb with g++ 4.8.5.
+ AC_LANG_PUSH(C++)
+ save_CFLAGS="$CFLAGS"
+ save_LDFLAGS="$LDFLAGS"
+ CFLAGS="$CFLAGS $srchigh_pkg_cflags"
+ LDFLAGS="$LDFLAGS $srchigh_pkg_libs"
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <srchilite/sourcehighlight.h>],
+ [std::string outlang = "esc.outlang";
+ new srchilite::SourceHighlight (outlang);]
+ )],
+ [have_usable_source_highlight=yes],
+ [have_usable_source_highlight=no]
+ )
+ CFLAGS="$save_CFLAGS"
+ LDFLAGS="$save_LDFLAGS"
+ AC_LANG_POP(C++)
+
+ if test "${have_usable_source_highlight}" = "yes"; then
+ AC_DEFINE([HAVE_SOURCE_HIGHLIGHT], 1,
+ [Define to 1 if the source-highlight library is available])
+ AC_MSG_RESULT([yes])
+ SRCHIGH_CFLAGS="$srchigh_pkg_cflags"
+ SRCHIGH_LIBS="$srchigh_pkg_libs"
+ else
+ AC_MSG_RESULT([no])
+ if test "${enable_source_highlight}" = "yes"; then
+ AC_MSG_ERROR([source-highlight in your system could not be used])
+ fi
+ fi
else
AC_MSG_RESULT([no])
if test "${enable_source_highlight}" = "yes"; then
AC_SUBST(SRCHIGH_LIBS)
AC_SUBST(SRCHIGH_CFLAGS)
-AC_ARG_WITH(intel_pt,
- AS_HELP_STRING([--with-intel-pt], [include Intel Processor Trace support (auto/yes/no)]),
- [], [with_intel_pt=auto])
-AC_MSG_CHECKING([whether to use intel pt])
-AC_MSG_RESULT([$with_intel_pt])
-
-if test "${with_intel_pt}" = no; then
- AC_MSG_WARN([Intel Processor Trace support disabled; some features may be unavailable.])
- HAVE_LIBIPT=no
-else
- AC_PREPROC_IFELSE([AC_LANG_SOURCE([[
-#include <linux/perf_event.h>
-#ifndef PERF_ATTR_SIZE_VER5
-# error
-#endif
- ]])], [perf_event=yes], [perf_event=no])
- if test "$perf_event" != yes; then
- if test "$with_intel_pt" = yes; then
- AC_MSG_ERROR([linux/perf_event.h missing or too old])
- else
- AC_MSG_WARN([linux/perf_event.h missing or too old; some features may be unavailable.])
- fi
- fi
-
- AC_LIB_HAVE_LINKFLAGS([ipt], [], [#include "intel-pt.h"], [pt_insn_alloc_decoder (0);])
- if test "$HAVE_LIBIPT" != yes; then
- if test "$with_intel_pt" = yes; then
- AC_MSG_ERROR([libipt is missing or unusable])
- else
- AC_MSG_WARN([libipt is missing or unusable; some features may be unavailable.])
- fi
- else
- save_LIBS=$LIBS
- LIBS="$LIBS $LIBIPT"
- AC_CHECK_FUNCS(pt_insn_event)
- AC_CHECK_MEMBERS([struct pt_insn.enabled, struct pt_insn.resynced], [], [],
- [#include <intel-pt.h>])
- LIBS=$save_LIBS
- fi
-fi
-
# ------------------------- #
# Checks for header files. #
# ------------------------- #
AC_HEADER_STDC
# elf_hp.h is for HP/UX 64-bit shared library support.
-AC_CHECK_HEADERS([nlist.h machine/reg.h poll.h sys/poll.h proc_service.h \
- thread_db.h linux/elf.h \
+AC_CHECK_HEADERS([nlist.h machine/reg.h \
+ thread_db.h \
sys/file.h sys/filio.h sys/ioctl.h sys/param.h \
- sys/resource.h sys/procfs.h sys/ptrace.h ptrace.h \
- sys/reg.h sys/debugreg.h sys/select.h \
+ sys/procctl.h sys/resource.h sys/ptrace.h ptrace.h \
+ sys/reg.h sys/debugreg.h \
termios.h elf_hp.h])
AC_CHECK_HEADERS(sys/user.h, [], [],
[#if HAVE_SYS_PARAM_H
#endif
])
+AC_CHECK_HEADERS([sys/socket.h])
+AC_CHECK_HEADERS([ws2tcpip.h])
+AC_CHECK_HEADERS([execinfo.h])
+
# ------------------------- #
# Checks for declarations. #
# ------------------------- #
AC_CHECK_DECLS([snprintf])
AM_LC_MESSAGES
-# ----------------------- #
-# Checks for structures. #
-# ----------------------- #
-
-AC_CHECK_MEMBERS([struct stat.st_blocks, struct stat.st_blksize])
-
# ------------------ #
# Checks for types. #
# ------------------ #
AC_CHECK_TYPES(socklen_t, [], [],
[#include <sys/types.h>
-#include <sys/socket.h>
+#if HAVE_SYS_SOCKET_H
+# include <sys/socket.h>
+#elif HAVE_WS2TCPIP_H
+# include <ws2tcpip.h>
+#endif
])
# ------------------------------------- #
# Checks for library functions. #
# ------------------------------ #
-AC_FUNC_MMAP
-AC_FUNC_VFORK
-AC_CHECK_FUNCS([getauxval getrusage getuid getgid \
- pipe poll pread pread64 pwrite resize_term \
- sbrk getpgid setpgid setpgrp setsid \
+AC_CHECK_FUNCS([getuid getgid \
+ pipe pread pread64 pwrite resize_term \
+ getpgid setsid \
sigaction sigsetmask socketpair \
ttrace wborder wresize setlocale iconvlist libiconvlist btowc \
setrlimit getrlimit posix_madvise waitpid \
- ptrace64 sigaltstack setns use_default_colors])
+ use_default_colors])
AM_LANGINFO_CODESET
GDB_AC_COMMON
if test "$cross_compiling" = no; then
AC_FUNC_SETPGRP
else
- AC_CACHE_CHECK([whether setpgrp takes no argument], ac_cv_func_setpgrp_void,
- [AC_TRY_COMPILE([
-#include <unistd.h>
-], [
- if (setpgrp(1,1) == -1)
- exit (0);
- else
- exit (1);
-], ac_cv_func_setpgrp_void=no, ac_cv_func_setpgrp_void=yes)])
+ AC_CACHE_CHECK(
+ [whether setpgrp takes no argument],
+ [ac_cv_func_setpgrp_void],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <unistd.h>],
+ [if (setpgrp(1,1) == -1)
+ exit (0);
+ else
+ exit (1);]
+ )],
+ [ac_cv_func_setpgrp_void=no],
+ [ac_cv_func_setpgrp_void=yes]
+ )]
+ )
if test "$ac_cv_func_setpgrp_void" = yes; then
AC_DEFINE(SETPGRP_VOID, 1)
fi
fi
-# Assume we'll default to using the included libiberty regex.
-gdb_use_included_regex=yes
-
-# However, if the system regex is GNU regex, then default to *not*
-# using the included regex.
-AC_CACHE_CHECK(
- [for GNU regex],
- [gdb_cv_have_gnu_regex],
- [AC_TRY_COMPILE(
- [#include <gnu-versions.h>],
- [#define REGEX_INTERFACE_VERSION 1
-#if _GNU_REGEX_INTERFACE_VERSION != REGEX_INTERFACE_VERSION
-# error "Version mismatch"
-#endif],
- gdb_cv_have_gnu_regex=yes,
- gdb_cv_have_gnu_regex=no)])
-if test "$gdb_cv_have_gnu_regex" = yes; then
- gdb_use_included_regex=no
-fi
-
-AC_ARG_WITH(included-regex,
- AS_HELP_STRING([--without-included-regex], [don't use included regex; this is the default on systems with version 2 of the GNU C library (use with caution on other system)]),
- gdb_with_regex=$withval,
- gdb_with_regex=$gdb_use_included_regex)
-if test "$gdb_with_regex" = yes; then
- AC_DEFINE(USE_INCLUDED_REGEX, 1,
- [Define to 1 if the regex included in libiberty should be used.])
-fi
-
# Check if <sys/proc.h> defines `struct thread' with a td_pcb member.
AC_CHECK_MEMBERS([struct thread.td_pcb], [], [],
[#include <sys/param.h>
])
# See if <sys/lwp.h> defines `struct lwp`.
-AC_CACHE_CHECK([for struct lwp], gdb_cv_struct_lwp,
-[AC_TRY_COMPILE([#include <sys/param.h>
-#define _KMEMUSER
-#include <sys/lwp.h>], [struct lwp l;],
-gdb_cv_struct_lwp=yes, gdb_cv_struct_lwp=no)])
+AC_CACHE_CHECK(
+ [for struct lwp],
+ [gdb_cv_struct_lwp],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <sys/param.h>
+ #define _KMEMUSER
+ #include <sys/lwp.h>],
+ [struct lwp l;]
+ )],
+ [gdb_cv_struct_lwp=yes],
+ [gdb_cv_struct_lwp=no]
+ )]
+)
if test "$gdb_cv_struct_lwp" = yes; then
AC_DEFINE(HAVE_STRUCT_LWP, 1,
[Define to 1 if your system has struct lwp.])
fi
# See if <machine/reg.h> degines `struct reg'.
-AC_CACHE_CHECK([for struct reg in machine/reg.h], gdb_cv_struct_reg,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <machine/reg.h>], [struct reg r;],
-gdb_cv_struct_reg=yes, gdb_cv_struct_reg=no)])
+AC_CACHE_CHECK(
+ [for struct reg in machine/reg.h],
+ [gdb_cv_struct_reg],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <sys/types.h>
+ #include <machine/reg.h>],
+ [struct reg r;]
+ )],
+ [gdb_cv_struct_reg=yes],
+ [gdb_cv_struct_reg=no]
+ )]
+)
if test "$gdb_cv_struct_reg" = yes; then
AC_DEFINE(HAVE_STRUCT_REG, 1,
[Define to 1 if your system has struct reg in <machine/reg.h>.])
[#include <sys/types.h>
#include <machine/reg.h>])
-# See if <sys/user.h> supports the %fs_base and %gs_bas amd64 segment registers.
-# Older amd64 Linux's don't have the fs_base and gs_base members of
-# `struct user_regs_struct'.
-AC_CHECK_MEMBERS([struct user_regs_struct.fs_base, struct user_regs_struct.gs_base],
- [], [], [#include <sys/types.h>
-#include <sys/user.h>])
-
# See if <sys/ptrace.h> provides the PTRACE_GETREGS request.
AC_MSG_CHECKING(for PTRACE_GETREGS)
-AC_CACHE_VAL(gdb_cv_have_ptrace_getregs,
-[AC_TRY_COMPILE([#include <sys/ptrace.h>],
- [PTRACE_GETREGS;],
- [gdb_cv_have_ptrace_getregs=yes],
- [gdb_cv_have_ptrace_getregs=no])])
+AC_CACHE_VAL(
+ [gdb_cv_have_ptrace_getregs],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([#include <sys/ptrace.h>], [PTRACE_GETREGS;])],
+ [gdb_cv_have_ptrace_getregs=yes],
+ [gdb_cv_have_ptrace_getregs=no]
+ )]
+)
AC_MSG_RESULT($gdb_cv_have_ptrace_getregs)
if test "$gdb_cv_have_ptrace_getregs" = yes; then
AC_DEFINE(HAVE_PTRACE_GETREGS, 1,
# See if <sys/ptrace.h> provides the PTRACE_GETFPXREGS request.
AC_MSG_CHECKING(for PTRACE_GETFPXREGS)
-AC_CACHE_VAL(gdb_cv_have_ptrace_getfpxregs,
-[AC_TRY_COMPILE([#include <sys/ptrace.h>],
- [PTRACE_GETFPXREGS;],
- [gdb_cv_have_ptrace_getfpxregs=yes],
- [gdb_cv_have_ptrace_getfpxregs=no])])
+AC_CACHE_VAL(
+ [gdb_cv_have_ptrace_getfpxregs],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM([#include <sys/ptrace.h>], [PTRACE_GETFPXREGS;])],
+ [gdb_cv_have_ptrace_getfpxregs=yes],
+ [gdb_cv_have_ptrace_getfpxregs=no]
+ )]
+)
AC_MSG_RESULT($gdb_cv_have_ptrace_getfpxregs)
if test "$gdb_cv_have_ptrace_getfpxregs" = yes; then
AC_DEFINE(HAVE_PTRACE_GETFPXREGS, 1,
# See if <sys/ptrace.h> provides the PT_GETDBREGS request.
AC_MSG_CHECKING(for PT_GETDBREGS)
-AC_CACHE_VAL(gdb_cv_have_pt_getdbregs,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/ptrace.h>],
- [PT_GETDBREGS;],
- [gdb_cv_have_pt_getdbregs=yes],
- [gdb_cv_have_pt_getdbregs=no])])
+AC_CACHE_VAL(
+ [gdb_cv_have_pt_getdbregs],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <sys/types.h>
+ #include <sys/ptrace.h>],
+ [PT_GETDBREGS;]
+ )],
+ [gdb_cv_have_pt_getdbregs=yes],
+ [gdb_cv_have_pt_getdbregs=no]
+ )]
+)
AC_MSG_RESULT($gdb_cv_have_pt_getdbregs)
if test "$gdb_cv_have_pt_getdbregs" = yes; then
AC_DEFINE(HAVE_PT_GETDBREGS, 1,
# See if <sys/ptrace.h> provides the PT_GETXMMREGS request.
AC_MSG_CHECKING(for PT_GETXMMREGS)
-AC_CACHE_VAL(gdb_cv_have_pt_getxmmregs,
-[AC_TRY_COMPILE([#include <sys/types.h>
-#include <sys/ptrace.h>],
- [PT_GETXMMREGS;],
- [gdb_cv_have_pt_getxmmregs=yes],
- [gdb_cv_have_pt_getxmmregs=no])])
+AC_CACHE_VAL(
+ [gdb_cv_have_pt_getxmmregs],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <sys/types.h>
+ #include <sys/ptrace.h>],
+ [PT_GETXMMREGS;]
+ )],
+ [gdb_cv_have_pt_getxmmregs=yes],
+ [gdb_cv_have_pt_getxmmregs=no]
+ )]
+)
AC_MSG_RESULT($gdb_cv_have_pt_getxmmregs)
if test "$gdb_cv_have_pt_getxmmregs" = yes; then
AC_DEFINE(HAVE_PT_GETXMMREGS, 1,
AC_CHECK_MEMBERS([struct ptrace_lwpinfo.pl_syscall_code], [], [],
[#include <sys/ptrace.h>])
-if test "$ac_cv_header_sys_procfs_h" = yes; then
- BFD_HAVE_SYS_PROCFS_TYPE(gregset_t)
- BFD_HAVE_SYS_PROCFS_TYPE(fpregset_t)
- BFD_HAVE_SYS_PROCFS_TYPE(prgregset_t)
- BFD_HAVE_SYS_PROCFS_TYPE(prfpregset_t)
- BFD_HAVE_SYS_PROCFS_TYPE(prgregset32_t)
- BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
- BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
- BFD_HAVE_SYS_PROCFS_TYPE(elf_fpregset_t)
-fi
-
# Check if the compiler supports the `long long' type.
AC_CACHE_CHECK([for long long support in compiler], gdb_cv_c_long_long,
AC_MSG_ERROR([Compiler must support long long for GDB.])
fi
-# Check if the compiler and runtime support printing long longs.
-
-AC_CACHE_CHECK([for long long support in printf],
- gdb_cv_printf_has_long_long,
- [AC_RUN_IFELSE([AC_LANG_PROGRAM([AC_INCLUDES_DEFAULT],
-[[char buf[32];
- long long l = 0;
- l = (l << 16) + 0x0123;
- l = (l << 16) + 0x4567;
- l = (l << 16) + 0x89ab;
- l = (l << 16) + 0xcdef;
- sprintf (buf, "0x%016llx", l);
- return (strcmp ("0x0123456789abcdef", buf));]])],
- gdb_cv_printf_has_long_long=yes,
- gdb_cv_printf_has_long_long=no,
- gdb_cv_printf_has_long_long=no)])
-if test "$gdb_cv_printf_has_long_long" = yes; then
- AC_DEFINE(PRINTF_HAS_LONG_LONG, 1,
- [Define to 1 if the "%ll" format works to print long longs.])
-fi
-
# Check if the compiler and runtime support printing decfloats.
AC_CACHE_CHECK([for decfloat support in printf],
case ${host_os} in
aix*)
- AC_CACHE_CHECK([for -bbigtoc option], [gdb_cv_bigtoc], [
- SAVE_LDFLAGS=$LDFLAGS
-
- case $GCC in
- yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
- *) gdb_cv_bigtoc=-bbigtoc ;;
- esac
-
- LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
- AC_TRY_LINK([], [int i;], [], [gdb_cv_bigtoc=])
- LDFLAGS="${SAVE_LDFLAGS}"
- ])
+ AC_CACHE_CHECK(
+ [for -bbigtoc option], [gdb_cv_bigtoc],
+ [SAVE_LDFLAGS=$LDFLAGS
+
+ case $GCC in
+ yes) gdb_cv_bigtoc=-Wl,-bbigtoc ;;
+ *) gdb_cv_bigtoc=-bbigtoc ;;
+ esac
+
+ LDFLAGS=$LDFLAGS\ $gdb_cv_bigtoc
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([], [int i;])],
+ [],
+ [gdb_cv_bigtoc=]
+ )
+ LDFLAGS="${SAVE_LDFLAGS}"]
+ )
CONFIG_LDFLAGS="${CONFIG_LDFLAGS} ${gdb_cv_bigtoc}"
;;
esac
RDYNAMIC="-Wl,--dynamic-list=${srcdir}/proc-service.list"
LDFLAGS="$LDFLAGS $RDYNAMIC"
if test "${have_libpython}" = no; then
- AC_TRY_LINK([], [], [dynamic_list=true])
+ AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM([], [])],
+ [dynamic_list=true],
+ []
+ )
else
# Workaround http://bugs.python.org/issue4434 where static
# libpythonX.Y.a would get its symbols required for
[#include "Python.h"],
[int err;
Py_Initialize ();
- err = PyRun_SimpleString ("import itertools\n");
+ err = PyRun_SimpleString ("import ctypes\n");
Py_Finalize ();
return err == 0 ? 0 : 1;])],
[dynamic_list=true], [], [true])
AC_SUBST(RDYNAMIC)
AC_MSG_RESULT($found)
+AC_CACHE_CHECK(
+ [whether execinfo.h backtrace is available],
+ gdb_cv_execinfo_backtrace,
+ [AC_LINK_IFELSE(
+ [AC_LANG_PROGRAM(
+ [
+ #include <execinfo.h>
+ ],
+ [
+ int f;
+ void *b[[2]];
+ f = backtrace (b, 2);
+ backtrace_symbols_fd (b, f, 2);
+ ])],
+ [gdb_cv_execinfo_backtrace=yes],
+ [gdb_cv_execinfo_backtrace=no])])
+if test "$gdb_cv_execinfo_backtrace" = yes; then
+ AC_DEFINE(HAVE_EXECINFO_BACKTRACE, 1,
+ [Define to 1 if execinfo.h backtrace functions are available.])
+fi
+
dnl For certain native configurations, we need to check whether thread
dnl support can be built in or not.
dnl
case ${host_os} in
aix*)
AC_MSG_CHECKING(for AiX thread debugging library)
- AC_CACHE_VAL(gdb_cv_have_aix_thread_debug,
- [AC_TRY_COMPILE([#include <sys/pthdebug.h>],
- [#ifndef PTHDB_VERSION_3
- #error
- #endif],
- gdb_cv_have_aix_thread_debug=yes,
- gdb_cv_have_aix_thread_debug=no)])
+ AC_CACHE_VAL(
+ [gdb_cv_have_aix_thread_debug],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <sys/pthdebug.h>],
+ [#ifndef PTHDB_VERSION_3
+ #error
+ #endif]
+ )],
+ [gdb_cv_have_aix_thread_debug=yes],
+ [gdb_cv_have_aix_thread_debug=no]
+ )]
+ )
AC_MSG_RESULT($gdb_cv_have_aix_thread_debug)
if test "$gdb_cv_have_aix_thread_debug" = yes; then
CONFIG_SRCS="${CONFIG_SRCS} aix-thread.c"
dnl See if we have a thread_db header file that has TD_NOTALLOC and
dnl other error codes.
if test "x$ac_cv_header_thread_db_h" = "xyes"; then
- AC_CACHE_CHECK([whether <thread_db.h> has TD_NOTALLOC],
- gdb_cv_thread_db_h_has_td_notalloc,
- AC_TRY_COMPILE(
- [#include <thread_db.h>],
- [int i = TD_NOTALLOC;],
- gdb_cv_thread_db_h_has_td_notalloc=yes,
- gdb_cv_thread_db_h_has_td_notalloc=no
- )
- )
- AC_CACHE_CHECK([whether <thread_db.h> has TD_VERSION],
- gdb_cv_thread_db_h_has_td_version,
- AC_TRY_COMPILE(
- [#include <thread_db.h>],
- [int i = TD_VERSION;],
- gdb_cv_thread_db_h_has_td_version=yes,
- gdb_cv_thread_db_h_has_td_version=no
- )
- )
- AC_CACHE_CHECK([whether <thread_db.h> has TD_NOTLS],
- gdb_cv_thread_db_h_has_td_notls,
- AC_TRY_COMPILE(
- [#include <thread_db.h>],
- [int i = TD_NOTLS;],
- gdb_cv_thread_db_h_has_td_notls=yes,
- gdb_cv_thread_db_h_has_td_notls=no
- )
- )
+ AC_CACHE_CHECK(
+ [whether <thread_db.h> has TD_NOTALLOC],
+ [gdb_cv_thread_db_h_has_td_notalloc],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <thread_db.h>],
+ [int i = TD_NOTALLOC;]
+ )],
+ [gdb_cv_thread_db_h_has_td_notalloc=yes],
+ [gdb_cv_thread_db_h_has_td_notalloc=no]
+ )]
+ )
+
+ AC_CACHE_CHECK(
+ [whether <thread_db.h> has TD_VERSION],
+ [gdb_cv_thread_db_h_has_td_version],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <thread_db.h>],
+ [int i = TD_VERSION;]
+ )],
+ [gdb_cv_thread_db_h_has_td_version=yes],
+ [gdb_cv_thread_db_h_has_td_version=no]
+ )]
+ )
+
+ AC_CACHE_CHECK(
+ [whether <thread_db.h> has TD_NOTLS],
+ [gdb_cv_thread_db_h_has_td_notls],
+ [AC_COMPILE_IFELSE(
+ [AC_LANG_PROGRAM(
+ [#include <thread_db.h>],
+ [int i = TD_NOTLS;]
+ )],
+ [gdb_cv_thread_db_h_has_td_notls=yes],
+ [gdb_cv_thread_db_h_has_td_notls=no]
+ )]
+ )
fi
if test "x$gdb_cv_thread_db_h_has_td_notalloc" = "xyes"; then
AC_DEFINE(THREAD_DB_HAS_TD_NOTALLOC, 1,
[Define if <thread_db.h> has the TD_NOTLS error code.])
fi
-dnl Check if we can disable the virtual address space randomization.
-dnl The functionality of setarch -R.
-AC_CHECK_DECLS([ADDR_NO_RANDOMIZE],,, [#include <sys/personality.h>])
-define([PERSONALITY_TEST], [AC_LANG_PROGRAM([#include <sys/personality.h>], [
-# if !HAVE_DECL_ADDR_NO_RANDOMIZE
-# define ADDR_NO_RANDOMIZE 0x0040000
-# endif
- /* Test the flag could be set and stays set. */
- personality (personality (0xffffffff) | ADDR_NO_RANDOMIZE);
- if (!(personality (personality (0xffffffff)) & ADDR_NO_RANDOMIZE))
- return 1])])
-AC_RUN_IFELSE([PERSONALITY_TEST],
- [have_personality=true],
- [have_personality=false],
- [AC_LINK_IFELSE([PERSONALITY_TEST],
- [have_personality=true],
- [have_personality=false])])
-if $have_personality
-then
- AC_DEFINE([HAVE_PERSONALITY], 1,
- [Define if you support the personality syscall.])
-fi
-
dnl Set the host's .gdbinit filename.
case $host_os in
go32* | *djgpp*)
esac
AC_DEFINE_UNQUOTED(GDBINIT,"$gdbinit",[The .gdbinit filename.])
+dnl Set the host's .gdbearlyinit filename
+AC_DEFINE_UNQUOTED(GDBEARLYINIT,".gdbearlyinit",[The .gdbearlyinit filename.])
+
dnl Handle optional features that can be enabled.
# Support for --with-sysroot is a copy of GDB_AC_WITH_DIR,
[automatically load system-wide gdbinit files from this directory],
[])
+AM_GDB_COMPILER_TYPE
AM_GDB_WARNINGS
AM_GDB_UBSAN
fi
# The ser-tcp.c module requires sockets.
-case ${host} in
- *mingw32*)
- AC_DEFINE(USE_WIN32API, 1,
- [Define if we should use the Windows API, instead of the
- POSIX API. On Windows, we use the Windows API when
- building for MinGW, but the POSIX API when building
- for Cygwin.])
- WIN32LIBS="$WIN32LIBS -lws2_32"
- ;;
-esac
-AC_SUBST(WIN32LIBS)
+# Note that WIN32APILIBS is set by GDB_AC_COMMON.
+WIN32LIBS="$WIN32LIBS $WIN32APILIBS"
# Add ELF support to GDB, but only if BFD includes ELF support.
GDB_AC_CHECK_BFD([for ELF support in BFD], gdb_cv_var_elf,
[bfd_get_elf_phdr_upper_bound (NULL)], elf-bfd.h)
if test "$gdb_cv_var_elf" = yes; then
- CONFIG_OBS="$CONFIG_OBS elfread.o stap-probe.o dtrace-probe.o"
+ CONFIG_OBS="$CONFIG_OBS elfread.o stap-probe.o dtrace-probe.o \
+ gcore-elf.o elf-none-tdep.o"
AC_DEFINE(HAVE_ELF, 1,
[Define if ELF support should be included.])
# -ldl is provided by bfd/Makfile.am (LIBDL) <PLUGINS>.
[Define to the default OS ABI for this configuration.])
fi
-AC_ARG_ENABLE(gdbserver,
-AS_HELP_STRING([--enable-gdbserver],
- [automatically build gdbserver (yes/no/auto, default is auto)]),
+# Setup possible use of libbacktrace.
+AC_ARG_ENABLE([libbacktrace],
+[AS_HELP_STRING([--enable-libbacktrace],
+ [use libbacktrace to write a backtrace after a fatal signal.])],
[case "${enableval}" in
- yes| no|auto) ;;
- *) AC_MSG_ERROR(bad value ${enableval} for --enable-gdbserver option) ;;
-esac],[enable_gdbserver=auto])
-
-# We only build gdbserver automatically in a native configuration, and
-# only if the user did not explicitly disable its build.
-if test "$gdb_native" = "yes" -a "$enable_gdbserver" != "no"; then
- AC_MSG_CHECKING(whether gdbserver is supported on this host)
- if test "x$build_gdbserver" = xyes; then
- AC_MSG_RESULT(yes)
- AC_CONFIG_SUBDIRS(gdbserver)
- gdbserver_build_enabled=yes
- else
- AC_MSG_RESULT(no)
- fi
-fi
+ yes) enable_libbacktrace=yes ;;
+ no) enable_libbacktrace=no ;;
+ *) AC_MSG_ERROR(bad value ${enableval} for --enable-libbacktrace option) ;;
+esac],
+enable_libbacktrace=yes)
-# If the user explicitly request the gdbserver to be built, verify that
-# we were in fact able to enable it.
-if test "$enable_gdbserver" = "yes" -a "$gdbserver_build_enabled" != "yes"; then
- AC_MSG_ERROR(Automatic gdbserver build is not supported for this configuration)
+if test "${enable_libbacktrace}" == "yes"; then
+ LIBBACKTRACE_INC="-I$srcdir/../libbacktrace/ -I../libbacktrace/"
+ LIBBACKTRACE_LIB=../libbacktrace/.libs/libbacktrace.a
+ AC_DEFINE(HAVE_LIBBACKTRACE, 1, [Define if libbacktrace is being used.])
+else
+ LIBBACKTRACE_INC=
+ LIBBACKTRACE_LIB=
fi
+AC_SUBST(LIBBACKTRACE_INC)
+AC_SUBST(LIBBACKTRACE_LIB)
+
# Check for babeltrace and babeltrace-ctf
AC_ARG_WITH(babeltrace,
- AC_HELP_STRING([--with-babeltrace], [include babeltrace support (auto/yes/no)]),
+ AS_HELP_STRING([--with-babeltrace], [include babeltrace support (auto/yes/no)]),
[], [with_babeltrace=auto])
AC_MSG_CHECKING([whether to use babeltrace])
AC_MSG_RESULT([$with_babeltrace])
# Check for xxhash
AC_ARG_WITH(xxhash,
- AC_HELP_STRING([--with-xxhash], [use libxxhash for hashing (faster) (auto/yes/no)]),
+ AS_HELP_STRING([--with-xxhash], [use libxxhash for hashing (faster) (auto/yes/no)]),
[], [with_xxhash=auto])
+GCC_ENABLE([libctf], [yes], [], [Handle .ctf type-info sections])
+if test x${enable_static} = xno; then
+ LIBCTF="-Wl,--rpath,../libctf/.libs ../libctf/.libs/libctf.so"
+ CTF_DEPS="../libctf/.libs/libctf.so"
+else
+ LIBCTF="../libctf/.libs/libctf.a"
+ CTF_DEPS="$LIBCTF"
+fi
+if test "${enable_libctf}" = yes; then
+ AC_DEFINE(ENABLE_LIBCTF, 1, [Handle .ctf type-info sections])
+else
+ LIBCTF=
+ CTF_DEPS=
+fi
+AC_SUBST(LIBCTF)
+AC_SUBST(CTF_DEPS)
+
+# If nativefile (NAT_FILE) is not set in configure.nat, we link to an
+# empty version.
+
if test "x$with_xxhash" != "xno"; then
AC_LIB_HAVE_LINKFLAGS([xxhash], [],
[#include <xxhash.h>],
AC_PATH_PROGS(XSLTPROC, xsltproc, missing)
if test "x$USE_MAINTAINER_MODE" = xyes; then
if test "${XSLTPROC}" = missing; then
- AC_ERROR(unable to find xsltproc. maintainer-mode requires xsltproc.)
+ AC_MSG_ERROR(unable to find xsltproc. maintainer-mode requires xsltproc.)
fi
fi
AC_SUBST(XSLTPROC)
[Define to be a string naming the default host character set.])
GDB_AC_SELFTEST([
- CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_UNITTESTS_OBS) gdbsupport/selftest.o selftest-arch.o"
- CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_UNITTESTS_SRCS) gdbsupport/selftest.c selftest-arch.c"
+ CONFIG_OBS="$CONFIG_OBS \$(SELFTESTS_OBS)"
+ CONFIG_SRCS="$CONFIG_SRCS \$(SELFTESTS_SRCS)"
])
GDB_AC_TRANSFORM([gdb], [GDB_TRANSFORM_NAME])