[Speex-dev] [patch] Mac Universal Binaries

Erik de Castro Lopo
2007-05-03T18:03:40Z

> 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.

Personally I think universal binaries are a bad idea.

For one of my projects, libsndfile, endian issues is not the only
think that breaks in univesal binaries. The problem is that I
detect cpu features other than just endian-ness at configure time;
things that cannot be detected purely from compiler flags.

See:
   http://www.mega-nerd.com/libsndfile/FAQ.html#Q018

However, my biggest objection to universal binaries for libsndfile
is that libsndfile has a huge and comprehensive test suite and
running the test suite during a universal build will only test
the native build, not the cross-compiled build. As far as I am
concerned, cross-compiled code that isn't tested is worse than
native code that isn't tested and I consider native code that
isn't tested to be broken code.

> My strong suspicion is that testing __BIG_ENDIAN__ at compile-time
> will work for all relevant unix-like platforms. Even icc supports
> this.

Yep, gcc and icc support it. How many others do? Is suspect
its very close to zero.

Erik
--
-----------------------------------------------------------------
Erik de Castro Lopo
-----------------------------------------------------------------
"UNIX was not designed to stop you from doing stupid things,  because
that would also stop you from doing clever things."  -- Doug Gwyn