[Python-Dev] Make _GNU_SOURCE default for gcc ?!

M.-A. Lemburg mal@lemburg.com
Tue, 04 Jul 2000 19:48:35 +0200


"M.-A. Lemburg" wrote:
> 
> Andrew Kuchling wrote:
> >
> > On Tue, Jul 04, 2000 at 11:45:05AM +0200, M.-A. Lemburg wrote:
> > >#ifdef __GNUC__
> > ># define _GNU_SOURCE
> > >#endif
> >
> > Doesn't it make more sense to define _GNU_SOURCE only if the C library
> > is glibc?  You could be using GCC on Solaris with Sun's libc, for
> > example, where _GNU_SOURCE would be meaningless.  Probably you have to
> > define _XOPEN_SOURCE everywhere, and _GNU_SOURCE if the libc is glibc.
> 
> Good point... it should probably read:
> 
> #ifdef __GLIBC__
> # define _GNU_SOURCE
> #else
> # define _XOPEN_SOURCE 500
> #endif
> 
> I'll do some more testing later today.

The testing showed that the above switch doesn't work:
__GLIBC__ is defined in features.h which is included by
all standard C lib headers in glibc.

The following finally made the warnings in timemodule.c
go away:

/* Enable compiler features including SUSv2 compatibility; switching
   on C lib defines doesn't work here, because the symbols haven't
   necessarily been defined yet. */
#define _GNU_SOURCE     1
#define _XOPEN_SOURCE   500

Defining _GNU_SOURCE on non glibc platforms shouldn't hurt,
so I simply dropped the switch.

Should I check this in ?

-- 
Marc-Andre Lemburg
______________________________________________________________________
Business:                                      http://www.lemburg.com/
Python Pages:                           http://www.lemburg.com/python/