where best to define __USE_XOPEN or include <features.h>?

Skip Montanaro skip at mojam.com
Wed Jun 2 13:16:35 EDT 1999

My Linux system (RH 5.2) is warning me about strptime when I build
Python 1.5.2.  I saw the comment in timemodule.c:

    /* extern char *strptime(); /* Enable this if it's not declared in
<time.h> */

I then took a look at <time.h> and saw:

    #ifdef __USE_XOPEN
    /* Parse S according to FORMAT and store binary time information in
       The return value is a pointer to the first unparsed character in
S.  */
    extern char *strptime __P ((__const char *__s, __const char *__fmt,
				struct tm *__tp));

This set me looking for the definition of __USE_XOPEN, which I found in
<features.h>, guarded by #ifdef _XOPEN_SOURCE.

Short-term, I can take the easy way out and simply modify timemodule.c,
however that's likely to be forgotten.  I was hoping there was some way
already in place (perhaps via configure) that would allow me to easily
set up the environment necessary to get strptime defined.  Being able to
set this stuff from the configure command line means my settings get
remembered at the top of config.status.

Any suggestions?

Skip Montanaro	| Mojam: "Uniting the World of Music"
skip at mojam.com  | Musi-Cal: http://www.musi-cal.com/

More information about the Python-list mailing list