From: foobar Date: Wed, 27 Jun 2007 14:40:02 +0000 (+0000) Subject: - Added PHP_CHECK_SIZEOF macro (special version of AC_CHECK_SIZEOF) X-Git-Tag: BEFORE_IMPORT_OF_MYSQLND~369 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=28fc4c26fcc7d0ddc90a8c0afedffe92c73895f7;p=php - Added PHP_CHECK_SIZEOF macro (special version of AC_CHECK_SIZEOF) # Now types like ptrdiff_t, ssize_t and intmax_t get defined to something # useful.. --- diff --git a/acinclude.m4 b/acinclude.m4 index 011ffc5a0e..a75b982a7b 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -1034,6 +1034,44 @@ dnl ------------------------------------------------------------------------- dnl Checks for structures, typedefs, broken functions, etc. dnl ------------------------------------------------------------------------- +dnl +dnl PHP_CHECK_SIZEOF(TYPE [, CROSS-SIZE]) +dnl Enhanced version of AC_CHECK_SIZEOF for checking more types +dnl than just those defined in stdio.h +dnl +AC_DEFUN(PHP_CHECK_SIZEOF, +[changequote(<<, >>)dnl +dnl The name to #define. +define(<>, translit(sizeof_$1, [a-z *], [A-Z_P]))dnl +dnl The cache variable name. +define(<>, translit(ac_cv_sizeof_$1, [ *], [_p]))dnl +changequote([, ])dnl +AC_MSG_CHECKING(size of $1) +AC_CACHE_VAL(AC_CV_NAME, +[AC_TRY_RUN([#include +#if STDC_HEADERS +#include +#include +#endif +#ifdef HAVE_INTTYPES_H +#include +#endif +#ifdef HAVE_UNISTD_H +#include +#endif +int main() +{ + FILE *f=fopen("conftestval", "w"); + if (!f) return(1); + fprintf(f, "%d\n", sizeof($1)); + return(0); + }], AC_CV_NAME=`cat conftestval`, AC_CV_NAME=0, ifelse([$2], , , AC_CV_NAME=$2))])dnl +AC_MSG_RESULT($AC_CV_NAME) +AC_DEFINE_UNQUOTED(AC_TYPE_NAME, $AC_CV_NAME, [The number of bytes in a $1.]) +undefine([AC_TYPE_NAME])dnl +undefine([AC_CV_NAME])dnl +]) + dnl dnl PHP_CHECK_IN_ADDR_T dnl @@ -2713,6 +2751,9 @@ php_cv_crypt_r_style=struct_crypt_data_gnu_source) fi ]) +dnl +dnl PHP_TEST_WRITE_STDOUT +dnl AC_DEFUN([PHP_TEST_WRITE_STDOUT],[ AC_CACHE_CHECK(whether writing to stdout works,ac_cv_write_stdout,[ AC_TRY_RUN([ diff --git a/configure.in b/configure.in index 9ac2c43bc2..49803324bf 100644 --- a/configure.in +++ b/configure.in @@ -422,15 +422,17 @@ PHP_TM_GMTOFF PHP_STRUCT_FLOCK PHP_SOCKLEN_T -AC_CHECK_SIZEOF(intmax_t, 0) AC_CHECK_SIZEOF(size_t, 8) -AC_CHECK_SIZEOF(ssize_t, 8) -AC_CHECK_SIZEOF(ptrdiff_t, 8) AC_CHECK_SIZEOF(long long, 8) AC_CHECK_SIZEOF(long long int, 8) AC_CHECK_SIZEOF(long, 8) AC_CHECK_SIZEOF(int, 4) +dnl These are defined elsewhere than stdio.h +PHP_CHECK_SIZEOF(intmax_t, 0) +PHP_CHECK_SIZEOF(ssize_t, 8) +PHP_CHECK_SIZEOF(ptrdiff_t, 8) + dnl Check for members of the stat structure AC_STRUCT_ST_BLKSIZE dnl AC_STRUCT_ST_BLOCKS will screw QNX because fileblocks.o does not exists