Subject: bug#27736: OSX 10.6.8: Building from master branch fails.

From: Paul Eggert <[email-masked]>
Date: Wed, 28 Mar 2018 14:29:38 -0700

On 03/28/2018 11:54 AM, Charles A. Roelli wrote:
>
> -            time_t t = -67768038400665600;
> +            time_t t = -67768038400666600;

Thanks, I did that in Gnulib and propagated the result into Emacs master 
(see attached patch).

> And then I got the following in the output of ./configure:
>
>    checking whether localtime loops forever near extrema... ./configure: line 30561: 35760 Alarm clock             TZ=QQQ0 ./conftest$EXEEXT

Thanks for mentioning that; I attempted to suppress the "Alarm clock" 
stuff in the attached patch too.

> I will try to find the exact boundary of the hang again.  And the hang
> is timezone-dependent, so that complicates things too.

I think we should be OK here, as the test case uses UTC so that it is 
reproducible. The use of UTC could explain why the abovementioned 
numeric change was needed.
>From ad52c652a64ebe3523437fb9bb714f99c1ffa9e6 Mon Sep 17 00:00:00 2001
From: Paul Eggert <[email-masked]>
Date: Wed, 28 Mar 2018 12:45:45 -0700
Subject: [PATCH] time_rz: fix workaround for Mac OS X 10.6 infloop

Problems reported by Charles A. Roelli (Bug#27736#117).
* m4/time_rz.m4 (gl_TIME_RZ): Use a slightly different timestamp.
Also, discard output, which clutters the 'configure' log.
---
 ChangeLog     | 7 +++++++
 m4/time_rz.m4 | 9 +++++----
 2 files changed, 12 insertions(+), 4 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 74f3bfc71..bd8df9a1e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2018-03-28  Paul Eggert  <[email-masked]>
+
+	time_rz: fix workaround for Mac OS X 10.6 infloop
+	Problems reported by Charles A. Roelli (Bug#27736#117).
+	* m4/time_rz.m4 (gl_TIME_RZ): Use a slightly different timestamp.
+	Also, discard output, which clutters the 'configure' log.
+
 2018-03-27  Paul Eggert  <[email-masked]>
 
 	havelib: port to Solaris 10 /bin/sh
diff --git a/m4/time_rz.m4 b/m4/time_rz.m4
index af9fa02b5..555570625 100644
--- a/m4/time_rz.m4
+++ b/m4/time_rz.m4
@@ -13,8 +13,8 @@ AC_DEFUN([gl_TIME_RZ],
   AC_REQUIRE([gl_HEADER_TIME_H_DEFAULTS])
   AC_REQUIRE([AC_STRUCT_TIMEZONE])
 
-  # Mac OS X 10.6 loops forever with some time_t values less
-  # than -67768038400665599.  See Bug#27706, Bug#27736, and
+  # Mac OS X 10.6 loops forever with some time_t values.
+  # See Bug#27706, Bug#27736, and
   # https://lists.gnu.org/r/bug-gnulib/2017-07/msg00142.html
   AC_CACHE_CHECK([whether localtime loops forever near extrema],
     [gl_cv_func_localtime_infloop_bug],
@@ -26,7 +26,7 @@ AC_DEFUN([gl_TIME_RZ],
             #include <unistd.h>
             #include <time.h>
           ]], [[
-            time_t t = -67768038400665600;
+            time_t t = -67768038400666600;
             struct tm *tm;
             char *tz = getenv ("TZ");
             if (! (tz && strcmp (tz, "QQQ0") == 0))
@@ -36,7 +36,8 @@ AC_DEFUN([gl_TIME_RZ],
             /* Use TM and *TM to suppress over-optimization.  */
             return tm && tm->tm_isdst;
           ]])],
-       [TZ=QQQ0 ./conftest$EXEEXT || gl_cv_func_localtime_infloop_bug=yes],
+       [(TZ=QQQ0 ./conftest$EXEEXT) >/dev/null 2>&1 ||
+           gl_cv_func_localtime_infloop_bug=yes],
        [],
        [gl_cv_func_localtime_infloop_bug="guessing no"])])
   if test "$gl_cv_func_localtime_infloop_bug" = yes; then
-- 
2.14.3