summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog9
-rw-r--r--lib/time.in.h3
-rw-r--r--lib/tzset.c12
-rw-r--r--m4/time_h.m41
-rw-r--r--m4/tzset.m46
-rw-r--r--modules/time1
-rw-r--r--modules/tzset2
7 files changed, 13 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 803c67d428..85e12587f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
2020-08-14 Bruno Haible <bruno@clisp.org>
+ tzset: Assume the function exists.
+ * lib/time.in.h (tzset): Assume HAVE_TZSET is 1.
+ * lib/tzset.c: Define rpl_tzset, not tzset. Assume HAVE_TZSET is 1.
+ * modules/tzset (configure.ac): Don't test HAVE_TZSET.
+ * m4/tzset.m4 (gl_FUNC_TZSET): Don't test for tzset. Don't set
+ HAVE_TZSET.
+ * m4/time_h.m4 (gl_HEADER_TIME_H_DEFAULTS): Don't initialize HAVE_TZSET.
+ * modules/time (Makefile.am): Don't substitute HAVE_TZSET.
+
nstrftime: Assume tzset exists.
* lib/nstrftime.c (HAVE_TZSET): Remove macro.
(__strftime_internal): Test my_strftime, not HAVE_TZSET.
diff --git a/lib/time.in.h b/lib/time.in.h
index e10e90c96b..7ad7d002a9 100644
--- a/lib/time.in.h
+++ b/lib/time.in.h
@@ -136,9 +136,6 @@ _GL_CXXALIASWARN (nanosleep);
_GL_FUNCDECL_RPL (tzset, void, (void));
_GL_CXXALIAS_RPL (tzset, void, (void));
# else
-# if ! @HAVE_TZSET@
-_GL_FUNCDECL_SYS (tzset, void, (void));
-# endif
_GL_CXXALIAS_SYS (tzset, void, (void));
# endif
_GL_CXXALIASWARN (tzset);
diff --git a/lib/tzset.c b/lib/tzset.c
index cd209e1949..681f0737a0 100644
--- a/lib/tzset.c
+++ b/lib/tzset.c
@@ -25,14 +25,8 @@
#include <stdlib.h>
#include <string.h>
-/* This is a wrapper for tzset, for systems on which tzset may clobber
- the static buffer used for localtime's result.
- Work around the bug in some systems whereby tzset clobbers the
- static buffer that localtime uses for its return value. The
- tzset function from Solaris 2.5, 2.5.1, and 2.6 has this problem. */
-
void
-tzset (void)
+rpl_tzset (void)
#undef tzset
{
#if defined _WIN32 && ! defined __CYGWIN__
@@ -66,9 +60,7 @@ tzset (void)
<https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/posix-tzset>
<https://docs.microsoft.com/en-us/cpp/c-runtime-library/reference/tzset> */
_tzset ();
-#elif HAVE_TZSET
- tzset ();
#else
- /* Do nothing. Avoid infinite recursion. */
+ tzset ();
#endif
}
diff --git a/m4/time_h.m4 b/m4/time_h.m4
index d0f89327c4..a15c09dc07 100644
--- a/m4/time_h.m4
+++ b/m4/time_h.m4
@@ -121,7 +121,6 @@ AC_DEFUN([gl_HEADER_TIME_H_DEFAULTS],
HAVE_NANOSLEEP=1; AC_SUBST([HAVE_NANOSLEEP])
HAVE_STRPTIME=1; AC_SUBST([HAVE_STRPTIME])
HAVE_TIMEGM=1; AC_SUBST([HAVE_TIMEGM])
- HAVE_TZSET=1; AC_SUBST([HAVE_TZSET])
dnl Even GNU libc does not have timezone_t yet.
HAVE_TIMEZONE_T=0; AC_SUBST([HAVE_TIMEZONE_T])
dnl If another module says to replace or to not replace, do that.
diff --git a/m4/tzset.m4 b/m4/tzset.m4
index 31ef601a04..a504d5e312 100644
--- a/m4/tzset.m4
+++ b/m4/tzset.m4
@@ -1,4 +1,4 @@
-# serial 14
+# serial 15
# Copyright (C) 2003, 2007, 2009-2020 Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
@@ -11,10 +11,6 @@ AC_DEFUN([gl_FUNC_TZSET],
[
AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
AC_REQUIRE([AC_CANONICAL_HOST])
- AC_CHECK_FUNCS_ONCE([tzset])
- if test $ac_cv_func_tzset = no; then
- HAVE_TZSET=0
- fi
REPLACE_TZSET=0
case "$host_os" in
mingw*) REPLACE_TZSET=1 ;;
diff --git a/modules/time b/modules/time
index c235ac8dd0..3daa751128 100644
--- a/modules/time
+++ b/modules/time
@@ -44,7 +44,6 @@ time.h: time.in.h $(top_builddir)/config.status $(CXXDEFS_H) $(ARG_NONNULL_H) $(
-e 's|@''HAVE_STRPTIME''@|$(HAVE_STRPTIME)|g' \
-e 's|@''HAVE_TIMEGM''@|$(HAVE_TIMEGM)|g' \
-e 's|@''HAVE_TIMEZONE_T''@|$(HAVE_TIMEZONE_T)|g' \
- -e 's|@''HAVE_TZSET''@|$(HAVE_TZSET)|g' \
-e 's|@''REPLACE_CTIME''@|$(REPLACE_CTIME)|g' \
-e 's|@''REPLACE_GMTIME''@|$(REPLACE_GMTIME)|g' \
-e 's|@''REPLACE_LOCALTIME''@|$(REPLACE_LOCALTIME)|g' \
diff --git a/modules/tzset b/modules/tzset
index ff7e60b22f..5423f3afe6 100644
--- a/modules/tzset
+++ b/modules/tzset
@@ -10,7 +10,7 @@ time
configure.ac:
gl_FUNC_TZSET
-if test $HAVE_TZSET = 0 || test $REPLACE_TZSET = 1; then
+if test $REPLACE_TZSET = 1; then
AC_LIBOBJ([tzset])
fi
gl_TIME_MODULE_INDICATOR([tzset])