summaryrefslogtreecommitdiff
path: root/configure.in
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>1995-09-10 04:18:58 +0000
committerRichard M. Stallman <rms@gnu.org>1995-09-10 04:18:58 +0000
commitd8eaa1412709499dd7801e1701dc484e8dfd1cd8 (patch)
tree4dcc068d9aad441ed769ad9b7d40bfb838f47c0a /configure.in
parentd343eca3a6e05510b21156942b8b067db6377818 (diff)
downloademacs-d8eaa1412709499dd7801e1701dc484e8dfd1cd8.tar.gz
(LOCALTIME_CACHE): Define if tzset exists and
if localtime caches TZ. Check for tzset.
Diffstat (limited to 'configure.in')
-rw-r--r--configure.in32
1 files changed, 31 insertions, 1 deletions
diff --git a/configure.in b/configure.in
index ea656331423..98243750ca6 100644
--- a/configure.in
+++ b/configure.in
@@ -1259,7 +1259,37 @@ AC_FUNC_ALLOCA
AC_CHECK_LIB(m, sqrt(0.0) + t)
AC_CHECK_FUNCS(gettimeofday gethostname dup2 rename closedir mkdir rmdir \
random lrand48 bcopy bcmp logb frexp fmod drem ftime res_init setsid \
-strerror fpathconf select mktime eaccess getpagesize)
+strerror fpathconf select mktime eaccess getpagesize tzset)
+
+AC_MSG_CHECKING(whether localtime caches TZ)
+AC_CACHE_VAL(emacs_cv_localtime_cache,
+[if test $ac_cv_func_tzset = yes; then
+AC_TRY_RUN([#include <time.h>
+#if STDC_HEADERS
+# include <stdlib.h>
+#endif
+main()
+{
+ time_t now = time ((time_t *) 0);
+ int hour;
+ if (putenv ("TZ=GMT0") != 0)
+ exit (1);
+ hour = localtime (&now)->tm_hour;
+ if (putenv ("TZ=PST8") != 0)
+ exit (1);
+ exit (localtime (&now)->tm_hour == hour);
+}], 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])
+else
+ # If we lack tzset, report that localtime does not cache TZ,
+ # since we can't invalidate the cache if we don't have tzset.
+ emacs_cv_localtime_cache=no
+fi])dnl
+AC_MSG_RESULT($emacs_cv_localtime_cache)
+if test $emacs_cv_localtime_cache = yes; then
+ AC_DEFINE(LOCALTIME_CACHE)
+fi
if test $HAVE_TIMEVAL = yes; then
AC_MSG_CHECKING(whether gettimeofday can't accept two arguments)