Bug #9555: Always define _GNU_SOURCE in glibc environments.

This keeps us from having to define _POSIX_C_SOURCE, _BSD_SOURCE, and
_XOPEN_SORUCE to get the C environment we want in different places.  It also
fixes the build on linux due to RTLD_DEFAULT having not been defined.
This commit is contained in:
Eric Anholt 2007-01-10 13:10:43 -08:00
parent 78f9592c11
commit 7fccec91c4
3 changed files with 10 additions and 41 deletions

View File

@ -1757,20 +1757,13 @@ AC_SUBST(XKB_COMPILED_DIR)
dnl and the rest of these are generic, so they're in config.h dnl and the rest of these are generic, so they're in config.h
AC_DEFINE(XResExtension, 1, [Build XRes extension]) AC_DEFINE(XResExtension, 1, [Build XRes extension])
dnl CYGWIN does not define fd_set if _POSIX_SOURCE is defined AC_TRY_COMPILE([
dnl _*_SOURCE on Solaris restricts to the standards, and removes non-standard #include <features.h>
dnl functions which X uses #ifndef __GLIBC__
case $host_os in #error not glibc
cygwin*) ;; #endif
solaris*) ;; ], [], [AC_DEFINE(_GNU_SOURCE, 1,
darwin*) ;; [ Enable GNU and other extensions to the C environment for glibc])])
freebsd*|netbsd*|openbsd*) ;;
*)
AC_DEFINE(_POSIX_SOURCE, 1, [POSIX-compliant source])
AC_DEFINE(_XOPEN_SOURCE, 500, [X/Open-compliant source])
AC_DEFINE(_BSD_SOURCE, 1, [BSD-compliant source])
;;
esac
AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix]) AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix])

View File

@ -419,16 +419,8 @@
/* Endian order */ /* Endian order */
#undef X_BYTE_ORDER #undef X_BYTE_ORDER
/* BSD-compliant source */ /* Enable GNU and other extensions to the C environment for GLIBC */
#undef _BSD_SOURCE #undef _GNU_SOURCE
/* POSIX-compliant source */
#undef _POSIX_SOURCE
#ifndef _XOPEN_SOURCE
/* X/Open-compliant source */
#undef _XOPEN_SOURCE
#endif
/* Define to empty if `const' does not conform to ANSI C. */ /* Define to empty if `const' does not conform to ANSI C. */
#undef const #undef const

View File

@ -53,23 +53,6 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include <dix-config.h> #include <dix-config.h>
#endif #endif
#ifndef __GLIBC__
#include <time.h>
#else
/* The world's most shocking hack, to ensure we get clock_gettime() and
* CLOCK_MONOTONIC. */
#ifdef _POSIX_C_SOURCE
#define _SAVED_POSIX_C_SOURCE _POSIX_C_SOURCE
#undef _POSIX_C_SOURCE
#endif
#define _POSIX_C_SOURCE 199309L
#include <time.h>
#undef _POSIX_C_SOURCE
#ifdef _SAVED_POSIX_C_SOURCE
#define _POSIX_C_SOURCE _SAVED_POSIX_C_SOURCE
#endif
#endif /* __linux__ */
#ifdef __CYGWIN__ #ifdef __CYGWIN__
#include <stdlib.h> #include <stdlib.h>
#include <signal.h> #include <signal.h>
@ -80,6 +63,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
#endif #endif
#include <X11/Xos.h> #include <X11/Xos.h>
#include <stdio.h> #include <stdio.h>
#include <time.h>
#include "misc.h" #include "misc.h"
#include <X11/X.h> #include <X11/X.h>
#define XSERV_t #define XSERV_t