2.4.2 on AIX fails compiling _codecs_cn.c

"Martin v. Löwis" martin at v.loewis.de
Thu Nov 24 03:23:37 EST 2005


Paul Watson wrote:
> It appears that _ALL_SOURCE gets defined in the /usr/include/standards.h 
> file.  If we could #define _ANSI_C_SOURCE or _POSIX_SOURCE, it appears 
> that it would eleminate _ALL_SOURCE.

Ah, ok - this should be easy enough. Python would normally define
_POSIX_SOURCE (through _XOPEN_SOURCE), but configure(.in) has this
block:

   # On AIX 4 and 5.1, mbstate_t is defined only when _XOPEN_SOURCE == 
500 but
   # used in wcsnrtombs() and mbsnrtowcs() even if _XOPEN_SOURCE is not 
defined
   # or has another value. By not (re)defining it, the defaults come in 
place.
   AIX/4)
     define_xopen_source=no;;
   AIX/5)
     if test `uname -r` -eq 1; then
       define_xopen_source=no
     fi
     ;;

which causes _XOPEN_SOURCE (and subsequently probably _POSIX_SOURCE) not 
to be defined. What AIX version are you using? Can you try removing
the fragment from configure(.in), rerun configure, verify that 
_XOPEN_SOURCE is defined in pyconfig.h, and then try building again?

If this works, this might be a solution. Otherwise, we need to put 
something like this into _codecs_cn.c:

#ifdef hz
/* On AIX version such-and-such, hz is defined because _ALL_SOURCE is
    defined, this in turn is defined because _XOPEN_SOURCE is not.
    As _XOPEN_SOURCE cannot be enabled (see configure.in), we just
    work around by removing the hz definition again. */
#undef hz
#endif

Regards,
Martin



More information about the Python-list mailing list