summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAntony Dovgal <tony2001@php.net>2007-09-04 18:46:08 +0000
committerAntony Dovgal <tony2001@php.net>2007-09-04 18:46:08 +0000
commita2d6d5fbb290459d9033f6048c589d9d177fbf3e (patch)
tree18316363b886b94a2006034bcf17c3b716a93474
parent2b41d574bb6ae350368e9d8cb88baa0eb3e3e959 (diff)
downloadphp-git-a2d6d5fbb290459d9033f6048c589d9d177fbf3e.tar.gz
detect endianness in compile time when using Apple's GCC (fixes universal binary build)
-rw-r--r--Zend/zend_strtod.c10
-rw-r--r--ext/date/lib/parse_tz.c10
-rw-r--r--ext/hash/hash_tiger.c10
3 files changed, 30 insertions, 0 deletions
diff --git a/Zend/zend_strtod.c b/Zend/zend_strtod.c
index 411a4cd1e3..fad9594105 100644
--- a/Zend/zend_strtod.c
+++ b/Zend/zend_strtod.c
@@ -138,6 +138,16 @@ typedef unsigned long int uint32_t;
# endif
#endif
+#if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
+# if defined(__LITTLE_ENDIAN__)
+# undef WORDS_BIGENDIAN
+# else
+# if defined(__BIG_ENDIAN__)
+# define WORDS_BIGENDIAN
+# endif
+# endif
+#endif
+
#ifdef WORDS_BIGENDIAN
#define IEEE_BIG_ENDIAN
#else
diff --git a/ext/date/lib/parse_tz.c b/ext/date/lib/parse_tz.c
index 31e42dec84..39e814db9f 100644
--- a/ext/date/lib/parse_tz.c
+++ b/ext/date/lib/parse_tz.c
@@ -29,6 +29,16 @@
#endif
#include "timezonedb.h"
+#if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
+# if defined(__LITTLE_ENDIAN__)
+# undef WORDS_BIGENDIAN
+# else
+# if defined(__BIG_ENDIAN__)
+# define WORDS_BIGENDIAN
+# endif
+# endif
+#endif
+
#ifdef WORDS_BIGENDIAN
#define timelib_conv_int(l) (l)
#else
diff --git a/ext/hash/hash_tiger.c b/ext/hash/hash_tiger.c
index 6e3e7dc2b7..5309cb7182 100644
--- a/ext/hash/hash_tiger.c
+++ b/ext/hash/hash_tiger.c
@@ -23,6 +23,16 @@
#include "php_hash_tiger.h"
#include "php_hash_tiger_tables.h"
+#if (defined(__APPLE__) || defined(__APPLE_CC__)) && (defined(__BIG_ENDIAN__) || defined(__LITTLE_ENDIAN__))
+# if defined(__LITTLE_ENDIAN__)
+# undef WORDS_BIGENDIAN
+# else
+# if defined(__BIG_ENDIAN__)
+# define WORDS_BIGENDIAN
+# endif
+# endif
+#endif
+
/* {{{ */
#define save_abc \
aa = a; \