New gdbserver option --debug-format=timestamp.
[binutils-gdb.git] / gdb / gdbserver / configure.ac
index 36ed82f55da41d8e1d00f621520d94b77ad4d8d8..0dfa4a9cc3a8056abbd00cbd1ff7ec193e9b989f 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-2014 Free Software Foundation, Inc.
 dnl
 dnl This file is part of GDB.
 dnl
@@ -27,6 +27,7 @@ AM_MAINTAINER_MODE
 
 AC_PROG_CC
 AC_GNU_SOURCE
+AC_SYS_LARGEFILE
 
 AC_CANONICAL_SYSTEM
 
@@ -36,12 +37,38 @@ AC_PROG_RANLIB
 AC_ARG_PROGRAM
 
 AC_HEADER_STDC
-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
@@ -51,14 +78,15 @@ AC_CHECK_PROGS(MAKE, make)
 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
+                proc_service.h sys/procfs.h linux/elf.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 wait.h sys/un.h)
-AC_CHECK_FUNCS(pread pwrite pread64 readlink)
+                netinet/tcp.h arpa/inet.h)
+AC_CHECK_FUNCS(gettimeofday pread pwrite pread64 readlink)
 AC_REPLACE_FUNCS(vasprintf vsnprintf)
 
+GDB_AC_COMMON
+
 # Check for UST
 ustlibs=""
 ustinc=""
@@ -158,23 +186,7 @@ LIBS="$LIBS -ldl"
 AC_CHECK_FUNCS(dladdr)
 LIBS="$old_LIBS"
 
-have_errno=no
-AC_MSG_CHECKING(for errno)
-AC_TRY_LINK([
-#if HAVE_ERRNO_H
-#include <errno.h>
-#endif], [static int x; x = errno;],
-  [AC_MSG_RESULT(yes - in errno.h); AC_DEFINE(HAVE_ERRNO, 1, [Define if errno is available]) have_errno=yes])
-if test $have_errno = no; then
-AC_TRY_LINK([
-#if HAVE_ERRNO_H
-#include <errno.h>
-#endif], [extern int errno; static int x; x = errno;],
-  [AC_MSG_RESULT(yes - must define); AC_DEFINE(HAVE_ERRNO, 1, [Define if errno is available]) AC_DEFINE(MUST_DEFINE_ERRNO, 1, [Checking if errno must be defined])],
-  [AC_MSG_RESULT(no)])
-fi
-
-AC_CHECK_DECLS([strerror, strstr, perror, vasprintf, vsnprintf])
+AC_CHECK_DECLS([strerror, perror, vasprintf, vsnprintf])
 
 AC_CHECK_TYPES(socklen_t, [], [],
 [#include <sys/types.h>
@@ -278,6 +290,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)
@@ -303,7 +320,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
@@ -331,7 +347,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],
@@ -440,7 +456,6 @@ 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)