]> granicus.if.org Git - php/commitdiff
Refactor timelib.m4
authorPeter Kokot <peterkokot@gmail.com>
Wed, 26 Sep 2018 17:29:25 +0000 (19:29 +0200)
committerPeter Kokot <peterkokot@gmail.com>
Wed, 13 Feb 2019 18:24:39 +0000 (19:24 +0100)
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 <io.h> and <strings.h> 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
ext/date/lib/timelib.m4 [deleted file]

index f1a4e5154ea706f7b21c27810f189fc49f885539..e4641565711051a869c19383ba790056ea09228a 100644 (file)
@@ -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 (file)
index e112380..0000000
+++ /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 <sys/types.h>
-#endif
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#elif HAVE_STDINT_H   
-# include <stdint.h>  
-#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)