distutils & OS X universal binaries

Robin Becker robin at NOSPAMreportlab.com
Sat Dec 8 11:46:47 EST 2007


Martin v. Löwis wrote:
.........
> 
> In the specific case, just use the WORDS_BIGENDIAN macro defined in
> pyconfig.h; it will be defined if the target is bigendian, and
> undefined otherwise. In the case of a universal build, it will be
> undefined in the x86 compiler invocation, and defined in the ppc
> invocation.
> 
> If you are curious as to how it arranges that, read the source.
......

OK I read the source and am slightly puzzled by the code in 
pyconfig.h.in which reads

#ifdef __BIG_ENDIAN__
#define WORDS_BIGENDIAN 1
#else
#ifndef __LITTLE_ENDIAN__
#undef WORDS_BIGENDIAN
#endif
#endif


I'm puzzled why WORDS_BIGENDIAN is undefined if both __BIG_ENDIAN__ and 
__LITTLE_ENDIAN__ are undefined. Surely in that case WORDS_BIGENDIAN 
should be left alone (if it is already defined). If there's a compiler 
for a bigendian architecture which doesn't define the gcc macros the we 
seem to get the wrong result.
-- 
Robin Becker



More information about the Python-list mailing list