This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Cleanup Configure.in (14/n)


Here's a patch that makes us define _GNU_SOURCE to make sure we get
all GNU extensions on systems that have them.  There has been talk
about doing this before in relation to canonicalize_file_name.  Then
people didn't want to take the risk of introducing additional
problems.  However, knwoing glibc fairly well, I think the risk is
low.  Let's say I know what I'm doing... (famous last words).  Anyway,
this lets me greatly simplify the check for pread64, and gets rid of
the -D junk in the compilations on Linux.

Checked in.

Mark

P.S. I used aclocal from Automake 1.4-p5 to regenerate aclocal.m4.
This introduces some minor differences with respect to what used to be
there, but nothing serious.  Feel free to regenerate it.


Index: ChangeLog
from  Mark Kettenis  <kettenis@gnu.org>

	* configure.in: Call AC_GNU_SOURCE.  Check for pread64 using
	AC_CHECK_FUNCS and remove the old check for pread64.
	* acinclude.m4 (AC_GNU_SOURCE): New macro.
	* acconfig.h (_GNU_SOURCE): Add.
	(HAVE_PREAD64): Remove.
	* configure, aclocal.m4, config.in: Regenerated.

Index: acconfig.h
===================================================================
RCS file: /cvs/src/src/gdb/acconfig.h,v
retrieving revision 1.23
diff -u -p -r1.23 acconfig.h
--- acconfig.h 2 Jan 2003 22:59:01 -0000 1.23
+++ acconfig.h 4 Jan 2003 00:22:30 -0000
@@ -1,3 +1,8 @@
+/* Enable GNU extensions on systems that have them.  */
+#ifndef _GNU_SOURCE
+# undef _GNU_SOURCE
+#endif
+
 /* Define if your struct reg has r_fs.  */
 #undef HAVE_STRUCT_REG_R_FS
 
@@ -45,9 +50,6 @@
 
 /* Define if <sys/procfs.h> has pr_siginfo64_t */
 #undef HAVE_PR_SIGINFO64_T
-
-/* Define if the pread64 function is available.  */
-#undef HAVE_PREAD64
 
 /* Define if <link.h> exists and defines struct link_map which has
    members with an ``l_'' prefix.  (For Solaris, SVR4, and
Index: acinclude.m4
===================================================================
RCS file: /cvs/src/src/gdb/acinclude.m4,v
retrieving revision 1.5
diff -u -p -r1.5 acinclude.m4
--- acinclude.m4 27 Nov 2002 19:13:08 -0000 1.5
+++ acinclude.m4 4 Jan 2003 00:22:30 -0000
@@ -918,3 +918,12 @@ size_t iconv();
   fi
   AC_SUBST(LIBICONV)
 ])
+
+# AC_GNU_SOURCE
+# -------------
+# FIXME: Remove thise once we start using Autoconf 2.5x (x>=4).
+AC_DEFUN([AC_GNU_SOURCE],
+[AC_BEFORE([$0], [AC_TRY_COMPILE])dnl
+AC_BEFORE([$0], [AC_TRY_RUN])dnl
+AC_DEFINE([_GNU_SOURCE])
+])
Index: configure.in
===================================================================
RCS file: /cvs/src/src/gdb/configure.in,v
retrieving revision 1.111
diff -u -p -r1.111 configure.in
--- configure.in 3 Jan 2003 23:19:27 -0000 1.111
+++ configure.in 4 Jan 2003 00:22:31 -0000
@@ -26,6 +26,7 @@ AC_CONFIG_HEADER(config.h:config.in)
 AM_MAINTAINER_MODE
 
 AC_PROG_CC
+AC_GNU_SOURCE
 AC_AIX
 AC_ISC_POSIX
 AM_PROG_CC_STDC
@@ -307,6 +308,7 @@ AC_FUNC_MMAP
 AC_FUNC_VFORK
 AC_CHECK_FUNCS(canonicalize_file_name realpath)
 AC_CHECK_FUNCS(poll)
+AC_CHECK_FUNCS(pread64)
 AC_CHECK_FUNCS(sbrk)
 AC_CHECK_FUNCS(setpgid setpgrp)
 AC_CHECK_FUNCS(sigaction sigprocmask sigsetmask)
@@ -824,23 +826,6 @@ fi
 if test "x$gdb_cv_thread_db_h_has_td_notalloc" = "xyes"; then
   AC_DEFINE(THREAD_DB_HAS_TD_NOTALLOC, 1,
             [Define if <thread_db.h> has the TD_NOTALLOC error code.])
-fi
-
-dnl linux-proc.c wants to use pread64, which may require special CFLAGS
-dnl -D_BSD_SOURCE is normally assumed but we have to specify it because of
-dnl -D_XOPEN_SOURCE=500.
-if test $host = $target; then
-  case $target in
-    *-linux*)
-      save_CFLAGS=$CFLAGS
-      CFLAGS="$CFLAGS -D_BSD_SOURCE -D_XOPEN_SOURCE=500 -D_LARGEFILE64_SOURCE"
-      AC_TRY_LINK([#include <unistd.h>],
-		  [pread64 (0, NULL, 0, 0);],
-		  [ENABLE_CFLAGS="$ENABLE_CFLAGS -D_BSD_SOURCE -D_XOPEN_SOURCE=500 -D_LARGEFILE64_SOURCE"
-		   AC_DEFINE(HAVE_PREAD64)], [])
-      CFLAGS=$save_CFLAGS
-      ;;
-  esac
 fi
 
 dnl Handle optional features that can be enabled.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]