cvs: /php4 acinclude.m4 configure.in reentrancy.c
| From: | Sascha Schumann | Date: | Fri, 03 Mar 2000 16:11:08 +0000 |
| Subject: | cvs: /php4 acinclude.m4 configure.in reentrancy.c | ||
| Groups: | php.version4 | ||
| Request: | Send a blank email to php-version4+get-11465@lists.php.net to get a copy of this message | ||
sas Fri Mar 3 08:11:08 2000 EDT
Modified files:
/php4 acinclude.m4 configure.in reentrancy.c
Log:
Support HP-UX 10.x non-standard time-related reentrant functions
Index: php4/acinclude.m4
diff -u php4/acinclude.m4:1.63 php4/acinclude.m4:1.64
--- php4/acinclude.m4:1.63 Tue Feb 29 05:02:29 2000
+++ php4/acinclude.m4 Fri Mar 3 08:10:38 2000
@@ -1,6 +1,35 @@
-dnl $Id: acinclude.m4,v 1.63 2000/02/29 13:02:29 sas Exp $
+dnl $Id: acinclude.m4,v 1.64 2000/03/03 16:10:38 sas Exp $
dnl
dnl This file contains local autoconf functions.
+
+AC_DEFUN(PHP_TIME_R_TYPE,[
+AC_CACHE_CHECK(for time_r type, ac_cv_time_r_type,[
+AC_TRY_RUN([
+#include <time.h>
+
+main() {
+char buf[27];
+struct tm t;
+time_t old = 0;
+int r;
+
+gmtime_r(&old, &t);
+r = (int) asctime_r(&t, buf, 26);
+if (r == -1 || (r > 0 && r <= 26)) exit(0);
+exit(1);
+}
+],[
+ ac_cv_time_r_type=hpux
+],[
+ ac_cv_time_r_type=normal
+],[
+ ac_cv_time_r_type=normal
+])
+])
+if test "$ac_cv_time_r_type" = "hpux"; then
+ AC_DEFINE(PHP_HPUX_TIME_R,1,[Whether you have HP-SUX 10.x])
+fi
+])
AC_DEFUN(PHP_SUBST,[
PHP_VAR_SUBST="$PHP_VAR_SUBST $1"
Index: php4/configure.in
diff -u php4/configure.in:1.96 php4/configure.in:1.97
--- php4/configure.in:1.96 Tue Feb 29 05:02:29 2000
+++ php4/configure.in Fri Mar 3 08:10:38 2000
@@ -1,4 +1,4 @@
-dnl ## $Id: configure.in,v 1.96 2000/02/29 13:02:29 sas Exp $ -*- sh -*-
+dnl ## $Id: configure.in,v 1.97 2000/03/03 16:10:38 sas Exp $ -*- sh -*-
dnl ## Process this file with autoconf to produce a configure script.
divert(1)
@@ -340,6 +340,7 @@
AC_FUNC_ALLOCA
AC_BROKEN_SPRINTF
PHP_DECLARED_TIMEZONE
+PHP_TIME_R_TYPE
dnl AIX keeps in_addr_t in /usr/include/netinet/in.h
dnl AC_MSG_CHECKING(for in_addr_t)
Index: php4/reentrancy.c
diff -u php4/reentrancy.c:1.10 php4/reentrancy.c:1.11
--- php4/reentrancy.c:1.10 Sat Feb 19 15:21:25 2000
+++ php4/reentrancy.c Fri Mar 3 08:10:38 2000
@@ -46,7 +46,42 @@
#endif
+#if defined(PHP_HPUX_TIME_R)
+PHPAPI struct tm *localtime_r(const time_t *const timep, struct tm *p_tm)
+{
+#undef localtime_r
+ if (localtime_r(timep, p_tm) == 0)
+ return (p_tm);
+ return (NULL);
+}
+
+PHPAPI char *ctime_r(const time_t *clock, char *buf)
+{
+#undef ctime_r
+ if (ctime_r(clock, buf, 26) != -1)
+ return (buf);
+ return (NULL);
+}
+
+PHPAPI char *asctime_r(const struct tm *tm, char *buf)
+{
+#undef asctime_r
+ if (asctime_r(tm, buf, 26) != -1)
+ return (buf);
+ return (NULL);
+}
+
+PHPAPI struct tm *gmtime_r(const time_t *const timep, struct tm *p_tm)
+{
+#undef gmtime_r
+ if (gmtime_r(timep, p_tm) == 0)
+ return (p_tm);
+ return (NULL);
+}
+
+#endif
+
#if !defined(HAVE_LOCALTIME_R) && defined(HAVE_LOCALTIME)
PHPAPI struct tm *localtime_r(const time_t *const timep, struct tm *p_tm)