[Python-Dev] python, lipo and the future?

"Martin v. Löwis" martin at v.loewis.de
Sun Sep 17 18:53:04 CEST 2006


Ronald Oussoren schrieb:
> One problem is that python's configure script detects the sizes of
> various types and those values will be different on 32-bit and 64-bit
> flavours.

FWIW, the PC build "solves" this problem by providing a hand-crafted
pyconfig.h file, instead of using an autoconf-generated one.
That could work for OSX as well, although it is tedious to keep
the hand-crafted file up-to-date.

For the PC, this isn't really a problem, since Windows doesn't suddenly
grow new features, at least not those that configure checks for. So
forking pyconfig.h once and then customizing it for universal binaries
might work.

Another approach would be to override architecture-specific defines.
For example, a block

#ifdef __APPLE__
#include "pyosx.h"
#endif

could be added to the end of pyconfig.h, and then pyosx.h would have

#undef SIZEOF_LONG

#if defined(__i386__) || defined(__ppc__)
#define SIZEOF_LONG 4
#elif defined(__amd64__) || defined(__ppc64__)
#define SIZEOF_LONG 8
#else
#error unsupported architecture
#endif

Out of curiosity: how do the current universal binaries deal with this
issue?

Regards,
Martin


More information about the Python-Dev mailing list