Skip to content

Commit

Permalink
Bug #9555: Always define _GNU_SOURCE in glibc environments.
Browse files Browse the repository at this point in the history
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.
(cherry picked from 7fccec9 commit)
  • Loading branch information
Adam Jackson committed Jan 22, 2007
1 parent fd77f9c commit fd838c0
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 41 deletions.
21 changes: 7 additions & 14 deletions configure.ac
Expand Up @@ -1599,20 +1599,13 @@ dnl and the rest of these are generic, so they're in config.h
AC_DEFINE(XFreeXDGA, 1, [Build XDGA support])
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 <features.h>
#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])

Expand Down
12 changes: 2 additions & 10 deletions include/dix-config.h.in
Expand Up @@ -410,16 +410,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
Expand Down
18 changes: 1 addition & 17 deletions os/utils.c
Expand Up @@ -53,23 +53,6 @@ OR PERFORMANCE OF THIS SOFTWARE.
#include <dix-config.h>
#endif

/* The world's most shocking hack, to ensure we get clock_gettime() and
* CLOCK_MONOTONIC. */
#ifdef sun /* Needed to tell Solaris headers not to restrict to */
#define __EXTENSIONS__ /* only the functions defined in POSIX 199309. */
#endif

#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

#ifdef __CYGWIN__
#include <stdlib.h>
#include <signal.h>
Expand All @@ -80,6 +63,7 @@ OR PERFORMANCE OF THIS SOFTWARE.
#endif
#include <X11/Xos.h>
#include <stdio.h>
#include <time.h>
#include "misc.h"
#include <X11/X.h>
#define XSERV_t
Expand Down

0 comments on commit fd838c0

Please sign in to comment.