diff options
author | Bruno Haible <bruno@clisp.org> | 2020-07-26 13:46:35 +0200 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2020-07-26 13:46:35 +0200 |
commit | a6fbda46c278750dec50b0b41a9a88026944dcb9 (patch) | |
tree | 000dece806892f5358a1ec3fddd37b72f0bb39a4 /m4 | |
parent | 994d7b1849b9157c154d8981ec8bdc0eb0f40acc (diff) | |
download | gnulib-a6fbda46c278750dec50b0b41a9a88026944dcb9.tar.gz |
gettimeofday: Remove workaround for Mac OS X 10.0.
* m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY_CLOBBER): Remove macro.
(gl_FUNC_GETTIMEOFDAY): Don't invoke it.
* lib/gettimeofday.c: Don't include localtime-buffer.h.
(gettimeofday): Don't test GETTIMEOFDAY_CLOBBERS_LOCALTIME.
* lib/localtime.c: Don't test GETTIMEOFDAY_CLOBBERS_LOCALTIME.
* modules/gettimeofday (Depends-on): Remove localtime-buffer.
* modules/localtime-buffer: Remove file.
* lib/localtime-buffer.h: Remove file.
* lib/localtime-buffer.c: Remove file.
* m4/localtime-buffer.m4: Remove file.
* MODULES.html.sh (Date and time <time.h>): Remove localtime-buffer.
Diffstat (limited to 'm4')
-rw-r--r-- | m4/gettimeofday.m4 | 61 | ||||
-rw-r--r-- | m4/localtime-buffer.m4 | 21 |
2 files changed, 1 insertions, 81 deletions
diff --git a/m4/gettimeofday.m4 b/m4/gettimeofday.m4 index c72b3eacc6..578ed49b07 100644 --- a/m4/gettimeofday.m4 +++ b/m4/gettimeofday.m4 @@ -1,4 +1,4 @@ -# serial 27 +# serial 28 # Copyright (C) 2001-2003, 2005, 2007, 2009-2020 Free Software Foundation, Inc. # This file is free software; the Free Software Foundation @@ -19,7 +19,6 @@ AC_DEFUN([gl_FUNC_GETTIMEOFDAY], if test $ac_cv_func_gettimeofday != yes; then HAVE_GETTIMEOFDAY=0 else - gl_FUNC_GETTIMEOFDAY_CLOBBER AC_CACHE_CHECK([for gettimeofday with POSIX signature], [gl_cv_func_gettimeofday_posix_signature], [AC_COMPILE_IFELSE( @@ -66,63 +65,5 @@ int gettimeofday (struct timeval *restrict, struct timezone *restrict); declaration of the second argument to gettimeofday.]) ]) - -dnl See if gettimeofday clobbers the static buffer that localtime uses -dnl for its return value. The gettimeofday function from Mac OS X 10.0.4 -dnl (i.e., Darwin 1.3.7) has this problem. -dnl -dnl If it does, then arrange to use gettimeofday and localtime only via -dnl the wrapper functions that work around the problem. - -AC_DEFUN([gl_FUNC_GETTIMEOFDAY_CLOBBER], -[ - AC_REQUIRE([gl_HEADER_SYS_TIME_H]) - AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles - AC_REQUIRE([gl_LOCALTIME_BUFFER_DEFAULTS]) - - AC_CACHE_CHECK([whether gettimeofday clobbers localtime buffer], - [gl_cv_func_gettimeofday_clobber], - [AC_RUN_IFELSE( - [AC_LANG_PROGRAM( - [[#include <string.h> - #include <sys/time.h> - #include <time.h> - #include <stdlib.h> - ]], - [[ - time_t t = 0; - struct tm *lt; - struct tm saved_lt; - struct timeval tv; - lt = localtime (&t); - saved_lt = *lt; - gettimeofday (&tv, NULL); - return memcmp (lt, &saved_lt, sizeof (struct tm)) != 0; - ]])], - [gl_cv_func_gettimeofday_clobber=no], - [gl_cv_func_gettimeofday_clobber=yes], - [# When cross-compiling: - case "$host_os" in - # Guess all is fine on glibc systems. - *-gnu* | gnu*) gl_cv_func_gettimeofday_clobber="guessing no" ;; - # Guess all is fine on musl systems. - *-musl*) gl_cv_func_gettimeofday_clobber="guessing no" ;; - # Guess no on native Windows. - mingw*) gl_cv_func_gettimeofday_clobber="guessing no" ;; - # If we don't know, obey --enable-cross-guesses. - *) gl_cv_func_gettimeofday_clobber="$gl_cross_guess_inverted" ;; - esac - ])]) - - case "$gl_cv_func_gettimeofday_clobber" in - *yes) - REPLACE_GETTIMEOFDAY=1 - AC_DEFINE([GETTIMEOFDAY_CLOBBERS_LOCALTIME], [1], - [Define if gettimeofday clobbers the localtime buffer.]) - gl_LOCALTIME_BUFFER_NEEDED - ;; - esac -]) - # Prerequisites of lib/gettimeofday.c. AC_DEFUN([gl_PREREQ_GETTIMEOFDAY], [:]) diff --git a/m4/localtime-buffer.m4 b/m4/localtime-buffer.m4 deleted file mode 100644 index 09df3c97f2..0000000000 --- a/m4/localtime-buffer.m4 +++ /dev/null @@ -1,21 +0,0 @@ -# localtime-buffer.m4 serial 1 -dnl Copyright (C) 2017-2020 Free Software Foundation, Inc. -dnl This file is free software; the Free Software Foundation -dnl gives unlimited permission to copy and/or distribute it, -dnl with or without modifications, as long as this notice is preserved. - -AC_DEFUN([gl_LOCALTIME_BUFFER_DEFAULTS], -[ - NEED_LOCALTIME_BUFFER=0 -]) - -dnl Macro invoked from other modules, to signal that the compilation of -dnl module 'localtime-buffer' is needed. -AC_DEFUN([gl_LOCALTIME_BUFFER_NEEDED], -[ - AC_REQUIRE([gl_LOCALTIME_BUFFER_DEFAULTS]) - AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS]) - NEED_LOCALTIME_BUFFER=1 - REPLACE_GMTIME=1 - REPLACE_LOCALTIME=1 -]) |