| 1 | #
|
|---|
| 2 | # Check to make sure that the build environment is sane.
|
|---|
| 3 | #
|
|---|
| 4 |
|
|---|
| 5 | # Copyright (C) 1996, 1997, 2000, 2001, 2003 Free Software Foundation, Inc.
|
|---|
| 6 |
|
|---|
| 7 | # This program is free software; you can redistribute it and/or modify
|
|---|
| 8 | # it under the terms of the GNU General Public License as published by
|
|---|
| 9 | # the Free Software Foundation; either version 2, or (at your option)
|
|---|
| 10 | # any later version.
|
|---|
| 11 |
|
|---|
| 12 | # This program is distributed in the hope that it will be useful,
|
|---|
| 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 15 | # GNU General Public License for more details.
|
|---|
| 16 |
|
|---|
| 17 | # You should have received a copy of the GNU General Public License
|
|---|
| 18 | # along with this program; if not, write to the Free Software
|
|---|
| 19 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
|---|
| 20 | # 02111-1307, USA.
|
|---|
| 21 |
|
|---|
| 22 | # serial 3
|
|---|
| 23 |
|
|---|
| 24 | # AM_SANITY_CHECK
|
|---|
| 25 | # ---------------
|
|---|
| 26 | AC_DEFUN([AM_SANITY_CHECK],
|
|---|
| 27 | [AC_MSG_CHECKING([whether build environment is sane])
|
|---|
| 28 | # Just in case
|
|---|
| 29 | sleep 1
|
|---|
| 30 | echo timestamp > conftest.file
|
|---|
| 31 | # Do `set' in a subshell so we don't clobber the current shell's
|
|---|
| 32 | # arguments. Must try -L first in case configure is actually a
|
|---|
| 33 | # symlink; some systems play weird games with the mod time of symlinks
|
|---|
| 34 | # (eg FreeBSD returns the mod time of the symlink's containing
|
|---|
| 35 | # directory).
|
|---|
| 36 | if (
|
|---|
| 37 | set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
|
|---|
| 38 | if test "$[*]" = "X"; then
|
|---|
| 39 | # -L didn't work.
|
|---|
| 40 | set X `ls -t $srcdir/configure conftest.file`
|
|---|
| 41 | fi
|
|---|
| 42 | rm -f conftest.file
|
|---|
| 43 | if test "$[*]" != "X $srcdir/configure conftest.file" \
|
|---|
| 44 | && test "$[*]" != "X conftest.file $srcdir/configure"; then
|
|---|
| 45 |
|
|---|
| 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])
|
|---|
| 52 | fi
|
|---|
| 53 |
|
|---|
| 54 | test "$[2]" = conftest.file
|
|---|
| 55 | )
|
|---|
| 56 | then
|
|---|
| 57 | # Ok.
|
|---|
| 58 | :
|
|---|
| 59 | else
|
|---|
| 60 | AC_MSG_ERROR([newly created file is older than distributed files!
|
|---|
| 61 | Check your system clock])
|
|---|
| 62 | fi
|
|---|
| 63 | AC_MSG_RESULT(yes)])
|
|---|