1 # Check to make sure that the build environment is sane. -*- Autoconf -*-
3 # Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008, 2009
4 # Free Software Foundation, Inc.
6 # This file is free software; the Free Software Foundation
7 # gives unlimited permission to copy and/or distribute it,
8 # with or without modifications, as long as this notice is preserved.
14 AC_DEFUN([AM_SANITY_CHECK],
15 [AC_MSG_CHECKING([whether build environment is sane])
16 # Reject unsafe characters in $srcdir or the absolute working directory
17 # name. Accept space and tab only in the latter.
21 *[[\\\"\#\$\&\'\`$am_lf]]*)
22 AC_MSG_ERROR([unsafe absolute working directory name]);;
25 *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
26 AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
29 # Do `set' in a subshell so we don't clobber the current shell's
30 # arguments. Must try -L first in case configure is actually a
31 # symlink; some systems play weird games with the mod time of symlinks
32 # (eg FreeBSD returns the mod time of the symlink's containing
36 echo timestamp > conftest.file
37 set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
38 if test "$[*]" = "X"; then
40 set X `ls -t "$srcdir/configure" conftest.file`
43 if test "$[*]" != "X $srcdir/configure conftest.file" \
44 && test "$[*]" != "X conftest.file $srcdir/configure"; then
46 # If neither matched, then we have a broken ls. This can happen
47 # if, for instance, CONFIG_SHELL is bash and it inherits a
48 # broken ls alias from the environment. This has actually
49 # happened. Such a system could not be considered "sane".
50 AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken
51 alias in your environment])
53 if test "$[2]" = conftest.file || test $am_try -eq 2; then
59 test "$[2]" = conftest.file
65 AC_MSG_ERROR([newly created file is older than distributed files!
66 Check your system clock])