gdb: btrace: fix build errors on older glibc builds
[deliverable/binutils-gdb.git] / gdb / gdbserver / configure.ac
index ac8223a2906afc5f4731f7a26177c3a7611e8d23..c1675086c0bced0885f69ba661b1b3ba8add91d3 100644 (file)
@@ -1,5 +1,5 @@
 dnl Autoconf configure script for GDB server.
-dnl Copyright (C) 2000, 2002-2012 Free Software Foundation, Inc.
+dnl Copyright (C) 2000-2013 Free Software Foundation, Inc.
 dnl
 dnl This file is part of GDB.
 dnl
@@ -26,12 +26,13 @@ AC_CONFIG_HEADER(config.h:config.in)
 AM_MAINTAINER_MODE
 
 AC_PROG_CC
-gl_EARLY
 AC_GNU_SOURCE
+AC_SYS_LARGEFILE
 
 AC_CANONICAL_SYSTEM
 
 AC_PROG_INSTALL
+AC_PROG_RANLIB
 
 AC_ARG_PROGRAM
 
@@ -40,16 +41,51 @@ AC_HEADER_DIRENT
 
 AC_FUNC_ALLOCA
 
+# Set the 'development' global.
+. $srcdir/../development.sh
+
+# Enable -lmcheck by default (it provides cheap-enough memory
+# mangling), but turn it off for releases.
+if $development; then
+  libmcheck_default=yes
+else
+  libmcheck_default=no
+fi
+GDB_AC_LIBMCHECK(${libmcheck_default})
+
+ACX_NONCANONICAL_TARGET
+ACX_NONCANONICAL_HOST
+
+# Dependency checking.
+ZW_CREATE_DEPDIR
+ZW_PROG_COMPILER_DEPENDENCIES([CC])
+
 # Check for the 'make' the user wants to use.
 AC_CHECK_PROGS(MAKE, make)
+MAKE_IS_GNU=
+case "`$MAKE --version 2>&1 | sed 1q`" in
+  *GNU*)
+    MAKE_IS_GNU=yes
+    ;;
+esac
+AM_CONDITIONAL(GMAKE, test "$MAKE_IS_GNU" = yes)
+AC_PROG_MAKE_SET
+
+# Configure gnulib.  We can't use AC_CONFIG_SUBDIRS as that'd expect
+# to find the the source subdir to be configured directly under
+# gdbserver/.  We need to build gnulib under some other directory not
+# "gnulib", to avoid the problem of both GDB and GDBserver wanting to
+# build it in the same directory, when building in the source dir.
+ACX_CONFIGURE_DIR(["../gnulib"], ["build-gnulib-gdbserver"])
 
 AC_CHECK_HEADERS(sgtty.h termio.h termios.h sys/reg.h string.h dnl
                 proc_service.h sys/procfs.h thread_db.h linux/elf.h dnl
-                stdlib.h unistd.h dnl
+                stdlib.h dnl
                 errno.h fcntl.h signal.h sys/file.h malloc.h dnl
                 sys/ioctl.h netinet/in.h sys/socket.h netdb.h dnl
-                netinet/tcp.h arpa/inet.h sys/wait.h sys/un.h)
-AC_CHECK_FUNCS(pread pwrite pread64 readlink)
+                netinet/tcp.h arpa/inet.h sys/wait.h wait.h sys/un.h dnl
+                linux/perf_event.h sys/syscall.h)
+AC_CHECK_FUNCS(pread pwrite pread64 readlink fdwalk pipe2)
 AC_REPLACE_FUNCS(vasprintf vsnprintf)
 
 # Check for UST
@@ -119,7 +155,7 @@ if test "${ERROR_ON_WARNING}" = yes ; then
 fi
 
 build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
--Wformat-nonliteral -Wno-char-subscripts"
+-Wformat-nonliteral -Wno-char-subscripts -Wempty-body"
 
 WARN_CFLAGS=""
 if test "x$GCC" = xyes
@@ -167,7 +203,7 @@ AC_TRY_LINK([
   [AC_MSG_RESULT(no)])
 fi
 
-AC_CHECK_DECLS([strerror, perror, memmem, vasprintf, vsnprintf])
+AC_CHECK_DECLS([strerror, strstr, perror, vasprintf, vsnprintf])
 
 AC_CHECK_TYPES(socklen_t, [], [],
 [#include <sys/types.h>
@@ -271,6 +307,11 @@ if test "${srv_linux_regsets}" = "yes"; then
   fi
 fi
 
+if test "${srv_linux_btrace}" = "yes"; then
+  AC_DEFINE(HAVE_LINUX_BTRACE, 1,
+           [Define if the target supports branch tracing.])
+fi
+
 if test "$ac_cv_header_sys_procfs_h" = yes; then
   BFD_HAVE_SYS_PROCFS_TYPE(lwpid_t)
   BFD_HAVE_SYS_PROCFS_TYPE(psaddr_t)
@@ -296,7 +337,6 @@ LIBS="$old_LIBS"
 
 srv_thread_depfiles=
 srv_libs=
-USE_THREAD_DB=
 
 if test "$srv_linux_thread_db" = "yes"; then
   if test "$ac_cv_lib_dl_dlopen" = "yes"; then
@@ -324,7 +364,7 @@ if test "$srv_linux_thread_db" = "yes"; then
   fi
 
   srv_thread_depfiles="thread-db.o proc-service.o"
-  USE_THREAD_DB="-DUSE_THREAD_DB"
+  AC_DEFINE(USE_THREAD_DB, 1, [Define if we should use libthread_db.])
   AC_CACHE_CHECK([for TD_VERSION], gdbsrv_cv_have_td_version,
   [AC_TRY_COMPILE([#include <thread_db.h>], [TD_VERSION;],
                  [gdbsrv_cv_have_td_version=yes],
@@ -433,24 +473,20 @@ fi
 
 AC_SUBST(GDBSERVER_DEPFILES)
 AC_SUBST(GDBSERVER_LIBS)
-AC_SUBST(USE_THREAD_DB)
 AC_SUBST(srv_xmlbuiltin)
 AC_SUBST(srv_xmlfiles)
 AC_SUBST(IPA_DEPFILES)
 AC_SUBST(extra_libraries)
 
-gl_INIT
-# GDBserver does not use automake, but gnulib does.  This line lets
-# us generate its Makefile.in.
-AM_INIT_AUTOMAKE(gdbserver, UNUSED-VERSION, [no-define])
+GNULIB=build-gnulib-gdbserver/import
 
 GNULIB_STDINT_H=
 if test x"$STDINT_H" != x; then
-  GNULIB_STDINT_H=gnulib/$STDINT_H
+  GNULIB_STDINT_H=$GNULIB/$STDINT_H
 fi
 AC_SUBST(GNULIB_STDINT_H)
 
-AC_OUTPUT(Makefile gnulib/Makefile:${srcdir}/../gnulib/Makefile.in,
+AC_OUTPUT(Makefile,
 [case x$CONFIG_HEADERS in
 xconfig.h:config.in)
 echo > stamp-h ;;
This page took 0.02615 seconds and 4 git commands to generate.