[Speex-dev] [patch] Mac Universal Binaries
jpgrayson at gmail.com
Thu May 3 18:01:49 PDT 2007
On 5/3/07, Jean-Marc Valin <jean-marc.valin at usherbrooke.ca> wrote:
> I don't quite see the major difference between doing things at configure
> time or at compile time, bug anyway...
Sorry, I was not clear. The thing that is unique about the Mac build
process is that it shares the same configuration for both x86 and ppc
builds. It also uses a single compiler invocation for both where
__BIG_ENDIAN__ is defined ppc and __LITTLE_ENDIAN__ for x86.
> My suspicion is that I don't want to break things because MacOS X has
> strange requirements.
I suspect your suspicion to be quite valid. Agreed.
> > 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.
> Actually, all we need is to do is have that once in the main include:
> #if defined(WORDS_BIGENDIAN) || defined(__BIG_ENDIAN__)
> #define SPEEX_BIGENDIAN
> and then we just use SPEEX_BIGENDIAN everywhere else.
This technique would work for in all cases except when building the
universal binary on a ppc machine. In that case, both WORDS_BIGENDIAN
and __LITTLE_ENDIAN__ will be defined at compile time (for the x86
part of the build). Maybe if we amended the expression to this:
#if !defined(__LITTLE_ENDIAN__) && ( defined(WORDS_BIGENDIAN) ||
I think that would cover all the bases.
I have attached a patch that makes this change. There is a little code
duplication because wavio.h and misc.h both need this trick, but they
don't appear to share any headers besides speex_types.h. I wasn't sure
if speex_types.h was a good place for this or not.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 1290 bytes
Desc: not available
Url : http://lists.xiph.org/pipermail/speex-dev/attachments/20070503/bfde8f58/speex-ppc-endianness2.bin
More information about the Speex-dev