* lisp/image-mode.el (image-transform-fill-window): New command (bug#69565).
[emacs.git] / m4 / time_rz.m4
blob8f45f2b1d3dca4a78e3a8fd81c0b5e386f247f9e
1 # time_rz.m4
2 # serial 1
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
24      AC_RUN_IFELSE(
25        [AC_LANG_PROGRAM(
26           [[#include <stdlib.h>
27             #include <string.h>
28             #include <unistd.h>
29             #include <time.h>
30           ]], [[
31             time_t t = -67768038400666600;
32             struct tm *tm;
33             char *tz = getenv ("TZ");
34             if (! (tz && strcmp (tz, "QQQ0") == 0))
35               return 0;
36             alarm (2);
37             tm = localtime (&t);
38             /* Use TM and *TM to suppress over-optimization.  */
39             return tm && tm->tm_isdst;
40           ]])],
41        [(TZ=QQQ0 ./conftest$EXEEXT) >/dev/null 2>&1 ||
42            gl_cv_func_localtime_works=no],
43        [],
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
48          extreme arguments.])
49   fi
51   AC_CHECK_TYPES([timezone_t], [], [], [[#include <time.h>]])
52   if test "$ac_cv_type_timezone_t" = yes; then
53     HAVE_TIMEZONE_T=1
54   fi