summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1996-02-28 23:25:27 +0000
committerRichard M. Stallman <rms@gnu.org>1996-02-28 23:25:27 +0000
commite738e05a14a3eb6b16444b96e1a4a7caf0336a1b (patch)
tree125d2f4ced0f54ed259ddaedfe5e03cf1ed682e9
parentc788ce96ef6e1d8d123b67aed0b9c602e4a8493c (diff)
downloademacs-e738e05a14a3eb6b16444b96e1a4a7caf0336a1b.tar.gz
(LOCALTIME_CACHE): Also define if localtime mishandles unsetting TZ.
This works around a localtime bug in mips-dec-ultrix.
-rw-r--r--configure.in23
1 files changed, 19 insertions, 4 deletions
diff --git a/configure.in b/configure.in
index da8b2efc794..a977091e79f 100644
--- a/configure.in
+++ b/configure.in
@@ -3,7 +3,7 @@ dnl To rebuild the `configure' script from this, execute the command
dnl autoconf
dnl in the directory containing this script.
dnl
-dnl Copyright (C) 1994, 1995 Free Software Foundation, Inc.
+dnl Copyright (C) 1994, 1995, 1996 Free Software Foundation, Inc.
dnl
dnl This file is part of GNU Emacs.
dnl
@@ -1375,16 +1375,31 @@ AC_TRY_RUN([#include <time.h>
#if STDC_HEADERS
# include <stdlib.h>
#endif
+extern char **environ;
+unset_TZ ()
+{
+ char **from, **to;
+ for (to = from = environ; (*to = *from); from++)
+ if (! (to[0][0] == 'T' && to[0][1] == 'Z' && to[0][2] == '='))
+ to++;
+}
main()
{
time_t now = time ((time_t *) 0);
- int hour;
+ int hour_GMT0, hour_unset;
if (putenv ("TZ=GMT0") != 0)
exit (1);
- hour = localtime (&now)->tm_hour;
+ hour_GMT0 = localtime (&now)->tm_hour;
+ unset_TZ ();
+ hour_unset = localtime (&now)->tm_hour;
if (putenv ("TZ=PST8") != 0)
exit (1);
- exit (localtime (&now)->tm_hour == hour);
+ if (localtime (&now)->tm_hour == hour_GMT0)
+ exit (1);
+ unset_TZ ();
+ if (localtime (&now)->tm_hour != hour_unset)
+ exit (1);
+ exit (0);
}], emacs_cv_localtime_cache=no, emacs_cv_localtime_cache=yes,
[# If we have tzset, assume the worst when cross-compiling.
emacs_cv_localtime_cache=yes])