[Speex-dev] [patch] Mac Universal Binaries
Peter Grayson
jpgrayson at gmail.com
Thu May 3 08:15:15 PDT 2007
On 5/2/07, Jean-Marc Valin <jean-marc.valin at usherbrooke.ca> wrote:
> Well, I don't quite understand why AC_C_BIGENDIAN and the solution
> you're proposing is likely to break other big endian machines (the ones
> that don't have __BIG_ENDIAN__). Can you send a patch that addresses
> that (i.e. still uses AC_C_BIGENDIAN when it works)?
It is not that AC_C_BIGENDIAN does not work. It is that it determines
endianness at configure-time as opposed to compile-time. The process
for building universal binaries on Mac demands that the distinction be
made at compile-time. To enable building universal binaries on Mac in
a single pass, the decision has to be deferred to compile-time.
My strong suspicion is that testing __BIG_ENDIAN__ at compile-time
will work for all relevant unix-like platforms. Even icc supports
this.
The extra thing we could do is set a preprocessor variable at
configure-time that we could use at compile-time to determine whether
the endianess was resolved at configure-time or should be resolved at
compile-time. For example:
#if defined(COMPILE_TIME_ENDIANESS) && defined(__BIG_ENDIAN__) ||
!defined(COMPILE_TIME_ENDIANESS) && defined(WORDS_BIGENDIAN)
/* do big endian thing */
#else
/* do little endian thing */
#endif
This seems excessively complicated, so I preferred not to do it.
Can others comment on the availability of the compiler defined
__BIG_ENDIAN__ and __LITTLE_ENDIAN__ variables?
Pete
More information about the Speex-dev
mailing list