>From 05486abf0559efa3764ae3fbe8f6fbe5f6322df8 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 14 Aug 2020 20:06:32 +0200 Subject: [PATCH 3/3] 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. --- ChangeLog | 9 +++++++++ lib/time.in.h | 3 --- lib/tzset.c | 12 ++---------- m4/time_h.m4 | 1 - m4/tzset.m4 | 6 +----- modules/time | 1 - modules/tzset | 2 +- 7 files changed, 13 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 803c67d..85e1258 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2020-08-14 Bruno Haible + 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 e10e90c..7ad7d00 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 cd209e1..681f073 100644 --- a/lib/tzset.c +++ b/lib/tzset.c @@ -25,14 +25,8 @@ #include #include -/* 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) */ _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 d0f8932..a15c09d 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 31ef601..a504d5e 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 c235ac8..3daa751 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 ff7e60b..5423f3a 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]) -- 2.7.4