1 # Check to make sure that the build environment is sane. -*- Autoconf -*-
3 # Copyright (C) 1996-2012 Free Software Foundation, Inc.
5 # This file is free software; the Free Software Foundation
6 # gives unlimited permission to copy and/or distribute it,
7 # with or without modifications, as long as this notice is preserved.
11 AC_DEFUN([AM_SANITY_CHECK],
12 [AC_MSG_CHECKING([whether build environment is sane])
13 # Reject unsafe characters in $srcdir or the absolute working directory
14 # name. Accept space and tab only in the latter.
18 *[[\\\"\#\$\&\'\`$am_lf]]*)
19 AC_MSG_ERROR([unsafe absolute working directory name]);;
22 *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
23 AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);;
26 # Do 'set' in a subshell so we don't clobber the current shell's
27 # arguments. Must try -L first in case configure is actually a
28 # symlink; some systems play weird games with the mod time of symlinks
29 # (eg FreeBSD returns the mod time of the symlink's containing
34 echo "timestamp, slept: $am_has_slept" > conftest.file
35 set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
36 if test "$[*]" = "X"; then
38 set X `ls -t "$srcdir/configure" conftest.file`
40 if test "$[*]" != "X $srcdir/configure conftest.file" \
41 && test "$[*]" != "X conftest.file $srcdir/configure"; then
43 # If neither matched, then we have a broken ls. This can happen
44 # if, for instance, CONFIG_SHELL is bash and it inherits a
45 # broken ls alias from the environment. This has actually
46 # happened. Such a system could not be considered "sane".
47 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
48 alias in your environment])
50 if test "$[2]" = conftest.file || test $am_try -eq 2; then
57 test "$[2]" = conftest.file
63 AC_MSG_ERROR([newly created file is older than distributed files!
64 Check your system clock])
67 # If we didn't sleep, we still need to ensure time stamps of config.status and
68 # generated files are strictly newer.
70 if grep 'slept: no' conftest.file >/dev/null 2>&1; then
74 AC_CONFIG_COMMANDS_PRE(
75 [AC_MSG_CHECKING([that generated files are newer than configure])
76 if test -n "$am_sleep_pid"; then
77 # Hide warnings about reused PIDs.
78 wait $am_sleep_pid 2>/dev/null
80 AC_MSG_RESULT([done])])