diff configure.in @ 8572:9ec2882243a6 HEAD

Try to use (Apple) gcc's __BIG_ENDIAN__ and __LITTLE_ENDIAN__ macros if possible. Based on a patch by Apple.
author Timo Sirainen <tss@iki.fi>
date Fri, 19 Dec 2008 08:50:14 +0200
parents 5d80abcfb2ff
children 729576bb91d8
line wrap: on
line diff
--- a/configure.in	Fri Dec 19 07:49:08 2008 +0200
+++ b/configure.in	Fri Dec 19 08:50:14 2008 +0200
@@ -2124,20 +2124,24 @@
 AC_SUBST(dict_drivers)
 
 dnl **
-dnl ** Index file compatibility flags
+dnl ** Endianess
 dnl **
 
-dnl * currently just checking for endianess
-
-AC_C_BIGENDIAN
-
-if test $ac_cv_c_bigendian = yes; then
-	flags=0
-else
-	flags=1
-fi
-
-AC_DEFINE_UNQUOTED(MAIL_INDEX_COMPAT_FLAGS, $flags, Index file compatibility flags)
+dnl At least Apple's gcc supports __BIG_ENDIAN__ and __LITTLE_ENDIAN__
+dnl defines. Use them if possible to allow cross-compiling.
+AC_MSG_CHECKING([if __BIG_ENDIAN__ or __LITTLE_ENDIAN__ is defined])
+AC_TRY_COMPILE([
+  #if !(__BIG_ENDIAN__ || __LITTLE_ENDIAN__)
+  #error nope
+  #endif
+], [
+], [
+  AC_DEFINE(WORDS_BIGENDIAN, __BIG_ENDIAN__, Define if your CPU is big endian)
+  AC_MSG_RESULT(yes)
+], [
+  AC_MSG_RESULT(no)
+  AC_C_BIGENDIAN
+])
 
 dnl **
 dnl ** IPv6 support