]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
Fix timestamp issues by ensuring configure takes at least a second.
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 2 Oct 2010 16:58:56 +0000 (18:58 +0200)
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>
Sat, 2 Oct 2010 17:57:14 +0000 (19:57 +0200)
* m4/sanity.m4 (AM_SANITY_CHECK): If we didn't sleep here,
start a sleep in the background and wait for it to finish
before creating config.status, hopefully fixing all spurious
testsuite failures involving botched time stamps.
* NEWS: Update.
Reports by Ludovic Courtès, Peter Breitenlohner, and others.

ChangeLog
NEWS
configure
m4/sanity.m4

index 5fd2c7680c2f503c16326bd2212469217c21a9cb..7c9cc877fe4f9368c2b8a5b4537e6f13d7fb16e0 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2010-10-02  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+       Fix timestamp issues by ensuring configure takes at least a second.
+       * m4/sanity.m4 (AM_SANITY_CHECK): If we didn't sleep here,
+       start a sleep in the background and wait for it to finish
+       before creating config.status, hopefully fixing all spurious
+       testsuite failures involving botched time stamps.
+       * NEWS: Update.
+       Reports by Ludovic Courtès, Peter Breitenlohner, and others.
+
 2009-09-06  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
 
        Avoid sleeping for one second most of the time in sanity check.
diff --git a/NEWS b/NEWS
index cd427fbed590b986ad1fc794a75c26bd386207c9..d26dfd0682a81a1da4517999124bd83197f6cc42 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,13 @@
 New in 1.11.0a:
 
+* Miscellaneous changes:
+
+  - Automake's early configure-time sanity check now tries to avoid sleeping
+    for a second, which slowed down cached configure runs noticeably.  In that
+    case, it will check back at the end of the configure script to ensure that
+    at least one second has passed, to avoid time stamp issues with makefile
+    rules rerunning autotools programs.
+
 Bugs fixed in 1.11.0a:
 
 * Bugs introduced by 1.11:
index 5dd8a9af38c03ad42102e7d5ddaf0fe21ebfcddf..86bd8f51a0ca257a21f05498a351e3756f8202fa 100755 (executable)
--- a/configure
+++ b/configure
@@ -1875,14 +1875,14 @@ esac
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
+   am_has_slept=no
    for am_try in 1 2; do
-     echo timestamp > conftest.file
+     echo "timestamp, slept: $am_has_slept" > conftest.file
      set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
      if test "$*" = "X"; then
        # -L didn't work.
        set X `ls -t "$srcdir/configure" conftest.file`
      fi
-     rm -f conftest.file
      if test "$*" != "X $srcdir/configure conftest.file" \
        && test "$*" != "X conftest.file $srcdir/configure"; then
 
@@ -1898,6 +1898,7 @@ if (
      fi
      # Just in case.
      sleep 1
+     am_has_slept=yes
    done
    test "$2" = conftest.file
    )
@@ -1910,6 +1911,16 @@ Check your system clock" "$LINENO" 5
 fi
 { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
 $as_echo "yes" >&6; }
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+  ( sleep 1 ) &
+  am_sleep_pid=$!
+
+fi
+rm -f conftest.file
+
 test "$program_prefix" != NONE &&
   program_transform_name="s&^&$program_prefix&;$program_transform_name"
 # Use a double $ so make ignores it.
@@ -2868,6 +2879,13 @@ LIBOBJS=$ac_libobjs
 LTLIBOBJS=$ac_ltlibobjs
 
 
+if test -n "$am_sleep_pid"; then
+       { $as_echo "$as_me:${as_lineno-$LINENO}: checking that generated files are newer than configure" >&5
+$as_echo_n "checking that generated files are newer than configure... " >&6; }
+       wait $am_sleep_pid
+       { $as_echo "$as_me:${as_lineno-$LINENO}: result: done" >&5
+$as_echo "done" >&6; }
+     fi
 
 
 : ${CONFIG_STATUS=./config.status}
index db87c8bb1cb7515e4bf3f6bda117c1df898082ab..94e1e51f6fd94d132d436da1fc119eb5152c3d29 100644 (file)
@@ -1,13 +1,13 @@
 # Check to make sure that the build environment is sane.    -*- Autoconf -*-
 
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008, 2009
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008, 2009, 2010
 # Free Software Foundation, Inc.
 #
 # This file is free software; the Free Software Foundation
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 6
+# serial 7
 
 # AM_SANITY_CHECK
 # ---------------
@@ -32,14 +32,14 @@ esac
 # (eg FreeBSD returns the mod time of the symlink's containing
 # directory).
 if (
+   am_has_slept=no
    for am_try in 1 2; do
-     echo timestamp > conftest.file
+     echo "timestamp, slept: $am_has_slept" > conftest.file
      set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
      if test "$[*]" = "X"; then
        # -L didn't work.
        set X `ls -t "$srcdir/configure" conftest.file`
      fi
-     rm -f conftest.file
      if test "$[*]" != "X $srcdir/configure conftest.file" \
        && test "$[*]" != "X conftest.file $srcdir/configure"; then
 
@@ -55,6 +55,7 @@ if (
      fi
      # Just in case.
      sleep 1
+     am_has_slept=yes
    done
    test "$[2]" = conftest.file
    )
@@ -65,4 +66,19 @@ else
    AC_MSG_ERROR([newly created file is older than distributed files!
 Check your system clock])
 fi
-AC_MSG_RESULT(yes)])
+AC_MSG_RESULT(yes)
+# If we didn't sleep, we still need to ensure time stamps of config.status and
+# generated files are strictly newer.
+am_sleep_pid=
+if grep 'slept: no' conftest.file >/dev/null 2>&1; then
+  ( sleep 1 ) &
+  am_sleep_pid=$!
+  AC_CONFIG_COMMANDS_PRE(
+    [if test -n "$am_sleep_pid"; then
+       AC_MSG_CHECKING([that generated files are newer than configure])
+       wait $am_sleep_pid
+       AC_MSG_RESULT([done])
+     fi])
+fi
+rm -f conftest.file
+])