diff options
author | Jeremy Huddleston <jeremyhu@apple.com> | 2012-03-19 02:16:41 -0700 |
---|---|---|
committer | Akira TAGOH <akira@tagoh.org> | 2012-03-21 11:59:01 +0900 |
commit | 8cc4498122b17843b00ec3eebdd7a7d8d59cb7ff (patch) | |
tree | ea3da24703b6ea0847a339058e3a5f175abd5d5d | |
parent | e1ffb3dcd46f1fbbc5cb7527bc7f447b060ed98f (diff) |
fcarch: Check for architecture signature at compile time rather than configure time
https://bugs.freedesktop.org/show_bug.cgi?id=20208
Signed-off-by: Jeremy Huddleston <jeremyhu@apple.com>
-rw-r--r-- | fc-cache/fc-cache.c | 3 | ||||
-rw-r--r-- | src/fcarch.c | 4 | ||||
-rw-r--r-- | src/fcarch.h | 23 |
3 files changed, 24 insertions, 6 deletions
diff --git a/fc-cache/fc-cache.c b/fc-cache/fc-cache.c index d2653507..deb4aa80 100644 --- a/fc-cache/fc-cache.c +++ b/fc-cache/fc-cache.c @@ -22,8 +22,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#include "../src/fcarch.h" - #ifdef HAVE_CONFIG_H #include <config.h> #else @@ -34,6 +32,7 @@ #endif #include <fontconfig/fontconfig.h> +#include "../src/fcarch.h" #include <stdio.h> #include <stdlib.h> #include <unistd.h> diff --git a/src/fcarch.c b/src/fcarch.c index c69397e1..09d24b31 100644 --- a/src/fcarch.c +++ b/src/fcarch.c @@ -31,12 +31,12 @@ #ifndef FC_ARCHITECTURE -#include "fcarch.h" - /* Make sure the cache structure is consistent with what we expect */ #include "fcint.h" +#include "fcarch.h" + FC_ASSERT_STATIC (1 == sizeof (char)); FC_ASSERT_STATIC (2 == sizeof (FcChar16)); FC_ASSERT_STATIC (4 == sizeof (int)); diff --git a/src/fcarch.h b/src/fcarch.h index 9cabf045..22e6f8e1 100644 --- a/src/fcarch.h +++ b/src/fcarch.h @@ -46,9 +46,28 @@ * be64 1234 8 8 */ -#if defined(WORDS_BIGENDIAN) && WORDS_BIGENDIAN +#ifdef __APPLE__ +# include <machine/endian.h> +# undef SIZEOF_VOID_P +# undef ALIGNOF_DOUBLE +# ifdef __LP64__ +# define SIZEOF_VOID_P 8 +# define ALIGNOF_DOUBLE 8 +# else +# define SIZEOF_VOID_P 4 +# define ALIGNOF_DOUBLE 4 +# endif +#endif + +#if defined(__DARWIN_BYTE_ORDER) && __DARWIN_BYTE_ORDER == __DARWIN_LITTLE_ENDIAN +# define FC_ARCH_ENDIAN "le" +#elif defined(__DARWIN_BYTE_ORDER) && __DARWIN_BYTE_ORDER == __DARWIN_BIG_ENDIAN +# define FC_ARCH_ENDIAN "be" +#elif defined(__DARWIN_BYTE_ORDER) && __DARWIN_BYTE_ORDER == __DARWIN_PDP_ENDIAN +# define FC_ARCH_ENDIAN "pe" +#elif defined(WORDS_BIGENDIAN) && WORDS_BIGENDIAN # define FC_ARCH_ENDIAN "be" -#else /* !WORDS_BIGENDIAN */ +#else # define FC_ARCH_ENDIAN "le" #endif |