From: foobar Date: Sat, 22 Jan 2005 20:29:39 +0000 (+0000) Subject: MFH: Compile fix for systems without uint32_t typedef X-Git-Tag: php-5.0.4RC1~273 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=b1aaab7355d09c4607fe4dd4d4858b2192ceb0a0;p=php MFH: Compile fix for systems without uint32_t typedef --- diff --git a/Zend/Zend.m4 b/Zend/Zend.m4 index 83c764a058..a97debbd65 100644 --- a/Zend/Zend.m4 +++ b/Zend/Zend.m4 @@ -42,6 +42,8 @@ if test "$ac_cv_prog_gcc" = "yes" -a "`uname -s`" = "Rhapsody"; then fi AC_CHECK_HEADERS( +inttypes.h \ +stdint.h \ limits.h \ malloc.h \ string.h \ @@ -82,6 +84,27 @@ dnl This is required for QNX and may be some BSD derived systems AC_CHECK_TYPE( uint, unsigned int ) AC_CHECK_TYPE( ulong, unsigned long ) +dnl Check if uint32_t is defined +AC_MSG_CHECKING(for uint32_t) +AC_TRY_COMPILE([ +#if HAVE_SYS_TYPES_H +#include +#endif +#if HAVE_INTTYPES_H +#include +#elif HAVE_STDINT_H +#include +#endif], +[if ((uint32_t *) 0) + return 0; +if (sizeof (uint32_t)) + return 0; +],[ + AC_DEFINE(HAVE_UINT32_T,1,[Define if uint32_t type is present. ]) + AC_MSG_RESULT(yes) +], AC_MSG_RESULT(no) +)dnl + dnl Checks for library functions. AC_FUNC_VPRINTF AC_FUNC_MEMCMP diff --git a/Zend/configure.in b/Zend/configure.in index 67d3598663..9cbd1e11ce 100644 --- a/Zend/configure.in +++ b/Zend/configure.in @@ -15,6 +15,9 @@ AC_ZEND_C_BIGENDIAN dnl We want this one before the checks, so the checks can modify CFLAGS. test -z "$CFLAGS" && auto_cflags=1 +AC_CHECK_SIZEOF(long, 8) +AC_CHECK_SIZEOF(int, 4) + sinclude(Zend.m4) LIBZEND_BASIC_CHECKS diff --git a/Zend/zend_strtod.c b/Zend/zend_strtod.c index 1d502c3c94..4891c33666 100644 --- a/Zend/zend_strtod.c +++ b/Zend/zend_strtod.c @@ -91,14 +91,22 @@ #include +#ifdef HAVE_SYS_TYPES_H +#include +#endif + #if defined(HAVE_INTTYPES_H) #include #elif defined(HAVE_STDINT_H) #include #endif -#ifdef HAVE_SYS_TYPES_H -#include +#ifndef HAVE_UINT32_T +# if SIZEOF_INT == 4 +typedef unsigned int uint32_t; +# elif SIZEOF_LONG == 4 +typedef unsigned long int uint32_t; +# endif #endif #ifdef WORDS_BIGENDIAN