summaryrefslogtreecommitdiff
path: root/m4/sanity.m4
diff options
context:
space:
mode:
authorRalf Wildenhues <Ralf.Wildenhues@gmx.de>2009-09-06 13:06:32 +0200
committerRalf Wildenhues <Ralf.Wildenhues@gmx.de>2009-09-06 13:07:39 +0200
commitf6b3f7fb620580356865ebedfbaf76af3e534369 (patch)
tree2d5e66af1ab8d3a807609e691094cb6c6f0c6b15 /m4/sanity.m4
parent53fe020252642f4b923b8c77392e37e4c5b7038d (diff)
downloadautomake-f6b3f7fb620580356865ebedfbaf76af3e534369.tar.gz
Avoid sleeping for one second most of the time in sanity check.
* m4/sanity.m4 (AM_SANITY_CHECK): Try sanity check first without sleeping for a second, and only if that failed, sleep and try again, to avoid the delay in the common case of a configure script that is older than a second, or a system with sub-second time stamp granularity. Report and different patch by Jim Meyering. Signed-off-by: Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
Diffstat (limited to 'm4/sanity.m4')
-rw-r--r--m4/sanity.m446
1 files changed, 25 insertions, 21 deletions
diff --git a/m4/sanity.m4 b/m4/sanity.m4
index 3d2f30432..db87c8bb1 100644
--- a/m4/sanity.m4
+++ b/m4/sanity.m4
@@ -1,21 +1,18 @@
# Check to make sure that the build environment is sane. -*- Autoconf -*-
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
+# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008, 2009
# 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 5
+# serial 6
# AM_SANITY_CHECK
# ---------------
AC_DEFUN([AM_SANITY_CHECK],
[AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftest.file
# Reject unsafe characters in $srcdir or the absolute working directory
# name. Accept space and tab only in the latter.
am_lf='
@@ -35,23 +32,30 @@ esac
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
- 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
-
- # If neither matched, then we have a broken ls. This can happen
- # if, for instance, CONFIG_SHELL is bash and it inherits a
- # broken ls alias from the environment. This has actually
- # happened. Such a system could not be considered "sane".
- AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
-alias in your environment])
- fi
+ for am_try in 1 2; do
+ echo timestamp > 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
+ # If neither matched, then we have a broken ls. This can happen
+ # if, for instance, CONFIG_SHELL is bash and it inherits a
+ # broken ls alias from the environment. This has actually
+ # happened. Such a system could not be considered "sane".
+ AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
+ alias in your environment])
+ fi
+ if test "$[2]" = conftest.file || test $am_try -eq 2; then
+ break
+ fi
+ # Just in case.
+ sleep 1
+ done
test "$[2]" = conftest.file
)
then