Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6f18a3c

Browse files
committed
Define _XOPEN_SOURCE and _GNU_SOURCE in pyconfig.h, to have them
available in the configure tests already.
1 parent 0a30e64 commit 6f18a3c

4 files changed

Lines changed: 39 additions & 12 deletions

File tree

Include/Python.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,6 @@
22
#define Py_PYTHON_H
33
/* Since this is a "meta-include" file, no #ifdef __cplusplus / extern "C" { */
44

5-
6-
/* Enable compiler features; switching on C lib defines doesn't work
7-
here, because the symbols haven't necessarily been defined yet. */
8-
#ifndef _GNU_SOURCE
9-
# define _GNU_SOURCE 1
10-
#endif
11-
12-
#ifndef _XOPEN_SOURCE
13-
# define _XOPEN_SOURCE 500
14-
#endif
15-
165
/* Include nearly all Python header files */
176

187
#include "patchlevel.h"

configure

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#! /bin/sh
2-
# From configure.in Revision: 1.333 .
2+
# From configure.in Revision: 1.334 .
33
# Guess values for system-dependent variables and create Makefiles.
44
# Generated by GNU Autoconf 2.53.
55
#
@@ -1225,6 +1225,23 @@ VERSION=2.3
12251225
12261226
SOVERSION=1.0
12271227
1228+
# The later defininition of _XOPEN_SOURCE disables certain features
1229+
# on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
1230+
1231+
cat >>confdefs.h <<\_ACEOF
1232+
#define _GNU_SOURCE 1
1233+
_ACEOF
1234+
1235+
1236+
# The definition of _GNU_SOURCE potentially causes a change of the value
1237+
# of _XOPEN_SOURCE. So define it only conditionally.
1238+
1239+
1240+
cat >>confdefs.h <<\_ACEOF
1241+
#define _XOPEN_SOURCE 500
1242+
_ACEOF
1243+
1244+
12281245
# Arguments passed to configure.
12291246
12301247
CONFIG_ARGS="$ac_configure_args"

configure.in

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,19 @@ VERSION=2.3
2020
AC_SUBST(SOVERSION)
2121
SOVERSION=1.0
2222

23+
# The later defininition of _XOPEN_SOURCE disables certain features
24+
# on Linux, so we need _GNU_SOURCE to re-enable them (makedev, tm_zone).
25+
AC_DEFINE(_GNU_SOURCE, 1, [Define on Linux to activate all library features])
26+
27+
# The definition of _GNU_SOURCE potentially causes a change of the value
28+
# of _XOPEN_SOURCE. So define it only conditionally.
29+
AH_VERBATIM([_XOPEN_SOURCE],
30+
[/* Define on UNIX to activate XPG/5 features. */
31+
#ifndef _XOPEN_SOURCE
32+
# define _XOPEN_SOURCE 500
33+
#endif])
34+
AC_DEFINE(_XOPEN_SOURCE, 500)
35+
2336
# Arguments passed to configure.
2437
AC_SUBST(CONFIG_ARGS)
2538
CONFIG_ARGS="$ac_configure_args"

pyconfig.h.in

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -754,6 +754,9 @@
754754
/* This must be set to 64 on some systems to enable large file support. */
755755
#undef _FILE_OFFSET_BITS
756756

757+
/* Define on Linux to activate all library features */
758+
#undef _GNU_SOURCE
759+
757760
/* This must be defined on some systems to enable large file support. */
758761
#undef _LARGEFILE_SOURCE
759762

@@ -773,6 +776,11 @@
773776
/* Define to force use of thread-safe errno, h_errno, and other functions */
774777
#undef _REENTRANT
775778

779+
/* Define on UNIX to activate XPG/5 features. */
780+
#ifndef _XOPEN_SOURCE
781+
# define _XOPEN_SOURCE 500
782+
#endif
783+
776784
/* Define to 1 if type `char' is unsigned and you are not using gcc. */
777785
#ifndef __CHAR_UNSIGNED__
778786
# undef __CHAR_UNSIGNED__

0 commit comments

Comments
 (0)