2 # Copyright (C) 2011 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Check that remake rules from subdirectories do not hang or cycle
18 # endlessly, even with build systems that takes several seconds to
19 # rebuild the Makefiles.
20 # This test tries to ensure a long-enough rebuild time by introducing
21 # an explicit delay in the build process.
22 # Suggestion by Ralf Wildenhues.
28 cat > configure.in <<END
30 AM_INIT_AUTOMAKE([foreign -Wall -Werror])
31 AC_CONFIG_FILES([Makefile sub/Makefile])
32 AC_SUBST([MAGIC], [magic])
36 echo SUBDIRS = sub > Makefile.am
40 # Both aclocal and automake are expected to run one and just one time.
41 # Create and use wrappers that will verify that.
43 ocwd=`pwd` || fatal_ "cannot get current working directory"
47 cat > bin/automake <<END
50 PATH='$PATH'; export PATH
51 sentinel='$ocwd/automake-has-run'
52 if test -f "\$sentinel"; then
53 echo "Automake has been run more than one time" >&2
56 echo automake has run > "\$sentinel"
59 exec $AUTOMAKE \${1+"\$@"}
61 chmod a+x bin/automake
63 cat > bin/aclocal <<END
66 PATH='$PATH'; export PATH
67 sentinel='$ocwd/aclocal-has-run'
68 if test -f "\$sentinel"; then
69 echo "Aclocal has been run more than one time" >&2
72 echo aclocal has run > "\$sentinel"
75 exec $ACLOCAL \${1+"\$@"}
80 cp bin/automake bin/automake-$APIVERSION
81 cp bin/aclocal bin/aclocal-$APIVERSION
83 PATH=$ocwd/bin$PATH_SEPARATOR$PATH; export PATH
85 AUTOMAKE=automake ACLOCAL=aclocal; export AUTOMAKE ACLOCAL
87 $ACLOCAL # Should use or just-defined wrapper.
91 # Sanity check: the wrappers have been used.
92 test -f automake-has-run
93 test -f aclocal-has-run
94 rm -f automake-has-run aclocal-has-run
97 # Sanity check: Makefile doesn't get updated uselessly.
98 ACLOCAL=false AUTOMAKE=false AUTOCONF=false $MAKE -e
101 sed "s|magic|magic2|" configure.in > t
105 AUTOMAKE="$AUTOMAKE" ACLOCAL="$ACLOCAL" $MAKE -e Makefile
110 grep -i magic configure Makefile.in Makefile sub/Makefile.in sub/Makefile
112 $FGREP magic2 configure
113 $FGREP magic2 Makefile
114 $FGREP magic2 sub/Makefile