summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2002-07-20 08:51:52 +0000
committerMartin v. Löwis <martin@v.loewis.de>2002-07-20 08:51:52 +0000
commitb9111947b0ada40c27f64800344f3bc51f198699 (patch)
treeb1f1820d06ee7a21697bf6d29067b675a9278940
parentf3c171b4dcd2dd64a4cbb1d210f23555f34ae403 (diff)
downloadcpython-b9111947b0ada40c27f64800344f3bc51f198699.tar.gz
Define _XOPEN_SOURCE and _GNU_SOURCE in pyconfig.h, to have them
available in the configure tests already.
-rw-r--r--Include/Python.h11
-rwxr-xr-xconfigure19
-rw-r--r--configure.in13
-rw-r--r--pyconfig.h.in8
4 files changed, 39 insertions, 12 deletions
diff --git a/Include/Python.h b/Include/Python.h
index 2d5e2a6e3e..dc9ce457e9 100644
--- a/Include/Python.h
+++ b/Include/Python.h
@@ -2,17 +2,6 @@
#define Py_PYTHON_H
/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */
-
-/* Enable compiler features; switching on C lib defines doesn't work
- here, because the symbols haven't necessarily been defined yet. */
-#ifndef _GNU_SOURCE
-# define _GNU_SOURCE 1
-#endif
-
-#ifndef _XOPEN_SOURCE
-# define _XOPEN_SOURCE 500
-#endif
-
/* Include nearly all Python header files */
#include "patchlevel.h"
diff --git a/configure b/configure
index 4bd474084d..7fc3bfd127 100755
--- a/configure
+++ b/configure
@@ -1,5 +1,5 @@
#! /bin/sh
-# From configure.in Revision: 1.333 .
+# From configure.in Revision: 1.334 .
# Guess values for system-dependent variables and create Makefiles.
# Generated by GNU Autoconf 2.53.
#
@@ -1225,6 +1225,23 @@ VERSION=2.3
SOVERSION=1.0
+# The later defininition of _XOPEN_SOURCE disables certain features
+# on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
+
+cat >>confdefs.h <<\_ACEOF
+#define _GNU_SOURCE 1
+_ACEOF
+
+
+# The definition of _GNU_SOURCE potentially causes a change of the value
+# of _XOPEN_SOURCE. So define it only conditionally.
+
+
+cat >>confdefs.h <<\_ACEOF
+#define _XOPEN_SOURCE 500
+_ACEOF
+
+
# Arguments passed to configure.
CONFIG_ARGS="$ac_configure_args"
diff --git a/configure.in b/configure.in
index 208dc056ee..98d54d1a47 100644
--- a/configure.in
+++ b/configure.in
@@ -20,6 +20,19 @@ VERSION=2.3
AC_SUBST(SOVERSION)
SOVERSION=1.0
+# The later defininition of _XOPEN_SOURCE disables certain features
+# on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
+AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
+
+# The definition of _GNU_SOURCE potentially causes a change of the value
+# of _XOPEN_SOURCE. So define it only conditionally.
+AH_VERBATIM([_XOPEN_SOURCE],
+[/* Define on UNIX to activate XPG/5 features. */
+#ifndef _XOPEN_SOURCE
+# define _XOPEN_SOURCE 500
+#endif])
+AC_DEFINE(_XOPEN_SOURCE, 500)
+
# Arguments passed to configure.
AC_SUBST(CONFIG_ARGS)
CONFIG_ARGS="$ac_configure_args"
diff --git a/pyconfig.h.in b/pyconfig.h.in
index 8b14932432..8a9a1ada50 100644
--- a/pyconfig.h.in
+++ b/pyconfig.h.in
@@ -754,6 +754,9 @@
/* This must be set to 64 on some systems to enable large file support. */
#undef _FILE_OFFSET_BITS
+/* Define on Linux to activate all library features */
+#undef _GNU_SOURCE
+
/* This must be defined on some systems to enable large file support. */
#undef _LARGEFILE_SOURCE
@@ -773,6 +776,11 @@
/* Define to force use of thread-safe errno, h_errno, and other functions */
#undef _REENTRANT
+/* Define on UNIX to activate XPG/5 features. */
+#ifndef _XOPEN_SOURCE
+# define _XOPEN_SOURCE 500
+#endif
+
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
#ifndef __CHAR_UNSIGNED__
# undef __CHAR_UNSIGNED__