From: Sascha Schumann Date: Sat, 1 Jan 2000 02:22:01 +0000 (+0000) Subject: Declare timezone only, if the system fails to do so. X-Git-Tag: BEFORE_PRE_SHUTDOWN_REVERSE_PATCH~101 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2fd8cbff2ac301a90fc417bff206bd0a65e8692c;p=php Declare timezone only, if the system fails to do so. --- diff --git a/acconfig.h.in b/acconfig.h.in index 1a85f3acbf..ab1e69378b 100644 --- a/acconfig.h.in +++ b/acconfig.h.in @@ -1,7 +1,5 @@ /* This is the default configuration file to read -*- C -*- */ -#undef socklen_t - /* these are defined by automake */ #undef PACKAGE #undef VERSION diff --git a/acinclude.m4 b/acinclude.m4 index b45ca77deb..0fe1571c49 100644 --- a/acinclude.m4 +++ b/acinclude.m4 @@ -484,3 +484,22 @@ AC_DEFUN(PHP_OUTPUT,[ PHP_OUTPUT_FILES="$PHP_OUTPUT_FILES $1" ]) +AC_DEFUN(PHP_DECLARED_TIMEZONE,[ + AC_CACHE_CHECK(for declared timezone, ac_cv_declared_timezone,[ + AC_TRY_COMPILE([ +#include +#include +#ifdef HAVE_SYS_TIME_H +#include +#endif +],[ + time_t foo = (time_t) timezone; +],[ + ac_cv_declared_timezone=yes +],[ + ac_cv_declared_timezone=no +])]) + if test "$ac_cv_declared_timezone" = "yes"; then + AC_DEFINE(HAVE_DECLARED_TIMEZONE, 1, [Whether system headers declare timezone]) + fi +]) diff --git a/configure.in b/configure.in index 0c8f6ed226..fee52bf8b8 100644 --- a/configure.in +++ b/configure.in @@ -335,6 +335,7 @@ AC_REPLACE_FUNCS(strlcat strlcpy getopt) AC_FUNC_UTIME_NULL AC_FUNC_ALLOCA AC_BROKEN_SPRINTF +PHP_DECLARED_TIMEZONE dnl AIX keeps in_addr_t in /usr/include/netinet/in.h dnl AC_MSG_CHECKING(for in_addr_t) diff --git a/ext/standard/datetime.c b/ext/standard/datetime.c index d2fb2a40a0..650fc82b4d 100644 --- a/ext/standard/datetime.c +++ b/ext/standard/datetime.c @@ -53,7 +53,7 @@ char *day_short_names[] = "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; -#if !defined(HAVE_TM_ZONE) && !defined(_TIMEZONE) && !(WIN32||WINNT) +#if !defined(HAVE_TM_ZONE) && !defined(_TIMEZONE) && !defined(HAVE_DECLARED_TIMEZONE) extern time_t timezone; #endif diff --git a/ext/standard/parsedate.y b/ext/standard/parsedate.y index 393207da09..28aabf5e4f 100644 --- a/ext/standard/parsedate.y +++ b/ext/standard/parsedate.y @@ -46,15 +46,10 @@ #include #endif -#if WIN32||WINNT -# include -#else -# if !defined(HAVE_TM_ZONE) && !defined(_TIMEZONE) +#if !defined(HAVE_TM_ZONE) && !defined(_TIMEZONE) && !defined(HAVE_DECLARED_TIMEZONE) extern time_t timezone; -# endif #endif - #define yylhs date_yylhs #define yylen date_yylen #define yydefred date_yydefred diff --git a/main/win95nt.h b/main/win95nt.h index 0808a84638..b481d70f61 100644 --- a/main/win95nt.h +++ b/main/win95nt.h @@ -1,4 +1,5 @@ /* Defines and types for Windows 95/NT */ +#define HAVE_DECLARED_TIMEZONE #define WIN32_LEAN_AND_MEAN #include #include