From 0ffa84d7401d61a251029c0813e38a69f84a9486 Mon Sep 17 00:00:00 2001 From: Peter Kokot Date: Wed, 26 Sep 2018 19:29:25 +0200 Subject: [PATCH] Refactor timelib.m4 The ext/date/lib is bundled library and also includes additional timelib.m4 macros and checks specific for PHP. All the checks in the timelib.m4 are already done in the PHP's configure.ac: - headers except for io.h and strings.h - two functions checked strftime and gettimeofday - if size of longint is 8 - if size of int is 4 - int32_t and uint32_t types using the PHP_CHECK_STDINT_TYPES Macro `AC_TIMELIB_C_BIGENDIAN` defined in timelib.m4 is not used. The two checkings for strtoll and atoll have been moved to date extension's config0.m4 file. Additional check for headers and has been added to config0.m4 of the date extension. Therefore the timelib.m4 can be simplified and removed from the bundled library to have easier maintenance in the later branches and also upstream library. --- ext/date/config0.m4 | 10 ++++- ext/date/lib/timelib.m4 | 83 ----------------------------------------- 2 files changed, 8 insertions(+), 85 deletions(-) delete mode 100644 ext/date/lib/timelib.m4 diff --git a/ext/date/config0.m4 b/ext/date/config0.m4 index f1a4e5154e..e464156571 100644 --- a/ext/date/config0.m4 +++ b/ext/date/config0.m4 @@ -1,8 +1,14 @@ dnl $Id$ dnl config.m4 for date extension -sinclude(ext/date/lib/timelib.m4) -sinclude(lib/timelib.m4) +dnl Check for headers needed by timelib +AC_CHECK_HEADERS([ \ +strings.h \ +io.h +]) + +dnl Check for strtoll, atoll +AC_CHECK_FUNCS(strtoll atoll) PHP_DATE_CFLAGS="-I@ext_builddir@/lib -DZEND_ENABLE_STATIC_TSRMLS_CACHE=1 -DHAVE_TIMELIB_CONFIG_H=1" timelib_sources="lib/astro.c lib/dow.c lib/parse_date.c lib/parse_tz.c diff --git a/ext/date/lib/timelib.m4 b/ext/date/lib/timelib.m4 deleted file mode 100644 index e112380da0..0000000000 --- a/ext/date/lib/timelib.m4 +++ /dev/null @@ -1,83 +0,0 @@ -dnl -dnl $Id$ -dnl -dnl -dnl TL_DEF_HAVE(what [, why]) -dnl -dnl Generates 'AC_DEFINE(HAVE_WHAT, 1, [WHY])' -dnl -AC_DEFUN([TL_DEF_HAVE],[AC_DEFINE([HAVE_]translit($1,a-z_.-,A-Z___),1,[ $2 ])])dnl - -dnl -dnl TL_CHECK_INT_TYPE(type) -dnl -AC_DEFUN([TL_CHECK_INT_TYPE],[ -AC_CACHE_CHECK([for $1], ac_cv_int_type_$1, [ -AC_TRY_COMPILE([ -#if HAVE_SYS_TYPES_H -# include -#endif -#if HAVE_INTTYPES_H -# include -#elif HAVE_STDINT_H -# include -#endif], -[if (($1 *) 0) - return 0; -if (sizeof ($1)) - return 0; -], [ac_cv_int_type_$1=yes], [ac_cv_int_type_$1=no]) -]) -if test "$ac_cv_int_type_$1" = "yes"; then - TL_DEF_HAVE($1, [Define if $1 type is present.]) -fi -])dnl - -dnl -dnl AC_TIMELIB_C_BIGENDIAN -dnl Replacement macro for AC_C_BIGENDIAN -dnl -AC_DEFUN([AC_TIMELIB_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, [], [Define if processor uses big-endian word]) - fi -])dnl - -dnl Check for types, sizes, etc. needed by timelib -AC_CHECK_SIZEOF(long, 8) -AC_CHECK_SIZEOF(int, 4) -TL_CHECK_INT_TYPE(int32_t) -TL_CHECK_INT_TYPE(uint32_t) - -dnl Check for headers needed by timelib -AC_CHECK_HEADERS([ \ -sys/time.h \ -sys/types.h \ -stdint.h \ -dirent.h \ -string.h \ -strings.h \ -unistd.h \ -io.h -]) - -dnl Check for strtoll, atoll -AC_CHECK_FUNCS(strtoll atoll strftime gettimeofday) -- 2.40.0