3 dnl Copyright (C) 2015-2024 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 Time zone functions: tzalloc, localtime_rz, etc.
10 dnl Written by Paul Eggert.
12 AC_DEFUN([gl_TIME_RZ],
14 AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
15 AC_REQUIRE([gl_TIME_H_DEFAULTS])
16 AC_REQUIRE([AC_STRUCT_TIMEZONE])
18 # On Mac OS X 10.6, localtime loops forever with some time_t values.
19 # See Bug#27706, Bug#27736, and
20 # https://lists.gnu.org/r/bug-gnulib/2017-07/msg00142.html
21 AC_CACHE_CHECK([whether localtime works even near extrema],
22 [gl_cv_func_localtime_works],
23 [gl_cv_func_localtime_works=yes
31 time_t t = -67768038400666600;
33 char *tz = getenv ("TZ");
34 if (! (tz && strcmp (tz, "QQQ0") == 0))
38 /* Use TM and *TM to suppress over-optimization. */
39 return tm && tm->tm_isdst;
41 [(TZ=QQQ0 ./conftest$EXEEXT) >/dev/null 2>&1 ||
42 gl_cv_func_localtime_works=no],
44 [gl_cv_func_localtime_works="guessing yes"])])
45 if test "$gl_cv_func_localtime_works" = no; then
46 AC_DEFINE([HAVE_LOCALTIME_INFLOOP_BUG], 1,
47 [Define if localtime-like functions can loop forever on
51 AC_CHECK_TYPES([timezone_t], [], [], [[#include <time.h>]])
52 if test "$ac_cv_type_timezone_t" = yes; then