com php-src: Refactor timelib.m4: ext/date/config0.m4 ext/date/lib/timelib.m4
| From: | Peter Kokot | Date: | Wed, 13 Feb 2019 18:24:39 +0000 |
| Subject: | com php-src: Refactor timelib.m4: ext/date/config0.m4 ext/date/lib/timelib.m4 | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-104618@lists.php.net to get a copy of this message | ||
Commit: 0ffa84d7401d61a251029c0813e38a69f84a9486
Author: Peter Kokot <peterkokot@gmail.com> Wed, 26 Sep 2018 19:29:25 +0200
Parents: 56dba3f3d05bbe7eedb31f9c85e1a5b55c99ceec
Branches: PHP-7.2 PHP-7.3 PHP-7.4 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=0ffa84d7401d61a251029c0813e38a69f84a9486
Log:
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 <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.
Changed paths:
M ext/date/config0.m4
D ext/date/lib/timelib.m4
Diff:
diff --git a/ext/date/config0.m4 b/ext/date/config0.m4
index f1a4e51..e464156 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 e112380..0000000
--- 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 <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)