automake-commit
[Top][All Lists]
Advanced

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

[Automake-commit] [SCM] GNU Automake branch, msvc, updated. v1.11-537-g9


From: Peter Rosin
Subject: [Automake-commit] [SCM] GNU Automake branch, msvc, updated. v1.11-537-g91ab753
Date: Mon, 24 Oct 2011 08:47:07 +0000

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GNU Automake".

http://git.sv.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=91ab753b7b654934aaa34006067a92993bb53c09

The branch, msvc has been updated
       via  91ab753b7b654934aaa34006067a92993bb53c09 (commit)
       via  9b5ced02fd41130d408d95808855a067eb82dd68 (commit)
       via  beef7a6673037dee4508e91ef9b4515e0b0246f0 (commit)
       via  6a2fe8188c546a1cdf0bfbb72f6ac9f1fcd70b78 (commit)
       via  e98cba8d0c5d7b1826b1a450a750346a13b4da13 (commit)
       via  cc2202a6b0d5a7dc2f8af17e4ac2fdd3fe46d267 (commit)
       via  c7a6a92ea100e3c78c7f48bd6a672da3ad46fc7f (commit)
       via  d2b90968332e5903a1408d49ec967602e499363d (commit)
       via  7cb64d4f6501319acc6984adb3589f60f6e047e9 (commit)
       via  65c015849f02bec4b7c106758be71db12f602d73 (commit)
       via  100e97400a06c0f9af0ea7be99aa60be95c624bf (commit)
       via  f8f8ec0e6c0dbcaa458e48efa7b5c64960e528bd (commit)
       via  d91f357d9841d2da2fe7538bbcff73bcca94435a (commit)
       via  7a770586e81edba77ebdbd83fb6ca6fed39d2fab (commit)
       via  8c021e00169da8802d47e9428e282aa6ff78b656 (commit)
       via  ded01c88c9579656cc138ce7e0b55dcf025b1a5a (commit)
       via  f5b69b8a0d787cf798653fdb975affa9e7ff44b8 (commit)
       via  7e5ae808d830c9319a4dd3d357b10dcf4315f529 (commit)
       via  94ad7e48dc63321ca334e71c0f87dc3eada8ffd6 (commit)
       via  02ab80cebbb9efc1e3dfbd3034dc517f3c5e099d (commit)
       via  ae412c3817a7fe6d553863c0b2a825bd400e4b76 (commit)
       via  ba0c477b275aaae0e4f77003ac96f4cc2ec12ebf (commit)
       via  d710255c09afd2d6e06d72259816988a0a79ea18 (commit)
       via  b9b79d887abdc615bae92a9dd79de881664d19d3 (commit)
       via  7d40532a3464eee6a26d303c378c44af95075698 (commit)
       via  39a9fd16381469f911d42a3e27975edcb248bbf2 (commit)
       via  736fde9f6cf8d514ef30dc5d83fe2a41c3e22c9a (commit)
       via  0773a99888c8932c19b61145d78317278d2bdd66 (commit)
       via  1cfe9542265d1d2a36d7cd90751b2ed269b0fbd3 (commit)
       via  59919b1abf748166c0329fa1bfe5f3c3302670c2 (commit)
       via  e8082fb643b8ecd5997b9d8ca52204a81d60ea10 (commit)
       via  bbfca16e5b63386abb44f0872555198e86bd8738 (commit)
       via  90bea64bc5023be075b63bf7c651d0242f35a83c (commit)
       via  c5d19098a3deb8fc7f6ca89398edb22854737950 (commit)
       via  e834f22817217fa113e6c900d08a553051384227 (commit)
       via  6816b316a8424f868342218eab4d61497988bea6 (commit)
       via  8dc8556c9a4d1680aae579698ac3f39d39f235e5 (commit)
       via  2126b691505027fb1041a0fbd82281dd042a5bfe (commit)
       via  b10236760bd33b263be14cbd51aacaf78235e601 (commit)
       via  a2803e6a0d65e5124dd12d89acab61ac8fc11a53 (commit)
       via  b100d18da312f4b22be283b9a877b221667b2245 (commit)
       via  a2498fe8d148c507e5e09b7de8a5aee9f2418e5c (commit)
       via  c4f363ff3d699eaa6b1e1cc079d33749957934c9 (commit)
       via  eae5cfa9b373ee19b2768957b53dbe53a586b69e (commit)
       via  b9fa1fc1eb50d7907764ec0972a674548a7bd8b3 (commit)
       via  33805241126d1b087eb8af401a5f84cb33e88a3d (commit)
       via  15721c4885b8f24ca9ce2c5f2c42899277a11261 (commit)
       via  122cb639106d5b3a8dad966e43af03426670642a (commit)
       via  2c57ac68468784a67c7ed8dced20cd5ac2b63e61 (commit)
       via  73497948db0d2c6c7418f7df5c129eeee16ddf51 (commit)
       via  9393a25995d4bbedc5103cce3e7dd9a7dd39e8d6 (commit)
       via  d5ebf21cccd0597f53e7b3c4063dff4704e454a6 (commit)
       via  0209b6ddef31d414e59c6f34ae7642e9785b5770 (commit)
       via  7aea1edaab587725f4a9becd30c00b5917cfe3f0 (commit)
       via  fb7141a5a2f1da7ec13f3cb14043a0591e8ff3ea (commit)
       via  c9dfc368a623178f32b67b164f051e9ab65edd99 (commit)
       via  dd7e620bf9ef468a762be8594c61c7e5bb0b0d27 (commit)
       via  0b7d3cbc93055201bc58497e6519f477d0b72701 (commit)
       via  8d97cb95019b04707fdd60b4d9994d0acc9c6554 (commit)
       via  e9e0b23fc89dbec01138359033b13a8f8be50ee8 (commit)
       via  c9a6f7e262be9f011862580a07e37091819b6785 (commit)
       via  9a937d21bbf695af2749d6ca2cd2def96009ec9a (commit)
       via  2990ef353fa395d1b7ded2aa15f5cf574adbb78d (commit)
       via  20787ab1199329eda967d14a6fd1d7f6a92d149a (commit)
       via  5e4631085ef78ab2385429e123006e9daa1e7d7d (commit)
       via  4412308796486424c901342ea9361cd0ce597184 (commit)
       via  2d5a0d87ddeaaab474e4fc1d9816feb275711384 (commit)
       via  30f99cbd07736c96603d15346fc8ad9097a0dddd (commit)
       via  672fd9352b5b8a07ab0c74cef2357770497fcdaa (commit)
       via  527d34a6af23afcbede70765e72a255c7affe729 (commit)
       via  9f10765954f400c047b3d6cd12e31e54efefe0c3 (commit)
       via  fc27b8fa70ffad842a525e05d5069022b96f6388 (commit)
       via  3f7d0a5e8a9970e166a228a32a3bc80cd6da7868 (commit)
       via  a2ebf0e5b1f34d76ce92673cf8575a10d33f9b05 (commit)
       via  cd16ceb382de8f64d44efd7dd1948c33fc52566e (commit)
       via  429b748cecaa046d11f5a93bea0c93c809179ed6 (commit)
       via  a716df2ed5f62889d3b442d5ecc5e2edd6794ee4 (commit)
       via  dd8b570a6a55cb20690cdc2c312309338d2495d3 (commit)
       via  b46debf534a9adab1b7c8e8b96c3c11de5dc9ae4 (commit)
       via  0c0b402635f34abd5dd6e33a81d89dd8057a0d73 (commit)
       via  253c2e7e4afc90ca4b9077f9b85fbc0944133ef9 (commit)
      from  b07777bd6da63018e845e18ce96c4168343b47b6 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 91ab753b7b654934aaa34006067a92993bb53c09
Merge: cc2202a 9b5ced0
Author: Peter Rosin <address@hidden>
Date:   Mon Oct 24 09:04:24 2011 +0200

    Merge branch 'maint' into msvc
    
    * tests/subpkg-yacc.test: Adjust to new portability requirements due
    to the new AM_PROG_AR macro.

commit cc2202a6b0d5a7dc2f8af17e4ac2fdd3fe46d267
Author: Peter Rosin <address@hidden>
Date:   Fri Oct 21 00:24:38 2011 +0200

    warnings: new 'extra-portability' category, for AM_PROG_AR
    
    * lib/Automake/ChannelDefs.pm: Register new extra-portability
    warning channel.
    (switch_warning): Turn off extra-portability if portability is
    turned off, and turn on portability if extra-portability is
    turned on.
    (set_strictness): Silence extra-portability for --gnits, --gnu
    and --foreign.
    * tests/extra-portability2.test: New test, checking that the
    extra-portability channel is silenced by --gnits, --gnu and
    --foreign.
    * doc/automake.texi (Invoking Automake): Document the new warning
    category and its interaction with the portability category.
    * tests/extra-portability.test: New test, checking the interaction
    between the portability and extra-portability warning categories.
    * automake.in (handle_libraries, handle_ltlibraries): Move the
    AM_PROG_AR warnings to the new extra-portability channel.
    * tests/ar2.test: Adjust to the new warning channel.
    * tests/pr300-lib.test: Likewise.
    * tests/pr300-ltlib.test: Likewise.
    * tests/pr307.test: Likewise.
    * tests/pr401.test: Likewise.
    * tests/pr401b.test: Likewise.
    * tests/pr401c.test: Likewise.
    * tests/pr72.test: Likewise.
    * NEWS: Likewise.
    * tests/Makefile.am (TESTS): Update.
    
    Signed-off-by: Peter Rosin <address@hidden>

commit c7a6a92ea100e3c78c7f48bd6a672da3ad46fc7f
Author: Peter Rosin <address@hidden>
Date:   Fri Oct 21 00:23:34 2011 +0200

    ar-lib: new 'AM_PROG_AR' macro, triggering the 'ar-lib' script
    
    * m4/ar-lib.m4: New macro AM_PROG_AR, which locates an
    archiver and triggers the auxiliary 'ar-lib' script if needed.
    * m4/Makefile.am (dist_m4data_DATA): Update.
    * automake.in ($seen_ar): New variable.
    (scan_autoconf_traces): Set it.
    (handle_libraries, handle_ltlibraries): Require AM_PROG_AR for
    portability.
    * doc/automake.texi (Public Macros): Mention the new
    'AM_PROG_AR' macro.
    (Subpackages): Add AM_PROG_AR to the example.
    (A Library): Adjust recommendations for AR given the new
    AM_PROG_AR macro.
    * All relevant tests: Adjust to new portability requirements due
    to the new AM_PROG_AR macro.
    * tests/ar-lib2.test: New test, checking that AM_PROG_AR triggers
    install of ar-lib.
    * tests/ar-lib3.test: New test, checking that lib_LIBRARIES
    requires AM_PROG_AR.
    * tests/ar-lib4.test: New test, checking that lib_LTLIBRARIES
    requires AM_PROG_AR.
    * tests/ar-lib5a.test: New test, checking that AM_PROG_AR triggers
    use of ar-lib when the archiver is Microsoft lib.
    * tests/ar-lib5b.test: New test, checking that AM_PROG_AR triggers
    use of ar-lib when the archiver is a faked lib.
    * tests/ar-lib6a.test: New test, checking the ordering of
    AM_PROG_AR and LT_INIT.
    * tests/ar-lib6b.test: New test, checking the ordering of
    AM_PROG_AR and AC_PROG_LIBTOOL.
    * tests/ar-lib7.test: New test, checking that automake warns
    if ar-lib is missing.
    * tests/ar3.test: New test, checking that AR and ARFLAGS may
    be overridden by the user even if AM_PROG_AR is used.
    * tests/ar4.test: New test, checking that AM_PROG_AR bails out
    if it cannot determine the archiver interface.
    * tests/ar5.test: New test, checking that AM_PROG_AR runs its
    optional argument if it cannot determine the archiver interface.
    * tests/defs.in: New required entry 'lib'.
    * tests/Makefile.am (TESTS): Update.
    * NEWS: Update.
    
    Signed-off-by: Peter Rosin <address@hidden>

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |  629 ++++++++++++++++++++
 Makefile.in                                        |   24 +-
 NEWS                                               |   49 ++
 THANKS                                             |    4 +-
 aclocal.in                                         |   89 ++--
 automake.in                                        |   82 +++-
 bootstrap                                          |    4 +-
 doc/Makefile.in                                    |   14 +-
 doc/automake.texi                                  |  202 +++++--
 lib/Automake/ChannelDefs.pm                        |   13 +
 lib/Automake/Makefile.in                           |   14 +-
 lib/Automake/tests/Makefile.in                     |    6 +
 lib/Makefile.in                                    |   14 +-
 lib/am/Makefile.in                                 |   10 +-
 lib/am/data.am                                     |    4 +-
 lib/am/dejagnu.am                                  |   20 +-
 lib/am/distdir.am                                  |   22 +-
 lib/am/inst-vars.am                                |   18 +
 lib/am/java.am                                     |   14 +-
 lib/am/libs.am                                     |    4 +-
 lib/am/lisp.am                                     |    8 +-
 lib/am/mans.am                                     |    8 +-
 lib/am/python.am                                   |   34 +-
 lib/am/scripts.am                                  |    4 +-
 lib/py-compile                                     |   51 +-
 m4/Makefile.am                                     |   13 +-
 m4/Makefile.in                                     |   89 ++-
 m4/{ => acdir}/dirlist                             |    0
 m4/ar-lib.m4                                       |   58 ++
 tests/Makefile.am                                  |   57 ++
 tests/Makefile.in                                  |   65 ++-
 tests/aclibobj.test                                |    2 +
 tests/aclocal-acdir.test                           |   97 +++
 tests/aclocal-path-install-serial.test             |   88 +++
 tests/aclocal-path-install.test                    |   55 ++
 tests/aclocal-path-nonexistent.test                |   36 ++
 tests/aclocal-path-precedence.test                 |   93 +++
 tests/aclocal-path.test                            |   58 ++
 tests/aclocal-print-acdir.test                     |   35 ++
 tests/aclocal.in                                   |    6 +-
 tests/aclocal.test                                 |    6 +-
 tests/aclocal4.test                                |    3 +-
 tests/ansi10.test                                  |    1 +
 tests/ar-lib2.test                                 |   40 ++
 tests/ar-lib3.test                                 |   45 ++
 tests/ar-lib4.test                                 |   57 ++
 tests/ar-lib5a.test                                |   72 +++
 tests/ar-lib5b.test                                |   83 +++
 tests/ar-lib6a.test                                |   39 ++
 tests/ar-lib6b.test                                |   39 ++
 tests/ar-lib7.test                                 |   36 ++
 tests/ar.test                                      |    3 +
 tests/ar2.test                                     |    2 +-
 tests/ar3.test                                     |   43 ++
 tests/ar4.test                                     |   35 ++
 tests/ar5.test                                     |   33 +
 tests/canon4.test                                  |    3 +
 tests/check12.test                                 |  206 +++++++
 tests/compile4.test                                |    1 +
 tests/cond13.test                                  |    3 +
 tests/condlib.test                                 |    3 +
 tests/defs.in                                      |    8 +
 tests/dejagnu-absolute-builddir.test               |   62 ++
 tests/dejagnu-relative-srcdir.test                 |   86 +++
 tests/dejagnu-siteexp-append.test                  |   72 +++
 tests/dejagnu-siteexp-extend.test                  |  161 +++++
 tests/dejagnu-siteexp-useredit.test                |   69 +++
 tests/dejagnu.test                                 |    7 +-
 tests/dejagnu2.test                                |   21 +-
 tests/dejagnu3.test                                |   17 +-
 tests/dejagnu4.test                                |   19 +-
 tests/dejagnu5.test                                |   19 +-
 tests/dejagnu6.test                                |   16 +-
 tests/dejagnu7.test                                |   10 +-
 tests/depcomp4.test                                |    1 +
 tests/depcomp6.test                                |    1 +
 tests/depcomp7.test                                |    1 +
 tests/depcomp8b.test                               |    1 +
 tests/dist-auxfile-2.test                          |   62 ++
 tests/dist-auxfile.test                            |   96 +++
 tests/distcheck-hook-m4.am                         |   30 +
 tests/distcheck-missing-m4.test                    |  120 ++++
 tests/distcheck-outdated-m4.test                   |  139 +++++
 tests/distcheck-override-infodir.test              |   63 ++
 tests/distcheck-pr9579.test                        |   98 +++
 tests/extra-portability.test                       |   69 +++
 tests/extra-portability2.test                      |   53 ++
 tests/fort5.test                                   |    1 +
 tests/instdir-java.test                            |    1 +
 tests/instdir-ltlib.test                           |    1 +
 tests/instdir-prog.test                            |    1 +
 tests/instfail-libtool.test                        |    1 +
 tests/instfail.test                                |    1 +
 tests/insthook.test                                |    6 +-
 tests/instspc.test                                 |    1 +
 tests/java-clean.test                              |   68 +++
 tests/java-compile-install.test                    |   99 +++
 tests/java-mix.test                                |   69 +++
 tests/java-no-duplicate.test                       |   47 ++
 tests/java-nobase.test                             |   67 ++
 tests/java-sources.test                            |   67 ++
 tests/java.test                                    |    9 +-
 tests/javadir-undefined.test                       |   37 ++
 tests/ldflags.test                                 |    2 +
 tests/libobj10.test                                |    3 +
 tests/libobj11.test                                |    2 +
 tests/libobj12.test                                |    2 +
 tests/libobj13.test                                |    1 +
 tests/libobj2.test                                 |    2 +
 tests/libobj7.test                                 |    2 +
 tests/libobj8.test                                 |    2 +
 tests/library.test                                 |    3 +
 tests/libtoo10.test                                |    1 +
 tests/libtool2.test                                |    1 +
 tests/libtool3.test                                |    1 +
 tests/libtool5.test                                |    1 +
 tests/libtool6.test                                |    1 +
 tests/libtool7.test                                |    1 +
 tests/libtool8.test                                |    1 +
 tests/libtool9.test                                |    1 +
 tests/listval.test                                 |    2 +
 tests/location.test                                |    3 +
 tests/ltcond.test                                  |    1 +
 tests/ltcond2.test                                 |    1 +
 tests/ltconv.test                                  |    1 +
 tests/ltdeps.test                                  |    2 +
 tests/ltinit.test                                  |    1 +
 tests/ltinstloc.test                               |    3 +-
 tests/ltlibobjs.test                               |    2 +
 tests/ltlibsrc.test                                |    1 +
 tests/ltorder.test                                 |    1 +
 tests/multlib.test                                 |    2 +
 tests/nobase-libtool.test                          |    1 +
 tests/nobase-nodist.test                           |   62 ++
 tests/nobase.test                                  |    1 +
 tests/noinstdir.test                               |    3 +
 tests/parallel-tests3.test                         |   19 +-
 tests/pr300-lib.test                               |    2 +-
 tests/pr300-ltlib.test                             |    2 +-
 tests/pr307.test                                   |    2 +-
 tests/pr401.test                                   |   10 +-
 tests/pr401b.test                                  |   10 +-
 tests/pr401c.test                                  |   10 +-
 tests/pr72.test                                    |    2 +-
 tests/primary-prefix-couples-documented-valid.test |    1 +
 tests/primary-prefix-couples-force-valid.test      |    3 +-
 tests/primary-prefix-invalid-couples.test          |    2 +
 tests/primary-prefix-valid-couples.test            |    4 +-
 tests/py-compile-basedir.test                      |   51 ++
 tests/py-compile-basic.test                        |   64 ++
 tests/py-compile-basic2.test                       |   71 +++
 tests/py-compile-destdir.test                      |   44 ++
 tests/py-compile-env.test                          |   60 ++
 tests/py-compile-option-terminate.test             |   44 ++
 tests/py-compile-usage.test                        |   75 +++
 tests/silent3.test                                 |    1 +
 tests/silent4.test                                 |    1 +
 tests/silent9.test                                 |    1 +
 tests/specflg-dummy.test                           |    1 +
 tests/specflg2.test                                |    3 +
 tests/stdlib2.test                                 |    1 +
 tests/strip2.test                                  |    1 +
 tests/strip3.test                                  |    1 +
 tests/subdir4.test                                 |    3 +
 tests/subdirbuiltsources.test                      |    1 +
 tests/subobj10.test                                |    1 +
 tests/subobj9.test                                 |    1 +
 tests/subpkg-yacc.test                             |  151 +++++
 tests/subpkg.test                                  |   29 +-
 tests/subst3.test                                  |    1 +
 tests/substtarg.test                               |    3 +
 tests/suffix10.test                                |    1 +
 tests/suffix2.test                                 |    1 +
 tests/suffix5.test                                 |    2 +
 tests/suffix8.test                                 |    1 +
 tests/test-extensions-cond.test                    |   72 +++
 tests/test-extensions.test                         |   74 +++
 tests/uninstall-fail.test                          |   67 ++
 tests/uninstall-pr9578.test                        |   69 +++
 tests/vala.test                                    |    1 +
 tests/vala1.test                                   |    1 +
 181 files changed, 5350 insertions(+), 352 deletions(-)
 rename m4/{ => acdir}/dirlist (100%)
 create mode 100644 m4/ar-lib.m4
 create mode 100755 tests/aclocal-acdir.test
 create mode 100755 tests/aclocal-path-install-serial.test
 create mode 100755 tests/aclocal-path-install.test
 create mode 100755 tests/aclocal-path-nonexistent.test
 create mode 100755 tests/aclocal-path-precedence.test
 create mode 100755 tests/aclocal-path.test
 create mode 100755 tests/aclocal-print-acdir.test
 create mode 100755 tests/ar-lib2.test
 create mode 100755 tests/ar-lib3.test
 create mode 100755 tests/ar-lib4.test
 create mode 100755 tests/ar-lib5a.test
 create mode 100755 tests/ar-lib5b.test
 create mode 100755 tests/ar-lib6a.test
 create mode 100755 tests/ar-lib6b.test
 create mode 100755 tests/ar-lib7.test
 create mode 100755 tests/ar3.test
 create mode 100755 tests/ar4.test
 create mode 100755 tests/ar5.test
 create mode 100755 tests/check12.test
 create mode 100755 tests/dejagnu-absolute-builddir.test
 create mode 100755 tests/dejagnu-relative-srcdir.test
 create mode 100755 tests/dejagnu-siteexp-append.test
 create mode 100755 tests/dejagnu-siteexp-extend.test
 create mode 100755 tests/dejagnu-siteexp-useredit.test
 create mode 100755 tests/dist-auxfile-2.test
 create mode 100755 tests/dist-auxfile.test
 create mode 100644 tests/distcheck-hook-m4.am
 create mode 100755 tests/distcheck-missing-m4.test
 create mode 100755 tests/distcheck-outdated-m4.test
 create mode 100755 tests/distcheck-override-infodir.test
 create mode 100755 tests/distcheck-pr9579.test
 create mode 100755 tests/extra-portability.test
 create mode 100755 tests/extra-portability2.test
 create mode 100755 tests/java-clean.test
 create mode 100755 tests/java-compile-install.test
 create mode 100755 tests/java-mix.test
 create mode 100755 tests/java-no-duplicate.test
 create mode 100755 tests/java-nobase.test
 create mode 100755 tests/java-sources.test
 create mode 100755 tests/javadir-undefined.test
 create mode 100755 tests/nobase-nodist.test
 create mode 100755 tests/py-compile-basedir.test
 create mode 100755 tests/py-compile-basic.test
 create mode 100755 tests/py-compile-basic2.test
 create mode 100755 tests/py-compile-destdir.test
 create mode 100755 tests/py-compile-env.test
 create mode 100755 tests/py-compile-option-terminate.test
 create mode 100755 tests/py-compile-usage.test
 create mode 100755 tests/subpkg-yacc.test
 create mode 100755 tests/test-extensions-cond.test
 create mode 100755 tests/test-extensions.test
 create mode 100755 tests/uninstall-fail.test
 create mode 100755 tests/uninstall-pr9578.test

diff --git a/ChangeLog b/ChangeLog
index 4e1c067..003b69a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,571 @@
+2011-10-24  Peter Rosin  <address@hidden>
+
+       Merge branch 'maint' into msvc
+
+       * tests/subpkg-yacc.test: Adjust to new portability requirements due
+       to the new AM_PROG_AR macro.
+
+2011-10-19  Stefano Lattarini  <address@hidden>
+
+       dejagnu: allow the package developer to extend site.exp
+       Fixes automake bug#7873.
+       * lib/am/dejagnu.am (site.exp): Depend from the files listed in
+       $(EXTRA_DEJAGNU_SITE_CONFIG), if any.  Append their contents to
+       the generated site.exp (still preserving user edits).
+       * doc/automake.texi (Dejagnu Tests): Update.
+       * tests/dejagnu-siteexp-append.test: New test.
+       * tests/dejagnu-siteexp-extend.test: Likewise.
+       * tests/dejagnu-siteexp-useredit.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+       * NEWS: Update.
+       Suggestion by Rainer Orth.
+
+2011-10-19  Stefano Lattarini  <address@hidden>
+
+       dejagnu: ensure 'srcdir' is defined as a relative directory
+       This change fixes automake bug#7833.
+       * lib/am/dejagnu.am (check-DEJAGNU): Prefer using plain $(srcdir)
+       over calculating and using the absolute path of $(srcdir).
+       * tests/dejagnu-relative-srcdir.test: New test.
+       * tests/dejagnu-absolute-builddir.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+       Report by Ian Lance Taylor.  Suggestions by Ralf Wildenhues.
+
+2010-12-13  Ralf Wildenhues  <address@hidden>
+
+       Fix testsuite failure of check12.test without DejaGNU.
+       * tests/check12.test: Require runtest.
+
+2010-12-10  Stefano Lattarini  <address@hidden>
+
+       Extend and improve tests on DejaGnu support.
+       * tests/dejagnu.test: Do not create useless dummy test script.
+       Add trailing `:' command.  In heading comments, add reference
+       to ...
+       * tests/check12.test: ... this new "semantic" test, covering
+       concurrent use of dejagnu tests, simple tests and `check-local'
+       target.
+       * tests/dejagnu2.test: Make test more reliable, by avoid weak
+       grepping of make output.  Prefer `cat' over `echo' to append
+       to configure.in.  Quote literal dots in grep regexps.  Prefer
+       `grep -c ...' over `grep ... | wc -l'.  Make grepping of
+       automake stderr slightly stricter.  Add trailing `:' command.
+       * tests/dejagnu3.test: Prefer `cat' over `echo' to append to
+       configure.in.  Check stderr of expected-to-fail "make" call.
+       Remove extra blank lines from Makefile.am.
+       * tests/dejagnu4.test: Prefer `cat' over `echo' to append to
+       configure.in.  Prefer `mv -f' over plain `mv' when the target
+       file already exists.  Avoid extra mkdir calls by creating more
+       directories at once.  Better use of blank lines.  Check that
+       the `*.log' and `*.sum' files are created by runtest also when
+       "make check" fails.
+       * tests/dejagnu7.test: Prefer `cat' over `echo' to append to
+       configure.in.  Better use of blank lines.  Add a trailing `:'
+       command.
+       * tests/dejagnu6.test: Likewise, and give the dejagnu test a
+       more descriptive name.
+       * tests/dejagnu5.test: Likewise.  Also, simply define package
+       name to `$me' rather than using a non-obvious sed script to
+       extract it from `AC_INIT', and write the Makefile.am with only
+       one command.
+       * tests/Makefile.am (TESTS): Updated.
+
+2011-10-21  Peter Rosin  <address@hidden>
+
+       * THANKS: Fix whitespace issue.
+
+2011-10-18  Stefano Lattarini  <address@hidden>
+
+       tests: fix spurious failure with FreeBSD make and Yacc in VPATH
+       * tests/subpkg.test: Some cosmetic adjustments.  Move the tests
+       checking that $(YLWRAP) is defined and installed properly when
+       ylwrap is in a default auxdir found in a parent package ...
+       * tests/subpkg-yacc.test: ... into this new test, which carefully
+       avoids to trigger the known bug#7884 (combo FreeBSD make plus Yacc
+       plus VPATH build).
+       * tests/Makefile.am (TESTS): Update.
+
+2011-10-18  Stefano Lattarini  <address@hidden>
+
+       tests: avoid spurious failure in 'parallel-tests3.test'
+       This fixes automake bug#8788.
+       * tests/parallel-tests3.test: To ensure that the serial run of
+       the dummy testsuite is still ongoing when the parallel run has
+       terminated, use `kill -0', not a bare `kill'.  This will prevent
+       a testsuite crash on NetBSD 5.1, and a testsuite hang on FreeBSD
+       8.2.  Also, since we are at it, try harder to avoid possible
+       hangs of the script in other unusual situations.
+
+2011-10-20  Stefano Lattarini  <address@hidden>
+
+       tests: fix spurious failures with "chatty" make implementations
+       * tests/distcheck-missing-m4.test: On failure, some make
+       implementations (such as Solaris make) print the whole failed
+       recipe on standard output.  This was causing a spurious failure
+       in the checks grepping the output from make.  Work around this.
+       * tests/distcheck-outdated-m4.test: Likewise.
+
+2011-10-20  Stefano Lattarini  <address@hidden>
+
+       tests: fix spurious failure on fast machines
+       * tests/aclocal-path-precedence.test: Also remove the `configure'
+       script between different test runs, to ensure it is always remade
+       by autoconf.  Add proper explicative comments.
+
+2011-10-20  Stefano Lattarini  <address@hidden>
+
+       tests: avoid spurious failure of 'uninstall-fail.test' on Solaris
+       * tests/uninstall-fail.test: All the Solaris 10 shells (/bin/sh,
+       /bin/ksh, and /usr/xpg4/bin/sh), upon failing to chdir to a
+       directory with the `cd' builtin, print a message like:
+         "sh: /root: permission denied"
+       which doesn't report the `cd' builtin anywhere.  Relax the grepping
+       of the error message accordingly.
+
+2011-10-19  Stefano Lattarini  <address@hidden>
+
+       tests: avoid spurious failure of 'uninstall-fail.test' on Cygwin
+       * tests/uninstall-fail.test: Be sure to really skip this test
+       on systems that allows files to be removed from unwritable
+       directories.  Motivated by a spurious failure on Cygwin 1.5.
+
+2011-10-17  Stefano Lattarini  <address@hidden>
+
+       tests: fix spurious failure with autoconf 2.62
+       * tests/aclocal-path-precedence.test: Rewrite configure.in,
+       rather than appending to it, to avoid spurious failures (at
+       least with autoconf 2.62) due to repeated calls to AC_INIT.
+       Also, add package name and version arguments to AC_INIT, to
+       avoid spurious errors from automake.
+
+2011-10-16  Stefano Lattarini  <address@hidden>
+
+       docs: avoid using colon character inside arguments of @pxref
+       Fixes automake bug#9753
+       * doc/automake.texi (VPATH Builds): Avoid using colon character
+       `:' inside arguments of @pxref, as this can cause problems in
+       the generated `.info' files, and such an usage will be explicitly
+       forbidden by future texinfo documentation.
+       * THANKS: Update.
+       Reported by Дилян Палаузов.
+
+2011-10-07  Stefano Lattarini  <address@hidden>
+
+       parallel-tests: warn on conditional TEST_EXTENSIONS definition
+       Before this change, automake would have still bailed out, but
+       with a confusing error message (about an invalid redefinition
+       of TEST_EXTENSIONS).
+       * automake.in (handle_tests): Warn explicitly if TEST_EXTENSIONS
+       has conditional contents.
+       * tests/test-extensions-con.test: New test.
+       * tests/Makefile.am (TESTS): Add it.
+       * NEWS: Update.
+
+2011-10-06  Stefano Lattarini  <address@hidden>
+
+       parallel-tests: don't allow @substitutions@ in TEST_EXTENSIONS
+       Even after the last commit `v1.11-476-g90bea64', the checks
+       performed by automake on entries in $(TEST_EXTENSIONS) tried to
+       allow for @substitited@ stuff.  This however ends up allowing
+       quite brittle setups, which, most importantly, are of no real
+       practical usefulness anyway.  So it's better to just disallow
+       @substitutions@ in TEST_EXTENSIONS altogether, offering a clear
+       error message, instead of risking weird bugs and unexpected
+       behaviors in the generated Makefile.in.
+       * automake.in ($TEST_EXTENSION_PATTERN): Turned from a regular
+       expression ...
+       (is_valid_test_extension): ... into this subroutine.  Don't allow
+       generic @substitutions@ anymore (possibly making an exception for
+       address@hidden@' under the proper circumstances).
+       * tests/test-extensions.test: Adjust and extend.
+
+2011-10-06  Stefano Lattarini  <address@hidden>
+
+       tests: fix spurious failure in 'insthook.test'
+       * tests/insthook.test (Makefile.am): Add a proper `uninstall-hook'
+       target to remove the symlink created by the `install-exec-hook'
+       target; this prevents "make distcheck" from failing spuriously.
+       Since we are at it, delete an extra blank line, and add a trailing
+       `:' command.
+
+2011-10-06  Stefano Lattarini  <address@hidden>
+
+       maintcheck: fix spurious failure
+       * lib/am/distdir.am: Use `$(infodir)', not `${infodir}', to avoid
+       complaints from the `sc_no_brace_variable_expansions' maintainer
+       check.
+
+2011-10-06  Stefano Lattarini  <address@hidden>
+
+       fix: make a test script executable
+       * tests/nobase-nodist.test: Make executable.
+
+2011-10-06  Stefano Lattarini  <address@hidden>
+
+       coverage: expose automake bug#9651
+       * tests/dist-auxfile.test: New test, xfailing.
+       * tests/dist-auxfile-2.test: Likewise.
+       * tests/Makefile.am (TESTS, XFAIL_TESTS): Add them.
+
+2011-10-01  Stefano Lattarini  <address@hidden>
+
+       parallel-tests: automake error our on invalid TEST_EXTENSIONS
+       This change fixes automake bug#9400.
+       * automake.in (handle_tests): Bail out if a suffix specified in
+       TEST_EXTENSIONS would produce an invalid `xxx_LOG_COMPILER'
+       variable or an invalid suffix rule.  Before this change, automake
+       would have issued a confusing error messages (about invalid or
+       non-POSIX variables being defined), and in some situations would
+       have even produced a broken `Makefile.in' file.
+       ($TEST_EXTENSION_PATTERN): New helper variable.
+       * doc/automake.texi (Simple Tests using parallel-tests): Document
+       the limitations on TEST_EXTENSIONS explicitly.
+       * NEWS: Update.
+       * tests/test-extensions.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-09-28  Stefano Lattarini  <address@hidden>
+
+       docs: don't suggest installing `.m4' files in hard-coded location
+       This change fixes automake bug#7988.
+       * doc/automake.texi (aclocal Options): State that the use of
+       the `--print-ac-dir' option to determine the directory where
+       third-party packages can install their `.m4' files is discouraged
+       now.
+       (Extending aclocal): Suggest telling the user about ACLOCAL_PATH.
+       * THANKS: Update.
+       Report by Peter Johansson.
+
+2011-09-26  Stefano Lattarini  <address@hidden>
+
+       distuninstallcheck: fail also when only one file is left installed
+       This change fixes automake bug#9579.
+       * lib/am/distdir.am (distuninstallcheck): Be stricter in ignoring
+       a potential `dir' file created by install-info and left installed.
+       Also, be more careful about "this can't happen" kind of errors.
+       (am__distuninstallcheck_listfiles): New internal helper macro.
+       * tests/distcheck-pr9579.test: New test.
+       * tests/distcheck-override-infodir.test: Likewise.
+       * tests/Makefile.am (TESTS): Add them.
+       * NEWS, THANKS: Update.
+       Report by Nick Bowler.
+
+2011-09-28  Stefano Lattarini  <address@hidden>
+
+       maintcheck: fix usage of `cd' instead of `$(am__cd)'
+       * lib/am/inst-vars.am (am__uninstall_files_from_dir): Use
+       `$(am__cd)', not plain `cd'.
+
+2011-09-24  Stefano Lattarini  <address@hidden>
+
+       uninstall: "make uninstall" before "make install" works
+       This change fixes automake bug#9578.
+       * lib/am/inst-vars.am (am__uninstall_files_from_dir): New internal
+       macro, that defines a shell code fragment to uninstall files from
+       a given directory.
+       * lib/am/data.am (uninstall-%DIR%%PRIMARY%): Use it, to reduce code
+       duplication and improve consistency and correctness.
+       * lib/am/libs.am (uninstall-%DIR%LIBRARIES): Likewise.
+       * lib/am/lisp.am (uninstall-%DIR%LISP): Likewise.
+       * lib/am/mans.am (uninstall-man%SECTION%): Likewise.
+       * lib/am/python.am (uninstall-%DIR%LIBRARIES): Likewise.
+       * lib/am/scripts.am (uninstall-%DIR%SCRIPTS): Likewise.
+       * tests/uninstall-pr9578.test: New test.
+       * tests/uninstall-fail.test: New test.
+       * tests/Makefile.am (TESTS): Add them.
+       * NEWS, THANKS: Update.
+       Report by Nick Bowler.
+
+2011-09-22  Stefano Lattarini  <address@hidden>
+
+       tests: fix tests on aclocal search path precedences
+       * tests/aclocal-path-precedence.test: Call `$ACLOCAL' with the
+       proper overridden system acdir.
+
+2011-09-20  Stefano Lattarini  <address@hidden>
+
+       * NEWS: Fix typo.
+
+2011-09-20  Stefano Lattarini  <address@hidden>
+
+       docs: document planned precedence changes in aclocal search path
+       * doc/automake.texi (Macro Search Path): Explicitly state that the
+       lookup order for extra directories of `.m4' files will be changed
+       in the next major release.
+       * NEWS: Likewise.
+
+2011-09-19  Paolo Bonzini  <address@hidden>
+           Stefano Lattarini  <address@hidden>
+
+       aclocal: handle ACLOCAL_PATH environment variable
+       * aclocal.in (parse_ACLOCAL_PATH): New function, parse ACLOCAL_PATH
+       as a colon-separated list of directories to be included in the
+       search path.
+       * doc/automake.texi (Macro Search Path): Document new behavior and
+       the precedence rules for various elements of the search path.
+       * tests/aclocal-path.test: New test.
+       * tests/aclocal-path-install.test: Likewise.
+       * tests/aclocal-path-install-serial.test: Likewise.
+       * tests/aclocal-path-precedence.test: Likewise.
+       * tests/aclocal-path-nonexistent.test: Likewise.
+       * tests/Makefile.am (TESTS): Add them.
+       * NEWS: Update.
+       * tests/distcheck-missing-m4.test: Extend by also checking
+       interactions with ACLOCAL_PATH.
+       * tests/distcheck-outdated-m4.test: Likewise, and fix a couple
+       of botched comments since we are at it.
+
+2011-09-19  Stefano Lattarini  <address@hidden>
+
+       tests: fix spurious failure in 'primary-prefix-valid-couples.test'
+       * tests/primary-prefix-valid-couples.test: After commit
+       v1.11-464-gc9dfc36, `java_JAVA' is not a valid prefix/primary
+       combination by default anymore: one has to explicitly define
+       $(javadir) to make it so.  So just drop `java_JAVA' from our
+       Makefile.am  Also, since we are at it, ...
+       (configure.in): ... remove AM_PROG_GCJ from here, as it's not
+       really required.
+
+2011-09-19  Stefano Lattarini  <address@hidden>
+
+       docs: deprecate JAVA primary
+       * doc/automake.texi (Java): Deprecate the JAVA primary, stating
+       that it will become obsolete in automake 1.12 and probably removed
+       altogether in automake 1.13.  Reflect this in the section title,
+       by appending the string "(deprecated feature)".
+       (@menu, @detailmenu): Update.
+       (Java Support with gcj): The cross-referenced support for bytecode
+       compilation with the JAVA primary is rudimentary and deprecated.
+       State that explicitly.
+
+2011-09-19  Stefano Lattarini  <address@hidden>
+
+       docs: clearer distinction between `.java' with javac and with gcj
+       * doc/automake.texi (Java support): Rename this node ...
+       (Java support with gcj): ... to this, and change its title from
+       "Compiling Java sources" to "Compiling Java sources using gcj".
+       (@detailmenu, @menu, @cindex): Update and make more precise.
+       (Java): Change the title of this node from simply "Java" to
+       "Java bytecode compilation".
+       (@detailmenu, @menu, @cindex): Update and make more precise.
+
+2011-09-18  Stefano Lattarini  <address@hidden>
+
+       java: complain if java_JAVA is used but $(javadir) is undefined
+       Fixes automake bug#8461.
+       * automake.in (handle_java): Remove inappropriate "java" argument
+       from the calls to `&am_install_var' and `&am_primary_prefixes'.
+       * tests/instdir-java.test (Makefile.am): Define `$(javadir)'.
+       * tests/javadir-undefined.test: New test.
+       * tests/Makefile.am (TESTS): Add it.
+       * NEWS: Update.
+
+2011-09-12  Stefano Lattarini  <address@hidden>
+
+       cosmetics: fix various typos and grammaros
+       * NEWS: Fix typos.
+       * tests/py-compile-basic.test: Likewise.
+       * tests/py-compile-basedir.test: Fix botched wording in comments.
+       * tests/py-compile-option-terminate.test: Fix typo and incomplete
+       comment.
+       Suggestions by Peter Rosin.
+
+2011-09-18  Stefano Lattarini  <address@hidden>
+
+       coverage: test interactions of `nobase_' and `nodist_'
+       * tests/nobase-nodist.test: New test.
+       * tests/Makefile.am (TESTS): Add it.
+
+2011-09-18  Stefano Lattarini  <address@hidden>
+
+       java: fix various blunders in test 'java-mix.test'
+       * tests/java-mix.test: Add missing call to `set -e'.  Fix inverted
+       semantics (`.java' files are expected *not* to be distributed by
+       default, not the other way round).  Fix various typos in the name
+       of the `.java' files.  Correct other minor blunders.  Improve some
+       comments.
+
+2011-04-23  Stefano Lattarini  <address@hidden>
+
+       java: allow both JAVA and nobase_JAVA in the same Makefile.am
+       * automake.in (handle_java): Also strip `nobase_' from the given
+       prefix, when needed.
+       * tests/java-clean.test: Update and extend.
+       * tests/java-compile-install.test: Likewise.
+       * tests/java-no-duplicate.test: Likewise.
+       * tests/java-sources.test: Likewise.
+       * tests/java-noinst.test: Likewise.
+       * tests/java-mix-dist-nodist.test: Renamed to ...
+       * tests/java-mix.test: ... this, and extended.
+       * tests/java-nobase.test: New test, still xfailing due to
+       unrelated issues.
+       * tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
+
+2011-04-18  Stefano Lattarini  <address@hidden>
+
+       java: allow both dist_JAVA and nodist_JAVA in the same Makefile.am
+       Fixes automake bug#8434.
+       * automake.in (handle_java): Strip `dist_' and `nodist_' from
+       the given prefix.  Define a new internal Makefile variable
+       `am__java_sources'.  Related adjustments.
+       * lib/am/java.am (JAVAC, JAVAROOT, CLASSPATH_ENV): Define only the
+       first time this am file is processed.
+       (class%DIR%.stamp): Stamp file renamed ...
+       (class%NDIR%.stamp): ... to this, so that the `dist_' and `nodist_'
+       prefixes are stripped from the name of the stampfile.  Adjust
+       declaration of dependencies by using the new automake-generated
+       internal variable `$(am__java_sources)'.  In the rule, use `$@'
+       as the name of the target, rather than hard-coding it.
+       * tests/java.test: Update and extend.
+       * tests/java-no-duplicate.test: New test.
+       * tests/java-mix-dist-nodist.test: Likewise.
+       * tests/java-compile-and-install.test: Likewise.
+       * tests/java-clean.test: Likewise.
+       * tests/java-sources.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-09-11  Stefano Lattarini  <address@hidden>
+
+       tests: fix spurious failure on fast machines
+       * tests/aclocal-acdir.test: Avoid spurious failures due to caching
+       issues, by cleaning the autom4te cache between all the aclocal
+       invocations, and by always calling autoconf with the `--force'
+       flag.
+
+2011-09-09  Stefano Lattarini  <address@hidden>
+
+       aclocal: better URL reference in error message
+       * aclocal.in (scan_file): In the error message about underquoted
+       definitions, reference the automake page at `www.gnu.org', not
+       at `sources.redhat.com'.
+
+2011-09-09  Stefano Lattarini  <address@hidden>
+
+       coverage: distcheck-hook to catch missing/outdated *.m4 files
+       Related to automake bug#9037.
+       * tests/distcheck-missing-m4.test: New test.
+       * tests/distcheck-outdated-m4.test: Likewise.
+       * tests/distcheck-hook-m4.am: New data file, used by the new
+       tests.
+       * tests/Makefile.am (distcheck-m4-missing.log,
+       distcheck-m4-outdated.log): Depend on it.
+       (EXTRA_DIST): Distribute it.
+       (TESTS): Add the new tests.
+
+2011-09-06  Stefano Lattarini  <address@hidden>
+
+       aclocal: more granularity in acdir overriding
+       Before this change, using the `--acdir' option caused aclocal to
+       redefine both the directory of automake-provided m4 macros and the
+       directory of third-party system-wide m4 macros.  With this change,
+       we deprecate the `--acdir' aclocal option, and introduce two new
+       options `--automake-acdir' and `--system-acdir', to allow for more
+       granularity.
+       * aclocal.in (@automake_includes, @system_includes,
+       @user_includes): Fix and extend comments.
+       (usage): Update.
+       (handle_acdir_option): New function.
+       (parse_arguments): Recognize new options `--system-acdir' and
+       `automake-acdir', and handle `--acdir' using the new function
+       above.  Simplify logic by assuming that the directory of
+       third-party system-wide m4 files always exists.
+       * tests/aclocal.in: Update to use the new options, instead of
+       the deprecated. `--acdir'.
+       * m4/dirlist: Move ...
+       * m4/acdir/dirlist: ... here.
+       * m4/Makefile.am (EXTRA_DIST): Update.
+       (m4datadir): Rename ...
+       (automake_acdir): ... to this.  Accordingly, ...
+       (dist_m4data_DATA): ... rename this ...
+       (dist_automake_ac_DATA): ... to this.
+       (system_acdir): New, directory.
+       (dist_system_ac_DATA): New, defined to an empty value; this will
+       ensure that the $(system_acdir) directory will be created by
+       "make install".
+       * tests/aclocal.test: Remove check about the `--print-ac-dir'
+       option of aclocal, it has been moved into ...
+       * tests/aclocal-print-acdir.test: ... this new test, and quite
+       extended.
+       * tests/aclocal-acdir.test: New test.
+       * tests/Makefile.am (TESTS): Add the new tests.
+       * NEWS, bootstrap: Update.
+       * doc/automake.texi (aclocal Options, Macro Search Path): Update.
+
+2011-10-21  Peter Rosin  <address@hidden>
+
+       warnings: new 'extra-portability' category, for AM_PROG_AR
+       * lib/Automake/ChannelDefs.pm: Register new extra-portability
+       warning channel.
+       (switch_warning): Turn off extra-portability if portability is
+       turned off, and turn on portability if extra-portability is
+       turned on.
+       (set_strictness): Silence extra-portability for --gnits, --gnu
+       and --foreign.
+       * tests/extra-portability2.test: New test, checking that the
+       extra-portability channel is silenced by --gnits, --gnu and
+       --foreign.
+       * doc/automake.texi (Invoking Automake): Document the new warning
+       category and its interaction with the portability category.
+       * tests/extra-portability.test: New test, checking the interaction
+       between the portability and extra-portability warning categories.
+       * automake.in (handle_libraries, handle_ltlibraries): Move the
+       AM_PROG_AR warnings to the new extra-portability channel.
+       * tests/ar2.test: Adjust to the new warning channel.
+       * tests/pr300-lib.test: Likewise.
+       * tests/pr300-ltlib.test: Likewise.
+       * tests/pr307.test: Likewise.
+       * tests/pr401.test: Likewise.
+       * tests/pr401b.test: Likewise.
+       * tests/pr401c.test: Likewise.
+       * tests/pr72.test: Likewise.
+       * NEWS: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+
+2011-10-21  Peter Rosin  <address@hidden>
+           Ralf Wildenhues  <address@hidden>
+           Stefano Lattarini  <address@hidden>
+
+       Add new 'AM_PROG_AR' macro, triggering the 'ar-lib' script.
+       * m4/ar-lib.m4: New macro AM_PROG_AR, which locates an
+       archiver and triggers the auxiliary 'ar-lib' script if needed.
+       * m4/Makefile.am (dist_m4data_DATA): Update.
+       * automake.in ($seen_ar): New variable.
+       (scan_autoconf_traces): Set it.
+       (handle_libraries, handle_ltlibraries): Require AM_PROG_AR for
+       portability.
+       * doc/automake.texi (Public Macros): Mention the new
+       'AM_PROG_AR' macro.
+       (Subpackages): Add AM_PROG_AR to the example.
+       (A Library): Adjust recommendations for AR given the new
+       AM_PROG_AR macro.
+       * All relevant tests: Adjust to new portability requirements due
+       to the new AM_PROG_AR macro.
+       * tests/ar-lib2.test: New test, checking that AM_PROG_AR triggers
+       install of ar-lib.
+       * tests/ar-lib3.test: New test, checking that lib_LIBRARIES
+       requires AM_PROG_AR.
+       * tests/ar-lib4.test: New test, checking that lib_LTLIBRARIES
+       requires AM_PROG_AR.
+       * tests/ar-lib5a.test: New test, checking that AM_PROG_AR triggers
+       use of ar-lib when the archiver is Microsoft lib.
+       * tests/ar-lib5b.test: New test, checking that AM_PROG_AR triggers
+       use of ar-lib when the archiver is a faked lib.
+       * tests/ar-lib6a.test: New test, checking the ordering of
+       AM_PROG_AR and LT_INIT.
+       * tests/ar-lib6b.test: New test, checking the ordering of
+       AM_PROG_AR and AC_PROG_LIBTOOL.
+       * tests/ar-lib7.test: New test, checking that automake warns
+       if ar-lib is missing.
+       * tests/ar3.test: New test, checking that AR and ARFLAGS may
+       be overridden by the user even if AM_PROG_AR is used.
+       * tests/ar4.test: New test, checking that AM_PROG_AR bails out
+       if it cannot determine the archiver interface.
+       * tests/ar5.test: New test, checking that AM_PROG_AR runs its
+       optional argument if it cannot determine the archiver interface.
+       * tests/defs.in: New required entry 'lib'.
+       * tests/Makefile.am (TESTS): Update.
+       * NEWS: Update.
+
 2011-09-05  Peter Rosin  <address@hidden>
 
        * tests/amhello-binpkg.test: Add missing $EXEEXT usage.
@@ -441,6 +1009,67 @@
        generic hard errors.  The latter should be reserved for "real"
        set-up failures.
 
+2011-06-08  Stefano Lattarini  <address@hidden>
+
+       py-compile: '--' and non-option arguments terminate the option list
+       * lib/py-compile: Any non-option argument, or the special `--'
+       argument, now explicitly terminates the list of options.
+       * tests/py-compile-option-terminate.test: New test.
+       * tests/Makefile.am (TESTS): Update.
+       * NEWS: Update.
+
+2011-06-08  Stefano Lattarini  <address@hidden>
+
+       py-compile: complain on unrecognized options
+       * lib/py-compile: Complain on unrecognized options.  Don't be too
+       lax in matching `--help' and `--version' options.
+       * tests/py-compile-usage.test: Extend accordingly.
+       * NEWS: Update.
+
+2011-06-08  Stefano Lattarini  <address@hidden>
+
+       py-compile: normalize error and help messages
+       * lib/py-compile: Now error messages do not begin with a capital
+       letter, nor end with a period, as per GNU standards.  Prepend the
+       error messages with the name of the script, not with its path.
+       When an invalid usage is recognized, always display the customary
+       message "Try `py-compile --help' ..." on a line of its own.
+       ($me): New variable, containing the name of the
+       program, i.e., `py-compile'.  Use it throughout.
+       (usage_error): New function, used to display error messages about
+       invalid usage.
+       * tests/py-compile-usage.test: Extend and tighten accordingly.
+
+2011-06-08  Stefano Lattarini  <address@hidden>
+
+       python tests: add "unit tests" on py-compile
+       * tests/py-compile-basic.test: New test.
+       * tests/py-compile-basic2.test: New test.
+       * tests/py-compile-basedir.test: Likewise.
+       * tests/py-compile-destdir.test: Likewise.
+       * tests/py-compile-env.test: Likewise.
+       * tests/py-compile-usage.test: Likewise.
+       * tests/Makefile.am (TESTS): Update.
+       Tested with python 2.0.1, 2.4.6, 2.6.6, 2.7.1, and 3.1.3.
+
+2011-06-08  Stefano Lattarini  <address@hidden>
+
+       py-compile: the '--destdir' option now accepts a blank argument
+       * lib/py-compile (Option parsing): Do not count an empty argument
+       to `--destdir' or `--basedir' as a missing argument.
+       * lib/python.am: Simplify accordingly, passing the `--destdir'
+       option to py-compile unconditionally, even if `$(DESTDIR)' is
+       empty.
+       * NEWS: Update.
+
+2011-06-08  Stefano Lattarini  <address@hidden>
+
+       python: run the 'py-compile' script with $(SHELL)
+       * lib/python.am (install-%DIR%PYTHON): Run each instance of
+       py-compile using $(SHELL).  Since we are at it, break overly
+       long lines.
+       (am__py_compile): New variable, to reduce code duplication.
+
 2011-06-02  Stefano Lattarini  <address@hidden>
 
        maintcheck: fix some failures, extend some checks
diff --git a/Makefile.in b/Makefile.in
index 35a9cbd..9a03035 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -91,6 +91,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(bindir)"
 SCRIPTS = $(bin_SCRIPTS)
 SOURCES =
@@ -145,6 +151,8 @@ am__relativize = \
 DIST_ARCHIVES = $(distdir).tar.gz $(distdir).tar.bz2
 GZIP_ENV = --best
 distuninstallcheck_listfiles = find . -type f -print
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+  | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
 distcleancheck_listfiles = find . -type f -print
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -447,9 +455,7 @@ uninstall-binSCRIPTS:
        @list='$(bin_SCRIPTS)'; test -n "$(bindir)" || exit 0; \
        files=`for p in $$list; do echo "$$p"; done | \
               sed -e 's,.*/,,;$(transform)'`; \
-       test -n "$$list" || exit 0; \
-       echo " ( cd '$(DESTDIR)$(bindir)' && rm -f" $$files ")"; \
-       cd "$(DESTDIR)$(bindir)" && rm -f $$files
+       dir='$(DESTDIR)$(bindir)'; $(am__uninstall_files_from_dir)
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
@@ -753,8 +759,16 @@ distcheck: dist
          list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
          sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
 distuninstallcheck:
-       @$(am__cd) '$(distuninstallcheck_dir)' \
-       && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+       @test -n '$(distuninstallcheck_dir)' || { \
+         echo 'ERROR: trying to run $@ with an empty' \
+              '$$(distuninstallcheck_dir)' >&2; \
+         exit 1; \
+       }; \
+       $(am__cd) '$(distuninstallcheck_dir)' || { \
+         echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+         exit 1; \
+       }; \
+       test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
           || { echo "ERROR: files left after uninstall:" ; \
                if test -n "$(DESTDIR)"; then \
                  echo "  (check DESTDIR support)"; \
diff --git a/NEWS b/NEWS
index b59a820..0c84006 100644
--- a/NEWS
+++ b/NEWS
@@ -5,6 +5,23 @@ New in 1.11.0a:
   - The Automake support for automatic de-ANSI-fication will be removed in
     the next major Automake release (1.12).
 
+  - The `--acdir' option of aclocal is deprecated, and will probably be
+    removed in the next major Automake release (1.12).
+
+  - The exact order in which the directories in the aclocal macro
+    search path are looked up is probably going to be changed in the
+    next Automake release (1.12).
+
+* Changes to aclocal:
+
+  - The `--acdir' option is deprecated.  Now you should use the new options
+    `--automake-acdir' and `--system-acdir' instead.
+
+  - The `ACLOCAL_PATH' environment variable is now interpreted as a
+    colon-separated list of additional directories to search after the
+    automake internal acdir (by default ${prefix}/share/aclocal-APIVERSION)
+    and before the system acdir (by default ${prefix}/share/aclocal).
+
 * Miscellaneous changes:
 
   - The `lzma' compression scheme and associated automake option `dist-lzma'
@@ -13,6 +30,11 @@ New in 1.11.0a:
   - The `compile' script now converts some options for MSVC for a better
     user experience.  Similarly, the new `ar-lib' script wraps Microsoft lib.
 
+  - The py-compile script now accepts empty arguments passed to the options
+    `--destdir' and `--basedir', and complains about unrecognized options.
+    Moreover, a non-option argument or a special `--' argument terminates
+    the list of options.
+
   - A developer that needs to pass specific flags to configure at "make
     distcheck" time can now, and indeed he's advised to, do so by defining
     the developer-reserved makefile variable AM_DISTCHECK_CONFIGURE_FLAGS,
@@ -21,6 +43,15 @@ New in 1.11.0a:
     user; still, the old Makefile.am files that used to define it should
     still continue to work as before.
 
+  - New macro AM_PROG_AR that looks for an archiver and wraps it in the new
+    'ar-lib' auxiliary script if the found archiver is Microsoft lib.  This
+    new macro is required for LIBRARIES and LTLIBRARIES when automake is
+    run with -Wextra-portability (or -Wall) and -Werror.
+
+  - When using DejaGnu-based testsuites, the user can extend the `site.exp'
+    file generated by automake-provided rules by defining the special make
+    variable `$(EXTRA_DEJAGNU_SITE_CONFIG)'.
+
 Bugs fixed in 1.11.0a:
 
 * Bugs introduced by 1.11:
@@ -30,6 +61,13 @@ Bugs fixed in 1.11.0a:
     does not report spurious successes when used with concurrent FreeBSD
     make (e.g., "make check -j3").
 
+  - When the parallel-tests driver is in use, automake now explicitly
+    rejects invalid entries and conditional contents in TEST_EXTENSIONS,
+    instead of issuing confusing and apparently unrelated error messages
+    (e.g., "non-POSIX variable name", "bad characters in variable name",
+    or "redefinition of TEST_EXTENSIONS), or even, in some situations,
+    silently producing broken `Makefile.in' files.
+
   - The `silent-rules' option now also silences all compile rules if dependency
     tracking is disabled.  Also, when `silent-rules' is not used, the output 
from
     `make' does not contain spurious extra lines with only a backslash in them
@@ -42,6 +80,13 @@ Bugs fixed in 1.11.0a:
 
 * Long standing bugs:
 
+  - "make distcheck" now correctly complains also when "make uninstall"
+    leaves one and only one file installed in $(prefix).
+
+  - A "make uninstall" issued before a "make install", or after a mere
+    "make install-data" or a mere "make install-exec" does not spuriously
+    fail anymore.
+
   - Automake now warns about more primary/directory invalid combinations,
     such as "doc_LIBRARIES" or "pkglib_PROGRAMS".
 
@@ -83,6 +128,10 @@ Bugs fixed in 1.11.0a:
   - Java sources specified with check_JAVA are not compiled anymore upon
     "make all", but only upon "make check".
 
+  - An usage like "java_JAVA = foo.java" will now cause Automake to warn
+    and error out if `javadir' is undefined, instead of silently producing
+    a broken Makefile.in.
+
   - Now aclocal and automake, when they've to spawn autoconf or autom4te
     processes, honour the configure-time definitions of AUTOCONF and
     AUTOM4TE.
diff --git a/THANKS b/THANKS
index f83e1fc..eae683f 100644
--- a/THANKS
+++ b/THANKS
@@ -83,7 +83,7 @@ Diab Jerius           address@hidden
 Didier Cassirame       address@hidden
 Dieter Baron           address@hidden
 Dieter Jurzitza                address@hidden
-Dilyan Palauzov                address@hidden
+Дилян Палаузов            address@hidden
 Dmitry Mikhin          address@hidden
 Dmitry V. Levin                address@hidden
 Doug Evans             address@hidden
@@ -244,6 +244,7 @@ Motoyuki Kasahara   address@hidden
 Nathanael Nerode       address@hidden
 Nelson H. F. Beebe     address@hidden
 Nicholas Wourms                address@hidden
+Nick Bowler            address@hidden
 Nicolas Joly           address@hidden
 Nicolas Thiery         address@hidden
 NightStrike            address@hidden
@@ -275,6 +276,7 @@ Per Oyvind Hvidsten address@hidden
 Peter Breitenlohner    address@hidden
 Peter Eisentraut       address@hidden
 Peter Gavin            address@hidden
+Peter Johansson                address@hidden
 Peter Mattis           address@hidden
 Peter Muir             address@hidden
 Peter O'Gorman         address@hidden
diff --git a/aclocal.in b/aclocal.in
index 4b63c1a..2ae9a89 100644
--- a/aclocal.in
+++ b/aclocal.in
@@ -54,9 +54,12 @@ $perl_threads = 0;
 # Include paths for searching macros.  We search macros in this order:
 # user-supplied directories first, then the directory containing the
 # automake macros, and finally the system-wide directories for
-# third-party macro.  @user_includes can be augmented with -I.
-# @system_includes can be augmented with the `dirlist' file.  Also
-# --acdir will reset both @automake_includes and @system_includes.
+# third-party macros.
+# @user_includes can be augmented with -I.
+# @automake_includes can be reset with the `--automake-acdir' option.
+# @system_includes can be augmented with the `dirlist' file or the
+# ACLOCAL_PATH environment variable, and reset with the `--system-acdir'
+# option.
 my @user_includes = ();
 my @automake_includes = ("@datadir@/aclocal-$APIVERSION");
 my @system_includes = ('@datadir@/aclocal');
@@ -562,7 +565,7 @@ sub scan_file ($$$)
            {
              msg ('syntax', "$file:$.", "warning: underquoted definition of $2"
                   . "\n  run info '(automake)Extending aclocal'\n"
-                  . "  or see http://sources.redhat.com/automake/";
+                  . "  or see http://www.gnu.org/software/automake/manual/";
                   . "automake.html#Extending-aclocal")
                unless $underquoted_manual_once;
              $underquoted_manual_once = 1;
@@ -877,7 +880,8 @@ sub usage ($)
 Generate `aclocal.m4' by scanning `configure.ac' or `configure.in'
 
 Options:
-      --acdir=DIR           directory holding config files (for debugging)
+      --automake-acdir=DIR  directory holding automake-provided m4 files
+      --system-acdir=DIR    directory holding third-party system-wide files
       --diff[=COMMAND]      run COMMAND [diff -u] on M4 files that would be
                               changed (implies --install and --dry-run)
       --dry-run             pretend to, but do not actually update any file
@@ -886,7 +890,8 @@ Options:
   -I DIR                    add directory to search list for .m4 files
       --install             copy third-party files to the first -I directory
       --output=FILE         put output in FILE (default aclocal.m4)
-      --print-ac-dir        print name of directory holding m4 files, then exit
+      --print-ac-dir        print name of directory holding system-wide
+                              third-party m4 files, then exit
       --verbose             don't be silent
       --version             print version number, then exit
   -W, --warnings=CATEGORY   report the warnings falling in CATEGORY
@@ -923,6 +928,15 @@ EOF
   exit 0;
 }
 
+# Using --acdir overrides both the automake (versioned) directory and
+# the public (unversioned) system directory.  This usage is obsolete.
+sub handle_acdir_option ($$)
+{
+  msg 'obsolete', '', "`--acdir' is deprecated\n";
+  @system_includes = ($_[1]);
+  @automake_includes = ();
+}
+
 # Parse command line.
 sub parse_arguments ()
 {
@@ -931,12 +945,9 @@ sub parse_arguments ()
 
   my %cli_options =
     (
-     'acdir=s'         => sub # Setting --acdir overrides both the
-                             { # automake (versioned) directory and the
-                              # public (unversioned) system directory.
-                              @automake_includes = ();
-                              @system_includes = ($_[1])
-                            },
+     'acdir=s'         => \&handle_acdir_option,
+     'system-acdir=s'  => sub { shift; @system_includes = @_; },
+     'automake-acdir=s'        => sub { shift; @automake_includes = @_; },
      'diff:s'          => \$diff_command,
      'dry-run'         => \$dry_run,
      'force'           => \$force_output,
@@ -1017,34 +1028,37 @@ sub parse_arguments ()
             . "\nfirst -I option, but no -I was supplied.");
     }
 
-  if (! -d $system_includes[0])
+  # Finally, adds any directory listed in the `dirlist' file.
+  if (open (DIRLIST, "$system_includes[0]/dirlist"))
     {
-      # By default $(datadir)/aclocal doesn't exist.  We don't want to
-      # get an error in the case where we are searching the default
-      # directory and it hasn't been created.  (We know
-      # @system_includes has its default value if @automake_includes
-      # is not empty, because --acdir is the only way to change this.)
-      @system_includes = () if @automake_includes;
+      while (<DIRLIST>)
+        {
+          # Ignore '#' lines.
+          next if /^#/;
+          # strip off newlines and end-of-line comments
+          s/\s*\#.*$//;
+          chomp;
+          foreach my $dir (glob)
+            {
+              push (@system_includes, $dir) if -d $dir;
+            }
+        }
+      close (DIRLIST);
     }
-  else
+}
+
+# Add any directory listed in the `ACLOCAL_PATH' environment variable
+# to the list of system include directories.
+sub parse_ACLOCAL_PATH ()
+{
+  return if not defined $ENV{"ACLOCAL_PATH"};
+  # Directories in ACLOCAL_PATH should take precedence over system
+  # directories, so we use unshift.  However, directories that
+  # come first in ACLOCAL_PATH take precedence over directories
+  # coming later, which is why the result of split is reversed.
+  foreach my $dir (reverse split /:/, $ENV{"ACLOCAL_PATH"})
     {
-      # Finally, adds any directory listed in the `dirlist' file.
-      if (open (DIRLIST, "$system_includes[0]/dirlist"))
-       {
-         while (<DIRLIST>)
-           {
-             # Ignore '#' lines.
-             next if /^#/;
-             # strip off newlines and end-of-line comments
-             s/\s*\#.*$//;
-             chomp;
-             foreach my $dir (glob)
-               {
-                 push (@system_includes, $dir) if -d $dir;
-               }
-           }
-         close (DIRLIST);
-       }
+      unshift (@system_includes, $dir) if $dir ne '' && -d $dir;
     }
 }
 
@@ -1052,6 +1066,7 @@ sub parse_arguments ()
 
 parse_WARNINGS;                    # Parse the WARNINGS environment variable.
 parse_arguments;
+parse_ACLOCAL_PATH;
 $configure_ac = require_configure_ac;
 
 # We may have to rerun aclocal if some file have been installed, but
diff --git a/automake.in b/automake.in
index 83db668..2d3b270 100755
--- a/automake.in
+++ b/automake.in
@@ -396,6 +396,9 @@ my $package_version_location;
 # TRUE if we've seen AM_ENABLE_MULTILIB.
 my $seen_multilib = 0;
 
+# TRUE if we've seen AM_PROG_AR
+my $seen_ar = 0;
+
 # TRUE if we've seen AM_PROG_CC_C_O
 my $seen_cc_c_o = 0;
 
@@ -2820,6 +2823,13 @@ sub handle_libraries
              &check_libobjs_sources ($xlib, $xlib . '_LIBADD');
            }
        }
+
+      if (! $seen_ar)
+       {
+         msg ('extra-portability', $where,
+              "`$onelib': linking libraries using a non-POSIX\n"
+              . "archiver requires `AM_PROG_AR' in `$configure_ac'")
+       }
     }
 }
 
@@ -3057,6 +3067,13 @@ sub handle_ltlibraries
              &check_libobjs_sources ($xlib, $xlib . '_LIBADD');
            }
        }
+
+      if (! $seen_ar)
+       {
+         msg ('extra-portability', $where,
+              "`$onelib': linking libtool libraries using a non-POSIX\n"
+              . "archiver requires `AM_PROG_AR' in `$configure_ac'")
+       }
     }
 }
 
@@ -4927,6 +4944,19 @@ sub handle_tests_dejagnu
     $output_rules .= file_contents ('dejagnu', new Automake::Location);
 }
 
+# is_valid_test_extension ($EXT)
+# ------------------------------
+# Return true if $EXT can appear in $(TEST_EXTENSIONS), return false
+# otherwise.
+sub is_valid_test_extension ($)
+{
+  my $ext = shift;
+  return 1
+    if ($ext =~ /^\.[a-zA-Z_][a-zA-Z0-9_]*$/);
+  return 1
+    if (exists $configure_vars{'EXEEXT'} && $ext eq subst ('EXEEXT'));
+  return 0;
+}
 
 # Handle TESTS variable and other checks.
 sub handle_tests
@@ -4969,9 +4999,26 @@ sub handle_tests
              $at_exeext = subst ('EXEEXT');
              $suff = $at_exeext  . ' ' . $suff;
            }
-         define_variable ('TEST_EXTENSIONS', $suff, INTERNAL);
-         # FIXME: this mishandles conditions.
-         my @test_suffixes = (var 'TEST_EXTENSIONS')->value_as_list_recursive;
+          if (! var 'TEST_EXTENSIONS')
+            {
+             define_variable ('TEST_EXTENSIONS', $suff, INTERNAL);
+            }
+          my $var = var 'TEST_EXTENSIONS';
+          # Currently, we are not able to deal with conditional contents
+          # in TEST_EXTENSIONS.
+          if ($var->has_conditional_contents)
+           {
+            msg_var 'unsupported', $var,
+                     "`TEST_EXTENSIONS' cannot have conditional contents";
+           }
+         my @test_suffixes = $var->value_as_list_recursive;
+          if ((my @invalid_test_suffixes =
+                  grep { !is_valid_test_extension $_ } @test_suffixes) > 0)
+            {
+              error $var->rdef (TRUE)->location,
+                    "invalid test extensions: @invalid_test_suffixes";
+            }
+          @test_suffixes = grep { is_valid_test_extension $_ } @test_suffixes;
          if ($handle_exeext)
            {
              unshift (@test_suffixes, $at_exeext)
@@ -5104,23 +5151,35 @@ sub handle_java
 {
     my @sourcelist = &am_install_var ('-candist',
                                      'java', 'JAVA',
-                                     'java', 'noinst', 'check');
+                                     'noinst', 'check');
     return if ! @sourcelist;
 
-    my @prefix = am_primary_prefixes ('JAVA', 1,
-                                     'java', 'noinst', 'check');
+    my @prefixes = am_primary_prefixes ('JAVA', 1,
+                                       'noinst', 'check');
 
     my $dir;
-    foreach my $curs (@prefix)
+    my @java_sources = ();
+    foreach my $prefix (@prefixes)
       {
+        (my $curs = $prefix) =~ s/^(?:nobase_)?(?:dist_|nodist_)?//;
+
        next
          if $curs eq 'EXTRA';
 
-       err_var "${curs}_JAVA", "multiple _JAVA primaries in use"
-         if defined $dir;
+        push @java_sources, '$(' . $prefix . '_JAVA' . ')';
+
+       if (defined $dir)
+         {
+           err_var "${curs}_JAVA", "multiple _JAVA primaries in use"
+            unless $curs eq $dir;
+         }
+
        $dir = $curs;
       }
 
+    define_pretty_variable ('am__java_sources', TRUE, INTERNAL,
+                            "@java_sources");
+
     if ($dir eq 'check')
       {
         push (@check, "class$dir.stamp");
@@ -5268,6 +5327,7 @@ sub scan_autoconf_traces ($)
                AM_GNU_GETTEXT_INTL_SUBDIR => 0,
                AM_INIT_AUTOMAKE => 0,
                AM_MAINTAINER_MODE => 0,
+               AM_PROG_AR => 0,
                AM_PROG_CC_C_O => 0,
                AM_SILENT_RULES => 0,
                _AM_SUBST_NOTMAKE => 1,
@@ -5459,6 +5519,10 @@ sub scan_autoconf_traces ($)
        {
          $seen_maint_mode = $where;
        }
+      elsif ($macro eq 'AM_PROG_AR')
+       {
+         $seen_ar = $where;
+       }
       elsif ($macro eq 'AM_PROG_CC_C_O')
        {
          $seen_cc_c_o = $where;
diff --git a/bootstrap b/bootstrap
index 9f1a8d8..c0043a3 100755
--- a/bootstrap
+++ b/bootstrap
@@ -109,7 +109,9 @@ $BOOTSTRAP_SHELL ./gen-parallel-tests > parallel-tests.am
 cd ..
 
 # Run the autotools.
-$PERL ./aclocal.tmp -I m4
+# Use `-I' here so that our own *.m4 files in m4/ gets included,
+# not copied, in aclocal.m4.
+$PERL ./aclocal.tmp -I m4 --automake-acdir m4 --system-acdir m4/acdir
 $AUTOCONF
 $PERL ./automake.tmp
 
diff --git a/doc/Makefile.in b/doc/Makefile.in
index 3034dcb..04bb38a 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -105,6 +105,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 man1dir = $(mandir)/man1
 NROFF = nroff
 MANS = $(dist_man1_MANS)
@@ -478,9 +484,7 @@ uninstall-man1:
        files=`{ for i in $$list; do echo "$$i"; done; \
        } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^1][0-9a-z]*$$,1,;x' \
              -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
-       test -z "$$files" || { \
-         echo " ( cd '$(DESTDIR)$(man1dir)' && rm -f" $$files ")"; \
-         cd "$(DESTDIR)$(man1dir)" && rm -f $$files; }
+       dir='$(DESTDIR)$(man1dir)'; $(am__uninstall_files_from_dir)
 install-dist_docDATA: $(dist_doc_DATA)
        @$(NORMAL_INSTALL)
        test -z "$(docdir)" || $(MKDIR_P) "$(DESTDIR)$(docdir)"
@@ -498,9 +502,7 @@ uninstall-dist_docDATA:
        @$(NORMAL_UNINSTALL)
        @list='$(dist_doc_DATA)'; test -n "$(docdir)" || list=; \
        files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-       test -n "$$files" || exit 0; \
-       echo " ( cd '$(DESTDIR)$(docdir)' && rm -f" $$files ")"; \
-       cd "$(DESTDIR)$(docdir)" && rm -f $$files
+       dir='$(DESTDIR)$(docdir)'; $(am__uninstall_files_from_dir)
 
 ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
        list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
diff --git a/doc/automake.texi b/doc/automake.texi
index ce1bdbb..a5508bf 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -230,7 +230,7 @@ Building Programs and Libraries
 * Assembly Support::            Compiling assembly sources
 * Fortran 77 Support::          Compiling Fortran 77 sources
 * Fortran 9x Support::          Compiling Fortran 9x sources
-* Java Support::                Compiling Java sources
+* Java Support with gcj::       Compiling Java sources using gcj
 * Vala Support::                Compiling Vala sources
 * Support for Other Languages::  Compiling other languages
 * ANSI::                        Automatic de-ANSI-fication (deprecated, soon 
to be removed)
@@ -291,7 +291,7 @@ Other GNU Tools
 * Emacs Lisp::                  Emacs Lisp
 * gettext::                     Gettext
 * Libtool::                     Libtool
-* Java::                        Java
+* Java::                        Java bytecode compilation (deprecated)
 * Python::                      Python
 
 Building documentation
@@ -894,7 +894,7 @@ about some concurrency in the way build commands are run.  
For this
 reason we refer to such setups using the name @emph{VPATH builds} in
 the following.  @emph{VPATH} is the name of the @command{make} feature
 used by the @file{Makefile}s to allow these builds (@pxref{General
-Search, , @code{VPATH}: Search Path for All Prerequisites, make, The
+Search, , @code{VPATH} Search Path for All Prerequisites, make, The
 GNU Make Manual}).
 
 @cindex multiple configurations, example
@@ -2680,6 +2680,9 @@ user redefinitions of Automake rules or variables
 @item portability
 portability issues (e.g., use of @command{make} features that are
 known to be not portable)
address@hidden extra-portability
+extra portability issues related to obscure tools.  One example of such
+a tool is the Microsoft @command{lib} archiver.
 @item syntax
 weird syntax, unused variables, typos
 @item unsupported
@@ -2702,6 +2705,12 @@ are enabled in @option{--gnu} and @option{--gnits} 
strictness.
 On the other hand, the @option{silent-rules} options (@pxref{Options})
 turns off portability warnings about recursive variable expansions.
 
address@hidden Checked by extra-portability.test
+Turning off @samp{portability} will also turn off @samp{extra-portability},
+and similarly turning on @samp{extra-portability} will also turn on
address@hidden  However, turning on @samp{portability} or turning
+off @samp{extra-portability} will not affect the other category.
+
 @vindex WARNINGS
 The environment variable @env{WARNINGS} can contain a comma separated
 list of categories to enable.  It will be taken into account before the
@@ -3194,10 +3203,21 @@ overridden using the @env{AUTOM4TE} environment 
variable.
 @command{aclocal} accepts the following options:
 
 @table @code
address@hidden address@hidden
address@hidden --automake-acdir
+Look for the automake-provided macro files in @var{dir} instead of
+in the installation directory.  This is typically used for debugging.
+
address@hidden address@hidden
address@hidden --system-acdir
+Look for the system-wide third-party macro files (and the special
address@hidden file) in @var{dir} instead of in the installation
+directory.  This is typically used for debugging.
+
 @item address@hidden
 @opindex --acdir
-Look for the macro files in @var{dir} instead of the installation
-directory.  This is typically used for debugging.
address@hidden shorthand for address@hidden@var{dir}
address@hidden''.  Will be removed in future aclocal versions.
 
 @item address@hidden
 @opindex --diff
@@ -3251,8 +3271,12 @@ Cause the output to be put into @var{file} instead of 
@file{aclocal.m4}.
 @opindex --print-ac-dir
 Prints the name of the directory that @command{aclocal} will search to
 find third-party @file{.m4} files.  When this option is given, normal
-processing is suppressed.  This option can be used by a package to
-determine where to install a macro file.
+processing is suppressed.  This option was used @emph{in the past} by
+third-party packages to determine where to install @file{.m4} macro
+files, but @emph{this usage is today discouraged}, since it causes
address@hidden(prefix)} not to be thoroughly honoured (which violates the
+GNU Coding Standards), and a similar semantics can be better obtained
+with the @env{ACLOCAL_PATH} environment variable; @pxref{Extending aclocal}.
 
 @item --verbose
 @opindex --verbose
@@ -3302,7 +3326,7 @@ directories, in this order:
 @item @var{acdir-APIVERSION}
 This is where the @file{.m4} macros distributed with Automake itself
 are stored.  @var{APIVERSION} depends on the Automake release used;
-for Automake 1.6.x, @var{APIVERSION} = @code{1.6}.
+for example, for Automake 1.11.x, @var{APIVERSION} = @code{1.11}.
 
 @item @var{acdir}
 This directory is intended for third party @file{.m4} files, and is
@@ -3313,31 +3337,24 @@ value of @var{acdir}, use the @option{--print-ac-dir} 
option
 (@pxref{aclocal Options}).
 @end table
 
-As an example, suppose that @command{automake-1.6.2} was configured with
+As an example, suppose that @command{automake-1.11.2} was configured with
 @address@hidden/usr/local}.  Then, the search path would be:
 
 @enumerate
address@hidden @file{/usr/local/share/aclocal-1.6/}
address@hidden @file{/usr/local/share/aclocal-1.11.2/}
 @item @file{/usr/local/share/aclocal/}
 @end enumerate
 
+The paths for the @var{acdir} and @var{acdir-APIVERSION} directories can
+be changed respectively through aclocal options @option{--system-acdir}
+and @option{--automake-acdir} (@pxref{aclocal Options}).  Note however
+that these options are only intended for use by the internal Automake
+test suite, or for debugging under highly unusual situations; they are
+not ordinarily needed by end-users.
+
 As explained in (@pxref{aclocal Options}), there are several options that
 can be used to change or extend this search path.
 
address@hidden Modifying the Macro Search Path: @option{--acdir}
-
-The most erroneous option to modify the search path is
address@hidden@var{dir}}, which changes default directory and
-drops the @var{APIVERSION} directory.  For example, if one specifies
address@hidden/opt/private/}, then the search path becomes:
-
address@hidden
address@hidden @file{/opt/private/}
address@hidden enumerate
-
-This option, @option{--acdir}, is intended for use by the internal
-Automake test suite only; it is not ordinarily needed by end-users.
-
 @subsubheading Modifying the Macro Search Path: @samp{-I @var{dir}}
 
 Any extra directories specified using @option{-I} options
@@ -3387,21 +3404,19 @@ Then, the search path would be
 @noindent
 and all directories with path names starting with @code{/test3}.
 
-If the @address@hidden option is used, then @command{aclocal}
-will search for the @file{dirlist} file in @var{dir}.  In the
address@hidden/opt/private/} example above, @command{aclocal} would look
-for @file{/opt/private/dirlist}.  Again, however, the @option{--acdir}
-option is intended for use by the internal Automake test suite only;
address@hidden is not ordinarily needed by end-users.
+If the @address@hidden option is used, then
address@hidden will search for the @file{dirlist} file in
address@hidden; but remember the warnings  above against the use of
address@hidden
 
 @file{dirlist} is useful in the following situation: suppose that
address@hidden version @code{1.6.2} is installed with
address@hidden version @code{1.11.2} is installed with
 @samp{--prefix=/usr} by the system vendor.  Thus, the default search
 directories are
 
 @c @code looks better than @file here
 @enumerate
address@hidden @code{/usr/share/aclocal-1.6/}
address@hidden @code{/usr/share/aclocal-1.11/}
 @item @code{/usr/share/aclocal/}
 @end enumerate
 
@@ -3422,7 +3437,7 @@ Now, the ``default'' search path on the affected system is
 
 @c @code looks better than @file here
 @enumerate
address@hidden @code{/usr/share/aclocal-1.6/}
address@hidden @code{/usr/share/aclocal-1.11/}
 @item @code{/usr/share/aclocal/}
 @item @code{/usr/local/share/aclocal/}
 @end enumerate
@@ -3436,6 +3451,41 @@ Similarly, @file{dirlist} can be handy if you have 
installed a local
 copy of Automake in your account and want @command{aclocal} to look for
 macros installed at other places on the system.
 
address@hidden
address@hidden Modifying the Macro Search Path: @file{ACLOCAL_PATH}
address@hidden @env{ACLOCAL_PATH}
+
+The fourth and last mechanism to customize the macro search path is
+also the simplest.  Any directory included in the colon-separated
+environment variable @env{ACLOCAL_PATH} is added to the search path
address@hidden Keep in sync with aclocal-path-precedence.test.
+and takes precedence over system directories (including those found via
address@hidden), with the exception of the versioned directory
address@hidden (@pxref{Macro Search Path}).  However, directories
+passed via @option{-I} will take precedence over directories in
address@hidden
+
address@hidden Keep in sync with aclocal-path-installed.test.
+Also note that, if the @option{--install} option is used, any @file{.m4}
+file containing a required macro that is found in a directory listed in
address@hidden will be installed locally.
address@hidden Keep in sync with aclocal-path-installed-serial.test.
+In this case, serial numbers in @file{.m4} are honoured too,
address@hidden
+
+Conversely to @file{dirlist}, @env{ACLOCAL_PATH} is useful if you are
+using a global copy of Automake and want @command{aclocal} to look for
+macros somewhere under your home directory.
+
address@hidden Planned future incompatibilities
+
+The order in which the directories in the macro search path are currently
+looked up is confusing and/or suboptimal in various aspects, and is
+probably going to be changed in the future Automake release.  In
+particular, directories in @env{ACLOCAL_PATH} and @address@hidden
+might end up taking precedence over @address@hidden, and
+directories in @address@hidden/dirlist} might end up taking precedence
+over @address@hidden  @emph{This is a possible future incompatibility!}
 
 @node Extending aclocal
 @subsection Writing your own aclocal macros
@@ -3463,8 +3513,12 @@ aclocal_DATA = mymacro.m4 myothermacro.m4
 
 @noindent
 Please do use @file{$(datadir)/aclocal}, and not something based on
-the result of @samp{aclocal --print-ac-dir}.  @xref{Hard-Coded Install
-Paths}, for arguments.
+the result of @samp{aclocal --print-ac-dir} (@pxref{Hard-Coded Install
+Paths}, for arguments).  It might also be helpful to suggest to
+the user to add the @file{$(datadir)/aclocal} directory to his
address@hidden variable (@pxref{ACLOCAL_PATH}) so that
address@hidden will find the @file{.m4} files installed by your
+package automatically.
 
 A file of macros should be a series of properly quoted
 @code{AC_DEFUN}'s (@pxref{Macro Definitions, , , autoconf, The
@@ -3945,6 +3999,15 @@ environment, or use the @option{--with-lispdir} option to
 @command{configure} to explicitly set the correct path (if you're sure
 you have an @command{emacs} that supports Emacs Lisp).
 
address@hidden AM_PROG_AR(@ovar{act-if-fail})
address@hidden AM_PROG_AR
address@hidden AR
+You must use this macro when you use the archiver in your project, if
+you want support for unusual archivers such as Microsoft @command{lib}.
+The content of the optional argument is executed if the archiver
+interface is not recognized; the default action is to abort configure
+with an error message.
+
 @item AM_PROG_AS
 @acindex AM_PROG_AS
 @vindex CCAS
@@ -4568,6 +4631,7 @@ AC_INIT([hand], [1.2])
 AC_CONFIG_AUX_DIR([.])
 AM_INIT_AUTOMAKE
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
@@ -4633,7 +4697,7 @@ to build programs and libraries.
 * Assembly Support::            Compiling assembly sources
 * Fortran 77 Support::          Compiling Fortran 77 sources
 * Fortran 9x Support::          Compiling Fortran 9x sources
-* Java Support::                Compiling Java sources
+* Java Support with gcj::       Compiling Java sources using gcj
 * Vala Support::                Compiling Vala sources
 * Support for Other Languages::  Compiling other languages
 * ANSI::                        Automatic de-ANSI-fication (deprecated, soon 
to be removed)
@@ -5008,12 +5072,14 @@ by invoking @samp{$(AR) $(ARFLAGS)} followed by the 
name of the
 library and the list of objects, and finally by calling
 @samp{$(RANLIB)} on that library.  You should call
 @code{AC_PROG_RANLIB} from your @file{configure.ac} to define
address@hidden (Automake will complain otherwise).  @code{AR} and
address@hidden default to @code{ar} and @code{cru} respectively; you
-can override these two variables my setting them in your
address@hidden, by @code{AC_SUBST}ing them from your
address@hidden, or by defining a per-library @code{maude_AR}
-variable (@pxref{Program and Library Variables}).
address@hidden (Automake will complain otherwise).  You should also
+call @code{AM_PROG_AR} to define @code{AR}, in order to support unusual
+archivers such as Microsoft lib.  @code{ARFLAGS} will default to
address@hidden; you can override this variable by setting it in your
address@hidden or by @code{AC_SUBST}ing it from your
address@hidden  You can override the @code{AR} variable by
+defining a per-library @code{maude_AR} variable (@pxref{Program and
+Library Variables}).
 
 @cindex Empty libraries
 Be careful when selecting library components conditionally.  Because
@@ -6694,17 +6760,19 @@ is as follows:
 
 @end table
 
address@hidden Java Support
address@hidden Java Support with gcj
 @comment  node-name,  next,  previous,  up
address@hidden Java Support
address@hidden Compiling Java sources using gcj
 
address@hidden Java support
address@hidden Support for Java
address@hidden Java support with gcj
address@hidden Support for Java with gcj
address@hidden Java to native code, compilation
address@hidden Compilation of Java to native code
 
 Automake includes support for natively compiled Java, using @command{gcj},
-the Java front end to the GNU Compiler Collection (preliminary support
+the Java front end to the GNU Compiler Collection (rudimentary support
 for compiling Java to bytecode using the @command{javac} compiler is
-also present; @pxref{Java}).
+also present, @emph{albeit deprecated}; @pxref{Java}).
 
 Any package including Java code to be compiled must define the output
 variable @code{GCJ} in @file{configure.ac}; the variable @code{GCJFLAGS}
@@ -6798,8 +6866,9 @@ source file.
 Automake currently only includes full support for C, C++ (@pxref{C++
 Support}), Objective C (@pxref{Objective C Support}), Fortran 77
 (@pxref{Fortran 77 Support}), Fortran 9x (@pxref{Fortran 9x Support}),
-and Java (@pxref{Java Support}).  There is only rudimentary support for other
-languages, support for which will be improved based on user demand.
+and Java (@pxref{Java Support with gcj}).  There is only rudimentary
+support for other languages, support for which will be improved based
+on user demand.
 
 Some limited support for adding your own languages is available via the
 suffix rule handling (@pxref{Suffixes}).
@@ -7473,7 +7542,7 @@ use in GNU programs, it tries hard to interoperate with 
other GNU tools.
 * Emacs Lisp::                  Emacs Lisp
 * gettext::                     Gettext
 * Libtool::                     Libtool
-* Java::                        Java
+* Java::                        Java bytecode compilation (deprecated)
 * Python::                      Python
 @end menu
 
@@ -7566,15 +7635,22 @@ libtool, The Libtool Manual}) with the 
@code{LTLIBRARIES} primary.
 
 
 @node Java
address@hidden Java
address@hidden Java bytecode compilation (deprecated)
 
 @cindex @code{_JAVA} primary, defined
 @cindex @code{JAVA} primary, defined
 @cindex Primary variable, @code{JAVA}
address@hidden Java to bytecode, compilation
address@hidden Compilation of Java to bytecode
 
 Automake provides some minimal support for Java bytecode compilation with
 the @code{JAVA} primary (in addition to the support for compiling Java to
-native machine code; @pxref{Java Support}).
+native machine code; @pxref{Java Support with gcj}).  Note however that
address@hidden interface and most features described here are deprecated}; the
+next automake release will strive to provide a better and cleaner
+interface, which however @emph{won't be backward-compatible}; the present
+interface will probably be removed altogether in future automake releases
+(1.13 or later), so don't use it in new code.
 
 Any @file{.java} files listed in a @code{_JAVA} variable will be
 compiled with @code{JAVAC} at build time.  By default, @file{.java}
@@ -8770,9 +8846,15 @@ Each log file is created when the corresponding test has 
completed.
 The set of log files is listed in the read-only variable
 @code{TEST_LOGS}, and defaults to @code{TESTS}, with the executable
 extension if any (@pxref{EXEEXT}), as well as any suffix listed in
address@hidden removed, and @file{.log} appended.
address@hidden defaults to @file{.test}.  Results are undefined
-if a test file name ends in several concatenated suffixes.
address@hidden removed, and @file{.log} appended.  Results
+are undefined if a test file name ends in several concatenated suffixes.
address@hidden defaults to @file{.test}; it can be overridden by
+the user, in which case any extension listed in it must be constituted
+by a dot, followed by a non-digit alphabetic character, followed by any
+number of alphabetic characters.
address@hidden Keep in sync with test-extensions.test.
+For example, @samp{.sh}, @samp{.T} and @samp{.t1} are valid extensions,
+while @samp{.x-y}, @samp{.6c} and @samp{.t.1} are not.
 
 @vindex _LOG_COMPILE
 @vindex _LOG_COMPILER
@@ -9007,6 +9089,14 @@ not the place where the test suite author should define 
new variables:
 this should be done elsewhere in the real test suite code.
 Especially, @file{site.exp} should not be distributed.
 
+Still, if the package author has legitimate reasons to extend
address@hidden at @command{make} time, he can do so by defining
+the variable @code{EXTRA_DEJAGNU_SITE_CONFIG}; the files listed
+there will be considered @file{site.exp} prerequisites, and their
+content will be appended to it (in the same order in which they
+appear in @code{EXTRA_DEJAGNU_SITE_CONFIG}).  Note that files are
address@hidden distributed by default.
+
 For more information regarding DejaGnu test suites, see @ref{Top, , ,
 dejagnu, The DejaGnu Manual}.
 
diff --git a/lib/Automake/ChannelDefs.pm b/lib/Automake/ChannelDefs.pm
index aaca979..61b4ed4 100644
--- a/lib/Automake/ChannelDefs.pm
+++ b/lib/Automake/ChannelDefs.pm
@@ -115,6 +115,10 @@ variables (silent by default).
 
 Warnings about non-portable constructs.
 
+=item C<extra-portability>
+
+Extra warnings about non-portable constructs covering obscure tools.
+
 =item C<syntax>
 
 Warnings about weird syntax, unused variables, typos...
@@ -151,6 +155,7 @@ register_channel 'automake', type => 'fatal', backtrace => 
1,
   footer => "\nPlease contact <$PACKAGE_BUGREPORT>.",
   uniq_part => UP_NONE, ordered => 0;
 
+register_channel 'extra-portability', type => 'warning', silent => 1;
 register_channel 'gnu', type => 'warning';
 register_channel 'obsolete', type => 'warning', silent => 1;
 register_channel 'override', type => 'warning', silent => 1;
@@ -180,6 +185,7 @@ sub usage ()
   `obsolete'      obsolete features or constructions
   `override'      user redefinitions of Automake rules or variables
   `portability'   portability issues (default in gnu and gnits modes)
+  `extra-portability'  extra portability issues related to obscure tools
   `syntax'        dubious syntactic constructs (default)
   `unsupported'   unsupported or incomplete features (default)
   `all'           all the warnings
@@ -284,6 +290,10 @@ sub switch_warning ($)
       setup_channel $cat, silent => $has_no;
       setup_channel 'portability-recursive', silent => $has_no
         if $cat eq 'portability';
+      setup_channel 'extra-portability', silent => $has_no
+        if ($cat eq 'portability' && $has_no);
+      setup_channel 'portability', silent => $has_no
+        if ($cat eq 'extra-portability' && ! $has_no);
     }
   else
     {
@@ -345,6 +355,7 @@ sub set_strictness ($)
       setup_channel 'error-gnu/warn', silent => 0, type => 'error';
       setup_channel 'error-gnits', silent => 1;
       setup_channel 'portability', silent => 0;
+      setup_channel 'extra-portability', silent => 1;
       setup_channel 'gnu', silent => 0;
     }
   elsif ($name eq 'gnits')
@@ -353,6 +364,7 @@ sub set_strictness ($)
       setup_channel 'error-gnu/warn', silent => 0, type => 'error';
       setup_channel 'error-gnits', silent => 0;
       setup_channel 'portability', silent => 0;
+      setup_channel 'extra-portability', silent => 1;
       setup_channel 'gnu', silent => 0;
     }
   elsif ($name eq 'foreign')
@@ -361,6 +373,7 @@ sub set_strictness ($)
       setup_channel 'error-gnu/warn', silent => 0, type => 'warning';
       setup_channel 'error-gnits', silent => 1;
       setup_channel 'portability', silent => 1;
+      setup_channel 'extra-portability', silent => 1;
       setup_channel 'gnu', silent => 1;
     }
   else
diff --git a/lib/Automake/Makefile.in b/lib/Automake/Makefile.in
index baccf7d..cdeeb9b 100644
--- a/lib/Automake/Makefile.in
+++ b/lib/Automake/Makefile.in
@@ -96,6 +96,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(perllibdir)" "$(DESTDIR)$(perllibdir)"
 DATA = $(dist_perllib_DATA) $(nodist_perllib_DATA)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive        \
@@ -316,9 +322,7 @@ uninstall-dist_perllibDATA:
        @$(NORMAL_UNINSTALL)
        @list='$(dist_perllib_DATA)'; test -n "$(perllibdir)" || list=; \
        files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-       test -n "$$files" || exit 0; \
-       echo " ( cd '$(DESTDIR)$(perllibdir)' && rm -f" $$files ")"; \
-       cd "$(DESTDIR)$(perllibdir)" && rm -f $$files
+       dir='$(DESTDIR)$(perllibdir)'; $(am__uninstall_files_from_dir)
 install-nodist_perllibDATA: $(nodist_perllib_DATA)
        @$(NORMAL_INSTALL)
        test -z "$(perllibdir)" || $(MKDIR_P) "$(DESTDIR)$(perllibdir)"
@@ -336,9 +340,7 @@ uninstall-nodist_perllibDATA:
        @$(NORMAL_UNINSTALL)
        @list='$(nodist_perllib_DATA)'; test -n "$(perllibdir)" || list=; \
        files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-       test -n "$$files" || exit 0; \
-       echo " ( cd '$(DESTDIR)$(perllibdir)' && rm -f" $$files ")"; \
-       cd "$(DESTDIR)$(perllibdir)" && rm -f $$files
+       dir='$(DESTDIR)$(perllibdir)'; $(am__uninstall_files_from_dir)
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in
index 17a2002..06f6ceb 100644
--- a/lib/Automake/tests/Makefile.in
+++ b/lib/Automake/tests/Makefile.in
@@ -101,6 +101,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 # Restructured Text title and section.
 am__rst_title = sed 's/.*/   &   /;h;s/./=/g;p;x;p;g;p;s/.*//'
 am__rst_section = sed 'p;s/./=/g;p;g'
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 3b05946..5db429b 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -99,6 +99,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(pkgvdatadir)" "$(DESTDIR)$(scriptdir)"
 DATA = $(dist_pkgvdata_DATA) $(dist_script_DATA)
 RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive        \
@@ -288,9 +294,7 @@ uninstall-dist_pkgvdataDATA:
        @$(NORMAL_UNINSTALL)
        @list='$(dist_pkgvdata_DATA)'; test -n "$(pkgvdatadir)" || list=; \
        files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-       test -n "$$files" || exit 0; \
-       echo " ( cd '$(DESTDIR)$(pkgvdatadir)' && rm -f" $$files ")"; \
-       cd "$(DESTDIR)$(pkgvdatadir)" && rm -f $$files
+       dir='$(DESTDIR)$(pkgvdatadir)'; $(am__uninstall_files_from_dir)
 install-dist_scriptDATA: $(dist_script_DATA)
        @$(NORMAL_INSTALL)
        test -z "$(scriptdir)" || $(MKDIR_P) "$(DESTDIR)$(scriptdir)"
@@ -308,9 +312,7 @@ uninstall-dist_scriptDATA:
        @$(NORMAL_UNINSTALL)
        @list='$(dist_script_DATA)'; test -n "$(scriptdir)" || list=; \
        files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-       test -n "$$files" || exit 0; \
-       echo " ( cd '$(DESTDIR)$(scriptdir)' && rm -f" $$files ")"; \
-       cd "$(DESTDIR)$(scriptdir)" && rm -f $$files
+       dir='$(DESTDIR)$(scriptdir)'; $(am__uninstall_files_from_dir)
 
 # This directory's subdirectories are mostly independent; you can cd
 # into them and run `make' without going through this Makefile.
diff --git a/lib/am/Makefile.in b/lib/am/Makefile.in
index 649c1bf..f570905 100644
--- a/lib/am/Makefile.in
+++ b/lib/am/Makefile.in
@@ -89,6 +89,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 am__installdirs = "$(DESTDIR)$(amdir)"
 DATA = $(dist_am_DATA)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -279,9 +285,7 @@ uninstall-dist_amDATA:
        @$(NORMAL_UNINSTALL)
        @list='$(dist_am_DATA)'; test -n "$(amdir)" || list=; \
        files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-       test -n "$$files" || exit 0; \
-       echo " ( cd '$(DESTDIR)$(amdir)' && rm -f" $$files ")"; \
-       cd "$(DESTDIR)$(amdir)" && rm -f $$files
+       dir='$(DESTDIR)$(amdir)'; $(am__uninstall_files_from_dir)
 tags: TAGS
 TAGS:
 
diff --git a/lib/am/data.am b/lib/am/data.am
index 36af717..1817447 100644
--- a/lib/am/data.am
+++ b/lib/am/data.am
@@ -73,9 +73,7 @@ uninstall-%DIR%%PRIMARY%:
        @list='$(%DIR%_%PRIMARY%)'; test -n "$(%NDIR%dir)" || list=; \
 ?BASE? files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
 ?!BASE?        $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
-       test -n "$$files" || exit 0; \
-       echo " ( cd '$(DESTDIR)$(%NDIR%dir)' && rm -f" $$files ")"; \
-       cd "$(DESTDIR)$(%NDIR%dir)" && rm -f $$files
+       dir='$(DESTDIR)$(%NDIR%dir)'; $(am__uninstall_files_from_dir)
 endif %?INSTALL%
 
 
diff --git a/lib/am/dejagnu.am b/lib/am/dejagnu.am
index 08de45c..660050a 100644
--- a/lib/am/dejagnu.am
+++ b/lib/am/dejagnu.am
@@ -44,7 +44,7 @@ endif ! %?CYGNUS%
 .PHONY: check-DEJAGNU
 check-DEJAGNU: site.exp
 ## Life is easiest with an absolute srcdir, so do that.
-       srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \
+       srcdir='$(srcdir)'; export srcdir; \
        EXPECT=$(EXPECT); export EXPECT; \
 ## Allow this to work when expect and DejaGnu are in tree.
 ## Only required when --cygnus in force.
@@ -72,12 +72,12 @@ check-DEJAGNU: site.exp
 ## Note that in the rule we don't directly generate site.exp to avoid
 ## the possibility of a corrupted site.exp if make is interrupted.
 ## Jim Meyering has some useful text on this topic.
-site.exp: Makefile
+site.exp: Makefile $(EXTRA_DEJAGNU_SITE_CONFIG)
        @echo 'Making a new site.exp file...'
        @echo '## these variables are automatically generated by make ##' 
>site.tmp
        @echo '# Do not edit here.  If you wish to override these values' 
>>site.tmp
        @echo '# edit the last section' >>site.tmp
-       @echo 'set srcdir $(srcdir)' >>site.tmp
+       @echo 'set srcdir "$(srcdir)"' >>site.tmp
        @echo "set objdir `pwd`" >>site.tmp
 ## Quote the *_alias variables because they might be empty.
 ?BUILD?        @echo 'set build_alias "$(build_alias)"' >>site.tmp
@@ -86,9 +86,17 @@ site.exp: Makefile
 ?HOST? @echo 'set host_triplet $(host_triplet)' >>site.tmp
 ?TARGET?       @echo 'set target_alias "$(target_alias)"' >>site.tmp
 ?TARGET?       @echo 'set target_triplet $(target_triplet)' >>site.tmp
-       @echo '## All variables above are generated by configure. Do Not Edit 
##' >>site.tmp
-       @test ! -f site.exp || \
-         sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp
+## Allow the package author to extend site.exp.
+       @list='$(EXTRA_DEJAGNU_SITE_CONFIG)'; for f in $$list; do \
+         echo "## Begin content included from file $$f.  Do not modify. ##" \
+          && cat `test -f "$$f" || echo '$(srcdir)/'`$$f \
+          && echo "## End content included from file $$f. ##" \
+          || exit 1; \
+        done >> site.tmp
+       @echo "## End of auto-generated content; you can edit from here. ##" >> 
site.tmp
+       @if test -f site.exp; then \
+          sed -e '1,/^## End of auto-generated content.*##/d' site.exp >> 
site.tmp; \
+        fi
        @-rm -f site.bak
        @test ! -f site.exp || mv site.exp site.bak
        @mv site.tmp site.exp
diff --git a/lib/am/distdir.am b/lib/am/distdir.am
index c2dd7c5..41ff14a 100644
--- a/lib/am/distdir.am
+++ b/lib/am/distdir.am
@@ -1,6 +1,6 @@
 ## automake - create Makefile.in from Makefile.am
 ## Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009,
-## 2010 Free Software Foundation, Inc.
+## 2010, 2011 Free Software Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
@@ -516,11 +516,23 @@ distcheck: dist
 ## from distcheck, so that they can be overridden by the user.
 .PHONY: distuninstallcheck
 distuninstallcheck_listfiles = find . -type f -print
+## The `dir' file (created by install-info) might still exist after
+## uninstall, so we must be prepared to account for it.  The following
+## check is not 100% strict, but is definitely good enough, and even
+## accounts for overridden $(infodir).
+am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
+  | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
 distuninstallcheck:
-## We use -le 1 because the `dir' file (created by install-info)
-## might still exist after uninstall.
-       @$(am__cd) '$(distuninstallcheck_dir)' \
-       && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
+       @test -n '$(distuninstallcheck_dir)' || { \
+         echo 'ERROR: trying to run $@ with an empty' \
+              '$$(distuninstallcheck_dir)' >&2; \
+         exit 1; \
+       }; \
+       $(am__cd) '$(distuninstallcheck_dir)' || { \
+         echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
+         exit 1; \
+       }; \
+       test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
           || { echo "ERROR: files left after uninstall:" ; \
                if test -n "$(DESTDIR)"; then \
                  echo "  (check DESTDIR support)"; \
diff --git a/lib/am/inst-vars.am b/lib/am/inst-vars.am
index a49cfe9..a807f79 100644
--- a/lib/am/inst-vars.am
+++ b/lib/am/inst-vars.am
@@ -15,6 +15,7 @@
 ## along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 if %?FIRST%
+
 ## These variables help stripping any $(VPATH) that some
 ## Make implementations prepend before VPATH-found files.
 ## The issue is discussed at length in distdir.am.
@@ -52,4 +53,21 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+
+## A shell code fragment to uninstall files from a given directory.
+## It expects the $dir and $files shell variables to be defined respectively
+## to the directory where the files to be removed are, and to the list of
+## such files.
+am__uninstall_files_from_dir = { \
+## Some rm implementations complain if `rm -f' is used without arguments.
+  test -z "$$files" \
+## At least Solaris /bin/sh still lacks `test -e', so we use the multiple
+## tests below instead.  We expect $dir to be either non-existent or a
+## directory, so the failure we'll experience if it is a regular file
+## is indeed desired and welcome (better to fail loudly thasn silently).
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+
 endif %?FIRST%
diff --git a/lib/am/java.am b/lib/am/java.am
index 604df22..464b706 100644
--- a/lib/am/java.am
+++ b/lib/am/java.am
@@ -20,11 +20,13 @@
 ## Building.  ##
 ## ---------- ##
 
+if %?FIRST%
 JAVAC = javac
 CLASSPATH_ENV = 
CLASSPATH=$(JAVAROOT):$(srcdir)/$(JAVAROOT)$${CLASSPATH:+":$$CLASSPATH"}
 JAVAROOT = $(top_builddir)
+endif %?FIRST%
 
-class%DIR%.stamp: $(%DIR%_JAVA)
+class%NDIR%.stamp: $(am__java_sources)
        @list1='$?'; list2=; if test -n "$$list1"; then \
          for p in $$list1; do \
            if test -f $$p; then d=; else d="$(srcdir)/"; fi; \
@@ -33,7 +35,7 @@ class%DIR%.stamp: $(%DIR%_JAVA)
          echo '$(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) $(AM_JAVACFLAGS) 
$(JAVACFLAGS) '"$$list2"; \
          $(CLASSPATH_ENV) $(JAVAC) -d $(JAVAROOT) $(AM_JAVACFLAGS) 
$(JAVACFLAGS) $$list2; \
        else :; fi
-       echo timestamp > class%DIR%.stamp
+       echo timestamp > $@
 
 
 ## ------------ ##
@@ -44,7 +46,7 @@ if %?INSTALL%
 am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
 ?EXEC?.PHONY install-exec-am: install-%DIR%JAVA
 ?!EXEC?.PHONY install-data-am: install-%DIR%JAVA
-install-%DIR%JAVA: class%DIR%.stamp
+install-%DIR%JAVA: class%NDIR%.stamp
        @$(NORMAL_INSTALL)
        test -z "$(%NDIR%dir)" || $(MKDIR_P) "$(DESTDIR)$(%NDIR%dir)"
 ## A single .java file can be compiled into multiple .class files.  So
@@ -76,9 +78,9 @@ endif %?INSTALL%
 ## Cleaning.  ##
 ## ---------- ##
 
-.PHONY clean-am: clean-%DIR%JAVA
-clean-%DIR%JAVA:
-       -rm -f *.class class%DIR%.stamp
+.PHONY clean-am: clean-%NDIR%JAVA
+clean-%NDIR%JAVA:
+       -rm -f *.class class%NDIR%.stamp
 
 
 ## -------------- ##
diff --git a/lib/am/libs.am b/lib/am/libs.am
index eec62a1..29f630b 100644
--- a/lib/am/libs.am
+++ b/lib/am/libs.am
@@ -87,9 +87,7 @@ uninstall-%DIR%LIBRARIES:
        @list='$(%DIR%_LIBRARIES)'; test -n "$(%NDIR%dir)" || list=; \
 ?BASE? files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
 ?!BASE?        $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
-       test -n "$$files" || exit 0; \
-       echo " ( cd '$(DESTDIR)$(%NDIR%dir)' && rm -f "$$files" )"; \
-       cd "$(DESTDIR)$(%NDIR%dir)" && rm -f $$files
+       dir='$(DESTDIR)$(%NDIR%dir)'; $(am__uninstall_files_from_dir)
 endif %?INSTALL%
 
 
diff --git a/lib/am/lisp.am b/lib/am/lisp.am
index ab45b30..6ffcdbf 100644
--- a/lib/am/lisp.am
+++ b/lib/am/lisp.am
@@ -128,12 +128,8 @@ uninstall-%DIR%LISP:
        list='$(%DIR%_LISP)'; \
 ?BASE? files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
 ?!BASE?        $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
-       test -n "$$files" || exit 0; \
-       filesc=`echo "$$files" | sed 's|$$|c|'`; \
-       echo " ( cd '$(DESTDIR)$(%NDIR%dir)' && rm -f" $$files ")"; \
-       cd "$(DESTDIR)$(%NDIR%dir)" && rm -f $$files || exit $$?; \
-       echo " ( cd '$(DESTDIR)$(%NDIR%dir)' && rm -f" $$filesc ")"; \
-       cd "$(DESTDIR)$(%NDIR%dir)" && rm -f $$filesc
+       files="$$files "`echo "$$files" | sed 's|$$|c|'`; \
+       dir='$(DESTDIR)$(%NDIR%dir)'; $(am__uninstall_files_from_dir)
 endif %?INSTALL%
 
 
diff --git a/lib/am/mans.am b/lib/am/mans.am
index 66a6c7e..b41a94d 100644
--- a/lib/am/mans.am
+++ b/lib/am/mans.am
@@ -119,9 +119,7 @@ if %?NOTRANS_MANS%
 ?HAVE_NOTRANS?   sed -n '/\.%SECTION%[a-z]*$$/p'; \
 ## Extract basename of manpage, change the extension if needed.
        } | sed 's,.*/,,;s,\.[^%SECTION%][0-9a-z]*$$,.%SECTION%,'`; \
-       test -z "$$files" || { \
-         echo " ( cd '$(DESTDIR)$(man%SECTION%dir)' && rm -f" $$files ")"; \
-         cd "$(DESTDIR)$(man%SECTION%dir)" && rm -f $$files; }
+       dir='$(DESTDIR)$(man%SECTION%dir)'; $(am__uninstall_files_from_dir)
 endif %?NOTRANS_MANS%
 if %?TRANS_MANS%
 ## Handle MANS without notrans_ prefix
@@ -136,7 +134,5 @@ if %?TRANS_MANS%
 ## transform, and change the extension if needed.
        } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^%SECTION%][0-9a-z]*$$,%SECTION%,;x' 
\
              -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \
-       test -z "$$files" || { \
-         echo " ( cd '$(DESTDIR)$(man%SECTION%dir)' && rm -f" $$files ")"; \
-         cd "$(DESTDIR)$(man%SECTION%dir)" && rm -f $$files; }
+       dir='$(DESTDIR)$(man%SECTION%dir)'; $(am__uninstall_files_from_dir)
 endif %?TRANS_MANS%
diff --git a/lib/am/python.am b/lib/am/python.am
index 9424a19..427c95d 100644
--- a/lib/am/python.am
+++ b/lib/am/python.am
@@ -1,6 +1,6 @@
 ## automake - create Makefile.in from Makefile.am
-## Copyright (C) 1999, 2001, 2003, 2004, 2006, 2007, 2008, 2009  Free
-## Software Foundation, Inc.
+## Copyright (C) 1999, 2001, 2003, 2004, 2006, 2007, 2008, 2009, 2011
+## Free Software Foundation, Inc.
 
 ## This program is free software; you can redistribute it and/or modify
 ## it under the terms of the GNU General Public License as published by
@@ -24,6 +24,7 @@ endif %?INSTALL%
 ## ------------ ##
 
 if %?INSTALL%
+?FIRST?am__py_compile = PYTHON=$(PYTHON) $(SHELL) $(py_compile)
 am__installdirs += "$(DESTDIR)$(%NDIR%dir)"
 .PHONY install-%EXEC?exec:data%-am: install-%DIR%PYTHON
 install-%DIR%PYTHON: $(%DIR%_PYTHON)
@@ -52,11 +53,8 @@ if %?BASE%
 ## Byte-compile must be done at install time, since file times are
 ## encoded in the actual files.
        if test -n "$$dlist"; then \
-         if test -z "$(DESTDIR)"; then \
-           PYTHON=$(PYTHON) $(py_compile) --basedir "$(%NDIR%dir)" $$dlist; \
-         else \
-           PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir 
"$(%NDIR%dir)" $$dlist; \
-         fi; \
+         $(am__py_compile) --destdir "$(DESTDIR)" \
+                           --basedir "$(%NDIR%dir)" $$dlist; \
        else :; fi
 else !%?BASE%
        @list='$(%DIR%_PYTHON)'; test -n "$(%NDIR%dir)" || list=; \
@@ -76,11 +74,8 @@ else !%?BASE%
 ## Byte-compile must be done at install time, since file times are
 ## encoded in the actual files.
          if test -n "$$dlist"; then \
-           if test -z "$(DESTDIR)"; then \
-             PYTHON=$(PYTHON) $(py_compile) --basedir "$(%NDIR%dir)" $$dlist; \
-           else \
-             PYTHON=$(PYTHON) $(py_compile) --destdir "$(DESTDIR)" --basedir 
"$(%NDIR%dir)" $$dlist; \
-           fi; \
+           $(am__py_compile) --destdir "$(DESTDIR)" \
+                             --basedir "$(%NDIR%dir)" $$dlist; \
          else :; fi \
        done
 endif !%?BASE%
@@ -99,16 +94,15 @@ uninstall-%DIR%PYTHON:
 ?BASE? files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
 ?!BASE?        $(am__nobase_strip_setup); files=`$(am__nobase_strip)`; \
        test -n "$$files" || exit 0; \
+       dir='$(DESTDIR)$(%NDIR%dir)'; \
+## Also remove the .pyc and .pyo byte compiled versions.
        filesc=`echo "$$files" | sed 's|$$|c|'`; \
        fileso=`echo "$$files" | sed 's|$$|o|'`; \
-       echo " ( cd '$(DESTDIR)$(%NDIR%dir)' && rm -f" $$files ")"; \
-       cd "$(DESTDIR)$(%NDIR%dir)" && rm -f $$files || exit $$?; \
-## This is to remove the .pyc and .pyo byte compiled versions (a bit
-## of a hack).
-       echo " ( cd '$(DESTDIR)$(%NDIR%dir)' && rm -f" $$filesc ")"; \
-       cd "$(DESTDIR)$(%NDIR%dir)" && rm -f $$filesc || exit $$?; \
-       echo " ( cd '$(DESTDIR)$(%NDIR%dir)' && rm -f" $$fileso ")"; \
-       cd "$(DESTDIR)$(%NDIR%dir)" && rm -f $$fileso
+       st=0; \
+       for files in "$$files" "$$filesc" "$$fileso"; do \
+         $(am__uninstall_files_from_dir) || st=$$?; \
+       done; \
+       exit $$st
 endif %?INSTALL%
 
 
diff --git a/lib/am/scripts.am b/lib/am/scripts.am
index 790cb64..346f0d3 100644
--- a/lib/am/scripts.am
+++ b/lib/am/scripts.am
@@ -83,9 +83,7 @@ uninstall-%DIR%SCRIPTS:
 ?!BASE?        $(am__nobase_strip_setup); \
 ?!BASE?        files=`$(am__nobase_strip) \
 ?!BASE?               -e 'h;s,.*/,,;$(transform);x;s|[^/]*$$||;G;s,\n,,'`; \
-       test -n "$$list" || exit 0; \
-       echo " ( cd '$(DESTDIR)$(%NDIR%dir)' && rm -f" $$files ")"; \
-       cd "$(DESTDIR)$(%NDIR%dir)" && rm -f $$files
+       dir='$(DESTDIR)$(%NDIR%dir)'; $(am__uninstall_files_from_dir)
 endif %?INSTALL%
 
 
diff --git a/lib/py-compile b/lib/py-compile
index 3f9d05b..15c834c 100755
--- a/lib/py-compile
+++ b/lib/py-compile
@@ -1,10 +1,10 @@
 #!/bin/sh
 # py-compile - Compile a Python program
 
-scriptversion=2009-04-28.21; # UTC
+scriptversion=2011-06-08.12; # UTC
 
-# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2008, 2009 Free Software
-# Foundation, Inc.
+# Copyright (C) 2000, 2001, 2003, 2004, 2005, 2008, 2009, 2011 Free
+# Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -32,28 +32,36 @@ if [ -z "$PYTHON" ]; then
   PYTHON=python
 fi
 
+me=py-compile
+
+usage_error ()
+{
+  echo "$me: $*" >&2
+  echo "Try \`$me --help' for more information." >&2
+  exit 1
+}
+
 basedir=
 destdir=
-files=
 while test $# -ne 0; do
   case "$1" in
     --basedir)
-      basedir=$2
-      if test -z "$basedir"; then
-        echo "$0: Missing argument to --basedir." 1>&2
-        exit 1
+      if test $# -lt 2; then
+        usage_error "option '--basedir' requires an argument"
+      else
+        basedir=$2
       fi
       shift
       ;;
     --destdir)
-      destdir=$2
-      if test -z "$destdir"; then
-        echo "$0: Missing argument to --destdir." 1>&2
-        exit 1
+      if test $# -lt 2; then
+        usage_error "option '--destdir' requires an argument"
+      else
+        destdir=$2
       fi
       shift
       ;;
-    -h|--h*)
+    -h|--help)
       cat <<\EOF
 Usage: py-compile [--help] [--version] [--basedir DIR] [--destdir DIR] 
FILES..."
 
@@ -69,20 +77,27 @@ Report bugs to <address@hidden>.
 EOF
       exit $?
       ;;
-    -v|--v*)
-      echo "py-compile $scriptversion"
+    -v|--version)
+      echo "$me $scriptversion"
       exit $?
       ;;
+    --)
+      shift
+      break
+      ;;
+    -*)
+      usage_error "unrecognized option '$1'"
+      ;;
     *)
-      files="$files $1"
+      break
       ;;
   esac
   shift
 done
 
+files=$*
 if test -z "$files"; then
-    echo "$0: No files given.  Try \`$0 --help' for more information." 1>&2
-    exit 1
+    usage_error "no files given"
 fi
 
 # if basedir was given, then it should be prepended to filenames before
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 0cf074b..eebf04e 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -3,7 +3,7 @@
 ## Makefile for Automake m4.
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2006,
-# 2008, 2009 Free Software Foundation, Inc.
+# 2008, 2009, 2011 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -18,10 +18,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/>.
 
-m4datadir = $(datadir)/aclocal-$(APIVERSION)
+automake_acdir = $(datadir)/aclocal-$(APIVERSION)
+system_acdir = $(datadir)/aclocal
 
-dist_m4data_DATA = \
+dist_automake_ac_DATA = \
 $(top_srcdir)/m4/amversion.m4 \
+ar-lib.m4 \
 as.m4 \
 auxdir.m4 \
 ccstdc.m4 \
@@ -59,7 +61,10 @@ tar.m4 \
 upc.m4 \
 vala.m4
 
-EXTRA_DIST = dirlist amversion.in
+# So that $(system_acdir) will be created by "make install".
+dist_system_ac_DATA =
+
+EXTRA_DIST = acdir/dirlist amversion.in
 
 # We build amversion.m4 here, instead of from config.status,
 # because config.status is rerun each time one of configure's
diff --git a/m4/Makefile.in b/m4/Makefile.in
index ff4dd43..ba2611a 100644
--- a/m4/Makefile.in
+++ b/m4/Makefile.in
@@ -16,7 +16,7 @@
 @SET_MAKE@
 
 # Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2006,
-# 2008, 2009 Free Software Foundation, Inc.
+# 2008, 2009, 2011 Free Software Foundation, Inc.
 
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -50,8 +50,8 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 subdir = m4
-DIST_COMMON = $(dist_m4data_DATA) $(srcdir)/Makefile.am \
-       $(srcdir)/Makefile.in
+DIST_COMMON = $(dist_automake_ac_DATA) $(dist_system_ac_DATA) \
+       $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
        $(top_srcdir)/m4/auxdir.m4 $(top_srcdir)/m4/init.m4 \
@@ -89,8 +89,15 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__installdirs = "$(DESTDIR)$(m4datadir)"
-DATA = $(dist_m4data_DATA)
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
+am__installdirs = "$(DESTDIR)$(automake_acdir)" \
+       "$(DESTDIR)$(system_acdir)"
+DATA = $(dist_automake_ac_DATA) $(dist_system_ac_DATA)
 DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
 ACLOCAL = @ACLOCAL@
 AMTAR = @AMTAR@
@@ -185,9 +192,11 @@ target_alias = @target_alias@
 top_build_prefix = @top_build_prefix@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-m4datadir = $(datadir)/aclocal-$(APIVERSION)
-dist_m4data_DATA = \
+automake_acdir = $(datadir)/aclocal-$(APIVERSION)
+system_acdir = $(datadir)/aclocal
+dist_automake_ac_DATA = \
 $(top_srcdir)/m4/amversion.m4 \
+ar-lib.m4 \
 as.m4 \
 auxdir.m4 \
 ccstdc.m4 \
@@ -225,7 +234,10 @@ tar.m4 \
 upc.m4 \
 vala.m4
 
-EXTRA_DIST = dirlist amversion.in
+
+# So that $(system_acdir) will be created by "make install".
+dist_system_ac_DATA = 
+EXTRA_DIST = acdir/dirlist amversion.in
 all: all-am
 
 .SUFFIXES:
@@ -259,26 +271,42 @@ $(top_srcdir)/configure:  $(am__configure_deps)
 $(ACLOCAL_M4):  $(am__aclocal_m4_deps)
        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
 $(am__aclocal_m4_deps):
-install-dist_m4dataDATA: $(dist_m4data_DATA)
+install-dist_automake_acDATA: $(dist_automake_ac_DATA)
+       @$(NORMAL_INSTALL)
+       test -z "$(automake_acdir)" || $(MKDIR_P) "$(DESTDIR)$(automake_acdir)"
+       @list='$(dist_automake_ac_DATA)'; test -n "$(automake_acdir)" || list=; 
\
+       for p in $$list; do \
+         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
+         echo "$$d$$p"; \
+       done | $(am__base_list) | \
+       while read files; do \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(automake_acdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(automake_acdir)" || exit $$?; \
+       done
+
+uninstall-dist_automake_acDATA:
+       @$(NORMAL_UNINSTALL)
+       @list='$(dist_automake_ac_DATA)'; test -n "$(automake_acdir)" || list=; 
\
+       files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
+       dir='$(DESTDIR)$(automake_acdir)'; $(am__uninstall_files_from_dir)
+install-dist_system_acDATA: $(dist_system_ac_DATA)
        @$(NORMAL_INSTALL)
-       test -z "$(m4datadir)" || $(MKDIR_P) "$(DESTDIR)$(m4datadir)"
-       @list='$(dist_m4data_DATA)'; test -n "$(m4datadir)" || list=; \
+       test -z "$(system_acdir)" || $(MKDIR_P) "$(DESTDIR)$(system_acdir)"
+       @list='$(dist_system_ac_DATA)'; test -n "$(system_acdir)" || list=; \
        for p in $$list; do \
          if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
          echo "$$d$$p"; \
        done | $(am__base_list) | \
        while read files; do \
-         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(m4datadir)'"; \
-         $(INSTALL_DATA) $$files "$(DESTDIR)$(m4datadir)" || exit $$?; \
+         echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(system_acdir)'"; \
+         $(INSTALL_DATA) $$files "$(DESTDIR)$(system_acdir)" || exit $$?; \
        done
 
-uninstall-dist_m4dataDATA:
+uninstall-dist_system_acDATA:
        @$(NORMAL_UNINSTALL)
-       @list='$(dist_m4data_DATA)'; test -n "$(m4datadir)" || list=; \
+       @list='$(dist_system_ac_DATA)'; test -n "$(system_acdir)" || list=; \
        files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
-       test -n "$$files" || exit 0; \
-       echo " ( cd '$(DESTDIR)$(m4datadir)' && rm -f" $$files ")"; \
-       cd "$(DESTDIR)$(m4datadir)" && rm -f $$files
+       dir='$(DESTDIR)$(system_acdir)'; $(am__uninstall_files_from_dir)
 tags: TAGS
 TAGS:
 
@@ -320,7 +348,7 @@ check-am: all-am
 check: check-am
 all-am: Makefile $(DATA)
 installdirs:
-       for dir in "$(DESTDIR)$(m4datadir)"; do \
+       for dir in "$(DESTDIR)$(automake_acdir)" "$(DESTDIR)$(system_acdir)"; 
do \
          test -z "$$dir" || $(MKDIR_P) "$$dir"; \
        done
 install: install-am
@@ -373,7 +401,8 @@ info: info-am
 
 info-am:
 
-install-data-am: install-dist_m4dataDATA
+install-data-am: install-dist_automake_acDATA \
+       install-dist_system_acDATA
 
 install-dvi: install-dvi-am
 
@@ -417,21 +446,23 @@ ps: ps-am
 
 ps-am:
 
-uninstall-am: uninstall-dist_m4dataDATA
+uninstall-am: uninstall-dist_automake_acDATA \
+       uninstall-dist_system_acDATA
 
 .MAKE: install-am install-strip
 
 .PHONY: all all-am check check-am clean clean-generic distclean \
        distclean-generic distdir dvi dvi-am html html-am info info-am \
        install install-am install-data install-data-am \
-       install-dist_m4dataDATA install-dvi install-dvi-am \
-       install-exec install-exec-am install-html install-html-am \
-       install-info install-info-am install-man install-pdf \
-       install-pdf-am install-ps install-ps-am install-strip \
-       installcheck installcheck-am installdirs maintainer-clean \
-       maintainer-clean-generic mostlyclean mostlyclean-generic pdf \
-       pdf-am ps ps-am uninstall uninstall-am \
-       uninstall-dist_m4dataDATA
+       install-dist_automake_acDATA install-dist_system_acDATA \
+       install-dvi install-dvi-am install-exec install-exec-am \
+       install-html install-html-am install-info install-info-am \
+       install-man install-pdf install-pdf-am install-ps \
+       install-ps-am install-strip installcheck installcheck-am \
+       installdirs maintainer-clean maintainer-clean-generic \
+       mostlyclean mostlyclean-generic pdf pdf-am ps ps-am uninstall \
+       uninstall-am uninstall-dist_automake_acDATA \
+       uninstall-dist_system_acDATA
 
 
 # We build amversion.m4 here, instead of from config.status,
diff --git a/m4/dirlist b/m4/acdir/dirlist
similarity index 100%
rename from m4/dirlist
rename to m4/acdir/dirlist
diff --git a/m4/ar-lib.m4 b/m4/ar-lib.m4
new file mode 100644
index 0000000..822ca60
--- /dev/null
+++ b/m4/ar-lib.m4
@@ -0,0 +1,58 @@
+##                                                          -*- Autoconf -*-
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# AM_PROG_AR([ACT-IF-FAIL])
+# -------------------------
+# Try to determine the archiver interface, and trigger the ar-lib wrapper
+# if it is needed.  If the detection of archiver interface fails, run
+# ACT-IF-FAIL (default is to abort configure with a proper error message).
+AC_DEFUN([AM_PROG_AR],
+[AC_BEFORE([$0], [LT_INIT])dnl
+AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl
+AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
+AC_REQUIRE_AUX_FILE([ar-lib])dnl
+AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false])
+: ${AR=ar}
+
+AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface],
+  [am_cv_ar_interface=ar
+   AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])],
+     [am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD'
+      AC_TRY_EVAL([am_ar_try])
+      if test "$ac_status" -eq 0; then
+        am_cv_ar_interface=ar
+      else
+        am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext 
>&AS_MESSAGE_LOG_FD'
+        AC_TRY_EVAL([am_ar_try])
+        if test "$ac_status" -eq 0; then
+          am_cv_ar_interface=lib
+        else
+          m4_default([$1],
+            [AC_MSG_ERROR([could not determine $AR interface])])
+        fi
+      fi
+      rm -f conftest.lib libconftest.a
+     ])
+   ])
+
+case $am_cv_ar_interface in
+ar)
+  ;;
+lib)
+  # Microsoft lib, so override with the ar-lib wrapper script.
+  # FIXME: It is wrong to rewrite AR.
+  # But if we don't then we get into trouble of one sort or another.
+  # A longer-term fix would be to have automake use am__AR in this case,
+  # and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something
+  # similar.
+  AR="$am_aux_dir/ar-lib $AR"
+  ;;
+esac
+AC_SUBST([AR])dnl
+])
diff --git a/tests/Makefile.am b/tests/Makefile.am
index f1fd4ce..bbb8c92 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -20,7 +20,10 @@ XFAIL_TESTS = \
 all.test \
 auxdir2.test \
 cond17.test \
+dist-auxfile.test \
+dist-auxfile-2.test \
 gcj6.test \
+java-nobase.test \
 pr8365-remake-timing.test \
 yacc-dist-nobuild-subdir.test \
 vala-vpath.test \
@@ -71,6 +74,13 @@ acloca19.test \
 acloca20.test \
 acloca21.test \
 acloca22.test \
+aclocal-acdir.test \
+aclocal-print-acdir.test \
+aclocal-path.test \
+aclocal-path-install.test \
+aclocal-path-install-serial.test \
+aclocal-path-nonexistent.test \
+aclocal-path-precedence.test \
 acoutnoq.test \
 acoutpt.test \
 acoutpt2.test \
@@ -106,8 +116,19 @@ ansi8.test \
 ansi9.test \
 ansi10.test \
 ar-lib.test \
+ar-lib2.test \
+ar-lib3.test \
+ar-lib4.test \
+ar-lib5a.test \
+ar-lib5b.test \
+ar-lib6a.test \
+ar-lib6b.test \
+ar-lib7.test \
 ar.test \
 ar2.test \
+ar3.test \
+ar4.test \
+ar5.test \
 asm.test \
 asm2.test \
 asm3.test \
@@ -290,6 +311,11 @@ dejagnu4.test \
 dejagnu5.test \
 dejagnu6.test \
 dejagnu7.test \
+dejagnu-absolute-builddir.test \
+dejagnu-relative-srcdir.test \
+dejagnu-siteexp-extend.test \
+dejagnu-siteexp-append.test \
+dejagnu-siteexp-useredit.test \
 depacl2.test \
 depcomp.test \
 depcomp2.test \
@@ -313,6 +339,8 @@ destdir.test \
 dirlist.test \
 dirlist2.test \
 discover.test \
+dist-auxfile.test \
+dist-auxfile-2.test \
 dist-included-parent-dir.test \
 distcleancheck.test \
 distcom2.test \
@@ -330,6 +358,10 @@ distcheck-configure-flags-am.test \
 distcheck-configure-flags-subpkg.test \
 distcheck-hook.test \
 distcheck-hook2.test \
+distcheck-missing-m4.test \
+distcheck-outdated-m4.test \
+distcheck-pr9579.test \
+distcheck-override-infodir.test \
 dmalloc.test \
 doc-parsing-buglets-colneq-subst.test \
 doc-parsing-buglets-tabs.test \
@@ -364,6 +396,8 @@ extra8.test \
 extra10.test \
 extra11.test \
 extra12.test \
+extra-portability.test \
+extra-portability2.test \
 f90only.test \
 flavor.test \
 flibs.test \
@@ -453,8 +487,15 @@ java2.test \
 java3.test \
 java-check.test \
 java-empty-classpath.test \
+javadir-undefined.test \
 javaprim.test \
 javasubst.test \
+java-clean.test \
+java-nobase.test \
+java-compile-install.test \
+java-sources.test \
+java-no-duplicate.test \
+java-mix.test \
 ldadd.test \
 ldflags.test \
 lex.test \
@@ -559,6 +600,7 @@ multlib.test \
 nobase.test \
 nobase-libtool.test \
 nobase-python.test \
+nobase-nodist.test \
 nodef.test \
 nodef2.test \
 nodep.test \
@@ -615,6 +657,8 @@ parallel-tests-log-override-1.test \
 parallel-tests-log-override-2.test \
 parallel-tests-log-override-recheck.test \
 parallel-tests-log-compiler-example.test \
+test-extensions.test \
+test-extensions-cond.test \
 parse.test \
 percent.test \
 percent2.test \
@@ -662,6 +706,13 @@ primary-prefix-valid-couples.test \
 primary-prefix-couples-force-valid.test \
 primary-prefix-couples-documented-valid.test \
 proginst.test \
+py-compile-basic.test \
+py-compile-basic2.test \
+py-compile-basedir.test \
+py-compile-destdir.test \
+py-compile-env.test \
+py-compile-option-terminate.test \
+py-compile-usage.test \
 python.test \
 python2.test \
 python3.test \
@@ -770,6 +821,7 @@ subpkg.test \
 subpkg2.test \
 subpkg3.test \
 subpkg4.test \
+subpkg-yacc.test \
 subst.test \
 subst2.test \
 subst3.test \
@@ -832,6 +884,8 @@ txinfo32.test \
 txinfo33.test \
 transform.test \
 transform2.test \
+uninstall-pr9578.test \
+uninstall-fail.test \
 unused.test \
 upc.test \
 upc2.test \
@@ -883,6 +937,9 @@ $(parallel_tests)
 
 EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS)
 
+distcheck-missing-m4.log distcheck-outdated-m4.log: distcheck-hook-m4.am
+EXTRA_DIST += distcheck-hook-m4.am
+
 # Each test case depends on defs, aclocal, and automake.
 check_SCRIPTS = defs aclocal-$(APIVERSION) automake-$(APIVERSION)
 
diff --git a/tests/Makefile.in b/tests/Makefile.in
index a6e17a1..724b204 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -104,6 +104,12 @@ am__nobase_list = $(am__nobase_strip_setup); \
 am__base_list = \
   sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
   sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
+am__uninstall_files_from_dir = { \
+  test -z "$$files" \
+    || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
+    || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
+         $(am__cd) "$$dir" && rm -f $$files; }; \
+  }
 # Restructured Text title and section.
 am__rst_title = sed 's/.*/   &   /;h;s/./=/g;p;x;p;g;p;s/.*//'
 am__rst_section = sed 'p;s/./=/g;p;g'
@@ -285,7 +291,10 @@ XFAIL_TESTS = \
 all.test \
 auxdir2.test \
 cond17.test \
+dist-auxfile.test \
+dist-auxfile-2.test \
 gcj6.test \
+java-nobase.test \
 pr8365-remake-timing.test \
 yacc-dist-nobuild-subdir.test \
 vala-vpath.test \
@@ -349,6 +358,13 @@ acloca19.test \
 acloca20.test \
 acloca21.test \
 acloca22.test \
+aclocal-acdir.test \
+aclocal-print-acdir.test \
+aclocal-path.test \
+aclocal-path-install.test \
+aclocal-path-install-serial.test \
+aclocal-path-nonexistent.test \
+aclocal-path-precedence.test \
 acoutnoq.test \
 acoutpt.test \
 acoutpt2.test \
@@ -384,8 +400,19 @@ ansi8.test \
 ansi9.test \
 ansi10.test \
 ar-lib.test \
+ar-lib2.test \
+ar-lib3.test \
+ar-lib4.test \
+ar-lib5a.test \
+ar-lib5b.test \
+ar-lib6a.test \
+ar-lib6b.test \
+ar-lib7.test \
 ar.test \
 ar2.test \
+ar3.test \
+ar4.test \
+ar5.test \
 asm.test \
 asm2.test \
 asm3.test \
@@ -568,6 +595,11 @@ dejagnu4.test \
 dejagnu5.test \
 dejagnu6.test \
 dejagnu7.test \
+dejagnu-absolute-builddir.test \
+dejagnu-relative-srcdir.test \
+dejagnu-siteexp-extend.test \
+dejagnu-siteexp-append.test \
+dejagnu-siteexp-useredit.test \
 depacl2.test \
 depcomp.test \
 depcomp2.test \
@@ -591,6 +623,8 @@ destdir.test \
 dirlist.test \
 dirlist2.test \
 discover.test \
+dist-auxfile.test \
+dist-auxfile-2.test \
 dist-included-parent-dir.test \
 distcleancheck.test \
 distcom2.test \
@@ -608,6 +642,10 @@ distcheck-configure-flags-am.test \
 distcheck-configure-flags-subpkg.test \
 distcheck-hook.test \
 distcheck-hook2.test \
+distcheck-missing-m4.test \
+distcheck-outdated-m4.test \
+distcheck-pr9579.test \
+distcheck-override-infodir.test \
 dmalloc.test \
 doc-parsing-buglets-colneq-subst.test \
 doc-parsing-buglets-tabs.test \
@@ -642,6 +680,8 @@ extra8.test \
 extra10.test \
 extra11.test \
 extra12.test \
+extra-portability.test \
+extra-portability2.test \
 f90only.test \
 flavor.test \
 flibs.test \
@@ -731,8 +771,15 @@ java2.test \
 java3.test \
 java-check.test \
 java-empty-classpath.test \
+javadir-undefined.test \
 javaprim.test \
 javasubst.test \
+java-clean.test \
+java-nobase.test \
+java-compile-install.test \
+java-sources.test \
+java-no-duplicate.test \
+java-mix.test \
 ldadd.test \
 ldflags.test \
 lex.test \
@@ -837,6 +884,7 @@ multlib.test \
 nobase.test \
 nobase-libtool.test \
 nobase-python.test \
+nobase-nodist.test \
 nodef.test \
 nodef2.test \
 nodep.test \
@@ -893,6 +941,8 @@ parallel-tests-log-override-1.test \
 parallel-tests-log-override-2.test \
 parallel-tests-log-override-recheck.test \
 parallel-tests-log-compiler-example.test \
+test-extensions.test \
+test-extensions-cond.test \
 parse.test \
 percent.test \
 percent2.test \
@@ -940,6 +990,13 @@ primary-prefix-valid-couples.test \
 primary-prefix-couples-force-valid.test \
 primary-prefix-couples-documented-valid.test \
 proginst.test \
+py-compile-basic.test \
+py-compile-basic2.test \
+py-compile-basedir.test \
+py-compile-destdir.test \
+py-compile-env.test \
+py-compile-option-terminate.test \
+py-compile-usage.test \
 python.test \
 python2.test \
 python3.test \
@@ -1048,6 +1105,7 @@ subpkg.test \
 subpkg2.test \
 subpkg3.test \
 subpkg4.test \
+subpkg-yacc.test \
 subst.test \
 subst2.test \
 subst3.test \
@@ -1110,6 +1168,8 @@ txinfo32.test \
 txinfo33.test \
 transform.test \
 transform2.test \
+uninstall-pr9578.test \
+uninstall-fail.test \
 unused.test \
 upc.test \
 upc2.test \
@@ -1159,7 +1219,8 @@ yflags.test \
 yflags2.test \
 $(parallel_tests)
 
-EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS)
+EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS) \
+       distcheck-hook-m4.am
 
 # Each test case depends on defs, aclocal, and automake.
 check_SCRIPTS = defs aclocal-$(APIVERSION) automake-$(APIVERSION)
@@ -1497,6 +1558,8 @@ $(parallel_tests): $(parallel_tests:-p.test=.test) 
Makefile.am
          < $(srcdir)/$$input >$@
        chmod a+rx $@
 
+distcheck-missing-m4.log distcheck-outdated-m4.log: distcheck-hook-m4.am
+
 clean-local: clean-local-check
 .PHONY: clean-local-check
 clean-local-check:
diff --git a/tests/aclibobj.test b/tests/aclibobj.test
index 6ef6f6b..a40baa4 100755
--- a/tests/aclibobj.test
+++ b/tests/aclibobj.test
@@ -20,6 +20,7 @@
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_OUTPUT
 END
@@ -32,6 +33,7 @@ END
 
 : > maude.c
 : > liver.c
+: > ar-lib
 
 $ACLOCAL
 
diff --git a/tests/aclocal-acdir.test b/tests/aclocal-acdir.test
new file mode 100755
index 0000000..e02db30
--- /dev/null
+++ b/tests/aclocal-acdir.test
@@ -0,0 +1,97 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test aclocal's `--acdir', `--automake-acdir' and `--system-acdir'
+# options.  Also check that stuff in the automake acdir takes precedence
+# over stuff in the system acdir.
+
+. ./defs || Exit 1
+
+set -e
+
+mkdir am sys
+
+cat >> configure.in <<'END'
+MY_MACRO
+END
+
+cat > am/foo.m4 <<'END'
+AC_DEFUN([AM_INIT_AUTOMAKE], [fake--init--automake])
+END
+
+cat > sys/foo.m4 <<'END'
+AC_DEFUN([MY_MACRO], [my--macro])
+END
+
+$ACLOCAL --automake-acdir am
+$AUTOCONF --force
+$FGREP 'fake--init--automake' configure
+$FGREP 'MY_MACRO' configure
+
+rm -rf autom4te*.cache
+
+$ACLOCAL --system-acdir sys
+$AUTOCONF --force
+$FGREP 'am__api_version' configure
+$FGREP 'my--macro' configure
+
+rm -rf autom4te*.cache
+
+$ACLOCAL --automake-acdir am --system-acdir sys
+$AUTOCONF --force
+$FGREP 'fake--init--automake' configure
+$FGREP 'my--macro' configure
+
+rm -rf autom4te*.cache
+
+$ACLOCAL --system-acdir sys --automake-acdir am
+$AUTOCONF --force
+$FGREP 'fake--init--automake' configure
+$FGREP 'my--macro' configure
+
+rm -rf autom4te*.cache
+
+# Stuff in automake acdir takes precedence over stuff in system acdir.
+cat > am/bar.m4 <<'END'
+AC_DEFUN([MY_MACRO], [am--macro])
+END
+$ACLOCAL --automake-acdir am --system-acdir sys
+$AUTOCONF --force
+$FGREP 'fake--init--automake' configure
+$FGREP 'am--macro' configure
+$FGREP 'my--macro' configure && Exit 1 # Just to be sure.
+
+rm -rf autom4te*.cache
+
+# Obsolescent `--acdir' option.
+$ACLOCAL -Wobsolete --acdir am 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep '.*--acdir.*deprecated' stderr
+
+rm -rf autom4te*.cache
+
+$ACLOCAL -Wno-obsolete --acdir am
+$AUTOCONF --force
+$FGREP 'fake--init--automake' configure
+$FGREP 'am--macro' configure
+
+rm -rf autom4te*.cache
+
+$ACLOCAL -Wno-obsolete --acdir sys 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep 'macro .*AM_INIT_AUTOMAKE.* not found' stderr
+
+:
diff --git a/tests/aclocal-path-install-serial.test 
b/tests/aclocal-path-install-serial.test
new file mode 100755
index 0000000..511ccee
--- /dev/null
+++ b/tests/aclocal-path-install-serial.test
@@ -0,0 +1,88 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# ACLOCAL_PATH, acdir and `--install' interactions when serial number
+# are involved.
+
+am_create_testdir=empty
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in << 'END'
+AC_INIT
+AM_FOO
+END
+
+set_serial ()
+{
+  serial=$1 file=$2
+  sed '/^# serial/d' $file > t
+  case $serial in
+    none) mv -f t $file;;
+       *) (echo "# serial $serial" && cat t) > $file; rm -f t;;
+  esac
+  cat $file # For debugging.
+}
+
+win ()
+{
+  case $1 in
+    sdir) ok=sdir ko=pdir;;
+    pdir) ok=pdir ko=sdir;;
+       *) fatal_ "win(): invalud argument \`$1'";;
+  esac
+  # This is required on fast machine, to avoid caching and timestamp
+  # issues with the autotools (already happened in practice).
+  rm -rf configure aclocal.m4 autom4te*.cache m4/*
+  $ACLOCAL -I m4 --install
+  test -f m4/foo.m4 # Sanity check.
+  $AUTOCONF
+  $FGREP "::$ok:"  m4/foo.m4
+  $FGREP "::$ok::" configure
+  $FGREP "::$ko::" m4/foo.m4 configure && Exit 1
+  :
+}
+
+mkdir sdir pdir m4
+
+ACLOCAL="$ACLOCAL --system-acdir=`pwd`/sdir"
+ACLOCAL_PATH=./pdir; export ACLOCAL_PATH
+
+cat > sdir/foo.m4 << 'END'
+AC_DEFUN([AM_FOO], [::sdir::])
+END
+cat > pdir/foo.m4 << 'END'
+AC_DEFUN([AM_FOO], [::pdir::])
+END
+
+set_serial 2 sdir/foo.m4
+set_serial 1 pdir/foo.m4
+win sdir
+
+set_serial 3.3 sdir/foo.m4
+set_serial 5.7 pdir/foo.m4
+win pdir
+
+set_serial 0    sdir/foo.m4
+set_serial none pdir/foo.m4
+win sdir
+
+set_serial none  sdir/foo.m4
+set_serial 1.2.3 pdir/foo.m4
+win pdir
+
+:
diff --git a/tests/aclocal-path-install.test b/tests/aclocal-path-install.test
new file mode 100755
index 0000000..5e46eb6
--- /dev/null
+++ b/tests/aclocal-path-install.test
@@ -0,0 +1,55 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# ACLOCAL_PATH and `--install' interactions.
+
+am_create_testdir=empty
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in << 'END'
+AC_INIT
+AM_FOO
+END
+
+mkdir acdir pdir ldir
+
+ACLOCAL="$ACLOCAL --system-acdir=`pwd`/acdir"
+ACLOCAL_PATH=./pdir; export ACLOCAL_PATH
+
+cat > acdir/foo.m4 << 'END'
+AC_DEFUN([AM_FOO], [:])
+END
+
+cat > pdir/bar.m4 << 'END'
+AC_DEFUN([AM_BAR], [:])
+END
+
+# The `--install' option should never cause anything to be installed
+# in a directory specified in ACLOCAL_PATH.
+$ACLOCAL --install 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep ' no -I was supplied' stderr
+test ! -f pdir/foo.m4
+
+# The `--install' option should cause a required macro found in a
+# directory specified in ACLOCAL_PATH to be installed locally.
+echo AM_BAR >> configure.in
+$ACLOCAL --install -I ldir
+diff pdir/bar.m4 ldir/bar.m4
+
+:
diff --git a/tests/aclocal-path-nonexistent.test 
b/tests/aclocal-path-nonexistent.test
new file mode 100755
index 0000000..e1157a1
--- /dev/null
+++ b/tests/aclocal-path-nonexistent.test
@@ -0,0 +1,36 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Non-existent directories in ACLOCAL_PATH are ok.
+
+am_create_testdir=empty
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in << 'END'
+AC_INIT
+AM_FOO
+END
+
+mkdir mdir
+echo 'AC_DEFUN([AM_FOO], [am--foo])' > mdir/foo.m4
+
+ACLOCAL_PATH=./nonesuch:./mdir:`pwd`/nonesuch2:nonesuch3 $ACLOCAL
+$AUTOCONF
+$FGREP 'am--foo' configure
+
+:
diff --git a/tests/aclocal-path-precedence.test 
b/tests/aclocal-path-precedence.test
new file mode 100755
index 0000000..c02fd3b
--- /dev/null
+++ b/tests/aclocal-path-precedence.test
@@ -0,0 +1,93 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check precedence rules for ACLOCAL_PATH.
+
+am_create_testdir=empty
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in << END
+AC_INIT([$me], [1.0])
+AM_INIT_AUTOMAKE([parallel-tests])
+FOO_MACRO
+BAR_MACRO
+AC_PROG_LIBTOOL
+AM_GNU_GETTEXT
+END
+
+mkdir mdir1 mdir2 mdir3 sysdir extradir
+
+cat > mdir1/foo1.m4 << 'END'
+AC_DEFUN([FOO_MACRO], [::pass-foo::])
+END
+
+cat > mdir2/foo2.m4 << 'END'
+AC_DEFUN([FOO_MACRO], [::fail-foo::])
+END
+
+cat > mdir1/baz.m4 << 'END'
+AC_DEFUN([BAR_MACRO], [::fail-bar::])
+END
+
+cat > mdir3/bar.m4 << 'END'
+AC_DEFUN([BAR_MACRO], [::pass-bar::])
+END
+
+cat > mdir2/quux.m4 << 'END'
+AC_DEFUN([AM_INIT_AUTOMAKE], [::fail-init::])
+AC_DEFUN([AC_PROG_LIBTOOL],  [::pass-libtool::])
+AC_DEFUN([AM_GNU_GETTEXT],   [::pass-gettext::])
+END
+
+cat > sysdir/libtool.m4 << 'END'
+AC_DEFUN([AC_PROG_LIBTOOL], [::fail-libtool::])
+END
+
+cat > extradir/gettext.m4 << 'END'
+AC_DEFUN([AM_GNU_GETTEXT], [::fail-gettext::])
+END
+
+echo ./extradir > sysdir/dirlist
+
+ACLOCAL_PATH=mdir1:mdir2 $ACLOCAL -I mdir3 --system-acdir sysdir
+$AUTOCONF
+
+$FGREP '::' configure # For debugging.
+
+# Directories coming first in ACLOCAL_PATH should take precedence
+# over those coming later.
+$FGREP '::pass-foo::' configure
+
+# Directories from `-I' options should take precedence over directories
+# in ACLOCAL_PATH.
+$FGREP '::pass-bar::' configure
+
+# Directories in ACLOCAL_PATH should take precedence over system acdir
+# (typically `${prefix}/share/aclocal'), and any directory added through
+# the `dirlist' special file.
+$FGREP '::pass-gettext::' configure
+$FGREP '::pass-libtool::' configure
+
+# Directories in ACLOCAL_PATH shouldn't take precedence over the internal
+# automake acdir (typically `${prefix}/share/aclocal-${APIVERSION}').
+$FGREP 'am__api_version' configure
+
+# A final sanity check.
+$FGREP '::fail' configure && Exit 1
+
+:
diff --git a/tests/aclocal-path.test b/tests/aclocal-path.test
new file mode 100755
index 0000000..16fd3f9
--- /dev/null
+++ b/tests/aclocal-path.test
@@ -0,0 +1,58 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check basic ACLOCAL_PATH support.
+
+am_create_testdir=empty
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in << 'END'
+AC_INIT
+AM_FOO_MACRO
+AM_BAR_MACRO
+AM_BAZ_MACRO
+END
+
+mkdir mdir1 mdir2 mdir3
+
+cat > mdir1/foo.m4 << 'END'
+AC_DEFUN([AM_FOO_MACRO], [am--foo])
+END
+
+cat > mdir2/bar.m4 << 'END'
+AC_DEFUN([AM_BAR_MACRO], [am--bar])
+END
+
+cat > mdir3/baz.m4 << 'END'
+AC_DEFUN([AM_BAZ_MACRO], [am--baz])
+END
+
+ACLOCAL_PATH=mdir1:./mdir2:`pwd`/mdir3 $ACLOCAL
+$AUTOCONF
+
+# there should be no m4_include in aclocal.m4, even though ACLOCAL_PATH
+# contains `mdir1' and `./mdir2' as relative directories.  Only -I
+# directories should be subject to file inclusion.
+$FGREP m4_include aclocal.m4 && Exit 1
+
+$EGREP 'AM_(FOO|BAR|BAZ)_MACRO' configure && Exit 1
+$FGREP 'am--foo' configure
+$FGREP 'am--bar' configure
+$FGREP 'am--baz' configure
+
+:
diff --git a/tests/aclocal-print-acdir.test b/tests/aclocal-print-acdir.test
new file mode 100755
index 0000000..368416c
--- /dev/null
+++ b/tests/aclocal-print-acdir.test
@@ -0,0 +1,35 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test on aclocal's `--print-ac-dir' option.
+
+. ./defs || Exit 1
+
+set -e
+
+$ACLOCAL --print-ac-dir
+test "`$ACLOCAL --print-ac-dir`" = "$testaclocaldir/acdir"
+
+$ACLOCAL -Wno-obsolete --acdir foo --print-ac-dir
+test "`$ACLOCAL -Wno-obsolete --acdir foo --print-ac-dir`" = foo
+
+$ACLOCAL --system-acdir /bar --print-ac-dir
+test "`$ACLOCAL --system-acdir /bar --print-ac-dir`" = /bar
+
+$ACLOCAL --automake-acdir /bar --print-ac-dir
+test "`$ACLOCAL --automake-acdir /bar --print-ac-dir`" = 
"$testaclocaldir/acdir"
+
+:
diff --git a/tests/aclocal.in b/tests/aclocal.in
index f8aa1a7..5326ad0 100644
--- a/tests/aclocal.in
+++ b/tests/aclocal.in
@@ -12,6 +12,6 @@ fi
 
 perllibdir="@abs_top_builddir@/address@hidden@@abs_top_srcdir@/lib"
 export perllibdir
-# Most of the files are in $srcdir/../m4.  However amversion.m4 is
-# generated in ../m4, so we include that directory in the search path too.
-exec "@abs_top_builddir@/aclocal" "address@hidden@/m4" ${1+"$@"}
+
+exec "@abs_top_builddir@/aclocal" "address@hidden@/m4" \
+     "address@hidden@/m4/acdir" ${1+"$@"}
diff --git a/tests/aclocal.test b/tests/aclocal.test
index da80d08..439faa9 100755
--- a/tests/aclocal.test
+++ b/tests/aclocal.test
@@ -15,8 +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/>.
 
-# Test to make sure that aclocal --output works.  Report from
-# Alexandre Oliva.
+# Test on some aclocal options.  Report from Alexandre Oliva.
+
 . ./defs || Exit 1
 
 set -e
@@ -41,6 +41,4 @@ grep '[Tt]ry.*--help.*for more information' stderr
 
 $ACLOCAL --versi
 
-test "`$ACLOCAL --print-ac-dir`" = "$testaclocaldir"
-
 :
diff --git a/tests/aclocal4.test b/tests/aclocal4.test
index 9fa96ec..eab8ca8 100755
--- a/tests/aclocal4.test
+++ b/tests/aclocal4.test
@@ -25,6 +25,7 @@ set -e
 
 cat >>configure.in <<EOF
 AC_PROG_RANLIB
+AM_PROG_AR
 AC_PROG_CC
 MY_MACRO
 AC_CONFIG_FILES([lib/Makefile])
@@ -60,7 +61,7 @@ EOF
 
 $ACLOCAL -I m4
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE --add-missing
 ./configure
 $MAKE check-not-foo
 
diff --git a/tests/ansi10.test b/tests/ansi10.test
index 4ff2c86..68e1249 100755
--- a/tests/ansi10.test
+++ b/tests/ansi10.test
@@ -25,6 +25,7 @@ cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_CC_STDC
 AM_C_PROTOTYPES
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_LIBOBJ([hello])
 AC_CONFIG_FILES([dir/Makefile])
diff --git a/tests/ar-lib2.test b/tests/ar-lib2.test
new file mode 100755
index 0000000..67a64e9
--- /dev/null
+++ b/tests/ar-lib2.test
@@ -0,0 +1,40 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test if AM_PROG_AR installs ar-lib.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_AR
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = wish
+wish_SOURCES = a.c
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing 2>stderr || { cat stderr >&2; Exit 1; }
+cat stderr >&2
+# Make sure ar-lib is installed, and that Automake says so.
+grep '^configure\.in:.*install.*ar-lib' stderr
+test -f ar-lib
+
+:
diff --git a/tests/ar-lib3.test b/tests/ar-lib3.test
new file mode 100755
index 0000000..6bcf6c2
--- /dev/null
+++ b/tests/ar-lib3.test
@@ -0,0 +1,45 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test if lib_LIBRARIES requests AM_PROG_AR.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+END
+
+cat > Makefile.am << 'END'
+lib_LIBRARIES = libfoo.a
+libfoo_a_SOURCES = foo.c
+END
+
+$ACLOCAL
+AUTOMAKE_fails
+
+grep 'requires.*AM_PROG_AR' stderr
+
+cat >> configure.in << 'END'
+AM_PROG_AR
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+
+:
diff --git a/tests/ar-lib4.test b/tests/ar-lib4.test
new file mode 100755
index 0000000..e05a8c2
--- /dev/null
+++ b/tests/ar-lib4.test
@@ -0,0 +1,57 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test if lib_LTLIBRARIES requests AM_PROG_AR.
+
+required=libtoolize
+. ./defs || Exit 1
+
+set -e
+
+cp configure.in X
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_PROG_LIBTOOL
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+lib_LTLIBRARIES = libfoo.la
+libfoo_la_SOURCES = foo.c
+END
+
+libtoolize
+$ACLOCAL
+AUTOMAKE_fails
+
+grep 'requires.*AM_PROG_AR' stderr
+
+cp X configure.in
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+AC_PROG_LIBTOOL
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+
+:
diff --git a/tests/ar-lib5a.test b/tests/ar-lib5a.test
new file mode 100755
index 0000000..cb73f92
--- /dev/null
+++ b/tests/ar-lib5a.test
@@ -0,0 +1,72 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test if AM_PROG_AR triggers the use of the ar-lib script.
+# This test requires Microsoft lib.
+# Keep this test in sync with sister test `ar-lib5b.test'.
+
+required=lib
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in << END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([auxdir])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+# We want to test the content of am_cv_ar_interface in the Makefile.
+AC_SUBST([am_cv_ar_interface])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+lib_LIBRARIES = libwish.a
+libwish_a_SOURCES = wish.c
+
+check-local:
+       test x'$(am_cv_ar_interface)' = x'lib'
+       test -f ar-lib-worked
+MOSTLYCLEANFILES = ar-lib-worked
+END
+
+cat > wish.c << 'END'
+int wish(void) { return 0; }
+END
+
+mkdir auxdir
+cat > auxdir/ar-lib << 'END'
+# /bin/sh
+:> ar-lib-worked
+END
+chmod +x auxdir/ar-lib
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+# Sanity check: test that it is ok to use `am_cv_ar_interface' as we do.
+$FGREP 'am_cv_ar_interface=' configure
+
+./configure AR=lib RANLIB=:
+
+$MAKE check
+$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS='AR=lib RANLIB=:'
+
+:
diff --git a/tests/ar-lib5b.test b/tests/ar-lib5b.test
new file mode 100755
index 0000000..181c24b
--- /dev/null
+++ b/tests/ar-lib5b.test
@@ -0,0 +1,83 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test if AM_PROG_AR triggers the use of the ar-lib script.
+# This test does not require Microsoft lib.
+# Keep this test in sync with sister test `ar-lib5a.test'.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in << END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([auxdir])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+# We want to test the content of am_cv_ar_interface in the Makefile.
+AC_SUBST([am_cv_ar_interface])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+lib_LIBRARIES = libwish.a
+libwish_a_SOURCES = wish.c
+
+check-local:
+       test x'$(am_cv_ar_interface)' = x'lib'
+       test -f ar-lib-worked
+MOSTLYCLEANFILES = ar-lib-worked
+END
+
+cat > wish.c << 'END'
+int wish(void) { return 0; }
+END
+
+mkdir auxdir
+cat > auxdir/ar-lib << 'END'
+# /bin/sh
+:> ar-lib-worked
+END
+chmod +x auxdir/ar-lib
+
+# Let's fake microsoft lib.
+mkdir bin
+cat > bin/lib << 'END'
+# /bin/sh
+case " $* " in
+  *' -OUT:'*) exit 0;;
+  *' cru '*) exit 1;;
+  *) : > ar-lib-worked;;
+esac
+END
+chmod +x bin/lib
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+# Sanity check: test that it is ok to use `am_cv_ar_interface' as we do.
+$FGREP 'am_cv_ar_interface=' configure
+
+./configure AR=bin/lib RANLIB=:
+
+$MAKE check
+$MAKE distcheck DISTCHECK_CONFIGURE_FLAGS="AR=`pwd`/bin/lib RANLIB=:"
+
+:
diff --git a/tests/ar-lib6a.test b/tests/ar-lib6a.test
new file mode 100755
index 0000000..f1b982c
--- /dev/null
+++ b/tests/ar-lib6a.test
@@ -0,0 +1,39 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test AM_PROG_AR ordering requirements
+# Keep this test in sync with sister test `ar-lib6b.test'.
+
+required=libtoolize
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+m4_ifdef([LT_INIT], [LT_INIT], [AC_PROG_LIBTOOL])
+AM_PROG_AR
+END
+
+libtoolize
+$ACLOCAL
+$AUTOCONF 2>stderr || { cat stderr >&2; Exit 1; }
+cat stderr >&2
+
+$EGREP '(AC_PROG_LIBTOOL|LT_INIT).*before.*AM_PROG_AR' stderr
+
+:
diff --git a/tests/ar-lib6b.test b/tests/ar-lib6b.test
new file mode 100755
index 0000000..5487add
--- /dev/null
+++ b/tests/ar-lib6b.test
@@ -0,0 +1,39 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test AM_PROG_AR ordering requirements for older Libtools
+# Keep this test in sync with sister test `ar-lib6a.test'.
+
+required=libtoolize
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_PROG_LIBTOOL
+AM_PROG_AR
+END
+
+libtoolize
+$ACLOCAL
+$AUTOCONF 2>stderr || { cat stderr >&2; Exit 1; }
+cat stderr >&2
+
+$EGREP 'AC_PROG_LIBTOOL.*before.*AM_PROG_AR' stderr
+
+:
diff --git a/tests/ar-lib7.test b/tests/ar-lib7.test
new file mode 100755
index 0000000..3f758a9
--- /dev/null
+++ b/tests/ar-lib7.test
@@ -0,0 +1,36 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test if automake warns if ar-lib is missing when AM_PROG_AR is used.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AM_PROG_AR
+END
+
+:> Makefile.am
+
+$ACLOCAL
+AUTOMAKE_fails
+
+grep '^configure\.in:.*ar-lib.*not found' stderr
+
+$AUTOMAKE --add-missing
+
+:
diff --git a/tests/ar.test b/tests/ar.test
index dbdf246..06dcde3 100755
--- a/tests/ar.test
+++ b/tests/ar.test
@@ -21,6 +21,7 @@
 set -e
 
 cat >> configure.in << 'END'
+AM_PROG_AR
 AC_SUBST([AR], ['echo it works'])
 AC_SUBST([ARFLAGS], ['>'])
 AC_SUBST([RANLIB], ['echo really works >>'])
@@ -32,6 +33,8 @@ lib_LIBRARIES = libfoo.a
 libfoo_a_SOURCES =
 END
 
+:> ar-lib
+
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
diff --git a/tests/ar2.test b/tests/ar2.test
index 329f804..f37f514 100755
--- a/tests/ar2.test
+++ b/tests/ar2.test
@@ -33,7 +33,7 @@ libfoo_a_SOURCES = foo.c
 END
 
 $ACLOCAL
-$AUTOMAKE
+$AUTOMAKE -Wno-extra-portability
 grep '^ARFLAGS =' Makefile.in
 grep '^AR =' Makefile.in
 
diff --git a/tests/ar3.test b/tests/ar3.test
new file mode 100755
index 0000000..1d5e84e
--- /dev/null
+++ b/tests/ar3.test
@@ -0,0 +1,43 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Make sure that AR, ARFLAGS, etc. works also when the macro AM_PROG_AR
+# is used.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AM_PROG_AR
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+EXTRA_LIBRARIES = libfoo.a
+libfoo_a_SOURCES = foo.c
+END
+
+: > ar-lib
+
+$ACLOCAL
+$AUTOMAKE
+$EGREP '^ARFLAGS =' Makefile.in
+$EGREP '^AR =' Makefile.in
+
+:
diff --git a/tests/ar4.test b/tests/ar4.test
new file mode 100755
index 0000000..ebd8c57
--- /dev/null
+++ b/tests/ar4.test
@@ -0,0 +1,35 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test if configure bails out if $AR does not work and AM_PROG_AR is used.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AM_PROG_AR
+END
+
+$ACLOCAL
+$AUTOCONF
+
+./configure AR=/bin/false 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+
+grep 'configure: error: could not determine /bin/false interface' stderr
+
+:
diff --git a/tests/ar5.test b/tests/ar5.test
new file mode 100755
index 0000000..d00f421
--- /dev/null
+++ b/tests/ar5.test
@@ -0,0 +1,33 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test the optional argument of AM_PROG_AR.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AM_PROG_AR([echo spy > bad-archiver-interface-detected])
+END
+
+$ACLOCAL
+$AUTOCONF
+
+./configure AR=/bin/false
+test -f bad-archiver-interface-detected
+
+:
diff --git a/tests/canon4.test b/tests/canon4.test
index 52e968d..d98636f 100755
--- a/tests/canon4.test
+++ b/tests/canon4.test
@@ -22,6 +22,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 END
 
@@ -30,6 +31,8 @@ noinst_LIBRARIES = libx-y.a
 libx_y_a_SOURCES = xy.c
 END
 
+: > ar-lib
+
 $ACLOCAL
 $AUTOMAKE
 
diff --git a/tests/check12.test b/tests/check12.test
new file mode 100755
index 0000000..34c8409
--- /dev/null
+++ b/tests/check12.test
@@ -0,0 +1,206 @@
+#! /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 to make sure dejagnu tests, automake-style tests, and check-local
+# target can coexist.
+
+required=runtest
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS =
+EXTRA_DIST =
+CLEANFILES =
+END
+
+## Simple tests.
+
+cat > a.test << 'END'
+#!/bin/sh
+exit ${A_EXIT_STATUS-0}
+END
+cat > b.test << 'END'
+#!/bin/sh
+exit ${B_EXIT_STATUS-0}
+END
+chmod +x a.test b.test
+
+cat >> Makefile.am << 'END'
+TESTS = a.test b.test
+EXTRA_DIST += $(TESTS)
+END
+
+A_EXIT_STATUS=0; export A_EXIT_STATUS
+B_EXIT_STATUS=0; export B_EXIT_STATUS
+
+## DejaGnu tests.
+
+cat >> Makefile.am << 'END'
+AUTOMAKE_OPTIONS += dejagnu
+DEJATOOL = hammer spanner
+AM_RUNTESTFLAGS = HAMMER=$(srcdir)/hammer SPANNER=$(srcdir)/spanner
+EXTRA_DIST += hammer.test/hammer.exp
+EXTRA_DIST += spanner.test/spanner.exp
+END
+
+cat > hammer << 'END'
+#! /bin/sh
+echo "Everything looks like a ${NAIL-nail} to me!"
+END
+
+NAIL=nail; export NAIL
+
+cat > spanner << 'END'
+#! /bin/sh
+echo "I'm a right spanner!"
+END
+chmod +x hammer spanner
+
+mkdir hammer.test spanner.test
+
+cat > hammer.test/hammer.exp << 'END'
+set test test_hammer
+spawn $HAMMER
+expect {
+    "Everything looks like a nail to me!" { pass "$test" }
+    default { fail "$test" }
+}
+END
+
+cat > spanner.test/spanner.exp << 'END'
+set test test_spanner
+spawn $SPANNER
+expect {
+    "I'm a right spanner!" { pass "$test" }
+    default { fail "$test" }
+}
+END
+
+## User-defined extra tests.
+
+cat >> Makefile.am <<'END'
+check-local:
+       case $$CHECKLOCAL_EXIT_STATUS in \
+         0) echo 'check-local succeded :-)';; \
+         *) echo 'check-local failed :-(';; \
+       esac >local.log
+       exit $$CHECKLOCAL_EXIT_STATUS
+CLEANFILES += local.log
+END
+CHECKLOCAL_EXIT_STATUS=0; export CHECKLOCAL_EXIT_STATUS
+
+## Go with the testcase execution.
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+for vpath in : false; do
+
+  if $vpath; then
+    srcdir=..
+    mkdir build_
+    cd build_
+  else
+    srcdir=.
+  fi
+
+  if test -f config.status; then
+    $MAKE distclean
+  fi
+
+  $srcdir/configure
+
+  $MAKE check
+  test -f hammer.log
+  test -f hammer.sum
+  test -f spanner.log
+  test -f spanner.sum
+  # This checks will be run only by the autogenerated `check12-p.test'.
+  if test x"$parallel_tests" = x"yes"; then
+    cat test-suite.log
+    grep '^PASS: a\.test (exit: 0)' a.log
+    grep '^PASS: b\.test (exit: 0)' b.log
+  else
+    :
+  fi
+  grep 'check-local succeded :-)' local.log
+
+  cp -f config.status config-status.sav
+
+  $MAKE distclean
+  test ! -r hammer.log
+  test ! -r hammer.sum
+  test ! -r spanner.log
+  test ! -r spanner.sum
+  test ! -r test-suite.log
+  test ! -r a.log
+  test ! -r b.log
+  test ! -r local.log
+
+  mv -f config-status.sav config.status
+  ./config.status
+
+  NAIL=screw $MAKE check && Exit 1
+  test -f hammer.log
+  test -f hammer.sum
+  test -f spanner.log
+  test -f spanner.sum
+  grep 'FAIL: test_hammer' hammer.sum
+  grep 'FAIL:' spanner.sum && Exit 1
+
+  B_EXIT_STATUS=1 $MAKE check && Exit 1
+  # This checks will be run only by the autogenerated `check12-p.test'.
+  if test x"$parallel_tests" = x"yes"; then
+    cat test-suite.log
+    grep '^PASS: a\.test (exit: 0)' a.log
+    grep '^FAIL: b\.test (exit: 1)' b.log
+    grep '^FAIL: b\.test (exit: 1)' test-suite.log
+  else :; fi
+
+  CHECKLOCAL_EXIT_STATUS=1 $MAKE check && Exit 1
+  grep 'check-local failed :-(' local.log
+
+  # Do not trust the exit status of `make -k'.
+  NAIL=screw B_EXIT_STATUS=23 CHECKLOCAL_EXIT_STATUS=1 $MAKE -k check || :
+  test -f hammer.log
+  test -f hammer.sum
+  test -f spanner.log
+  test -f spanner.sum
+  grep 'FAIL: test_hammer' hammer.sum
+  grep 'FAIL:' spanner.sum && Exit 1
+  # This checks will be run only by the autogenerated `check12-p.test'.
+  if test x"$parallel_tests" = x"yes"; then
+    cat test-suite.log
+    grep '^PASS: a\.test (exit: 0)' a.log
+    grep '^FAIL: b\.test (exit: 23)' b.log
+    grep '^FAIL: b\.test (exit: 23)' test-suite.log
+  else :; fi
+  grep 'check-local failed :-(' local.log
+
+  cd $srcdir
+
+done
+
+$MAKE distcheck
+
+:
diff --git a/tests/compile4.test b/tests/compile4.test
index 5a0bdf3..0b3e981 100755
--- a/tests/compile4.test
+++ b/tests/compile4.test
@@ -48,6 +48,7 @@ absmainobj=`pwd`/main.obj
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
diff --git a/tests/cond13.test b/tests/cond13.test
index e5f6be9..28f6cd3 100755
--- a/tests/cond13.test
+++ b/tests/cond13.test
@@ -24,6 +24,7 @@ set -e
 cat >> configure.in << 'END'
 AC_PROG_CC
 AC_PROG_CXX
+AM_PROG_AR
 AC_PROG_RANLIB
 AM_CONDITIONAL(COND1, true)
 AM_CONDITIONAL(COND2, true)
@@ -49,6 +50,8 @@ endif
 libtest_a_SOURCES = $(TESTSOURCES)
 END
 
+: > ar-lib
+
 $ACLOCAL
 $AUTOMAKE
 
diff --git a/tests/condlib.test b/tests/condlib.test
index b6c998d..88ef308 100755
--- a/tests/condlib.test
+++ b/tests/condlib.test
@@ -24,6 +24,7 @@ set -e
 cat >> configure.in << 'END'
 AC_PROG_RANLIB
 AM_MAINTAINER_MODE
+AM_PROG_AR
 AC_PROG_CC
 END
 
@@ -36,6 +37,8 @@ nodist_librsaref_a_SOURCES = desc.c digit.c
 BUILT_SOURCES = $(nodist_librsaref_a_SOURCES)
 END
 
+: > ar-lib
+
 $ACLOCAL
 $AUTOMAKE
 
diff --git a/tests/defs.in b/tests/defs.in
index 2959f8b..b8edd3b 100644
--- a/tests/defs.in
+++ b/tests/defs.in
@@ -278,6 +278,14 @@ do
       echo "$me: running javac -version -help"
       javac -version -help || exit 77
       ;;
+    lib)
+      AR=lib
+      export AR
+      # Attempting to create an empty archive will actually not
+      # create the archive, but lib will output its version.
+      echo "$me: running $AR -out:defstest.lib"
+      $AR -out:defstest.lib || skip_ "Microsoft \`lib' utility not available"
+      ;;
     makedepend)
       echo "$me: running makedepend -f-"
       ( makedepend -f- ) || exit 77
diff --git a/tests/dejagnu-absolute-builddir.test 
b/tests/dejagnu-absolute-builddir.test
new file mode 100755
index 0000000..ad9578f
--- /dev/null
+++ b/tests/dejagnu-absolute-builddir.test
@@ -0,0 +1,62 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that DejaGnu testsuites have 'objdir' defined (as a TCL variable)
+# to an absolute path.
+
+required=runtest
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = dejagnu
+DEJATOOL = tcl env
+EXTRA_DIST = tcl.test/tcl.exp
+END
+
+mkdir tcl.test
+
+cat > tcl.test/tcl.exp << 'END'
+send_user "tcl_objdir: $objdir\n"
+if { [ regexp "^/" $objdir ] } {
+    pass "test_tcl_objdir"
+} else {
+    fail "test_tcl_objdir"
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure
+
+$MAKE check
+
+# Sanity check: all tests have run.
+test -f env.log
+test -f env.sum
+test -f tcl.log
+test -f tcl.sum
+
+$MAKE distcheck
+
+:
diff --git a/tests/dejagnu-relative-srcdir.test 
b/tests/dejagnu-relative-srcdir.test
new file mode 100755
index 0000000..8a70d58
--- /dev/null
+++ b/tests/dejagnu-relative-srcdir.test
@@ -0,0 +1,86 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that DejaGnu testsuites have 'srcdir' defined to a relative path
+# (both as TCL variable and as environment variable).
+
+required=runtest
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = dejagnu
+DEJATOOL = tcl env
+EXTRA_DIST = env.test/env.exp tcl.test/tcl.exp lib/tcl.exp
+END
+
+mkdir env.test tcl.test lib
+
+# DejaGnu can change $srcdir behind our backs, so we have to
+# save its original value.  Thanks to Ian Lance Taylor for the
+# suggestion.
+cat > lib/tcl.exp << 'END'
+send_user "tcl_lib_srcdir: $srcdir\n"
+set orig_srcdir $srcdir
+END
+
+cat > env.test/env.exp << 'END'
+set env_srcdir $env(srcdir)
+send_user "env_srcdir: $env_srcdir\n"
+if { [ regexp "^\.\.?$" $env_srcdir ] } {
+    pass "test_env_src"
+} else {
+    fail "test_env_src"
+}
+END
+
+cat > tcl.test/tcl.exp << 'END'
+send_user "tcl_srcdir: $srcdir\n"
+if { [ regexp "^\.\.?$" $srcdir ] } {
+    pass "test_tcl_src"
+} else {
+    fail "test_tcl_src"
+}
+send_user "tcl_orig_srcdir: $orig_srcdir\n"
+if { [ regexp "^\.\.?$" $orig_srcdir ] } {
+    pass "test_tcl_orig_src"
+} else {
+    fail "test_tcl_orig_src"
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure --srcdir=.
+
+$MAKE check
+
+# Sanity check: all tests have run.
+test -f env.log
+test -f env.sum
+test -f tcl.log
+test -f tcl.sum
+
+$MAKE distcheck
+
+:
diff --git a/tests/dejagnu-siteexp-append.test 
b/tests/dejagnu-siteexp-append.test
new file mode 100755
index 0000000..7bd34ed
--- /dev/null
+++ b/tests/dejagnu-siteexp-append.test
@@ -0,0 +1,72 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that the files in $(EXTRA_DEJAGNU_SITE_CONFIG) get appended to
+# site.exp in the same order in which they're listed in that variable.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = dejagnu
+DEJATOOL = tool
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure
+
+$MAKE site.exp
+sed '/^##.*##$/d' site.exp > expected
+
+cat > foo.exp << 'END'
+foo1
+foo2
+foo3
+END
+
+cat foo.exp - >> expected << 'END'
+BAR 1
+# foo
+BAR 2
+END
+
+cat >> Makefile.am << 'END'
+EXTRA_DEJAGNU_SITE_CONFIG = foo.exp bar.exp
+bar.exp:
+       @(echo 'BAR 1' && echo '# foo' && echo 'BAR 2') > $@
+END
+
+$AUTOMAKE Makefile
+./config.status Makefile
+
+rm -f site.exp
+$MAKE site.exp
+sed '/^##.*##$/d' site.exp > obtained
+
+cat expected
+cat site.exp
+
+diff expected obtained
+
+:
diff --git a/tests/dejagnu-siteexp-extend.test 
b/tests/dejagnu-siteexp-extend.test
new file mode 100755
index 0000000..591267e
--- /dev/null
+++ b/tests/dejagnu-siteexp-extend.test
@@ -0,0 +1,161 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that the developer can extend the site.exp generated by the
+# automake-generated Makefile.
+
+required=runtest
+. ./defs || Exit 1
+
+set -e
+
+write_check_for ()
+{
+  echo "send_user \"$1: \$$1\\n\""
+  cat << END
+if { \$$1 == "/$1/" } {
+    pass "test_$1"
+} else {
+    fail "test_$1"
+}
+END
+}
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = dejagnu
+DEJATOOL = tool
+
+EXTRA_DIST = tool.test/tool.exp
+
+EXTRA_DEJAGNU_SITE_CONFIG = foo.exp
+EXTRA_DIST += foo.exp
+END
+
+echo 'set foo "/foo/"' > foo.exp
+
+mkdir tool.test
+write_check_for foo > tool.test/tool.exp
+cat tool.test/tool.exp
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure
+
+$MAKE check
+cat foo.exp
+cat site.exp
+grep 'PASS: test_foo' tool.sum
+
+write_check_for bar >> tool.test/tool.exp
+write_check_for baz >> tool.test/tool.exp
+cat tool.test/tool.exp
+
+# Ensure that foo.exp will be newer than site.exp, which will
+# thus have to be remade.
+$sleep
+# With this, below we'll also check that settings in files coming later in
+# $(EXTRA_DEJAGNU_SITE_CONFIG) override those in files coming earlier.
+cat >> foo.exp <<'END'
+set bar "/foo/"
+set baz "/foo/"
+set qux "/foo/"
+END
+
+$MAKE check && { cat site.exp; Exit 1; }
+grep 'PASS: test_foo' tool.sum
+grep 'FAIL: test_bar' tool.sum
+grep 'FAIL: test_baz' tool.sum
+
+cat >> Makefile.am << 'END'
+EXTRA_DEJAGNU_SITE_CONFIG += bar bar.dir/bar
+EXTRA_DIST += bar
+DISTCLEANFILES = bar.dir/bar
+bar.dir/bar:
+       test -d bar.dir || mkdir bar.dir
+       echo 'set baz "/baz/"' > $@
+END
+
+echo 'set bar "/bar/"' > bar
+# This will allow us to check one more time that settings in files
+# coming later in $(EXTRA_DEJAGNU_SITE_CONFIG) override those in
+# files coming earlier.
+echo 'set baz "/xyz/"' >> bar
+
+# Ensure that the Makefile will be newer than site.exp, which will
+# thus have to be remade.
+$sleep
+$AUTOMAKE Makefile
+./config.status Makefile
+
+$MAKE check || { cat site.exp; Exit 1; }
+cat site.exp
+cat bar.dir/bar
+$FGREP '/bar/' site.exp
+$FGREP '/baz/' site.exp
+grep 'PASS: test_foo' tool.sum
+grep 'PASS: test_bar' tool.sum
+grep 'PASS: test_baz' tool.sum
+
+# Check that the features we're testing behave well in VPATH builds.
+$MAKE distcheck
+
+# Check that the user can edit the site.exp file, and that his edits
+# are retained.
+write_check_for zardoz >> tool.test/tool.exp
+cat tool.test/tool.exp
+echo 'set zardoz "/zardoz/"' >> site.exp
+
+$MAKE check
+cat site.exp
+grep 'PASS: test_zardoz' tool.sum
+
+cat >> Makefile.am << 'END'
+EXTRA_DEJAGNU_SITE_CONFIG += quux.exp
+quux.exp:
+       echo 'set zardoz "/quux/"' > $@
+END
+
+# Ensure that the Makefile will be newer than on site.exp, which will
+# thus have to be remade.
+$sleep
+$AUTOMAKE Makefile
+./config.status Makefile
+grep 'zardoz.*/quux/' Makefile
+
+$MAKE site.exp
+cat site.exp
+cat quux.exp
+grep 'zardoz.*/quux/' site.exp
+
+$MAKE check
+grep 'PASS: test_zardoz' tool.sum
+grep 'zardoz: /zardoz/' tool.log
+grep 'zardoz.*quux' tool.log && Exit 1
+
+# Check that files in $(EXTRA_DEJAGNU_SITE_CONFIG) are not distributed
+# by default.
+$MAKE distdir
+ls -l $me-1.0
+test ! -r $me-1.0/bar.dir/bar
+test ! -r $me-1.0/quux.exp
+
+:
diff --git a/tests/dejagnu-siteexp-useredit.test 
b/tests/dejagnu-siteexp-useredit.test
new file mode 100755
index 0000000..a51bc40
--- /dev/null
+++ b/tests/dejagnu-siteexp-useredit.test
@@ -0,0 +1,69 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that the user can edit the Makefile-generated site.exp, and
+# have its edits survive to the remaking of that file.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AUTOMAKE_OPTIONS = dejagnu
+DEJATOOL = foo
+END
+
+# Deliberately select a variable defined automatically by
+# the Makefile-generated site.exp.
+mkdir foo.test
+cat > foo.test/foo.exp << 'END'
+send_user "objdir: $objdir\n"
+set pipe "|"
+if { $objdir == "${pipe}objdir${pipe}" } {
+    pass "test_obj"
+} else {
+    fail "test_obj"
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure
+
+$MAKE site.exp
+echo 'set objdir "|objdir|"' >> site.exp
+cat site.exp
+$sleep
+touch Makefile
+$MAKE site.exp
+cat site.exp
+is_newest site.exp Makefile  # Sanity check.
+grep '|objdir|' site.exp
+test `grep -c '|objdir|' site.exp` -eq 1
+
+# We can done a "more semantic" check if DejaGnu is available.
+if runtest SOMEPROGRAM=someprogram --version; then
+  $MAKE check
+  grep 'PASS: test_obj' foo.sum
+fi
+
+:
diff --git a/tests/dejagnu.test b/tests/dejagnu.test
index a273770..b3e58e7 100755
--- a/tests/dejagnu.test
+++ b/tests/dejagnu.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/>.
 
-# Test to make sure dejagnu tests and automake-style tests can coexist.
+# Superficial test to check that dejagnu tests and automake-style
+# tests can coexist.  See also related deeper test `check12.test'.
 
 . ./defs || Exit 1
 
@@ -25,10 +26,10 @@ AUTOMAKE_OPTIONS = dejagnu
 TESTS = frob.test
 END
 
-: > frob.test
-
 $ACLOCAL
 $AUTOMAKE
 
 grep '^check-TESTS' Makefile.in
 grep '^check-DEJAGNU' Makefile.in
+
+:
diff --git a/tests/dejagnu2.test b/tests/dejagnu2.test
index 531f744..121f6d8 100755
--- a/tests/dejagnu2.test
+++ b/tests/dejagnu2.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2001, 2002, 2003  Free Software Foundation, Inc.
+# Copyright (C) 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
@@ -20,26 +20,29 @@
 
 set -e
 
-echo 'AC_OUTPUT' >> configure.in
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
 
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = dejagnu
 
 site.exp:
-       @echo foo
+       echo :GREP:ME: > $@
 END
 
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -Wno-override
 
-grep site.exp Makefile.in
-test `grep '^site\.exp:' Makefile.in | wc -l` -eq 1
+grep 'site\.exp' Makefile.in
+test `grep -c '^site\.exp:' Makefile.in` -eq 1
 
 ./configure
-$MAKE site.exp >stdout
-cat stdout
-grep foo stdout
+$MAKE site.exp
+grep ':GREP:ME:' site.exp
 
 AUTOMAKE_fails
-grep 'Makefile.am:3:.*site.exp' stderr
+grep '^Makefile\.am:3:.*site\.exp' stderr
+
+:
diff --git a/tests/dejagnu3.test b/tests/dejagnu3.test
index d812ac4..2c5d375 100755
--- a/tests/dejagnu3.test
+++ b/tests/dejagnu3.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
@@ -28,15 +28,14 @@ END
 
 chmod +x hammer
 
-echo AC_OUTPUT >> configure.in
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
 
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = dejagnu
-
 DEJATOOL = hammer
-
 AM_RUNTESTFLAGS = HAMMER=$(srcdir)/hammer
-
 EXTRA_DIST = hammer hammer.test/hammer.exp
 END
 
@@ -65,5 +64,9 @@ $MAKE distcheck
 
 # Ensure that the envvar RUNTESTFLAGS is used.
 # Report from Mark Mitchell.
-RUNTESTFLAGS=--unknown-option $MAKE check && Exit 1
-Exit 0
+RUNTESTFLAGS=--unknown-runtest-option $MAKE check >output 2>&1 \
+  && { cat output; Exit 1; }
+cat output
+$FGREP 'unknown-runtest-option' output
+
+:
diff --git a/tests/dejagnu4.test b/tests/dejagnu4.test
index 5fdda10..fa64a31 100755
--- a/tests/dejagnu4.test
+++ b/tests/dejagnu4.test
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2003, 2006  Free Software Foundation, Inc.
+# Copyright (C) 2003, 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
@@ -26,17 +26,17 @@ cat > hammer << 'END'
 #! /bin/sh
 echo "Everything looks like a nail to me!"
 END
-
 chmod +x hammer
 
 cat > spanner << 'END'
 #! /bin/sh
 echo "I'm a right spanner!"
 END
-
 chmod +x spanner
 
-echo AC_OUTPUT >> configure.in
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
 
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = dejagnu
@@ -49,8 +49,7 @@ EXTRA_DIST  = hammer  hammer.test/hammer.exp
 EXTRA_DIST += spanner spanner.test/spanner.exp
 END
 
-mkdir hammer.test
-mkdir spanner.test
+mkdir hammer.test spanner.test
 
 cat > hammer.test/hammer.exp << 'END'
 set test test
@@ -86,8 +85,14 @@ $MAKE distcheck
 
 # Test for PR 488.
 sed 's/E\(verything\)/Not e\1/' hammer > thammer
-mv thammer hammer
+mv -f thammer hammer
 chmod +x hammer
 
+rm -f hammer.log hammer.sum spanner.log spanner.sum
 $MAKE check && Exit 1
+test -f hammer.log
+test -f hammer.sum
+test -f spanner.log
+test -f spanner.sum
+
 :
diff --git a/tests/dejagnu5.test b/tests/dejagnu5.test
index 0095958..0237a08 100755
--- a/tests/dejagnu5.test
+++ b/tests/dejagnu5.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
@@ -22,30 +22,27 @@ required=runtest
 
 set -e
 
-# Get the package name from configure.in.
-package=`$FGREP AC_INIT configure.in | sed -e 's:^[^[]*\[\([^]]*\)\].*$:\1:'`
+package=$me
 
 cat > $package << 'END'
 #! /bin/sh
 echo "Ah, we have been expecting you, Mr. Blond."
 END
-
 chmod +x $package
 
-echo AC_OUTPUT >> configure.in
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
 
 cat > Makefile.am << END
 AUTOMAKE_OPTIONS = dejagnu
-
 EXTRA_DIST = $package $package.test/$package.exp
+AM_RUNTESTFLAGS = PACKAGE=\$(srcdir)/$package
 END
 
-echo "AM_RUNTESTFLAGS = PACKAGE=\$(srcdir)/$package" >> Makefile.am
-
 mkdir $package.test
-
 cat > $package.test/$package.exp << 'END'
-set test "test"
+set test "a_dejagnu_test"
 spawn $PACKAGE
 expect {
     "Ah, we have been expecting you, Mr. Blond." { pass "$test" }
@@ -64,3 +61,5 @@ test -f $package.log
 test -f $package.sum
 
 $MAKE distcheck
+
+:
diff --git a/tests/dejagnu6.test b/tests/dejagnu6.test
index 25a1f1f..662ca28 100755
--- a/tests/dejagnu6.test
+++ b/tests/dejagnu6.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,23 +25,21 @@ cat > faildeja << 'END'
 #! /bin/sh
 echo whatever
 END
-
 chmod +x faildeja
 
-echo AC_OUTPUT >> configure.in
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
 
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = dejagnu
-
 DEJATOOL = faildeja
-
 AM_RUNTESTFLAGS = FAILDEJA=$(srcdir)/faildeja
 END
 
 mkdir faildeja.test
-
 cat > faildeja.test/faildeja.exp << 'END'
-set test test
+set test failing_deja_test
 spawn $FAILDEJA
 expect {
     default { fail "$test" }
@@ -57,4 +55,6 @@ $AUTOMAKE --add-missing
 $MAKE check && Exit 1
 test -f faildeja.log
 test -f faildeja.sum
-$FGREP 'FAIL: test' faildeja.sum
+$FGREP 'FAIL: failing_deja_test' faildeja.sum
+
+:
diff --git a/tests/dejagnu7.test b/tests/dejagnu7.test
index 552c2ca..0be4d1f 100755
--- a/tests/dejagnu7.test
+++ b/tests/dejagnu7.test
@@ -29,21 +29,19 @@ cat > failtcl << 'END'
 #! /bin/sh
 echo whatever
 END
-
 chmod +x failtcl
 
-echo AC_OUTPUT >> configure.in
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
 
 cat > Makefile.am << 'END'
 AUTOMAKE_OPTIONS = dejagnu
-
 DEJATOOL = failtcl
-
 AM_RUNTESTFLAGS = --status FAILTCL=$(srcdir)/failtcl
 END
 
 mkdir failtcl.test
-
 cat > failtcl.test/failtcl.exp << 'END'
 set test test
 spawn $FAILTCL
@@ -62,3 +60,5 @@ $MAKE check && Exit 1
 test -f failtcl.log
 test -f failtcl.sum
 $FGREP 'missing close-brace' failtcl.sum
+
+:
diff --git a/tests/depcomp4.test b/tests/depcomp4.test
index 4f2df97..3c3602f 100755
--- a/tests/depcomp4.test
+++ b/tests/depcomp4.test
@@ -23,6 +23,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/depcomp6.test b/tests/depcomp6.test
index ea15e20..c7734b1 100755
--- a/tests/depcomp6.test
+++ b/tests/depcomp6.test
@@ -23,6 +23,7 @@ set -e
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_CONFIG_FILES([sub2/Makefile])
 AC_OUTPUT
diff --git a/tests/depcomp7.test b/tests/depcomp7.test
index 47f09fc..9b0ed22 100755
--- a/tests/depcomp7.test
+++ b/tests/depcomp7.test
@@ -24,6 +24,7 @@ set -e
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
+AM_PROG_AR
 AM_PROG_LIBTOOL
 AC_CONFIG_FILES([sub2/Makefile])
 AC_OUTPUT
diff --git a/tests/depcomp8b.test b/tests/depcomp8b.test
index d36e754..5651479 100755
--- a/tests/depcomp8b.test
+++ b/tests/depcomp8b.test
@@ -26,6 +26,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/dist-auxfile-2.test b/tests/dist-auxfile-2.test
new file mode 100755
index 0000000..08daa6c
--- /dev/null
+++ b/tests/dist-auxfile-2.test
@@ -0,0 +1,62 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Files specified by AC_REQUIRE_AUX_FILE must exist, and if a Makefile
+# is present in the build-aux directory, they correctly get automatically
+# distributed.
+# Related to automake bug#9651.
+
+am_create_testdir=empty
+. ./defs || Exit 1
+
+set -e
+
+cat > configure.in <<END
+AC_INIT([$me], [1.0])
+AC_CONFIG_AUX_DIR([sub])
+AM_INIT_AUTOMAKE
+AC_REQUIRE_AUX_FILE([zardoz])
+AC_CONFIG_FILES([Makefile sub/Makefile])
+AC_OUTPUT
+END
+
+cat > Makefile.am <<'END'
+SUBDIRS = sub
+test: distdir
+       ls -l $(distdir) $(distdir)/* ;: For debugging.
+       test -f $(distdir)/sub/zardoz
+.PHONY: test
+check-local: test
+END
+
+mkdir sub
+: > sub/Makefile.am
+
+echo dummy > sub/zardoz
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+test -f sub/install-sh
+# Should work also without `--add-missing'.
+$AUTOMAKE
+
+./configure
+
+$MAKE test
+$MAKE distcheck
+
+:
diff --git a/tests/dist-auxfile.test b/tests/dist-auxfile.test
new file mode 100755
index 0000000..2776a25
--- /dev/null
+++ b/tests/dist-auxfile.test
@@ -0,0 +1,96 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Files specified by AC_REQUIRE_AUX_FILE must exist, and they get
+# automatically distributed by the top-level Makefile.am.
+# Automake bug#9651 reported that this didn't happen when the build-aux
+# directory was set to `.' by AC_CONFIG_AUX_DIR.
+
+am_create_testdir=empty
+. ./defs || Exit 1
+
+set -e
+
+i=0
+for auxdir in build-aux ''; do
+
+  echo "*** Testing with auxdir '$auxdir' ***"
+
+  i=`expr $i + 1`
+  mkdir T$i.d
+  cd T$i.d
+
+  unindent > configure.in <<END
+    AC_INIT([$me], [1.0])
+    AC_CONFIG_AUX_DIR([${auxdir:-.}])
+    AM_INIT_AUTOMAKE
+    AC_REQUIRE_AUX_FILE([foo.txt])
+    AC_REQUIRE_AUX_FILE([bar.sh])
+    AC_REQUIRE_AUX_FILE([zardoz])
+    AC_CONFIG_FILES([Makefile subdir/Makefile])
+    AC_OUTPUT
+END
+
+  echo auxdir = ${auxdir:+"$auxdir/"} > Makefile.am
+  unindent >> Makefile.am <<'END'
+    SUBDIRS = subdir
+    test: distdir
+       ls -l $(distdir) $(distdir)/*      ;: For debugging.
+       @echo DIST_COMMON = $(DIST_COMMON) ;: Likewise.
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]$(auxdir)foo.txt '
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]$(auxdir)bar.sh '
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]$(auxdir)zardoz '
+       test -f $(distdir)/$(auxdir)foo.txt
+       test -f $(distdir)/$(auxdir)bar.sh
+       test -f $(distdir)/$(auxdir)zardoz
+    .PHONY: test
+    check-local: test
+END
+
+  mkdir subdir
+  : > subdir/Makefile.am
+  
+  test -z "$auxdir" || mkdir "$auxdir" || Exit 99
+
+  if test -z "$auxdir"; then
+    auxdir=.
+    auxdir_rx='\.'
+  else
+    auxdir_rx=$auxdir
+  fi
+
+  $ACLOCAL
+  $AUTOCONF
+
+  AUTOMAKE_fails
+  grep "^configure\\.in:4:.* required file.*$auxdir_rx/foo\\.txt" stderr
+  grep "^configure\\.in:5:.* required file.*$auxdir_rx/bar\\.sh"  stderr
+  grep "^configure\\.in:6:.* required file.*$auxdir_rx/zardoz"    stderr
+
+  touch $auxdir/foo.txt $auxdir/bar.sh $auxdir/zardoz
+  cp "$testsrcdir"/../lib/missing "$testsrcdir"/../lib/install-sh $auxdir
+  $AUTOMAKE
+  ./configure
+  $MAKE test
+  $EGREP '(foo\.txt|bar\.sh|zardoz)' subdir/Makefile.in && Exit 1
+
+  $MAKE distcheck
+
+  cd ..
+
+done
+
+:
diff --git a/tests/distcheck-hook-m4.am b/tests/distcheck-hook-m4.am
new file mode 100644
index 0000000..88681e9
--- /dev/null
+++ b/tests/distcheck-hook-m4.am
@@ -0,0 +1,30 @@
+## Data files for some tests.  Not used in the automake build system.
+##
+## Copyright (C) 2011 Free Software Foundation, Inc.
+##
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2, or (at your option)
+## any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+distcheck-hook:
+       @fatal () { echo "$@: $$*" >&2; exit 1; }; \
+       $(am__cd) $(distdir) && chmod u+w . && mkdir _m4 \
+         || fatal "cannot setup distdir"; \
+       $(ACLOCAL) -I _m4 $(ACLOCAL_AMFLAGS) --install --output=_am.m4 \
+         || fatal "cannot regenerate aclocal.m4"; \
+       lst=`ls _m4 | tr '\012\015' '  '`; \
+       if test -n "$$lst"; then \
+         fatal "required m4 files not distributed or outdated: $$lst"; \
+       fi; \
+       $(AUTOCONF) -o /dev/null || fatal "can't remake configure"; \
+       rm -rf _m4 _am.m4 autom4te.cache && chmod a-w . \
+         || fatal "cannot reset distdir"
diff --git a/tests/distcheck-missing-m4.test b/tests/distcheck-missing-m4.test
new file mode 100755
index 0000000..1d42748
--- /dev/null
+++ b/tests/distcheck-missing-m4.test
@@ -0,0 +1,120 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test that we can define a distcheck-hook to diagnose m4 files
+# missing from the dist tarball (interaction with `--install').
+# See automake bug#9037.
+
+. ./defs || Exit 1
+
+set -e
+
+cwd=`pwd` || fatal_ "cannot get current working directory"
+
+cp "$testsrcdir"/distcheck-hook-m4.am . \
+  || fatal_ "cannot fetch makefile fragment \`distcheck-hook-m4.am'"
+
+cat > Makefile.am << 'END'
+## The lack of `--install' here is meant.
+ACLOCAL_AMFLAGS = -I m4
+include $(srcdir)/distcheck-hook-m4.am
+END
+
+cat >> configure.in << 'END'
+dnl We *deliberately* don't use m4_pattern_forbid here.
+AC_OUTPUT
+MY_FOO
+MY_BAR
+MY_BAZ
+MY_ZAR
+END
+
+mkdir m4 acdir acdir1 acdir2 pth
+
+cat > acdir/dirlist << END
+$cwd/acdir1
+$cwd/acdir2
+END
+
+echo 'AC_DEFUN([MY_FOO], [:])' > m4/foo.m4
+echo 'AC_DEFUN([MY_BAR], [:])' > acdir1/bar.m4
+echo 'AC_DEFUN([MY_BAZ], [:])' > acdir1/baz.m4
+echo 'AC_DEFUN([MY_QUX], [:])' > acdir2/qux.m4
+echo 'AC_DEFUN([MY_ZAR], [:])' > pth/zar.m4
+echo 'AC_DEFUN([MY_BLA], [:])' > pth/bla.m4
+
+ACLOCAL="$ACLOCAL --system-acdir=$cwd/acdir"; export ACLOCAL
+ACLOCAL_PATH=$cwd/pth; export ACLOCAL_PATH
+
+# We don't use `--install' here.  Our distcheck-hook should catch this.
+$ACLOCAL -I m4
+$AUTOCONF
+$EGREP 'MY_(FOO|BAR|BAZ|ZAR)' configure && Exit 1 # Sanity check.
+$AUTOMAKE
+
+check_no_spurious_error ()
+{
+  $EGREP -i 'mkdir:|:.*(permission|denied)' output && Exit 1
+  # On failure, some make implementations (such as Solaris make) print the
+  # whole failed recipe on stdout.  The first grep works around this.
+  grep -v 'rm -rf ' output | grep -i 'autom4te.*\.cache' && Exit 1
+  : # To placate `set -e'.
+}
+
+./configure
+
+$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
+cat output
+for x in bar baz zar; do
+  $EGREP "required m4 file.*not distributed.* $x.m4( |$)" output
+done
+check_no_spurious_error
+
+# Now we use `--install', and "make distcheck" should pass.
+$ACLOCAL -I m4 --install
+test -f m4/bar.m4 # Sanity check.
+test -f m4/baz.m4 # Likewise.
+test -f m4/zar.m4 # Likewise.
+using_gmake || $MAKE Makefile
+$MAKE distcheck
+
+# We start to use new "third-party" macros from new .m4 files, but forget
+# to re-run "aclocal --install" by hand, relying on automatic remake rules.
+# Our distcheck-hook should catch this too.
+cat >> configure.in << 'END'
+MY_QUX
+MY_BLA
+END
+
+$MAKE
+$EGREP 'MY_(FOO|BAR|BAZ|QUX|ZAR|BLA)' configure && Exit 1 # Sanity check.
+
+$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
+cat output
+$EGREP "required m4 file.*not distributed.* qux.m4( |$)" output
+$EGREP "required m4 file.*not distributed.* bla.m4( |$)" output
+check_no_spurious_error
+# Check that we don't complain for files that should have been found.
+$FGREP " (bar|baz|zar).m4" output && Exit 1
+
+# Now we again use `--install', and "make distcheck" should pass.
+$ACLOCAL -I m4 --install
+test -f m4/qux.m4 # Sanity check.
+test -f m4/bla.m4 # Likewise.
+using_gmake || $MAKE Makefile
+$MAKE distcheck
+
+:
diff --git a/tests/distcheck-outdated-m4.test b/tests/distcheck-outdated-m4.test
new file mode 100755
index 0000000..e3f265e
--- /dev/null
+++ b/tests/distcheck-outdated-m4.test
@@ -0,0 +1,139 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test that we can define a distcheck-hook to diagnose outdated m4
+# files in a dist tarball (interaction with `--install').
+# See automake bug#9037.
+
+. ./defs || Exit 1
+
+set -e
+
+cwd=`pwd` || fatal_ "cannot get current working directory"
+
+cp "$testsrcdir"/distcheck-hook-m4.am . \
+  || fatal_ "cannot fetch makefile fragment \`distcheck-hook-m4.am'"
+
+cat > Makefile.am << 'END'
+## The lack of `--install' here is meant.
+ACLOCAL_AMFLAGS = -I m4
+include $(srcdir)/distcheck-hook-m4.am
+END
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+MY_FOO
+MY_BAR
+MY_BAZ
+END
+
+mkdir m4 acdir
+echo 'AC_DEFUN([MY_FOO], [:])' > m4/foo.m4
+echo 'AC_DEFUN([MY_BAR], [:])' > acdir/bar.m4
+cat > acdir/baz.m4 << 'END'
+# serial 1
+AC_DEFUN([MY_BAZ], [:])
+END
+
+ACLOCAL="$ACLOCAL --system-acdir=$cwd/acdir"; export ACLOCAL
+
+# The use of `--install' here won't help when the installed file `.m4'
+# will become out-of-date w.r.t. the one in the system acdir.
+$ACLOCAL -I m4 --install
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE distcheck # Sanity check.
+
+check_no_spurious_error ()
+{
+  $EGREP -i 'mkdir:|:.*(permission|denied)' output && Exit 1
+  # On failure, some make implementations (such as Solaris make) print the
+  # whole failed recipe on stdout.  The first grep works around this.
+  grep -v 'rm -rf ' output | grep -i 'autom4te.*\.cache' && Exit 1
+  : # To placate `set -e'.
+}
+
+# We start to use a new "third-party" macro in a new version
+# of a pre-existing third-party m4 file, but forget to re-run
+# "aclocal --install" by hand, relying on automatic remake
+# rules.  Our distcheck-hook should catch this too.
+echo MY_ZARDOZ >> configure.in
+
+cat > acdir/baz.m4 << 'END'
+# serial 2
+AC_DEFUN([MY_BAZ], [:])
+AC_DEFUN([MY_ZARDOZ], [:])
+END
+
+$MAKE # Rebuild configure and makefiles.
+$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
+cat output
+
+$EGREP "required m4 file.* outdated.* baz.m4( |$)" output
+check_no_spurious_error
+# Check that we don't complain for files that aren't outdated.
+$EGREP " (foo|bar).m4" output && Exit 1
+
+# Now we again use `--install' explicitly, and "make distcheck"
+# should pass.
+$ACLOCAL -I m4 --install
+using_gmake || $MAKE Makefile
+$MAKE distcheck
+
+# Similar to what have been done above, but this time we:
+#  - use ACLOCAL_PATH, and
+#  - do not add the use of a new macro.
+
+echo MY_FNORD >> configure.in
+
+mkdir pth
+cat > pth/fnord.m4 << 'END'
+# serial 1
+AC_DEFUN([MY_FNORD], [:])
+END
+
+ACLOCAL_PATH="$cwd/pth"; export ACLOCAL_PATH
+
+# The explicit use of `--install' here won't help when the installed file
+# `.m4' will become out-of-date w.r.t. the one in the system acdir.
+$ACLOCAL -I m4 --install
+using_gmake || $MAKE Makefile
+$MAKE distcheck
+
+# Only increase serial number, without changing the other contents; this
+# is deliberate.
+cat > pth/fnord.m4 << 'END'
+# serial 2
+AC_DEFUN([MY_FNORD], [:])
+END
+
+$MAKE # Rebuild configure and makefiles.
+$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
+cat output
+$EGREP "required m4 file.* outdated.* fnord.m4( |$)" output
+check_no_spurious_error
+# Check that we don't complain for files that aren't outdated.
+$EGREP " (foo|bar|baz).m4" output && Exit 1
+
+# Now we again use `--install' explicitly, and "make distcheck"
+# should pass.
+$ACLOCAL -I m4 --install
+using_gmake || $MAKE Makefile
+$MAKE distcheck
+
+:
diff --git a/tests/distcheck-override-infodir.test 
b/tests/distcheck-override-infodir.test
new file mode 100755
index 0000000..8c54cfb
--- /dev/null
+++ b/tests/distcheck-override-infodir.test
@@ -0,0 +1,63 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that we can override ${infodir} while having distcheck still
+# working.  Relate to automake bug#9579.
+
+required='makeinfo tex texi2dvi'
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+infodir = ${prefix}/blah/blah/foobar
+info_TEXINFOS = main.texi
+## Sanity check.
+installcheck-local:
+       if test x$${infodir+set} != xset; then \
+         ls -l "$(DESTDIR)/$(prefix)/blah/blah/foobar/" || exit 1; \
+         test -f "$(DESTDIR)/$(prefix)/blah/blah/foobar/dir" || exit 1; \
+       else \
+         ls -l "$(DESTDIR)/$$infodir/" || exit 1; \
+         test -f "$(DESTDIR)/$$infodir/dir" || exit 1; \
+       fi
+END
+
+cat > main.texi << 'END'
+\input texinfo
address@hidden main.info
address@hidden main
address@hidden Top
+Hello walls.
address@hidden
+END
+
+$ACLOCAL
+$AUTOMAKE -a
+$AUTOCONF
+
+./configure
+$MAKE
+
+$MAKE distcheck
+infodir="`pwd`"/_info $MAKE -e distcheck
+test -f _info/dir || Exit 99 # Sanity check.
+
+:
diff --git a/tests/distcheck-pr9579.test b/tests/distcheck-pr9579.test
new file mode 100755
index 0000000..667401d
--- /dev/null
+++ b/tests/distcheck-pr9579.test
@@ -0,0 +1,98 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check against automake bug#9579: distcheck does not always detect
+# incomplete uninstall as advertised.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+# NOTE: the use of `dir' as the name of the data file installed by hand
+# is deliberate, and enhances coverage -- see definition and comments of
+# lib/am/distdir.am:$(am__distuninstallcheck_listfiles).
+
+cat > Makefile.am << 'END'
+dist_data_DATA = foo
+EXTRA_DIST = dir
+install-data-local:
+       $(MKDIR_P) '$(DESTDIR)$(datadir)'
+       cp '$(srcdir)/dir' '$(DESTDIR)$(datadir)/dir'
+END
+
+: > foo
+: > dir
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure --prefix="`pwd`/inst"
+
+# Sanity checks.
+$MAKE install
+find inst -type f
+test -f inst/share/foo
+test -f inst/share/dir
+# We expect the uninstall target of our Makefile to be definitely broken.
+$MAKE uninstall
+test -f inst/share/dir
+rm -rf inst
+
+$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
+cat output
+
+$FGREP 'ERROR: files left after uninstall:' output
+grep '/share/dir *$' output
+
+# A few trickier corner cases.
+
+cat > Makefile.am << 'END'
+EXTRA_DIST = dir
+install-data-local:
+install-data-local:
+       $(MKDIR_P) '$(DESTDIR)$(prefix)/mu/share/info'
+       cp '$(srcdir)/dir' '$(DESTDIR)$(prefix)/mu/share/info'
+       $(MKDIR_P) '$(DESTDIR)$(infodir)/more'
+       cp '$(srcdir)/dir' '$(DESTDIR)$(infodir)/more'
+END
+
+$AUTOMAKE
+./config.status Makefile
+
+# Sanity checks, again.
+$MAKE install
+find inst -type f
+test -f inst/mu/share/info/dir
+test -f inst/share/info/more/dir
+# We expect the uninstall target of our Makefile to be definitely broken.
+$MAKE uninstall
+test -f inst/mu/share/info/dir
+test -f inst/share/info/more/dir
+rm -rf inst
+
+$MAKE distcheck >output 2>&1 && { cat output; Exit 1; }
+cat output
+
+$FGREP 'ERROR: files left after uninstall:' output
+grep '/mu/share/info/dir *$' output
+grep '/share/info/more/dir *$' output
+
+:
diff --git a/tests/extra-portability.test b/tests/extra-portability.test
new file mode 100755
index 0000000..191dcb4
--- /dev/null
+++ b/tests/extra-portability.test
@@ -0,0 +1,69 @@
+#! /bin/sh
+# Copyright (C) 2011  Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check interactions between the `portability' and `extra-portability'
+# warning categories:
+#   1. `-Wextra-portability' must imply `-Wportability'.
+#   2. `-Wno-portability' must imply `-Wno-extra-portability'.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >>configure.in <<END
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+cat >Makefile.am <<END
+EXTRA_LIBRARIES = libfoo.a
+libfoo_a_SOURCES = sub/foo.c
+libfoo_a_CPPFLAGS = -Dwhatever
+END
+
+$ACLOCAL
+
+# Enabling extra-portability enables portability.
+AUTOMAKE_fails -Wnone -Wextra-portability
+# The expected diagnostic is
+#    Makefile.am:2: compiling `foo.c' with per-target flags requires 
`AM_PROG_CC_C_O' in `configure.in'
+#    .../lib/am/library.am: `libfoo.a': linking libraries using a non-POSIX
+#    .../lib/am/library.am: archiver requires `AM_PROG_AR' in `configure.in'
+#    Makefile.am:1:   while processing library `libfoo.a'
+grep 'requires.*AM_PROG_CC_C_O' stderr
+grep 'requires.*AM_PROG_AR' stderr
+
+# Disabling extra-portability leaves portability intact.
+AUTOMAKE_fails -Wno-extra-portability
+# The expected diagnostic is
+#    Makefile.am:2: compiling `foo.c' with per-target flags requires 
`AM_PROG_CC_C_O' in `configure.in'
+#    Makefile.am:1:   while processing library `libfoo.a'
+grep 'requires.*AM_PROG_CC_C_O' stderr
+grep 'requires.*AM_PROG_AR' stderr && Exit 1
+
+# Enabling portability does not enable extra-portability.
+AUTOMAKE_fails -Wnone -Wportability
+# The expected diagnostic is
+#    Makefile.am:2: compiling `foo.c' with per-target flags requires 
`AM_PROG_CC_C_O' in `configure.in'
+#    Makefile.am:1:   while processing library `libfoo.a'
+grep 'requires.*AM_PROG_CC_C_O' stderr
+grep 'requires.*AM_PROG_AR' stderr && Exit 1
+
+# Disabling portability disables extra-portability.
+$AUTOMAKE -Wno-portability
+
+:
diff --git a/tests/extra-portability2.test b/tests/extra-portability2.test
new file mode 100755
index 0000000..a44b144
--- /dev/null
+++ b/tests/extra-portability2.test
@@ -0,0 +1,53 @@
+#! /bin/sh
+# Copyright (C) 2011  Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Make sure that extra-portability warnings are not enabled by --gnits,
+# --gnu and --foreign.
+
+. ./defs || Exit 1
+
+set -e
+
+# Satisfy --gnits and --gnu.
+: > INSTALL
+: > NEWS
+: > README
+: > AUTHORS
+: > ChangeLog
+: > COPYING
+: > THANKS
+
+cat >>configure.in <<END
+AC_PROG_CC
+AC_PROG_RANLIB
+AC_OUTPUT
+END
+
+cat >Makefile.am <<END
+EXTRA_LIBRARIES = libfoo.a
+libfoo_a_SOURCES = foo.c
+END
+
+$ACLOCAL
+
+# Make sure the test is useful.
+AUTOMAKE_fails
+
+$AUTOMAKE --foreign
+$AUTOMAKE --gnu
+$AUTOMAKE --gnits
+
+:
diff --git a/tests/fort5.test b/tests/fort5.test
index d6151a7..cc93403 100755
--- a/tests/fort5.test
+++ b/tests/fort5.test
@@ -56,6 +56,7 @@ AC_PROG_FC
 AC_FC_SRCEXT([f90], [],
   [AC_MSG_FAILURE([$FC compiler cannot create executables], 77)])
 AC_FC_LIBRARY_LDFLAGS
+AM_PROG_AR
 LT_PREREQ([2.0])
 AC_PROG_LIBTOOL
 AC_OUTPUT
diff --git a/tests/instdir-java.test b/tests/instdir-java.test
index 9d9a03c..94a6a25 100755
--- a/tests/instdir-java.test
+++ b/tests/instdir-java.test
@@ -26,6 +26,7 @@ AC_OUTPUT
 END
 
 cat >Makefile.am <<'END'
+javadir = $(datarootdir)/java
 java_JAVA = foo.java
 END
 
diff --git a/tests/instdir-ltlib.test b/tests/instdir-ltlib.test
index 1fb4f37..f400377 100755
--- a/tests/instdir-ltlib.test
+++ b/tests/instdir-ltlib.test
@@ -25,6 +25,7 @@ set -e
 cat >>configure.in <<'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/instdir-prog.test b/tests/instdir-prog.test
index 6a73b75..66a4892 100755
--- a/tests/instdir-prog.test
+++ b/tests/instdir-prog.test
@@ -24,6 +24,7 @@ set -e
 cat >>configure.in <<'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_OUTPUT
 END
diff --git a/tests/instfail-libtool.test b/tests/instfail-libtool.test
index 1e756a6..2e5e312 100755
--- a/tests/instfail-libtool.test
+++ b/tests/instfail-libtool.test
@@ -25,6 +25,7 @@ required='libtool libtoolize'
 set -e
 
 cat >>configure.in <<END
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/instfail.test b/tests/instfail.test
index 38a1c9c..3fb60b5 100755
--- a/tests/instfail.test
+++ b/tests/instfail.test
@@ -25,6 +25,7 @@ set -e
 
 cat >>configure.in <<END
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AM_PATH_LISPDIR
 AC_OUTPUT
diff --git a/tests/insthook.test b/tests/insthook.test
index a315447..1b03324 100755
--- a/tests/insthook.test
+++ b/tests/insthook.test
@@ -37,6 +37,9 @@ installcheck-local:
        test -f "$(bindir)/foo"
        test -f "$(bindir)/foo-$(VERSION)"
        : > $(top_srcdir)/../ok
+
+uninstall-hook:
+       rm -f $(DESTDIR)$(bindir)/foo-$(VERSION)
 END
 
 echo 1 > foo
@@ -63,7 +66,6 @@ grep 1 bin/foo-1.0
 grep 2 bin/foo-2.0
 grep 2 bin/foo
 
-
 # install-hook is an error.
 cat >>Makefile.am <<EOF
 install-hook:
@@ -73,3 +75,5 @@ EOF
 AUTOMAKE_fails
 grep install-data-hook stderr
 grep install-exec-hook stderr
+
+:
diff --git a/tests/instspc.test b/tests/instspc.test
index 7d00788..c305461 100755
--- a/tests/instspc.test
+++ b/tests/instspc.test
@@ -33,6 +33,7 @@ set -e
 
 cat >> configure.in <<'EOF'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_OUTPUT
 EOF
diff --git a/tests/java-clean.test b/tests/java-clean.test
new file mode 100755
index 0000000..7db5e53
--- /dev/null
+++ b/tests/java-clean.test
@@ -0,0 +1,68 @@
+#! /bin/sh
+# Copyright (C) 1998, 2001, 2002, 2004, 2007  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 cleaning of Java class files and timestamps.
+
+required=javac
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+javadir = $(datadir)/java
+
+java_JAVA = Class.java
+dist_java_JAVA = ClassDist.java
+nodist_java_JAVA = ClassNodist.java
+
+nobase_java_JAVA = ClassNobase.java
+nobase_dist_java_JAVA = ClassNobaseDist.java
+nobase_nodist_java_JAVA = ClassNobaseNodist.java
+END
+
+for base in '' Nobase; do
+  for dist in '' Dist Nodist; do
+    echo "class Class$base$dist {}" > Class$base$dist.java
+  done
+done
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE
+ls -l
+test -f classjava.stamp
+for base in '' Nobase; do
+  for dist in '' Dist Nodist; do
+    test -f Class$base$dist.class
+  done
+done
+$MAKE clean
+find . -name '*.class' -o -name '*.stamp' | grep . && Exit 1
+# We should not remove unrelated stamp files.
+echo timestamp > classjava2.stamp
+echo timestamp > classdist_java.stamp
+$MAKE clean
+test -f classjava2.stamp
+test -f classdist_java.stamp
+
+:
diff --git a/tests/java-compile-install.test b/tests/java-compile-install.test
new file mode 100755
index 0000000..74b7a00
--- /dev/null
+++ b/tests/java-compile-install.test
@@ -0,0 +1,99 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test on compilation and installation of Java class files.
+
+required=javac
+. ./defs || Exit 1
+
+set -e
+
+cat >>configure.in <<'EOF'
+AC_OUTPUT
+EOF
+
+cat > Makefile.am << 'END'
+javadir = $(datadir)/java
+java_JAVA = Foo.java
+nobase_java_JAVA = Foo2.java
+nobase_dist_java_JAVA = Bar.java
+nodist_java_JAVA = Baz.java
+
+# Java files are not distributed by default, so we distribute
+# one "by hand" ...
+EXTRA_DIST = Foo.java
+# ... and make the other one generated.
+Foo2.java:
+       rm -f $@ address@hidden
+       echo 'class bClass {}' > address@hidden
+       chmod a-w address@hidden && mv -f address@hidden $@
+
+# Explicitly declared as `nodist_', so generate it.
+Baz.java:
+       rm -f $@ address@hidden
+       echo 'class Baz {}' > address@hidden
+       echo 'class Baz2 {}' >> address@hidden
+       chmod a-w address@hidden && mv -f address@hidden $@
+
+test:
+       ls -l $(srcdir) . ;: For debugging.
+       test   -f $(srcdir)/Foo.java
+       test   -f $(srcdir)/Bar.java
+       test   -f Foo2.java
+       test   -f Baz.java
+       test   -f aClass.class
+       test   -f bClass.class
+       test   -f Zardoz.class
+       test   -f Baz.class
+       test   -f Baz2.class
+       test ! -r Foo.class
+       test ! -r Bar.class
+       test   -f classjava.stamp
+
+test-install:
+       ls -l $(javadir) ;: For debugging.
+       test   -f '$(javadir)/bClass.class'
+       test   -f '$(javadir)/aClass.class'
+       test   -f '$(javadir)/Zardoz.class'
+       test   -f '$(javadir)/Baz.class'
+       test   -f '$(javadir)/Baz2.class'
+       test ! -r '$(javadir)/Foo.class'
+       test ! -r '$(javadir)/Bar.class'
+       if find $(prefix) | grep '\.stamp$$'; then exit 1; else :; fi
+
+check-local: test
+installcheck-local: test-install
+
+.PHONY: test test-install
+
+DISTCLEANFILES = Baz.java Foo2.java
+END
+
+echo 'class aClass {}' > Foo.java
+echo 'class Zardoz {}' > Bar.java
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure --prefix="`pwd`"/_inst
+$MAKE
+$MAKE test
+$MAKE install
+$MAKE test-install
+$MAKE distcheck
+
+:
diff --git a/tests/java-mix.test b/tests/java-mix.test
new file mode 100755
index 0000000..d6a43e7
--- /dev/null
+++ b/tests/java-mix.test
@@ -0,0 +1,69 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that the JAVA primary can be used freely in the same Makefile.am
+# with proper combinations of the `dist_', `nodist_' and `nobase_'
+# modifiers.  Also check that `.java' files are not ditributed by default.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+# This test does not require compilation of *.java files.
+JAVAC = false
+javadir = $(prefix)
+
+java_JAVA = Class.java
+dist_java_JAVA = ClassDist.java
+nodist_java_JAVA = ClassNodist.java
+
+nobase_java_JAVA = ClassNobase.java
+nobase_dist_java_JAVA = ClassNobaseDist.java
+nobase_nodist_java_JAVA = ClassNobaseNodist.java
+
+Class.java ClassNodist.java ClassNobase.java ClassNobaseNodist.java:
+       @echo '$@ should not be generated!' >&2; exit 1
+END
+
+: > ClassDist.java
+: > ClassNobaseDist.java
+
+$ACLOCAL
+$AUTOCONF
+# Automake used to display non-fatal warnings with this test, but
+# they were unexpected, so we want to consider them as failures in
+# this test.
+$AUTOMAKE 2>stderr || { cat stderr >&2; Exit 1; }
+cat stderr >&2
+test ! -s stderr
+
+./configure
+
+$MAKE distdir
+ls -l $distdir # For debugging.
+test ! -f $distdir/Class.java
+test -f $distdir/ClassDist.java
+test ! -f $distdir/ClassNobase.java
+test -f $distdir/ClassNobaseDist.java
+test ! -f $distdir/ClassNodist.java
+test ! -f $distdir/ClassNobaseNodist.java
+
+:
diff --git a/tests/java-no-duplicate.test b/tests/java-no-duplicate.test
new file mode 100755
index 0000000..ec42a3b
--- /dev/null
+++ b/tests/java-no-duplicate.test
@@ -0,0 +1,47 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test that some Java-related variables and rules are not repeatedly
+# defined.
+
+. ./defs || Exit 1
+
+set -e
+
+cat > Makefile.am << 'END'
+javadir = $(datadir)/java
+java_JAVA = a.java
+dist_java_JAVA = b.java
+nodist_java_JAVA = c.java
+nobase_java_JAVA = d.java
+nobase_dist_java_JAVA = e.java
+nobase_nodist_java_JAVA = f.java
+END
+
+$ACLOCAL
+$AUTOMAKE
+
+$EGREP -i '\.stamp|\.class|java|classpath' Makefile.in # For debugging.
+
+for var in JAVAC JAVAROOT CLASSPATH_ENV am__java_sources; do
+  grep "^$var =" Makefile.in
+  test `grep -c "^[$sp$tab]*$var[$sp$tab]*=" Makefile.in` = 1
+done
+
+grep '^classjava\.stamp:' Makefile.in
+test `grep -c "class.*java.*\.stamp.*:" Makefile.in` = 1
+
+:
diff --git a/tests/java-nobase.test b/tests/java-nobase.test
new file mode 100755
index 0000000..7b55290
--- /dev/null
+++ b/tests/java-nobase.test
@@ -0,0 +1,67 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test support of `nobase_' with the `JAVA' primary.
+
+required=javac
+. ./defs || Exit 1
+
+set -e
+
+cat >>configure.in <<'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+javadir = $(datadir)/java
+nobase_java_JAVA = sub/subsub/Foo.java
+nobase_dist_java_JAVA = sub/Bar.java
+nobase_nodist_java_JAVA = sub2/Baz.java
+
+# Java files are not distributed by default.
+EXTRA_DIST = sub/subsub/Foo.java
+
+sub2/Baz.java:
+       rm -f $@ address@hidden
+       test -d sub2 || mkdir sub2
+       echo 'class Baz {}' > address@hidden
+       chmod a-w address@hidden && mv -f address@hidden $@
+
+.PHONY: test-install
+test-install:
+       find $(prefix) ;: For debugging.
+       test   -f $(javadir)/sub/subsub/Foo.class
+       test   -f $(javadir)/sub/Bar.class
+       test   -f $(javadir)/sub2/Baz.class
+installcheck-local: test-install
+DISTCLEANFILES = sub2/Baz.java
+END
+
+mkdir sub sub/subsub
+echo 'class Foo {}' > sub/subsub/Foo.java
+echo 'class Bar {}' > sub/Bar.java
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure --prefix="`pwd`"/_inst
+$MAKE check
+$MAKE install
+$MAKE test-install
+$MAKE distcheck
+
+:
diff --git a/tests/java-sources.test b/tests/java-sources.test
new file mode 100755
index 0000000..770eb2d
--- /dev/null
+++ b/tests/java-sources.test
@@ -0,0 +1,67 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test definition of automake-generated private Makefile variable
+# `$(am__java_sources)'.
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+foodir = $(prefix)
+
+foo_JAVA = a.java
+dist_foo_JAVA = b.java
+nodist_foo_JAVA = c.java
+nobase_foo_JAVA = d.java
+nobase_dist_foo_JAVA = e.java
+nobase_nodist_foo_JAVA = f.java
+
+.PHONY: debug
+debug:
+       @echo 'am__java_sources: "$(am__java_sources)"'
+got:
+       @lst='$(am__java_sources)'; \
+         for f in $$lst; do echo $$f; done | sort > $@
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+cat > exp << 'END'
+a.java
+b.java
+c.java
+d.java
+e.java
+f.java
+END
+
+./configure
+$MAKE debug
+$MAKE got
+
+cat got
+cat exp
+diff exp got
+
+:
diff --git a/tests/java.test b/tests/java.test
index cae56dc..4aa91d0 100755
--- a/tests/java.test
+++ b/tests/java.test
@@ -1,5 +1,6 @@
 #! /bin/sh
-# Copyright (C) 1998, 2001, 2002, 2004, 2007  Free Software Foundation, Inc.
+# Copyright (C) 1998, 2001, 2002, 2004, 2007, 2011 Free Software
+# Foundation, Inc.
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -25,7 +26,6 @@ cat >>configure.in <<'EOF'
 AC_OUTPUT
 EOF
 
-
 cat > Makefile.am << 'END'
 javadir = $(datadir)/java
 dist_java_JAVA = a.java b.java
@@ -34,7 +34,10 @@ END
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE
-grep '^all[-a-z]*:.*classdist_java\.stamp' Makefile.in
+
+$EGREP '\.stamp|class' Makefile.in # For debugging.
+grep '^all[-a-z]*:.*classjava\.stamp' Makefile.in
+test `grep -c '^all[-a-z]*:.*classjava\.stamp' Makefile.in` -eq 1
 
 cat >a.java <<EOF
 class a
diff --git a/tests/javadir-undefined.test b/tests/javadir-undefined.test
new file mode 100755
index 0000000..9b6d1f3
--- /dev/null
+++ b/tests/javadir-undefined.test
@@ -0,0 +1,37 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Use of JAVA primary should not allow the use of the `java_' prefix
+# when $(javadir) is undefined.  Otherwise, we could silently end up
+# with a broken Makefile.in (where "make install" doesn't install
+# the *.class files).
+# See automake bug#8461.
+
+. ./defs || Exit 1
+
+set -e
+
+$ACLOCAL
+
+echo java_JAVA = a.java > Makefile.am
+AUTOMAKE_fails
+grep '^Makefile\.am:1:.*java_JAVA.*javadir.* undefined' stderr
+$EGREP '(uninitialized|line) ' stderr && Exit 1
+
+echo javadir = a-dummy-value >> Makefile.am
+$AUTOMAKE
+
+:
diff --git a/tests/ldflags.test b/tests/ldflags.test
index 39ca274..c00f227 100755
--- a/tests/ldflags.test
+++ b/tests/ldflags.test
@@ -21,6 +21,7 @@ required=libtool
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_SUBST([LTLIBOBJS], [q.o])
 AM_CONDITIONAL(USE_SWIG, :)
@@ -37,6 +38,7 @@ END
 
 : > ltconfig
 : > ltmain.sh
+: > ar-lib
 : > config.guess
 : > config.sub
 : > q.c
diff --git a/tests/libobj10.test b/tests/libobj10.test
index 0d24741..97dffec 100755
--- a/tests/libobj10.test
+++ b/tests/libobj10.test
@@ -23,6 +23,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_LIBOBJ([foo])
 AC_OUTPUT
@@ -33,6 +34,8 @@ noinst_LIBRARIES = libfoo.a
 libfoo_a_LIBADD = @LIBOBJS@
 END
 
+: > ar-lib
+
 $ACLOCAL
 AUTOMAKE_fails
 grep 'Makefile.am:2:.*foo\.c' stderr
diff --git a/tests/libobj11.test b/tests/libobj11.test
index 204ff8b..fc7f173 100755
--- a/tests/libobj11.test
+++ b/tests/libobj11.test
@@ -22,6 +22,7 @@ cat > configure.in << 'END'
 AC_INIT
 AM_INIT_AUTOMAKE(nonesuch, nonesuch)
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_LIBOBJ([mountlist])
 AC_OUTPUT(Makefile)
@@ -33,6 +34,7 @@ libtu_a_SOURCES =
 libtu_a_LIBADD = @LIBOBJS@
 END
 
+: > ar-lib
 : > mountlist.c
 
 $ACLOCAL || Exit 1
diff --git a/tests/libobj12.test b/tests/libobj12.test
index 5f1d029..e4522bc 100755
--- a/tests/libobj12.test
+++ b/tests/libobj12.test
@@ -23,6 +23,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_LIBOBJ([foo])
 AC_LIBOBJ([bar])
@@ -44,6 +45,7 @@ p1_LDADD = @LIBOBJS@
 p2_SOURCES = bar.c
 END
 
+: > ar-lib
 : > foo.c
 : > bar.c
 
diff --git a/tests/libobj13.test b/tests/libobj13.test
index 6ca68c9..fc3112b 100755
--- a/tests/libobj13.test
+++ b/tests/libobj13.test
@@ -24,6 +24,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_LIBOBJ([foo])
 AC_OUTPUT
diff --git a/tests/libobj2.test b/tests/libobj2.test
index 81b0e72..36c01b3 100755
--- a/tests/libobj2.test
+++ b/tests/libobj2.test
@@ -24,6 +24,7 @@ cat > configure.in << 'END'
 AC_INIT
 AM_INIT_AUTOMAKE(nonesuch, nonesuch)
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_LIBOBJ([fsusage])
 AC_OUTPUT(subdir/Makefile)
@@ -37,6 +38,7 @@ libtu_a_SOURCES =
 libtu_a_LIBADD = @LIBOBJS@
 END
 
+: > ar-lib
 : > subdir/fsusage.c
 
 $ACLOCAL || Exit 1
diff --git a/tests/libobj7.test b/tests/libobj7.test
index 73a8ab0..1ff36c4 100755
--- a/tests/libobj7.test
+++ b/tests/libobj7.test
@@ -22,6 +22,7 @@ cat > configure.in << 'END'
 AC_INIT
 AM_INIT_AUTOMAKE(nonesuch, nonesuch)
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_REPLACE_FUNCS(basename dirname strsignal)
 AC_OUTPUT(Makefile)
@@ -33,6 +34,7 @@ libtu_a_SOURCES =
 libtu_a_LIBADD = @LIBOBJS@
 END
 
+: > ar-lib
 : > basename.c
 : > dirname.c
 : > strsignal.c
diff --git a/tests/libobj8.test b/tests/libobj8.test
index 206bca6..e143753 100755
--- a/tests/libobj8.test
+++ b/tests/libobj8.test
@@ -24,6 +24,7 @@ AC_INIT
 AM_INIT_AUTOMAKE(nonesuch, nonesuch)
 AC_PROG_CC
 AC_PROG_CC_STDC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_REPLACE_FUNCS(basename dirname strsignal)
 AM_C_PROTOTYPES
@@ -43,6 +44,7 @@ END
 
 : > ansi2knr.1
 : > ansi2knr.c
+: > ar-lib
 
 $ACLOCAL || Exit 1
 $AUTOMAKE  -Wno-obsolete || Exit 1
diff --git a/tests/library.test b/tests/library.test
index 1e2b58b..8adc575 100755
--- a/tests/library.test
+++ b/tests/library.test
@@ -22,6 +22,7 @@ cat >> configure.in << 'END'
 AC_PROG_RANLIB
 AM_MAINTAINER_MODE
 AC_PROG_CC
+AM_PROG_AR
 END
 
 cat > Makefile.am << 'END'
@@ -30,5 +31,7 @@ lib_LIBRARIES = libfoo.a
 libfoo_a_DEPENDENCIES = libzot.a
 END
 
+: > ar-lib
+
 $ACLOCAL || Exit 1
 $AUTOMAKE
diff --git a/tests/libtoo10.test b/tests/libtoo10.test
index 51a68d4..44c0726 100755
--- a/tests/libtoo10.test
+++ b/tests/libtoo10.test
@@ -22,6 +22,7 @@ required=libtoolize
 set -e
 
 cat >> configure.in << 'END'
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/libtool2.test b/tests/libtool2.test
index a50f6a4..0120fa9 100755
--- a/tests/libtool2.test
+++ b/tests/libtool2.test
@@ -24,6 +24,7 @@ AC_INIT
 AM_INIT_AUTOMAKE(mypackage,0.1)
 
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 
 AC_CONFIG_FILES([
diff --git a/tests/libtool3.test b/tests/libtool3.test
index 3427f28..1643f31 100755
--- a/tests/libtool3.test
+++ b/tests/libtool3.test
@@ -24,6 +24,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AM_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/libtool5.test b/tests/libtool5.test
index c7f0476..8208388 100755
--- a/tests/libtool5.test
+++ b/tests/libtool5.test
@@ -27,6 +27,7 @@ cat >>configure.in <<'END'
 AM_CONDITIONAL([COND1], [true])
 AM_CONDITIONAL([COND2], [false])
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/libtool6.test b/tests/libtool6.test
index ad01b14..ea5fd9c 100755
--- a/tests/libtool6.test
+++ b/tests/libtool6.test
@@ -26,6 +26,7 @@ cat >>configure.in <<'END'
 AM_CONDITIONAL([COND1], [true])
 AM_CONDITIONAL([COND2], [false])
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/libtool7.test b/tests/libtool7.test
index a2f912f..8ebce0a 100755
--- a/tests/libtool7.test
+++ b/tests/libtool7.test
@@ -24,6 +24,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_LIBTOOL_DLOPEN
 AM_PROG_LIBTOOL
 AC_OUTPUT
diff --git a/tests/libtool8.test b/tests/libtool8.test
index a1bb88a..ed1b6cf 100755
--- a/tests/libtool8.test
+++ b/tests/libtool8.test
@@ -25,6 +25,7 @@ cat >>configure.in <<'END'
 AM_CONDITIONAL([COND1], [true])
 AM_CONDITIONAL([COND2], [false])
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/libtool9.test b/tests/libtool9.test
index c0d9688..a27a1da 100755
--- a/tests/libtool9.test
+++ b/tests/libtool9.test
@@ -26,6 +26,7 @@ set -e
 cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
+AM_PROG_AR
 AC_LIBTOOL_DLOPEN
 AM_PROG_LIBTOOL
 AC_OUTPUT
diff --git a/tests/listval.test b/tests/listval.test
index 5ff75db..d7cc884 100755
--- a/tests/listval.test
+++ b/tests/listval.test
@@ -21,6 +21,7 @@ required=libtool
 
 cat >> configure.in << 'END'
 AC_SUBST(LTLIBOBJS)
+AM_PROG_AR
 AC_PROG_LIBTOOL
 END
 
@@ -34,6 +35,7 @@ END
 
 : > ltconfig
 : > ltmain.sh
+: > ar-lib
 : > config.guess
 : > config.sub
 
diff --git a/tests/location.test b/tests/location.test
index 13a2183..6098796 100755
--- a/tests/location.test
+++ b/tests/location.test
@@ -24,6 +24,7 @@ cat >> configure.in << 'END'
 AM_CONDITIONAL([COND1], [true])
 AM_CONDITIONAL([COND2], [true])
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 END
 
@@ -44,6 +45,8 @@ VAR = 1 \
       3
 END
 
+: > ar-lib
+
 $ACLOCAL
 AUTOMAKE_fails
 
diff --git a/tests/ltcond.test b/tests/ltcond.test
index 0350a3d..401572b 100755
--- a/tests/ltcond.test
+++ b/tests/ltcond.test
@@ -27,6 +27,7 @@ AM_CONDITIONAL([WANT_LIBFOO], [true])
 AM_CONDITIONAL([WANT_LIBBAR], [false])
 AC_SUBST([WANTEDLIBS], ['lib1foo.la lib1bar.la'])
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/ltcond2.test b/tests/ltcond2.test
index 1687513..898c971 100755
--- a/tests/ltcond2.test
+++ b/tests/ltcond2.test
@@ -23,6 +23,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_SUBST([HELLO_SYSTEM], [hello-generic.lo])
 AM_CONDITIONAL([LINUX], true)
diff --git a/tests/ltconv.test b/tests/ltconv.test
index 0ec2132..a130b94 100755
--- a/tests/ltconv.test
+++ b/tests/ltconv.test
@@ -24,6 +24,7 @@ set -e
 
 cat >>configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_CONFIG_FILES(sub1/Makefile
                sub2/Makefile
diff --git a/tests/ltdeps.test b/tests/ltdeps.test
index 43d0ae3..7ece4d4 100755
--- a/tests/ltdeps.test
+++ b/tests/ltdeps.test
@@ -22,6 +22,7 @@ required=libtool
 set -e
 
 cat >> configure.in << 'END'
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_PROG_CXX
 AM_CONDITIONAL(HACKING_COMPACT_BUILD, whatever)
@@ -51,6 +52,7 @@ END
 
 : > ltconfig
 : > ltmain.sh
+: > ar-lib
 : > config.guess
 : > config.sub
 
diff --git a/tests/ltinit.test b/tests/ltinit.test
index b4eaad6..8b76bdf 100755
--- a/tests/ltinit.test
+++ b/tests/ltinit.test
@@ -25,6 +25,7 @@ set -e
 
 cat >>configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 dnl Older libtool versions don't define LT_PREREQ :-(
 m4_ifdef([LT_PREREQ],
     [LT_PREREQ([2.0])],
diff --git a/tests/ltinstloc.test b/tests/ltinstloc.test
index bb3203a..a4d715e 100755
--- a/tests/ltinstloc.test
+++ b/tests/ltinstloc.test
@@ -24,6 +24,7 @@ set -e
 
 cat >>configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AM_CONDITIONAL([COND], [:])
 AC_OUTPUT
@@ -46,7 +47,7 @@ AUTOMAKE_fails --add-missing
 # libtoolize might have installed config.guess and config.sub already,
 # and autom4te might warn about bugs in Libtool macro files, so filter
 # out warnings about Makefile.am only.  We don't care in this test
-# whether automake installs config.guess and config.sub.
+# whether automake installs config.guess, config.sub and ar-lib.
 
 cat >expected <<'END'
 Makefile.am:5: sub/liba2.la multiply defined in condition COND
diff --git a/tests/ltlibobjs.test b/tests/ltlibobjs.test
index fd66473..2df0017 100755
--- a/tests/ltlibobjs.test
+++ b/tests/ltlibobjs.test
@@ -21,6 +21,7 @@ required=libtool
 
 cat >> configure.in << 'END'
 AC_SUBST(LTLIBOBJS)
+AM_PROG_AR
 AC_PROG_LIBTOOL
 END
 
@@ -32,6 +33,7 @@ END
 
 : > ltconfig
 : > ltmain.sh
+: > ar-lib
 : > config.guess
 : > config.sub
 
diff --git a/tests/ltlibsrc.test b/tests/ltlibsrc.test
index 2c9911d..e8fa6f0 100755
--- a/tests/ltlibsrc.test
+++ b/tests/ltlibsrc.test
@@ -23,6 +23,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/ltorder.test b/tests/ltorder.test
index 0f69211..ef4a5f7 100755
--- a/tests/ltorder.test
+++ b/tests/ltorder.test
@@ -23,6 +23,7 @@ set -e
 
 cat >>configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/multlib.test b/tests/multlib.test
index 3f88be3..1072a57 100755
--- a/tests/multlib.test
+++ b/tests/multlib.test
@@ -66,6 +66,7 @@ AC_CONFIG_SRCDIR(foo.c)
 AC_CONFIG_AUX_DIR(.)
 AM_INIT_AUTOMAKE
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AM_ENABLE_MULTILIB(Makefile,[..])
 AC_CONFIG_FILES([Makefile])
@@ -89,6 +90,7 @@ AC_INIT(libbar, 0.1, address@hidden)
 AC_CONFIG_AUX_DIR(.)
 AM_INIT_AUTOMAKE
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AM_ENABLE_MULTILIB(Makefile,[..])
 AC_CONFIG_FILES([Makefile sub/Makefile])
diff --git a/tests/nobase-libtool.test b/tests/nobase-libtool.test
index 12b055e..2a0cf68 100755
--- a/tests/nobase-libtool.test
+++ b/tests/nobase-libtool.test
@@ -26,6 +26,7 @@ set -e
 
 cat >> configure.in <<'EOF'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 EOF
diff --git a/tests/nobase-nodist.test b/tests/nobase-nodist.test
new file mode 100755
index 0000000..90823e2
--- /dev/null
+++ b/tests/nobase-nodist.test
@@ -0,0 +1,62 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Interaction of `nobase_' and `nodist_' prefixes.
+
+. ./defs || Exit 1
+
+set -e
+
+# Simulate no emacs and no python (it shouldn't be needed in this test).
+EMACS="no" PYTHON=":"; export EMCAS PYTHON
+
+cat >> configure.in << 'END'
+AM_PATH_LISPDIR
+AM_PATH_PYTHON([], [], [:])
+# Simulate no javac (it shouldn't be needed in this test).
+AC_SUBST([JAVAC], [false])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+nobase_nodist_noinst_PYTHON = baz1.py sub/baz2.py
+# Lisp and Java sources are not distributed by default, so try both
+# with and without the `nodist_' prefix, for more coverage.
+nobase_noinst_LISP = foo1.el sub/foo2.el
+nobase_nodist_noinst_LISP = foo3.el sub/foo4.el
+nobase_noinst_JAVA = bar1.java sub/bar2.java
+nobase_nodist_noinst_JAVA = bar3.java sub/bar4.java
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+./configure
+$MAKE distdir
+
+ls -l $distdir $distdir/* # For debugging.
+test ! -f $distdir/foo1.el
+test ! -f $distdir/sub/foo2.el
+test ! -f $distdir/foo3.el
+test ! -f $distdir/sub/foo4.el
+test ! -f $distdir/bar1.java
+test ! -f $distdir/sub/bar2.java
+test ! -f $distdir/bar3.java
+test ! -f $distdir/sub/bar4.java
+test ! -f $distdir/baz1.py
+test ! -f $distdir/sub/baz2.py
+
+:
diff --git a/tests/nobase.test b/tests/nobase.test
index 8b0dc6e..cac8756 100755
--- a/tests/nobase.test
+++ b/tests/nobase.test
@@ -24,6 +24,7 @@ set -e
 
 cat >> configure.in <<'EOF'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_OUTPUT
 EOF
diff --git a/tests/noinstdir.test b/tests/noinstdir.test
index 3f33c32..b04bb0d 100755
--- a/tests/noinstdir.test
+++ b/tests/noinstdir.test
@@ -34,9 +34,12 @@ END
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 END
 
+: > ar-lib
+
 $ACLOCAL || Exit 1
 $AUTOMAKE || Exit 1
 
diff --git a/tests/parallel-tests3.test b/tests/parallel-tests3.test
index a138f90..69ba1d0 100755
--- a/tests/parallel-tests3.test
+++ b/tests/parallel-tests3.test
@@ -70,15 +70,22 @@ $sleep
 : >stdout
 $MAKE -j4 check >> stdout
 cd ..
-kill $!
+# Ensure the tests are really being run in parallel mode: if this is
+# the case, the serial run of the dummy testsuite started above should
+# still be ongoing when the parallel one has terminated.
+kill -0 $!
 cat parallel/stdout
 test `grep -c PASS parallel/stdout` -eq 8
 
-# Wait long enough so that there are no open files any more
-# when the post-test cleanup runs.
-while test ! -f serial/test-suite.log
-do
-  $sleep
+# Wait long enough so that there are no open files any more when the
+# post-test cleanup runs.  But exit after we've waited for two minutes
+# or more, to avoid testsuite hangs in unusual situations (this has
+# already happened).
+i=1
+while test ! -f serial/test-suite.log && test $i -le 120; do
+  i=`expr $i + 1`
+  sleep '1' # Extra quoting to please maintainer-check.
 done
 $sleep
+
 :
diff --git a/tests/pr300-lib.test b/tests/pr300-lib.test
index ee46b4b..e10be24 100755
--- a/tests/pr300-lib.test
+++ b/tests/pr300-lib.test
@@ -45,7 +45,7 @@ END
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --copy --add-missing
+$AUTOMAKE -Wno-extra-portability --copy --add-missing
 
 ./configure --prefix "`pwd`/inst"
 
diff --git a/tests/pr300-ltlib.test b/tests/pr300-ltlib.test
index c47f32e..5e8c052 100755
--- a/tests/pr300-ltlib.test
+++ b/tests/pr300-ltlib.test
@@ -47,7 +47,7 @@ END
 libtoolize
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --copy --add-missing
+$AUTOMAKE -Wno-extra-portability --copy --add-missing
 
 ./configure --prefix "`pwd`/inst"
 
diff --git a/tests/pr307.test b/tests/pr307.test
index 7676c4b..3496817 100755
--- a/tests/pr307.test
+++ b/tests/pr307.test
@@ -68,7 +68,7 @@ done
 libtoolize --force
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE -a
+$AUTOMAKE -Wno-extra-portability -a
 
 # Sanity check: make sure the variable we are attempting to force
 # is used by configure
diff --git a/tests/pr401.test b/tests/pr401.test
index 88f7733..6009315 100755
--- a/tests/pr401.test
+++ b/tests/pr401.test
@@ -81,7 +81,7 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-extra-portability
 ./configure
 $MAKE distcheck
 
@@ -97,7 +97,7 @@ mv -f configure.int configure.in
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-extra-portability
 ./configure
 test ! -d lib/lib
 $MAKE distcheck
@@ -108,7 +108,7 @@ $MAKE distcheck
 
 mv -f src/Makefile.am src/t
 sed 's/LDADD = .*/LDADD = @LIBOBJS@/' src/t > src/Makefile.am
-AUTOMAKE_fails
+AUTOMAKE_fails -Wno-extra-portability
 grep 'cannot be used outside.*lib' stderr
 mv -f src/t src/Makefile.am
 
@@ -139,7 +139,7 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --add-missing
+$AUTOMAKE -Wno-extra-portability --add-missing
 ./configure
 test ! -d src/lib
 test ! -d 'src/$(top_builddir)'
@@ -176,7 +176,7 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-extra-portability
 ./configure
 $MAKE distcheck
 
diff --git a/tests/pr401b.test b/tests/pr401b.test
index 0af4646..4bd2f36 100755
--- a/tests/pr401b.test
+++ b/tests/pr401b.test
@@ -82,7 +82,7 @@ EOF
 libtoolize
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE -a
+$AUTOMAKE -Wno-extra-portability -a
 ./configure
 $MAKE distcheck
 
@@ -99,7 +99,7 @@ mv -f configure.int configure.in
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE -a
+$AUTOMAKE -Wno-extra-portability -a
 ./configure
 test ! -d lib/lib
 $MAKE distcheck
@@ -110,7 +110,7 @@ $MAKE distcheck
 
 mv -f src/Makefile.am src/t
 sed 's/LDADD = .*/LDADD = @LTLIBOBJS@/' src/t > src/Makefile.am
-AUTOMAKE_fails
+AUTOMAKE_fails -Wno-extra-portability
 grep 'cannot be used outside.*lib' stderr
 mv -f src/t src/Makefile.am
 
@@ -140,7 +140,7 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --add-missing
+$AUTOMAKE -Wno-extra-portability --add-missing
 ./configure
 test ! -d src/lib
 test ! -d 'src/$(top_builddir)'
@@ -177,7 +177,7 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-extra-portability
 ./configure
 $MAKE distcheck
 
diff --git a/tests/pr401c.test b/tests/pr401c.test
index b94bc16..1d0511f 100755
--- a/tests/pr401c.test
+++ b/tests/pr401c.test
@@ -83,7 +83,7 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-extra-portability
 ./configure
 $MAKE distcheck
 
@@ -100,7 +100,7 @@ mv -f configure.int configure.in
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-extra-portability
 ./configure
 test ! -d lib/lib
 $MAKE distcheck
@@ -111,7 +111,7 @@ $MAKE distcheck
 
 mv -f src/Makefile.am src/t
 sed 's/LDADD = .*/LDADD = @ALLOCA@/' src/t > src/Makefile.am
-AUTOMAKE_fails
+AUTOMAKE_fails -Wno-extra-portability
 grep 'cannot be used outside.*lib' stderr
 mv -f src/t src/Makefile.am
 
@@ -142,7 +142,7 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --add-missing
+$AUTOMAKE -Wno-extra-portability --add-missing
 ./configure
 $MAKE
 test ! -d src/lib
@@ -179,7 +179,7 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -Wno-extra-portability
 ./configure
 $MAKE distcheck
 
diff --git a/tests/pr72.test b/tests/pr72.test
index ab911ad..5af32ec 100755
--- a/tests/pr72.test
+++ b/tests/pr72.test
@@ -39,7 +39,7 @@ END
 : > config.sub
 
 $ACLOCAL
-$AUTOMAKE
+$AUTOMAKE -Wno-extra-portability
 
 grep '^LINK =' Makefile.in
 
diff --git a/tests/primary-prefix-couples-documented-valid.test 
b/tests/primary-prefix-couples-documented-valid.test
index 645f318..c09e6ca 100755
--- a/tests/primary-prefix-couples-documented-valid.test
+++ b/tests/primary-prefix-couples-documented-valid.test
@@ -24,6 +24,7 @@ set -e
 
 cat >> configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_PROG_LIBTOOL
 AM_PROG_GCJ
diff --git a/tests/primary-prefix-couples-force-valid.test 
b/tests/primary-prefix-couples-force-valid.test
index 315ee4e..d60ecbf 100755
--- a/tests/primary-prefix-couples-force-valid.test
+++ b/tests/primary-prefix-couples-force-valid.test
@@ -30,6 +30,7 @@ set -e
 
 cat >> configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_OUTPUT
 END
@@ -75,7 +76,7 @@ END
 : > bar.h
 
 $ACLOCAL
-$AUTOMAKE
+$AUTOMAKE -a
 $AUTOCONF
 
 cwd=`pwd` || fatal_ "cannot get current working directory"
diff --git a/tests/primary-prefix-invalid-couples.test 
b/tests/primary-prefix-invalid-couples.test
index 88e0817..16e9f43 100755
--- a/tests/primary-prefix-invalid-couples.test
+++ b/tests/primary-prefix-invalid-couples.test
@@ -26,6 +26,7 @@ set -e
 
 oIFS=$IFS # Saved for later.
 
+: > ar-lib
 : > ltmain.sh
 : > texinfo.tex
 : > elisp-comp
@@ -35,6 +36,7 @@ oIFS=$IFS # Saved for later.
 
 cat >> configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_SUBST([LIBTOOL], [:]) dnl So that we don't have to require Libtool.
 AM_PROG_GCJ
diff --git a/tests/primary-prefix-valid-couples.test 
b/tests/primary-prefix-valid-couples.test
index f326808..13520f2 100755
--- a/tests/primary-prefix-valid-couples.test
+++ b/tests/primary-prefix-valid-couples.test
@@ -23,9 +23,9 @@ set -e
 
 cat >> configure.in <<'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_PROG_LIBTOOL
-AM_PROG_GCJ
 AM_PATH_PYTHON
 AM_PATH_LISPDIR
 END
@@ -44,6 +44,7 @@ echo '@setfilename foo' > foo.texi
 : > texinfo.tex
 : > py-compile
 : > elisp-comp
+: > ar-lib
 
 # Setup Makefile.am.
 
@@ -78,7 +79,6 @@ done
 echo "info_TEXINFOS = foo.texi" >> Makefile.am
 echo "lisp_LISP = foo.el" >> Makefile.am
 echo "python_PYTHON = foo.py" >> Makefile.am
-echo "java_JAVA = foo.java" >> Makefile.am
 
 awk '{print NR ":" $0}' Makefile.am # For debugging.
 
diff --git a/tests/py-compile-basedir.test b/tests/py-compile-basedir.test
new file mode 100755
index 0000000..a277639
--- /dev/null
+++ b/tests/py-compile-basedir.test
@@ -0,0 +1,51 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test the `--basedir' option of the `py-compile' script,
+
+required=python
+. ./defs || Exit 1
+
+set -e
+
+# We'll need to create files in `..', so we need one more subdirectory
+# level in order not to clutter up the top-level tests directory.
+mkdir sandbox
+cd sandbox
+
+cp "$testsrcdir/../lib/py-compile" .
+
+f=__init__
+for d in foo foo/bar "`pwd`/foo" . .. ../foo ''; do
+  if test -z "$d"; then
+    d2=.
+  else
+    d2=$d
+  fi
+  ../install-sh -d "$d2" "$d2/sub" || Exit 99
+  : > "$d2/$f.py"
+  : > "$d2/sub/$f.py"
+  ./py-compile --basedir "$d" "$f.py" "sub/$f.py"
+  ls -l "$d2" "$d2/sub" # For debugging.
+  test -f "$d2/$f.pyc"
+  test -f "$d2/$f.pyo"
+  test -f "$d2/sub/$f.pyc"
+  test -f "$d2/sub/$f.pyo"
+  rm -f "$d2/$f.pyc" "$d2/$f.pyo" "$d2/sub/$f.pyc" "$d2/sub/$f.pyo"
+  find . | grep '\.py[co]$' && Exit 1
+done
+
+:
diff --git a/tests/py-compile-basic.test b/tests/py-compile-basic.test
new file mode 100755
index 0000000..a7a3f89
--- /dev/null
+++ b/tests/py-compile-basic.test
@@ -0,0 +1,64 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test more basic functionalities of the `py-compile' script,
+# with "believable" python sources.  See also related test
+# `py-compile-basic2.test'.
+
+required=python
+. ./defs || Exit 1
+
+set -e
+
+cp "$testsrcdir/../lib/py-compile" .
+
+cat > foo.py <<'END'
+# Try out some non-trivial syntax in here.
+
+'''Module docstring'''
+
+def foo (*args, **kwargs):
+  """Function docstring
+  with embedded newline"""
+  return 1
+
+class Foo:
+  r"""Class docstring"""
+  def __init__(self):
+    r'''Method docstring
+        with
+        embedded
+        newlines'''
+    pass
+
+bar = baz = (1, (2,), [3, 4]); zardoz = 0;
+END
+
+cat > bar.py <<'END'
+# Import of non-existent modules, or assertion of false conditions,
+# shouldn't cause problems, as it should be enough for the code to
+# be syntactically correct.
+import Automake.No.Such.Module
+assert False
+END
+
+./py-compile foo.py bar.py
+test -f foo.pyc
+test -f foo.pyo
+test -f bar.pyc
+test -f bar.pyo
+
+:
diff --git a/tests/py-compile-basic2.test b/tests/py-compile-basic2.test
new file mode 100755
index 0000000..0da0d42
--- /dev/null
+++ b/tests/py-compile-basic2.test
@@ -0,0 +1,71 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test more basic functionalities of the `py-compile' script, with
+# dummy python sources, but more complex directory layouts.  See also
+# related test `py-compile-basic.test'.
+
+required=python
+. ./defs || Exit 1
+
+set -e
+
+ocwd=`pwd` || Exit 99
+
+pyfiles="
+  foo.py
+  ./foo1.py
+  ../foo2.py
+  ../dir/foo3.py
+  $ocwd/foo4.py
+  sub/bar.py
+  sub/subsub/barbar.py
+  __init__.py
+  sub/__init__.py
+  1.py
+  .././_.py
+"
+
+lst='
+  dir/foo
+  dir/foo1
+  foo2
+  dir/foo3
+  foo4
+  dir/sub/bar
+  dir/sub/subsub/barbar
+  dir/__init__
+  dir/sub/__init__
+  dir/1
+  _
+'
+
+mkdir dir
+cd dir
+cp "$testsrcdir/../lib/py-compile" .
+mkdir sub sub/subsub
+touch $pyfiles
+./py-compile $pyfiles
+cd "$ocwd"
+
+for x in $lst; do echo $x.pyc; echo $x.pyo; done | sort > exp
+find . -name '*.py[co]' | sed 's|^\./||' | sort > got
+
+cat exp
+cat got
+diff exp got
+
+:
diff --git a/tests/py-compile-destdir.test b/tests/py-compile-destdir.test
new file mode 100755
index 0000000..3d122e6
--- /dev/null
+++ b/tests/py-compile-destdir.test
@@ -0,0 +1,44 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test the `--destdir' option of the `py-compile' script,
+
+required=python
+. ./defs || Exit 1
+
+set -e
+
+cp "$testsrcdir/../lib/py-compile" .
+
+# Should not give false positives when grepping for it, so use
+# an "uncommon" string (with ugly CamelCase).
+destdir=TheDestDir
+
+mkdir sub $destdir $destdir/sub
+echo 'def foo (): return "foo"' > $destdir/foo.py
+echo 'def bar (): return "bar"' > $destdir/sub/bar.py
+
+./py-compile --destdir $destdir foo.py sub/bar.py
+ls -l $destdir $destdir/sub # For debugging.
+ls . sub | grep '\.py[co]$' && Exit 1
+test -f $destdir/foo.pyc
+test -f $destdir/foo.pyo
+test -f $destdir/sub/bar.pyc
+test -f $destdir/sub/bar.pyo
+strings $destdir/*.py[co] $destdir/sub/*.py[co] || : # For debugging.
+$FGREP $destdir $destdir/*.py[co] $destdir/sub/*.py[co] && Exit 1
+
+:
diff --git a/tests/py-compile-env.test b/tests/py-compile-env.test
new file mode 100755
index 0000000..a72d173
--- /dev/null
+++ b/tests/py-compile-env.test
@@ -0,0 +1,60 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Make sure `py-compile' honours the PYTHON environment variable.
+
+. ./defs || Exit 1
+
+set -e
+
+cp "$testsrcdir/../lib/py-compile" .
+
+cat > my-py <<'END'
+#!/bin/sh
+: > my-py.run
+END
+chmod a+x my-py
+
+mkdir sub1
+cd sub1
+
+PYTHON=: ../py-compile foo.py
+ls | grep . && Exit 1
+
+PYTHON=false ../py-compile foo.py && Exit 1
+ls | grep . && Exit 1
+
+PYTHON='echo GrEpMe AndMeToo' ../py-compile foo.py
+PYTHON='echo GrEpMe AndMeToo' ../py-compile foo.py | grep 'GrEpMe AndMeToo'
+ls | grep . && Exit 1
+
+cd ..
+mkdir sub2
+cd sub2
+
+PYTHON=../my-py ../py-compile foo.py
+test -f my-py.run
+ls | grep -v '^my-py\.run$' | grep . && Exit 1
+
+cd ..
+mkdir sub3
+cd sub3
+PATH=..$PATH_SEPARATOR$PATH; export PATH
+PYTHON=my-py py-compile foo.py
+test -f my-py.run
+ls | grep -v '^my-py\.run$' | grep . && Exit 1
+
+:
diff --git a/tests/py-compile-option-terminate.test 
b/tests/py-compile-option-terminate.test
new file mode 100755
index 0000000..69f9bb5
--- /dev/null
+++ b/tests/py-compile-option-terminate.test
@@ -0,0 +1,44 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that a non-option argument and the `--' special argument
+# explicitly terminate the option list for `py-compile'.
+
+required=python
+. ./defs || Exit 1
+
+set -e
+
+cp "$testsrcdir/../lib/py-compile" .
+
+: > ./-o.py
+: > ./--foo.py
+./py-compile -- -o.py --foo.py
+test -f ./-o.pyc
+test -f ./-o.pyo
+test -f ./--foo.pyc
+test -f ./--foo.pyo
+rm -f ./-*.py[co]
+: > x.py
+./py-compile x.py -o.py --foo.py
+test -f ./x.pyc
+test -f ./x.pyo
+test -f ./-o.pyc
+test -f ./-o.pyo
+test -f ./--foo.pyc
+test -f ./--foo.pyo
+
+:
diff --git a/tests/py-compile-usage.test b/tests/py-compile-usage.test
new file mode 100755
index 0000000..7e8c786
--- /dev/null
+++ b/tests/py-compile-usage.test
@@ -0,0 +1,75 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test `py-compile --help', `py-compile --version', and that `py-compile'
+# correctly complains on wrong usage.
+
+. ./defs || Exit 1
+
+set -e
+
+cp "$testsrcdir/../lib/py-compile" .
+
+# --help
+
+./py-compile --help >stdout 2>stderr \
+  || { cat stdout; cat stderr >&2; Exit 1; }
+cat stdout
+test -s stderr && { cat stderr >&2; Exit 1; }
+grep '^Usage: py-compile .' stdout
+$FGREP ' [--basedir DIR]' stdout
+$FGREP ' [--destdir DIR]' stdout
+
+# --version
+
+./py-compile --version >stdout 2>stderr \
+  || { cat stdout; cat stderr >&2; Exit 1; }
+cat stdout
+test -s stderr && { cat stderr >&2; Exit 1; }
+year='20[0-9][0-9]' # Hopefully automake will be obsolete in 80 years ;-)
+month='(0[0-9]|1[012])'
+day='([012][0-9]|3[01])'
+hour='([01][0-9]|2[0123])'
+LC_ALL=C $EGREP "^py-compile $year-$month-$day\.$hour" stdout
+test `wc -l <stdout` -eq 1
+
+# Unknown option.
+for opt in -b -d --foo; do
+  ./py-compile $opt 2>stderr && { cat stderr >&2; Exit 1; }
+  cat stderr >&2
+  grep "^py-compile: unrecognized option ['\`]$opt'" stderr
+  grep "^Try [\`']py-compile --help' for more information" stderr
+done
+
+# Missing option argument.
+
+for opt in --basedir --destdir; do
+  ./py-compile $opt 2>stderr && { cat stderr >&2; Exit 1; }
+  cat stderr >&2
+  grep "^py-compile: option ['\`]$opt' requires an argument" stderr
+  grep "^Try [\`']py-compile --help' for more information" stderr
+done
+
+# Missing files.
+
+for args in '' '--basedir dir' '--destdir dir'; do
+  ./py-compile $args 2>stderr && { cat stderr >&2; Exit 1; }
+  cat stderr >&2
+  grep '^py-compile: no files given' stderr
+  grep "^Try [\`']py-compile --help' for more information" stderr
+done
+
+:
diff --git a/tests/silent3.test b/tests/silent3.test
index 17f1959..4d66a0a 100755
--- a/tests/silent3.test
+++ b/tests/silent3.test
@@ -29,6 +29,7 @@ cat >>configure.in <<'EOF'
 AM_SILENT_RULES
 AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
+AM_PROG_AR
 AM_PROG_CC_C_O
 AC_PROG_LIBTOOL
 AC_OUTPUT
diff --git a/tests/silent4.test b/tests/silent4.test
index 9c343c0..4ef4653 100755
--- a/tests/silent4.test
+++ b/tests/silent4.test
@@ -30,6 +30,7 @@ cat >>configure.in <<'EOF'
 AM_SILENT_RULES
 AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
+AM_PROG_AR
 AM_PROG_CC_C_O
 AC_PROG_LIBTOOL
 AC_OUTPUT
diff --git a/tests/silent9.test b/tests/silent9.test
index f0abb29..76d97fc 100755
--- a/tests/silent9.test
+++ b/tests/silent9.test
@@ -30,6 +30,7 @@ AM_SILENT_RULES
 AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
 AM_PROG_CC_C_O
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 EOF
diff --git a/tests/specflg-dummy.test b/tests/specflg-dummy.test
index 614d6c2..d0c8ba6 100755
--- a/tests/specflg-dummy.test
+++ b/tests/specflg-dummy.test
@@ -61,6 +61,7 @@ AC_PROG_LEX
 AC_PROG_F77
 AC_PROG_FC
 AM_PROG_GCJ
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_PROG_LIBTOOL
 AM_PROG_UPC
diff --git a/tests/specflg2.test b/tests/specflg2.test
index 0dc7fcc..f67fd7b 100755
--- a/tests/specflg2.test
+++ b/tests/specflg2.test
@@ -24,6 +24,7 @@ cat >> configure.in << 'END'
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_CXX
+AM_PROG_AR
 AC_PROG_RANLIB
 END
 
@@ -35,6 +36,8 @@ libfoo_a_CFLAGS = -DBAR
 libfoo_a_CXXFLAGS = -DZOT
 END
 
+: > ar-lib
+
 # Make sure `compile' is required.
 $ACLOCAL
 AUTOMAKE_fails
diff --git a/tests/stdlib2.test b/tests/stdlib2.test
index c5d543c..5da42ad 100755
--- a/tests/stdlib2.test
+++ b/tests/stdlib2.test
@@ -32,6 +32,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/strip2.test b/tests/strip2.test
index 5786ded..bab0a38 100755
--- a/tests/strip2.test
+++ b/tests/strip2.test
@@ -24,6 +24,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 AC_OUTPUT
 END
diff --git a/tests/strip3.test b/tests/strip3.test
index b159673..34b0254 100755
--- a/tests/strip3.test
+++ b/tests/strip3.test
@@ -24,6 +24,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/subdir4.test b/tests/subdir4.test
index 7ea10f8..9d4efec 100755
--- a/tests/subdir4.test
+++ b/tests/subdir4.test
@@ -26,6 +26,7 @@ mkdir lib src
 cat >> configure.in << 'END'
 AC_PROG_RANLIB
 AC_PROG_CC
+AM_PROG_AR
 AC_CONFIG_FILES([lib/Makefile src/Makefile])
 AC_OUTPUT
 END
@@ -56,6 +57,8 @@ cat > src/Makefile.am << 'END'
 pkgdata_DATA =
 END
 
+: > ar-lib
+
 $ACLOCAL
 $AUTOMAKE --gnu
 
diff --git a/tests/subdirbuiltsources.test b/tests/subdirbuiltsources.test
index a84f28e..a6a0035 100755
--- a/tests/subdirbuiltsources.test
+++ b/tests/subdirbuiltsources.test
@@ -28,6 +28,7 @@ cat >> configure.in << 'END'
 AC_CONFIG_FILES([lib/Makefile])
 AC_PROG_RANLIB
 AC_PROG_CC
+AM_PROG_AR
 AC_OUTPUT
 END
 
diff --git a/tests/subobj10.test b/tests/subobj10.test
index dbddf29..e446fba 100755
--- a/tests/subobj10.test
+++ b/tests/subobj10.test
@@ -26,6 +26,7 @@ AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE([subdir-objects])
 
 AM_PROG_AS
+AM_PROG_AR
 AC_PROG_RANLIB
 
 AC_CONFIG_FILES([Makefile])
diff --git a/tests/subobj9.test b/tests/subobj9.test
index 83f3a31..39ba33e 100755
--- a/tests/subobj9.test
+++ b/tests/subobj9.test
@@ -25,6 +25,7 @@ cat > configure.in << END
 AC_INIT([$me], [1.0])
 AM_INIT_AUTOMAKE([subdir-objects])
 AC_PROG_CXX
+AM_PROG_AR
 AM_PROG_LIBTOOL
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
diff --git a/tests/subpkg-yacc.test b/tests/subpkg-yacc.test
new file mode 100755
index 0000000..011d5c2
--- /dev/null
+++ b/tests/subpkg-yacc.test
@@ -0,0 +1,151 @@
+#! /bin/sh
+# Copyright (C) 2002, 2003, 2004, 2006, 2011 Free Software Foundation,
+# Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that ylwrap is installed properly, and $(YLWRAP) us defined
+# properly, when a subpackage is involved.
+
+required='cc yacc'
+. ./defs || Exit 1
+
+set -e
+
+cat >>configure.in <<'END'
+AC_PROG_CC
+AC_CONFIG_SUBDIRS([lib])
+AC_OUTPUT
+END
+
+cat >Makefile.am <<'EOF'
+SUBDIRS = lib
+bin_PROGRAMS = MU
+MU_LDADD = lib/liblib.a
+# It's ok to override distdir.
+distdir = subpack-1
+# Remove a file created by rules in subdir lib.
+CLEANFILES = lib-dist-hook-has-run
+EOF
+
+cat >MU.c <<'EOF'
+int lib (void);
+int main (void)
+{
+  return lib ();
+}
+EOF
+
+mkdir lib
+mkdir lib/src
+
+cat >lib/configure.ac <<'EOF'
+AC_INIT([lib], [2.3])
+AM_INIT_AUTOMAKE
+AC_PROG_RANLIB
+AC_PROG_YACC
+dnl This comes after YACC and RANLIB checks, deliberately.
+AC_PROG_CC
+AM_PROG_AR
+AC_CONFIG_HEADERS([config.h:config.hin])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+EOF
+
+cat >lib/Makefile.am <<'EOF'
+noinst_LIBRARIES = liblib.a
+liblib_a_SOURCES = src/x.c foo.y
+EXTRA_liblib_a_SOURCES = bar.y
+
+dist-hook:
+       test -d $(top_distdir)
+       test -d $(distdir)
+       find $(top_distdir) $(distdir) ;: For debugging.
+       test -f $(top_distdir)/MU.c
+       test ! -f $(distdir)/MU.c
+       for suf in y c; do \
+         for name in foo bar; do \
+           test -f $(distdir)/$$name.$$suf || exit 1; \
+           test ! -f $(top_distdir)/$$name.$$suf || exit 1; \
+         done; \
+       done
+       test -f $(distdir)/foo.y
+       test ! -f $(top_distdir)/foo.y
+       test -f $(distdir)/src/x.c
+       test ! -f $(top_distdir)/src/x.c
+       test -f $(YLWRAP)
+       : > $(top_builddir)/../lib-dist-hook-has-run
+EOF
+
+cat > lib/foo.y << 'END'
+%{
+int yylex (void) { return 0; }
+void yyerror (char *s) {}
+%}
+%%
+foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
+END
+
+cp lib/foo.y lib/bar.y
+
+cat >lib/src/x.c <<'EOF'
+#include <config.h>
+int lib (void)
+{
+  return 0;
+}
+EOF
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -Wno-override
+
+cd lib
+$ACLOCAL
+$AUTOCONF
+$AUTOHEADER
+$AUTOMAKE -Wno-override --add-missing
+cd ..
+
+# Some checks here are slightly more tricky than we'd like, but we cannot
+# simply use "make distcheck", to avoid triggering a spurious failure due
+# to issues with FreeBSD make and VPATH builds (see automake bug#7884).
+
+./configure
+$MAKE
+$MAKE dist
+test -f lib-dist-hook-has-run
+test -f subpack-1.tar.gz
+test ! -d subpack-1 # Make sure "dist" cleans up after itself.
+
+mkdir workdir
+cd workdir
+gzip -c -d ../subpack-1.tar.gz | tar xf -
+test -d subpack-1
+mkdir build
+cd build
+../subpack-1/configure
+$MAKE
+$MAKE dist
+test -f lib-dist-hook-has-run
+test -f subpack-1.tar.gz
+test ! -d subpack-1 # Make sure "dist" cleans up after itself.
+
+# Don't trust non-GNU makes to do distcheck with a Yacc-using
+# package (see bug referenced above).
+if using_gmake; then
+  $MAKE distcheck || Exit 1
+fi
+
+:
diff --git a/tests/subpkg.test b/tests/subpkg.test
index 3662937..cfa5acb 100755
--- a/tests/subpkg.test
+++ b/tests/subpkg.test
@@ -53,10 +53,8 @@ ACLOCAL_AMFLAGS = -I m4
 EOF
 
 cat >LDADD.c <<'EOF'
-int lib ();
-
-int
-main ()
+int lib (void);
+int main (void)
 {
   return lib ();
 }
@@ -68,8 +66,8 @@ mkdir lib/src
 cat >lib/configure.ac <<'EOF'
 AC_INIT([lib], [2.3])
 AM_INIT_AUTOMAKE
+AM_PROG_AR
 AC_PROG_RANLIB
-AC_PROG_YACC
 AC_CONFIG_HEADERS([config.h:config.hin])
 AC_CONFIG_FILES([Makefile])
 FOO
@@ -77,33 +75,20 @@ EOF
 
 cat >lib/Makefile.am <<'EOF'
 noinst_LIBRARIES = liblib.a
-liblib_a_SOURCES = src/x.c foo.y
-EXTRA_liblib_a_SOURCES = bar.y
+liblib_a_SOURCES = src/x.c
 
 dist-hook:
        test ! -f $(distdir)/LDADD.c
        test -f $(top_distdir)/LDADD.c
        test -f $(distdir)/src/x.c
        test ! -f $(top_distdir)/src/x.c
-       test -f $(YLWRAP)
 
 ACLOCAL_AMFLAGS = -I ../m4
 EOF
 
-cat > lib/foo.y << 'END'
-%{
-int yylex () {return 0;}
-void yyerror (char *s) {}
-%}
-%%
-foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
-END
-
-cp lib/foo.y lib/bar.y
-
 cat >lib/src/x.c <<'EOF'
 #include <config.h>
-int lib ()
+int lib (void)
 {
   return 0;
 }
@@ -124,5 +109,7 @@ cd ..
 ./configure
 $MAKE
 $MAKE distcheck
-test ! -d subpack-1            # make sure distcheck cleans up after itself
+test ! -d subpack-1 # Make sure distcheck cleans up after itself.
 test -f subpack-1.tar.gz
+
+:
diff --git a/tests/subst3.test b/tests/subst3.test
index 1bcb170..c7adc8c 100755
--- a/tests/subst3.test
+++ b/tests/subst3.test
@@ -24,6 +24,7 @@ set -e
 
 cat >> configure.in <<'EOF'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_RANLIB
 if test -n "$doit"; then
   AC_SUBST([basehdr], [sub/base.h])
diff --git a/tests/substtarg.test b/tests/substtarg.test
index d828954..34db19f 100755
--- a/tests/substtarg.test
+++ b/tests/substtarg.test
@@ -25,6 +25,7 @@ set -e
 cat >> configure.in << 'END'
 AC_CONFIG_SOURCE([fakelib.c])
 AC_PROG_CC
+AM_PROG_AR
 RANLIB=:
 AC_SUBST([RANLIB])
 SUBST=hei
@@ -42,6 +43,8 @@ address@hidden@.a: Makefile $(address@hidden@_a_OBJECTS) 
$(address@hidden@_a_DEPEND
        @echo here we do some custom stuff, instead of invoking the linker
 END
 
+: > ar-lib
+
 $ACLOCAL
 AUTOMAKE_fails
 grep 'address@hidden@.a' stderr
diff --git a/tests/suffix10.test b/tests/suffix10.test
index 131359c..bdc4928 100755
--- a/tests/suffix10.test
+++ b/tests/suffix10.test
@@ -25,6 +25,7 @@ set -e
 cat >>configure.in <<EOF
 AC_PROG_CC
 AC_PROG_YACC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
 EOF
diff --git a/tests/suffix2.test b/tests/suffix2.test
index 405ce90..f55d965 100755
--- a/tests/suffix2.test
+++ b/tests/suffix2.test
@@ -24,6 +24,7 @@ set -e
 
 cat >> configure.in << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 END
 
diff --git a/tests/suffix5.test b/tests/suffix5.test
index b3b36aa..2cf0afa 100755
--- a/tests/suffix5.test
+++ b/tests/suffix5.test
@@ -24,6 +24,7 @@ required=libtool
 set -e
 
 cat >> configure.in << 'END'
+AM_PROG_AR
 AC_PROG_LIBTOOL
 END
 
@@ -38,6 +39,7 @@ END
 : > ltmain.sh
 : > config.guess
 : > config.sub
+: > ar-lib
 
 $ACLOCAL
 $AUTOMAKE
diff --git a/tests/suffix8.test b/tests/suffix8.test
index 70ff3a5..d2ba0d4 100755
--- a/tests/suffix8.test
+++ b/tests/suffix8.test
@@ -23,6 +23,7 @@ required='gcc libtoolize'
 set -e
 
 cat >>configure.in <<'END'
+AM_PROG_AR
 AM_PROG_LIBTOOL
 AC_OUTPUT
 END
diff --git a/tests/test-extensions-cond.test b/tests/test-extensions-cond.test
new file mode 100755
index 0000000..26409a8
--- /dev/null
+++ b/tests/test-extensions-cond.test
@@ -0,0 +1,72 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Expose bug in conditional definition of TEST_EXTENSIONS.
+
+parallel_tests=yes
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AM_CONDITIONAL([COND], [:])
+AM_CONDITIONAL([COND2], [:])
+END
+
+$ACLOCAL
+
+cat > 1.am << 'END'
+TESTS =
+if COND
+## lineno 4
+TEST_EXTENSIONS = .foo
+endif
+END
+
+cat > 2.am << 'END'
+TESTS =
+## lineno 3
+TEST_EXTENSIONS = .foo
+if COND
+# Do nothing.
+else
+TEST_EXTENSIONS += .bar
+endif
+END
+
+cat > 3.am << 'END'
+TESTS =
+if COND
+if !COND2
+TESTS = x
+else
+## lineno 7
+TEST_EXTENSIONS = .foo
+endif
+endif
+END
+
+: > test-driver
+
+for i in 1 2 3; do
+  AUTOMAKE_fails $i
+  lineno=`sed -n 's/^## lineno //p' $i.am` \
+    && test 0 -lt "$lineno" \
+    || Exit 99
+  grep "^$i\\.am:$lineno:.*TEST_EXTENSIONS.*conditional content" stderr
+done
+
+:
diff --git a/tests/test-extensions.test b/tests/test-extensions.test
new file mode 100755
index 0000000..901d872b
--- /dev/null
+++ b/tests/test-extensions.test
@@ -0,0 +1,74 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Make sure that Automake diagnose invalid entries in TEST_EXTENSIONS,
+# and do not diagnose valid (albeit more unusual) ones.
+# See automake bug#9400.
+
+parallel_tests=yes
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in <<'END'
+AC_OUTPUT
+END
+
+$ACLOCAL
+$AUTOCONF
+
+valid_extensions='sh T t1 _foo BAR x_Y_z _'
+
+echo TESTS = > Makefile.am
+echo " $valid_extensions" \
+  | sed -e 's/ / ./g' -e 's/^/TEST_EXTENSIONS =/' >> Makefile.am
+cat Makefile.am # For debugging.
+
+$AUTOMAKE
+
+grep -i 'log' Makefile.in # For debugging.
+
+for lc in $valid_extensions; do
+  uc=`echo $lc | tr '[a-z]' '[A-Z]'`
+  $FGREP "\$(${uc}_LOG_COMPILER)" Makefile.in
+  grep "^${uc}_LOG_COMPILE =" Makefile.in
+  grep "^\.${lc}\.log:" Makefile.in
+done
+
+# The produced Makefile is not broken.
+./configure
+$MAKE all check
+
+cat > Makefile.am << 'END'
+TESTS = foo.test bar.sh
+TEST_EXTENSIONS  = .test mu .x-y a-b .t.1 .sh .6c .0 .11 .= @suf@ 
address@hidden@
+TEST_EXTENSIONS += .= .t33 address@hidden _&_
+END
+
+AUTOMAKE_fails
+for suf in mu .x-y a-b .t.1 .6c .0 .11  @suf@ address@hidden@ '.=' '_&_'; do
+  suf2=`printf '%s\n' "$suf" | sed -e 's/\./\\./'`
+  $EGREP "^Makefile\.am:2:.*invalid test extension.* $suf2( |$)" stderr
+done
+
+# Verify that we accept valid suffixes, even if intermixed with
+# invalid ones.
+$EGREP '\.(sh|test|t33)' stderr && Exit 1
+
+# Verify that we don't try to handle invalid suffixes.
+$EGREP '(LOG_COMPILER|non-POSIX var|bad character)' stderr && Exit 1
+
+:
diff --git a/tests/uninstall-fail.test b/tests/uninstall-fail.test
new file mode 100755
index 0000000..14a843b
--- /dev/null
+++ b/tests/uninstall-fail.test
@@ -0,0 +1,67 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# "make uninstall" complains and errors out on failures.
+
+# FIXME: this test only deal with DATA primary; maybe we need sister
+# tests for other primaries too?  E.g., SCRIPTS, PROGRAMS, LISP, PYTHON,
+# etc...
+
+. ./defs || Exit 1
+
+set -e
+
+mkdir d
+: > d/f
+chmod a-w d || skip "cannot make directories unwritable"
+rm -f d/f && skip_ "can delete files from unwritable directories"
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+data_DATA = foobar.txt
+END
+
+: > foobar.txt
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+inst=__inst-dir__
+
+./configure --prefix="`pwd`/$inst"
+
+mkdir $inst $inst/share
+: > $inst/share/foobar.txt
+
+chmod a-w $inst/share
+$MAKE uninstall >output 2>&1 && { cat output; Exit 1; }
+cat output
+grep "rm: .*foobar\.txt" output
+
+chmod a-rwx $inst/share
+(cd $inst/share) && skip_ "cannot make directories fully unreadable"
+
+$MAKE uninstall >output 2>&1 && { cat output; Exit 1; }
+cat output
+# Some shells, like Solaris 10 /bin/sh and /bin/ksh, do not report
+# the name of the `cd' builtin upon a chdir error.
+$EGREP "(cd|sh): .*$inst/share" output
+
+:
diff --git a/tests/uninstall-pr9578.test b/tests/uninstall-pr9578.test
new file mode 100755
index 0000000..9aea52d
--- /dev/null
+++ b/tests/uninstall-pr9578.test
@@ -0,0 +1,69 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check against automake bug#9578: "make uninstall" issued before
+# "make install" or after a mere "make install-data" or a mere
+# "make install-exec" failed spuriously.
+#
+# FIXME: this test only deal with DATA and script primaries; maybe we
+# need sister tests for other primaries too?  E.g., PROGRAMS, LISP,
+# PYTHON, etc...
+
+. ./defs || Exit 1
+
+set -e
+
+cat >> configure.in << 'END'
+AC_OUTPUT
+END
+
+: > foo
+: > bar
+
+cat > Makefile.am << 'END'
+bin_SCRIPTS = foo
+data_DATA = bar
+END
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure --prefix="`pwd`/inst"
+
+$MAKE uninstall
+test ! -d inst
+
+rm -rf inst
+
+$MAKE install-exec
+test -f inst/bin/foo || Exit 99 # Sanity check.
+$MAKE uninstall
+test ! -f inst/bin/foo
+
+$MAKE install-data
+test -f inst/share/bar || Exit 99 # Sanity check.
+$MAKE uninstall
+test ! -f inst/share/bar
+
+rm -rf inst
+
+$MAKE install-exec
+test -f inst/bin/foo || Exit 99 # Sanity check.
+$MAKE uninstall
+test ! -f inst/bin/foo
+
+:
diff --git a/tests/vala.test b/tests/vala.test
index 3e9ae36..34b71d4 100755
--- a/tests/vala.test
+++ b/tests/vala.test
@@ -28,6 +28,7 @@ set -e
 
 cat >> 'configure.in' << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AM_PROG_VALAC
 AC_OUTPUT
diff --git a/tests/vala1.test b/tests/vala1.test
index d0cc241..b2c9e16 100755
--- a/tests/vala1.test
+++ b/tests/vala1.test
@@ -29,6 +29,7 @@ set -e
 
 cat >> 'configure.in' << 'END'
 AC_PROG_CC
+AM_PROG_AR
 AC_PROG_LIBTOOL
 AM_PROG_VALAC
 AC_OUTPUT


hooks/post-receive
-- 
GNU Automake



reply via email to

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