From 224f862780cb3ade958542e61f0b9c98b719cdd3 Mon Sep 17 00:00:00 2001 From: meep-eep Date: Thu, 23 Nov 2006 22:41:57 +0000 Subject: [PATCH] Fixes for compilation on MacOS. git-svn-id: svn://svn.code.sf.net/p/sc2/code/trunk@2525 8092fc87-c524-0410-9efc-e669fe64eaf9 --- sc2/src/endian_uqm.h | 17 +++++++++++++++++ sc2/src/sc2code/libs/network/bytesex.h | 2 +- .../sc2code/libs/sound/openal/audiodrv_openal.h | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/sc2/src/endian_uqm.h b/sc2/src/endian_uqm.h index 5f3910e3e..759008bc7 100644 --- a/sc2/src/endian_uqm.h +++ b/sc2/src/endian_uqm.h @@ -25,6 +25,23 @@ #include "config.h" #include "types.h" +#if defined (__APPLE__) && defined (__GNUC__) +// When using the MacOS gcc compiler to build universal binaries, +// each file will be compiled once for each platform. +// This means that checking endianness beforehand from build.sh will not do, +// but fortunately, gcc defines __BIG_ENDIAN__ or __LITTLE_ENDIAN__ on +// this platform. +# if defined(__BIG_ENDIAN__) +# undef WORDS_BIGENDIAN +# define WORDS_BIGENDIAN +# elif defined(__LITTLE_ENDIAN__) +# undef WORDS_BIGENDIAN +# else + // Neither __BIG_ENDIAN__ nor __LITTLE_ENDIAN__ is defined. + // Fallback to using the build.sh defined value. +# endif +#endif /* __APPLE__ */ + #if defined(_MSC_VER) || defined(__BORLANDC__) || \ defined(__DMC__) || defined(__SC__) || \ defined(__WATCOMC__) || defined(__LCC__) diff --git a/sc2/src/sc2code/libs/network/bytesex.h b/sc2/src/sc2code/libs/network/bytesex.h index 34a678260..99b644db7 100644 --- a/sc2/src/sc2code/libs/network/bytesex.h +++ b/sc2/src/sc2code/libs/network/bytesex.h @@ -27,7 +27,7 @@ #include "port.h" // for inline -#include "config.h" +#include "endian_uqm.h" // for WORDS_BIGENDIAN #include "types.h" diff --git a/sc2/src/sc2code/libs/sound/openal/audiodrv_openal.h b/sc2/src/sc2code/libs/sound/openal/audiodrv_openal.h index 01a212659..1635eb276 100644 --- a/sc2/src/sc2code/libs/sound/openal/audiodrv_openal.h +++ b/sc2/src/sc2code/libs/sound/openal/audiodrv_openal.h @@ -23,6 +23,7 @@ #include "config.h" #include "libs/sound/sound.h" #include "options.h" +#include "endian_uqm.h" #if defined (__APPLE__) # include