cvs: php4 / acinclude.m4 /main php_reentrancy.h reentrancy.c

From: Date: Sun, 20 May 2001 21:29:55 +0000
Subject: cvs: php4 / acinclude.m4 /main php_reentrancy.h reentrancy.c
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-5872@lists.php.net to get a copy of this message
sas Sun May 20 14:29:55 2001 EDT Modified files: /php4 acinclude.m4 /php4/main reentrancy.c php_reentrancy.h Log: Support for IRIX-style asctime_r/ctime_r. Index: php4/acinclude.m4 diff -u php4/acinclude.m4:1.128 php4/acinclude.m4:1.129 --- php4/acinclude.m4:1.128 Sun May 20 14:07:23 2001 +++ php4/acinclude.m4 Sun May 20 14:29:55 2001 @@ -1,4 +1,4 @@ -dnl $Id: acinclude.m4,v 1.128 2001/05/20 21:07:23 sas Exp $ +dnl $Id: acinclude.m4,v 1.129 2001/05/20 21:29:55 sas Exp $ dnl dnl This file contains local autoconf functions. @@ -323,7 +323,6 @@ AC_CACHE_CHECK(for type of reentrant time-related functions, ac_cv_time_r_type,[ AC_TRY_RUN([ #include <time.h> -#include <stdlib.h> main() { char buf[27]; @@ -333,19 +332,37 @@ s = gmtime_r(&old, &t); r = (int) asctime_r(&t, buf, 26); -if (r == s && s == 0) exit(0); -exit(1); +if (r == s && s == 0) return (0); +return (1); } ],[ ac_cv_time_r_type=hpux ],[ - ac_cv_time_r_type=POSIX + AC_TRY_RUN([ +#include <time.h> +main() { + struct tm t, *s; + time_t old = 0; + char buf[27], *p; + + s = gmtime_r(&old, &t); + p = asctime_r(&t, buf, 26); + if (p == buf && s == t) return (0); + return (1); +} + ],[ + ac_cv_time_r_type=irix + ],[ + ac_cv_time_r_type=POSIX + ]) ],[ ac_cv_time_r_type=POSIX ]) ]) -if test "$ac_cv_time_r_type" = "hpux"; then - AC_DEFINE(PHP_HPUX_TIME_R,1,[Whether you have HP-UX 10.x]) + case $ac_cv_time_r_type in + hpux) AC_DEFINE(PHP_HPUX_TIME_R,1,[Whether you have HP-UX 10.x]) ;; + irix) AC_DEFINE(PHP_IRIX_TIME_R,1,[Whether you have IRIX-style functions]) ;; + esac fi ]) Index: php4/main/reentrancy.c diff -u php4/main/reentrancy.c:1.27 php4/main/reentrancy.c:1.28 --- php4/main/reentrancy.c:1.27 Fri Apr 27 04:14:48 2001 +++ php4/main/reentrancy.c Sun May 20 14:29:55 2001 @@ -56,6 +56,27 @@ #endif +#if defined(PHP_IRIX_TIME_R) + +#define HAVE_CTIME_R 1 +#define HAVE_ASCTIME_R 1 + +PHPAPI char *php_ctime_r(const time_t *clock, char *buf) +{ + if (ctime_r(clock, buf, 26) == buf) + return (buf); + return (NULL); +} + +PHPAPI char *php_asctime_r(const struct tm *tm, char *buf) +{ + if (asctime_r(tm, buf, 26) == buf) + return (buf); + return (NULL); +} + +#endif + #if defined(PHP_HPUX_TIME_R) #define HAVE_LOCALTIME_R 1 Index: php4/main/php_reentrancy.h diff -u php4/main/php_reentrancy.h:1.13 php4/main/php_reentrancy.h:1.14 --- php4/main/php_reentrancy.h:1.13 Sun Feb 25 22:07:31 2001 +++ php4/main/php_reentrancy.h Sun May 20 14:29:55 2001 @@ -36,8 +36,12 @@ #define HAVE_ASCTIME 1 #define HAVE_CTIME 1 +#if defined(PHP_IRIX_TIME_R) +#undef HAVE_ASCTIME_R +#undef HAVE_CTIME_R +#endif -#ifdef PHP_HPUX_TIME_R +#if defined(PHP_HPUX_TIME_R) #undef HAVE_LOCALTIME_R #undef HAVE_ASCTIME_R #undef HAVE_CTIME_R

« previous php.cvs (#5872) next »