aboutsummaryrefslogtreecommitdiff
path: root/gdb/configure.ac
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2015-07-24 14:57:19 +0100
committerPedro Alves <palves@redhat.com>2015-07-24 14:57:19 +0100
commiteb7aa56163cc15bb732aa3b07966103fd6940d50 (patch)
treec74c84c1a5bcce3a18cbd5986e7987f48c9f8ac3 /gdb/configure.ac
parent55d7b841962c6e054735acdca2e0bb485afa0144 (diff)
downloadgdb-eb7aa56163cc15bb732aa3b07966103fd6940d50.zip
gdb-eb7aa56163cc15bb732aa3b07966103fd6940d50.tar.gz
gdb-eb7aa56163cc15bb732aa3b07966103fd6940d50.tar.bz2
make gdbserver use the same ptrace autoconf checks as gdb
This factors the ptrace checks out of gdb's configure.ac to a new ptrace.m4 file, and then makes gdbserver's configure.ac source it too. gdb/ChangeLog: 2015-07-24 Pedro Alves <palves@redhat.com> * acinclude.m4: Include ptrace.m4. * configure.ac: Call GDB_AC_PTRACE and move ptrace checks ... * ptrace.m4: ... to this new file. gdb/gdbserver/ChangeLog: 2015-07-24 Pedro Alves <palves@redhat.com> * acinclude.m4: Include ../ptrace.m4. * configure.ac: Call GDB_AC_PTRACE. * config.in, configure: Regenerate.
Diffstat (limited to 'gdb/configure.ac')
-rw-r--r--gdb/configure.ac71
1 files changed, 2 insertions, 69 deletions
diff --git a/gdb/configure.ac b/gdb/configure.ac
index a40860a..905c27b 100644
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -1355,75 +1355,8 @@ AC_CHECK_FUNCS([getauxval getrusage getuid getgid \
AM_LANGINFO_CODESET
GDB_AC_COMMON
-# Check the return and argument types of ptrace. No canned test for
-# this, so roll our own.
-gdb_ptrace_headers='
-#include <sys/types.h>
-#if HAVE_SYS_PTRACE_H
-# include <sys/ptrace.h>
-#endif
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif
-'
-# There is no point in checking if we don't have a prototype.
-AC_CHECK_DECLS(ptrace, [], [
- : ${gdb_cv_func_ptrace_ret='int'}
- : ${gdb_cv_func_ptrace_args='int,int,long,long'}
-], $gdb_ptrace_headers)
-# Check return type. Varargs (used on GNU/Linux) conflict with the
-# empty argument list, so check for that explicitly.
-AC_CACHE_CHECK([return type of ptrace], gdb_cv_func_ptrace_ret,
- AC_TRY_COMPILE($gdb_ptrace_headers,
- [extern long ptrace (enum __ptrace_request, ...);],
- gdb_cv_func_ptrace_ret='long',
- AC_TRY_COMPILE($gdb_ptrace_headers,
- [extern int ptrace ();],
- gdb_cv_func_ptrace_ret='int',
- gdb_cv_func_ptrace_ret='long')))
-AC_DEFINE_UNQUOTED(PTRACE_TYPE_RET, $gdb_cv_func_ptrace_ret,
- [Define as the return type of ptrace.])
-# Check argument types.
-AC_CACHE_CHECK([types of arguments for ptrace], gdb_cv_func_ptrace_args, [
- AC_TRY_COMPILE($gdb_ptrace_headers,
- [extern long ptrace (enum __ptrace_request, ...);],
- [gdb_cv_func_ptrace_args='int,int,long,long'],[
-for gdb_arg1 in 'int' 'long'; do
- for gdb_arg2 in 'pid_t' 'int' 'long'; do
- for gdb_arg3 in 'int *' 'caddr_t' 'int' 'long' 'void *'; do
- for gdb_arg4 in 'int' 'long' 'void *'; do
- AC_TRY_COMPILE($gdb_ptrace_headers, [
-extern $gdb_cv_func_ptrace_ret
- ptrace ($gdb_arg1, $gdb_arg2, $gdb_arg3, $gdb_arg4);
-], [gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4";
- break 4;])
- for gdb_arg5 in 'int *' 'int' 'long'; do
- AC_TRY_COMPILE($gdb_ptrace_headers, [
-extern $gdb_cv_func_ptrace_ret
- ptrace ($gdb_arg1, $gdb_arg2, $gdb_arg3, $gdb_arg4, $gdb_arg5);
-], [
-gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4,$gdb_arg5";
- break 5;])
- done
- done
- done
- done
-done
-# Provide a safe default value.
-: ${gdb_cv_func_ptrace_args='int,int,long,long'}
-])])
-ac_save_IFS=$IFS; IFS=','
-set dummy `echo "$gdb_cv_func_ptrace_args" | sed 's/\*/\*/g'`
-IFS=$ac_save_IFS
-shift
-AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG3, $[3],
- [Define to the type of arg 3 for ptrace.])
-AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG4, $[4],
- [Define to the type of arg 4 for ptrace.])
-if test -n "$[5]"; then
- AC_DEFINE_UNQUOTED(PTRACE_TYPE_ARG5, $[5],
- [Define to the type of arg 5 for ptrace.])
-fi
+# Check the return and argument types of ptrace.
+GDB_AC_PTRACE
dnl AC_FUNC_SETPGRP does not work when cross compiling
dnl Instead, assume we will have a prototype for setpgrp if cross compiling.