From: foobar Date: Mon, 20 Dec 2004 20:38:05 +0000 (+0000) Subject: MFH: endian compile problem fix X-Git-Tag: php-5.0.4RC1~451 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a0644877661ccaea669e5d11c7a4cdd14d3c301d;p=php MFH: endian compile problem fix --- diff --git a/Zend/zend_strtod.c b/Zend/zend_strtod.c index d0b197335d..bba9ac7edb 100644 --- a/Zend/zend_strtod.c +++ b/Zend/zend_strtod.c @@ -91,22 +91,15 @@ #include -#if defined(LIBC_SCCS) && !defined(lint) -static char *rcsid = "$OpenBSD: strtod.c,v 1.19 2004/02/03 16:52:11 drahn Exp $"; -#endif /* LIBC_SCCS and not lint */ - -#if defined(__m68k__) || defined(__sparc__) || defined(__i386__) || \ - defined(__mips__) || defined(__mips) || defined(__ns32k__) || defined(__alpha__) || defined(__alpha) || \ - defined(__powerpc__) || defined(__ppc__) || defined(__m88k__) || defined(__hpux) || \ - defined(__hppa__) || defined(__x86_64__) || (defined(__arm__) && \ - defined(__VFP_FP__)) +#ifdef HAVE_SYS_TYPES_H #include -#if BYTE_ORDER == BIG_ENDIAN +#endif + +#ifdef WORDS_BIGENDIAN #define IEEE_BIG_ENDIAN #else #define IEEE_LITTLE_ENDIAN #endif -#endif #if defined(__arm__) && !defined(__VFP_FP__) /* diff --git a/acinclude.m4 b/acinclude.m4 index e9737e9d80..3d007b3081 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1932,3 +1932,32 @@ AC_DEFUN(PHP_TEST_BUILD, [ LIBS=$old_LIBS ]) ]) + +dnl +dnl PHP_C_BIGENDIAN +dnl Replacement macro for AC_C_BIGENDIAN +dnl +AC_DEFUN([PHP_C_BIGENDIAN], +[AC_CACHE_CHECK(whether byte ordering is bigendian, ac_cv_c_bigendian_php, + [ + ac_cv_c_bigendian_php=unknown + AC_TRY_RUN( + [ +int main(void) +{ + short one = 1; + char *cp = (char *)&one; + + if (*cp == 0) { + return(0); + } else { + return(1); + } +} + ], [ac_cv_c_bigendian_php=yes], [ac_cv_c_bigendian_php=no], [ac_cv_c_bigendian_php=unknown]) + if test $ac_cv_c_bigendian_php = yes; then + AC_DEFINE(WORDS_BIGENDIAN) + fi + ]) +]) + diff --git a/configure.in b/configure.in index 49e9be67a9..7dd063ec29 100644 --- a/configure.in +++ b/configure.in @@ -170,6 +170,10 @@ else AC_MSG_WARN(You will need flex 2.5.4 or later if you want to regenerate Zend/PHP lexical parsers.) fi +dnl Check whether byte ordering is bigendian +PHP_C_BIGENDIAN + + dnl Platform-specific compile settings. dnl -------------------------------------------------------------------------