automake-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Extend checks on remake rules.


From: Stefano Lattarini
Subject: Re: [PATCH] Extend checks on remake rules.
Date: Mon, 6 Dec 2010 20:34:04 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

On Sunday 05 December 2010, Ralf Wildenhues wrote:
> * Stefano Lattarini wrote on Sun, Dec 05, 2010 at 06:06:00PM CET:
> > I'll wait the customary 72 hours (until wednesday evening) before pushing.
> 
> This patch should have proper testing on several systems,
I tested it on GNU/Linux with several GNU make versions (3.78.1, 3.79,
3.80, 3.81, 3.82), with the FreeBSD make port (most tests were skipped
with it, obviously), and with dash (0.5.2) and pdksh as shells.  I also
tested it on Solaris 10 with GNU make 3.82, Solaris /bin/sh, and Solaris
tools only (plus autoconf and autom4te, of course), and then with
Solaris XPG4 make (most tests were skipped with it, obviously).

That's basically the best I can do.

> and seems ok when tested and with nits below addressed.

> If you still don't have access, please ping the person involved again,
> and me so that I can test the patch eventually.
> 
> A couple of issues in this patch I'm seeing just from glancing at it
> is that it touches this sed limitation (quoting autoconf.info):
> 
>      If a sed script is specified on the command line and ends in an
>      `a', `c', or `i' command, the last line of inserted text should be
>      followed by a newline.  Otherwise some `sed' implementations
>      (e.g., OpenBSD 3.9) do not append a newline to the inserted text.
>
Thanks for spotting this.  I've amended the patch to avoid the use
of the sed `i' command altogether, resorting to simpler uses of cat
instead (see the attached squash-in).  This had also the nice side
effect of making the affected testcases clearer IMHO.

> In remake1a, your sanity check requires that 'make -n' works to really
> not remake anything.  If that were the main purpose of the test, that
> would be fine, but as a sanity check I'd rather not use -n here.
>
Hmmm... wait, I can no more see the point of that sanity check now, nor
can I remember why I deemed it useful... maybe it is just a leftover of
an earlier version of the patch?  I'd say we simply remove it altogether;
that's what I've done in the attached squash-in.

> What is remake11.test for?
>
Well, as the comments say, it is for testing remake rules in deeply
nested subdirectories, and with many files.  It's a mild stress test,
just to ensure that rebuild rules don't break in obvious ways in a
slightly "heavier than usual" setup.

> Some of the tests look like they are testing the same things really
> as other new or existing tests.
>
Maybe, but I prefer to have some overlaps between different tests rather
than a lack in coverage.  Also, different tests might check the same
feature in slightly different situations, so that the overlapping is only
partial anyway, and the increase in coverage is real (albeit small).

> Can you explain them (ideally, the
> comment at the start of the test should be unique for each test so
> we can infer from that that each of the tests is actually required)?
>
I've tried to improve some heading comments (see the attached
squash-in); please tell me if now they seem clearer now.  Also,
Maybe I should expand comments in tests remake9*.tes toot, but
I haven't yet figured it out how to do so without being quite
verbose.  Hmm, but maybe here being verbose is the right thing
to do after all...  WDYT?

In the process, I've also made a couple of small improvements and
fixes to remake8{a,b}.test; please check them out and tell me if
you're OK with them.

> I wish you'd get yourself convinced to get rid of some of the 'for
> debugging' type comments, these things seem a bit obvious to need a
> comment.
>
I'm starting to agree with this more and more at every new patch...

> OTOH, I can see that some of them really help getting over
> the "wait, isn't that a typo" sort of feeling.  Hmm, maybe leave
> them in, skipping over them isn't that hard.
> 
OK; BTW, since these comments are easy to grep, we can get rid of
them in a follow-up patch at any moment, if we decide so.

> > The updated rebased patch is attached.  In it I have:
> >  - removed the overly hackish and complex tests remake2{a,b,c}.test,
> >    introduced by the previous version of my patch; I'll hopefully
> >    be able to find a saner way to improve coverage in that area (it
> >    can always be done in a follow-up patch without problems);
> >  - removed a uselessly-added "make distcheck" from `remake4.test';
> >  - removed all usages of in-line shell commments in make rules (since
> >    it turned out they're unportable to at least Tru64/OSF 5.1 make);
> >    this affected only test `remake12.test';
> >  - removed usages of `##' special automake comments which weren't on
> >    lines of their own (this usage is not part of the automake API)
> >  - added or extended comments for trickier tests;
> >  - thrown in some micellanous minor improvements and simplifications.
> 
> Good!
> 
> Thanks,
> Ralf
> 

Thanks for the review.

Regards,
  Stefano
diff --git a/ChangeLog b/ChangeLog
index 349057a..474a3d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,4 @@
-2010-12-05  Stefano Lattarini  <address@hidden>
+2010-12-06  Stefano Lattarini  <address@hidden>
 
        Tests: extend checks on remake rules.
        This adds proper semantical tests (i.e. run make to check the
@@ -13,15 +13,18 @@
        and ensure verbose printing of captured make output.
        * tests/remake.test: Enable `errexit' shell flag, and related
        changes.  Modernize `configure.in'.  Add trailing `:' command.
-       In heading comments, add reference to sister test remake1a.test.
+       Improve heading comments, and add a reference to new sister test
+       remake1a.test.
        * tests/remake3.test: Likewise (but with sister test being
        remake3a.test).
-       * tests/remake2.test: Make grepping of `Makefile.in' slighty
-       stricter.
+       * tests/remake2.test: Improve heading comments.  Enable `errexit'
+       shell flag, and related changes.  Modernize `configure.in'.  Make
+       grepping of `Makefile.in' slightly stricter.  Add trailing `:'
+       command.
        * tests/remake1a.test: New test, sister of remake.test.
        * tests/remake3a.test: New test, sister of remake3.test.
        * tests/remake8a.test: New test.
-       * tests/remake8b.test: New test.
+       * tests/remake8b.test: Likewise.
        * tests/remake9a.test: Likewise.
        * tests/remake9b.test: Likewise.
        * tests/remake9c.test: Likewise.
diff --git a/tests/remake.test b/tests/remake.test
index 48183bf..4d3036b 100755
--- a/tests/remake.test
+++ b/tests/remake.test
@@ -15,8 +15,9 @@
 # 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 remaking rules in subdir are correctly generated.
-# See also sister functional test `remake1b.test'.
+# Weak "grepping" test trying to ensure that remaking rules in a subdir
+# are correctly generated.
+# See also sister functional test `remake1a.test'.
 
 . ./defs || Exit 1
 
diff --git a/tests/remake11.test b/tests/remake11.test
index 1038931..7754867 100755
--- a/tests/remake11.test
+++ b/tests/remake11.test
@@ -14,8 +14,10 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test remake rules in deeply nested subdirectories,
-# and with a lot of files.
+# Test remake rules in deeply nested subdirectories, and with a lot
+# of files.  This is basically a mild stress test, ensuring that rebuild
+# rules don't break in obvious ways in a slightly "heavier than usual"
+# setup.
 
 required=GNUmake
 . ./defs || Exit 1
diff --git a/tests/remake1a.test b/tests/remake1a.test
index c0cf5c5..ce80c19 100755
--- a/tests/remake1a.test
+++ b/tests/remake1a.test
@@ -39,8 +39,6 @@ $AUTOMAKE
 
 ./configure
 
-(cd sub && $MAKE -n) # sanity check
-
 # Rebuild rules should work even if there is no top-level
 # makefiles, if we are careful enough to trigger them only
 # in proper subdirs
diff --git a/tests/remake2.test b/tests/remake2.test
index 0d8b5fe..452e951 100755
--- a/tests/remake2.test
+++ b/tests/remake2.test
@@ -15,7 +15,9 @@
 # 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 remaking rules in subdir are correct.
+# Weak "grepping" test trying to ensure that remaking rules in subdir
+# are correct even when there is no upper-level Makefile.
+# TODO: we should really add also functional tests for this!
 
 . ./defs || Exit 1
 
diff --git a/tests/remake3.test b/tests/remake3.test
index b330b07..708dca8 100755
--- a/tests/remake3.test
+++ b/tests/remake3.test
@@ -14,7 +14,8 @@
 # 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 remaking rules work when there is no subdir Makefile.
+# Weak "grepping" test trying to ensure that remake rules work for files
+# in a subdirectory even when there is no Makefile for that subdirectory.
 # See also sister functional test `remake3a.test'.
 
 . ./defs || Exit 1
diff --git a/tests/remake3a.test b/tests/remake3a.test
index 90f5cbf..a58c462 100755
--- a/tests/remake3a.test
+++ b/tests/remake3a.test
@@ -14,10 +14,10 @@
 # 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 remaking rules work when there is no subdir Makefile.
+# Ensure that remake rules work for files in a subdirectory even when
+# there is no Makefile for that subdirectory.
 # See also sister "grepping" test `remake3.test'.
 
-# NOTE: this test should work also without GNU make.
 . ./defs || Exit 1
 
 set -e
diff --git a/tests/remake8a.test b/tests/remake8a.test
index c94d151..96fcc08 100755
--- a/tests/remake8a.test
+++ b/tests/remake8a.test
@@ -14,17 +14,19 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test basic remake rules for Makefiles, for in-tree builds
-# Keep this in sync with sister test `remake8b.test'.
+# Test basic remake rules for Makefiles, for an *in-tree build*.
+# This testcase checks dependency of generated Makefile from Makefile.am,
+# configure.ac, acinclude.m4, aclocal.m4, and extra m4 files considered
+# by aclocal.
+# Keep this in sync with sister test `remake8b.test', which performs the
+# same checks for a VPATH build.
 
 required=GNUmake
 . ./defs || Exit 1
 
 set -e
 
-cat >> configure.in <<'END'
-AC_OUTPUT
-END
+mv -f configure.in configure.stub
 
 cat > Makefile.am <<'END'
 all-local: foo
@@ -36,6 +38,10 @@ check-local:
 CLEANFILES = foo
 END
 
+cat configure.stub - > configure.in <<'END'
+AC_OUTPUT
+END
+
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
@@ -50,6 +56,9 @@ grep '!Foo!' foo
 $MAKE distcheck
 
 rm -f foo
+
+# Modify just Makefile.am.
+
 $sleep
 
 cat > $srcdir/Makefile.am <<'END'
@@ -71,6 +80,9 @@ test ! -r foo
 $MAKE distcheck
 
 rm -f bar
+
+# Modify Makefile.am and configure.in.
+
 $sleep
 
 cat > $srcdir/Makefile.am <<'END'
@@ -82,12 +94,11 @@ check-local:
        test ! -r bar
 END
 
-mv -f $srcdir/configure.in configure.bak
-
-sed '/^AC_OUTPUT$/i\
-AC_CONFIG_FILES([quux])\
-AC_SUBST([QUUX], [Zardoz])' configure.bak >$srcdir/configure.in
-cat $srcdir/configure.in # for debugging
+cat $srcdir/configure.stub - > $srcdir/configure.in <<'END'
+AC_CONFIG_FILES([quux])
+AC_SUBST([QUUX], [Zardoz])
+AC_OUTPUT
+END
 
 cat > $srcdir/quux.in <<'END'
 address@hidden@!
@@ -100,10 +111,13 @@ test ! -f bar
 $MAKE distcheck
 
 rm -f quux
+
+# Modify Makefile.am to add a directory of extra m4 files
+# considered by aclocal.
+
 $sleep
 
 mkdir $srcdir/m4
-: > $srcdir/acinclude.m4
 
 cat > $srcdir/Makefile.am <<'END'
 ACLOCAL_AMFLAGS = -I m4
@@ -117,11 +131,15 @@ END
 $MAKE # this should place aclocal flags in Makefile
 grep '.*-I m4' Makefile # sanity check
 
+# Modify configure.in and aclocal.m4.
+
 $sleep
-sed '/^AC_OUTPUT$/i\
-AC_CONFIG_FILES([quux])\
-MY_CUSTOM_MACRO' configure.bak >$srcdir/configure.in
-cat $srcdir/configure.in # for debugging
+
+cat $srcdir/configure.stub - > $srcdir/configure.in <<'END'
+AC_CONFIG_FILES([quux])
+MY_CUSTOM_MACRO
+AC_OUTPUT
+END
 
 cat >> $srcdir/aclocal.m4 <<'END'
 AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Foo%])])
@@ -132,7 +150,13 @@ cat quux
 grep '%Foo%' quux
 $MAKE distcheck
 
+# Modify Makefile.am, remove aclocal.m4, and add a new m4 file to
+# the directory of extra m4 files considered by aclocal.  This new
+# file should now provide a macro required by configure.in and that
+# was previously provided by aclocal.m4.
+
 $sleep
+
 sed 's/%Foo%/%Bar%/g' $srcdir/Makefile.am > t
 mv -f t $srcdir/Makefile.am
 cat $srcdir/Makefile.am
@@ -146,8 +170,14 @@ cat quux
 grep '%Bar%' quux
 $MAKE distcheck
 
+# Modify Makefile.am, remove all the extra m4 files to considered
+# by aclocal, and add an acinclude.m4 file.  This last file should
+# now provide a macro required by configure.in, and that was
+# previously provided by the extra m4 files considered by aclocal.
+
 $sleep
-rm -f m4/*.m4
+
+rm -f $srcdir/m4/*.m4
 sed 's/%Bar%/%Quux%/g' $srcdir/Makefile.am > t
 mv -f t $srcdir/Makefile.am
 cat $srcdir/Makefile.am
diff --git a/tests/remake8b.test b/tests/remake8b.test
index 96a82ae..3861326 100755
--- a/tests/remake8b.test
+++ b/tests/remake8b.test
@@ -14,17 +14,19 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test basic remake rules for Makefiles, for in-tree builds
-# Keep this in sync with sister test `remake8a.test'.
+# Test basic remake rules for Makefiles, for a *VPATH build*.
+# This testcase checks dependency of generated Makefile from Makefile.am,
+# configure.ac, acinclude.m4, aclocal.m4, and extra m4 files considered
+# by aclocal.
+# Keep this in sync with sister test `remake8a.test', which performs the
+# same checks for a in-tree build.
 
 required=GNUmake
 . ./defs || Exit 1
 
 set -e
 
-cat >> configure.in <<'END'
-AC_OUTPUT
-END
+mv -f configure.in configure.stub
 
 cat > Makefile.am <<'END'
 all-local: foo
@@ -36,6 +38,10 @@ check-local:
 CLEANFILES = foo
 END
 
+cat configure.stub - > configure.in <<'END'
+AC_OUTPUT
+END
+
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
@@ -52,6 +58,9 @@ grep '!Foo!' foo
 $MAKE distcheck
 
 rm -f foo
+
+# Modify just Makefile.am.
+
 $sleep
 
 cat > $srcdir/Makefile.am <<'END'
@@ -73,6 +82,9 @@ test ! -r foo
 $MAKE distcheck
 
 rm -f bar
+
+# Modify Makefile.am and configure.in.
+
 $sleep
 
 cat > $srcdir/Makefile.am <<'END'
@@ -84,12 +96,11 @@ check-local:
        test ! -r bar
 END
 
-mv -f $srcdir/configure.in configure.bak
-
-sed '/^AC_OUTPUT$/i\
-AC_CONFIG_FILES([quux])\
-AC_SUBST([QUUX], [Zardoz])' configure.bak >$srcdir/configure.in
-cat $srcdir/configure.in # for debugging
+cat $srcdir/configure.stub - > $srcdir/configure.in <<'END'
+AC_CONFIG_FILES([quux])
+AC_SUBST([QUUX], [Zardoz])
+AC_OUTPUT
+END
 
 cat > $srcdir/quux.in <<'END'
 address@hidden@!
@@ -102,10 +113,13 @@ test ! -f bar
 $MAKE distcheck
 
 rm -f quux
+
+# Modify Makefile.am to add a directory of extra m4 files
+# considered by aclocal.
+
 $sleep
 
 mkdir $srcdir/m4
-: > $srcdir/acinclude.m4
 
 cat > $srcdir/Makefile.am <<'END'
 ACLOCAL_AMFLAGS = -I m4
@@ -119,11 +133,15 @@ END
 $MAKE # this should place aclocal flags in Makefile
 grep '.*-I m4' Makefile # sanity check
 
+# Modify configure.in and aclocal.m4.
+
 $sleep
-sed '/^AC_OUTPUT$/i\
-AC_CONFIG_FILES([quux])\
-MY_CUSTOM_MACRO' configure.bak >$srcdir/configure.in
-cat $srcdir/configure.in # for debugging
+
+cat $srcdir/configure.stub - > $srcdir/configure.in <<'END'
+AC_CONFIG_FILES([quux])
+MY_CUSTOM_MACRO
+AC_OUTPUT
+END
 
 cat >> $srcdir/aclocal.m4 <<'END'
 AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Foo%])])
@@ -134,7 +152,13 @@ cat quux
 grep '%Foo%' quux
 $MAKE distcheck
 
+# Modify Makefile.am, remove aclocal.m4, and add a new m4 file to
+# the directory of extra m4 files considered by aclocal.  This new
+# file should now provide a macro required by configure.in and that
+# was previously provided by aclocal.m4.
+
 $sleep
+
 sed 's/%Foo%/%Bar%/g' $srcdir/Makefile.am > t
 mv -f t $srcdir/Makefile.am
 cat $srcdir/Makefile.am
@@ -148,8 +172,14 @@ cat quux
 grep '%Bar%' quux
 $MAKE distcheck
 
+# Modify Makefile.am, remove all the extra m4 files to considered
+# by aclocal, and add an acinclude.m4 file.  This last file should
+# now provide a macro required by configure.in, and that was
+# previously provided by the extra m4 files considered by aclocal.
+
 $sleep
-rm -f m4/*.m4
+
+rm -f $srcdir/m4/*.m4
 sed 's/%Bar%/%Quux%/g' $srcdir/Makefile.am > t
 mv -f t $srcdir/Makefile.am
 cat $srcdir/Makefile.am
diff --git a/tests/remake9c.test b/tests/remake9c.test
index ae9b91c..19bd1f1 100755
--- a/tests/remake9c.test
+++ b/tests/remake9c.test
@@ -14,7 +14,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test remake rules when aclocal.m4 or its prerequisites change.
+# Test remake rules when acinclude.m4 or its prerequisites change.
 # Keep in sync with the other sister tests `remake9*.test'.
 
 required=GNUmake
From 3662825e5ec819265a3fd9067139942d9bc34e64 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Fri, 13 Aug 2010 11:50:31 +0200
Subject: [PATCH] Tests: extend checks on remake rules.

This adds proper semantical tests (i.e. run make to check the
rebuild rules are correctly triggered) in addition to tentative
grepping of the generated Makefile.in(s).

* tests/remake.test: Enable `errexit' shell flag, and related
changes.  Modernize `configure.in'.  Add trailing `:' command.
In heading comments, add reference to sister test remake1a.test.
* tests/remake3.test: Likewise (but with sister test being
remake3a.test).
* tests/remake2.test: Make grepping of `Makefile.in' slighty
stricter.
* tests/remake5.test: Also run the `distcheck' target.  Add
trailing `:' command.  Use proper m4 quoting in configure.in.
* tests/remake4.test: Prefer `$me' over hard-coded test name.
* tests/remake7.test: Use the `configure.in' stub created by
./defs, rather than writing it from scratch.
* tests/remake6.test: Likewise.  Also, add trailing `:' command,
and ensure verbose printing of captured make output.
* tests/remake1a.test: New test, sister of remake.test.
* tests/remake3a.test: New test, sister of remake3.test.
* tests/remake8a.test: New test.
* tests/remake8b.test: New test.
* tests/remake9a.test: Likewise.
* tests/remake9b.test: Likewise.
* tests/remake9c.test: Likewise.
* tests/remake9d.test: Likewise.
* tests/remake10a.test: Likewise.
* tests/remake10b.test: Likewise.
* tests/remake10c.test: Likewise.
* tests/remake11.test: Likewise.
* tests/remake12.test: Likewise.
* tests/Makefile.am (TESTS): Updated.
---
 ChangeLog            |   38 ++++++++++
 tests/Makefile.am    |   13 ++++
 tests/Makefile.in    |   13 ++++
 tests/remake.test    |   24 ++++--
 tests/remake10a.test |  108 ++++++++++++++++++++++++++++
 tests/remake10b.test |  107 +++++++++++++++++++++++++++
 tests/remake10c.test |  112 +++++++++++++++++++++++++++++
 tests/remake11.test  |   84 +++++++++++++++++++++
 tests/remake12.test  |  122 +++++++++++++++++++++++++++++++
 tests/remake1a.test  |   57 +++++++++++++++
 tests/remake2.test   |   26 +++++---
 tests/remake3.test   |   21 ++++--
 tests/remake3a.test  |   75 +++++++++++++++++++
 tests/remake4.test   |    6 +-
 tests/remake5.test   |    9 ++-
 tests/remake6.test   |   20 +++---
 tests/remake7.test   |   11 ++--
 tests/remake8a.test  |  193 +++++++++++++++++++++++++++++++++++++++++++++++++
 tests/remake8b.test  |  195 ++++++++++++++++++++++++++++++++++++++++++++++++++
 tests/remake9a.test  |  106 +++++++++++++++++++++++++++
 tests/remake9b.test  |  108 ++++++++++++++++++++++++++++
 tests/remake9c.test  |  109 ++++++++++++++++++++++++++++
 tests/remake9d.test  |  109 ++++++++++++++++++++++++++++
 23 files changed, 1623 insertions(+), 43 deletions(-)
 create mode 100755 tests/remake10a.test
 create mode 100755 tests/remake10b.test
 create mode 100755 tests/remake10c.test
 create mode 100755 tests/remake11.test
 create mode 100755 tests/remake12.test
 create mode 100755 tests/remake1a.test
 create mode 100755 tests/remake3a.test
 create mode 100755 tests/remake8a.test
 create mode 100755 tests/remake8b.test
 create mode 100755 tests/remake9a.test
 create mode 100755 tests/remake9b.test
 create mode 100755 tests/remake9c.test
 create mode 100755 tests/remake9d.test

diff --git a/ChangeLog b/ChangeLog
index e8864f1..474a3d5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,41 @@
+2010-12-06  Stefano Lattarini  <address@hidden>
+
+       Tests: extend checks on remake rules.
+       This adds proper semantical tests (i.e. run make to check the
+       rebuild rules are correctly triggered) in addition to tentative
+       grepping of the generated Makefile.in(s).
+       * tests/remake5.test: Also run the `distcheck' target.  Add
+       trailing `:' command.  Use proper m4 quoting in configure.in.
+       * tests/remake4.test: Prefer `$me' over hard-coded test name.
+       * tests/remake7.test: Use the `configure.in' stub created by
+       ./defs, rather than writing it from scratch.
+       * tests/remake6.test: Likewise.  Also, add trailing `:' command,
+       and ensure verbose printing of captured make output.
+       * tests/remake.test: Enable `errexit' shell flag, and related
+       changes.  Modernize `configure.in'.  Add trailing `:' command.
+       Improve heading comments, and add a reference to new sister test
+       remake1a.test.
+       * tests/remake3.test: Likewise (but with sister test being
+       remake3a.test).
+       * tests/remake2.test: Improve heading comments.  Enable `errexit'
+       shell flag, and related changes.  Modernize `configure.in'.  Make
+       grepping of `Makefile.in' slightly stricter.  Add trailing `:'
+       command.
+       * tests/remake1a.test: New test, sister of remake.test.
+       * tests/remake3a.test: New test, sister of remake3.test.
+       * tests/remake8a.test: New test.
+       * tests/remake8b.test: Likewise.
+       * tests/remake9a.test: Likewise.
+       * tests/remake9b.test: Likewise.
+       * tests/remake9c.test: Likewise.
+       * tests/remake9d.test: Likewise.
+       * tests/remake10a.test: Likewise.
+       * tests/remake10b.test: Likewise.
+       * tests/remake10c.test: Likewise.
+       * tests/remake11.test: Likewise.
+       * tests/remake12.test: Likewise.
+       * tests/Makefile.am (TESTS): Updated.
+
 2010-11-25  Stefano Lattarini  <address@hidden>
 
        Fix spurious failures in `silent*.test' for $CC != gcc
diff --git a/tests/Makefile.am b/tests/Makefile.am
index dab04e3..8b81932 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -614,12 +614,25 @@ python12.test \
 recurs.test \
 recurs2.test \
 remake.test \
+remake1a.test \
 remake2.test \
 remake3.test \
+remake3a.test \
 remake4.test \
 remake5.test \
 remake6.test \
 remake7.test \
+remake8a.test \
+remake8b.test \
+remake9a.test \
+remake9b.test \
+remake9c.test \
+remake9d.test \
+remake10a.test \
+remake10b.test \
+remake10c.test \
+remake11.test \
+remake12.test \
 regex.test \
 req.test \
 reqd.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index de21f43..0d494e7 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -881,12 +881,25 @@ python12.test \
 recurs.test \
 recurs2.test \
 remake.test \
+remake1a.test \
 remake2.test \
 remake3.test \
+remake3a.test \
 remake4.test \
 remake5.test \
 remake6.test \
 remake7.test \
+remake8a.test \
+remake8b.test \
+remake9a.test \
+remake9b.test \
+remake9c.test \
+remake9d.test \
+remake10a.test \
+remake10b.test \
+remake10c.test \
+remake11.test \
+remake12.test \
 regex.test \
 req.test \
 reqd.test \
diff --git a/tests/remake.test b/tests/remake.test
index 9c86b1b..4d3036b 100755
--- a/tests/remake.test
+++ b/tests/remake.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 2000, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 2000, 2001, 2002, 2010 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
@@ -14,20 +15,27 @@
 # 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 remaking rules in subdir are correctly generated.
+# Weak "grepping" test trying to ensure that remaking rules in a subdir
+# are correctly generated.
+# See also sister functional test `remake1a.test'.
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(sub/Makefile)
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
 END
 
 mkdir sub
 : > sub/Makefile.am
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep '^Makefile' sub/Makefile.in
+
+:
diff --git a/tests/remake10a.test b/tests/remake10a.test
new file mode 100755
index 0000000..67b9e14
--- /dev/null
+++ b/tests/remake10a.test
@@ -0,0 +1,108 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test remake rules for m4 files included (also recursively) by
+# configure.ac.
+# Keep in sync with sister tests `remake10b.test' and `remake10c.test'.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+hash1=7532aa4708e8320c8c7098a5e3a1ec88aafb074f
+hash2=99368830db9954b4d9fecd04d3996d9acea7129f
+hash3=36fe4f389c0a835dfcdb0f58a8909eab43189af1
+
+cat >> configure.in <<END
+m4_include([foo.m4])
+AC_SUBST([am_fingerprint], [m4_fingerprint])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+.PHONY: nil
+nil:
+## Used by "make distcheck" later.
+check-local:
+       test -f $(top_srcdir)/foo.m4
+       test ! -r $(top_srcdir)/bar.m4
+       test x'$(am_fingerprint)' = x'DummyValue'
+END
+
+echo 'm4_define([m4_fingerprint], [BadBadBad])' > foo.m4
+
+$sleep # so that generated autotools files will be older than prerequisites
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+for vpath in : false; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    top_srcdir=..
+  else
+    top_srcdir=.
+  fi
+
+  $top_srcdir/configure
+  $MAKE # should be no-op
+
+  $sleep
+  echo "m4_define([m4_fingerprint], [$hash1])" > $top_srcdir/foo.m4
+  $MAKE nil
+  $FGREP am_fingerprint Makefile # for debugging
+  $FGREP $hash1 Makefile
+
+  $sleep
+  echo "m4_define([m4_fingerprint], [$hash2])" > $top_srcdir/foo.m4
+  $MAKE nil
+  $FGREP am_fingerprint Makefile # for debugging
+  $FGREP $hash1 Makefile && Exit 1
+  $FGREP $hash2 Makefile
+
+  $sleep
+  echo "m4_include([bar.m4])" > $top_srcdir/foo.m4
+  echo "m4_define([m4_fingerprint], [$hash3])" > $top_srcdir/bar.m4
+  $MAKE nil
+  $FGREP am_fingerprint Makefile # for debugging
+  $FGREP $hash1 Makefile && Exit 1
+  $FGREP $hash2 Makefile && Exit 1
+  $FGREP $hash3 Makefile
+
+  $sleep
+  echo "m4_define([m4_fingerprint], [$hash1])" > $top_srcdir/bar.m4
+  $MAKE nil
+  $FGREP $hash2 Makefile && Exit 1
+  $FGREP $hash3 Makefile && Exit 1
+  $FGREP $hash1 Makefile
+
+  $sleep
+  echo "m4_define([m4_fingerprint], [DummyValue])" > $top_srcdir/foo.m4
+  $MAKE distcheck
+  $FGREP $hash1 Makefile && Exit 1 # sanity check
+  $FGREP $hash2 Makefile && Exit 1 # likewise
+  $FGREP $hash3 Makefile && Exit 1 # likewise
+
+  $MAKE distclean
+
+  cd $top_srcdir
+
+done
+
+:
diff --git a/tests/remake10b.test b/tests/remake10b.test
new file mode 100755
index 0000000..2e81db6
--- /dev/null
+++ b/tests/remake10b.test
@@ -0,0 +1,107 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test remake rules for am files included (also recursively) by
+# Makefile.am.
+# Keep in sync with sister tests `remake10a.test' and `remake10c.test'.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+hash1=7532aa4708e8320c8c7098a5e3a1ec88aafb074f
+hash2=99368830db9954b4d9fecd04d3996d9acea7129f
+hash3=36fe4f389c0a835dfcdb0f58a8909eab43189af1
+
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+.PHONY: nil
+nil:
+include foo.am
+## Used by "make distcheck" later.
+check-local:
+       test -f $(top_srcdir)/foo.am
+       test ! -r $(top_srcdir)/bar.am
+       test x'$(am_fingerprint)' = x'DummyValue'
+END
+
+echo 'am_fingerprint = BadBadBad' > foo.am
+
+$sleep # so that generated autotools files will be older than prerequisites
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+for vpath in : false; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    top_srcdir=..
+  else
+    top_srcdir=.
+  fi
+
+  $top_srcdir/configure
+  $MAKE # should be no-op
+
+  $sleep
+  echo "am_fingerprint = $hash1" > $top_srcdir/foo.am
+  $MAKE nil
+  $FGREP am_fingerprint Makefile # for debugging
+  $FGREP $hash1 Makefile
+
+  $sleep
+  echo "am_fingerprint = $hash2" > $top_srcdir/foo.am
+  $MAKE nil
+  $FGREP am_fingerprint Makefile # for debugging
+  $FGREP $hash1 Makefile && Exit 1
+  $FGREP $hash2 Makefile
+
+  $sleep
+  echo 'include $(top_srcdir)/bar.am' > $top_srcdir/foo.am
+  echo "am_fingerprint = $hash3" > $top_srcdir/bar.am
+  $MAKE nil
+  $FGREP am_fingerprint Makefile # for debugging
+  $FGREP $hash1 Makefile && Exit 1
+  $FGREP $hash2 Makefile && Exit 1
+  $FGREP $hash3 Makefile
+
+  $sleep
+  echo "am_fingerprint = $hash1" > $top_srcdir/bar.am
+  $MAKE nil
+  $FGREP $hash2 Makefile && Exit 1
+  $FGREP $hash3 Makefile && Exit 1
+  $FGREP $hash1 Makefile
+
+  $sleep
+  echo "am_fingerprint = DummyValue" > $top_srcdir/foo.am
+  $MAKE distcheck
+  $FGREP $hash1 Makefile && Exit 1 # sanity check
+  $FGREP $hash2 Makefile && Exit 1 # likewise
+  $FGREP $hash3 Makefile && Exit 1 # likewise
+
+  $MAKE distclean
+
+  cd $top_srcdir
+
+done
+
+:
diff --git a/tests/remake10c.test b/tests/remake10c.test
new file mode 100755
index 0000000..98c13c5
--- /dev/null
+++ b/tests/remake10c.test
@@ -0,0 +1,112 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test remake rules for m4 files included (also recursively) by
+# aclocal.m4.
+# Keep in sync with sister tests `remake10a.test' and `remake10b.test'.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+hash1=7532aa4708e8320c8c7098a5e3a1ec88aafb074f
+hash2=99368830db9954b4d9fecd04d3996d9acea7129f
+hash3=36fe4f389c0a835dfcdb0f58a8909eab43189af1
+
+cat >> configure.in <<END
+am_fingerprint='AM_FINGERPRINT'
+AC_SUBST([am_fingerprint])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I m4
+.PHONY: nil
+nil:
+## Used by "make distcheck" later.
+check-local:
+       test -f $(top_srcdir)/m4/foo.m4
+       test ! -r $(top_srcdir)/m4/bar.m4
+       test x'$(am_fingerprint)' = x'DummyValue'
+END
+
+mkdir m4
+echo 'AC_DEFUN([AM_FINGERPRINT], [BadBadBad])' > m4/foo.m4
+
+$sleep # so that generated autotools files will be older than prerequisites
+$ACLOCAL -I m4
+$AUTOCONF
+$AUTOMAKE
+
+for vpath in : false; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    top_srcdir=..
+  else
+    top_srcdir=.
+  fi
+
+  $top_srcdir/configure
+  $MAKE # should be no-op
+
+  $sleep
+  echo "AC_DEFUN([AM_FINGERPRINT], [$hash1])" > $top_srcdir/m4/foo.m4
+  $MAKE nil
+  $FGREP am_fingerprint Makefile # for debugging
+  $FGREP $hash1 Makefile
+
+  $sleep
+  echo "AC_DEFUN([AM_FINGERPRINT], [$hash2])" > $top_srcdir/m4/foo.m4
+  $MAKE nil
+  $FGREP am_fingerprint Makefile # for debugging
+  $FGREP $hash1 Makefile && Exit 1
+  $FGREP $hash2 Makefile
+
+  $sleep
+  echo "m4_include([m4/bar.m4])" > $top_srcdir/m4/foo.m4
+  echo "AC_DEFUN([AM_FINGERPRINT], [$hash3])" > $top_srcdir/m4/bar.m4
+  $MAKE nil
+  $FGREP am_fingerprint Makefile # for debugging
+  $FGREP $hash1 Makefile && Exit 1
+  $FGREP $hash2 Makefile && Exit 1
+  $FGREP $hash3 Makefile
+
+  $sleep
+  echo "AC_DEFUN([AM_FINGERPRINT], [$hash1])" > $top_srcdir/m4/bar.m4
+  $MAKE nil
+  $FGREP $hash2 Makefile && Exit 1
+  $FGREP $hash3 Makefile && Exit 1
+  $FGREP $hash1 Makefile
+
+  $sleep
+  echo "AC_DEFUN([AM_FINGERPRINT], [DummyValue])" > $top_srcdir/m4/foo.m4
+  echo "AC_DEFUN([AM_UNUSED], [NoSuchMacro])" > $top_srcdir/m4/bar.m4
+  $MAKE nil # required to work around limitation of GNU make 3.82
+  $MAKE distcheck
+  $FGREP $hash1 Makefile && Exit 1 # sanity check
+  $FGREP $hash2 Makefile && Exit 1 # likewise
+  $FGREP $hash3 Makefile && Exit 1 # likewise
+
+  $MAKE distclean
+
+  cd $top_srcdir
+
+done
+
+:
diff --git a/tests/remake11.test b/tests/remake11.test
new file mode 100755
index 0000000..7754867
--- /dev/null
+++ b/tests/remake11.test
@@ -0,0 +1,84 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test remake rules in deeply nested subdirectories, and with a lot
+# of files.  This is basically a mild stress test, ensuring that rebuild
+# rules don't break in obvious ways in a slightly "heavier than usual"
+# setup.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+ocwd=`pwd` || Exit 1
+
+hash1=7532aa4708e8320c8c7098a5e3a1ec88aafb074f
+hash2=99368830db9954b4d9fecd04d3996d9acea7129f
+
+echo "AC_SUBST([FOO], [$hash1])" >> configure.in
+
+echo "@FOO@" > bar.in
+echo "AC_CONFIG_FILES([bar])" >> configure.in
+for i in 0 1 2 3 4 5 6 7 8 9; do
+  d=${d+"$d/"}sub$i
+  echo "SUBDIRS = sub$i" > Makefile.am
+  echo "AC_CONFIG_FILES([$d/Makefile])" >> "$ocwd"/configure.in
+  echo "AC_CONFIG_FILES([$d/bar])" >> "$ocwd"/configure.in
+  mkdir sub$i
+  cd sub$i
+  echo "$d: @FOO@" > bar.in
+done
+echo AC_OUTPUT >> "$ocwd"/configure.in
+: > Makefile.am
+unset d i
+bottom=`pwd`
+
+cd "$ocwd"
+
+makefiles_am_list=`find . -name Makefile.am | LC_ALL=C sort`
+makefiles_list=`echo "$makefiles_am_list" | sed 's/\.am$//'`
+bar_in_list=`find . -name bar.in | LC_ALL=C sort`
+bar_list=`echo "$bar_in_list" | sed 's/\.in$//'`
+
+cat configure.in # useful for debugging
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+
+for f in configure config.status $makefiles_list $bar_list; do
+  $FGREP "$hash1" $f
+done
+
+$sleep
+sed "s/$hash1/$hash2/" configure.in >configure.tmp
+mv -f configure.tmp configure.in
+
+cd "$bottom"
+$MAKE
+cd "$ocwd"
+
+for f in configure config.status $makefiles_list $bar_list; do
+  $FGREP "$hash2" $f
+done
+$FGREP "$hash1" configure config.status $makefiles_list $bar_list && Exit 1
+
+$MAKE distcheck
+
+:
diff --git a/tests/remake12.test b/tests/remake12.test
new file mode 100755
index 0000000..f031a96
--- /dev/null
+++ b/tests/remake12.test
@@ -0,0 +1,122 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test basic remake rules for Makefiles with non-default names
+# and/or with multiple sources.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+hash1=7532aa4708e8320c8c7098a5e3a1ec88aafb074f
+hash2=99368830db9954b4d9fecd04d3996d9acea7129f
+hash3=36fe4f389c0a835dfcdb0f58a8909eab43189af1
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([zardoz])
+AC_CONFIG_LINKS([Makefile:Makefile])
+AC_OUTPUT
+END
+
+cat > zardoz.am <<END
+EXTRA_DIST = Makefile
+#H: $hash1
+END
+
+cat > Makefile <<END
+include zardoz
+nil:
+.PHONY: nil
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE nil
+grep '^#H:' zardoz.in # for debugging
+$FGREP $hash1 zardoz
+$FGREP $hash1 zardoz.in
+$MAKE distcheck
+$MAKE distclean # this shouldn't remove Makefile
+ls -l
+test -f Makefile
+
+./configure
+
+$sleep
+sed "s/%HASH3%/$hash3/" >> Makefile <<'END'
+my-check:
+       ls -l . $(srcdir) ;: for debugging
+       test -f $(srcdir)/quux.am
+       test -f $(srcdir)/quux.in
+       test -f $(srcdir)/bot.in
+       test -f $(srcdir)/top.in
+       test ! -r $(srcdir)/zardoz.am
+       test ! -r $(srcdir)/zardoz.in
+       grep FOO zardoz ;: for debugging
+       test x'$(FOO)' = x'%HASH3%'
+test:
+       ls -l ;: for debugging
+       test x'$(FOO)' = x'dummy'
+.PHONY: test my-check
+END
+sed "s/^#H:.*/#H: $hash2/" zardoz.am > t
+cat >> t <<'END'
+# used by "make distcheck" below
+check-local: my-check
+END
+mv -f t zardoz.am
+cat zardoz.am # for debugging
+$MAKE nil
+$FGREP my-check zardoz # sanity check
+$FGREP $hash1 zardoz zardoz.in && Exit 1
+$FGREP $hash2 zardoz
+$FGREP $hash2 zardoz.in
+
+./configure
+
+$sleep
+sed 's/^\(AC_CONFIG_FILES\)(.*/\1([zardoz:top.in:quux.in:bot.in])/' \
+  <configure.in >t
+mv -f t configure.in
+cat configure.in # for debugging
+sed '/^#H:/d' zardoz.am > quux.am
+echo 'FOO = dummy' >> quux.am
+echo 'BAR = $(BAZ)' > top.in
+echo "BAZ = $hash3" > bot.in
+$MAKE test
+$FGREP my-check zardoz # sanity check
+$FGREP $hash3 quux.in && Exit 1
+$FGREP $hash3 zardoz
+$FGREP $hash1 zardoz && Exit 1
+$FGREP $hash2 zardoz && Exit 1
+# After the remake above, the files `zardoz.am' and `zardoz.in'
+# should be no more needed
+echo 'endif' > zardoz.am # put in syntax error
+$MAKE test
+rm -f zardoz.in zardoz.am # get rid of them
+$MAKE test
+
+echo 'FOO = $(BAR)' >> quux.am
+$MAKE distcheck
+
+:
diff --git a/tests/remake1a.test b/tests/remake1a.test
new file mode 100755
index 0000000..ce80c19
--- /dev/null
+++ b/tests/remake1a.test
@@ -0,0 +1,57 @@
+#! /bin/sh
+# Copyright (C) 2010 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 remaking rules in subdir are correctly generated.
+# See also sister "grepping" test `remake.test'.
+
+. ./defs || Exit 1
+
+fingerprint='=/FiNgErPrInT/='
+
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
+END
+
+mkdir sub
+: > sub/Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+# Rebuild rules should work even if there is no top-level
+# makefiles, if we are careful enough to trigger them only
+# in proper subdirs
+$sleep
+echo "# $fingerprint" > sub/Makefile.am
+cd sub
+$MAKE Makefile
+cd ..
+# Check that no spurious Makefile has been created in the
+# top-level directory.
+test ! -r Makefile
+# Check that the Makefile in the subdirectory has been properly
+# updated.
+$FGREP "$fingerprint" sub/Makefile
+
+:
diff --git a/tests/remake2.test b/tests/remake2.test
index 3b63dea..452e951 100755
--- a/tests/remake2.test
+++ b/tests/remake2.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2000, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2000, 2001, 2002, 2010 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
@@ -14,20 +15,27 @@
 # 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 remaking rules in subdir are correct.
+# Weak "grepping" test trying to ensure that remaking rules in subdir
+# are correct even when there is no upper-level Makefile.
+# TODO: we should really add also functional tests for this!
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(sub/Makefile)
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
 END
 
 mkdir sub
 : > sub/Makefile.am
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
+
+grep '\$(AUTOMAKE).*sub/Makefile' sub/Makefile.in
 
-grep 'AUTOMAKE.*sub/Makefile' sub/Makefile.in
+:
diff --git a/tests/remake3.test b/tests/remake3.test
index 08ec16a..708dca8 100755
--- a/tests/remake3.test
+++ b/tests/remake3.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 2001, 2002, 2010 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
@@ -14,14 +14,17 @@
 # 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 remaking rules work when there is no subdir Makefile.
+# Weak "grepping" test trying to ensure that remake rules work for files
+# in a subdirectory even when there is no Makefile for that subdirectory.
+# See also sister functional test `remake3a.test'.
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(Makefile sub/foo)
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([sub/foo])
+AC_OUTPUT
 END
 
 : > Makefile.am
@@ -29,7 +32,9 @@ END
 mkdir sub
 : > sub/foo.in
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
 
 grep '^sub/foo' Makefile.in
+
+:
diff --git a/tests/remake3a.test b/tests/remake3a.test
new file mode 100755
index 0000000..a58c462
--- /dev/null
+++ b/tests/remake3a.test
@@ -0,0 +1,75 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Ensure that remake rules work for files in a subdirectory even when
+# there is no Makefile for that subdirectory.
+# See also sister "grepping" test `remake3.test'.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([sub/foo])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+all-local: sub/foo
+END
+
+mkdir sub
+: > sub/foo.in
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+# First a VPATH build.
+mkdir build
+cd build
+../configure
+$sleep
+test -f sub/foo
+test ! -s sub/foo
+echo '#GrepMe#' > ../sub/foo.in
+$MAKE
+grep '#GrepMe#' sub/foo
+
+cd ..
+
+# Now try an in-tree build.
+: > sub/foo.in # restore its original (empty) content
+./configure
+$sleep
+test -f sub/foo
+test ! -s sub/foo
+echo '#GrepMe#' > sub/foo.in
+$MAKE
+grep '#GrepMe#' sub/foo
+
+# Finally try to check the distribution.
+$sleep
+echo '%GrepMe%' > sub/foo.in
+cat >>Makefile.am <<END
+check-local:
+       grep '%GrepMe%' sub/foo
+END
+$MAKE
+grep "grep '%GrepMe%' sub/foo" Makefile.in # sanity check
+$MAKE distcheck
+
+:
diff --git a/tests/remake4.test b/tests/remake4.test
index d6dbed7..0621c90 100755
--- a/tests/remake4.test
+++ b/tests/remake4.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2010 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
@@ -50,7 +50,9 @@ $MAKE
 $sleep
 touch aclocal.m4
 $MAKE distdir
-cd remake4-1.0
+cd $me-1.0
 test ! -f rebuild_ok
 ./configure
 $MAKE
+
+:
diff --git a/tests/remake5.test b/tests/remake5.test
index d353632..133f9a0 100755
--- a/tests/remake5.test
+++ b/tests/remake5.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003  Free Software Foundation, Inc.
+# Copyright (C) 2003, 2010 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
@@ -25,7 +25,7 @@ set -e
 
 cat >>configure.in <<'EOF'
 AM_MAINTAINER_MODE
-m4_include(foo.m4)
+m4_include([foo.m4])
 if test ! -f rebuild_ok; then
   ACLOCAL=false
   AUTOMAKE=false
@@ -70,3 +70,8 @@ $sleep
 echo 'AC_SUBST([YIPPY_YIPPY_YEAH])' >foo.m4
 $MAKE
 grep YIPPY_YIPPY_YEAH Makefile
+
+# Try the distribution, for completeness.
+$MAKE distcheck
+
+:
diff --git a/tests/remake6.test b/tests/remake6.test
index a25e486..885bcb4 100755
--- a/tests/remake6.test
+++ b/tests/remake6.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 2010 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
@@ -17,12 +17,12 @@
 # Make sure remaking rules work when subdir Makefile.in has been removed.
 
 . ./defs || Exit 1
+
 set -e
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(Makefile sub/Makefile)
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
@@ -42,23 +42,25 @@ $MAKE
 # only.
 
 rm -f Makefile.in
-$MAKE >stdout
+$MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 test `grep -c " --run " stdout` -eq 1
 
 rm -f sub/Makefile.in
-$MAKE >stdout
+$MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 test `grep -c " --run " stdout` -eq 1
 
 $sleep  # Let touched files appear newer.
 
 touch Makefile.am
-$MAKE >stdout
+$MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 test `grep -c " --run " stdout` -eq 1
 
 touch sub/Makefile.am
-$MAKE >stdout
+$MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 test `grep -c " --run " stdout` -eq 1
+
+:
diff --git a/tests/remake7.test b/tests/remake7.test
index 670f60b..66d4b9c 100755
--- a/tests/remake7.test
+++ b/tests/remake7.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2008  Free Software Foundation, Inc.
+# Copyright (C) 2008, 2010 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
@@ -17,12 +17,12 @@
 # Make sure remaking rules fail when they should.
 
 . ./defs || Exit 1
+
 set -e
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(Makefile sub/Makefile)
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([sub/Makefile])
+AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
@@ -67,4 +67,5 @@ $MAKE && Exit 1
 
 rm -f Makefile.in
 $MAKE && Exit 1
+
 :
diff --git a/tests/remake8a.test b/tests/remake8a.test
new file mode 100755
index 0000000..96fcc08
--- /dev/null
+++ b/tests/remake8a.test
@@ -0,0 +1,193 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test basic remake rules for Makefiles, for an *in-tree build*.
+# This testcase checks dependency of generated Makefile from Makefile.am,
+# configure.ac, acinclude.m4, aclocal.m4, and extra m4 files considered
+# by aclocal.
+# Keep this in sync with sister test `remake8b.test', which performs the
+# same checks for a VPATH build.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+mv -f configure.in configure.stub
+
+cat > Makefile.am <<'END'
+all-local: foo
+foo:
+       echo '!Foo!' >$@
+check-local:
+       cat foo
+       grep '!Foo!' foo
+CLEANFILES = foo
+END
+
+cat configure.stub - > configure.in <<'END'
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+srcdir='.' # to make syncing with remake8b.test easier.
+
+$srcdir/configure
+
+$MAKE
+cat foo
+grep '!Foo!' foo
+$MAKE distcheck
+
+rm -f foo
+
+# Modify just Makefile.am.
+
+$sleep
+
+cat > $srcdir/Makefile.am <<'END'
+all-local: bar
+bar:
+       echo '!Baz!' >$@
+check-local:
+       cat bar
+       grep '!Baz!' bar
+       test ! -r $(srcdir)/foo
+       test ! -r foo
+CLEANFILES = bar
+END
+
+$MAKE
+cat bar
+grep '!Baz!' bar
+test ! -r foo
+$MAKE distcheck
+
+rm -f bar
+
+# Modify Makefile.am and configure.in.
+
+$sleep
+
+cat > $srcdir/Makefile.am <<'END'
+all-local: quux
+check-local:
+       cat quux
+       grep '!Zardoz!' quux
+       test ! -r $(srcdir)/bar
+       test ! -r bar
+END
+
+cat $srcdir/configure.stub - > $srcdir/configure.in <<'END'
+AC_CONFIG_FILES([quux])
+AC_SUBST([QUUX], [Zardoz])
+AC_OUTPUT
+END
+
+cat > $srcdir/quux.in <<'END'
address@hidden@!
+END
+
+$MAKE
+cat quux
+grep '!Zardoz!' quux
+test ! -f bar
+$MAKE distcheck
+
+rm -f quux
+
+# Modify Makefile.am to add a directory of extra m4 files
+# considered by aclocal.
+
+$sleep
+
+mkdir $srcdir/m4
+
+cat > $srcdir/Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I m4
+all-local: quux
+check-local:
+       cat quux
+       grep '%Foo%' quux
+       test x'$(QUUX)' = x'%Foo%'
+END
+
+$MAKE # this should place aclocal flags in Makefile
+grep '.*-I m4' Makefile # sanity check
+
+# Modify configure.in and aclocal.m4.
+
+$sleep
+
+cat $srcdir/configure.stub - > $srcdir/configure.in <<'END'
+AC_CONFIG_FILES([quux])
+MY_CUSTOM_MACRO
+AC_OUTPUT
+END
+
+cat >> $srcdir/aclocal.m4 <<'END'
+AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Foo%])])
+END
+
+$MAKE
+cat quux
+grep '%Foo%' quux
+$MAKE distcheck
+
+# Modify Makefile.am, remove aclocal.m4, and add a new m4 file to
+# the directory of extra m4 files considered by aclocal.  This new
+# file should now provide a macro required by configure.in and that
+# was previously provided by aclocal.m4.
+
+$sleep
+
+sed 's/%Foo%/%Bar%/g' $srcdir/Makefile.am > t
+mv -f t $srcdir/Makefile.am
+cat $srcdir/Makefile.am
+rm -f $srcdir/aclocal.m4
+cat > $srcdir/m4/blah.m4 <<'END'
+AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Bar%])])
+END
+
+$MAKE
+cat quux
+grep '%Bar%' quux
+$MAKE distcheck
+
+# Modify Makefile.am, remove all the extra m4 files to considered
+# by aclocal, and add an acinclude.m4 file.  This last file should
+# now provide a macro required by configure.in, and that was
+# previously provided by the extra m4 files considered by aclocal.
+
+$sleep
+
+rm -f $srcdir/m4/*.m4
+sed 's/%Bar%/%Quux%/g' $srcdir/Makefile.am > t
+mv -f t $srcdir/Makefile.am
+cat $srcdir/Makefile.am
+cat > $srcdir/acinclude.m4 <<'END'
+AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Quux%])])
+END
+
+$MAKE
+cat quux
+grep '%Quux%' quux
+$MAKE distcheck
+
+:
diff --git a/tests/remake8b.test b/tests/remake8b.test
new file mode 100755
index 0000000..3861326
--- /dev/null
+++ b/tests/remake8b.test
@@ -0,0 +1,195 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test basic remake rules for Makefiles, for a *VPATH build*.
+# This testcase checks dependency of generated Makefile from Makefile.am,
+# configure.ac, acinclude.m4, aclocal.m4, and extra m4 files considered
+# by aclocal.
+# Keep this in sync with sister test `remake8a.test', which performs the
+# same checks for a in-tree build.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+mv -f configure.in configure.stub
+
+cat > Makefile.am <<'END'
+all-local: foo
+foo:
+       echo '!Foo!' >$@
+check-local:
+       cat foo
+       grep '!Foo!' foo
+CLEANFILES = foo
+END
+
+cat configure.stub - > configure.in <<'END'
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+mkdir build
+cd build
+srcdir='..' # to make syncing with remake8a.test easier.
+
+$srcdir/configure
+
+$MAKE
+cat foo
+grep '!Foo!' foo
+$MAKE distcheck
+
+rm -f foo
+
+# Modify just Makefile.am.
+
+$sleep
+
+cat > $srcdir/Makefile.am <<'END'
+all-local: bar
+bar:
+       echo '!Baz!' >$@
+check-local:
+       cat bar
+       grep '!Baz!' bar
+       test ! -r $(srcdir)/foo
+       test ! -r foo
+CLEANFILES = bar
+END
+
+$MAKE
+cat bar
+grep '!Baz!' bar
+test ! -r foo
+$MAKE distcheck
+
+rm -f bar
+
+# Modify Makefile.am and configure.in.
+
+$sleep
+
+cat > $srcdir/Makefile.am <<'END'
+all-local: quux
+check-local:
+       cat quux
+       grep '!Zardoz!' quux
+       test ! -r $(srcdir)/bar
+       test ! -r bar
+END
+
+cat $srcdir/configure.stub - > $srcdir/configure.in <<'END'
+AC_CONFIG_FILES([quux])
+AC_SUBST([QUUX], [Zardoz])
+AC_OUTPUT
+END
+
+cat > $srcdir/quux.in <<'END'
address@hidden@!
+END
+
+$MAKE
+cat quux
+grep '!Zardoz!' quux
+test ! -f bar
+$MAKE distcheck
+
+rm -f quux
+
+# Modify Makefile.am to add a directory of extra m4 files
+# considered by aclocal.
+
+$sleep
+
+mkdir $srcdir/m4
+
+cat > $srcdir/Makefile.am <<'END'
+ACLOCAL_AMFLAGS = -I m4
+all-local: quux
+check-local:
+       cat quux
+       grep '%Foo%' quux
+       test x'$(QUUX)' = x'%Foo%'
+END
+
+$MAKE # this should place aclocal flags in Makefile
+grep '.*-I m4' Makefile # sanity check
+
+# Modify configure.in and aclocal.m4.
+
+$sleep
+
+cat $srcdir/configure.stub - > $srcdir/configure.in <<'END'
+AC_CONFIG_FILES([quux])
+MY_CUSTOM_MACRO
+AC_OUTPUT
+END
+
+cat >> $srcdir/aclocal.m4 <<'END'
+AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Foo%])])
+END
+
+$MAKE
+cat quux
+grep '%Foo%' quux
+$MAKE distcheck
+
+# Modify Makefile.am, remove aclocal.m4, and add a new m4 file to
+# the directory of extra m4 files considered by aclocal.  This new
+# file should now provide a macro required by configure.in and that
+# was previously provided by aclocal.m4.
+
+$sleep
+
+sed 's/%Foo%/%Bar%/g' $srcdir/Makefile.am > t
+mv -f t $srcdir/Makefile.am
+cat $srcdir/Makefile.am
+rm -f $srcdir/aclocal.m4
+cat > $srcdir/m4/blah.m4 <<'END'
+AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Bar%])])
+END
+
+$MAKE
+cat quux
+grep '%Bar%' quux
+$MAKE distcheck
+
+# Modify Makefile.am, remove all the extra m4 files to considered
+# by aclocal, and add an acinclude.m4 file.  This last file should
+# now provide a macro required by configure.in, and that was
+# previously provided by the extra m4 files considered by aclocal.
+
+$sleep
+
+rm -f $srcdir/m4/*.m4
+sed 's/%Bar%/%Quux%/g' $srcdir/Makefile.am > t
+mv -f t $srcdir/Makefile.am
+cat $srcdir/Makefile.am
+cat > $srcdir/acinclude.m4 <<'END'
+AC_DEFUN([MY_CUSTOM_MACRO], [AC_SUBST([QUUX], [%Quux%])])
+END
+
+$MAKE
+cat quux
+grep '%Quux%' quux
+$MAKE distcheck
+
+:
diff --git a/tests/remake9a.test b/tests/remake9a.test
new file mode 100755
index 0000000..1d714dd
--- /dev/null
+++ b/tests/remake9a.test
@@ -0,0 +1,106 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test remake rules when configure.in or its prerequisites change.
+# Keep in sync with the other sister tests `remake9*.test'.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+hash1=7532aa4708e8320c8c7098a5e3a1ec88aafb074f
+hash2=99368830db9954b4d9fecd04d3996d9acea7129f
+
+cat >> configure.in <<END
+am_fingerprint=BadBadBad
+AC_SUBST([am_fingerprint])
+AC_CONFIG_FILES([foo.sh:foo.in], [chmod a+x foo.sh])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+nil:
+.PHONY: nil
+
+$(srcdir)/configure.in: $(srcdir)/tweak-configure-in
+       $(SHELL) $(srcdir)/tweak-configure-in <$@ >address@hidden
+       mv -f address@hidden $@
+EXTRA_DIST = $(srcdir)/tweak-configure-in
+
+# Used by "make distcheck" later.
+check-local:
+       test x'$(am_fingerprint)' = x'DummyValue'
+       test x"`./foo.sh`" = x"DummyValue"
+END
+
+cat > foo.in <<END
+#!/bin/sh
+echo '@am_fingerprint@'
+END
+
+echo cat > tweak-configure-in # no-op by default
+
+$sleep # so that generated autotools files will be older than prerequisites
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+for vpath in : false; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+  $MAKE # should be no-op
+
+  $sleep
+  sed "s/^\\(am_fingerprint\\)=.*/\\1=$hash1/" $srcdir/configure.in >t
+  mv -f t $srcdir/configure.in
+  $MAKE nil
+  $FGREP am_fingerprint Makefile # for debugging
+  $FGREP $hash1 Makefile
+  test x"`./foo.sh`" = x"$hash1"
+
+  $sleep
+  echo 'sed "s/^\\(am_fingerprint\\)=.*/\\1='$hash2'/"' \
+    > $srcdir/tweak-configure-in
+  $MAKE nil
+  $FGREP am_fingerprint Makefile # for debugging
+  $FGREP $hash1 Makefile && Exit 1
+  $FGREP $hash2 Makefile
+  test x"`./foo.sh`" = x"$hash2"
+
+  $sleep
+  echo cat > $srcdir/tweak-configure-in # no-op again
+  sed "s/^\\(am_fingerprint\\)=.*/\\1=DummyValue/" $srcdir/configure.in >t
+  mv -f t $srcdir/configure.in
+  $MAKE distcheck
+  $FGREP $hash1 Makefile && Exit 1 # sanity check
+  $FGREP $hash2 Makefile && Exit 1 # likewise
+
+  $MAKE distclean
+
+  cd $srcdir
+
+done
+
+:
diff --git a/tests/remake9b.test b/tests/remake9b.test
new file mode 100755
index 0000000..041db04
--- /dev/null
+++ b/tests/remake9b.test
@@ -0,0 +1,108 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test remake rules when Makefile.am or its prerequisites change.
+# Keep in sync with the other sister tests `remake9*.test'.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+hash1=7532aa4708e8320c8c7098a5e3a1ec88aafb074f
+hash2=99368830db9954b4d9fecd04d3996d9acea7129f
+
+cat >> configure.in <<END
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+am_fingerprint = BadBadBad
+
+all-local: nil
+nil: foo.sh
+.PHONY: nil
+
+$(srcdir)/Makefile.am: $(srcdir)/tweak-makefile-am
+       $(SHELL) $(srcdir)/tweak-makefile-am <$@ >address@hidden
+       mv -f address@hidden $@
+EXTRA_DIST = $(srcdir)/tweak-makefile-am
+
+foo.sh: Makefile
+       rm -f $@ address@hidden
+       echo '#!/bin/sh' > address@hidden
+       echo "echo '$(am_fingerprint)'" >> address@hidden
+       chmod a+x address@hidden && mv -f address@hidden $@
+CLEANFILES = foo.sh
+
+# Used by "make distcheck" later.
+check-local:
+       test x'$(am_fingerprint)' = x'DummyValue'
+       test x"`./foo.sh`" = x"DummyValue"
+END
+
+echo cat > tweak-makefile-am # no-op by default
+
+$sleep # so that generated autotools files will be older than prerequisites
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+for vpath in : false; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+  $MAKE # should be no-op
+
+  $sleep
+  sed "s/^\\(am_fingerprint\\) *=.*/\\1 = $hash1/" $srcdir/Makefile.am >t
+  mv -f t $srcdir/Makefile.am
+  $MAKE nil
+  $FGREP am_fingerprint Makefile # for debugging
+  $FGREP $hash1 Makefile
+  test x"`./foo.sh`" = x"$hash1"
+
+  $sleep
+  echo 'sed "s/^\\(am_fingerprint\\) *=.*/\\1 = '$hash2'/"' \
+    > $srcdir/tweak-makefile-am
+  $MAKE nil
+  $FGREP am_fingerprint Makefile # for debugging
+  $FGREP $hash1 Makefile && Exit 1
+  $FGREP $hash2 Makefile
+  test x"`./foo.sh`" = x"$hash2"
+
+  $sleep
+  echo cat > $srcdir/tweak-makefile-am # no-op again
+  sed "s/^\\(am_fingerprint\\) *=.*/\\1 = DummyValue/" $srcdir/Makefile.am >t
+  mv -f t $srcdir/Makefile.am
+  $MAKE distcheck
+  $FGREP $hash1 Makefile && Exit 1 # sanity check
+  $FGREP $hash2 Makefile && Exit 1 # likewise
+
+  $MAKE distclean
+
+  cd $srcdir
+
+done
+
+:
diff --git a/tests/remake9c.test b/tests/remake9c.test
new file mode 100755
index 0000000..19bd1f1
--- /dev/null
+++ b/tests/remake9c.test
@@ -0,0 +1,109 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test remake rules when acinclude.m4 or its prerequisites change.
+# Keep in sync with the other sister tests `remake9*.test'.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+hash1=7532aa4708e8320c8c7098a5e3a1ec88aafb074f
+hash2=99368830db9954b4d9fecd04d3996d9acea7129f
+
+cat >> configure.in <<END
+am_fingerprint='MY_FINGERPRINT'
+AC_SUBST([am_fingerprint])
+AC_CONFIG_FILES([foo.sh:foo.in], [chmod a+x foo.sh])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+nil:
+.PHONY: nil
+
+# The right way to extend an autogenerated aclocal.m4 is to provide
+# an acinclude.m4 file.
+$(srcdir)/acinclude.m4: $(srcdir)/tweak-acinclude-m4
+       $(SHELL) $(srcdir)/tweak-acinclude-m4 <$@ >address@hidden
+       mv -f address@hidden $@
+       touch $@
+EXTRA_DIST = $(srcdir)/tweak-acinclude-m4
+
+# Used by "make distcheck" later.
+check-local:
+       test x'$(am_fingerprint)' = x'DummyValue'
+       test x"`./foo.sh`" = x"DummyValue"
+END
+
+cat > foo.in <<END
+#!/bin/sh
+echo '@am_fingerprint@'
+END
+
+echo "AC_DEFUN([MY_FINGERPRINT], [BadBadBad])" > acinclude.m4
+
+echo : > tweak-acinclude-m4 # no-op by default
+
+$sleep # so that generated autotools files will be older than prerequisites
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+for vpath in : false; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+  $MAKE # should be no-op
+
+  $sleep
+  echo "AC_DEFUN([MY_FINGERPRINT], [$hash1])" > $srcdir/acinclude.m4
+  $MAKE nil
+  $FGREP am_fingerprint Makefile # for debugging
+  $FGREP $hash1 Makefile
+  test x"`./foo.sh`" = x"$hash1"
+
+  $sleep
+  echo "echo 'AC_DEFUN([MY_FINGERPRINT], [$hash2])'" \
+    > $srcdir/tweak-acinclude-m4
+  $MAKE nil
+  $FGREP am_fingerprint Makefile # for debugging
+  $FGREP $hash1 Makefile && Exit 1
+  $FGREP $hash2 Makefile
+  test x"`./foo.sh`" = x"$hash2"
+
+  $sleep
+  echo : > $srcdir/tweak-acinclude-m4 # no-op again
+  echo "AC_DEFUN([MY_FINGERPRINT], [DummyValue])" > $srcdir/acinclude.m4
+  $MAKE distcheck
+  $FGREP $hash1 Makefile && Exit 1 # sanity check
+  $FGREP $hash2 Makefile && Exit 1 # likewise
+
+  $MAKE distclean
+
+  cd $srcdir
+
+done
+
+:
diff --git a/tests/remake9d.test b/tests/remake9d.test
new file mode 100755
index 0000000..4a44fba
--- /dev/null
+++ b/tests/remake9d.test
@@ -0,0 +1,109 @@
+#! /bin/sh
+# Copyright (C) 2010 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/>.
+
+# Test remake rules when aclocal.m4 or its prerequisites change.
+# Keep in sync with the other sister tests `remake9*.test'.
+
+required=GNUmake
+. ./defs || Exit 1
+
+set -e
+
+hash1=7532aa4708e8320c8c7098a5e3a1ec88aafb074f
+hash2=99368830db9954b4d9fecd04d3996d9acea7129f
+
+cat >> configure.in <<END
+am_fingerprint='MY_FINGERPRINT'
+AC_SUBST([am_fingerprint])
+AC_CONFIG_FILES([foo.sh:foo.in], [chmod a+x foo.sh])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+nil:
+.PHONY: nil
+
+# A non-autogenerated aclocal.m4 can be extended by hand.
+$(srcdir)/aclocal.m4: $(srcdir)/tweak-aclocal-m4
+       $(SHELL) $(srcdir)/tweak-aclocal-m4 <$@ >address@hidden
+       mv -f address@hidden $@
+       touch $@
+EXTRA_DIST = $(srcdir)/tweak-aclocal-m4
+
+# Used by "make distcheck" later.
+check-local:
+       test x'$(am_fingerprint)' = x'DummyValue'
+       test x"`./foo.sh`" = x"DummyValue"
+END
+
+cat > foo.in <<END
+#!/bin/sh
+echo '@am_fingerprint@'
+END
+
+echo cat > tweak-aclocal-m4 # no-op by default
+
+$sleep # so that generated autotools files will be older than prerequisites
+$ACLOCAL
+# Cheatingly mark aclocal.m4 as non auto-generated.
+sed '/^ *#.*generated automatically/d' aclocal.m4 > t
+mv -f t aclocal.m4
+$AUTOCONF
+$AUTOMAKE
+
+for vpath in : false; do
+
+  if $vpath; then
+    mkdir build
+    cd build
+    srcdir=..
+  else
+    srcdir=.
+  fi
+
+  $srcdir/configure
+  $MAKE # should be no-op
+
+  $sleep
+  echo "AC_DEFUN([MY_FINGERPRINT], [$hash1])dnl %%%" >> $srcdir/aclocal.m4
+  $MAKE nil
+  $FGREP am_fingerprint Makefile # for debugging
+  $FGREP $hash1 Makefile
+  test x"`./foo.sh`" = x"$hash1"
+
+  $sleep
+  echo "sed 's/.*dnl *%%%.*/AC_DEFUN([MY_FINGERPRINT], [$hash2])/'" \
+    > $srcdir/tweak-aclocal-m4
+  $MAKE nil
+  $FGREP am_fingerprint Makefile # for debugging
+  $FGREP $hash1 Makefile && Exit 1
+  $FGREP $hash2 Makefile
+  test x"`./foo.sh`" = x"$hash2"
+
+  $sleep
+  echo cat > $srcdir/tweak-aclocal-m4 # no-op again
+  echo 'AC_DEFUN([MY_FINGERPRINT], [DummyValue])' >> $srcdir/aclocal.m4
+  $MAKE distcheck
+  $FGREP $hash1 Makefile && Exit 1 # sanity check
+  $FGREP $hash2 Makefile && Exit 1 # likewise
+
+  $MAKE distclean
+
+  cd $srcdir
+
+done
+
+:
-- 
1.7.1


reply via email to

[Prev in Thread] Current Thread [Next in Thread]