From 03bb75d30b52d22adc8467154baa68bb97401eb4 Mon Sep 17 00:00:00 2001 From: jorton Date: Thu, 13 Jan 2005 10:48:22 +0000 Subject: * configure.in: Require autoconf 2.50. Use AC_CHECK_MEMBERS to check for struct tm members tm_gmtoff and __tm_gmtoff (the check for __tm_gmtoff seemed to be missing!). * time/unix/time.c: Define NO_GMTOFF_IN_STRUCT_TM if neither member is found. (get_offset, apr_os_exp_time_get, apr_os_exp_time_put): Use new macro names. (apr_unix_setup_time): Use NO_GMTOFF_IN_STRUCT_TM. * time/unix/timestr.c (apr_strftime): Use new macro names. git-svn-id: http://svn.apache.org/repos/asf/apr/apr/trunk@125058 13f79535-47bb-0310-9956-ffa450edef68 --- configure.in | 12 +++++------- time/unix/time.c | 25 +++++++++++++------------ time/unix/timestr.c | 6 +++--- 3 files changed, 21 insertions(+), 22 deletions(-) diff --git a/configure.in b/configure.in index 7b3ab3552..178005ac7 100644 --- a/configure.in +++ b/configure.in @@ -4,6 +4,8 @@ dnl dnl Process this file with autoconf to produce a configure script. dnl Use ./buildconf to prepare build files and run autoconf for APR. +AC_PREREQ(2.50) + AC_INIT(build/apr_common.m4) AC_CONFIG_HEADER(include/arch/unix/apr_private.h) AC_CONFIG_AUX_DIR(build) @@ -1804,14 +1806,10 @@ AC_SUBST(osuuid) dnl ----------------------------- Checking for Time Support echo "${nl}Checking for Time Support..." -AC_CACHE_CHECK([for tm_gmtoff in struct tm], ac_cv_struct_tm_gmtoff, -[AC_TRY_COMPILE([#include -#include ], [struct tm tm; tm.tm_gmtoff;], - ac_cv_struct_tm_gmtoff=yes, ac_cv_struct_tm_gmtoff=no)]) -if test "$ac_cv_struct_tm_gmtoff" = "yes"; then - AC_DEFINE(HAVE_GMTOFF, 1, [Define if struct tm has a tm_gmtoff field]) -fi +AC_CHECK_MEMBERS([struct tm.tm_gmtoff, struct tm.__tm_gmtoff],,,[ +#include +#include ]) dnl ----------------------------- Checking for Networking Support echo "${nl}Checking for Networking support..." diff --git a/time/unix/time.c b/time/unix/time.c index 507d71014..b005cf67b 100644 --- a/time/unix/time.c +++ b/time/unix/time.c @@ -1,4 +1,4 @@ -/* Copyright 2000-2004 The Apache Software Foundation +/* Copyright 2000-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -34,15 +34,16 @@ #endif /* End System Headers */ -#if !defined(HAVE_GMTOFF) && !defined(HAVE___OFFSET) +#if !defined(HAVE_STRUCT_TM_TM_GMTOFF) && !defined(HAVE_STRUCT_TM___TM_GMTOFF) static apr_int32_t server_gmt_offset; -#endif /* if !defined(HAVE_GMTOFF) && !defined(HAVE___OFFSET) */ +#define NO_GMTOFF_IN_STRUCT_TM +#endif static apr_int32_t get_offset(struct tm *tm) { -#ifdef HAVE_GMTOFF +#if defined(HAVE_STRUCT_TM_TM_GMTOFF) return tm->tm_gmtoff; -#elif defined(HAVE___OFFSET) +#elif defined(HAVE_STRUCT_TM___TM_GMTOFF) return tm->__tm_gmtoff; #else #ifdef NETWARE @@ -54,7 +55,7 @@ static apr_int32_t get_offset(struct tm *tm) return server_gmt_offset + daylightOffset; } #else - if(tm->tm_isdst) + if (tm->tm_isdst) return server_gmt_offset + 3600; #endif return server_gmt_offset; @@ -189,9 +190,9 @@ APR_DECLARE(apr_status_t) apr_os_exp_time_get(apr_os_exp_time_t **ostime, (*ostime)->tm_yday = aprtime->tm_yday; (*ostime)->tm_isdst = aprtime->tm_isdst; -#if HAVE_GMTOFF +#if defined(HAVE_STRUCT_TM_TM_GMTOFF) (*ostime)->tm_gmtoff = aprtime->tm_gmtoff; -#elif defined(HAVE__OFFSET) +#elif defined(HAVE_STRUCT_TM___TM_GMTOFF) (*ostime)->__tm_gmtoff = aprtime->tm_gmtoff; #endif @@ -220,9 +221,9 @@ APR_DECLARE(apr_status_t) apr_os_exp_time_put(apr_time_exp_t *aprtime, aprtime->tm_yday = (*ostime)->tm_yday; aprtime->tm_isdst = (*ostime)->tm_isdst; -#if HAVE_GMTOFF +#if defined(HAVE_STRUCT_TM_TM_GMTOFF) aprtime->tm_gmtoff = (*ostime)->tm_gmtoff; -#elif defined(HAVE__OFFSET) +#elif defined(HAVE_STRUCT_TM___TM_GMTOFF) aprtime->tm_gmtoff = (*ostime)->__tm_gmtoff; #endif @@ -276,7 +277,7 @@ APR_DECLARE(void) apr_netware_setup_time(void) #else APR_DECLARE(void) apr_unix_setup_time(void) { -#if !defined(HAVE_GMTOFF) && !defined(HAVE___OFFSET) +#ifdef NO_GMTOFF_IN_STRUCT_TM /* Precompute the offset from GMT on systems where it's not in struct tm. @@ -316,7 +317,7 @@ APR_DECLARE(void) apr_unix_setup_time(void) t.tm_isdst = 0; /* we know this GMT time isn't daylight-savings */ t2 = mktime(&t); server_gmt_offset = (apr_int32_t) difftime(t1, t2); -#endif +#endif /* NO_GMTOFF_IN_STRUCT_TM */ } #endif diff --git a/time/unix/timestr.c b/time/unix/timestr.c index b7a90164e..06015ab66 100644 --- a/time/unix/timestr.c +++ b/time/unix/timestr.c @@ -1,4 +1,4 @@ -/* Copyright 2000-2004 The Apache Software Foundation +/* Copyright 2000-2005 The Apache Software Foundation * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -142,9 +142,9 @@ apr_status_t apr_strftime(char *s, apr_size_t *retsize, apr_size_t max, tm.tm_wday = xt->tm_wday; tm.tm_yday = xt->tm_yday; tm.tm_isdst = xt->tm_isdst; -#if defined(HAVE_GMTOFF) +#if defined(HAVE_STRUCT_TM_TM_GMTOFF) tm.tm_gmtoff = xt->tm_gmtoff; -#elif defined(HAVE___OFFSET) +#elif defined(HAVE_STRUCT_TM___TM_GMTOFF) tm.__tm_gmtoff = xt->tm_gmtoff; #endif (*retsize) = strftime(s, max, format, &tm); -- cgit v1.2.1