+2011-12-22 Stefano Lattarini <stefano.lattarini@gmail.com>
+
+ include: avoid "deleted .am file" problem
+ * automake.in (handle_configure): When processing `configure.am',
+ also expand `HAVE-MAKEFILE-IN-DEPS' to a boolean telling whether
+ `MAKEFILE-IN-DEPS' is empty or not.
+ * lib/am/configure.am [?HAVE-MAKEFILE-IN-DEPS?]
+ (%MAKEFILE-IN-DEPS%): New target without dependencies, to
+ avoid the "deleted .am file" problem. Emit this only when
+ `?HAVE-MAKEFILE-IN-DEPS?' is true, to avoid generating an
+ "empty" dependency declaration.
+ * tests/deleted-am.test: Make grepping of error message stricter.
+ * tests/dist-missing-am.test: Likewise.
+ * tests/remake-deleted-am.test: New test.
+ * tests/remake-deleted-am-2.test: Likewise.
+ * tests/remake-deleted-am-subdir.test: Likewise.
+ * tests/remake-renamed-am.test: Likewise.
+ * tests/makefile-deps.test: Likewise.
+ * tests/Makefile.am (TESTS): Add the new tests.
+ * NEWS: Update.
+ Fixes automake bug#9768.
+ Report by Peter Johansson.
+ See also commit `Release-1-10-40-gd0ebf71', which fixed a similar
+ problem for .m4 files included by configure.ac.
+
2011-12-14 Stefano Lattarini <stefano.lattarini@gmail.com>
tests: better handling of gettext and libtool requirements
* Long-standing bugs:
+ - The "deleted header file problem" for *.am files is avoided by stub
+ rules. This allows `make' to trigger a rerun of `automake' also if
+ some previously needed `.am' file has been removed.
+
- "make distcheck" now correctly complains also when "make uninstall"
leaves one and only one file installed in $(prefix).
'MAKEFILE-DEPS' => "@rewritten",
'CONFIG-MAKEFILE' => ($relative_dir eq '.') ? '$@' : '$(subdir)/$@',
'MAKEFILE-IN' => $rel_makefile_in,
+ 'HAVE-MAKEFILE-IN-DEPS' => (@include_stack > 0),
'MAKEFILE-IN-DEPS' => "@include_stack",
'MAKEFILE-AM' => $rel_makefile_am,
'AUTOMAKE-OPTIONS' => $automake_options,
cd $(top_builddir) && $(SHELL) ./config.status %CONFIG-MAKEFILE% $(am__depfiles_maybe);; \
esac;
+## Avoid the "deleted header file" problem for the dependencies.
+?HAVE-MAKEFILE-IN-DEPS?%MAKEFILE-IN-DEPS%:
+
DIST_COMMON += %MAKEFILE-AM%
maintclean-vpath.test \
maintmode-configure-msg.test \
make.test \
+makefile-deps.test \
makej.test \
makej2.test \
maken.test \
remake-subdir-long-time.test \
remake-am-pr10111.test \
remake-m4-pr10111.test \
+remake-deleted-am.test \
+remake-deleted-am-2.test \
+remake-deleted-am-subdir.test \
+remake-renamed-am.test \
pr8365-remake-timing.test \
regex.test \
req.test \
rm -f zardoz.am
$MAKE >output 2>&1 && { cat output; Exit 1; }
cat output
-# FIXME: enable this stricter grepping, once bug#9768 has been taken
-# FIXME: care of.
-## This error will come from automake, not make, so we can be stricter
-## in our grepping of it.
-# grep 'cannot open.*zardoz\.am' output
-grep 'zardoz\.am' output
+# This error will come from automake, not make, so we can be stricter
+# in our grepping of it.
+grep 'cannot open.*zardoz\.am' output
grep 'foobar\.am' output && Exit 1 # No spurious error, please.
# Try with one less indirection.
rm -f foobar.am
$MAKE >output 2>&1 && { cat output; Exit 1; }
cat output
-# FIXME: enable this stricter grepping, once bug#9768 has been taken
-# FIXME: care of.
-## This error will come from automake, not make, so we can be stricter
-## in our grepping of it.
-# grep 'cannot open.*foobar\.am' output
-grep 'foobar\.am' output
+# This error will come from automake, not make, so we can be stricter
+# in our grepping of it.
+grep 'cannot open.*foobar\.am' output
:
fi
$MAKE >output 2>&1 && { cat output; Exit 1; }
cat output
-# FIXME: enable this stricter grepping, once bug#9768 has been taken
-# FIXME: care of.
-# # This error comes from automake, not make, so we can be stricter
-# # in our grepping of it.
-# grep 'cannot open.*zardoz\.am' output
+ # This error comes from automake, not make, so we can be stricter
+ # in our grepping of it.
+ grep 'cannot open.*zardoz\.am' output
grep 'foobar\.am' output && Exit 1 # No spurious error, please.
cd "$ocwd" || fatal_ "cannot chdir back to top-level test directory"
done
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Make sure we don't emit a rule with empty target if list of
+# automatically-computed dependencies for Makefile.in is empty.
+
+. ./defs || Exit 1
+
+set -e
+
+: > Makefile.am
+
+$ACLOCAL
+$AUTOMAKE
+
+grep "^ *:" Makefile.in && Exit 1
+
+:
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that inclusion of `.am' fragments by automake does not suffer
+# of the "deleted header problem". This test checks deeper inclusion
+# stacks, and use VPATH builds.
+
+. ./defs || Exit 1
+
+set -e
+
+echo AC_OUTPUT >> configure.in
+
+$ACLOCAL
+$AUTOCONF
+
+cat > Makefile.am <<'END'
+include $(srcdir)/foo.am
+END
+
+cat > foo.am <<'END'
+# this is foo
+include sub/bar.am
+include baz.am
+END
+
+mkdir sub
+echo 'include $(top_srcdir)/sub/zardoz.am' > sub/bar.am
+echo '# this is zardoz' > sub/zardoz.am
+
+echo 'include fnord.am' > baz.am
+echo '# you are not seeing this' > fnord.am
+
+$AUTOMAKE
+# Sanity checks.
+$FGREP 'this is zardoz' Makefile.in
+$FGREP 'you are not seeing this' Makefile.in
+
+mkdir build
+cd build
+
+srcdir=..
+
+$srcdir/configure
+$MAKE
+
+$sleep
+echo '# this is baz' > $srcdir/baz.am
+rm -f $srcdir/fnord.am
+$MAKE
+# Sanity checks.
+$FGREP 'you are not seeing this' $srcdir/Makefile.in Makefile && Exit 1
+$FGREP 'this is baz' $srcdir/Makefile.in
+$FGREP 'this is baz' Makefile
+
+$sleep
+rm -rf $srcdir/sub $srcdir/foo.am $srcdir/baz.am
+echo '# no more inclusions' > $srcdir/Makefile.am
+$MAKE
+# Sanity checks.
+$EGREP 'this is (foo|bar|baz)' Makefile $srcdir/Makefile.in && Exit 1
+$FGREP 'no more inclusions' Makefile
+
+:
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that inclusion of `.am' fragments by automake does not suffer
+# of the "deleted header problem". This test does the check when the
+# SUBDIRS variable is involved.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<'END'
+AC_CONFIG_FILES([sub1/Makefile sub2/Makefile])
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOCONF
+
+cat > Makefile.am <<'END'
+include foo.am
+SUBDIRS = sub1 sub2
+END
+
+echo '# this is foo.am' > foo.am
+
+mkdir sub1 sub2
+
+echo 'include $(srcdir)/bar.am' > sub1/Makefile.am
+echo '# this is bar.am' > sub1/bar.am
+
+echo 'include $(top_srcdir)/foo.am' > sub2/Makefile.am
+
+$AUTOMAKE
+# Sanity checks.
+$FGREP 'this is foo.am' Makefile.in
+$FGREP 'this is bar.am' sub1/Makefile.in
+$FGREP 'this is foo.am' sub2/Makefile.in
+
+./configure
+$MAKE # Should be no-op.
+
+$sleep
+echo '# this is sub1/Makefile.am' > sub1/Makefile.am
+rm -f sub1/bar.am
+$MAKE all
+# Sanity checks.
+$FGREP 'this is bar' sub1/Makefile.in sub1/Makefile && Exit 1
+$FGREP 'this is sub1/Makefile.am' sub1/Makefile.in
+$FGREP 'this is sub1/Makefile.am' sub1/Makefile
+
+$sleep
+for d in . sub2; do
+ sed "s|.*include.*foo\.am.*|# this is $d/Makefile.am|" $d/Makefile.am > t
+ mv -f t $d/Makefile.am
+done
+rm -f foo.am
+$MAKE all
+# Sanity checks.
+$FGREP 'this is foo' sub*/Makefile* Makefile* && Exit 1
+for d in . sub1 sub2; do
+ $FGREP "this is $d/Makefile.am" $d/Makefile.in
+ $FGREP "this is $d/Makefile.am" $d/Makefile
+done
+
+:
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that inclusion of `.am' fragments by automake does not suffer
+# of the "deleted header problem". Basic checks are done here.
+
+. ./defs || Exit 1
+
+set -e
+
+echo AC_OUTPUT >> configure.in
+
+$ACLOCAL
+$AUTOCONF
+
+cat > Makefile.am <<'END'
+include foo.am
+include $(srcdir)/bar.am
+include $(top_srcdir)/baz.am
+END
+
+echo '# this is foo' > foo.am
+echo '# this is bar' > bar.am
+echo '# this is baz' > baz.am
+
+$AUTOMAKE
+# Sanity checks.
+$FGREP 'this is foo' Makefile.in
+$FGREP 'this is bar' Makefile.in
+$FGREP 'this is baz' Makefile.in
+
+./configure
+$MAKE # Should be no-op.
+
+$sleep
+sed '/^include foo\.am$/d' Makefile.am > t
+mv -f t Makefile.am
+rm -f foo.am
+$MAKE Makefile
+# Sanity checks.
+$FGREP 'this is foo' Makefile.in Makefile && Exit 1
+$FGREP 'this is bar' Makefile.in
+$FGREP 'this is bar' Makefile
+$FGREP 'this is baz' Makefile.in
+$FGREP 'this is baz' Makefile
+
+$sleep
+echo '# empty empty' > Makefile.am
+rm -f bar.am baz.am
+$MAKE Makefile
+# Sanity checks.
+$FGREP 'empty empty' Makefile.in
+$FGREP 'empty empty' Makefile
+grep 'this is ba[rz]' Makefile Makefile.in && Exit 1
+
+:
--- /dev/null
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Check that inclusion of `.am' fragments by automake does not suffer
+# of the "deleted header problem". This test checks that we can rename
+# an included .am file without confusing the remake rules.
+
+. ./defs || Exit 1
+
+set -e
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am <<'END'
+include foo.am
+END
+
+cat > foo.am <<'END'
+all-local:
+ echo ok > has-run-1
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+$MAKE
+test -f has-run-1
+
+$sleep
+rm -f has-run-1
+mv -f foo.am bar.am
+echo include bar.am > Makefile.am
+$MAKE Makefile
+$FGREP 'foo.am' Makefile Makefile.in && Exit 1
+
+$sleep
+rm -f has-run-1 bar.am
+echo 'all-local:; echo ok > has-run-2' > zardoz.am
+echo 'include $(srcdir)/zardoz.am' > Makefile.am
+using_gmake || $MAKE Makefile
+$MAKE
+test ! -f has-run-1
+test -f has-run-2
+
+: