summaryrefslogtreecommitdiff
path: root/m4/tzset.m4
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2020-07-26 13:17:18 +0200
committerBruno Haible <bruno@clisp.org>2020-07-26 13:39:46 +0200
commit994d7b1849b9157c154d8981ec8bdc0eb0f40acc (patch)
tree5773b2fedd9462dbef1648d1f8cedd44db1ef9f1 /m4/tzset.m4
parentc7002725ef142a57787a13ed11dc701e4a0ee77b (diff)
downloadgnulib-994d7b1849b9157c154d8981ec8bdc0eb0f40acc.tar.gz
tzset: Remove workaround for Solaris 2.6.
* m4/tzset.m4 (gl_FUNC_TZSET_CLOBBER): Remove macro. (gl_FUNC_TZSET): Don't invoke it. Don't define TZSET_CLOBBERS_LOCALTIME. Don't require gl_LOCALTIME_BUFFER_DEFAULTS. * lib/localtime-buffer.h: Don't test TZSET_CLOBBERS_LOCALTIME. * lib/localtime-buffer.c: Likewise. * lib/localtime.c: Likewise. * lib/tzset.c: Don't include localtime-buffer.h. (tzset): Don't test TZSET_CLOBBERS_LOCALTIME. * lib/nstrftime.c (__strftime_internal): Assume HAVE_RUN_TZSET_TEST is 1. * modules/tzset (Depends-on): Remove localtime-buffer.
Diffstat (limited to 'm4/tzset.m4')
-rw-r--r--m4/tzset.m465
1 files changed, 1 insertions, 64 deletions
diff --git a/m4/tzset.m4 b/m4/tzset.m4
index 7d987d8860..31ef601a04 100644
--- a/m4/tzset.m4
+++ b/m4/tzset.m4
@@ -1,85 +1,22 @@
-# serial 13
+# serial 14
# Copyright (C) 2003, 2007, 2009-2020 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# See if we have a working tzset function.
-# If so, arrange to compile the wrapper function.
-# For at least Solaris 2.5.1 and 2.6, this is necessary
-# because tzset can clobber the contents of the buffer
-# used by localtime.
-
# Written by Paul Eggert and Jim Meyering.
AC_DEFUN([gl_FUNC_TZSET],
[
AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
- AC_REQUIRE([gl_LOCALTIME_BUFFER_DEFAULTS])
AC_REQUIRE([AC_CANONICAL_HOST])
AC_CHECK_FUNCS_ONCE([tzset])
if test $ac_cv_func_tzset = no; then
HAVE_TZSET=0
fi
- gl_FUNC_TZSET_CLOBBER
REPLACE_TZSET=0
- case "$gl_cv_func_tzset_clobber" in
- *yes)
- REPLACE_TZSET=1
- AC_DEFINE([TZSET_CLOBBERS_LOCALTIME], [1],
- [Define if tzset clobbers localtime's static buffer.])
- gl_LOCALTIME_BUFFER_NEEDED
- ;;
- esac
case "$host_os" in
mingw*) REPLACE_TZSET=1 ;;
esac
])
-
-# Set gl_cv_func_tzset_clobber.
-AC_DEFUN([gl_FUNC_TZSET_CLOBBER],
-[
- AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
- AC_CACHE_CHECK([whether tzset clobbers localtime buffer],
- [gl_cv_func_tzset_clobber],
- [AC_RUN_IFELSE([AC_LANG_SOURCE([[
-#include <time.h>
-#include <stdlib.h>
-
-int
-main ()
-{
- time_t t1 = 853958121;
- struct tm *p, s;
- putenv ("TZ=GMT0");
- p = localtime (&t1);
- s = *p;
- putenv ("TZ=EST+3EDT+2,M10.1.0/00:00:00,M2.3.0/00:00:00");
- tzset ();
- return (p->tm_year != s.tm_year
- || p->tm_mon != s.tm_mon
- || p->tm_mday != s.tm_mday
- || p->tm_hour != s.tm_hour
- || p->tm_min != s.tm_min
- || p->tm_sec != s.tm_sec);
-}
- ]])],
- [gl_cv_func_tzset_clobber=no],
- [gl_cv_func_tzset_clobber=yes],
- [case "$host_os" in
- # Guess all is fine on glibc systems.
- *-gnu* | gnu*) gl_cv_func_tzset_clobber="guessing no" ;;
- # Guess all is fine on musl systems.
- *-musl*) gl_cv_func_tzset_clobber="guessing no" ;;
- # Guess no on native Windows.
- mingw*) gl_cv_func_tzset_clobber="guessing no" ;;
- # If we don't know, obey --enable-cross-guesses.
- *) gl_cv_func_tzset_clobber="$gl_cross_guess_inverted" ;;
- esac
- ])
- ])
-
- AC_DEFINE([HAVE_RUN_TZSET_TEST], [1],
- [Define to 1 if you have run the test for working tzset.])
-])