* configure.ac: Check for memmem declaration.
[deliverable/binutils-gdb.git] / gdb / configure.ac
index 39246aab8250a36501c351604e7eaf19c89f3cbb..32d0937930437ebc2c66493e6536081e8838775b 100644 (file)
@@ -1,6 +1,6 @@
 dnl Autoconf configure script for GDB, the GNU debugger.
 dnl Copyright (C) 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-dnl 2005, 2006
+dnl 2005, 2006, 2007, 2008
 dnl Free Software Foundation, Inc.
 dnl
 dnl This file is part of GDB.
@@ -29,9 +29,10 @@ AC_PROG_CC
 AC_GNU_SOURCE
 AC_AIX
 AC_ISC_POSIX
+gl_EARLY
 AM_PROG_CC_STDC
 
-AC_CONFIG_AUX_DIR(`cd $srcdir;pwd`/..)
+AC_CONFIG_AUX_DIR(..)
 AC_CANONICAL_SYSTEM
 
 dnl List of object files and targets accumulated by configure.
@@ -59,10 +60,23 @@ if test x"$USE_NLS" = xyes; then
    CONFIG_UNINSTALL="$CONFIG_UNINSTALL uninstall-po"
 fi
 
+gl_INIT
+
+# For Makefile dependencies.
+GNULIB_STDINT_H=
+if test x"$STDINT_H" != x; then
+  GNULIB_STDINT_H=gnulib/$STDINT_H
+fi
+AC_SUBST(GNULIB_STDINT_H)
+
 PACKAGE=gdb
 AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of this package. ])
 AC_SUBST(PACKAGE)
 
+# GDB does not use automake, but gnulib does.  This line lets us
+# generate its Makefile.in.
+AM_INIT_AUTOMAKE(gdb, UNUSED-VERSION, [no-define])
+
 debugdir=${libdir}/debug
         
 AC_ARG_WITH(separate-debug-dir,
@@ -207,8 +221,6 @@ if test "x$targ_defvec" != x; then
     [Define to BFD's default target vector. ])
 fi
 
-AC_ARG_PROGRAM
-
 # The CLI cannot be disabled yet, but may be in the future.
 
 # Enable CLI.
@@ -255,11 +267,11 @@ fi
 AC_ARG_ENABLE(tui,
 [  --enable-tui            enable full-screen terminal user interface (TUI)],
   [case $enableval in
-    yes | no)
+    yes | no | auto)
       ;;
     *)
       AC_MSG_ERROR([bad value $enableval for --enable-tui]) ;;
-  esac],enable_tui=yes)
+  esac],enable_tui=auto)
 
 # Enable gdbtk.
 AC_ARG_ENABLE(gdbtk,
@@ -357,6 +369,11 @@ if test "$enable_profiling" = yes ; then
   CFLAGS="$OLD_CFLAGS"
 fi
 
+ACX_PKGVERSION([GDB])
+ACX_BUGURL([http://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])
+
 # --------------------- #
 # Checks for programs.  #
 # --------------------- #
@@ -394,6 +411,9 @@ AC_SEARCH_LIBS(gethostbyname, nsl)
 # Some systems (e.g. Solaris) have `socketpair' in libsocket.
 AC_SEARCH_LIBS(socketpair, socket)
 
+# Link in zlib if we can.  This allows us to read compressed debug sections.
+AC_SEARCH_LIBS(zlibVersion, z, [AC_CHECK_HEADERS(zlib.h)])
+
 # For the TUI, we need enhanced curses functionality.
 #
 # FIXME: kettenis/20040905: We prefer ncurses over the vendor-supplied
@@ -499,7 +519,6 @@ AC_CHECK_HEADERS(proc_service.h thread_db.h gnu/libc-version.h)
 AC_CHECK_HEADERS(signal.h)
 AC_CHECK_HEADERS(stddef.h)
 AC_CHECK_HEADERS(stdlib.h)
-AC_CHECK_HEADERS(stdint.h)
 AC_CHECK_HEADERS(string.h memory.h strings.h)
 AC_CHECK_HEADERS(sys/fault.h)
 AC_CHECK_HEADERS(sys/file.h)
@@ -553,9 +572,6 @@ AC_CHECK_HEADERS(elf_hp.h)
 # unconditionally, so what's the point in checking these?
 AC_CHECK_HEADERS(ctype.h time.h)
 
-# Create a header we can use portably to get the standard integer types.
-GCC_HEADER_STDINT(gdb_stdint.h)
-
 # ------------------------- #
 # Checks for declarations.  #
 # ------------------------- #
@@ -580,7 +596,6 @@ AC_CHECK_TYPES(socklen_t, [], [],
 [#include <sys/types.h>
 #include <sys/socket.h>
 ])
-AC_CHECK_TYPES(uintptr_t, [], [], [#include <stdint.h>])
 
 # ------------------------------------- #
 # Checks for compiler characteristics.  #
@@ -603,7 +618,7 @@ AC_CHECK_FUNCS(getuid getgid)
 AC_CHECK_FUNCS(poll)
 AC_CHECK_FUNCS(pread64)
 AC_CHECK_FUNCS(sbrk)
-AC_CHECK_FUNCS(setpgid setpgrp)
+AC_CHECK_FUNCS(setpgid setpgrp setsid)
 AC_CHECK_FUNCS(sigaction sigprocmask sigsetmask)
 AC_CHECK_FUNCS(socketpair)
 AC_CHECK_FUNCS(syscall)
@@ -628,16 +643,23 @@ 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.
+# 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 int ptrace ();],
-    gdb_cv_func_ptrace_ret='int',
-    gdb_cv_func_ptrace_ret='long'))
+    [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
@@ -661,7 +683,7 @@ gdb_cv_func_ptrace_args="$gdb_arg1,$gdb_arg2,$gdb_arg3,$gdb_arg4,$gdb_arg5";
 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
@@ -1253,6 +1275,29 @@ if test "x$gdb_cv_sys_syscall_h_has_tkill" = "xyes" && test "x$ac_cv_func_syscal
   AC_DEFINE(HAVE_TKILL_SYSCALL, 1, [Define if you support the tkill syscall.])
 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 Handle optional features that can be enabled.
 
 AC_ARG_WITH(sysroot,
@@ -1318,6 +1363,12 @@ build_warnings="-Wall -Wdeclaration-after-statement -Wpointer-arith \
 -Wformat-nonliteral -Wno-pointer-sign \
 -Wno-unused -Wno-switch -Wno-char-subscripts"
 
+# Enable -Wno-format by default when using gcc on mingw since many
+# GCC versions complain about %I64.
+case "${host}" in
+  *-*-mingw32*) build_warnings="$build_warnings -Wno-format" ;;
+esac
+
 AC_ARG_ENABLE(build-warnings,
 [  --enable-build-warnings Enable build-time compiler warnings if gcc is used],
 [case "${enableval}" in
@@ -1414,7 +1465,7 @@ OLD_LIBS=$LIBS
 CFLAGS="$CFLAGS -I${srcdir}/../include -I../bfd -I${srcdir}/../bfd"
 LDFLAGS="$LDFLAGS -L../bfd -L../libiberty"
 intl=`echo $LIBINTL | sed 's,${top_builddir}/,,g'`
-LIBS="$LIBS -lbfd -liberty $intl"
+LIBS="-lbfd -liberty $intl $LIBS"
 AC_CACHE_CHECK([for ELF support in BFD], gdb_cv_var_elf,
 [AC_TRY_LINK(
 [#include <stdlib.h>
@@ -1445,7 +1496,7 @@ AC_SUBST(WIN32LIBS)
 AC_SUBST(WIN32LDAPP)
 
 case "${host}" in
-*-*-cygwin*)
+*-*-cygwin* | *-*-mingw* )
     configdir="win"
     ;;
 *)
@@ -1557,20 +1608,23 @@ AC_PATH_X
 
 # Check whether we should enable the TUI, but only do so if we really
 # can.
-if test x"$enable_tui" = xyes; then
+if test x"$enable_tui" != xno; then
   if test -d $srcdir/tui; then
     if test "$ac_cv_search_waddstr" != no; then
       CONFIG_OBS="$CONFIG_OBS \$(SUBDIR_TUI_OBS)"
       CONFIG_DEPS="$CONFIG_DEPS \$(SUBDIR_TUI_DEPS)"
       CONFIG_SRCS="$CONFIG_SRCS \$(SUBDIR_TUI_SRCS)"
-      CONFIG_INITS="$CONFIG_INITS \$(SUBDIR_TUI_INITS)"
       ENABLE_CFLAGS="$ENABLE_CFLAGS \$(SUBDIR_TUI_CFLAGS)"
       CONFIG_ALL="${CONFIG_ALL} all-tui"
       CONFIG_CLEAN="${CONFIG_CLEAN} clean-tui"
       CONFIG_INSTALL="${CONFIG_INSTALL} install-tui"
       CONFIG_UNINSTALL="${CONFIG_UNINSTALL} uninstall-tui"
     else
-      AC_MSG_WARN([no enhanced curses library found; disabling TUI])
+      if test x"$enable_tui" = xyes; then
+       AC_MSG_ERROR([no enhanced curses library found; disable TUI])
+      else
+       AC_MSG_WARN([no enhanced curses library found; disabling TUI])
+      fi
     fi
   fi
 fi
@@ -1721,7 +1775,7 @@ AC_DEFINE(GDB_DEFAULT_HOST_CHARSET, "ISO-8859-1",
 
 AM_ICONV
 
-AC_OUTPUT(Makefile .gdbinit:gdbinit.in,
+AC_OUTPUT(Makefile .gdbinit:gdbinit.in gnulib/Makefile,
 [
 dnl Autoconf doesn't provide a mechanism for modifying definitions 
 dnl provided by makefile fragments.
This page took 0.028839 seconds and 4 git commands to generate.