diff --git a/configure.ac b/configure.ac index 3f5e5d8c1..c3107dc8c 100644 --- a/configure.ac +++ b/configure.ac @@ -1757,20 +1757,13 @@ AC_SUBST(XKB_COMPILED_DIR) dnl and the rest of these are generic, so they're in config.h AC_DEFINE(XResExtension, 1, [Build XRes extension]) -dnl CYGWIN does not define fd_set if _POSIX_SOURCE is defined -dnl _*_SOURCE on Solaris restricts to the standards, and removes non-standard -dnl functions which X uses -case $host_os in - cygwin*) ;; - solaris*) ;; - darwin*) ;; - 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_TRY_COMPILE([ +#include +#ifndef __GLIBC__ +#error not glibc +#endif +], [], [AC_DEFINE(_GNU_SOURCE, 1, + [ Enable GNU and other extensions to the C environment for glibc])]) AC_DEFINE_DIR(PROJECTROOT, prefix, [Overall prefix]) diff --git a/include/dix-config.h.in b/include/dix-config.h.in index 6bf27865c..1a9fdc516 100644 --- a/include/dix-config.h.in +++ b/include/dix-config.h.in @@ -419,16 +419,8 @@ /* Endian order */ #undef X_BYTE_ORDER -/* BSD-compliant source */ -#undef _BSD_SOURCE - -/* POSIX-compliant source */ -#undef _POSIX_SOURCE - -#ifndef _XOPEN_SOURCE -/* X/Open-compliant source */ -#undef _XOPEN_SOURCE -#endif +/* Enable GNU and other extensions to the C environment for GLIBC */ +#undef _GNU_SOURCE /* Define to empty if `const' does not conform to ANSI C. */ #undef const diff --git a/os/utils.c b/os/utils.c index b98c9c1fd..7c725e38d 100644 --- a/os/utils.c +++ b/os/utils.c @@ -53,23 +53,6 @@ OR PERFORMANCE OF THIS SOFTWARE. #include #endif -#ifndef __GLIBC__ -#include -#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 -#undef _POSIX_C_SOURCE -#ifdef _SAVED_POSIX_C_SOURCE -#define _POSIX_C_SOURCE _SAVED_POSIX_C_SOURCE -#endif -#endif /* __linux__ */ - #ifdef __CYGWIN__ #include #include @@ -80,6 +63,7 @@ OR PERFORMANCE OF THIS SOFTWARE. #endif #include #include +#include #include "misc.h" #include #define XSERV_t