automake-patches
[Top][All Lists]
Advanced

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

Re: [PATCH] Extend tests on AC_LIBOBJ and friends.


From: Stefano Lattarini
Subject: Re: [PATCH] Extend tests on AC_LIBOBJ and friends.
Date: Thu, 9 Dec 2010 21:41:46 +0100
User-agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )

Ping on this?  Reference:
 <http://lists.gnu.org/archive/html/automake-patches/2010-09/msg00000.html>

This is where the original patch has been tested:
> Patch tested with:
>   1. Debian GNU/Linux, GNU m4 1.4.11, autoconf/autom4te 2.62,
>      dash 0.5.2, GNU make 3.81
>   2. Debian GNU/Linux, GNU m4 1.4.14, autoconf/autom4te 2.67,
>      bash 2.0, GNU make 3.79
>   3. Debian GNU/Linux, GNU m4 1.4.14, autoconf/autom4te 2.65,
>      bash 4.0, FreeBSD make 8.1
>   4. Solaris 10, GNU m4 1.4.15, autoconf/autom4te 2.67, /bin/ksh
>      Version M-11/16/88i, GNU make 3.82, Solaris coreutils, mixed
>      Solaris and GNU tools (sed, grep, gawk, ...)
>   5. Solaris 10, GNU m4 1.4.15, autoconf/autom4te 2.62, /bin/sh,
>      Solaris tools (xpg4/ccs make, grep, sed, nawk, ...)
>   6. Debian GNU/Linux, GNU m4 1.4.14, autoconf/autom4te 2.65,
>      Heirloom shell, Heirloom make, mixed Heirloom tools and
>      GNU tools.

Now I've rebased the patch on latest maint, and amended it as follows:
 - the new test `libobj1.test' (superseding old test `aclibobj.test')
   has been renamed to `libobj-basic.test'.
 - in-line comments in make rules have been removed, since they are
   unportable to at least OSF/Tru64 make;
 - potentially problematic indentation in makefiles has been removed;
 - some typos in ChangeLog and in comments have been fixed;
 - other miscellanous minor fixes and improvements;

The updated patch and the squashed-in diffs are attached.

I will wait the customary 72 hours (until sunday evening) before
pushing.

Regards,
   Stefano
From 808e6e217c59de1e289c12074e1cbbdf8695352d Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Thu, 9 Dec 2010 20:28:36 +0100
Subject: [PATCH] SquashMe

---
 ChangeLog                                 |   12 ++++++------
 tests/Makefile.am                         |    2 +-
 tests/Makefile.in                         |    2 +-
 tests/{libobj1.test => libobj-basic.test} |   13 +++++--------
 tests/libobj15b.test                      |    6 +++---
 tests/libobj15c.test                      |    6 +++---
 tests/libobj16a.test                      |   10 ++++------
 tests/libobj16b.test                      |   20 +++++++++-----------
 tests/libobj18.test                       |   11 +++++++----
 tests/libobj19.test                       |    6 ++----
 tests/libobj2.test                        |    7 ++++---
 tests/libobj20a.test                      |    7 ++-----
 tests/libobj20b.test                      |    8 ++++----
 tests/libobj20c.test                      |    2 +-
 tests/libobj7.test                        |    2 +-
 15 files changed, 53 insertions(+), 61 deletions(-)
 rename tests/{libobj1.test => libobj-basic.test} (91%)

diff --git a/ChangeLog b/ChangeLog
index 0d0c64f..59635e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,11 +1,11 @@
-2010-09-01  Stefano Lattarini  <address@hidden>
+2010-12-09  Stefano Lattarini  <address@hidden>
 
        Extend tests on AC_LIBOBJ and friends.
        * tests/aclibobj.test: Removed, superseded by ...
-       * tests/libobj1.test: ... this new test, which runs autoconf,
+       * tests/libobj-basic.test: ... this new test, which runs autoconf,
        ./configure and make, to ensure everything really works.
-       * tests/libobj3.test: Add trailing `:' command.  Quote literal dot
-       in grep regexp.
+       * tests/libobj3.test: Add trailing `:' command.  Escape literal
+       dot in grep regexp.
        * tests/libobj4.test: Enable `errexit' shell flag, and related
        changes.  Add trailing `:' command.  Use proper m4 quoting.
        * tests/ltlibobjs.test: Likewise.
@@ -19,7 +19,7 @@
        ./configure and make, to ensure everything really works.
        * tests/libobj7.test: Likewise, and ensure that at least one
        function listed in AC_REPLACE_FUNCTIONS is truly replaced.
-       * tests/libobj13.test: Make grepping of Automake stderr slighty
+       * tests/libobj13.test: Make grepping of Automake stderr slightly
        stricter.  Add trailing `:' command.
        * tests/libobj12.test: Likewise.  Also, prefer "cat + here-doc"
        over "echo" to append to Makefile.am, and some cosmetic changes
@@ -38,7 +38,7 @@
        * tests/libobj11.test: Removed, superseded by ...
        * tests/libobj16a.test: ... this new test.
        * tests/libobj16b.test: New test, sister test of libobj16a.test,
-       but using oldish/depracated idioms.
+       but using oldish/deprecated idioms.
        * tests/libobj17.test: New test.
        * tests/libobj18.test: Likewise.
        * tests/libobj19.test: Likewise.
diff --git a/tests/Makefile.am b/tests/Makefile.am
index 2fe7b9e..e915510 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -415,7 +415,7 @@ lex5.test \
 lflags.test \
 lflags2.test \
 libexec.test \
-libobj1.test \
+libobj-basic.test \
 libobj2.test \
 libobj3.test \
 libobj4.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 6d307e3..17b9691 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -682,7 +682,7 @@ lex5.test \
 lflags.test \
 lflags2.test \
 libexec.test \
-libobj1.test \
+libobj-basic.test \
 libobj2.test \
 libobj3.test \
 libobj4.test \
diff --git a/tests/libobj1.test b/tests/libobj-basic.test
similarity index 91%
rename from tests/libobj1.test
rename to tests/libobj-basic.test
index 7323570..64b9c2b 100755
--- a/tests/libobj1.test
+++ b/tests/libobj-basic.test
@@ -36,9 +36,7 @@ include extra-checks.am
 .PHONY: $(extra_checks) pre-test
 
 pre-test: distdir
-       ls -l $(srcdir)
-       test x'$(srcdir)' = x'$(builddir)' || ls -l $(builddir)
-       ls -l $(distdir)
+       ls -l $(srcdir) $(builddir) $(distdir)
        $(AR) tv libtu.a
 $(extra_checks): pre-test
 check-local: $(extra_checks)
@@ -52,10 +50,10 @@ liver-src:
 liver-dist:
        grep dummy_liver $(distdir)/liver.c
 liver-not-dist:
-       test -d $(distdir) # sanity check
+       test -d $(distdir)
        test ! -r $(distdir)/liver.c
 maude-not-dist:
-       test -d $(distdir) # sanity check
+       test -d $(distdir)
        test ! -r $(distdir)/maude.c
 END
 
@@ -87,10 +85,10 @@ $AUTOMAKE
 
 $MAKE check
 $MAKE distcheck
-$MAKE distclean
 
+$MAKE distclean
 # Avoid timestamp-related differences.
-rm -rf autom4te.cache
+rm -rf autom4te*.cache
 
 cat > extra-checks.am << 'END'
 extra_checks = maude-src maude-dist liver-src liver-dist
@@ -108,6 +106,5 @@ $AUTOMAKE
 
 $MAKE check
 $MAKE distcheck
-$MAKE distclean
 
 :
diff --git a/tests/libobj15b.test b/tests/libobj15b.test
index 10f2b5b..000ba1f 100755
--- a/tests/libobj15b.test
+++ b/tests/libobj15b.test
@@ -24,9 +24,9 @@ cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_RANLIB
 AC_LIBSOURCE([foobar.c])
-## FIXME: without a call to AC_OUTPUT, Automake does not fail when file(s)
-##        specified in AC_LIBSOURCE call(s) do not exist.  Should we fix
-##        this limitation?  Or is the current behaviour god enough?
+# FIXME: without a call to AC_OUTPUT, Automake does not fail when file(s)
+#        specified in AC_LIBSOURCE call(s) do not exist.  Should we fix
+#        this limitation?  Or is the current behaviour good enough?
 AC_OUTPUT
 END
 
diff --git a/tests/libobj15c.test b/tests/libobj15c.test
index da77719..f1aa259 100755
--- a/tests/libobj15c.test
+++ b/tests/libobj15c.test
@@ -24,9 +24,9 @@ cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_RANLIB
 AC_LIBSOURCES([foobar.c, bazquux.c])
-## FIXME: without a call to AC_OUTPUT, Automake does not fail when file(s)
-##        specified in AC_LIBSOURCES call(s) do not exist.  Should we fix
-##        this limitation?  Or is the current behaviour god enough?
+# FIXME: without a call to AC_OUTPUT, Automake does not fail when file(s)
+#        specified in AC_LIBSOURCES call(s) do not exist.  Should we fix
+#        this limitation?  Or is the current behaviour good enough?
 AC_OUTPUT
 END
 
diff --git a/tests/libobj16a.test b/tests/libobj16a.test
index 594aeb3..a673819 100755
--- a/tests/libobj16a.test
+++ b/tests/libobj16a.test
@@ -38,9 +38,7 @@ include extra-checks.am
 .PHONY: $(extra_checks) pre-test
 
 pre-test: distdir
-       ls -l $(srcdir)
-       test x'$(srcdir)' = x'$(builddir)' || ls -l $(builddir)
-       ls -l $(distdir)
+       ls -l $(srcdir) $(builddir) $(distdir)
        $(AR) tv libtu.a
 $(extra_checks): pre-test
 check-local: $(extra_checks)
@@ -98,14 +96,14 @@ $MAKE distcheck
 $MAKE distclean
 
 # Avoid timestamp-related differences.
-rm -rf autom4te.cache
+rm -rf autom4te*.cache
 
 cat > extra-checks.am << 'END'
 extra_checks = maude-src maude-dist liver-src liver-dist
 if MAUDE_COND
-  extra_checks += maude-lib liver-not-lib
+extra_checks += maude-lib liver-not-lib
 else
-  extra_checks += maude-not-lib liver-lib
+extra_checks += maude-not-lib liver-lib
 endif
 END
 
diff --git a/tests/libobj16b.test b/tests/libobj16b.test
index 59dcf84..f2ac76d 100755
--- a/tests/libobj16b.test
+++ b/tests/libobj16b.test
@@ -38,9 +38,7 @@ include extra-checks.am
 .PHONY: $(extra_checks) pre-test
 
 pre-test: distdir
-       ls -l $(srcdir)
-       test x'$(srcdir)' = x'$(builddir)' || ls -l $(builddir)
-       ls -l $(distdir)
+       ls -l $(srcdir) $(builddir) $(distdir)
        $(AR) tv libtu.a
 $(extra_checks): pre-test
 check-local: $(extra_checks)
@@ -78,7 +76,7 @@ END
 sed '/%LIBOBJ-STUFF%/{
 s/.*//
 i\
-AC_LIBOBJ(maude) dnl! Do not quote this!
+AC_LIBOBJ(maude) dnl: do not quote this!
 }' configure.proto > configure.in
 cat configure.in # for debugging
 
@@ -98,14 +96,14 @@ $MAKE distcheck
 $MAKE distclean
 
 # Avoid timestamp-related differences.
-rm -rf autom4te.cache
+rm -rf autom4te*.cache
 
 cat > extra-checks.am << 'END'
 extra_checks = maude-src maude-dist liver-src liver-dist
 if MAUDE_COND
-  extra_checks += maude-lib liver-not-lib
+extra_checks += maude-lib liver-not-lib
 else
-  extra_checks += maude-not-lib liver-lib
+extra_checks += maude-not-lib liver-lib
 endif
 END
 
@@ -114,12 +112,12 @@ s/.*//
 i\
 AM_CONDITIONAL([MAUDE_COND], [test x"$MAUDE" = x"yes"])\
 if test x"$MAUDE" = x"yes"; then\
-  AC_LIBOBJ(maude) dnl! Do not quote this!\
+  AC_LIBOBJ(maude) dnl: do not quote this!\
 else\
-  AC_LIBOBJ(liver) dnl! Do not quote this!\
+  AC_LIBOBJ(liver) dnl: do not quote this!\
 fi\
-AC_LIBSOURCE(maude.c) dnl! Do not quote this!\
-AC_LIBSOURCE(liver.c) dnl! Do not quote this!
+AC_LIBSOURCE(maude.c) dnl: do not quote this!\
+AC_LIBSOURCE(liver.c) dnl: do not quote this!
 }' configure.proto > configure.in
 cat configure.in # for debugging
 
diff --git a/tests/libobj18.test b/tests/libobj18.test
index 0888237..e03493e 100755
--- a/tests/libobj18.test
+++ b/tests/libobj18.test
@@ -23,8 +23,9 @@ set -e
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_RANLIB
-bar=foo
-AC_LIBSOURCES([$bar.c])
+foo=dummy bar=dummy baz=dummy
+AC_LIBSOURCE([$foo.c])
+AC_LIBSOURCES([$bar.c, $baz.c])
 AC_OUTPUT
 END
 
@@ -34,10 +35,12 @@ libtu_a_SOURCES =
 libtu_a_LIBADD = $(LIBOBJS)
 END
 
-: > foo.c
+: > dummy.c
 
 $ACLOCAL
 AUTOMAKE_fails
-grep 'configure\.in:.*required file.*\./\$bar\.c.*not found' stderr
+grep 'configure\.in:.*required file.*\$foo\.c.*not found' stderr
+grep 'configure\.in:.*required file.*\$bar\.c.*not found' stderr
+grep 'configure\.in:.*required file.*\$baz\.c.*not found' stderr
 
 :
diff --git a/tests/libobj19.test b/tests/libobj19.test
index 4ec29f0..4fd150b 100755
--- a/tests/libobj19.test
+++ b/tests/libobj19.test
@@ -34,15 +34,13 @@ noinst_LIBRARIES = libtu.a
 libtu_a_SOURCES =
 libtu_a_LIBADD = $(LIBOBJS)
 check-local: distdir
-       ls -l $(srcdir)/*
-       test x'$(srcdir)' = x'$(builddir)' || ls -l $(builddir)/*
-       ls -l $(distdir)/*
+       ls -l $(srcdir)/* $(builddir)/* $(distdir)/*
        test -f libtu.a
        test ! -r $(srcdir)/foobar.c
        test -f $(srcdir)/libobj-dir/foobar.c
        test ! -r $(distdir)/foobar.c
        test -f $(distdir)/libobj-dir/foobar.c
-       $(AR) t libtu.a # for debugging
+       $(AR) t libtu.a
        $(AR) t libtu.a | grep foobar
 END
 
diff --git a/tests/libobj2.test b/tests/libobj2.test
index 0f454aa..913fef9 100755
--- a/tests/libobj2.test
+++ b/tests/libobj2.test
@@ -33,9 +33,9 @@ END
 cat > Makefile.am << 'END'
 SUBDIRS = subdir
 check-local: distdir
-       ls -l $(srcdir) $(srcdir)/subdir      # for debugging
-       ls -l $(distdir) $(distdir)/subdir    # likewise
-       ls -l $(builddir) $(builddir)/subdir  # likewise
+       ls -l $(srcdir) $(srcdir)/subdir
+       ls -l $(distdir) $(distdir)/subdir
+       ls -l $(builddir) $(builddir)/subdir
        test -f $(srcdir)/subdir/fsusage.c
        test -f $(distdir)/subdir/fsusage.c
        $(AR) tv $(builddir)/subdir/libtu.a
@@ -57,6 +57,7 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
 
+# Older grepping check, kept "just to be sure".
 $FGREP 'fsusage.c' subdir/Makefile.in
 
 ./configure
diff --git a/tests/libobj20a.test b/tests/libobj20a.test
index 01fdd1e..25c3cf3 100755
--- a/tests/libobj20a.test
+++ b/tests/libobj20a.test
@@ -15,7 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test error reporting for AC_CONFIG_LIBOBJ_DIR.
-# See also sister tests `aclibobj6b.test' and `aclibobj6c.test' .
+# See also sister tests `libobj20b.test' and `libobj20c.test' .
 
 . ./defs || Exit 1
 
@@ -28,10 +28,6 @@ AC_PROG_RANLIB
 AC_LIBOBJ([foo])
 END
 
-# We are not expected to be required to run this again after adding calls
-# to AC_LIBSOURCE/AC_LIBSOURCES, so just run it here once an for all.
-$ACLOCAL
-
 cat > Makefile.am << 'END'
 noinst_LIBRARIES = libtu.a
 libtu_a_SOURCES =
@@ -41,6 +37,7 @@ END
 mkdir libobj-dir
 : > libobj-dir/foo.c
 
+$ACLOCAL
 AUTOMAKE_fails
 grep 'LIBOBJS.*used outside.*libobj-dir' stderr
 grep 'subdir-objects.*not set' stderr
diff --git a/tests/libobj20b.test b/tests/libobj20b.test
index bc6b084..1662110 100755
--- a/tests/libobj20b.test
+++ b/tests/libobj20b.test
@@ -15,7 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test error reporting for AC_CONFIG_LIBOBJ_DIR.
-# See also sister tests `aclibobj6a.test' and `aclibobj6c.test' .
+# See also sister tests `libobj20a.test' and `libobj20c.test' .
 
 . ./defs || Exit 1
 
@@ -26,9 +26,9 @@ AC_CONFIG_LIBOBJ_DIR([libobj-dir])
 AC_PROG_CC
 AC_PROG_RANLIB
 AC_LIBSOURCE([foobar.c])
-## FIXME: without a call to AC_OUTPUT, Automake does not fail when file(s)
-##        specified in AC_LIBSOURCE call(s) do not exist.  Should we fix
-##        this limitation?  Or is the current behaviour god enough?
+# FIXME: without a call to AC_OUTPUT, Automake does not fail when file(s)
+#        specified in AC_LIBSOURCE call(s) do not exist.  Should we fix
+#        this limitation?  Or is the current behaviour good enough?
 AC_OUTPUT
 END
 
diff --git a/tests/libobj20c.test b/tests/libobj20c.test
index 33c43b1..4884359 100755
--- a/tests/libobj20c.test
+++ b/tests/libobj20c.test
@@ -15,7 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test error reporting for AC_CONFIG_LIBOBJ_DIR.
-# See also sister tests `aclibobj6a.test' and `aclibobj6b.test' .
+# See also sister tests `libobj20a.test' and `libobj20b.test' .
 
 . ./defs || Exit 1
 
diff --git a/tests/libobj7.test b/tests/libobj7.test
index 70c0ec0..be51db7 100755
--- a/tests/libobj7.test
+++ b/tests/libobj7.test
@@ -40,7 +40,7 @@ check-local: test1 test2 test3
 test1: all
        $(AR) tv libtu.a
 test2:
-       echo DIST_COMMON = $(DIST_COMMON) # for debugging
+       @echo DIST_COMMON = $(DIST_COMMON)
        echo ' ' $(DIST_COMMON) ' ' | grep '[ /]basename\.c '
        echo ' ' $(DIST_COMMON) ' ' | grep '[ /]dirname\.c '
        echo ' ' $(DIST_COMMON) ' ' | grep '[ /]am__dummy_function\.c '
-- 
1.7.1

From 88c5437de865d8d5574d12c1ba6256743987efc0 Mon Sep 17 00:00:00 2001
From: Stefano Lattarini <address@hidden>
Date: Tue, 31 Aug 2010 15:14:29 +0200
Subject: [PATCH] Extend tests on AC_LIBOBJ and friends.

* tests/aclibobj.test: Removed, superseded by ...
* tests/libobj1.test: ... this new test, which runs autoconf,
./configure and make, to ensure everything really works.
* tests/libobj3.test: Add trailing `:' command.  Quote literal dot
in grep regexp.
* tests/libobj4.test: Enable `errexit' shell flag, and related
changes.  Add trailing `:' command.  Use proper m4 quoting.
* tests/ltlibobjs.test: Likewise.
* tests/libobj5.test: Enable `errexit' shell flag, and related
changes.  Add trailing `:' command.  Make more robust by using
longer filenames to be grepped.
* tests/libobj8.test: Enable `errexit' shell flag, and related
changes.  Add trailing `:' command.  Use the configure.in
stub provided by ./defs, rather than writing it from scratch.
* tests/libobj2.test: Likewise.  Also, add calls to autoconf,
./configure and make, to ensure everything really works.
* tests/libobj7.test: Likewise, and ensure that at least one
function listed in AC_REPLACE_FUNCTIONS is truly replaced.
* tests/libobj13.test: Make grepping of Automake stderr slighty
stricter.  Add trailing `:' command.
* tests/libobj12.test: Likewise.  Also, prefer "cat + here-doc"
over "echo" to append to Makefile.am, and some cosmetic changes
in spacing.
* tests/libobj14.test: Call `Exit 1' if sourcing of ./defs fails.
Slighty improve m4 quoting.  Add trailing `:' command.
* tests/libobj10.test: Add calls to autoconf, ./configure and
make, to ensure everything really works.  Also, remove tests that
nonexistent source for AC_LIBOBJ cause an Automake failure: this
is already checked by ...
* tests/libobj15a.test: ... this new test.
* tests/libobj15b.test: New test, sister test of libobj15a.test,
checks AC_LIBSOURCE instead of AC_LIBOBJ.
* tests/libobj15c.test: New test, sister test of libobj15a.test,
checks AC_LIBSOURCES instead of AC_LIBOBJ.
* tests/libobj11.test: Removed, superseded by ...
* tests/libobj16a.test: ... this new test.
* tests/libobj16b.test: New test, sister test of libobj16a.test,
but using oldish/depracated idioms.
* tests/libobj17.test: New test.
* tests/libobj18.test: Likewise.
* tests/libobj19.test: Likewise.
* tests/libobj20a.test: Likewise.
* tests/libobj20b.test: Likewise.
* tests/libobj20c.test: Likewise.
* tests/Makefile.am (TESTS): Updated.
---
 ChangeLog                               |   49 +++++++++++
 tests/Makefile.am                       |   14 +++-
 tests/Makefile.in                       |   14 +++-
 tests/libobj-basic.test                 |  110 ++++++++++++++++++++++++
 tests/libobj10.test                     |   22 ++++--
 tests/libobj12.test                     |   26 ++++--
 tests/libobj13.test                     |    8 +-
 tests/libobj14.test                     |    4 +-
 tests/{libobj11.test => libobj15a.test} |   22 +++---
 tests/{aclibobj.test => libobj15b.test} |   30 +++----
 tests/{aclibobj.test => libobj15c.test} |   33 ++++----
 tests/libobj16a.test                    |  139 ++++++++++++++++++++++++++++++
 tests/libobj16b.test                    |  140 +++++++++++++++++++++++++++++++
 tests/{aclibobj.test => libobj17.test}  |   46 +++++++---
 tests/{aclibobj.test => libobj18.test}  |   31 +++----
 tests/{aclibobj.test => libobj19.test}  |   43 ++++++----
 tests/libobj2.test                      |   43 +++++++--
 tests/{aclibobj.test => libobj20a.test} |   32 +++----
 tests/{aclibobj.test => libobj20b.test} |   38 +++++----
 tests/{aclibobj.test => libobj20c.test} |   36 +++++----
 tests/libobj3.test                      |   10 ++-
 tests/libobj4.test                      |   10 ++-
 tests/libobj5.test                      |   16 ++--
 tests/libobj7.test                      |   65 ++++++++++-----
 tests/libobj8.test                      |   19 +++--
 tests/ltlibobjs.test                    |   10 ++-
 26 files changed, 793 insertions(+), 217 deletions(-)
 create mode 100755 tests/libobj-basic.test
 rename tests/{libobj11.test => libobj15a.test} (71%)
 copy tests/{aclibobj.test => libobj15b.test} (63%)
 copy tests/{aclibobj.test => libobj15c.test} (55%)
 create mode 100755 tests/libobj16a.test
 create mode 100755 tests/libobj16b.test
 copy tests/{aclibobj.test => libobj17.test} (56%)
 copy tests/{aclibobj.test => libobj18.test} (64%)
 copy tests/{aclibobj.test => libobj19.test} (56%)
 copy tests/{aclibobj.test => libobj20a.test} (67%)
 copy tests/{aclibobj.test => libobj20b.test} (50%)
 rename tests/{aclibobj.test => libobj20c.test} (56%)

diff --git a/ChangeLog b/ChangeLog
index e8864f1..59635e2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,52 @@
+2010-12-09  Stefano Lattarini  <address@hidden>
+
+       Extend tests on AC_LIBOBJ and friends.
+       * tests/aclibobj.test: Removed, superseded by ...
+       * tests/libobj-basic.test: ... this new test, which runs autoconf,
+       ./configure and make, to ensure everything really works.
+       * tests/libobj3.test: Add trailing `:' command.  Escape literal
+       dot in grep regexp.
+       * tests/libobj4.test: Enable `errexit' shell flag, and related
+       changes.  Add trailing `:' command.  Use proper m4 quoting.
+       * tests/ltlibobjs.test: Likewise.
+       * tests/libobj5.test: Enable `errexit' shell flag, and related
+       changes.  Add trailing `:' command.  Make more robust by using
+       longer filenames to be grepped.
+       * tests/libobj8.test: Enable `errexit' shell flag, and related
+       changes.  Add trailing `:' command.  Use the configure.in
+       stub provided by ./defs, rather than writing it from scratch.
+       * tests/libobj2.test: Likewise.  Also, add calls to autoconf,
+       ./configure and make, to ensure everything really works.
+       * tests/libobj7.test: Likewise, and ensure that at least one
+       function listed in AC_REPLACE_FUNCTIONS is truly replaced.
+       * tests/libobj13.test: Make grepping of Automake stderr slightly
+       stricter.  Add trailing `:' command.
+       * tests/libobj12.test: Likewise.  Also, prefer "cat + here-doc"
+       over "echo" to append to Makefile.am, and some cosmetic changes
+       in spacing.
+       * tests/libobj14.test: Call `Exit 1' if sourcing of ./defs fails.
+       Slighty improve m4 quoting.  Add trailing `:' command.
+       * tests/libobj10.test: Add calls to autoconf, ./configure and
+       make, to ensure everything really works.  Also, remove tests that
+       nonexistent source for AC_LIBOBJ cause an Automake failure: this
+       is already checked by ...
+       * tests/libobj15a.test: ... this new test.
+       * tests/libobj15b.test: New test, sister test of libobj15a.test,
+       checks AC_LIBSOURCE instead of AC_LIBOBJ.
+       * tests/libobj15c.test: New test, sister test of libobj15a.test,
+       checks AC_LIBSOURCES instead of AC_LIBOBJ.
+       * tests/libobj11.test: Removed, superseded by ...
+       * tests/libobj16a.test: ... this new test.
+       * tests/libobj16b.test: New test, sister test of libobj16a.test,
+       but using oldish/deprecated idioms.
+       * tests/libobj17.test: New test.
+       * tests/libobj18.test: Likewise.
+       * tests/libobj19.test: Likewise.
+       * tests/libobj20a.test: Likewise.
+       * tests/libobj20b.test: Likewise.
+       * tests/libobj20c.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..e915510 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -37,7 +37,6 @@ $(parallel_tests): $(parallel_tests:-p.test=.test) Makefile.am
 MAINTAINERCLEANFILES = $(parallel_tests)
 
 TESTS = \
-aclibobj.test \
 aclocal.test \
 aclocal3.test \
 aclocal4.test \
@@ -416,6 +415,7 @@ lex5.test \
 lflags.test \
 lflags2.test \
 libexec.test \
+libobj-basic.test \
 libobj2.test \
 libobj3.test \
 libobj4.test \
@@ -423,10 +423,20 @@ libobj5.test \
 libobj7.test \
 libobj8.test \
 libobj10.test \
-libobj11.test \
 libobj12.test \
 libobj13.test \
 libobj14.test \
+libobj15a.test \
+libobj15b.test \
+libobj15c.test \
+libobj16a.test \
+libobj16b.test \
+libobj17.test \
+libobj18.test \
+libobj19.test \
+libobj20a.test \
+libobj20b.test \
+libobj20c.test \
 library.test \
 library2.test \
 library3.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index de21f43..17b9691 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -304,7 +304,6 @@ pr401c-p.test
 
 MAINTAINERCLEANFILES = $(parallel_tests)
 TESTS = \
-aclibobj.test \
 aclocal.test \
 aclocal3.test \
 aclocal4.test \
@@ -683,6 +682,7 @@ lex5.test \
 lflags.test \
 lflags2.test \
 libexec.test \
+libobj-basic.test \
 libobj2.test \
 libobj3.test \
 libobj4.test \
@@ -690,10 +690,20 @@ libobj5.test \
 libobj7.test \
 libobj8.test \
 libobj10.test \
-libobj11.test \
 libobj12.test \
 libobj13.test \
 libobj14.test \
+libobj15a.test \
+libobj15b.test \
+libobj15c.test \
+libobj16a.test \
+libobj16b.test \
+libobj17.test \
+libobj18.test \
+libobj19.test \
+libobj20a.test \
+libobj20b.test \
+libobj20c.test \
 library.test \
 library2.test \
 library3.test \
diff --git a/tests/libobj-basic.test b/tests/libobj-basic.test
new file mode 100755
index 0000000..64b9c2b
--- /dev/null
+++ b/tests/libobj-basic.test
@@ -0,0 +1,110 @@
+#! /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 AC_LIBSOURCE and AC_LIBSOURCES work.
+
+. ./defs || Exit 1
+
+set -e
+
+mv configure.in configure.proto
+cat >> configure.proto << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+noinst_LIBRARIES = libtu.a
+libtu_a_SOURCES = foo.c
+libtu_a_LIBADD = $(LIBOBJS)
+
+include extra-checks.am
+.PHONY: $(extra_checks) pre-test
+
+pre-test: distdir
+       ls -l $(srcdir) $(builddir) $(distdir)
+       $(AR) tv libtu.a
+$(extra_checks): pre-test
+check-local: $(extra_checks)
+
+maude-src:
+       grep dummy_maude $(srcdir)/maude.c
+maude-dist:
+       grep dummy_maude $(distdir)/maude.c
+liver-src:
+       grep dummy_liver $(srcdir)/liver.c
+liver-dist:
+       grep dummy_liver $(distdir)/liver.c
+liver-not-dist:
+       test -d $(distdir)
+       test ! -r $(distdir)/liver.c
+maude-not-dist:
+       test -d $(distdir)
+       test ! -r $(distdir)/maude.c
+END
+
+cat > foo.c << 'END'
+extern int dummy_foo;
+END
+
+cat > maude.c << 'END'
+extern int dummy_maude;
+END
+
+cat > liver.c << 'END'
+extern int dummy_liver;
+END
+
+# AC_LIBSOURCE should work also if called after AC_OUTPUT.
+cat configure.proto - > configure.in <<END
+AC_LIBSOURCE([maude.c])
+END
+
+cat > extra-checks.am << 'END'
+extra_checks = maude-src maude-dist liver-not-dist
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+
+$MAKE check
+$MAKE distcheck
+
+$MAKE distclean
+# Avoid timestamp-related differences.
+rm -rf autom4te*.cache
+
+cat > extra-checks.am << 'END'
+extra_checks = maude-src maude-dist liver-src liver-dist
+END
+
+# AC_LIBSOURCES should work also if called after AC_OUTPUT.
+cat configure.proto - > configure.in <<END
+AC_LIBSOURCES([maude.c, liver.c])
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+./configure
+
+$MAKE check
+$MAKE distcheck
+
+:
diff --git a/tests/libobj10.test b/tests/libobj10.test
index 0d24741..7897351 100755
--- a/tests/libobj10.test
+++ b/tests/libobj10.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1999, 2000, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1999, 2000, 2001, 2002, 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
@@ -30,13 +31,22 @@ END
 
 cat > Makefile.am << 'END'
 noinst_LIBRARIES = libfoo.a
-libfoo_a_LIBADD = @LIBOBJS@
+libfoo_a_SOURCES =
+libfoo_a_LIBADD = $(LIBOBJS)
+BUILT_SOURCES = foo.c
+CLEANFILES = foo.c
+foo.c:
+       echo 'extern int dummy;' > $@
 END
 
 $ACLOCAL
-AUTOMAKE_fails
-grep 'Makefile.am:2:.*foo\.c' stderr
+$AUTOCONF
+$AUTOMAKE
 
-echo 'BUILT_SOURCES = foo.c' >> Makefile.am
+./configure
 
-$AUTOMAKE
+$MAKE
+ar t libfoo.a # for debugging
+$MAKE distcheck
+
+:
diff --git a/tests/libobj12.test b/tests/libobj12.test
index 5f1d029..747d7a0 100755
--- a/tests/libobj12.test
+++ b/tests/libobj12.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 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
@@ -14,11 +14,11 @@
 # 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 if a file can be mentioned in LIBOBJS and explicitly.
 # (See libobj13.test for the LTLIBRARIES check.)
 
 . ./defs || Exit 1
+
 set -e
 
 cat >> configure.in << 'END'
@@ -48,22 +48,30 @@ END
 : > bar.c
 
 $ACLOCAL
-$AUTOMAKE
 
 # This however should be diagnosed, since foo.c and bar.c are in 
@address@hidden
-echo 'libfoo_a_SOURCES += foo.c' >> Makefile.am
-echo 'p1_SOURCES += bar.c' >> Makefile.am
+cat >> Makefile.am << 'END'
+libfoo_a_SOURCES += foo.c
+p1_SOURCES += bar.c
+END
+
 AUTOMAKE_fails
-$FGREP foo.c stderr
-$FGREP bar.c stderr
+grep 'foo\.c.*explicitly mentioned' stderr
+grep 'bar\.c.*explicitly mentioned' stderr
 
 # Global `LDADD' can also come into play.
 cat > Makefile.am << 'END'
 noinst_PROGRAMS = a b
 LDADD = @LIBOBJS@
 END
+
 $AUTOMAKE
 grep 'a_DEPENDENCIES.*LIBOBJS' Makefile.in
-echo 'a_SOURCES = foo.c' >> Makefile.am
+
+cat >> Makefile.am << 'END'
+a_SOURCES = foo.c
+END
 AUTOMAKE_fails
-$FGREP foo.c stderr
+grep 'foo\.c.*explicitly mentioned' stderr
+
+:
diff --git a/tests/libobj13.test b/tests/libobj13.test
index 6ca68c9..6d1e68d 100755
--- a/tests/libobj13.test
+++ b/tests/libobj13.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 2002, 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
@@ -14,12 +14,12 @@
 # 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 if a file can be mentioned in LTLIBOBJS and explicitly.
 # (Like libobj12.test, but for Libtool libraries.)
 
 required='libtoolize'
 . ./defs || Exit 1
+
 set -e
 
 cat >> configure.in << 'END'
@@ -47,4 +47,6 @@ $AUTOMAKE --add-missing
 # This however should be diagnosed, since foo.c is in @address@hidden
 echo 'libfoo_la_SOURCES += foo.c' >> Makefile.am
 AUTOMAKE_fails
-$FGREP foo.c stderr
+grep 'foo\.c.*explicitly mentioned' stderr
+
+:
diff --git a/tests/libobj14.test b/tests/libobj14.test
index 0ee750c..08841c3 100755
--- a/tests/libobj14.test
+++ b/tests/libobj14.test
@@ -27,7 +27,7 @@ set -e
 cat >>configure.in <<'EOF'
 AC_PROG_CC
 AC_LIBSOURCE([bar.c])
-AM_CONDITIONAL([CASE], :)
+AM_CONDITIONAL([CASE], [:])
 AC_OUTPUT
 EOF
 
@@ -43,3 +43,5 @@ EOF
 
 $ACLOCAL
 $AUTOMAKE
+
+:
diff --git a/tests/libobj11.test b/tests/libobj15a.test
similarity index 71%
rename from tests/libobj11.test
rename to tests/libobj15a.test
index 204ff8b..51da834 100755
--- a/tests/libobj11.test
+++ b/tests/libobj15a.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002, 2008  Free Software Foundation, Inc.
+# 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
@@ -14,26 +14,26 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# AC_LIBOBJ must allow [] around its argument.
+# Nonexistent sources for AC_LIBOBJ should cause an Automake failure.
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+set -e
+
+cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_RANLIB
-AC_LIBOBJ([mountlist])
-AC_OUTPUT(Makefile)
+AC_LIBOBJ([foobar])
 END
 
 cat > Makefile.am << 'END'
 noinst_LIBRARIES = libtu.a
 libtu_a_SOURCES =
-libtu_a_LIBADD = @LIBOBJS@
+libtu_a_LIBADD = $(LIBOBJS)
 END
 
-: > mountlist.c
+$ACLOCAL
+AUTOMAKE_fails
+grep 'configure\.in:.*required file.*foobar\.c.*' stderr
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+:
diff --git a/tests/aclibobj.test b/tests/libobj15b.test
similarity index 63%
copy from tests/aclibobj.test
copy to tests/libobj15b.test
index 6ef6f6b..000ba1f 100755
--- a/tests/aclibobj.test
+++ b/tests/libobj15b.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
+# 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
@@ -14,36 +14,30 @@
 # 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 AC_LIBOBJ and friends work.
+# Nonexistent source for AC_LIBSOURCE should cause Automake to fail.
 
 . ./defs || Exit 1
 
+set -e
+
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_RANLIB
+AC_LIBSOURCE([foobar.c])
+# FIXME: without a call to AC_OUTPUT, Automake does not fail when file(s)
+#        specified in AC_LIBSOURCE call(s) do not exist.  Should we fix
+#        this limitation?  Or is the current behaviour good enough?
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 noinst_LIBRARIES = libtu.a
 libtu_a_SOURCES =
-libtu_a_LIBADD = @LIBOBJS@
+libtu_a_LIBADD = $(LIBOBJS)
 END
 
-: > maude.c
-: > liver.c
-
 $ACLOCAL
+AUTOMAKE_fails
+grep 'configure\.in:.*required file.*foobar\.c.*' stderr
 
-set -e
-
-cp configure.in X
-echo 'AC_LIBSOURCE(maude.c)' >> configure.in
-$AUTOMAKE
-
-# Avoid timestamp-related differences.
-rm -rf autom4te.cache
-
-cp X configure.in
-echo 'AC_LIBSOURCES([maude.c, liver.c])' >> configure.in
-$AUTOMAKE
+:
diff --git a/tests/aclibobj.test b/tests/libobj15c.test
similarity index 55%
copy from tests/aclibobj.test
copy to tests/libobj15c.test
index 6ef6f6b..f1aa259 100755
--- a/tests/aclibobj.test
+++ b/tests/libobj15c.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
+# 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
@@ -14,36 +14,37 @@
 # 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 AC_LIBOBJ and friends work.
+# Nonexistent sources for AC_LIBSOURCES should cause Automake to fail.
 
 . ./defs || Exit 1
 
+set -e
+
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_RANLIB
+AC_LIBSOURCES([foobar.c, bazquux.c])
+# FIXME: without a call to AC_OUTPUT, Automake does not fail when file(s)
+#        specified in AC_LIBSOURCES call(s) do not exist.  Should we fix
+#        this limitation?  Or is the current behaviour good enough?
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 noinst_LIBRARIES = libtu.a
 libtu_a_SOURCES =
-libtu_a_LIBADD = @LIBOBJS@
+libtu_a_LIBADD = $(LIBOBJS)
 END
 
-: > maude.c
-: > liver.c
-
 $ACLOCAL
 
-set -e
-
-cp configure.in X
-echo 'AC_LIBSOURCE(maude.c)' >> configure.in
-$AUTOMAKE
+AUTOMAKE_fails
+grep 'configure\.in:.*required file.*foobar\.c.*' stderr
+grep 'configure\.in:.*required file.*bazquux\.c.*' stderr
 
-# Avoid timestamp-related differences.
-rm -rf autom4te.cache
+: > foobar.c
+AUTOMAKE_fails
+grep 'configure\.in:.*required file.*bazquux\.c.*' stderr
+grep 'foobar\.c' stderr && Exit 1
 
-cp X configure.in
-echo 'AC_LIBSOURCES([maude.c, liver.c])' >> configure.in
-$AUTOMAKE
+:
diff --git a/tests/libobj16a.test b/tests/libobj16a.test
new file mode 100755
index 0000000..a673819
--- /dev/null
+++ b/tests/libobj16a.test
@@ -0,0 +1,139 @@
+#! /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 AC_LIBOBJ and friends work.
+# Please keep this in sync with sister test `libobj16b.test'.
+
+. ./defs || Exit 1
+
+set -e
+
+mv configure.in configure.proto
+cat >> configure.proto << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+%LIBOBJ-STUFF% # will be activated later
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+noinst_LIBRARIES = libtu.a
+libtu_a_SOURCES =
+libtu_a_LIBADD = $(LIBOBJS)
+
+include extra-checks.am
+.PHONY: $(extra_checks) pre-test
+
+pre-test: distdir
+       ls -l $(srcdir) $(builddir) $(distdir)
+       $(AR) tv libtu.a
+$(extra_checks): pre-test
+check-local: $(extra_checks)
+
+maude-src:
+       grep dummy_maude $(srcdir)/maude.c
+maude-dist:
+       grep dummy_maude $(distdir)/maude.c
+liver-src:
+       grep dummy_liver $(srcdir)/liver.c
+liver-dist:
+       grep dummy_liver $(distdir)/liver.c
+liver-not-dist: distdir
+       test ! -r $(distdir)/liver.c
+maude-not-dist: distdir
+       test ! -r $(distdir)/maude.c
+maude-lib:
+       $(AR) t libtu.a | grep maude
+maude-not-lib:
+       $(AR) t libtu.a | grep maude && exit 1; exit 0
+liver-lib:
+       $(AR) t libtu.a | grep liver
+liver-not-lib:
+       $(AR) t libtu.a | grep liver && exit 1; exit 0
+END
+
+cat > maude.c << 'END'
+extern int dummy_maude;
+END
+
+cat > liver.c << 'END'
+extern int dummy_liver;
+END
+
+sed '/%LIBOBJ-STUFF%/{
+s/.*//
+i\
+AC_LIBOBJ([maude])
+}' configure.proto > configure.in
+cat configure.in # for debugging
+
+cat > extra-checks.am << 'END'
+extra_checks = maude-src maude-dist maude-lib liver-not-dist
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE
+$MAKE check
+$MAKE distcheck
+$MAKE distclean
+
+# Avoid timestamp-related differences.
+rm -rf autom4te*.cache
+
+cat > extra-checks.am << 'END'
+extra_checks = maude-src maude-dist liver-src liver-dist
+if MAUDE_COND
+extra_checks += maude-lib liver-not-lib
+else
+extra_checks += maude-not-lib liver-lib
+endif
+END
+
+sed '/%LIBOBJ-STUFF%/{
+s/.*//
+i\
+AM_CONDITIONAL([MAUDE_COND], [test x"$MAUDE" = x"yes"])\
+if test x"$MAUDE" = x"yes"; then\
+  AC_LIBOBJ([maude])\
+else\
+  AC_LIBOBJ([liver])\
+fi\
+AC_LIBSOURCES([maude.c, liver.c])
+}' configure.proto > configure.in
+cat configure.in # for debugging
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure MAUDE=yes
+$MAKE
+$MAKE check
+$MAKE distcheck
+$MAKE distclean
+
+./configure MAUDE=no
+$MAKE
+$MAKE check
+$MAKE distcheck
+$MAKE distclean
+
+:
diff --git a/tests/libobj16b.test b/tests/libobj16b.test
new file mode 100755
index 0000000..f2ac76d
--- /dev/null
+++ b/tests/libobj16b.test
@@ -0,0 +1,140 @@
+#! /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 AC_LIBOBJ and friends work.
+# Please keep this in sync with sister test `libobj16b.test'.
+
+. ./defs || Exit 1
+
+set -e
+
+mv configure.in configure.proto
+cat >> configure.proto << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+%LIBOBJ-STUFF% # will be activated later
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+noinst_LIBRARIES = libtu.a
+libtu_a_SOURCES =
+libtu_a_LIBADD = @LIBOBJS@
+
+include extra-checks.am
+.PHONY: $(extra_checks) pre-test
+
+pre-test: distdir
+       ls -l $(srcdir) $(builddir) $(distdir)
+       $(AR) tv libtu.a
+$(extra_checks): pre-test
+check-local: $(extra_checks)
+
+maude-src:
+       grep dummy_maude $(srcdir)/maude.c
+maude-dist:
+       grep dummy_maude $(distdir)/maude.c
+liver-src:
+       grep dummy_liver $(srcdir)/liver.c
+liver-dist:
+       grep dummy_liver $(distdir)/liver.c
+liver-not-dist: distdir
+       test ! -r $(distdir)/liver.c
+maude-not-dist: distdir
+       test ! -r $(distdir)/maude.c
+maude-lib:
+       $(AR) t libtu.a | grep maude
+maude-not-lib:
+       $(AR) t libtu.a | grep maude && exit 1; exit 0
+liver-lib:
+       $(AR) t libtu.a | grep liver
+liver-not-lib:
+       $(AR) t libtu.a | grep liver && exit 1; exit 0
+END
+
+cat > maude.c << 'END'
+extern int dummy_maude;
+END
+
+cat > liver.c << 'END'
+extern int dummy_liver;
+END
+
+sed '/%LIBOBJ-STUFF%/{
+s/.*//
+i\
+AC_LIBOBJ(maude) dnl: do not quote this!
+}' configure.proto > configure.in
+cat configure.in # for debugging
+
+cat > extra-checks.am << 'END'
+extra_checks = maude-src maude-dist maude-lib liver-not-dist
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE
+$MAKE check
+$MAKE distcheck
+$MAKE distclean
+
+# Avoid timestamp-related differences.
+rm -rf autom4te*.cache
+
+cat > extra-checks.am << 'END'
+extra_checks = maude-src maude-dist liver-src liver-dist
+if MAUDE_COND
+extra_checks += maude-lib liver-not-lib
+else
+extra_checks += maude-not-lib liver-lib
+endif
+END
+
+sed '/%LIBOBJ-STUFF%/{
+s/.*//
+i\
+AM_CONDITIONAL([MAUDE_COND], [test x"$MAUDE" = x"yes"])\
+if test x"$MAUDE" = x"yes"; then\
+  AC_LIBOBJ(maude) dnl: do not quote this!\
+else\
+  AC_LIBOBJ(liver) dnl: do not quote this!\
+fi\
+AC_LIBSOURCE(maude.c) dnl: do not quote this!\
+AC_LIBSOURCE(liver.c) dnl: do not quote this!
+}' configure.proto > configure.in
+cat configure.in # for debugging
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure MAUDE=yes
+$MAKE
+$MAKE check
+$MAKE distcheck
+$MAKE distclean
+
+./configure MAUDE=no
+$MAKE
+$MAKE check
+$MAKE distcheck
+$MAKE distclean
+
+:
diff --git a/tests/aclibobj.test b/tests/libobj17.test
similarity index 56%
copy from tests/aclibobj.test
copy to tests/libobj17.test
index 6ef6f6b..daf4039 100755
--- a/tests/aclibobj.test
+++ b/tests/libobj17.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
+# 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
@@ -14,36 +14,54 @@
 # 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 AC_LIBOBJ and friends work.
+# Make sure AC_LIBOBJ accept non-literal arguments.
 
 . ./defs || Exit 1
 
+set -e
+
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_RANLIB
+foo=${FOO-oops}
+AC_LIBSOURCES([quux.c, zardoz.c])
+AC_LIBOBJ([$foo])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 noinst_LIBRARIES = libtu.a
 libtu_a_SOURCES =
-libtu_a_LIBADD = @LIBOBJS@
+libtu_a_LIBADD = $(LIBOBJS)
 END
 
-: > maude.c
-: > liver.c
+cat > quux.c <<'END'
+extern int dummy;
+END
+
+cat > zardoz.c <<'END'
+extern int dummy;
+END
 
+# These might print warnings, but should not error out.
 $ACLOCAL
+$AUTOMAKE
+$AUTOCONF
 
-set -e
+./configure FOO=quux
+$MAKE
+ls -l # for debugging
+test -f libtu.a
+ar t libtu.a | $FGREP quux
+ar t libtu.a | $FGREP zardoz && Exit 1
 
-cp configure.in X
-echo 'AC_LIBSOURCE(maude.c)' >> configure.in
-$AUTOMAKE
+$MAKE distclean
 
-# Avoid timestamp-related differences.
-rm -rf autom4te.cache
+./configure FOO=zardoz
+$MAKE
+ls -l # for debugging
+test -f libtu.a 
+ar t libtu.a | $FGREP zardoz
+ar t libtu.a | $FGREP quux && Exit 1
 
-cp X configure.in
-echo 'AC_LIBSOURCES([maude.c, liver.c])' >> configure.in
-$AUTOMAKE
+:
diff --git a/tests/aclibobj.test b/tests/libobj18.test
similarity index 64%
copy from tests/aclibobj.test
copy to tests/libobj18.test
index 6ef6f6b..e03493e 100755
--- a/tests/aclibobj.test
+++ b/tests/libobj18.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
+# 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
@@ -14,36 +14,33 @@
 # 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 AC_LIBOBJ and friends work.
+# Make sure AC_LIBSOURCE and AC_LIBSOURCES use arguments literally.
 
 . ./defs || Exit 1
 
+set -e
+
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_RANLIB
+foo=dummy bar=dummy baz=dummy
+AC_LIBSOURCE([$foo.c])
+AC_LIBSOURCES([$bar.c, $baz.c])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 noinst_LIBRARIES = libtu.a
 libtu_a_SOURCES =
-libtu_a_LIBADD = @LIBOBJS@
+libtu_a_LIBADD = $(LIBOBJS)
 END
 
-: > maude.c
-: > liver.c
+: > dummy.c
 
 $ACLOCAL
+AUTOMAKE_fails
+grep 'configure\.in:.*required file.*\$foo\.c.*not found' stderr
+grep 'configure\.in:.*required file.*\$bar\.c.*not found' stderr
+grep 'configure\.in:.*required file.*\$baz\.c.*not found' stderr
 
-set -e
-
-cp configure.in X
-echo 'AC_LIBSOURCE(maude.c)' >> configure.in
-$AUTOMAKE
-
-# Avoid timestamp-related differences.
-rm -rf autom4te.cache
-
-cp X configure.in
-echo 'AC_LIBSOURCES([maude.c, liver.c])' >> configure.in
-$AUTOMAKE
+:
diff --git a/tests/aclibobj.test b/tests/libobj19.test
similarity index 56%
copy from tests/aclibobj.test
copy to tests/libobj19.test
index 6ef6f6b..4fd150b 100755
--- a/tests/aclibobj.test
+++ b/tests/libobj19.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
+# 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
@@ -14,36 +14,49 @@
 # 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 AC_LIBOBJ and friends work.
+# Test support for AC_CONFIG_LIBOBJ_DIR.
 
 . ./defs || Exit 1
 
+set -e
+
 cat >> configure.in << 'END'
+AC_CONFIG_LIBOBJ_DIR([libobj-dir])
 AC_PROG_CC
 AC_PROG_RANLIB
+AC_LIBOBJ([foobar])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects ## required for our setup to work
 noinst_LIBRARIES = libtu.a
 libtu_a_SOURCES =
-libtu_a_LIBADD = @LIBOBJS@
+libtu_a_LIBADD = $(LIBOBJS)
+check-local: distdir
+       ls -l $(srcdir)/* $(builddir)/* $(distdir)/*
+       test -f libtu.a
+       test ! -r $(srcdir)/foobar.c
+       test -f $(srcdir)/libobj-dir/foobar.c
+       test ! -r $(distdir)/foobar.c
+       test -f $(distdir)/libobj-dir/foobar.c
+       $(AR) t libtu.a
+       $(AR) t libtu.a | grep foobar
 END
 
-: > maude.c
-: > liver.c
+mkdir libobj-dir
+cat > libobj-dir/foobar.c << 'END'
+extern int dummy;
+END
 
 $ACLOCAL
-
-set -e
-
-cp configure.in X
-echo 'AC_LIBSOURCE(maude.c)' >> configure.in
+$AUTOCONF
 $AUTOMAKE
 
-# Avoid timestamp-related differences.
-rm -rf autom4te.cache
+./configure
 
-cp X configure.in
-echo 'AC_LIBSOURCES([maude.c, liver.c])' >> configure.in
-$AUTOMAKE
+$MAKE
+$MAKE check
+$MAKE distcheck
+
+:
diff --git a/tests/libobj2.test b/tests/libobj2.test
index 81b0e72..913fef9 100755
--- a/tests/libobj2.test
+++ b/tests/libobj2.test
@@ -1,6 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 1999, 2000, 2001, 2002
-# Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1999, 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
@@ -20,13 +20,25 @@
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+set -e
+
+cat >> configure.in << 'END'
+AC_CONFIG_FILES([subdir/Makefile])
 AC_PROG_CC
 AC_PROG_RANLIB
 AC_LIBOBJ([fsusage])
-AC_OUTPUT(subdir/Makefile)
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+SUBDIRS = subdir
+check-local: distdir
+       ls -l $(srcdir) $(srcdir)/subdir
+       ls -l $(distdir) $(distdir)/subdir
+       ls -l $(builddir) $(builddir)/subdir
+       test -f $(srcdir)/subdir/fsusage.c
+       test -f $(distdir)/subdir/fsusage.c
+       $(AR) tv $(builddir)/subdir/libtu.a
 END
 
 mkdir subdir
@@ -37,9 +49,20 @@ libtu_a_SOURCES =
 libtu_a_LIBADD = @LIBOBJS@
 END
 
-: > subdir/fsusage.c
+cat > subdir/fsusage.c << 'END'
+extern int dummy;
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+# Older grepping check, kept "just to be sure".
+$FGREP 'fsusage.c' subdir/Makefile.in
+
+./configure
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$MAKE check
+$MAKE distcheck
 
-grep 'fsusage\.c' subdir/Makefile.in
+:
diff --git a/tests/aclibobj.test b/tests/libobj20a.test
similarity index 67%
copy from tests/aclibobj.test
copy to tests/libobj20a.test
index 6ef6f6b..25c3cf3 100755
--- a/tests/aclibobj.test
+++ b/tests/libobj20a.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
+# 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
@@ -14,36 +14,32 @@
 # 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 AC_LIBOBJ and friends work.
+# Test error reporting for AC_CONFIG_LIBOBJ_DIR.
+# See also sister tests `libobj20b.test' and `libobj20c.test' .
 
 . ./defs || Exit 1
 
+set -e
+
 cat >> configure.in << 'END'
+AC_CONFIG_LIBOBJ_DIR([libobj-dir])
 AC_PROG_CC
 AC_PROG_RANLIB
-AC_OUTPUT
+AC_LIBOBJ([foo])
 END
 
 cat > Makefile.am << 'END'
 noinst_LIBRARIES = libtu.a
 libtu_a_SOURCES =
-libtu_a_LIBADD = @LIBOBJS@
+libtu_a_LIBADD = $(LIBOBJS)
 END
 
-: > maude.c
-: > liver.c
+mkdir libobj-dir
+: > libobj-dir/foo.c
 
 $ACLOCAL
+AUTOMAKE_fails
+grep 'LIBOBJS.*used outside.*libobj-dir' stderr
+grep 'subdir-objects.*not set' stderr
 
-set -e
-
-cp configure.in X
-echo 'AC_LIBSOURCE(maude.c)' >> configure.in
-$AUTOMAKE
-
-# Avoid timestamp-related differences.
-rm -rf autom4te.cache
-
-cp X configure.in
-echo 'AC_LIBSOURCES([maude.c, liver.c])' >> configure.in
-$AUTOMAKE
+:
diff --git a/tests/aclibobj.test b/tests/libobj20b.test
similarity index 50%
copy from tests/aclibobj.test
copy to tests/libobj20b.test
index 6ef6f6b..1662110 100755
--- a/tests/aclibobj.test
+++ b/tests/libobj20b.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
+# 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
@@ -14,36 +14,44 @@
 # 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 AC_LIBOBJ and friends work.
+# Test error reporting for AC_CONFIG_LIBOBJ_DIR.
+# See also sister tests `libobj20a.test' and `libobj20c.test' .
 
 . ./defs || Exit 1
 
+set -e
+
 cat >> configure.in << 'END'
+AC_CONFIG_LIBOBJ_DIR([libobj-dir])
 AC_PROG_CC
 AC_PROG_RANLIB
+AC_LIBSOURCE([foobar.c])
+# FIXME: without a call to AC_OUTPUT, Automake does not fail when file(s)
+#        specified in AC_LIBSOURCE call(s) do not exist.  Should we fix
+#        this limitation?  Or is the current behaviour good enough?
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects
 noinst_LIBRARIES = libtu.a
 libtu_a_SOURCES =
-libtu_a_LIBADD = @LIBOBJS@
+libtu_a_LIBADD = $(LIBOBJS)
 END
 
-: > maude.c
-: > liver.c
-
 $ACLOCAL
 
-set -e
+AUTOMAKE_fails
+grep 'configure\.in:.*required directory.*libobj-dir' stderr
+
+mkdir libobj-dir
+: > foobar.c # oops, it should be in libobj-dir...
+AUTOMAKE_fails
+grep 'configure\.in:.*required file.*libobj-dir/foobar.c.*' stderr
 
-cp configure.in X
-echo 'AC_LIBSOURCE(maude.c)' >> configure.in
-$AUTOMAKE
+rm -f foobar.c
 
-# Avoid timestamp-related differences.
-rm -rf autom4te.cache
+: > libobj-dir/foobar.c
+$AUTOMAKE # now we should succeed
 
-cp X configure.in
-echo 'AC_LIBSOURCES([maude.c, liver.c])' >> configure.in
-$AUTOMAKE
+:
diff --git a/tests/aclibobj.test b/tests/libobj20c.test
similarity index 56%
rename from tests/aclibobj.test
rename to tests/libobj20c.test
index 6ef6f6b..4884359 100755
--- a/tests/aclibobj.test
+++ b/tests/libobj20c.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003, 2008  Free Software Foundation, Inc.
+# 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
@@ -14,36 +14,40 @@
 # 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 AC_LIBOBJ and friends work.
+# Test error reporting for AC_CONFIG_LIBOBJ_DIR.
+# See also sister tests `libobj20a.test' and `libobj20b.test' .
 
 . ./defs || Exit 1
 
+set -e
+
 cat >> configure.in << 'END'
+AC_CONFIG_LIBOBJ_DIR([libobj-dir])
 AC_PROG_CC
 AC_PROG_RANLIB
-AC_OUTPUT
+AC_LIBOBJ([foobar])
 END
 
 cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = subdir-objects ## required for our setup to work
 noinst_LIBRARIES = libtu.a
 libtu_a_SOURCES =
-libtu_a_LIBADD = @LIBOBJS@
+libtu_a_LIBADD = $(LIBOBJS)
 END
 
-: > maude.c
-: > liver.c
-
 $ACLOCAL
 
-set -e
+AUTOMAKE_fails
+grep 'configure\.in:.*required directory.*\./libobj-dir' stderr
+
+mkdir libobj-dir
+: > foobar.c # oops, it should be in libobj-dir!
+AUTOMAKE_fails
+grep 'configure\.in:.*required file.*libobj-dir/foobar.c.*' stderr
 
-cp configure.in X
-echo 'AC_LIBSOURCE(maude.c)' >> configure.in
-$AUTOMAKE
+rm -f foobar.c
 
-# Avoid timestamp-related differences.
-rm -rf autom4te.cache
+: > libobj-dir/foobar.c
+$AUTOMAKE # now we should succeed
 
-cp X configure.in
-echo 'AC_LIBSOURCES([maude.c, liver.c])' >> configure.in
-$AUTOMAKE
+:
diff --git a/tests/libobj3.test b/tests/libobj3.test
index 0aeced9..29aa6d5 100755
--- a/tests/libobj3.test
+++ b/tests/libobj3.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1996, 1997, 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 2001, 2002, 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
@@ -14,7 +15,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 we complain if @LIBOBJS@ is used without being set in configure.in
+# Make sure we complain if @LIBOBJS@ is used without being set in
+# configure.in.
 
 . ./defs || Exit 1
 
@@ -32,4 +34,6 @@ END
 
 $ACLOCAL
 AUTOMAKE_fails
-grep 'Makefile.am:3:.*LIBOBJS' stderr
+grep 'Makefile\.am:3:.*LIBOBJS' stderr
+
+:
diff --git a/tests/libobj4.test b/tests/libobj4.test
index d6639be..d31e5ff 100755
--- a/tests/libobj4.test
+++ b/tests/libobj4.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -19,14 +19,18 @@
 
 . ./defs || Exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 bin_PROGRAMS = foo
 END
 
 cat >> configure.in << 'END'
 AC_PROG_CC
-AC_REPLACE_FUNCS(foo)
+AC_REPLACE_FUNCS([foo])
 END
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
+
+:
diff --git a/tests/libobj5.test b/tests/libobj5.test
index 6add9e3..7aa218a 100755
--- a/tests/libobj5.test
+++ b/tests/libobj5.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1996, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1996, 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
@@ -19,6 +19,8 @@
 
 . ./defs || Exit 1
 
+set -e
+
 cat > Makefile.am << 'END'
 bin_PROGRAMS = joe
 LDADD = @LIBOBJS@
@@ -27,11 +29,13 @@ END
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_REPLACE_FUNCS(\
-   foo)
+   foo_bar_quux)
 END
 
-: > foo.c
+: > foo_bar_quux.c
+
+$ACLOCAL
+$AUTOMAKE
+$FGREP foo_bar_quux.c Makefile.in
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
-$FGREP foo.c Makefile.in
+:
diff --git a/tests/libobj7.test b/tests/libobj7.test
index 73a8ab0..be51db7 100755
--- a/tests/libobj7.test
+++ b/tests/libobj7.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1997, 1998, 2000, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1997, 1998, 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
@@ -18,33 +19,55 @@
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+set -e
+
+cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_RANLIB
-AC_REPLACE_FUNCS(basename dirname strsignal)
-AC_OUTPUT(Makefile)
+# `am__dummy_function' is there to ensure that at least one function is
+# replaced, to avoid creating an empty archive which can cause problems
+# with e.g. Solaris ar.
+AC_REPLACE_FUNCS([basename dirname am__dummy_function])
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 noinst_LIBRARIES = libtu.a
 libtu_a_SOURCES =
 libtu_a_LIBADD = @LIBOBJS@
+check-local: test1 test2 test3
+.PHONY: test1 test2 test3
+test1: all
+       $(AR) tv libtu.a
+test2:
+       @echo DIST_COMMON = $(DIST_COMMON)
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]basename\.c '
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]dirname\.c '
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]am__dummy_function\.c '
+test3: distdir
+       test -f $(distdir)/basename.c
+       test -f $(distdir)/dirname.c
+       test -f $(distdir)/am__dummy_function.c
+END
+
+cat > basename.c <<'END'
+extern int dummy1;
+END
+cat > dirname.c <<'END'
+extern int dummy2;
 END
+cat > am__dummy_function.c <<'END'
+extern int dummy3;
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE
+$MAKE check
+$MAKE distcheck
 
-: > basename.c
-: > dirname.c
-: > strsignal.c
-
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
-
-sed -n -e ': again
-  /^DIST_COMMON.*[^\]$/ p
-  /^DIST_COMMON/ {
-     s/^DIST_COMMON//p
-     n
-     s/^/DIST_COMMON/
-     b again
-  }' < Makefile.in | $FGREP dirname.c
+:
diff --git a/tests/libobj8.test b/tests/libobj8.test
index c06746b..95f21ed 100755
--- a/tests/libobj8.test
+++ b/tests/libobj8.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2000, 2001, 2002, 2006  Free Software Foundation, Inc.
+# Copyright (C) 1998, 2000, 2001, 2002, 2006, 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
@@ -19,15 +20,15 @@
 
 . ./defs || Exit 1
 
-cat > configure.in << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
+set -e
+
+cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_CC_STDC
 AC_PROG_RANLIB
 AC_REPLACE_FUNCS(basename dirname strsignal)
 AM_C_PROTOTYPES
-AC_OUTPUT(Makefile)
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
@@ -44,7 +45,9 @@ END
 : > ansi2knr.1
 : > ansi2knr.c
 
-$ACLOCAL || Exit 1
-$AUTOMAKE || Exit 1
+$ACLOCAL
+$AUTOMAKE
+
+$FGREP 'strsignal_.c:' Makefile.in
 
-grep 'strsignal_.c:' Makefile.in
+:
diff --git a/tests/ltlibobjs.test b/tests/ltlibobjs.test
index fd66473..e34e667 100755
--- a/tests/ltlibobjs.test
+++ b/tests/ltlibobjs.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 1999, 2001, 2002  Free Software Foundation, Inc.
+# Copyright (C) 1999, 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
@@ -19,8 +19,10 @@
 required=libtool
 . ./defs || Exit 1
 
+set -e
+
 cat >> configure.in << 'END'
-AC_SUBST(LTLIBOBJS)
+AC_SUBST([LTLIBOBJS])
 AC_PROG_LIBTOOL
 END
 
@@ -35,5 +37,7 @@ END
 : > config.guess
 : > config.sub
 
-$ACLOCAL || Exit 1
+$ACLOCAL
 $AUTOMAKE
+
+:
-- 
1.7.1


reply via email to

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