diff options
author | Tom Tromey <tom@tromey.com> | 2019-12-19 16:40:15 -0700 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2020-01-14 16:25:03 -0700 |
commit | 05ea2a051030a452bb1f4710dafeb1054cf38c17 (patch) | |
tree | 9d7ecb70ce4edf11c66c3a329344c4aed4fd48e6 /gdbsupport/common.m4 | |
parent | 01027315f54048dbaf03ac37455c2528c72a6d9b (diff) | |
download | gdb-05ea2a051030a452bb1f4710dafeb1054cf38c17.zip gdb-05ea2a051030a452bb1f4710dafeb1054cf38c17.tar.gz gdb-05ea2a051030a452bb1f4710dafeb1054cf38c17.tar.bz2 |
Move many configure checks to common.m4
This moves many needed configure checks from gdb and gdbserver into
common.m4. This helps gdbsupport, nat, and target be self-contained.
The result is a bit spaghetti-ish, because gdbsupport uses another m4
file from gdb/. The resulting code is somewhat non-obvious. However,
these problems already exist, so it's not really that much worse than
what is already done.
gdb/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* configure.ac: Move many checks to ../gdbsupport/common.m4.
gdb/gdbserver/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* configure.ac: Remove any checks that were added to common.m4.
* acinclude.m4: Include lib-ld.m4, lib-prefix.m4, and
lib-link.m4.
gdbsupport/ChangeLog
2020-01-14 Tom Tromey <tom@tromey.com>
* configure, Makefile.in, aclocal.m4, common.m4, config.in:
Rebuild.
* common.m4 (GDB_AC_COMMON): Move many checks from
gdb/configure.ac.
* acinclude.m4: Include bfd.m4, ptrace.m4.
Change-Id: I931eaa94065df268b30a2f1354390710df89c7f8
Diffstat (limited to 'gdbsupport/common.m4')
-rw-r--r-- | gdbsupport/common.m4 | 93 |
1 files changed, 91 insertions, 2 deletions
diff --git a/gdbsupport/common.m4 b/gdbsupport/common.m4 index 9e15940..68a3545 100644 --- a/gdbsupport/common.m4 +++ b/gdbsupport/common.m4 @@ -42,13 +42,50 @@ AC_DEFUN([GDB_AC_COMMON], [ sys/un.h sys/wait.h dnl thread_db.h wait.h dnl termios.h dnl - dlfcn.h) + dlfcn.h dnl + linux/elf.h sys/procfs.h proc_service.h) + AC_FUNC_MMAP + AC_FUNC_VFORK AC_CHECK_FUNCS([fdwalk getrlimit pipe pipe2 socketpair sigaction \ - sigprocmask]) + ptrace64 sbrk setns sigaltstack sigprocmask \ + setpgid setpgrp getrusage getauxval]) + + 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 AC_CHECK_DECLS([strstr]) + # ----------------------- # + # Checks for structures. # + # ----------------------- # + + AC_CHECK_MEMBERS([struct stat.st_blocks, struct stat.st_blksize]) + + 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. ])]) + # Check for std::thread. This does not work on some platforms, like # mingw and DJGPP. AC_LANG_PUSH([C++]) @@ -90,4 +127,56 @@ AC_DEFUN([GDB_AC_COMMON], [ if test "$gdb_cv_func_sigsetjmp" = "yes"; then AC_DEFINE(HAVE_SIGSETJMP, 1, [Define if sigsetjmp is available. ]) fi + + 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 + + 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 ]) |