]> Savannah Git Hosting - gnulib.git/commitdiff
tzset: Avoid guessing wrong when cross-compiling to glibc systems.
authorBruno Haible <bruno@clisp.org>
Sat, 5 May 2012 10:31:27 +0000 (12:31 +0200)
committerBruno Haible <bruno@clisp.org>
Sat, 5 May 2012 10:31:27 +0000 (12:31 +0200)
* m4/tzset.m4 (gl_FUNC_TZSET_CLOBBER): Require AC_CANONICAL_HOST. When
cross-compiling to a glibc platform, set gl_cv_func_tzset_clobber to
"guessing no".
* m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY): Update.

ChangeLog
m4/gettimeofday.m4
m4/tzset.m4

index 9f6d6c460584990f94f53837373beb68c4e56f2d..2a39ae4266ba67110eb26094dc4cf21140208aae 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2012-05-05  Bruno Haible  <bruno@clisp.org>
+
+       tzset: Avoid guessing wrong when cross-compiling to glibc systems.
+       * m4/tzset.m4 (gl_FUNC_TZSET_CLOBBER): Require AC_CANONICAL_HOST. When
+       cross-compiling to a glibc platform, set gl_cv_func_tzset_clobber to
+       "guessing no".
+       * m4/gettimeofday.m4 (gl_FUNC_GETTIMEOFDAY): Update.
+
 2012-05-05  Bruno Haible  <bruno@clisp.org>
 
        d-ino: Avoid guessing "no" when cross-compiling to glibc/Linux systems.
index 2e65eb5c1be0ed0e776029a6537d656e5ffcbb13..eda97027a92d72e67bd87f99dcd2b66fa936c752 100644 (file)
@@ -1,4 +1,4 @@
-# serial 19
+# serial 20
 
 # Copyright (C) 2001-2003, 2005, 2007, 2009-2012 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -56,14 +56,16 @@ int gettimeofday (struct timeval *restrict, struct timezone *restrict);
     fi
     m4_ifdef([gl_FUNC_TZSET_CLOBBER], [
       gl_FUNC_TZSET_CLOBBER
-      if test $gl_cv_func_tzset_clobber = yes; then
-        REPLACE_GETTIMEOFDAY=1
-        gl_GETTIMEOFDAY_REPLACE_LOCALTIME
-        AC_DEFINE([tzset], [rpl_tzset],
-          [Define to rpl_tzset if the wrapper function should be used.])
-        AC_DEFINE([TZSET_CLOBBERS_LOCALTIME], [1],
-          [Define if tzset clobbers localtime's static buffer.])
-      fi
+      case "$gl_cv_func_tzset_clobber" in
+        *yes)
+          REPLACE_GETTIMEOFDAY=1
+          gl_GETTIMEOFDAY_REPLACE_LOCALTIME
+          AC_DEFINE([tzset], [rpl_tzset],
+            [Define to rpl_tzset if the wrapper function should be used.])
+          AC_DEFINE([TZSET_CLOBBERS_LOCALTIME], [1],
+            [Define if tzset clobbers localtime's static buffer.])
+          ;;
+      esac
     ])
   fi
   AC_DEFINE_UNQUOTED([GETTIMEOFDAY_TIMEZONE], [$gl_gettimeofday_timezone],
index c3ef37321dd139c8f66270b2b1fc6d84a992d234..54b11bd7a7e467d85c823c26fdb411d19dc3a45a 100644 (file)
@@ -1,4 +1,4 @@
-# serial 6
+# serial 7
 
 # Copyright (C) 2003, 2007, 2009-2012 Free Software Foundation, Inc.
 # This file is free software; the Free Software Foundation
@@ -20,6 +20,7 @@ AC_DEFUN([gl_FUNC_TZSET], [])
 AC_DEFUN([gl_FUNC_TZSET_CLOBBER],
 [
   AC_REQUIRE([gl_HEADER_SYS_TIME_H])
+  AC_REQUIRE([AC_CANONICAL_HOST]) dnl for cross-compiles
   AC_CACHE_CHECK([whether tzset clobbers localtime buffer],
                  gl_cv_func_tzset_clobber,
   [
@@ -47,7 +48,13 @@ main ()
   ]])],
        [gl_cv_func_tzset_clobber=no],
        [gl_cv_func_tzset_clobber=yes],
-       [gl_cv_func_tzset_clobber=yes])])
+       [case "$host_os" in
+                  # Guess all is fine on glibc systems.
+          *-gnu*) gl_cv_func_tzset_clobber="guessing no" ;;
+                  # If we don't know, assume the worst.
+          *)      gl_cv_func_tzset_clobber="guessing yes" ;;
+        esac
+       ])])
 
   AC_DEFINE([HAVE_RUN_TZSET_TEST], [1],
     [Define to 1 if you have run the test for working tzset.])