1 dnl Time zone functions: tzalloc, localtime_rz, etc.
3 dnl Copyright (C) 2015-2018 Free Software Foundation, Inc.
4 dnl This file is free software; the Free Software Foundation
5 dnl gives unlimited permission to copy and/or distribute it,
6 dnl with or without modifications, as long as this notice is preserved.
8 dnl Written by Paul Eggert.
10 AC_DEFUN([gl_TIME_RZ],
12 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
13 AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
14 AC_REQUIRE([AC_STRUCT_TIMEZONE])
16 # Mac OS X 10.6 loops forever with some time_t values less
17 # than -67768038400665599. See Bug#27706, Bug#27736, and
18 # https://lists.gnu.org/r/bug-gnulib/2017-07/msg00142.html
19 AC_CACHE_CHECK([whether localtime loops forever near extrema],
20 [gl_cv_func_localtime_infloop_bug],
21 [gl_cv_func_localtime_infloop_bug=no
29 time_t t = -67768038400665600;
31 char *tz = getenv ("TZ");
32 if (! (tz && strcmp (tz, "QQQ0") == 0))
36 /* Use TM and *TM to suppress over-optimization. */
37 return tm && tm->tm_isdst;
39 [TZ=QQQ0 ./conftest$EXEEXT || gl_cv_func_localtime_infloop_bug=yes],
41 [gl_cv_func_localtime_infloop_bug="guessing no"])])
42 if test "$gl_cv_func_localtime_infloop_bug" = yes; then
43 AC_DEFINE([HAVE_LOCALTIME_INFLOOP_BUG], 1,
44 [Define if localtime-like functions can loop forever on
48 AC_CHECK_TYPES([timezone_t], [], [], [[#include <time.h>]])
49 if test "$ac_cv_type_timezone_t" = yes; then