Merge branch 'maint'
authorStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 3 Jan 2012 22:26:56 +0000 (23:26 +0100)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Tue, 3 Jan 2012 22:26:56 +0000 (23:26 +0100)
* maint:
  install: pkglibexec_SCRIPTS is a valid prefix/primary combination
  coverage: expose automake bug#10128
  progs, libs: implement EXTRA_foo_DEPENDENCIES
  tests: fix spurious failures in 'pr300*.test'

1  2 
NEWS
THANKS
automake.in
doc/automake.texi
tests/Makefile.am
tests/extradep.test
tests/extradep2.test
tests/pr300-lib.test
tests/pr300-ltlib.test
tests/primary-prefix-invalid-couples.tap
tests/primary-prefix-valid-couples.test

diff --combined NEWS
--- 1/NEWS
--- 2/NEWS
+++ b/NEWS
 -New in 1.11.0a:
 +New in 1.11a:
 +
 +* Obsolete features removed:
 +
 +  - Support for automatic de-ANSI-fication has been removed.
 +
 +  - The deprecated `lzma' compression format for distribution archives
 +    has been removed, in favor of `xz' and `lzip'.
 +
 +  - The obsolete AM_WITH_REGEX macro has been removed.
 +
 +  - The deprecated options `--output-dir', `--Werror' and `--Wno-error'
 +    have been removed.
 +
 +* New targets:
 +
 +  - New `cscope' target to build a cscope database for the source tree.
 +
 +* Changes to Automake-generated testsuite harnesses:
 +
 +  - Test scripts that exit with status 99 to signal an "hard error" (e.g.,
 +    and unexpected or internal error, or a failure to set up the test case
 +    scenario) have their outcome reported as an 'ERROR' now.  Previous
 +    versions of automake reported such an outcome as a 'FAIL' (the only
 +    difference with normal failures being that hard errors were counted
 +    as failures even when the test originating them was listed in
 +    XFAIL_TESTS).
 +
 +  - The testsuite summary displayed by the parallel-test harness has a
 +    completely new format, that always list the numbers of passed, failed,
 +    xfailed, xpassed, skipped and errored tests, even when these numbers
 +    are zero (but using smart coloring when the color-tests option is in
 +    effect).
 +
 +  - The default testsuite driver offered by the 'parallel-tests' option is
 +    now implemented (partly at least) with the help of automake-provided
 +    auxiliary scripts (e.g., `test-driver'), instead of relying entirely
 +    on code in the generated Makefile.in.
 +    This has two noteworthy implications.  The first one is that projects
 +    using the `parallel-tests' option should now either run automake with
 +    the `--add-missing' option, or manually copy the `test-driver' script
 +    into their tree.  The second, and more important, implication is that
 +    now, when the `parallel-tests' option is in use, TESTS_ENVIRONMENT can
 +    not be used anymore to define a test runner, and the command specified
 +    in LOG_COMPILER (and <ext>_LOG_COMPILER) must be a *real* executable
 +    program or script.  For example, this is still a valid usage (albeit
 +    a little contorted):
 +
 +      TESTS_ENVIRONMENT = \
 +        if test -n '$(STRICT_TESTS)'; then \
 +          maybe_errexit='-e'; \
 +        else \
 +          maybe_errexit=''; \
 +        fi;
 +      LOG_COMPILER = $(SHELL) $$maybe_errexit
 +
 +    while this is not anymore:
 +
 +      TESTS_ENVIRONMENT = \
 +        $(SHELL) `test -n '$(STRICT_TESTS_CHECKING)' && echo ' -e'`
 +
 +    neither is this:
 +
 +      TESTS_ENVIRONMENT = \
 +        run_with_perl_or_shell () \
 +        { \
 +          if grep -q '^#!.*perl' $$1; then
 +            $(PERL) $$1; \
 +          else \
 +            $(SHELL) $$1; \
 +          fi; \
 +        }
 +      LOG_COMPILER = run_with_per_or_shell
 +
 +  - The package authors can now use customary testsuite drivers within
 +    the framework provided by the 'parallel-tests' testsuite harness.
 +    Consistently with the existing syntax, this can be done by defining
 +    special makefile variables `LOG_DRIVER' and `<ext>_LOG_DRIVER'.
 +
 +  - A new developer-reserved variable `AM_TESTS_FD_REDIRECT' can be used
 +    to redirect/define file descriptors used by the test scripts.
 +
 +  - The parallel-tests harness generates now, in addition the `.log' files
 +    holding the output produced by the test scripts, a new set of `.trs'
 +    files, holding "metadata" derived by the execution of the test scripts;
 +    among such metadata are the outcomes of the test cases run by a script.
 +
 +  - Initial and still experimental support for the TAP test protocol is
 +    now provided.
  
 -* WARNING: Future backward-incompatibilities!
 +* Miscellaneous changes:
  
 -  - The `lzma' compression format for distribution archives has been
 -    deprecated in favor of `xz' and `lzip', and will be removed in the
 -    next major Automake release (1.12).
 +  - The `dist' and `dist-all' targets now can run compressors in parallel.
  
 -  - The Automake support for automatic de-ANSI-fication will be removed in
 -    the next major Automake release (1.12).
 +  - Automake can now generate silenced rules for texinfo outputs.
  
 -  - The `--acdir' option of aclocal is deprecated, and will probably be
 -    removed in the next major Automake release (1.12).
 +  - Some auxiliary files that are automatically distributed by Automake
 +    (e.g., `install-sh', or the `depcomp' script for packages compiling
 +    C sources) might now be listed in the DIST_COMMON variable in many
 +    Makefile.in files, rather than in the top-level one.
  
 -  - 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).
 +  - Messages of types warning or error from `automake' and `aclocal'
 +    are now prefixed with the respective type, and presence of -Werror
 +    is noted.
  
 -  - The obsolescent AM_WITH_REGEX  macro has been deprecated (since the
 -    GNU rx library has been decommissioned), and will be removed in the
 -    next major Automake release (1.12).
 +  - Automake's early configure-time sanity check now tries to avoid
 +    sleeping for a second, which slowed down cached configure runs
 +    noticeably.  In that case, it will check back at the end of the
 +    configure script to ensure that at least one second has passed, to
 +    avoid time stamp issues with makefile rules rerunning autotools
 +    programs.
  
 -* Changes to aclocal:
 +  - For programs and libraries, automake now detect EXTRA_foo_DEPENDENCIES
 +    and adds them to the normal list of dependencies, but without
 +    overwriting the foo_DEPENDENCIES variable, which is normally computed
 +    by automake.
  
 -  - The `--acdir' option is deprecated.  Now you should use the new options
 -    `--automake-acdir' and `--system-acdir' instead.
 +  - C source and header files derived from non-distributed Yacc sources
 +    are now removed by "make clean", not only by "make maintainer-clean".
  
 -  - 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).
 +  - The warnings in the category `extra-portability' are now enabled by
 +    `-Wall'.  In previous versions, one has to use `-Wextra-portability'
 +    to enable them.
 +
 +Bugs fixed in 1.11a:
 +
 +  - Various minor bugfixes.
 +
 +* Bugs introduced by 1.11:
 +
 +  - The AM_COND_IF macro also works if the shell expression for the
 +    conditional is no longer valid for the condition.
 +
 +* Long-standing bugs:
 +
 +  - Automake's own build system finally have a real "installcheck" target.
 +
 +  - Files listed with the AC_REQUIRE_AUX_FILE macro in configure.ac are
 +    now automatically distributed also if the directory of the auxiliary
 +    files coincides with the top-level directory.
 +
 +  - Automake now detects the presence of the `-d' flag in the various
 +    `*YFLAGS' variables even when their definitions involve indirections
 +    through other variables, such as in:
 +      foo_opts = -d
 +      AM_YFLAGS = $(foo_opts)
 +
 +  - Automake now complains if a `*YFLAGS' variable has any conditional
 +    content, not only a conditional definition.
 +
 +  - Explicit enabling and/or disabling of Automake warning categories
 +    through the `-W...' options now always takes precedence over the
 +    implicit warning level implied by Automake strictness (foreign, gnu
 +    or gnits), regardless of the order in which such strictness and
 +    warning flags appear.  For example, a setting like:
 +      AUTOMAKE_OPTIONS = -Wall --foreign
 +    will cause the warnings in category `portability' to be enabled, even
 +    if those warnings are by default disabled in `foreign' strictness.
 +
 +\f
 +New in 1.11.2a:
 +
 +* WARNING: Future backward-incompatibilities!
 +
 +  - The obsolescent AM_WITH_REGEX  macro has been deprecated, since the
 +    GNU rx library has been decommissioned.
 +
 +  - The `lzma' compression format for distribution archives has been
 +    deprecated in favor of `xz' and `lzip'.
 +
 +  - The `--acdir' option of aclocal is deprecated, and will probably be
 +    removed in the next major Automake release (1.12). [FIXME]
 +
 +  - 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). [FIXME]
  
  * Miscellaneous changes:
  
    - The last relics of Python 1.5 support have been removed from the
      AM_PATH_PYTHON macro.
  
 +Bugs fixed in 1.11.2a:
 +
 +* Long-standing bugs:
 +
 +  - The "deleted header file problem" for *.am files is avoided by stub
 +    rules.  This allows `make' to trigger a rerun of `automake' also if
 +    some previously needed `.am' file has been removed.
 +
 +  - The `silent-rules' option now generates working makefiles even
 +    for the uncommon `make' implementations that do not support the
 +    nested-variables extension to POSIX 2008.  For such `make'
 +    implementations, whether a build is silent is determined at
 +    configure time, and cannot be overridden at make time with
 +    `make V=0' or `make V=1'.
 +
 +\f
 +New in 1.11.2:
 +
 +* 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 Automake support for automatic de-ANSI-fication has been
 +    deprecated.
 +
    - The `lzma' compression scheme and associated automake option `dist-lzma'
      is obsoleted by `xz' and `dist-xz' due to upstream changes.
  
      specify a different level via the XZ_OPT and BZIP2 envvars respectively.
      E.g., "make dist-xz XZ_OPT=-7" or "make dist-bzip2 BZIP2=-5"
  
 +  - 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
      user; still, the old Makefile.am files that used to define it will
      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 selected archiver is Microsoft lib.
 +    This new macro is required for LIBRARIES and LTLIBRARIES when automake
 +    is run with -Wextra-portability 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)'.
      the `${infodir}/dir' file, by exporting the new environment variable
      `AM_UPDATE_INFO_DIR' to the value "no".
  
 -  - For programs and libraries, automake now detects EXTRA_foo_DEPENDENCIES
 -    and adds them to the normal list of dependencies, but without
 -    overwriting the foo_DEPENDENCIES variable, which is normally computed
 -    by automake.
 -
 -Bugs fixed in 1.11.0a:
 +Bugs fixed in 1.11.2:
  
+ * Bugs introduced by 1.11.2:
+   - Automake now correctly recognizes the prefix/primary combination
+    `pkglibexec_SCRIPTS' as valid.
  * Bugs introduced by 1.11:
  
 -  - The `parallel-tests' test driver works around a GNU make 3.80 bug with
 -    trailing white space in the test list (`TESTS = foo $(EMPTY)'), and
 -    does not report spurious successes when used with concurrent FreeBSD
 -    make (e.g., "make check -j3").
 +  - The parallel-tests driver no longer produces erroneous results with
 +    Tru64/OSF 5.1 sh upon unreadable log files.
 +
 +  - The `parallel-tests' test driver 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,
      not used, `make' output no longer contains spurious backslash-only
      lines, thus once again matching what Automake did before 1.11.
  
 -  - The `silent-rules' option now generates working makefiles even for
 -    the uncommon `make' implementations that do not support the
 -    nested-variables extension to POSIX 2008.  For such `make'
 -    implementations, whether a build is silent is determined at
 -    configure time, and cannot be overridden at make time with
 -    `make V=0' or `make V=1'.
 -
 -  - The AM_COND_IF macro also works if the shell expression for the conditional
 -    is no longer valid for the condition.
 +  - The AM_COND_IF macro also works if the shell expression for the
 +    conditional is no longer valid for the condition.
  
  * Long-standing bugs:
  
 -  - The "deleted header file problem" for *.am files is avoided by stub
 -    rules.  This allows `make' to trigger a rerun of `automake' also if
 -    some previously needed `.am' file has been removed.
 +  - The order of Yacc and Lex flags is fixed to be consistent with other
 +    languages: $(AM_YFLAGS) comes before $(YFLAGS), and $(AM_LFLAGS) before
 +    $(LFLAGS), so that the user variables override the developer variables.
  
    - "make distcheck" now correctly complains also when "make uninstall"
      leaves one and only one file installed in $(prefix).
    - Automake now warns about more primary/directory invalid combinations,
      such as "doc_LIBRARIES" or "pkglib_PROGRAMS".
  
 -  - On Darwin 9, `pythondir' and `pyexecdir' pointed below `/Library/Python'
 -    even if the `--prefix' argument pointed outside of a system directory.
 -    AM_PATH_PYTHON has been fixed to ignore the value returned from python's
 -    `get_python_lib' function if it points outside the configured prefix,
 -    unless the `--prefix' argument was either `/usr' or below `/System'.
 -
 -  - The testsuite does not try to change the mode of `ltmain.sh' files from
 -    a Libtool installation (symlinked to test directories) any more.
 -
 -  - AM_PROG_GCJ uses AC_CHECK_TOOLS to look for `gcj' now, so that prefixed
 -    tools are preferred in a cross-compile setup.
 +  - Rules generated by Automake now try harder to not change any files when
 +    `make -n' is invoked.  Fixes include compilation of Emacs Lisp, Vala, or
 +    Yacc source files and the rule to update config.h.
  
    - Several scripts and the parallel-tests testsuite driver now exit with
      the right exit status upon receiving a signal.
    - A per-Makefile.am setting of -Werror does not erroneously carry over
      to the handling of other Makefile.am files.
  
 -  - The order of Yacc and Lex flags is now consistent with that of other
 -    languages: $(AM_YFLAGS) comes before $(YFLAGS), and $(AM_LFLAGS) before
 -    $(LFLAGS), so that the user variables override the developer variables.
 -
 -  - Rules generated by Automake now try harder not to change any files when
 -    `make -n' is invoked.  Fixes include compilation of Emacs Lisp, Vala, or
 -    Yacc source files and the rule to update config.h.
 -
    - The code for automatic dependency tracking works around a Solaris
      make bug triggered by sources containing repeated slashes when the
      `subdir-objects' option was used.
  
 -  - The parallel-tests driver no longer produces erroneous results with
 -    Tru64/OSF 5.1 sh upon unreadable log files.
 -
    - The makedepend and hp depmodes now work better with VPATH builds.
  
    - Java sources specified with check_JAVA are no longer compiled for
      change its behaviour; this has proven to be frail and easy to
      regress.
  \f
 +Bugs fixed in 1.11.1:
 +
 +  - Lots of minor bugfixes.
 +
 +* Bugs introduced by 1.11:
 +
 +  - The `parallel-tests' test driver works around a GNU make 3.80 bug with
 +    trailing white space in the test list (`TESTS = foo $(EMPTY)').
 +
 +* Long standing bugs:
 +
 +  - On Darwin 9, `pythondir' and `pyexecdir' pointed below `/Library/Python'
 +    even if the `--prefix' argument pointed outside of a system directory.
 +    AM_PATH_PYTHON has been fixed to ignore the value returned from python's
 +    `get_python_lib' function if it points outside the configured prefix,
 +    unless the `--prefix' argument was either `/usr' or below `/System'.
 +
 +  - The testsuite does not try to change the mode of `ltmain.sh' files from
 +    a Libtool installation (symlinked to test directories) any more.
 +
 +  - AM_PROG_GCJ uses AC_CHECK_TOOLS to look for `gcj' now, so that prefixed
 +    tools are preferred in a cross-compile setup.
 +
 +  - The distribution is tarred up with mode 755 now by the `dist*' targets.
 +    This fixes a race condition where untrusted users could modify files
 +    in the $(PACKAGE)-$(VERSION) distdir before packing if the toplevel
 +    build directory was world-searchable.  This is CVE-2009-4029.
 +\f
  New in 1.11:
  
  * Version requirements:
diff --combined THANKS
--- 1/THANKS
--- 2/THANKS
+++ b/THANKS
@@@ -68,9 -68,7 +68,9 @@@ danbp                 danpb@nospam.postmaster.co.u
  Daniel Jacobowitz     drow@false.org
  Daniel Kahn Gillmor   dkg@fifthhorseman.net
  Daniel Richard G.     skunk@iskunk.org
 +Debarshi Ray          rishi@gnu.org
  Dave Brolley          brolley@redhat.com
 +Dave Hart             davehart@gmail.com
  Dave Korn             dave.korn.cygwin@googlemail.com
  Dave Morrison         dave@bnl.gov
  David A. Swierczek    swiercze@mr.med.ge.com
@@@ -80,6 -78,7 +80,7 @@@ David Pashley         david@davidpashley.co
  David Zaroski         cz253@cleveland.Freenet.Edu
  Dean Povey            dpovey@wedgetail.com
  Dennis J. Linse               Dennis.J.Linse@SAIC.com
+ Dennis Schridde               devurandom@gmx.net
  Derek R. Price                derek.price@openavenue.com
  Diab Jerius           djerius@cfa.harvard.edu
  Didier Cassirame      faded@free.fr
@@@ -150,7 -149,6 +151,7 @@@ Jared Davis                abiword@aiksaurus.co
  Jason Duell           jcduell@lbl.gov
  Jason Molenda         crash@cygnus.co.jp
  Jeff Bailey           Jbailey@phn.ca
 +Jeff A. Daily         jeff.daily@pnl.gov
  Jeff Garzik           jgarzik@pobox.com
  Jeff Squyres          jsquyres@lam-mpi.org
  Jens Elkner           elkner@imsgroup.de
@@@ -316,7 -314,6 +317,7 @@@ Roberto Bagnara            bagnara@cs.unipr.i
  Roman Fietze          roman.fietze@telemotive.de
  Ronald Landheer               ronald@landheer.com
  Roumen Petrov         bugtrack@roumenpetrov.info
 +Russ Allbery          rra@stanford.edu
  Rusty Ballinger               rusty@rlyeh.engr.sgi.com
  Ryan T. Sammartino    ryants@shaw.ca
  Sam Hocevar           sam@zoy.org
diff --combined automake.in
@@@ -7,8 -7,8 +7,8 @@@ eval 'case $# in 0) exec @PERL@ -S "$0"
  
  # automake - create Makefile.in from Makefile.am
  # Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
- # Foundation, Inc.
+ # 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 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
@@@ -53,6 -53,7 +53,6 @@@ struct (# Short name of the language (c
        # List of configure variables which must be defined.
        'config_vars' => '@',
  
 -      'ansi'    => "\$",
        # `pure' is `1' or `'.  A `pure' language is one where, if
        # all the files in a directory are of that language, then we
        # do not require the C compiler or any code to call it.
@@@ -207,6 -208,8 +207,6 @@@ my $INCLUDE_PATTERN = ('^include\s+
                       . '|(\$\(srcdir\)/' . $PATH_PATTERN . ')'
                       . '|([^/\$]' . $PATH_PATTERN . '))\s*(#.*)?' . "\$");
  
 -# Match `-d' as a command-line argument in a string.
 -my $DASH_D_PATTERN = "(^|\\s)-d(\\s|\$)";
  # Directories installed during 'install-exec' phase.
  my $EXEC_DIR_PATTERN =
    '^(?:bin|sbin|libexec|sysconf|localstate|lib|pkglib|.*exec.*)' . "\$";
@@@ -232,9 -235,9 +232,9 @@@ my @libtool_sometimes = qw(ltconfig ltc
  my @common_files =
      (qw(ABOUT-GNU ABOUT-NLS AUTHORS BACKLOG COPYING COPYING.DOC COPYING.LIB
        COPYING.LESSER ChangeLog INSTALL NEWS README THANKS TODO
 -      ansi2knr.1 ansi2knr.c compile config.guess config.rpath config.sub
 -      depcomp elisp-comp install-sh libversion.in mdate-sh missing
 -      mkinstalldirs py-compile texinfo.tex ylwrap),
 +      ar-lib compile config.guess config.rpath
 +      config.sub depcomp elisp-comp install-sh libversion.in mdate-sh
 +      missing mkinstalldirs py-compile texinfo.tex ylwrap),
       @libtool_files, @libtool_sometimes);
  
  # Commonly used files we auto-include, but only sometimes.  This list
@@@ -327,6 -330,10 +327,6 @@@ my @config_headers = ()
  # Names used in AC_CONFIG_LINKS call.
  my @config_links = ();
  
 -# Directory where output files go.  Actually, output files are
 -# relative to this directory.
 -my $output_directory;
 -
  # List of Makefile.am's to process, and their corresponding outputs.
  my @input_files = ();
  my %output_files = ();
@@@ -389,9 -396,6 +389,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;
  
@@@ -473,8 -477,9 +473,8 @@@ my %required_targets 
     'install-man' => 1,
    );
  
 -# Set to 1 if this run will create the Makefile.in that distributes
 -# the files in config_aux_dir.
 -my $automake_will_process_aux_dir = 0;
 +# Queue to push require_conf_file requirements to.
 +my $required_conf_file_queue;
  
  # The name of the Makefile currently being processed.
  my $am_file = 'BUG';
@@@ -569,6 -574,12 +569,6 @@@ my @dist_targets
  my %known_programs;
  my %known_libraries;
  
 -# Keys in this hash are the basenames of files which must depend on
 -# ansi2knr.  Values are either the empty string, or the directory in
 -# which the ANSI source file appears; the directory must have a
 -# trailing `/'.
 -my %de_ansi_files;
 -
  # This keeps track of which extensions we've seen (that we care
  # about).
  my %extension_seen;
@@@ -592,9 -603,9 +592,9 @@@ my %linkers_used
  # True if we need `LINK' defined.  This is a hack.
  my $need_link;
  
 -# Was get_object_extension run?
 -# FIXME: This is a hack. a better switch should be found.
 -my $get_object_extension_was_run;
 +# Does the generated Makefile have to build some compiled object
 +# (for binary programs, or plain or libtool libraries)?
 +my $must_handle_compiled_objects;
  
  # Record each file processed by make_paragraphs.
  my %transformed_files;
@@@ -694,6 -705,8 +694,6 @@@ sub initialize_per_input (
      %known_programs = ();
      %known_libraries= ();
  
 -    %de_ansi_files = ();
 -
      %extension_seen = ();
  
      %language_scratch = ();
  
      $need_link = 0;
  
 -    $get_object_extension_was_run = 0;
 +    $must_handle_compiled_objects = 0;
  
      %transformed_files = ();
  }
  register_language ('name' => 'c',
                   'Name' => 'C',
                   'config_vars' => ['CC'],
 -                 'ansi' => 1,
                   'autodep' => '',
                   'flags' => ['CFLAGS', 'CPPFLAGS'],
                   'ccer' => 'CC',
                   'link' => '$(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
                   'compile_flag' => '-c',
                   'libtool_tag' => 'CC',
 -                 'extensions' => ['.c'],
 -                 '_finish' => \&lang_c_finish);
 +                 'extensions' => ['.c']);
  
  # C++.
  register_language ('name' => 'cxx',
@@@ -886,7 -901,10 +886,7 @@@ register_language ('name' => 'asm'
                   'compiler' => 'CCASCOMPILE',
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
 -                 'extensions' => ['.s'],
 -
 -                 # With assembly we still use the C linker.
 -                 '_finish' => \&lang_c_finish);
 +                 'extensions' => ['.s']);
  
  # Preprocessed Assembler.
  register_language ('name' => 'cppasm',
                   'compiler' => 'CPPASCOMPILE',
                   'compile_flag' => '-c',
                   'output_flag' => '-o',
 -                 'extensions' => ['.S', '.sx'],
 -
 -                 # With assembly we still use the C linker.
 -                 '_finish' => \&lang_c_finish);
 +                 'extensions' => ['.S', '.sx']);
  
  # Fortran 77
  register_language ('name' => 'f77',
@@@ -1189,25 -1210,11 +1189,25 @@@ sub define_verbose_tagvar ($
      my ($name) = @_;
      if (option 'silent-rules')
        {
 -      define_verbose_var ($name, '@echo "  '. $name . ' ' x (6 - length ($name)) . '" $@;');
 +      define_verbose_var ($name, '@echo "  '. $name . ' ' x (8 - length ($name)) . '" $@;');
        define_verbose_var ('at', '@');
        }
  }
  
 +# define_verbose_texinfo
 +# ----------------------
 +# Engage the needed `silent-rules' machinery for assorted texinfo commands.
 +sub define_verbose_texinfo ()
 +{
 +  my @tagvars = ('DVIPS', 'MAKEINFO', 'INFOHTML', 'TEXI2DVI', 'TEXI2PDF');
 +  foreach my $tag (@tagvars)
 +    {
 +      define_verbose_tagvar($tag);
 +    }
 +  define_verbose_var('texinfo', '-q');
 +  define_verbose_var('texidevnull', '> /dev/null');
 +}
 +
  # define_verbose_libtool
  # ----------------------
  # Engage the needed `silent-rules' machinery for `libtool --silent'.
@@@ -1232,10 -1239,12 +1232,10 @@@ sub handle_option
          msg_var ('unsupported', $var,
                   "`AUTOMAKE_OPTIONS' cannot have conditional contents");
        }
 -      foreach my $locvals ($var->value_as_list_recursive (cond_filter => TRUE,
 -                                                        location => 1))
 -      {
 -        my ($loc, $value) = @$locvals;
 -        return 1 if (process_option_list ($loc, $value))
 -      }
 +      my @options = map { { option => $_->[1], where => $_->[0] } }
 +                      $var->value_as_list_recursive (cond_filter => TRUE,
 +                                                     location => 1);
 +      return 1 if process_option_list (@options);
      }
  
    # Override portability-recursive warning.
@@@ -1272,6 -1281,22 +1272,6 @@@ sub shadow_unconditionally ($$
    return "\$($varname)"
  }
  
 -# get_object_extension ($EXTENSION)
 -# ---------------------------------
 -# Prefix $EXTENSION with $U if ansi2knr is in use.
 -sub get_object_extension ($)
 -{
 -    my ($extension) = @_;
 -
 -    # Check for automatic de-ANSI-fication.
 -    $extension = '$U' . $extension
 -      if option 'ansi2knr';
 -
 -    $get_object_extension_was_run = 1;
 -
 -    return $extension;
 -}
 -
  # check_user_variables (@LIST)
  # ----------------------------
  # Make sure each variable VAR in @LIST does not exist, suggest using AM_VAR
@@@ -1291,7 -1316,7 +1291,7 @@@ sub check_user_variables (@
                  msg_cond_var ('gnu', $cond, $flag,
                                "`$flag' is a user variable, "
                                . "you should not override it;\n"
 -                              . "use `AM_$flag' instead.");
 +                              . "use `AM_$flag' instead");
                }
            }
        }
@@@ -1496,6 -1521,97 +1496,6 @@@ sub handle_language
                unless $depbase eq '';
            $depbase .= '$(DEPDIR)/' . basename ($obj);
  
 -          # Support for deansified files in subdirectories is ugly
 -          # enough to deserve an explanation.
 -          #
 -          # A Note about normal ansi2knr processing first.  On
 -          #
 -          #   AUTOMAKE_OPTIONS = ansi2knr
 -          #   bin_PROGRAMS = foo
 -          #   foo_SOURCES = foo.c
 -          #
 -          # we generate rules similar to:
 -          #
 -          #   foo: foo$U.o; link ...
 -          #   foo$U.o: foo$U.c; compile ...
 -          #   foo_.c: foo.c; ansi2knr ...
 -          #
 -          # this is fairly compact, and will call ansi2knr depending
 -          # on the value of $U (`' or `_').
 -          #
 -          # It's harder with subdir sources. On
 -          #
 -          #   AUTOMAKE_OPTIONS = ansi2knr
 -          #   bin_PROGRAMS = foo
 -          #   foo_SOURCES = sub/foo.c
 -          #
 -          # we have to create foo_.c in the current directory.
 -          # (Unless the user asks 'subdir-objects'.)  This is important
 -          # in case the same file (`foo.c') is compiled from other
 -          # directories with different cpp options: foo_.c would
 -          # be preprocessed for only one set of options if it were
 -          # put in the subdirectory.
 -          #
 -          # Because foo$U.o must be built from either foo_.c or
 -          # sub/foo.c we can't be as concise as in the first example.
 -          # Instead we output
 -          #
 -          #   foo: foo$U.o; link ...
 -          #   foo_.o: foo_.c; compile ...
 -          #   foo.o: sub/foo.c; compile ...
 -          #   foo_.c: foo.c; ansi2knr ...
 -          #
 -          # This is why we'll now transform $rule_file twice
 -          # if we detect this case.
 -          # A first time we output the compile rule with `$U'
 -          # replaced by `_' and the source directory removed,
 -          # and another time we simply remove `$U'.
 -          #
 -          # Note that at this point $source (as computed by
 -          # &handle_single_transform) is `sub/foo$U.c'.
 -          # This can be confusing: it can be used as-is when
 -          # subdir-objects is set, otherwise you have to know
 -          # it really means `foo_.c' or `sub/foo.c'.
 -          my $objdir = dirname ($obj);
 -          my $srcdir = dirname ($source);
 -          if ($lang->ansi && $obj =~ /\$U/)
 -            {
 -              prog_error "`$obj' contains \$U, but `$source' doesn't."
 -                if $source !~ /\$U/;
 -
 -              (my $source_ = $source) =~ s/\$U/_/g;
 -              # Output an additional rule if _.c and .c are not in
 -              # the same directory.  (_.c is always in $objdir.)
 -              if ($objdir ne $srcdir)
 -                {
 -                  (my $obj_ = $obj) =~ s/\$U/_/g;
 -                  (my $depbase_ = $depbase) =~ s/\$U/_/g;
 -                  $source_ = basename ($source_);
 -
 -                  $output_rules .=
 -                    file_contents ($rule_file,
 -                                   new Automake::Location,
 -                                   %transform,
 -                                   GENERIC   => 0,
 -
 -                                   DEPBASE   => $depbase_,
 -                                   BASE      => $obj_,
 -                                   SOURCE    => $source_,
 -                                   SOURCEFLAG => $sourceflags{$srcext} || '',
 -                                   OBJ       => "$obj_$myext",
 -                                   OBJOBJ    => "$obj_.obj",
 -                                   LTOBJ     => "$obj_.lo",
 -
 -                                   COMPILE   => $obj_compile,
 -                                   LTCOMPILE => $obj_ltcompile,
 -                                   -o        => $output_flag,
 -                                   %file_transform);
 -                  $obj =~ s/\$U//g;
 -                  $depbase =~ s/\$U//g;
 -                  $source =~ s/\$U//g;
 -                }
 -            }
 -
            $output_rules .=
              file_contents ($rule_file,
                             new Automake::Location,
@@@ -1651,7 -1767,7 +1651,7 @@@ sub check_libobjs_source
  #   $VAR is the name of the variable that the source filenames come from
  #   $TOPPARENT is the name of the _SOURCES variable which is being processed
  #   $DERIVED is the name of resulting executable or library
 -#   $OBJ is the object extension (e.g., `$U.lo')
 +#   $OBJ is the object extension (e.g., `.lo')
  #   $FILE the source file to transform
  #   %TRANSFORM contains extras arguments to pass to file_contents
  #     when producing explicit rules
@@@ -1662,6 -1778,8 +1662,6 @@@ sub handle_single_transform ($$$$$%
      my ($var, $topparent, $derived, $obj, $_file, %transform) = @_;
      my @files = ($_file);
      my @result = ();
 -    my $nonansi_obj = $obj;
 -    $nonansi_obj =~ s/\$U//g;
  
      # Turn sources into objects.  We use a while loop like this
      # because we might add to @files in the loop.
        # language function.
        my $aggregate = 'AM';
  
 -      $extension = &derive_suffix ($extension, $nonansi_obj);
 +      $extension = &derive_suffix ($extension, $obj);
        my $lang;
        if ($extension_map{$extension} &&
            ($lang = $languages{$extension_map{$extension}}))
            # Do we have per-executable flags for this executable?
            my $have_per_exec_flags = 0;
            my @peflags = @{$lang->flags};
 -          push @peflags, 'LIBTOOLFLAGS' if $nonansi_obj eq '.lo';
 +          push @peflags, 'LIBTOOLFLAGS' if $obj eq '.lo';
            foreach my $flag (@peflags)
              {
                if (set_seen ("${derived}_$flag"))
            my $subr = \&{'lang_' . $lang->name . '_rewrite'};
            my ($r, $source_extension)
                = &$subr ($directory, $base, $extension,
 -                        $nonansi_obj, $have_per_exec_flags, $var);
 +                        $obj, $have_per_exec_flags, $var);
            # Skip this entry if we were asked not to process it.
            next if $r == LANG_IGNORE;
  
                $this_obj_ext = $source_extension;
                $derived_source = 1;
            }
 -          elsif ($lang->ansi)
 -          {
 -              $this_obj_ext = $obj;
 -          }
            else
            {
 -              $this_obj_ext = $nonansi_obj;
 +              $this_obj_ext = $obj;
            }
            $object = $base . $this_obj_ext;
  
                        $full_ansi = $base . $extension;
                  }
  
 -              if ($lang->ansi && option 'ansi2knr')
 -                {
 -                  $full_ansi =~ s/$KNOWN_EXTENSIONS_PATTERN$/\$U$&/;
 -                  $obj_sans_ext .= '$U';
 -                }
 -
                my @specifics = ($full_ansi, $obj_sans_ext,
                                 # Only use $this_obj_ext in the derived
                                 # source case because in the other case we
                      [@specifics, %transform]);
            }
        }
 -      elsif ($extension eq $nonansi_obj)
 +      elsif ($extension eq $obj)
        {
            # This is probably the result of a direct suffix rule.
            # In this case we just accept the rewrite.
@@@ -2188,9 -2316,9 +2188,9 @@@ sub handle_lib_object
    my ($xname, $varname) = @_;
  
    my $var = var ($varname);
 -  prog_error "handle_lib_objects: `$varname' undefined"
 +  prog_error "`$varname' undefined"
      unless $var;
 -  prog_error "handle_lib_objects: unexpected variable name `$varname'"
 +  prog_error "unexpected variable name `$varname'"
      unless $varname =~ /^(.*)(?:LIB|LD)ADD$/;
    my $prefix = $1 || 'AM_';
  
               # FIXME: should display a stack of nested variables
               # as context when $var != $subvar.
               err_var ($var, "linker flags such as `$val' belong in "
 -                      . "`${prefix}LDFLAGS");
 +                      . "`${prefix}LDFLAGS'");
             }
           return ();
         }
@@@ -2383,7 -2511,8 +2383,7 @@@ sub check_canonical_spellin
  # Set up the compile suite.
  sub handle_compile ()
  {
 -    return
 -      unless $get_object_extension_was_run;
 +   return if ! $must_handle_compiled_objects;
  
      # Boilerplate.
      my $default_includes = '';
                                'DISTRMS' => join ("\n", @dist_rms)));
      $output_vars .= $vars;
      $output_rules .= "$coms$rules";
 -
 -    # Check for automatic de-ANSI-fication.
 -    if (option 'ansi2knr')
 -      {
 -      my ($ansi2knr_filename, $ansi2knr_where) = @{option 'ansi2knr'};
 -      my $ansi2knr_dir = '';
 -
 -      require_variables ($ansi2knr_where, "option `ansi2knr' is used",
 -                         TRUE, "ANSI2KNR", "U");
 -
 -      # topdir is where ansi2knr should be.
 -      if ($ansi2knr_filename eq 'ansi2knr')
 -        {
 -          # Only require ansi2knr files if they should appear in
 -          # this directory.
 -          require_file ($ansi2knr_where, FOREIGN,
 -                        'ansi2knr.c', 'ansi2knr.1');
 -
 -          # ansi2knr needs to be built before subdirs, so unshift it
 -          # rather then pushing it.
 -          unshift (@all, '$(ANSI2KNR)');
 -        }
 -      else
 -        {
 -          $ansi2knr_dir = dirname ($ansi2knr_filename);
 -        }
 -
 -      $output_rules .= &file_contents ('ansi2knr',
 -                                       new Automake::Location,
 -                                       'ANSI2KNR-DIR' => $ansi2knr_dir);
 -
 -    }
  }
  
  # handle_libtool ()
@@@ -2472,7 -2633,6 +2472,7 @@@ sub handle_program
                                  'bin', 'sbin', 'libexec', 'pkglibexec',
                                  'noinst', 'check');
    return if ! @proglist;
 +  $must_handle_compiled_objects = 1;
  
    my $seen_global_libobjs =
      var ('LDADD') && &handle_lib_objects ('', 'LDADD');
        my ($where, $one_file) = @$pair;
  
        my $seen_libobjs = 0;
 -      my $obj = get_object_extension '.$(OBJEXT)';
 +      my $obj = '.$(OBJEXT)';
  
        $known_programs{$one_file} = $where;
  
@@@ -2563,7 -2723,6 +2563,7 @@@ sub handle_librarie
    my @liblist = &am_install_var ('libs', 'LIBRARIES',
                                 'lib', 'pkglib', 'noinst', 'check');
    return if ! @liblist;
 +  $must_handle_compiled_objects = 1;
  
    my @prefix = am_primary_prefixes ('LIBRARIES', 0, 'lib', 'pkglib',
                                    'noinst', 'check');
        $where->push_context ("while processing library `$onelib'");
        $where->set (INTERNAL->get);
  
 -      my $obj = get_object_extension '.$(OBJEXT)';
 +      my $obj = '.$(OBJEXT)';
  
        # Canonicalize names and check for misspellings.
        my $xlib = &check_canonical_spelling ($onelib, '_LIBADD', '_SOURCES',
              &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'")
 +      }
      }
  }
  
@@@ -2676,7 -2828,6 +2676,7 @@@ sub handle_ltlibrarie
    my @liblist = &am_install_var ('ltlib', 'LTLIBRARIES',
                                 'noinst', 'lib', 'pkglib', 'check');
    return if ! @liblist;
 +  $must_handle_compiled_objects = 1;
  
    my @prefix = am_primary_prefixes ('LTLIBRARIES', 0, 'lib', 'pkglib',
                                    'noinst', 'check');
  
                   my $onlyone = ($dir ne $adir) ?
                     ("\nLibtool libraries can be built for only one "
 -                    . "destination.") : "";
 +                    . "destination") : "";
  
                   error ($liblocations{$val}{$acond},
                          "... and should also be $adirtxt$adircond.$onlyone");
        my ($where, $onelib) = @$pair;
  
        my $seen_libobjs = 0;
 -      my $obj = get_object_extension '.lo';
 +      my $obj = '.lo';
  
        # Canonicalize names and check for misspellings.
        my $xlib = &check_canonical_spelling ($onelib, '_LIBADD', '_LDFLAGS',
              &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'")
 +      }
      }
  }
  
@@@ -2929,7 -3073,7 +2929,7 @@@ sub check_typos (
  
          for my $cond ($var->conditions->conds)
            {
 -            $varname =~ /^(?:nobase_)?(?:dist_|nodist_)?(.*)_[[:alnum:]]+$/;
 +            $varname =~ /^(?:EXTRA_)?(?:nobase_)?(?:dist_|nodist_)?(.*)_[[:alnum:]]+$/;
              msg_var ('syntax', $var, "variable `$varname' is defined but no"
                       . " program or\nlibrary has `$1' as canonical name"
                       . " (possible typo)")
@@@ -2947,7 -3091,7 +2947,7 @@@ sub handle_script
      # useful to sometimes distribute scripts verbatim.  This happens
      # e.g. in Automake itself.
      &am_install_var ('-candist', 'scripts', 'SCRIPTS',
-                    'bin', 'sbin', 'libexec', 'pkgdata',
+                    'bin', 'sbin', 'libexec', 'pkglibexec', 'pkgdata',
                     'noinst', 'check');
  }
  
@@@ -3118,9 -3262,6 +3118,9 @@@ sub output_texinfo_build_rules ($$$@
  
    $output_rules .= file_contents ('texibuild',
                                  new Automake::Location,
 +                                  AM_V_MAKEINFO    => verbose_flag('MAKEINFO'),
 +                                  AM_V_TEXI2DVI    => verbose_flag('TEXI2DVI'),
 +                                  AM_V_TEXI2PDF    => verbose_flag('TEXI2PDF'),
                                  DEPS             => "@deps",
                                  DEST_PREFIX      => $dpfx,
                                  DEST_INFO_PREFIX => $dipfx,
                                  GENERIC_INFO     => $generic_info,
                                  INSRC            => $insrc,
                                  MAKEINFOFLAGS    => $makeinfoflags,
 +                                  SILENT           => silent_flag(),
                                  SOURCE           => ($generic
                                                       ? '$<' : $source),
                                  SOURCE_INFO      => ($generic_info
                                                       ? '$<' : $source),
                                  SOURCE_REAL      => $source,
                                  SOURCE_SUFFIX    => $ssfx,
 +                                  TEXIQUIET        => verbose_flag('texinfo'),
 +                                  TEXIDEVNULL      => verbose_flag('texidevnull'),
                                  );
    return ($dirstamp, "$dpfx.dvi", "$dpfx.pdf", "$dpfx.ps", "$dpfx.html");
  }
@@@ -3447,7 -3585,6 +3447,7 @@@ sub handle_texinfo (
    my ($mostlyclean, $clean, $maintclean) = ('', '', '');
    if ($info_texinfos)
      {
 +      define_verbose_texinfo;
        ($mostlyclean, $clean, $maintclean) = handle_texinfo_helper ($info_texinfos);
        chomp $mostlyclean;
        chomp $clean;
  
    $output_rules .=  file_contents ('texinfos',
                                   new Automake::Location,
 +                                   AM_V_DVIPS    => verbose_flag('DVIPS'),
                                   MOSTLYCLEAN   => $mostlyclean,
                                   TEXICLEAN     => $clean,
                                   MAINTCLEAN    => $maintclean,
 -                                 'LOCAL-TEXIS' => !!$info_texinfos);
 +                                 'LOCAL-TEXIS' => !!$info_texinfos,
 +                                   TEXIQUIET     => verbose_flag('texinfo'));
  }
  
  
@@@ -3618,7 -3753,6 +3618,7 @@@ sub handle_tag
  {
      my @tag_deps = ();
      my @ctag_deps = ();
 +    my @cscope_deps = ();
      if (var ('SUBDIRS'))
      {
        $output_rules .= ("tags-recursive:\n"
        push (@ctag_deps, 'ctags-recursive');
        &depend ('.PHONY', 'ctags-recursive');
        &depend ('.MAKE', 'ctags-recursive');
 +
 +      $output_rules .= ("cscopelist-recursive:\n"
 +                        . "\tlist=\'\$(SUBDIRS)\'; for subdir in \$\$list; do \\\n"
 +                        # Never fail here if a subdir fails; it
 +                        # isn't important.
 +                        . "\t  test \"\$\$subdir\" = . || (\$(am__cd) \$\$subdir"
 +                        . " && \$(MAKE) \$(AM_MAKEFLAGS) cscopelist); \\\n"
 +                        . "\tdone\n");
 +      push (@cscope_deps, 'cscopelist-recursive');
 +      &depend ('.PHONY', 'cscopelist-recursive');
 +      &depend ('.MAKE', 'cscopelist-recursive');
      }
  
      if (&saw_sources_p (1)
                                         new Automake::Location,
                                         CONFIG    => "@config",
                                         TAGSDIRS  => "@tag_deps",
 -                                       CTAGSDIRS => "@ctag_deps");
 +                                       CTAGSDIRS => "@ctag_deps",
 +                                       CSCOPEDIRS => "@cscope_deps");
  
        set_seen 'TAGS_DEPENDENCIES';
      }
      elsif (reject_var ('TAGS_DEPENDENCIES',
 -                     "doesn't make sense to define `TAGS_DEPENDENCIES'"
 -                     . "without\nsources or `ETAGS_ARGS'"))
 +                     "it doesn't make sense to define `TAGS_DEPENDENCIES'"
 +                     . " without\nsources or `ETAGS_ARGS'"))
      {
      }
      else
        # Otherwise, it would be possible for a top-level "make TAGS"
        # to fail because some subdirectory failed.
        $output_rules .= "tags: TAGS\nTAGS:\n\n";
 -      # Ditto ctags.
 +      # Ditto ctags and cscope.
        $output_rules .= "ctags: CTAGS\nCTAGS:\n\n";
 +      $output_rules .= "cscope cscopelist:\n\n";
      }
  }
  
@@@ -3805,7 -3926,7 +3805,7 @@@ sub handle_dist (
        $archive_defined ||=
        grep { option "dist-$_" } qw(shar zip tarZ bzip2 lzip lzma xz);
        error (option 'no-dist-gzip',
 -           "no-dist-gzip specified but no dist-* specified, "
 +           "no-dist-gzip specified but no dist-* specified,\n"
             . "at least one archive format must be enabled")
        unless $archive_defined;
      }
    # directory, we would have discovered it already, so we don't
    # check that.  But if the file is in a subdir without a Makefile,
    # we want to distribute it here if we are doing `.'.  Ugly!
 +  # Also, in some corner cases, it's possible that the following code
 +  # will cause the same file to appear in the $(DIST_COMMON) variables
 +  # of two distinct Makefiles; but this is not a problem, since the
 +  # `distdir' target in `lib/am/distdir.am' can deal with the same
 +  # file being distributed multiple times.
 +  # See also automake bug#9651.
    if ($relative_dir eq '.')
      {
        foreach my $file (split (' ' , $configure_dist_common))
        {
 +        my $dir = dirname ($file);
          push_dist_common ($file)
 -          unless is_make_dir (dirname ($file));
 +          if ($dir eq '.' || ! is_make_dir ($dir));
        }
      }
  
  }
  
  
 -# check_directory ($NAME, $WHERE)
 -# -------------------------------
 -# Ensure $NAME is a directory, and that it uses a sane name.
 -# Use $WHERE as a location in the diagnostic, if any.
 -sub check_directory ($$)
 +# check_directory ($NAME, $WHERE [, $RELATIVE_DIR = "."])
 +# -------------------------------------------------------
 +# Ensure $NAME is a directory (in $RELATIVE_DIR), and that it uses a sane
 +# name.  Use $WHERE as a location in the diagnostic, if any.
 +sub check_directory ($$;$)
  {
 -  my ($dir, $where) = @_;
 +  my ($dir, $where, $reldir) = @_;
 +  $reldir = '.' unless defined $reldir;
  
 -  error $where, "required directory $relative_dir/$dir does not exist"
 -    unless -d "$relative_dir/$dir";
 +  error $where, "required directory $reldir/$dir does not exist"
 +    unless -d "$reldir/$dir";
  
    # If an `obj/' directory exists, BSD make will enter it before
    # reading `Makefile'.  Hence the `Makefile' in the current directory
@@@ -3946,7 -4059,7 +3946,7 @@@ sub check_directories_in_var ($
      (sub
       {
         my ($var, $val, $cond, $full_cond) = @_;
 -       check_directory ($val, $var->rdef ($cond)->location);
 +       check_directory ($val, $var->rdef ($cond)->location, $relative_dir);
         return ();
       },
       undef,
@@@ -4000,7 -4113,7 +4000,7 @@@ sub scan_aclocal_m4 (
        push (@ac_deps, '$(ACLOCAL_M4_SOURCES)');
        msg_var ('obsolete', 'ACLOCAL_M4_SOURCES',
               "`ACLOCAL_M4_SOURCES' is obsolete.\n"
 -             . "It should be safe to simply remove it.");
 +             . "It should be safe to simply remove it");
      }
  
    # Note that it might be possible that aclocal.m4 doesn't exist but
@@@ -4812,58 -4925,6 +4812,58 @@@ sub handle_tests_dejagn
      $output_rules .= file_contents ('dejagnu', new Automake::Location);
  }
  
 +sub handle_per_suffix_test
 +{
 +  my ($test_suffix, %transform) = @_;
 +  my ($pfx, $generic, $parallel_tests_option, $am_exeext);
 +  prog_error ("called with 'parallel-tests' option not set")
 +    unless $parallel_tests_option = option 'parallel-tests';
 +  if ($test_suffix eq '')
 +    {
 +      $pfx = '';
 +      $generic = 0;
 +      $am_exeext = 'FALSE';
 +    }
 +  else
 +    {
 +      prog_error ("test suffix `$test_suffix' lacks leading dot")
 +        unless $test_suffix =~ m/^\.(.*)/;
 +      $pfx = uc ($1) . '_';
 +      $generic = 1;
 +      $am_exeext = exists $configure_vars{'EXEEXT'} ? 'am__EXEEXT'
 +                                                    : 'FALSE';
 +    }
 +  # The "test driver" program, deputed to handle tests protocol used by
 +  # test scripts.  By default, it's assumed that no protocol is used,
 +  # so we fall back to the old "parallel-tests" behaviour, implemented
 +  # by the `test-driver' auxiliary script.
 +  if (! var "${pfx}LOG_DRIVER")
 +    {
 +      require_conf_file ($parallel_tests_option->{position}, FOREIGN,
 +                        'test-driver');
 +      define_variable ("${pfx}LOG_DRIVER",
 +                       "\$(SHELL) $am_config_aux_dir/test-driver",
 +                       INTERNAL);
 +    }
 +  my $driver = '$(' . $pfx . 'LOG_DRIVER)';
 +  my $driver_flags = '$(AM_' . $pfx . 'LOG_DRIVER_FLAGS)'
 +                       . ' $(' . $pfx . 'LOG_DRIVER_FLAGS)';
 +  my $compile = "${pfx}LOG_COMPILE";
 +  define_variable ($compile,
 +                   '$(' . $pfx . 'LOG_COMPILER)'
 +                      . ' $(AM_' .  $pfx . 'LOG_FLAGS)'
 +                      . ' $(' . $pfx . 'LOG_FLAGS)',
 +                     INTERNAL);
 +  $output_rules .= file_contents ('check2', new Automake::Location,
 +                                   GENERIC => $generic,
 +                                   DRIVER => $driver,
 +                                   DRIVER_FLAGS => $driver_flags,
 +                                   COMPILE => '$(' . $compile . ')',
 +                                   EXT => $test_suffix,
 +                                   am__EXEEXT => $am_exeext,
 +                                   %transform);
 +}
 +
  # is_valid_test_extension ($EXT)
  # ------------------------------
  # Return true if $EXT can appear in $(TEST_EXTENSIONS), return false
@@@ -4907,7 -4968,7 +4907,7 @@@ sub handle_test
        append_exeext { exists $known_programs{$_[0]} } 'XFAIL_TESTS'
        if (var ('XFAIL_TESTS'));
  
 -      if (option 'parallel-tests')
 +      if (my $parallel_tests = option 'parallel-tests')
          {
          define_variable ('TEST_SUITE_LOG', 'test-suite.log', INTERNAL);
          define_variable ('TEST_SUITE_HTML', '$(TEST_SUITE_LOG:.log=.html)', INTERNAL);
                    return substr ($obj, 0, length ($obj) - length ($test_suffix)) . '.log'
                      if substr ($obj, - length ($test_suffix)) eq $test_suffix;
                  }
 +              my $base = $obj;
                $obj .= '.log';
 -              my $compile = 'LOG_COMPILE';
 -              define_variable ($compile,
 -                               '$(LOG_COMPILER) $(AM_LOG_FLAGS) $(LOG_FLAGS)', INTERNAL);
 -              $output_rules .= file_contents ('check2', new Automake::Location,
 -                                              GENERIC => 0,
 -                                              OBJ => $obj,
 -                                              SOURCE => $val,
 -                                              COMPILE =>'$(' . $compile . ')',
 -                                              EXT => '',
 -                                              am__EXEEXT => 'FALSE');
 +                handle_per_suffix_test ('',
 +                                        OBJ => $obj,
 +                                        BASE => $base,
 +                                        SOURCE => $val);
                return $obj;
              });
  
              $nhelper++;
              if ($test_suffix ne $at_exeext && $test_suffix ne '')
                {
 -                (my $ext = $test_suffix) =~ s/^\.//;
 -                $ext = uc $ext;
 -                my $compile = $ext . '_LOG_COMPILE';
 -                define_variable ($compile,
 -                                 '$(' . $ext . '_LOG_COMPILER) $(AM_' .  $ext . '_LOG_FLAGS)'
 -                                 . ' $(' . $ext . '_LOG_FLAGS)', INTERNAL);
 -                my $am_exeext = $handle_exeext ? 'am__EXEEXT' : 'FALSE';
 -                $output_rules .= file_contents ('check2', new Automake::Location,
 -                                                GENERIC => 1,
 -                                                OBJ => '',
 -                                                SOURCE => '$<',
 -                                                COMPILE => '$(' . $compile . ')',
 -                                                EXT => $test_suffix,
 -                                                am__EXEEXT => $am_exeext);
 +                  handle_per_suffix_test ($test_suffix,
 +                                          OBJ => '',
 +                                          BASE => '$*',
 +                                          SOURCE => '$<');
                }
            }
 -
 -        define_variable ('TEST_LOGS_TMP', '$(TEST_LOGS:.log=.log-t)', INTERNAL);
 -
 -        $clean_files{'$(TEST_LOGS_TMP)'} = MOSTLY_CLEAN;
          $clean_files{'$(TEST_LOGS)'} = MOSTLY_CLEAN;
 +        $clean_files{'$(TEST_LOGS:.log=.trs)'} = MOSTLY_CLEAN;
          $clean_files{'$(TEST_SUITE_LOG)'} = MOSTLY_CLEAN;
          $clean_files{'$(TEST_SUITE_HTML)'} = MOSTLY_CLEAN;
        }
@@@ -5175,8 -5254,8 +5175,8 @@@ sub scan_autoconf_config_files ($$
        my ($local, @rest) = split (/:/);
        @rest = ("$local.in",) unless @rest;
        msg ('portability', $where,
 -        "Omit leading `./' from config file names such as `$local',"
 -        . "\nas not all make implementations treat `file' and `./file' equally.")
 +        "omit leading `./' from config file names such as `$local',"
 +        . "\nas not all make implementations treat `file' and `./file' equally")
        if ($local =~ /^\.\//);
        my $input = locate_am @rest;
        if ($input)
@@@ -5229,7 -5308,6 +5229,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,
          if ($seen_init_automake)
            {
              error ($where, "AC_CONFIG_AUX_DIR must be called before "
 -                   . "AM_INIT_AUTOMAKE...", partial => 1);
 +                   . "AM_INIT_AUTOMAKE ...", partial => 1);
              error ($seen_init_automake, "... AM_INIT_AUTOMAKE called here");
            }
          $config_aux_dir = $args[1];
          $config_aux_dir_set_in_configure_ac = 1;
 -        $relative_dir = '.';
          check_directory ($config_aux_dir, $where);
        }
        elsif ($macro eq 'AC_CONFIG_FILES')
        elsif ($macro eq 'AC_CONFIG_LIBOBJ_DIR')
        {
          $config_libobj_dir = $args[1];
 -        $relative_dir = '.';
          check_directory ($config_libobj_dir, $where);
        }
        elsif ($macro eq 'AC_CONFIG_LINKS')
            }
          elsif (defined $args[1])
            {
 -            exit $exit_code
 -              if (process_global_option_list ($where,
 -                                              split (' ', $args[1])));
 +            my @opts = split (' ', $args[1]);
 +            @opts = map { { option => $_, where => $where } } @opts;
 +            exit $exit_code if process_global_option_list (@opts);
            }
        }
        elsif ($macro eq 'AM_MAINTAINER_MODE')
        {
          $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;
@@@ -5539,7 -5615,7 +5539,7 @@@ sub scan_autoconf_files (
              . "should verify that $configure_ac invokes AM_INIT_AUTOMAKE,"
              . "\nthat aclocal.m4 is present in the top-level directory,\n"
              . "and that aclocal.m4 was recently regenerated "
 -            . "(using aclocal).");
 +            . "(using aclocal)");
      }
    else
      {
              error ($seen_init_automake,
                     "your implementation of AM_INIT_AUTOMAKE comes from " .
                     "an\nold Automake version.  You should recreate " .
 -                   "aclocal.m4\nwith aclocal and run automake again.\n",
 +                   "aclocal.m4\nwith aclocal and run automake again",
                     # $? = 63 is used to indicate version mismatch to missing.
                     exit_code => 63);
            }
            {
              error ($seen_init_automake,
                     "no proper implementation of AM_INIT_AUTOMAKE was " .
 -                   "found,\nprobably because aclocal.m4 is missing...\n" .
 +                   "found,\nprobably because aclocal.m4 is missing.\n" .
                     "You should run aclocal to create this file, then\n" .
 -                   "run automake again.\n");
 +                   "run automake again");
            }
        }
      }
  
    locate_aux_dir ();
  
 -  # Reorder @input_files so that the Makefile that distributes aux
 -  # files is processed last.  This is important because each directory
 -  # can require auxiliary scripts and we should wait until they have
 -  # been installed before distributing them.
 -
 -  # The Makefile.in that distribute the aux files is the one in
 -  # $config_aux_dir or the top-level Makefile.
 -  my $auxdirdist = is_make_dir ($config_aux_dir) ? $config_aux_dir : '.';
 -  my @new_input_files = ();
 -  while (@input_files)
 -    {
 -      my $in = pop @input_files;
 -      my @ins = split (/:/, $output_files{$in});
 -      if (dirname ($ins[0]) eq $auxdirdist)
 -      {
 -        push @new_input_files, $in;
 -        $automake_will_process_aux_dir = 1;
 -      }
 -      else
 -      {
 -        unshift @new_input_files, $in;
 -      }
 -    }
 -  @input_files = @new_input_files;
 -
 -  # If neither the auxdir/Makefile nor the ./Makefile are generated
 -  # by Automake, we won't distribute the aux files anyway.  Assume
 -  # the user know what (s)he does, and pretend we will distribute
 -  # them to disable the error in require_file_internal.
 -  $automake_will_process_aux_dir = 1 if ! is_make_dir ($auxdirdist);
 -
    # Look for some files we need.  Always check for these.  This
    # check must be done for every run, even those where we are only
    # looking at a subdir Makefile.  We must set relative_dir for
 -  # maybe_push_required_file to work.
 +  # push_required_file to work.
    # Sort the files for stable verbose output.
    $relative_dir = '.';
    foreach my $file (sort keys %required_aux_file)
@@@ -5669,7 -5776,13 +5669,7 @@@ sub lang_sub_ob
  # Rewrite a single C source file.
  sub lang_c_rewrite
  {
 -  my ($directory, $base, $ext, $nonansi_obj, $have_per_exec_flags, $var) = @_;
 -
 -  if (option 'ansi2knr' && $base =~ /_$/)
 -    {
 -      # FIXME: include line number in error.
 -      err_am "C source file `$base.c' would be deleted by ansi2knr rules";
 -    }
 +  my ($directory, $base, $ext, $obj, $have_per_exec_flags, $var) = @_;
  
    my $r = LANG_PROCESS;
    if (option 'subdir-objects')
                   . "`AM_PROG_CC_C_O' in `$configure_ac'",
                   uniq_scope => US_GLOBAL,
                   uniq_part => 'AM_PROG_CC_C_O subdir')
 -          unless $seen_cc_c_o || $nonansi_obj eq '.lo';
 +          unless $seen_cc_c_o || $obj eq '.lo';
        }
 -
 -      # In this case we already have the directory information, so
 -      # don't add it again.
 -      $de_ansi_files{$base} = '';
 -    }
 -  else
 -    {
 -      $de_ansi_files{$base} = (($directory eq '.' || $directory eq '')
 -                             ? ''
 -                             : "$directory/");
      }
  
    if (! $seen_cc_c_o
        && $have_per_exec_flags
        && ! option 'subdir-objects'
 -      && $nonansi_obj ne '.lo')
 +      && $obj ne '.lo')
      {
        msg_var ('portability',
               $var, "compiling `$base.c' with per-target flags requires "
@@@ -5832,6 -5955,59 +5832,6 @@@ sub lang_java_rewrit
  # language, etc.  A finish function is only called if a source file of
  # the appropriate type has been seen.
  
 -sub lang_c_finish
 -{
 -    # Push all libobjs files onto de_ansi_files.  We actually only
 -    # push files which exist in the current directory, and which are
 -    # genuine source files.
 -    foreach my $file (keys %libsources)
 -    {
 -      if ($file =~ /^(.*)\.[cly]$/ && -f "$relative_dir/$file")
 -      {
 -          $de_ansi_files{$1} = ''
 -      }
 -    }
 -
 -    if (option 'ansi2knr' && keys %de_ansi_files)
 -    {
 -      # Make all _.c files depend on their corresponding .c files.
 -      my @objects;
 -      foreach my $base (sort keys %de_ansi_files)
 -      {
 -          # Each _.c file must depend on ansi2knr; otherwise it
 -          # might be used in a parallel build before it is built.
 -          # We need to support files in the srcdir and in the build
 -          # dir (because these files might be auto-generated.  But
 -          # we can't use $< -- some makes only define $< during a
 -          # suffix rule.
 -          my $ansfile = $de_ansi_files{$base} . $base . '.c';
 -          $output_rules .= ($base . "_.c: $ansfile \$(ANSI2KNR)\n\t"
 -                            . '$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) '
 -                            . '`if test -f $(srcdir)/' . $ansfile
 -                            . '; then echo $(srcdir)/' . $ansfile
 -                            . '; else echo ' . $ansfile . '; fi` '
 -                            . "| sed 's/^# \\([0-9]\\)/#line \\1/' "
 -                            . '| $(ANSI2KNR) > $@'
 -                            # If ansi2knr fails then we shouldn't
 -                            # create the _.c file
 -                            . " || rm -f \$\@\n");
 -          push (@objects, $base . '_.$(OBJEXT)');
 -          push (@objects, $base . '_.lo')
 -            if var ('LIBTOOL');
 -
 -          # Explicitly clean the _.c files if they are in a
 -          # subdirectory. (In the current directory they get erased
 -          # by a `rm -f *_.c' rule.)
 -          $clean_files{$base . '_.c'} = MOSTLY_CLEAN
 -            if dirname ($base) ne '.';
 -      }
 -
 -      # Make all _.o (and _.lo) files depend on ansi2knr.
 -      # Use a sneaky little hack to make it print nicely.
 -      &pretty_print_rule ('', '', @objects, ':', '$(ANSI2KNR)');
 -    }
 -}
 -
  sub lang_vala_finish_target ($$)
  {
    my ($self, $name) = @_;
@@@ -5943,29 -6119,12 +5943,29 @@@ sub lang_yacc_target_hoo
  {
      my ($self, $aggregate, $output, $input, %transform) = @_;
  
 -    my $flag = $aggregate . "_YFLAGS";
 -    my $flagvar = var $flag;
 -    my $YFLAGSvar = var 'YFLAGS';
 -    if (($flagvar && $flagvar->variable_value =~ /$DASH_D_PATTERN/o)
 -      || ($YFLAGSvar && $YFLAGSvar->variable_value =~ /$DASH_D_PATTERN/o))
 -    {
 +    # If some relevant *YFLAGS variable contains the `-d' flag, we'll
 +    # have to to generate special code.
 +    my $yflags_contains_minus_d = 0;
 +
 +    foreach my $pfx ("", "${aggregate}_")
 +      {
 +      my $yflagsvar = var ("${pfx}YFLAGS");
 +      next unless $yflagsvar;
 +      # We cannot work reliably with conditionally-defined YFLAGS.
 +      if ($yflagsvar->has_conditional_contents)
 +        {
 +          msg_var ('unsupported', $yflagsvar,
 +                   "`${pfx}YFLAGS' cannot have conditional contents");
 +        }
 +      else
 +        {
 +          $yflags_contains_minus_d = 1
 +            if grep (/^-d$/, $yflagsvar->value_as_list_recursive);
 +        }
 +      }
 +
 +    if ($yflags_contains_minus_d)
 +      {
        (my $output_base = $output) =~ s/$KNOWN_EXTENSIONS_PATTERN$//;
        my $header = $output_base . '.h';
  
        &push_dist_common ($header)
          if $transform{'DIST_SOURCE'};
  
 -      # If the files are built in the build directory, then we want
 -      # to remove them with `make clean'.  If they are in srcdir
 -      # they shouldn't be touched.  However, we can't determine this
 -      # statically, and the GNU rules say that yacc/lex output files
 -      # should be removed by maintainer-clean.  So that's what we
 -      # do.
 -      $clean_files{$header} = MAINTAINER_CLEAN;
 -    }
 -    # Erase $OUTPUT on `make maintainer-clean' (by GNU standards).
 +      # The GNU rules say that yacc/lex output files should be removed
 +      # by maintainer-clean.  However, if the files are not distributed,
 +      # then we want to remove them with "make clean"; otherwise,
 +      # "make distcheck" will fail.
 +      $clean_files{$header} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : CLEAN;
 +      }
      # See the comment above for $HEADER.
 -    $clean_files{$output} = MAINTAINER_CLEAN;
 +    $clean_files{$output} = $transform{'DIST_SOURCE'} ? MAINTAINER_CLEAN : CLEAN;
  }
  
  # This is a lex helper which is called whenever we have decided to
@@@ -6141,6 -6303,8 +6141,6 @@@ sub register_language (%
    my (%option) = @_;
  
    # Set the defaults.
 -  $option{'ansi'} = 0
 -    unless defined $option{'ansi'};
    $option{'autodep'} = 'no'
      unless defined $option{'autodep'};
    $option{'linker'} = ''
@@@ -6265,7 -6429,7 +6265,7 @@@ sub cond_stack_if ($$$
          my $mac = $_am_macro_for_cond{$cond};
          $text .= "\n  The usual way to define `$cond' is to add ";
          $text .= ($mac =~ / /) ? $mac : "`$mac'";
 -        $text .= "\n  to `$configure_ac' and run `aclocal' and `autoconf' again.";
 +        $text .= "\n  to `$configure_ac' and run `aclocal' and `autoconf' again";
          # These warnings appear in Automake files (depend2.am),
          # so there is no need to display them more than once:
          $scope = US_GLOBAL;
@@@ -6397,11 -6561,22 +6397,11 @@@ sub define_files_variable ($\@$$
  sub define_configure_variable ($)
  {
    my ($var) = @_;
 -
 -  my $pretty = VAR_ASIS;
 -  my $owner = VAR_CONFIGURE;
 -
    # Some variables we do not want to output.  For instance it
    # would be a bad idea to output `U = @U@` when `@U@` can be
    # substituted as `\`.
 -  $pretty = VAR_SILENT if exists $ignored_configure_vars{$var};
 -
 -  # ANSI2KNR is a variable that Automake wants to redefine, so
 -  # it must be owned by Automake.  (It is also used as a proof
 -  # that AM_C_PROTOTYPES has been run, that's why we do not simply
 -  # omit the AC_SUBST.)
 -  $owner = VAR_AUTOMAKE if $var eq 'ANSI2KNR';
 -
 -  Automake::Variable::define ($var, $owner, '', TRUE, subst $var,
 +  my $pretty = exists $ignored_configure_vars{$var} ? VAR_SILENT : VAR_ASIS;
 +  Automake::Variable::define ($var, VAR_CONFIGURE, '', TRUE, subst $var,
                              '', $configure_vars{$var}, $pretty);
  }
  
@@@ -7597,42 -7772,18 +7597,42 @@@ sub locate_aux_dir (
  }
  
  
 -# &maybe_push_required_file ($DIR, $FILE, $FULLFILE)
 +# &push_required_file ($DIR, $FILE, $FULLFILE)
  # --------------------------------------------------
 -# See if we want to push this file onto dist_common.  This function
 -# encodes the rules for deciding when to do so.
 -sub maybe_push_required_file
 +# Push the given file onto DIST_COMMON.
 +sub push_required_file
  {
    my ($dir, $file, $fullfile) = @_;
  
 +  # If the file to be distributed is in the same directory of the
 +  # currently processed Makefile.am, then we want to distribute it
 +  # from this same Makefile.am.
    if ($dir eq $relative_dir)
      {
        push_dist_common ($file);
 -      return 1;
 +    }
 +  # This is needed to allow a construct in a non-top-level Makefile.am
 +  # to require a file in the build-aux directory (see at least the test
 +  # script `test-driver-is-distributed.test').  This is related to the
 +  # automake bug#9546.  Note that the use of $config_aux_dir instead
 +  # of $am_config_aux_dir here is deliberate and necessary.
 +  elsif ($dir eq $config_aux_dir)
 +    {
 +      push_dist_common ("$am_config_aux_dir/$file");
 +    }
 +  # FIXME: another spacial case, for AC_LIBOBJ/AC_LIBSOURCE support.
 +  # We probably need some refactoring of this function and its callers,
 +  # to have a more explicit and systematic handling of all the special
 +  # cases; but, since there are only two of them, this is low-priority
 +  # ATM.
 +  elsif ($config_libobj_dir && $dir eq $config_libobj_dir)
 +    {
 +      # Avoid unsightly '/.'s.
 +      my $am_config_libobj_dir =
 +        '$(top_srcdir)' .
 +        ($config_libobj_dir eq '.' ? "" : "/$config_libobj_dir");
 +      $am_config_libobj_dir =~ s|/*$||;
 +      push_dist_common ("$am_config_libobj_dir/$file");
      }
    elsif ($relative_dir eq '.' && ! &is_make_dir ($dir))
      {
        if $dir =~ m,^\.\.(?:$|/),;
  
        push_dist_common ($fullfile);
 -      return 1;
      }
 -  return 0;
 +  else
 +    {
 +      prog_error "a Makefile in relative directory $relative_dir " .
 +                 "can't add files in directory $dir to DIST_COMMON";
 +    }
  }
  
  
  # than once.
  my %required_file_not_found = ();
  
 -# &require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, @FILES)
 -# --------------------------------------------------------------
 +# &required_file_check_or_copy ($WHERE, $DIRECTORY, $FILE)
 +# --------------------------------------------------------
  # Verify that the file must exist in $DIRECTORY, or install it.
 -# $MYSTRICT is the strictness level at which this file becomes required.
 -sub require_file_internal ($$$@)
 +sub required_file_check_or_copy ($$$)
  {
 -  my ($where, $mystrict, $dir, @files) = @_;
 +  my ($where, $dir, $file) = @_;
  
 -  foreach my $file (@files)
 +  my $fullfile = "$dir/$file";
 +  my $found_it = 0;
 +  my $dangling_sym = 0;
 +
 +  if (-l $fullfile && ! -f $fullfile)
 +    {
 +      $dangling_sym = 1;
 +    }
 +  elsif (dir_has_case_matching_file ($dir, $file))
      {
 -      my $fullfile = "$dir/$file";
 -      my $found_it = 0;
 -      my $dangling_sym = 0;
 +      $found_it = 1;
 +    }
  
 -      if (-l $fullfile && ! -f $fullfile)
 -      {
 -        $dangling_sym = 1;
 -      }
 -      elsif (dir_has_case_matching_file ($dir, $file))
 -      {
 -        $found_it = 1;
 -        maybe_push_required_file ($dir, $file, $fullfile);
 -      }
 +  # `--force-missing' only has an effect if `--add-missing' is
 +  # specified.
 +  return
 +    if $found_it && (! $add_missing || ! $force_missing);
  
 -      # `--force-missing' only has an effect if `--add-missing' is
 -      # specified.
 -      if ($found_it && (! $add_missing || ! $force_missing))
 -      {
 -        next;
 -      }
 -      else
 -      {
 -        # If we've already looked for it, we're done.  You might
 -        # wonder why we don't do this before searching for the
 -        # file.  If we do that, then something like
 -        # AC_OUTPUT(subdir/foo foo) will fail to put foo.in into
 -        # DIST_COMMON.
 -        if (! $found_it)
 -          {
 -            next if defined $required_file_not_found{$fullfile};
 -            $required_file_not_found{$fullfile} = 1;
 -          }
 +  # If we've already looked for it, we're done.  You might
 +  # wonder why we don't do this before searching for the
 +  # file.  If we do that, then something like
 +  # AC_OUTPUT(subdir/foo foo) will fail to put foo.in into
 +  # DIST_COMMON.
 +  if (! $found_it)
 +    {
 +      return if defined $required_file_not_found{$fullfile};
 +      $required_file_not_found{$fullfile} = 1;
 +    }
 +  if ($dangling_sym && $add_missing)
 +    {
 +      unlink ($fullfile);
 +    }
  
 -        if ($strictness >= $mystrict)
 -          {
 -            if ($dangling_sym && $add_missing)
 -              {
 -                unlink ($fullfile);
 -              }
 +  my $trailer = '';
 +  my $trailer2 = '';
 +  my $suppress = 0;
  
 -            my $trailer = '';
 -            my $trailer2 = '';
 -            my $suppress = 0;
 +  # Only install missing files according to our desired
 +  # strictness level.
 +  my $message = "required file `$fullfile' not found";
 +  if ($add_missing)
 +    {
 +      if (-f "$libdir/$file")
 +        {
 +          $suppress = 1;
  
 -            # Only install missing files according to our desired
 -            # strictness level.
 -            my $message = "required file `$fullfile' not found";
 -            if ($add_missing)
 -              {
 -                if (-f "$libdir/$file")
 -                  {
 -                    $suppress = 1;
 -
 -                    # Install the missing file.  Symlink if we
 -                    # can, copy if we must.  Note: delete the file
 -                    # first, in case it is a dangling symlink.
 -                    $message = "installing `$fullfile'";
 -
 -                    # The license file should not be volatile.
 -                    if ($file eq "COPYING")
 -                      {
 -                        $message .= " using GNU General Public License v3 file";
 -                        $trailer2 = "\n    Consider adding the COPYING file"
 -                                  . " to the version control system"
 -                                  . "\n    for your code, to avoid questions"
 -                                  . " about which license your project uses.";
 -                      }
 +          # Install the missing file.  Symlink if we
 +          # can, copy if we must.  Note: delete the file
 +          # first, in case it is a dangling symlink.
 +          $message = "installing `$fullfile'";
  
 -                    # Windows Perl will hang if we try to delete a
 -                    # file that doesn't exist.
 -                    unlink ($fullfile) if -f $fullfile;
 -                    if ($symlink_exists && ! $copy_missing)
 -                      {
 -                        if (! symlink ("$libdir/$file", $fullfile)
 -                            || ! -e $fullfile)
 -                          {
 -                            $suppress = 0;
 -                            $trailer = "; error while making link: $!";
 -                          }
 -                      }
 -                    elsif (system ('cp', "$libdir/$file", $fullfile))
 -                      {
 -                        $suppress = 0;
 -                        $trailer = "\n    error while copying";
 -                      }
 -                    set_dir_cache_file ($dir, $file);
 -                  }
 +          # The license file should not be volatile.
 +          if ($file eq "COPYING")
 +            {
 +              $message .= " using GNU General Public License v3 file";
 +              $trailer2 = "\n    Consider adding the COPYING file"
 +                        . " to the version control system"
 +                        . "\n    for your code, to avoid questions"
 +                        . " about which license your project uses";
 +            }
  
 -                if (! maybe_push_required_file (dirname ($fullfile),
 -                                                $file, $fullfile))
 -                  {
 -                    if (! $found_it && ! $automake_will_process_aux_dir)
 -                      {
 -                        # We have added the file but could not push it
 -                        # into DIST_COMMON, probably because this is
 -                        # an auxiliary file and we are not processing
 -                        # the top level Makefile.  Furthermore Automake
 -                        # hasn't been asked to create the Makefile.in
 -                        # that distributes the aux dir files.
 -                        error ($where, 'Please make a full run of automake'
 -                               . " so $fullfile gets distributed.");
 -                      }
 -                  }
 -              }
 -            else
 -              {
 -                $trailer = "\n  `automake --add-missing' can install `$file'"
 -                  if -f "$libdir/$file";
 -              }
 +          # Windows Perl will hang if we try to delete a
 +          # file that doesn't exist.
 +          unlink ($fullfile) if -f $fullfile;
 +          if ($symlink_exists && ! $copy_missing)
 +            {
 +              if (! symlink ("$libdir/$file", $fullfile)
 +                  || ! -e $fullfile)
 +                {
 +                  $suppress = 0;
 +                  $trailer = "; error while making link: $!";
 +                }
 +            }
 +          elsif (system ('cp', "$libdir/$file", $fullfile))
 +            {
 +              $suppress = 0;
 +              $trailer = "\n    error while copying";
 +            }
 +          set_dir_cache_file ($dir, $file);
 +        }
 +    }
 +  else
 +    {
 +      $trailer = "\n  `automake --add-missing' can install `$file'"
 +        if -f "$libdir/$file";
 +    }
  
 -            # If --force-missing was specified, and we have
 -            # actually found the file, then do nothing.
 -            next
 -              if $found_it && $force_missing;
 +  # If --force-missing was specified, and we have
 +  # actually found the file, then do nothing.
 +  return
 +    if $found_it && $force_missing;
  
 -            # If we couldn't install the file, but it is a target in
 -            # the Makefile, don't print anything.  This allows files
 -            # like README, AUTHORS, or THANKS to be generated.
 -            next
 -              if !$suppress && rule $file;
 +  # If we couldn't install the file, but it is a target in
 +  # the Makefile, don't print anything.  This allows files
 +  # like README, AUTHORS, or THANKS to be generated.
 +  return
 +    if !$suppress && rule $file;
  
 -            msg ($suppress ? 'note' : 'error', $where, "$message$trailer$trailer2");
 -          }
 -      }
 +  msg ($suppress ? 'note' : 'error', $where, "$message$trailer$trailer2");
 +}
 +
 +
 +# &require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, $QUEUE, @FILES)
 +# ----------------------------------------------------------------------
 +# Verify that the file must exist in $DIRECTORY, or install it.
 +# $MYSTRICT is the strictness level at which this file becomes required.
 +# Worker threads may queue up the action to be serialized by the master,
 +# if $QUEUE is true
 +sub require_file_internal ($$$@)
 +{
 +  my ($where, $mystrict, $dir, $queue, @files) = @_;
 +
 +  return
 +    unless $strictness >= $mystrict;
 +
 +  foreach my $file (@files)
 +    {
 +      push_required_file ($dir, $file, "$dir/$file");
 +      if ($queue)
 +        {
 +          queue_required_file_check_or_copy ($required_conf_file_queue,
 +                                             QUEUE_CONF_FILE, $relative_dir,
 +                                             $where, $mystrict, @files);
 +        }
 +      else
 +        {
 +          required_file_check_or_copy ($where, $dir, $file);
 +        }
      }
  }
  
  sub require_file ($$@)
  {
      my ($where, $mystrict, @files) = @_;
 -    require_file_internal ($where, $mystrict, $relative_dir, @files);
 +    require_file_internal ($where, $mystrict, $relative_dir, 0, @files);
  }
  
  # &require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
@@@ -7850,7 -7997,7 +7850,7 @@@ sub require_libsource_with_macro ($$$@
      if ($config_libobj_dir)
        {
        require_file_internal ($macro->rdef ($cond)->location, $mystrict,
 -                             $config_libobj_dir, @files);
 +                             $config_libobj_dir, 0, @files);
        }
      else
        {
        }
  }
  
 -# Queue to push require_conf_file requirements to.
 -my $required_conf_file_queue;
 -
 -# &queue_required_conf_file ($QUEUE, $KEY, $DIR, $WHERE, $MYSTRICT, @FILES)
 -# -------------------------------------------------------------------------
 -sub queue_required_conf_file ($$$$@)
 +# &queue_required_file_check_or_copy ($QUEUE, $KEY, $DIR, $WHERE,
 +#                                     $MYSTRICT, @FILES)
 +# ---------------------------------------------------------------
 +sub queue_required_file_check_or_copy ($$$$@)
  {
      my ($queue, $key, $dir, $where, $mystrict, @files) = @_;
      my @serial_loc;
      $queue->enqueue ($key, $dir, @serial_loc, $mystrict, 0 + @files, @files);
  }
  
 -# &require_queued_conf_file ($QUEUE)
 -# ----------------------------------
 -sub require_queued_conf_file ($)
 +# &require_queued_file_check_or_copy ($QUEUE)
 +# -------------------------------------------
 +sub require_queued_file_check_or_copy ($)
  {
      my ($queue) = @_;
      my $where;
      my @files;
      push @files, $queue->dequeue ()
        foreach (1 .. $nfiles);
 -
 -    # Dequeuing happens outside of per-makefile context, so we have to
 -    # set the variables used by require_file_internal and the functions
 -    # it calls.  Gross!
 -    $relative_dir = $dir;
 -    require_file_internal ($where, $mystrict, $config_aux_dir, @files);
 +    return
 +      unless $strictness >= $mystrict;
 +    foreach my $file (@files)
 +      {
 +        required_file_check_or_copy ($where, $config_aux_dir, $file);
 +      }
  }
  
  # &require_conf_file ($WHERE, $MYSTRICT, @FILES)
  # ----------------------------------------------
 -# Looks in configuration path, as specified by AC_CONFIG_AUX_DIR;
 -# worker threads may queue up the action to be serialized by the master.
 -#
 -# FIXME: this seriously relies on the semantics of require_file_internal
 -# and maybe_push_required_file, in that we exploit the fact that only the
 -# contents of the last handled output file may be impacted (which in turn
 -# is dealt with by the master thread).
 +# Looks in configuration path, as specified by AC_CONFIG_AUX_DIR.
  sub require_conf_file ($$@)
  {
      my ($where, $mystrict, @files) = @_;
 -    if (defined $required_conf_file_queue)
 -      {
 -      queue_required_conf_file ($required_conf_file_queue, QUEUE_CONF_FILE,
 -                                $relative_dir, $where, $mystrict, @files);
 -      }
 -    else
 -      {
 -      require_file_internal ($where, $mystrict, $config_aux_dir, @files);
 -      }
 +    my $queue = defined $required_conf_file_queue ? 1 : 0;
 +    require_file_internal ($where, $mystrict, $config_aux_dir,
 +                           $queue, @files);
  }
  
  
@@@ -8144,13 -8305,18 +8144,13 @@@ sub generate_makefile ($$
  
    check_typos;
  
 -  my ($out_file) = $output_directory . '/' . $makefile_in;
 -
    if ($exit_code != 0)
      {
 -      verb "not writing $out_file because of earlier errors";
 +      verb "not writing $makefile_in because of earlier errors";
        return;
      }
  
 -  if (! -d ($output_directory . '/' . $am_relative_dir))
 -    {
 -      mkdir ($output_directory . '/' . $am_relative_dir, 0755);
 -    }
 +  mkdir ($am_relative_dir, 0755) if ! -d $am_relative_dir;
  
    # We make sure that `all:' is the first target.
    my $output =
    #  * other dependencies, specific to the Makefile.am being processed
    #    (such as the Makefile.am itself, or any Makefile fragment
    #    it includes).
 -  my $timestamp = mtime $out_file;
 +  my $timestamp = mtime $makefile_in;
    if (! $force_generation
        && $configure_deps_greatest_timestamp < $timestamp
        && $output_deps_greatest_timestamp < $timestamp
 -      && $output eq contents ($out_file))
 +      && $output eq contents ($makefile_in))
      {
 -      verb "$out_file unchanged";
 +      verb "$makefile_in unchanged";
        # No need to update.
        return;
      }
  
 -  if (-e $out_file)
 +  if (-e $makefile_in)
      {
 -      unlink ($out_file)
 -      or fatal "cannot remove $out_file: $!\n";
 +      unlink ($makefile_in)
 +      or fatal "cannot remove $makefile_in: $!";
      }
  
 -  my $gm_file = new Automake::XFile "> $out_file";
 -  verb "creating $out_file";
 +  my $gm_file = new Automake::XFile "> $makefile_in";
 +  verb "creating $makefile_in";
    print $gm_file $output;
  }
  
@@@ -8245,7 -8411,7 +8245,7 @@@ sub print_autodist_files (@
  # Print usage information.
  sub usage ()
  {
 -    print "Usage: $0 [OPTION] ... [Makefile]...
 +    print "Usage: $0 [OPTION]... [Makefile]...
  
  Generate Makefile.in for configure from Makefile.am.
  
  # Parse command line.
  sub parse_arguments ()
  {
 -  # Start off as gnu.
 -  set_strictness ('gnu');
 +  my $strict = 'gnu';
 +  my $cygnus = 0;
 +  my $ignore_deps = 0;
 +  my @warnings = ();
  
 -  my $cli_where = new Automake::Location;
    my %cli_options =
      (
       'libdir=s'       => \$libdir,
 -     'gnu'            => sub { set_strictness ('gnu'); },
 -     'gnits'          => sub { set_strictness ('gnits'); },
 -     'cygnus'         => sub { set_global_option ('cygnus', $cli_where); },
 -     'foreign'          => sub { set_strictness ('foreign'); },
 -     'include-deps'   => sub { unset_global_option ('no-dependencies'); },
 -     'i|ignore-deps'  => sub { set_global_option ('no-dependencies',
 -                                                  $cli_where); },
 +     'gnu'            => sub { $strict = 'gnu'; },
 +     'gnits'          => sub { $strict = 'gnits'; },
 +     'foreign'                => sub { $strict = 'foreign'; },
 +     'cygnus'         => \$cygnus,
 +     'include-deps'   => sub { $ignore_deps = 0; },
 +     'i|ignore-deps'  => sub { $ignore_deps = 1; },
       'no-force'       => sub { $force_generation = 0; },
       'f|force-missing'  => \$force_missing,
 -     'o|output-dir=s' => \$output_directory,
       'a|add-missing'  => \$add_missing,
       'c|copy'         => \$copy_missing,
       'v|verbose'      => sub { setup_channel 'verb', silent => 0; },
 -     'W|warnings=s'     => \&parse_warnings,
 -     # These long options (--Werror and --Wno-error) for backward
 -     # compatibility.  Use -Werror and -Wno-error today.
 -     'Werror'           => sub { parse_warnings 'W', 'error'; },
 -     'Wno-error'        => sub { parse_warnings 'W', 'no-error'; },
 +     'W|warnings=s'     => \@warnings,
       );
    use Getopt::Long;
    Getopt::Long::config ("bundling", "pass_through");
    Getopt::Long::GetOptions %cli_options, 'version' => sub {}, 'help' => sub {}
      or exit 1;
  
 -  if (defined $output_directory)
 -    {
 -      msg 'obsolete', "`--output-dir' is deprecated\n";
 -    }
 -  else
 +  set_strictness ($strict);
 +  my $cli_where = new Automake::Location;
 +  set_global_option ('cygnus', $cli_where) if $cygnus;
 +  set_global_option ('no-dependencies', $cli_where) if $ignore_deps;
 +  for my $warning (@warnings)
      {
 -      # In the next release we'll remove this entirely.
 -      $output_directory = '.';
 +      &parse_warnings ('-W', $warning);
      }
  
    return unless @ARGV;
        }
        elsif (exists $argopts{$ARGV[0]})
        {
 -        fatal ("option `$ARGV[0]' requires an argument\n"
 -               . "Try `$0 --help' for more information.");
 +        fatal ("option `$ARGV[0]' requires an argument.\n"
 +               . "Try `$0 --help' for more information");
        }
        else
        {
          fatal ("unrecognized option `$ARGV[0]'.\n"
 -               . "Try `$0 --help' for more information.");
 +               . "Try `$0 --help' for more information");
        }
      }
  
    my $errspec = 0;
    foreach my $arg (@ARGV)
      {
 -      fatal ("empty argument\nTry `$0 --help' for more information.")
 +      fatal ("empty argument\nTry `$0 --help' for more information")
        if ($arg eq '');
  
        # Handle $local:$input syntax.
@@@ -8476,6 -8648,11 +8476,6 @@@ sub get_number_of_thread
    # It doesn't make sense to use more threads than makefiles,
    my $max_threads = @input_files;
  
 -  # but a single worker thread is helpful for exposing bugs.
 -  if ($automake_will_process_aux_dir && $max_threads > 1)
 -    {
 -      $max_threads--;
 -    }
    if ($nthreads > $max_threads)
      {
        $nthreads = $max_threads;
@@@ -8499,11 -8676,18 +8499,11 @@@ sub handle_makefiles_threaded ($
  {
    my ($nthreads) = @_;
  
 -  my @queued_input_files = @input_files;
 -  my $last_input_file = undef;
 -  if ($automake_will_process_aux_dir)
 -    {
 -      $last_input_file = pop @queued_input_files;
 -    }
 -
    # The file queue distributes all makefiles, the message queues
    # collect all serializations needed for respective files.
    my $file_queue = Thread::Queue->new;
    my %msg_queues;
 -  foreach my $file (@queued_input_files)
 +  foreach my $file (@input_files)
      {
        $msg_queues{$file} = Thread::Queue->new;
      }
        });
      }
  
 -  # Queue all normal makefiles.
 -  verb "queuing " . @queued_input_files . " input files";
 -  $file_queue->enqueue (@queued_input_files, (undef) x @threads);
 +  # Queue all makefiles.
 +  verb "queuing " . @input_files . " input files";
 +  $file_queue->enqueue (@input_files, (undef) x @threads);
  
    # Collect and process serializations.
 -  foreach my $file (@queued_input_files)
 +  foreach my $file (@input_files)
      {
        verb "dequeuing messages for " . $file;
        reset_local_duplicates ();
            }
          elsif ($key eq QUEUE_CONF_FILE)
            {
 -            require_queued_conf_file ($queue);
 +            require_queued_file_check_or_copy ($queue);
            }
          else
            {
        $exit_code = $exit_thread[0]
        if ($exit_thread[0] > $exit_code);
      }
 -
 -  # The master processes the last file.
 -  if ($automake_will_process_aux_dir)
 -    {
 -      verb "processing last input file";
 -      handle_makefile ($last_input_file);
 -    }
  }
  
  ################################################################
diff --combined doc/automake.texi
@@@ -24,7 -24,7 +24,7 @@@ This manual is for GNU Automake (versio
  Makefiles from template files.
  
  Copyright @copyright{} 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
- 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
+ 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Free Software
  Foundation, Inc.
  
  @quotation
@@@ -230,6 -230,7 +230,6 @@@ Building Programs and Librarie
  * 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)
  * Dependencies::                Automatic dependency tracking
  * EXEEXT::                      Support for executable extensions
  
@@@ -313,47 -314,14 +313,47 @@@ What Goes in a Distributio
  
  Support for test suites
  
 -* Simple Tests::                Listing programs and scripts in @code{TESTS}
 -* Simple Tests using parallel-tests::  More powerful test driver
 -* DejaGnu Tests::               Interfacing with the external testing framework
 +* Generalities about Testing::  Generic concepts and terminology about testing
 +* Simple Tests::                Listing test scripts in @code{TESTS}
 +* Custom Test Drivers::         Writing and using custom test drivers
 +* Using the TAP test protocol:: Integrating test scripts that use the TAP protocol
 +* DejaGnu Tests::               Interfacing with the @command{dejagnu} testing framework
  * Install Tests::               Running tests on installed packages
  
 +Simple Tests
 +
 +* Scripts-based Testsuites::    Automake-specific concepts and terminology
 +* Serial Test Harness::         Older (and obsolescent) serial test harness
 +* Parallel Test Harness::       Generic concurrent test harness
 +
 +Using the TAP test protocol
 +
 +* Introduction to TAP::
 +* Use TAP with the Automake test harness::
 +* Incompatibilities with other TAP parsers and drivers::
 +* Links and external resources on TAP::
 +
 +Custom Test Drivers
 +
 +* Overview of Custom Test Drivers Support::
 +* Declaring Custom Test Drivers::
 +* API for Custom Test Drivers::
 +
 +API for Custom Test Drivers
 +
 +* Command-line arguments for test drivers::
 +* Log files generation and test results recording::
 +* Testsuite progress output::
 +* HTML generation from testsuite logs::
 +
 +Changing Automake's Behavior
 +
 +* Options generalities::        Semantics of Automake option
 +* List of Automake options::    A comprehensive list of Automake options
 +
  Miscellaneous Rules
  
 -* Tags::                        Interfacing to etags and mkid
 +* Tags::                        Interfacing to cscope, etags and mkid
  * Suffixes::                    Handling new file extensions
  * Multilibs::                   Support for multilibs.
  
@@@ -1956,9 -1924,7 +1956,9 @@@ The valid strictness levels are
  Automake will check for only those things that are absolutely
  required for proper operations.  For instance, whereas GNU standards
  dictate the existence of a @file{NEWS} file, it will not be required in
 -this mode.  The name comes from the fact that Automake is intended to be
 +this mode.  This strictness will also turn off some warnings by default
 +(among them, portability warnings).
 +The name comes from the fact that Automake is intended to be
  used for GNU programs; these relaxed rules are not the standard mode of
  operation.
  
@@@ -2280,18 -2246,16 +2280,18 @@@ copies are updated before each release
  source in case you need more recent versions.
  
  @table @code
 -@item ansi2knr.c
 -@itemx ansi2knr.1
 -These two files are used for de-ANSI-fication support (they are
 -deprecated now, and @emph{will be removed} in the next major Automake
 -release; @pxref{ANSI}).
 +@item ar-lib
 +This is a wrapper primarily for the Microsoft lib archiver, to make
 +it more POSIX-like.
  
  @item compile
  This is a wrapper for compilers that do not accept options @option{-c}
  and @option{-o} at the same time.  It is only used when absolutely
 -required.  Such compilers are rare.
 +required.  Such compilers are rare, with the Microsoft C/C++ Compiler
 +as the most notable exception. This wrapper also makes the following
 +common options available for that compiler, while performing file name
 +translation where needed: @option{-I}, @option{-L}, @option{-l},
 +@option{-Wl,} and @option{-Xlinker}.
  
  @item config.guess
  @itemx config.sub
@@@ -2351,10 -2315,6 +2351,10 @@@ instead of copying files.  Such an oper
  multilibs (@pxref{Multilibs}).  This file is maintained in the GCC
  tree at @url{http://gcc.gnu.org/svn.html}.
  
 +@item test-driver
 +This implements the default test driver offered by the parallel
 +testsuite harness.
 +
  @item texinfo.tex
  Not a program, this file is required for @samp{make dvi}, @samp{make
  ps} and @samp{make pdf} to work when Texinfo sources are in the
@@@ -2713,9 -2673,6 +2713,9 @@@ user redefinitions of Automake rules o
  @item portability
  portability issues (e.g., use of @command{make} features that are
  known to be not portable)
 +@item 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
@@@ -2738,12 -2695,6 +2738,12 @@@ are enabled in @option{--gnu} and @opti
  On the other hand, the @option{silent-rules} options (@pxref{Options})
  turns off portability warnings about recursive variable expansions.
  
 +@c 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
 +@samp{portability}.  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
@@@ -2964,25 -2915,13 +2964,25 @@@ The Autoconf Manual}
  @item AC_CONFIG_AUX_DIR
  Automake will look for various helper scripts, such as
  @file{install-sh}, in the directory named in this macro invocation.
 -@c This list is accurate relative to version 1.8
 -(The full list of scripts is: @file{config.guess}, @file{config.sub},
 -@file{depcomp}, @file{elisp-comp}, @file{compile}, @file{install-sh},
 -@file{ltmain.sh}, @file{mdate-sh}, @file{missing}, @file{mkinstalldirs},
 -@file{py-compile}, @file{texinfo.tex}, and @file{ylwrap}.)  Not all
 -scripts are always searched for; some scripts will only be sought if the
 -generated @file{Makefile.in} requires them.
 +@c This list is accurate relative to version 1.11
 +(The full list of scripts is:
 +@file{ar-lib},
 +@file{config.guess},
 +@file{config.sub},
 +@file{depcomp},
 +@file{elisp-comp},
 +@file{compile},
 +@file{install-sh},
 +@file{ltmain.sh},
 +@file{mdate-sh},
 +@file{missing},
 +@file{mkinstalldirs},
 +@file{py-compile},
 +@file{test-driver},
 +@file{texinfo.tex},
 +@file{ylwrap}.)
 +Not all scripts are always searched for; some scripts
 +will only be sought if the generated @file{Makefile.in} requires them.
  
  If @code{AC_CONFIG_AUX_DIR} is not given, the scripts are looked for in
  their standard locations.  For @file{mdate-sh},
@@@ -3110,6 -3049,11 +3110,6 @@@ this way, e.g., @code{AC_PATH_XTRA} def
  @code{$(X_CFLAGS)} and @code{$(X_LIBS)} in any @file{Makefile.am}
  if @code{AC_PATH_XTRA} is called.
  
 -@item AM_C_PROTOTYPES
 -This is required when using the deprecated de-ANSI-fication feature;
 -@pxref{ANSI}.  @emph{It will be removed} in the next major Automake
 -release.
 -
  @item AM_CONDITIONAL
  This introduces an Automake conditional (@pxref{Conditionals}).
  
@@@ -3257,6 -3201,11 +3257,6 @@@ Look for the system-wide third-party ma
  @file{dirlist} file) in @var{dir} instead of in the installation
  directory.  This is typically used for debugging.
  
 -@item --acdir=@var{dir}
 -@opindex --acdir
 -@emph{Deprecated} shorthand for ``@option{--automake-acdir=@var{dir}
 ---system-acdir=@var{dir}}''.  Will be removed in future aclocal versions.
 -
  @item --diff[=@var{command}]
  @opindex --diff
  Run @var{command} on M4 file that would be installed or overwritten
@@@ -4039,15 -3988,6 +4039,15 @@@ environment, or use the @option{--with-
  @command{configure} to explicitly set the correct path (if you're sure
  you have an @command{emacs} that supports Emacs Lisp).
  
 +@item AM_PROG_AR(@ovar{act-if-fail})
 +@acindex AM_PROG_AR
 +@vindex 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
@@@ -4119,6 -4059,17 +4119,6 @@@ automatically (@pxref{autoupdate Invoca
  Autoconf Manual}).
  
  @table @code
 -@item AM_C_PROTOTYPES
 -@acindex AM_C_PROTOTYPES
 -@vindex ANSI2KNR
 -@vindex U
 -Check to see if function prototypes are understood by the compiler.  If
 -so, define @samp{PROTOTYPES} and set the output variables @code{U} and
 -@code{ANSI2KNR} to the empty string.  Otherwise, set @code{U} to
 -@samp{_} and @code{ANSI2KNR} to @samp{./ansi2knr}.  Automake used these
 -values to implement the deprecated de-ANSI-fication feature; however,
 -support for @emph{that feature will be removed} in the next major Automake
 -release, and then @emph{these macros and variables will go away as well}.
  
  @item AM_CONFIG_HEADER
  @acindex AM_CONFIG_HEADER
@@@ -4169,6 -4120,21 +4169,6 @@@ system.  If so, set the shell variable 
  @samp{yes}.  If not, set the variable to @samp{no}.  This macro is obsolete,
  you should use Autoconf's @code{AC_SYS_POSIX_TERMIOS} instead.
  
 -@item AM_WITH_REGEX
 -@acindex AM_WITH_REGEX
 -@vindex WITH_REGEX
 -@opindex --with-regex
 -@cindex regex package
 -@cindex rx package
 -Adds @option{--with-regex} to the @command{configure} command line.  If
 -specified (the default), then the @samp{regex} regular expression
 -library is used, @file{regex.o} is put into @code{LIBOBJS}, and
 -@code{WITH_REGEX} is defined.  If @option{--without-regex} is given, then
 -the @samp{rx} regular expression library is used, and @file{rx.o} is put
 -into @code{LIBOBJS}.  This macro is obsolete now (since @samp{rx} doesn't
 -seem to be maintained), and @emph{will be removed the next major version
 -of Automake}.  Consider using gnulib if you need regex functionality.
 -
  @end table
  
  
@@@ -4647,7 -4613,6 +4647,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
@@@ -4716,6 -4681,7 +4716,6 @@@ to build programs and libraries
  * 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)
  * Dependencies::                Automatic dependency tracking
  * EXEEXT::                      Support for executable extensions
  @end menu
@@@ -5092,14 -5058,12 +5092,14 @@@ by invoking @samp{$(AR) $(ARFLAGS)} fol
  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
 -@code{RANLIB} (Automake will complain otherwise).  @code{AR} and
 -@code{ARFLAGS} default to @code{ar} and @code{cru} respectively; you
 -can override these two variables my setting them in your
 -@file{Makefile.am}, by @code{AC_SUBST}ing them from your
 -@file{configure.ac}, or by defining a per-library @code{maude_AR}
 -variable (@pxref{Program and Library Variables}).
 +@code{RANLIB} (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
 +@code{cru}; you can override this variable by setting it in your
 +@file{Makefile.am} or by @code{AC_SUBST}ing it from your
 +@file{configure.ac}.  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
@@@ -6899,6 -6863,85 +6899,6 @@@ on user demand
  Some limited support for adding your own languages is available via the
  suffix rule handling (@pxref{Suffixes}).
  
 -
 -@node ANSI
 -@section Automatic de-ANSI-fication (deprecated, soon to be removed)
 -
 -@cindex de-ANSI-fication, defined
 -
 -@emph{The features described in this section are deprecated; you must
 -not use any of them in new code, and remove their use from older but
 -still maintained code: they will be withdrawn in the next major
 -Automake release.}
 -
 -When the C language was standardized in 1989, there was a long
 -transition period where package developers needed to worry about
 -porting to older systems that did not support ANSI C by default.
 -These older systems are no longer in practical use and are no longer
 -supported by their original suppliers, so developers need not worry
 -about this problem any more.
 -
 -Automake allows you to write packages that are portable to K&R C by
 -@dfn{de-ANSI-fying} each source file before the actual compilation takes
 -place.
 -
 -@vindex AUTOMAKE_OPTIONS
 -@opindex ansi2knr
 -
 -If the @file{Makefile.am} variable @code{AUTOMAKE_OPTIONS}
 -(@pxref{Options}) contains the option @option{ansi2knr} then code to
 -handle de-ANSI-fication is inserted into the generated
 -@file{Makefile.in}.
 -
 -This causes each C source file in the directory to be treated as ANSI C@.
 -If an ANSI C compiler is available, it is used.  If no ANSI C compiler
 -is available, the @command{ansi2knr} program is used to convert the source
 -files into K&R C, which is then compiled.
 -
 -The @command{ansi2knr} program is simple-minded.  It assumes the source
 -code will be formatted in a particular way; see the @command{ansi2knr} man
 -page for details.
 -
 -@acindex AM_C_PROTOTYPES
 -Support for the obsolete de-ANSI-fication feature
 -requires the source files @file{ansi2knr.c}
 -and @file{ansi2knr.1} to be in the same package as the ANSI C source;
 -these files are distributed with Automake.  Also, the package
 -@file{configure.ac} must call the macro @code{AM_C_PROTOTYPES}
 -(@pxref{Macros}).
 -
 -Automake also handles finding the @command{ansi2knr} support files in some
 -other directory in the current package.  This is done by prepending the
 -relative path to the appropriate directory to the @command{ansi2knr}
 -option.  For instance, suppose the package has ANSI C code in the
 -@file{src} and @file{lib} subdirectories.  The files @file{ansi2knr.c} and
 -@file{ansi2knr.1} appear in @file{lib}.  Then this could appear in
 -@file{src/Makefile.am}:
 -
 -@example
 -AUTOMAKE_OPTIONS = ../lib/ansi2knr
 -@end example
 -
 -If no directory prefix is given, the files are assumed to be in the
 -current directory.
 -
 -Note that automatic de-ANSI-fication will not work when the package is
 -being built for a different host architecture.  That is because
 -@command{automake} currently has no way to build @command{ansi2knr}
 -for the build machine.
 -
 -@c FIXME: this paragraph might be better moved to an `upgrading' section.
 -@cindex @code{LTLIBOBJS} and @code{ansi2knr}
 -@cindex @code{LIBOBJS} and @code{ansi2knr}
 -@cindex @code{ansi2knr} and @code{LTLIBOBJS}
 -@cindex @code{ansi2knr} and @code{LIBOBJS}
 -Using @code{LIBOBJS} with source de-ANSI-fication used to require
 -hand-crafted code in @file{configure} to append @samp{$U} to basenames
 -in @code{LIBOBJS}.  This is no longer true today.  Starting with version
 -2.54, Autoconf takes care of rewriting @code{LIBOBJS} and
 -@code{LTLIBOBJS}.  (@pxref{AC_LIBOBJ vs LIBOBJS, , @code{AC_LIBOBJ}
 -vs.@: @code{LIBOBJS}, autoconf, The Autoconf Manual})
 -
  @node Dependencies
  @section Automatic dependency tracking
  
@@@ -7056,11 -7099,12 +7056,12 @@@ prefix as with other primaries
  @vindex sbin_SCRIPTS
  @vindex libexec_SCRIPTS
  @vindex pkgdata_SCRIPTS
+ @vindex pkglibexec_SCRIPTS
  @vindex noinst_SCRIPTS
  @vindex check_SCRIPTS
  
  Scripts can be installed in @code{bindir}, @code{sbindir},
- @code{libexecdir}, or @code{pkgdatadir}.
+ @code{libexecdir}, @code{pkglibexecdir}, or @code{pkgdatadir}.
  
  Scripts that need not be installed can be listed in
  @code{noinst_SCRIPTS}, and among them, those which are needed only by
@@@ -8625,9 -8669,9 +8626,9 @@@ distributions in various formats.  Thei
  @item @code{dist-bzip2}
  Generate a bzip2 tar archive of the distribution.  bzip2 archives are
  frequently smaller than gzipped archives.
 -By default, this rule makes @samp{bzip2} use a compression option of
 -@option{-9}.  To make it use a different one, set the @env{BZIP2}
 -environment variable.  For example, @samp{make dist-bzip2 BZIP2=-7}.
 +By default, this rule makes @samp{bzip2} use a compression option of @option{-9}.
 +To make it use a different one, set the @env{BZIP2} environment variable.
 +For example, @samp{make dist-bzip2 BZIP2=-7}.
  @trindex dist-bzip2
  
  @item @code{dist-gzip}
@@@ -8635,7 -8679,7 +8636,7 @@@ Generate a gzip tar archive of the dist
  @trindex dist-gzip
  
  @item @code{dist-lzip}
 -Generate a @samp{lzip} tar archive of the distribution.  @command{lzip}
 +Generate an @samp{lzip} tar archive of the distribution.  @command{lzip}
  archives are frequently smaller than @command{bzip2}-compressed archives.
  @trindex dist-lzip
  
@@@ -8684,265 -8728,92 +8685,265 @@@ default, only the @code{dist-gzip} targ
  @cindex @code{make check}
  @trindex check
  
 -Automake supports three forms of test suites, the first two of which
 -are very similar.
 +Automake can generate code to handle two kinds of test suites.  One is
 +based on integration with the @command{dejagnu} framework.  The other
 +(and most used) form is based on the use of generic test scripts, and
 +its activation is triggered by the definition of the special @code{TESTS}
 +variable.  This second form allows for various degrees of sophistication
 +and customization; in particular, it allows for concurrent execution
 +of test scripts, use of established test protocols such as TAP, and
 +definition of custom test drivers and test runners.
 +
 +@noindent
 +In either case, the testsuite is invoked via @samp{make check}.
  
  @menu
 -* Simple Tests::                Listing programs and scripts in @code{TESTS}
 -* Simple Tests using parallel-tests::  More powerful test driver
 -* DejaGnu Tests::               Interfacing with the external testing framework
 +* Generalities about Testing::  Concepts and terminology about testing
 +* Simple Tests::                Listing test scripts in @code{TESTS}
 +* Custom Test Drivers::         Writing and using custom test drivers
 +* Using the TAP test protocol:: Integrating test scripts that use the TAP protocol
 +* DejaGnu Tests::               Interfacing with the @command{dejagnu} testing framework
  * Install Tests::               Running tests on installed packages
  @end menu
  
 +@node Generalities about Testing
 +@section Generalities about Testing
 +
 +The purpose of testing is to determine whether a program or system behaves
 +as expected (e.g., known inputs produce the expected outputs, error
 +conditions are correctly handled or reported, and older bugs do not
 +resurface).
 +
 +@cindex test case
 +The minimal unit of testing is usually called @emph{test case}, or simply
 +@emph{test}.  How a test case is defined or delimited, and even what
 +exactly @emph{constitutes} a test case, depends heavily on the testing
 +paradigm and/or framework in use, so we won't attempt any more precise
 +definition.  The set of the test cases for a given program or system
 +constitutes its @emph{testsuite}.
 +
 +@cindex test harness
 +@cindex testsuite harness
 +A @emph{test harness} (also @emph{testsuite harness}) is a program or
 +software component that executes all (or part of) the defined test cases,
 +analyzes their outcomes, and report or register these outcomes
 +appropriately.  Again, the details of how this is accomplished (and how
 +the developer and user can influence it or interface with it) varies
 +wildly, and we'll attempt no precise definition.
 +
 +@cindex test pass
 +@cindex test failure
 +A test is said to @emph{pass} when it can determine that the condition or
 +behaviour it means to verify holds, and is said to @emph{fail} when it can
 +determine that such condition of behaviour does @emph{not} hold.
 +
 +@cindex test skip
 +Sometimes, tests can rely on non-portable tools or prerequisites, or
 +simply make no sense on a given system (for example, a test checking a
 +Windows-specific feature makes no sense on a GNU/Linux system).  In this
 +case, accordingly to the definition above, the tests can neither be
 +considered passed nor failed; instead, they are @emph{skipped} -- i.e.,
 +they are not run, or their result is anyway ignored for what concerns
 +the count of failures an successes.  Skips are usually explicitly
 +reported though, so that the user will be aware that not all of the
 +testsuite has really run.
 +
 +@cindex xfail
 +@cindex expected failure
 +@cindex expected test failure
 +@cindex xpass
 +@cindex unexpected pass
 +@cindex unexpected test pass
 +It's not uncommon, especially during early development stages, that some
 +tests fail for known reasons, and that the developer doesn't want to
 +tackle these failures immediately (this is especially true when the
 +failing tests deal with corner cases).  In this situation, the better
 +policy is to declare that each of those failures is an @emph{expected
 +failure} (or @emph{xfail}).  In case a test that is expected to fail ends
 +up passing instead, many testing environments will flag the result as a
 +special kind of failure called @emph{unexpected pass} (or @emph{xpass}).
 +
 +@cindex hard error
 +@cindex Distinction between errors and failures in testsuites
 +Many testing environments and frameworks distinguish between test failures
 +and hard errors.  As we've seen, a test failure happens when some invariant
 +or expected behaviour of the software under test is not met.  An @emph{hard
 +error} happens when e.g., the set-up of a test case scenario fails, or when
 +some other unexpected or highly undesirable condition is encountered (for
 +example, the program under test experiences a segmentation fault).
 +
 +@emph{TODO}: Links to other test harnesses (esp. those sharing our
 +terminology)?
 +
  @node Simple Tests
  @section Simple Tests
  
 -If the variable @code{TESTS} is defined, its value is taken to be a
 -list of programs or scripts to run in order to do the testing.
 -Programs needing data files should look for them in @code{srcdir}
 -(which is both an environment variable and a make variable) so they
 -work when building in a separate directory (@pxref{Build Directories,
 -, Build Directories , autoconf, The Autoconf Manual}), and in
 -particular for the @code{distcheck} rule (@pxref{Checking the
 -Distribution}).
 -
 -For each of the @code{TESTS}, the result of execution is printed along
 -with the test name, where @code{PASS} denotes a successful test,
 -@code{FAIL} denotes a failed test, @code{XFAIL} an expected failure,
 -@code{XPASS} an unexpected pass for a test that is supposed to fail,
 -and @code{SKIP} denotes a skipped test.
 +@menu
 +* Scripts-based Testsuites::    Automake-specific concepts and terminology
 +* Serial Test Harness::         Older (and obsolescent) serial test harness
 +* Parallel Test Harness::       Generic concurrent test harness
 +@end menu
 +
 +@node Scripts-based Testsuites
 +@subsection Scripts-based Testsuites
 +
 +If the special variable @code{TESTS} is defined, its value is taken to be
 +a list of programs or scripts to run in order to do the testing.  Under
 +the appropriate circumstances, it's possible for @code{TESTS} to list
 +also data files to be passed to one or more test scripts defined by
 +different means (the so-called ``log compilers'', @pxref{Parallel Test
 +Harness}).
 +
 +Test scripts can be executed serially or concurrently.  Automake
 +supports both these kinds of test execution, with the serial test harness
 +being the default (for backward-compatibility reasons only, as its use
 +is nowadays discouraged).  The concurrent test harness relies on the
 +concurrence capabilities (if any) offered by the underlying @command{make}
 +implementation, and can thus only be as good as those are.
 +
 +By default, only the exit statuses of the test scripts are considered when
 +determining the testsuite outcome.  But Automake allows also the use of
 +more complex test protocols, either standard (@pxref{Using the TAP test
 +protocol}) or custom (@pxref{Custom Test Drivers}).  Note that you can
 +enable such protocols only when the parallel harness is used: they won't
 +work with the serial test harness.  In the rest of this section we are
 +going to concentrate mostly on protocol-less tests, since  we'll have later
 +a whole section devoted to the use of test protocols (again, @pxref{Custom
 +Test Drivers}).
  
  @cindex Exit status 77, special interpretation
 +@cindex Exit status 99, special interpretation
 +When no test protocol is in use, an exit status of 0 from a test script will
 +denote a success, an exit status of 77 a skipped test, an exit status of 99
 +an hard error, and any other exit status will denote a failure.
 +
 +@cindex Tests, expected failure
 +@cindex Expected test failure
 +@vindex XFAIL_TESTS
 +@vindex DISABLE_HARD_ERRORS
 +@cindex Disabling hard errors
 +You may define the variable @code{XFAIL_TESTS} to a list of tests
 +(usually a subset of @code{TESTS}) that are expected to fail; this will
 +effectively reverse the result of those tests (with the provision that
 +skips and hard errors remain untouched).  You may also instruct the
 +testsuite harness to treat hard errors like simple failures, by defining
 +the @code{DISABLE_HARD_ERRORS} make variable to a nonempty value.
 +
 +Note however that, for tests based on more complex test protocols,
 +the exact effects of @code{XFAIL_TESTS} and @code{DISABLE_HARD_ERRORS}
 +might change, or they might even have no effect at all (for example,
 +@c Keep this in sync with tap-no-disable-hard-errors.test.
 +in tests using TAP, there is not way to disable hard errors, and the
 +@code{DISABLE_HARD_ERRORS} variable has no effect on them).
 +
 +@anchor{Testsuite progress on console}
 +@cindex Testsuite progress on console
 +The result of each test case run by the scripts in @code{TESTS} will be
 +printed on standard output, along with the test name.  For test protocols
 +that allow more test cases per test script (such as TAP), a number,
 +identifier and/or brief description specific for the single test case is
 +expected to be printed in addition to the name of the test script.  The
 +possible results (whose meanings should be clear from the previous
 +@ref{Generalities about Testing}) are @code{PASS}, @code{FAIL},
 +@code{SKIP}, @code{XFAIL}, @code{XPASS} and @code{ERROR}.  Here is an
 +example of output from an hypothetical testsuite that uses both plain
 +and TAP tests:
 +@c Keep in sync with tap-doc.test.
 +@example
 +PASS: foo.sh
 +PASS: zardoz.tap 1 - Daemon started
 +PASS: zardoz.tap 2 - Daemon responding
 +SKIP: zardoz.tap 3 - Daemon uses /proc # SKIP /proc is not mounted
 +PASS: zardoz.tap 4 - Daemon stopped
 +SKIP: bar.sh
 +PASS: mu.tap 1
 +XFAIL: mu.tap 2 # TODO frobnication not yet implemented
 +@end example
  
 -The number of failures will be printed at the end of the run.  If a
 -given test program exits with a status of 77, then its result is ignored
 -in the final count.  This feature allows non-portable tests to be
 -ignored in environments where they don't make sense.
 +@noindent
 +A testsuite summary (expected to report at least the number of run,
 +skipped and failed tests) will be printed at the end of the testsuite
 +run.
  
 +@anchor{Simple tests and color-tests}
  @vindex AM_COLOR_TESTS
 +@cindex Colorized testsuite output
  If the Automake option @code{color-tests} is used (@pxref{Options})
  and standard output is connected to a capable terminal, then the test
  results and the summary are colored appropriately.  The user can disable
  colored output by setting the @command{make} variable
  @samp{AM_COLOR_TESTS=no}, or force colored output even without a connecting
 -terminal with @samp{AM_COLOR_TESTS=always}.
 -
 -Note that the semantics of some @command{make} implementations when used
 -in parallel mode (@pxref{Parallel make,,, autoconf, The Autoconf Manual})
 -can cause the automatic detection of a connection to a capable terminal
 -to fail.  In that case, you can still resort to the use of
 -@samp{AM_COLOR_TESTS=always}.
 +terminal with @samp{AM_COLOR_TESTS=always}.  It's also worth noting that
 +some @command{make} implementations, when used in parallel mode, have
 +slightly different semantics (@pxref{Parallel make,,, autoconf,
 +The Autoconf Manual}), which can break the automatic detection of a
 +connection to a capable terminal.  If this is the case, you'll have to
 +resort to the use of @samp{AM_COLOR_TESTS=always} in order to have the
 +testsuite output colorized.
 +
 +Test programs that need data files should look for them in @code{srcdir}
 +(which is both a make variable and an environment variable made available
 +to the tests), so that they work when building in a separate directory
 +(@pxref{Build Directories, , Build Directories , autoconf,
 +The Autoconf Manual}), and in particular for the @code{distcheck} rule
 +(@pxref{Checking the Distribution}).
  
  @vindex TESTS
  @vindex TESTS_ENVIRONMENT
 -The variable @code{TESTS_ENVIRONMENT} can be used to set environment
 -variables for the test run; the environment variable @env{srcdir} is
 -set in the rule.  If all your test programs are scripts, you can also
 -set @code{TESTS_ENVIRONMENT} to an invocation of the shell (e.g.
 -@samp{$(SHELL) -x} can be useful for debugging the tests), or any other
 -interpreter.  For instance, the following setup may be used to run tests
 -with Perl:
 +@vindex AM_TESTS_ENVIRONMENT
 +The @code{AM_TESTS_ENVIRONMENT} and @code{TESTS_ENVIRONMENT} variables can
 +be used to run initialization code and set environment variables for the
 +test scripts.  The former variable is developer-reserved, and can be
 +defined in the @file{Makefile.am}, while the latter is reserved for the
 +user, which can employ it to extend or override the settings in the
 +former; for this to work portably, however, the contents of a non-empty
 +@code{AM_TESTS_ENVIRONMENT} @emph{must} be terminated by a semicolon.
 +
 +@vindex AM_TESTS_FD_REDIRECT
 +The @code{AM_TESTS_FD_REDIRECT} variable can be used to define file
 +descriptor redirections for the test scripts.  One might think that
 +@code{AM_TESTS_ENVIRONMENT} could be used for this purpose, but experience
 +has shown that doing so portably is practically impossible.  The main
 +hurdle is constituted by Korn shells, which usually set the close-on-exec
 +flag on file descriptors opened with the @command{exec} builtin, thus
 +rendering an idiom like @code{AM_TESTS_ENVIRONMENT = exec 9>&2;}
 +ineffectual.  This issue also affects some Bourne shells, such as the
 +HP-UX's @command{/bin/sh},
 +@c FIXME: should we offer a link to the relevant discussions on the
 +@c bug-autoconf list?
  
  @c Keep in sync with tests-environment-backcompat.test.
  @example
 -TESTS_ENVIRONMENT = $(PERL) -Mstrict -w
 -TESTS = foo.pl bar.pl baz.pl
 +AM_TESTS_ENVIRONMENT = \
 +## Some environment initializations are kept in a separate shell
 +## file `tests-env.sh', which can make it easier to also run tests
 +## from the command line.
 +  . $(srcdir)/tests-env.sh; \
 +## On Solaris, prefer more POSIX-compliant versions of the standard
 +## tools by default.
 +  if test -d /usr/xpg4/bin; then \
 +    PATH=/usr/xpg4/bin:$$PATH; export PATH; \
 +  fi;
 +@c $$ restore font-lock
 +## With this, the test scripts will be able to print diagnostic
 +## messages to the original standard error stream, even if the test
 +## driver redirects the stderr of the test scripts to a log file
 +## before executing them.
 +AM_TESTS_FD_REDIRECT = 9>&2
  @end example
  
 -Note that the @option{parallel-tests} driver provides a more elegant
 -way to achieve the same effect, freeing the @code{TESTS_ENVIRONMENT}
 -variable for the user to override (@pxref{Simple Tests using
 -parallel-tests}).
 -
 -
 -@cindex Tests, expected failure
 -@cindex Expected test failure
 -
 -@vindex XFAIL_TESTS
 -You may define the variable @code{XFAIL_TESTS} to a list of tests
 -(usually a subset of @code{TESTS}) that are expected to fail.  This will
 -reverse the result of those tests.
 +@noindent
 +Note however that @code{AM_TESTS_ENVIRONMENT} is, for historical and
 +implementation reasons, @emph{not} supported by the serial harness
 +(@pxref{Serial Test Harness}).
  
  Automake ensures that each file listed in @code{TESTS} is built before
 -any tests are run; you can list both source and derived programs (or
 -scripts) in @code{TESTS}; the generated rule will look both in
 -@code{srcdir} and @file{.}.  For instance, you might want to run a C
 -program as a test.  To do this you would list its name in @code{TESTS}
 -and also in @code{check_PROGRAMS}, and then specify it as you would
 -any other program.
 +it is run; you can list both source and derived programs (or scripts)
 +in @code{TESTS}; the generated rule will look both in @code{srcdir} and
 +@file{.}.  For instance, you might want to run a C program as a test.
 +To do this you would list its name in @code{TESTS} and also in
 +@code{check_PROGRAMS}, and then specify it as you would any other
 +program.
  
  Programs listed in @code{check_PROGRAMS} (and @code{check_LIBRARIES},
  @code{check_LTLIBRARIES}...) are only built during @code{make check},
@@@ -8953,105 -8824,47 +8954,105 @@@ that @code{check_PROGRAMS} are @emph{no
  by the tests, not the tests themselves.  Of course you can set
  @code{TESTS = $(check_PROGRAMS)} if all your programs are test cases.
  
 +@node Serial Test Harness
 +@subsection Serial Test Harness
 +
 +@emph{NOTE:} This harness, while still being the default one, is
 +obsolescent, and kept mostly for backward-compatibility reasons.
 +The user is advised to use the parallel test harness instead
 +(@pxref{Parallel Test Harness}).
 +
 +The serial harness operates by simply running the tests serially, one at
 +the time, without any I/O redirection.  It's up to the user to implement
 +logging of tests' output, if that's requited or desired.
 +@c TODO: give an example of how this can be done.
 +
 +For historical and implementation reasons, the @code{AM_TESTS_ENVIRONMENT}
 +variable is @emph{not} supported by this harness (it will be silently
 +ignored if defined); only @code{TESTS_ENVIRONMENT} is, and it is to be
 +considered a developer-reserved variable.  This is done so that, when
 +using the serial harness, @code{TESTS_ENVIRONMENT} can be defined to an
 +invocation of an interpreter through which the tests are to be run.
 +For instance, the following setup may be used to run tests with Perl:
 +
 +@example
 +TESTS_ENVIRONMENT = $(PERL) -Mstrict -w
 +TESTS = foo.pl bar.pl baz.pl
 +@end example
 +
 +@noindent
 +It's important to note that the use of @code{TESTS_ENVIRONMENT} endorsed
 +here would be @emph{invalid} with the parallel harness.  That harness
 +provides a more elegant way to achieve the same effect, with the further
 +benefit of freeing the @code{TESTS_ENVIRONMENT} variable for the user
 +(@pxref{Parallel Test Harness}).
 +
 +Another, less serious limit of the serial harness is that it doesn't
 +really distinguish between simple failures and hard errors; this is
 +due to historical reasons only, and might be fixed in future Automake
 +versions.
  
 -@node Simple Tests using parallel-tests
 -@section Simple Tests using @samp{parallel-tests}
 +@node Parallel Test Harness
 +@subsection Parallel Test Harness
  @cindex @option{parallel-tests}, Using
  
 -The option @option{parallel-tests} (@pxref{Options}) enables a test
 -suite driver that is mostly compatible to the simple test driver described
 -in the previous section, but provides a few more features and slightly different
 -semantics.  It features concurrent execution of tests with @code{make -j},
 -allows to specify inter-test dependencies, lazy reruns of tests that
 -have not completed in a prior run, summary and verbose output in
 -@samp{RST} (reStructuredText) and @samp{HTML} format, and hard errors
 -for exceptional failures.  Similar to the simple test driver,
 -@code{TESTS_ENVIRONMENT}, @code{AM_COLOR_TESTS}, @code{XFAIL_TESTS}, and
 -the @code{check_*} variables are honored, and the environment variable
 -@env{srcdir} is set during test execution.
 -
 -This test driver is still experimental and may undergo changes in order
 -to satisfy additional portability requirements.
 +The parallel (or concurrent) test harness is enabled by the Automake option
 +@option{parallel-tests} .  It features concurrent execution of tests with
 +@code{make -j}, allows to specify inter-test dependencies, lazy reruns of
 +tests that have not completed in a prior run, summary and verbose output in
 +@samp{RST} (reStructuredText) and @samp{HTML} format.
 +
 +This harness is still somewhat experimental and may undergo changes in
 +order to satisfy additional portability requirements.
  
 +@anchor{Basics of test metadata}
  @vindex TEST_SUITE_LOG
  @vindex TESTS
 -The driver operates by defining a set of @command{make} rules to create
 -a summary log file, @code{TEST_SUITE_LOG}, which defaults to
 -@file{test-suite.log} and requires a @file{.log} suffix.  This file
 -depends upon log files created for each single test program listed in
 -@code{TESTS}, which in turn contain all output produced by the
 -corresponding tests.
 +@cindex @file{.log} files
 +@cindex @file{.trs} files
 +@cindex test metadata
 +The parallel test harness operates by defining a set of @command{make}
 +rules that run the test scripts listed in @code{TESTS}, and, for each
 +such script, save its output in a corresponding @file{.log} file and
 +its results (and other ``metadata'', @pxref{API for Custom Test Drivers})
 +in a corresponding @file{.trs} (as in @b{T}est @b{R}e@b{S}ults) file.
 +@c We choose the `.trs' extension also because, at the time of writing,
 +@c it isn't already used for other significant purposes; see e.g.:
 +@c   - http://filext.com/file-extension/trs
 +@c   - http://www.file-extensions.org/search/?searchstring=trs
 +The @file{.log} file will contain all the output emitted by the test on
 +its standard output and its standard error.  The @file{.trs} file will
 +contain, among the other things, the results of the test cases run by
 +the script.
 +
 +The parallel test harness will also create a summary log file,
 +@code{TEST_SUITE_LOG}, which defaults to @file{test-suite.log} and requires
 +a @file{.log} suffix.  This file depends upon all the @file{.log} and
 +@file{.trs} files created for the test scripts listed in @code{TESTS}.
 +
 +@vindex VERBOSE
 +As with the serial harness above, by default one status line is printed
 +per completed test, and a short summary after the suite has completed.
 +However, standard output and standard error of the test are redirected
 +to a per-test log file, so that parallel execution does not produce
 +intermingled output.  The output from failed tests is collected in the
 +@file{test-suite.log} file.  If the variable @samp{VERBOSE} is set, this
 +file is output after the summary.
 +@c FIXME: we should be clearer about what we mean exactly here ...
 +For best results, the tests should be verbose by default now.
  
  @vindex TEST_EXTENSIONS
  @vindex TEST_LOGS
 -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
 -@code{TEST_EXTENSIONS} removed, and @file{.log} appended.  Results
 -are undefined if a test file name ends in several concatenated suffixes.
 -@code{TEST_EXTENSIONS} 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.
 +Each couple of @file{.log} and @file{.trs} files 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 @code{TEST_EXTENSIONS} removed, and @file{.log} appended.
 +Results are undefined if a test file name ends in several concatenated
 +suffixes.  @code{TEST_EXTENSIONS} 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.
  @c 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 AM_@var{ext}_LOG_FLAGS
  @vindex AM_LOG_FLAGS
  For tests that match an extension @code{.@var{ext}} listed in
 -@code{TEST_EXTENSIONS}, you can provide a test driver using the variable
 -@code{@var{ext}_LOG_COMPILER} (note the upper-case extension) and pass
 -options in @code{AM_@var{ext}_LOG_FLAGS} and allow the user to pass
 -options in @code{@var{ext}_LOG_FLAGS}.  It will cause all tests with
 -this extension to be called with this driver.  For all tests without a
 -registered extension, the variables @code{LOG_COMPILER},
 +@code{TEST_EXTENSIONS}, you can provide a custom ``test runner'' using
 +the variable @code{@var{ext}_LOG_COMPILER} (note the upper-case
 +extension) and pass options in @code{AM_@var{ext}_LOG_FLAGS} and allow
 +the user to pass options in @code{@var{ext}_LOG_FLAGS}.  It will cause
 +all tests with this extension to be called with this runner.  For all
 +tests without a registered extension, the variables @code{LOG_COMPILER},
  @code{AM_LOG_FLAGS}, and @code{LOG_FLAGS} may be used.  For example,
  
  @c Keep in sync with parallel-tests-log-compiler-example.test.
@@@ -9091,34 -8904,24 +9092,34 @@@ AM_LOG_FLAGS = -
  @noindent
  will invoke @samp{$(PERL) -w foo.pl}, @samp{$(PYTHON) -v bar.py},
  and @samp{./wrapper-script -d baz} to produce @file{foo.log},
 -@file{bar.log}, and @file{baz.log}, respectively.  The
 -@samp{TESTS_ENVIRONMENT} variable is still expanded before the driver,
 -but should be reserved for the user.
 +@file{bar.log}, and @file{baz.log}, respectively.  The @file{foo.trs},
 +@file{bar.trs} and @file{baz.trs} files will be automatically produced
 +as a side-effect.
  
 -@vindex VERBOSE
 -As with the simple driver above, by default one status line is printed
 -per completed test, and a short summary after the suite has completed.
 -However, standard output and standard error of the test are redirected
 -to a per-test log file, so that parallel execution does not produce
 -intermingled output.  The output from failed tests is collected in the
 -@file{test-suite.log} file.  If the variable @samp{VERBOSE} is set, this
 -file is output after the summary.  For best results, the tests should be
 -verbose by default now.
 +It's important to note that, differently from what we've seen for the
 +serial test harness (@pxref{Parallel Test Harness}), the
 +@code{AM_TESTS_ENVIRONMENT} and @code{TESTS_ENVIRONMENT} variables
 +@emph{cannot} be use to define a custom test runner; the
 +@code{LOG_COMPILER} and @code{LOG_FLAGS} (or their extension-specific
 +counterparts) should be used instead:
 +
 +@example
 +## This is WRONG!
 +AM_TESTS_ENVIRONMENT = PERL5LIB='$(srcdir)/lib' $(PERL) -Mstrict -w
 +@end example
 +
 +@example
 +## Do this instead.
 +AM_TESTS_ENVIRONMENT = PERL5LIB='$(srcdir)/lib'; export PERL5LIB;
 +LOG_COMPILER = $(PERL)
 +AM_LOG_FLAGS = -Mstrict -w
 +@end example
  
  @trindex mostlyclean
  @trindex check-html
  @vindex RST2HTML
  @vindex TEST_SUITE_HTML
 +@noindent
  With @code{make check-html}, the log files may be converted from RST
  (reStructuredText, see @uref{http://docutils.sourceforge.net/@/rst.html})
  to HTML using @samp{RST2HTML}, which defaults to @command{rst2html} or
  set of converted log files.  The log and HTML files are removed upon
  @code{make mostlyclean}.
  
 -@vindex DISABLE_HARD_ERRORS
 -@cindex Exit status 99, special interpretation
 -@cindex hard error
 -Even in the presence of expected failures (see @code{XFAIL_TESTS}), there
 -may be conditions under which a test outcome needs attention.  For
 -example, with test-driven development, you may write tests for features
 -that you have not implemented yet, and thus mark these tests as expected
 -to fail.  However, you may still be interested in exceptional conditions,
 -for example, tests that fail due to a segmentation violation or another
 -error that is independent of the feature awaiting implementation.
 -Tests can exit with an exit status of 99 to signal such a @emph{hard
 -error}.  Unless the variable @code{DISABLE_HARD_ERRORS} is set to a
 -nonempty value, such tests will be counted as failed.
 -
 -By default, the test suite driver will run all tests, but there are
 +By default, the test suite harness will run all tests, but there are
  several ways to limit the set of tests that are run:
  
  @itemize @bullet
  @item
 -You can set the @code{TESTS} variable, similarly to how you can with
 -the simple test driver from the previous section.  For example, you can
 -use a command like this to run only a subset of the tests:
 +You can set the @code{TESTS} variable.  For example, you can use a
 +command like this to run only a subset of the tests:
  
  @example
  env TESTS="foo.test bar.test" make -e check
@@@ -9169,15 -8987,14 +9170,15 @@@ here too
  @item
  @vindex RECHECK_LOGS
  @cindex lazy test execution
 -By default, the test driver removes all old per-test log files before it
 -starts running tests to regenerate them.  The variable
 -@code{RECHECK_LOGS} contains the set of log files which are removed.
 -@code{RECHECK_LOGS} defaults to @code{TEST_LOGS}, which means all tests
 -need to be rechecked.  By overriding this variable, you can choose which
 -tests need to be reconsidered.  For example, you can lazily rerun only
 -those tests which are outdated, i.e., older than their prerequisite test
 -files, by setting this variable to the empty value:
 +By default, the test harness removes all old per-test @file{.log} and
 +@file{.trs} files before it starts running tests to regenerate them.  The
 +variable @code{RECHECK_LOGS} contains the set of @file{.log} (and, by
 +implication, @file{.trs}) files which are removed.  @code{RECHECK_LOGS}
 +defaults to @code{TEST_LOGS}, which means all tests need to be rechecked.
 +By overriding this variable, you can choose which tests need to be
 +reconsidered.  For example, you can lazily rerun only those tests which
 +are outdated, i.e., older than their prerequisite test files, by setting
 +this variable to the empty value:
  
  @example
  env RECHECK_LOGS= make -e check
  You can ensure that all tests are rerun which have failed or passed
  unexpectedly, by running @code{make recheck} in the test directory.
  This convenience target will set @code{RECHECK_LOGS} appropriately
 -before invoking the main test driver.  The @code{recheck-html} target
 -does the same as @code{recheck} but again converts the resulting log
 -file in HTML format, like the @code{check-html} target.
 +before invoking the main test harness.  The @code{recheck-html} target
 +does the same as @code{recheck} but again converts the resulting
 +@file{.log} file in HTML format, like the @code{check-html} target.
  @end itemize
  
 +@noindent
  In order to guarantee an ordering between tests even with @code{make
 --j@var{N}}, dependencies between the corresponding log files may be
 -specified through usual @command{make} dependencies.  For example, the
 -following snippet lets the test named @file{foo-execute.test} depend
 +-j@var{N}}, dependencies between the corresponding @file{.log} files
 +may be specified through usual @command{make} dependencies.  For example,
 +the following snippet lets the test named @file{foo-execute.test} depend
  upon completion of the test @file{foo-compile.test}:
  
  @example
@@@ -9218,7 -9034,6 +9219,7 @@@ parallel @command{make -j@var{N}}, so b
  concurrent execution.
  
  @cindex Unit tests
 +@c Keep in sync with 'parallel-tests-extra-programs.test'.
  The combination of lazy test execution and correct dependencies between
  tests and their sources may be exploited for efficient unit testing
  during development.  To further speed up the edit-compile-test cycle, it
@@@ -9246,573 -9061,6 +9247,573 @@@ semantics of FreeBSD and OpenBSD @comma
  In case of doubt you may want to require to use GNU @command{make},
  or work around the issue with inference rules to generate the tests.
  
 +@node Custom Test Drivers
 +@section Custom Test Drivers
 +
 +@menu
 +* Overview of Custom Test Drivers Support::
 +* Declaring Custom Test Drivers::
 +* API for Custom Test Drivers::
 +@end menu
 +
 +@node Overview of Custom Test Drivers Support
 +@subsection Overview of Custom Test Drivers Support
 +
 +Starting from Automake version 1.12, the parallel test harness allows
 +the package authors to use third-party custom test drivers, in case the
 +default ones are inadequate for their purposes, or do not support their
 +testing protocol of choice.
 +
 +A custom test driver is expected to properly run the test programs passed
 +to it (including the command-line arguments passed to those programs, if
 +any), to analyze their execution and outcome, to create the @file{.log}
 +and @file{.trs} files associated to these test runs, and to display the test
 +results on the console. It is responsibility of the author of the test
 +driver to ensure that it implements all the above steps meaningfully and
 +correctly; Automake isn't and can't be of any help here.  On the other
 +hand, the Automake-provided code for testsuite summary generation offers
 +support for test drivers allowing several test results per test script,
 +if they take care to register such results properly (@pxref{Log files
 +generation and test results recording}).
 +
 +The exact details of how test scripts' results are to be determined and
 +analyzed is left to the individual drivers.  Some drivers might only
 +consider the test script exit status (this is done for example by the
 +default test driver used by the parallel test harness, described
 +in the previous section).  Other drivers might implement more complex and
 +advanced test protocols, which might require them to parse and interpreter
 +the output emitted by the test script they're running (examples of such
 +protocols are TAP and SubUnit).
 +
 +It's very important to note that, even when using custom test drivers,
 +most of the infrastructure described in the previous section about the
 +parallel harness remains in place; this includes:
 +
 +@itemize
 +@item
 +list of test scripts defined in @code{TESTS}, and overridable at
 +runtime through the redefinition of @code{TESTS} or @code{TEST_LOGS};
 +@item
 +concurrency through the use of @command{make}'s option @option{-j};
 +@item
 +per-test @file{.log} and @file{.trs} files, and generation of a summary
 +@file{.log} file from them;
 +@item
 +@code{recheck} target, @code{RECHECK_LOGS} variable, and lazy reruns
 +of tests;
 +@item
 +inter-test dependencies;
 +@item
 +support for @code{check_*} variables (@code{check_PROGRAMS},
 +@code{check_LIBRARIES}, ...);
 +@item
 +use of @code{VERBOSE} environment variable to get verbose output on
 +testsuite failures;
 +@item
 +definition and honoring of @code{TESTS_ENVIRONMENT},
 +@code{AM_TESTS_ENVIRONMENT} and @code{AM_TESTS_FD_REDIRECT}
 +variables;
 +@item
 +definition of generic and extension-specific @code{LOG_COMPILER} and
 +@code{LOG_FLAGS} variables.
 +@end itemize
 +
 +@noindent
 +On the other hand, the exact semantics of how (and if)
 +@option{color-tests}, @code{XFAIL_TESTS}, and hard errors are supported
 +and handled is left to the individual test drivers.
 +
 +@c TODO: We should really add a working example in the doc/ directory,
 +@c TODO: and reference if from here.
 +
 +@node Declaring Custom Test Drivers
 +@subsection Declaring Custom Test Drivers
 +
 +@vindex _LOG_DRIVER
 +@vindex _LOG_DRIVER_FLAGS
 +@vindex LOG_DRIVER
 +@vindex LOG_DRIVER_FLAGS
 +@vindex @var{ext}_LOG_DRIVER
 +@vindex @var{ext}_LOG_DRIVER_FLAGS
 +@vindex AM_@var{ext}_LOG_DRIVER_FLAGS
 +@vindex AM_LOG_DRIVER_FLAGS
 +Custom testsuite drivers are declared by defining the make variables
 +@code{LOG_DRIVER} or @code{@var{ext}_LOG_DRIVER} (where @var{ext} must
 +be declared in @code{TEST_EXTENSIONS}).  They must be defined to
 +programs or scripts that will be used to drive the execution, logging,
 +and outcome report of the tests with corresponding extensions (or of
 +those with no registered extension in the case of @code{LOG_DRIVER}).
 +Clearly, multiple distinct test drivers can be declared in the same
 +@file{Makefile.am}.  Note moreover that the @code{LOG_DRIVER} variables
 +are @emph{not} a substitute for the @code{LOG_COMPILER} variables: the
 +two sets of variables can, and often do, usefully and legitimately
 +coexist.
 +
 +@c TODO: We should really be able to point to a clarifying example here!
 +
 +The developer-reserved variable @code{AM_LOG_DRIVER_FLAGS} and the
 +user-reserved variable @code{LOG_DRIVER_FLAGS} can be used to define
 +flags that will be passed to each invocation of @code{LOG_DRIVER},
 +with the user-defined flags obviously taking precedence over the
 +developer-reserved ones.  Similarly, for each extension @var{ext}
 +declared in @code{TEST_EXTENSIONS}, flags listed in
 +@code{AM_@var{ext}_LOG_DRIVER_FLAGS} and
 +@code{@var{ext}_LOG_DRIVER_FLAGS} will be passed to
 +invocations of @code{@var{ext}_LOG_DRIVER}.
 +
 +@node API for Custom Test Drivers
 +@subsection API for Custom Test Drivers
 +
 +Note that @emph{the APIs described here are still somewhat experimental},
 +and might undergo changes and tightenings in the future, to accommodate
 +for new features or to satisfy additional portability requirements.
 +
 +The main characteristic of these APIs is that they are designed to share
 +as much infrastructure, semantics, and implementation details as possible
 +with the parallel test harness and its default driver.
 +
 +@menu
 +* Command-line arguments for test drivers::
 +* Log files generation and test results recording::
 +* Testsuite progress output::
 +* HTML generation from testsuite logs::
 +@end menu
 +
 +@node Command-line arguments for test drivers
 +@subsubsection Command-line arguments for test drivers
 +
 +A custom driver can rely on various command-line options and arguments
 +being passed to it automatically by the Automake's @option{parallel-tests}
 +harness.  It is @emph{mandatory} that it understands all of them (even
 +if the exact interpretation of the associated semantics can legitimately
 +change between a test driver and another, and even be a no-op in some
 +drivers).
 +
 +@noindent
 +Here is the list of options:
 +
 +@table @option
 +@item --test-name=@var{NAME}
 +The name of the test, with VPATH prefix (if any) removed.  This can have a
 +suffix and a directory component (as in e.g., @file{sub/foo.test}), and is
 +mostly meant to be used in console reports about testsuite advancements and
 +results (@pxref{Testsuite progress output}).
 +@item --log-file=@file{@var{PATH}.log}
 +The @file{.log} file the test driver must create (@pxref{Basics of
 +test metadata}).  If it has a directory component (as in e.g.,
 +@file{sub/foo.log}), the test harness will ensure that such directory
 +exists @emph{before} the test driver is called.
 +@item --trs-file=@file{@var{PATH}.trs}
 +The @file{.trs} file the test driver must create (@pxref{Basics of
 +test metadata}).  If it has a directory component (as in e.g.,
 +@file{sub/foo.trs}), the test harness will ensure that such directory
 +exists @emph{before} the test driver is called.
 +@item --color-tests=@{yes|no@}
 +Whether the console output should be colorized or not (@pxref{Simple
 +tests and color-tests}, to learn when this option gets activated and
 +when it doesn't).
 +@item --expect-failure=@{yes|no@}
 +Whether the tested program is expected to fail.
 +@item --enable-hard-errors=@{yes|no@}
 +Whether ``hard errors'' in the tested program should be treated differently
 +from normal failures or not (the default should be @code{yes}).  The exact
 +meaning of ``hard error'' is highly dependent from the test protocols or
 +conventions in use.
 +@item --
 +Explicitly terminate the list of options.
 +@end table
 +
 +@noindent
 +The first non-option argument passed to the test driver is the program to
 +be run, and all the following ones are command-line options and arguments
 +for this program.
 +
 +Note that the exact semantics attached to the @option{--color-tests},
 +@option{--expect-failure} and @option{--enable-hard-errors} options are
 +left up to the individual test drivers.  Still, having a behaviour
 +compatible or at least similar to that provided by the default
 +@option{parallel-tests} driver is advised, as that would offer a better
 +consistency and a more pleasant user experience.
 +
 +@node Log files generation and test results recording
 +@subsubsection Log files generation and test results recording
 +
 +The test driver must correctly generate the files specified by the
 +@option{--log-file} and @option{--trs-file} option (even when the tested
 +program fails or crashes).
 +
 +The @file{.log} file should ideally contain all the output produced by the
 +tested program, plus optionally other information that might facilitate
 +debugging or analysis of bug reports.  Apart from that, its format is
 +basically free; the only limitation being that it must parse validly as
 +reStructuredText if the @file{.log} -> @file{.html} conversion is to be
 +supported.
 +
 +The @file{.trs} file is used to register some metadata through the use
 +of custom reStructuredText fields.  This metadata is expected to be
 +employed in various ways by the parallel test harness; for example, to
 +count the test results when printing the testsuite summary, or to decide
 +which tests to re-run upon @command{make reheck}.  Unrecognized metadata
 +in a @file{.trs} file is currently ignored by the harness, but this might
 +change in the future. The list of currently recognized metadata follows.
 +
 +@table @code
 +
 +@item :test-result:
 +@cindex Register test result
 +@cindex Register test case result
 +@cindex Test result, registering
 +@cindex Test case result, registering
 +@cindex @code{:test-result:}
 +@cindex reStructuredText field, @code{:test-result:}
 +The test driver must use this field to register the results of @emph{each}
 +test case run by a test script file.  Several @code{:test-result:} fields
 +can be present in the same @file{.trs} file; this is done in order to
 +support test protocols that allow a single test script to run more test
 +cases.
 +
 +@c Keep this in sync with lib/am/check-am:$(TEST_SUITE_LOG).
 +The only recognized test results are currently @code{PASS}, @code{XFAIL},
 +@code{SKIP}, @code{FAIL}, @code{XPASS} and @code{ERROR}.  These results,
 +when declared with @code{:test-result:}, can be optionally followed by
 +text holding the name and/or a brief description of the corresponding
 +test; the @option{parallel-tests} harness will ignore such extra text when
 +generating @file{test-suite.log} and preparing the testsuite summary.
 +
 +@c Keep in sync with 'test-metadata-recheck.test'.
 +@item @code{:recheck:}
 +@cindex :recheck:
 +@cindex reStructuredText field, @code{:recheck:}
 +If this field is present and defined to @code{no}, then the corresponding
 +test script will @emph{not} be run upon a @command{make recheck}.  What
 +happens when two or more @code{:recheck:} fields are present in the same
 +@file{.trs} file is undefined behaviour.
 +
 +@c Keep in sync with 'test-metadata-global-log.test'.
 +@item @code{:copy-in-global-log:}
 +@cindex :copy-in-global-log:
 +@cindex reStructuredText field, @code{:copy-in-global-log:}
 +If this field is present and defined to @code{no}, then the content
 +of the @file{.log} file will @emph{not} be copied into the global
 +@file{test-suite.log}.  We allow to forsake such copying because, while
 +it can be useful in debugging and analysis of bug report, it can also be
 +just a waste of space in normal situations, e.g., when a test script is
 +successful.  What happens when two or more @code{:copy-in-global-log:}
 +fields are present in the same @file{.trs} file is undefined behaviour.
 +
 +@c Keep in sync with 'test-metadata-global-result.test'.
 +@item @code{:test-global-result:}
 +@cindex :test-global-result:
 +@cindex reStructuredText field, @code{:test-global-result:}
 +This is used to declare the "global result" of the script.  Currently,
 +the value of this field is needed only to be reported (more or less
 +verbatim) in the generated global log file @code{$(TEST_SUITE_LOG)},
 +so it's quite free-form.  For example, a test script which run 10 test
 +cases, 6 of which pass and 4 of which are skipped, could reasonably have
 +a @code{PASS/SKIP} value for this field, while a test script which run
 +19 successful tests and one failed test could have an @code{ALMOST
 +PASSED} value.  What happens when two or more @code{:test-global-result:}
 +fields are present in the same @file{.trs} file is undefined behaviour.
 +@end table
 +
 +@noindent
 +Let's see a small example.  Assume a @file{.trs} file contains the
 +following lines:
 +
 +@example
 +:test-result: PASS server starts
 +:global-log-copy: no
 +:test-result: PASS HTTP/1.1 request
 +:test-result: FAIL HTTP/1.0 request
 +:recheck: yes
 +:test-result: SKIP HTTPS request (TLS library wasn't available)
 +:test-result: PASS server stops
 +@end example
 +
 +@noindent
 +Then the corresponding test script will be re-run by @command{make check},
 +will contribute with @emph{five} test results to the testsuite summary
 +(three of these tests being successful, one failed, and one skipped), and
 +the content of the corresponding @file{.log} file will @emph{not} be
 +copied in the global log file @file{test-suite.log}.
 +
 +@node Testsuite progress output
 +@subsubsection Testsuite progress output
 +
 +A custom test driver also has the task of displaying, on the standard
 +output, the test results as soon as they become available.  Depending on
 +the protocol in use, it can also display the reasons for failures and
 +skips, and, more generally, any useful diagnostic output (but remember
 +that each line on the screen is precious, so that cluttering the screen
 +with overly verbose information is bad idea).  The exact format of this
 +progress output is left up to the test driver; in fact, a custom test
 +driver might @emph{theoretically} even decide not to do any such report,
 +leaving it all to the testsuite summary (that would be a very lousy idea,
 +of course, and serves only to illustrate the flexibility that is
 +granted here).
 +
 +Remember that consistency is good; so, if possible, try to be consistent
 +with the output of the built-in Automake test drivers, providing a similar
 +``look & feel''.  In particular, the testsuite progress output should be
 +colorized when the @option{--color-tests} is passed to the driver.  On the
 +other end, if you are using a known and widespread test protocol with
 +well-established implementations, being consistent with those
 +implementations' output might be a good idea too.
 +
 +@c TODO: Give an example, maybe inspired to py.test-style output.
 +@c TODO: That is a good idea because it shows a test driver that allows
 +@c TODO: for different levels of verbosity in the progress output (could
 +@c TODO: be implemented either using a driver cmdline flag, or an
 +@c TODO: environment variable, or both).
 +
 +@node HTML generation from testsuite logs
 +@subsubsection HTML generation from testsuite logs
 +
 +If HTML testsuite output (with @code{check-html}) is to be supported,
 +the generated @file{.log} files must contain syntactically valid
 +reStructuredText.  If this is not the case, the HTML generation will not
 +work, although all the other functionalities of the Automake testsuite
 +harness should remain untouched, and continue to work correctly.
 +
 +@node Using the TAP test protocol
 +@section Using the TAP test protocol
 +
 +@menu
 +* Introduction to TAP::
 +* Use TAP with the Automake test harness::
 +* Incompatibilities with other TAP parsers and drivers::
 +* Links and external resources on TAP::
 +@end menu
 +
 +@node Introduction to TAP
 +@subsection Introduction to TAP
 +
 +TAP, the Test Anything Protocol, is a simple text-based interface between
 +testing modules or programs and a test harness.  The tests (also called
 +``TAP producers'' in this context) write test results in a simple format
 +on standard output; a test harness (also called ``TAP consumer'') will
 +parse and interpret these results, and properly present them to the user,
 +and/or register them for later analysis.  The exact details of how this
 +is accomplished can vary among different test harnesses.  The Automake
 +parallel harness will present the results on the console in the usual
 +fashion (@pxref{Testsuite progress on console}), and will use the
 +@file{.trs} files (@pxref{Basics of test metadata}) to store the test
 +results and related metadata.  Apart from that, it will try to remain
 +as much compatible as possible with pre-existing and widespread utilities,
 +such as the @uref{http://search.cpan.org/~andya/Test-Harness/bin/prove,
 +@command{prove} utility}, at least for the simpler usages.
 +
 +TAP started its life as part of the test harness for Perl, but today
 +it has been (mostly) standardized, and has various independent
 +implementations in different languages; among them, C, C++, Perl,
 +Python, PHP, and Java.  For a semi-official specification of the
 +TAP protocol, please refer to the documentation of
 +@uref{http://search.cpan.org/~petdance/Test-Harness/lib/Test/Harness/TAP.pod,
 +      @samp{Test::Harness::TAP}}.
 +
 +The most relevant real-world usages of TAP are obviously in the testsuites
 +of @command{perl} and of many perl modules.  Still, also other important
 +third-party packages, such as @uref{http://git-scm.com/, @command{git}},
 +use TAP in their testsuite.
 +
 +@node Use TAP with the Automake test harness
 +@subsection Use TAP with the Automake test harness
 +
 +Currently, the TAP driver that comes with Automake requires a perl
 +interpreter to work, and requires various by-hand steps on the
 +developer's part (this should be fixed in future Automake versions).
 +You'll have grab the @file{tap-driver.pl} script from the Automake
 +distribution by hand, copy it in your source tree, add code to
 +@file{configure.ac} to search a perl interpreter and to define the
 +@code{$(PERL)} variable accordingly, and use the Automake support
 +for third-party test drivers to instruct the harness to use the
 +@file{tap-driver.pl} to run your TAP-producing tests.  See the example
 +below for clarification.
 +
 +Apart from the options common to all the Automake test drivers
 +(@pxref{Command-line arguments for test drivers}), the @file{tap-driver.pl}
 +supports the following options, whose names are chosen for enhanced
 +compatibility with the @command{prove} utility.
 +
 +@table @option
 +@c Keep in sync with 'tap-exit.test' and 'tap-signal.test'.
 +@item --ignore-exit
 +Causes the test driver to ignore the exit status of the test scripts;
 +by default, the driver will report an error if the script exit with a
 +non-zero status.  This option has effect also
 +@item --comments
 +Instruct the test driver to display TAP diagnostic (i.e., lines beginning
 +with the @samp{#} character) in the testsuite progress output too; by
 +default, TAP diagnostic is only copied in the @file{.log} file.
 +@item --no-comments
 +Revert the effects of @option{--comments}.
 +@item --merge
 +Instruct the test driver to merge the test scripts' standard error into
 +their standard output.  This is necessary if you want to ensure that
 +diagnostics from the test scripts are displayed in the correct order
 +relative to test results; this can be of great help in debugging
 +(especially if your test scripts are shell scripts run with shell
 +tracing active).  As a downside, this option might cause the test
 +harness to get confused if anything that appears on standard error
 +looks like a test result.
 +@item --no-merge
 +Revert the effects of @option{--merge}.
 +@item --diagnostic-string=@var{STRING}
 +Change the string that introduces TAP diagnostic from the default value
 +of ``@code{#}'' to @code{@var{STRING}}.  This can be useful if your
 +TAP-based test scripts produce verbose output on which they have limited
 +control (because, say, the output comes by other tools invoked in the
 +scripts), and it might contain text that gets spuriously interpreted as
 +TAP diagnostic: such an issue can be solved by redefining the string that
 +activates TAP diagnostic to a value you know won't appear by chance in
 +the tests' output.  Note however that this feature is non-standard, as
 +the ``official'' TAP protocol does not allow for such a customization; so
 +don't use it if you can avoid it.
 +@end table
 +
 +@noindent
 +Here is an example of how the TAP driver can be set up and used.
 +
 +@c Keep in sync with tap-doc2.test.
 +@example
 +% @kbd{cat configure.ac}
 +AC_INIT([GNU Try Tap], [1.0], [bug-automake@@gnu.org])
 +AC_CONFIG_AUX_DIR([build-aux])
 +AM_INIT_AUTOMAKE([foreign parallel-tests -Wall -Werror])
 +AC_CONFIG_FILES([Makefile])
 +AC_REQUIRE_AUX_FILE([tap-driver.pl])
 +AC_PATH_PROG([PERL], [perl])
 +test -n "$PERL" || AC_MSG_ERROR([perl not found])
 +$PERL -MTAP::Parser -e 1 || AC_MSG_ERROR([TAP::Parser not found])
 +AC_OUTPUT
 +
 +% @kbd{cat Makefile.am}
 +TEST_LOG_DRIVER = $(PERL) $(srcdir)/build-aux/tap-driver.pl
 +TESTS = foo.test bar.test baz.test
 +EXTRA_DIST = $(TESTS)
 +
 +% @kbd{cat foo.test}
 +#!/bin/sh
 +echo 1..4 # Number of tests to be executed.
 +echo 'ok 1 - Swallows fly'
 +echo 'not ok 2 - Caterpillars fly # TODO metamorphosis in progress'
 +echo 'ok 3 - Pigs fly # SKIP not enough acid'
 +echo '# I just love word plays ...'
 +echo 'ok 4 - Flies fly too :-)'
 +
 +% @kbd{cat bar.test}
 +#!/bin/sh
 +echo 1..3
 +echo 'not ok 1 - Bummer, this test has failed.'
 +echo 'ok 2 - This passed though.'
 +echo 'Bail out! Ennui kicking in, sorry...'
 +echo 'ok 3 - This will not be seen.'
 +
 +% @kbd{cat baz.test}
 +#!/bin/sh
 +echo 1..1
 +echo ok 1
 +# Exit with error, even if all the test case has been successful.
 +exit 7
 +
 +% @kbd{cp @var{PREFIX}/share/automake-@var{APIVERSION}/tap-driver.pl .}
 +% @kbd{autoreconf -vi && ./configure && make check}
 +...
 +PASS: foo.test 1 - Swallows fly
 +XFAIL: foo.test 2 - Caterpillars fly # TODO metamorphosis in progress
 +SKIP: foo.test 3 - Pigs fly # SKIP not enough acid
 +PASS: foo.test 4 - Flies fly too :-)
 +FAIL: bar.test 1 - Bummer, this test has failed.
 +PASS: bar.test 2 - This passed though.
 +ERROR: bar.test - Bail out! Ennui kicking in, sorry...
 +PASS: baz.test 1
 +ERROR: baz.test - exited with status 7
 +...
 +Please report to bug-automake@@gnu.org
 +...
 +% @kbd{echo exit status: $?}
 +exit status: 1
 +
 +@c Keep the "skewed" indentation below, it produces pretty PDF output.
 +% @kbd{env TEST_LOG_DRIVER_FLAGS='--comments --ignore-exit' \
 +      TESTS='foo.test baz.test' make -e check}
 +...
 +PASS: foo.test 1 - Swallows fly
 +XFAIL: foo.test 2 - Caterpillars fly # TODO metamorphosis in progress
 +SKIP: foo.test 3 - Pigs fly # SKIP not enough acid
 +# foo.test: I just love word plays...
 +PASS: foo.test 4 - Flies fly too :-)
 +PASS: baz.test 1
 +...
 +% @kbd{echo exit status: $?}
 +exit status: 0
 +@end example
 +
 +@node Incompatibilities with other TAP parsers and drivers
 +@subsection Incompatibilities with other TAP parsers and drivers
 +
 +For implementation or historical reasons, the TAP driver and harness as
 +implemented by Automake have some minors incompatibilities with the
 +mainstream versions, which you should be aware of.
 +
 +@itemize @bullet
 +@item
 +A @code{Bail out!} directive doesn't stop the whole testsuite, but only
 +the test script it occurs into.  This doesn't follows TAP specifications,
 +but on the other hand it maximizes compatibility (and code sharing) with
 +the ``hard error'' concept of the default @option{parallel-tests} driver.
 +@item
 +The @code{version} and @code{pragma} directives are not supported.
 +@item
 +The @option{--diagnostic-string} option of out driver allows to modify
 +the string that introduces TAP diagnostic from the default value
 +of ``@code{#}''.  The standard TAP protocol has currently no way to
 +allow this, so if you use it your diagnostic will be lost to more
 +compliant tools like @command{prove} and @code{Test::Harness}
 +@item
 +And there are probably some other small and yet undiscovered
 +incompatibilities, especially in corner cases or with rare usages.
 +@end itemize
 +
 +@node Links and external resources on TAP
 +@subsection Links and external resources on TAP
 +
 +@noindent
 +Here are some links to more extensive official or third-party
 +documentation and resources about the TAP protocol and related
 +tools and libraries.
 +@itemize @bullet
 +@item
 +@uref{http://search.cpan.org/~petdance/Test-Harness/lib/Test/Harness/TAP.pod,
 +      @samp{Test::Harness::TAP}},
 +the (mostly) official documentation about the TAP format and protocol.
 +@item
 +@uref{http://search.cpan.org/~andya/Test-Harness/bin/prove,
 +      @command{prove}},
 +the most famous command-line TAP test driver, included in the distribution
 +of @command{perl} and
 +@uref{http://search.cpan.org/~andya/Test-Harness/lib/Test/Harness.pm,
 +      @samp{Test::Harness}}.
 +@item
 +The @uref{http://testanything.org/wiki/index.php/Main_Page,TAP wiki}.
 +@item
 +A ``gentle introduction'' to testing for perl coders:
 +@uref{http://search.cpan.org/dist/Test-Simple/lib/Test/Tutorial.pod,
 +      @samp{Test::Tutorial}}.
 +@item
 +@uref{http://search.cpan.org/~mschwern/Test-Simple/lib/Test/Simple.pm,
 +      @samp{Test::Simple}}
 +and
 +@uref{http://search.cpan.org/~mschwern/Test-Simple/lib/Test/More.pm,
 +      @samp{Test::More}},
 +the standard perl testing libraries, which are based on TAP.
 +@item
 +@uref{http://www.eyrie.org/~eagle/software/c-tap-harness/,C TAP Harness},
 +a C-based project implementing both a TAP producer and a TAP consumer.
 +@item
 +@uref{http://www.tap4j.org/,tap4j},
 +a Java-based project implementing both a TAP producer and a TAP consumer.
 +@end itemize
  
  @node DejaGnu Tests
  @section DejaGnu Tests
@@@ -9865,6 -9113,8 +9866,6 @@@ appear in @code{EXTRA_DEJAGNU_SITE_CONF
  For more information regarding DejaGnu test suites, see @ref{Top, , ,
  dejagnu, The DejaGnu Manual}.
  
 -In either case, the testing is done via @samp{make check}.
 -
  @node Install Tests
  @section Install Tests
  
@@@ -9977,16 -9227,8 +9978,16 @@@ will now be rerun each time the versio
  @node Options
  @chapter Changing Automake's Behavior
  
 +@menu
 +* Options generalities::        Semantics of Automake option
 +* List of Automake options::    A comprehensive list of Automake options
 +@end menu
 +
 +@node Options generalities
 +@section Options generalities
 +
  Various features of Automake can be controlled by options.  Except where
 -noted otherwise, options can be specified in one of several ways: Most
 +noted otherwise, options can be specified in one of several ways Most
  options can be applied on a per-@file{Makefile} basis when listed in a
  special @file{Makefile} variable named @code{AUTOMAKE_OPTIONS}.  Some
  of these options only make sense when specified in the toplevel
  require changes to the @command{configure} script can only be specified
  there.  These are annotated below.
  
 -Currently understood options are:
 +As a general rule, options specified in @code{AUTOMAKE_OPTIONS} take
 +precedence over those specified in @code{AM_INIT_AUTOMAKE}, which in
 +turn take precedence over those specified on the command line.
 +
 +Also, some care must be taken about the interactions among strictness
 +level and warning categories.  As a general rule, strictness-implied
 +warnings are overridden by those specified by explicit options.  For
 +example, even if @samp{portability} warnings are disabled by default
 +in @option{foreign} strictness, an usage like this will end up enabling
 +them:
 +
 +@example
 +AUTOMAKE_OPTIONS = -Wportability foreign
 +@end example
 +
 +However, a strictness level specified in a higher-priority context
 +will override all the explicit warnings specified in a lower-priority
 +context.  For example, if @file{configure.ac} contains:
 +
 +@example
 +AM_INIT_AUTOMAKE([-Wportability])
 +@end example
 +
 +@noindent
 +and @file{Makefile.am} contains:
 +
 +@example
 +AUTOMAKE_OPTIONS = foreign
 +@end example
 +
 +@noindent
 +then @samp{portability} warnings will be @emph{disabled} in
 +@file{Makefile.am}.
 +
 +@node List of Automake options
 +@section List of Automake options
 +
  @vindex AUTOMAKE_OPTIONS
  
  @table @asis
  Set the strictness as appropriate.  The @option{gnits} option also
  implies options @option{readme-alpha} and @option{check-news}.
  
 -@item @option{ansi2knr}
 -@itemx @option{@var{path}/ansi2knr}
 -@cindex Option, @option{ansi2knr}
 -@opindex ansi2knr
 -Turn on the deprecated de-ANSI-fication feature (@pxref{ANSI}).  Note
 -that that feature and this option @emph{will be removed} in the next
 -major Automake release.
 -
 -If preceded by a
 -path, the generated @file{Makefile.in} will look in the specified
 -directory to find the @file{ansi2knr} program.  The path should be a
 -relative path to another directory in the same distribution (Automake
 -does not check this).
 -
  @item @option{check-news}
  @cindex Option, @option{check-news}
  @opindex check-news
@@@ -10061,9 -9281,8 +10062,9 @@@ in the first few lines of the @file{NEW
  @item @option{color-tests}
  @cindex Option, @option{color-tests}
  @opindex color-tests
 -Cause output of the simple test suite (@pxref{Simple Tests}) to be
 -colorized on capable terminals.
 +Cause output of the serial and parallel test harnesses (see @ref{Simple
 +Tests}) and of properly-written custom test drivers (@pxref{Custom Test
 +Drivers}) to be colorized on capable terminals.
  
  @item @option{dejagnu}
  @cindex Option, @option{dejagnu}
@@@ -10191,8 -9410,8 +10192,8 @@@ this directory
  @item @option{parallel-tests}
  @cindex Option, @option{parallel-tests}
  @opindex parallel-tests
 -Enable test suite driver for @code{TESTS} that can run tests in parallel
 -(@pxref{Simple Tests using parallel-tests}, for more information).
 +Enable test suite harness for @code{TESTS} that can run tests in parallel
 +(@pxref{Parallel Test Harness}, for more information).
  
  @item @option{readme-alpha}
  @cindex Option, @option{readme-alpha}
@@@ -10355,7 -9574,7 +10356,7 @@@ the @code{AM_INIT_AUTOMAKE} macro in @f
  There are a few rules and variables that didn't fit anywhere else.
  
  @menu
 -* Tags::                        Interfacing to etags and mkid
 +* Tags::                        Interfacing to cscope, etags and mkid
  * Suffixes::                    Handling new file extensions
  * Multilibs::                   Support for multilibs.
  @end menu
@@@ -10417,14 -9636,6 +10418,14 @@@ Automake will also generate an @code{ID
  directory-by-directory basis.
  @trindex id
  
 +Similarly, the @code{cscope} rule will create a list of all the source
 +files in the tree and run @command{cscope} to build an inverted index
 +database.  The variable @code{CSCOPE} is the name of the program to invoke
 +(by default @command{cscope}); @code{CSCOPEFLAGS} and
 +@code{CSCOPE_ARGS} can be used by the user to pass additional flags and
 +file names respectively, while @code{AM_CSCOPEFLAGS} can be used by the
 +@file{Makefile.am}.
 +
  Finally, Automake also emits rules to support the
  @uref{http://www.gnu.org/software/global/, GNU Global Tags program}.
  The @code{GTAGS} rule runs Global Tags and puts the
@@@ -14287,7 -13498,7 +14288,7 @@@ parentheses is the number of generated 
  @c  LocalWords:  xs emph FIXME ref vindex pkglibdir pkgincludedir pkgdatadir mt
  @c  LocalWords:  pkg libdir cpio bindir sbindir rmt pax sbin zar zardir acindex
  @c  LocalWords:  HTML htmldir html noinst TEXINFOS nodist nobase strudel CFLAGS
 -@c  LocalWords:  libmumble CC YFLAGS ansi knr itemx de fication config url comp
 +@c  LocalWords:  libmumble CC YFLAGS itemx de fication config url comp
  @c  LocalWords:  depcomp elisp sh mdate mkinstalldirs mkdir py tex dvi ps pdf
  @c  LocalWords:  ylwrap zardoz INIT gettext acinclude mv FUNCS LIBOBJS LDADD fr
  @c  LocalWords:  uref featureful dnl src LINGUAS es ko nl pl sl sv PROG ISC doc
  @c  LocalWords:  dirlist noindent usr MULTILIB multilib Multilibs TIOCGWINSZ sc
  @c  LocalWords:  GWINSZ termios SRCDIR tarball bzip LISPDIR lispdir XEmacs CCAS
  @c  LocalWords:  emacsen MicroEmacs CCASFLAGS UX GCJ gcj GCJFLAGS posix DMALLOC
 -@c  LocalWords:  dmalloc ldmalloc REGEX regex rx DEPDIR DEP DEFUN aclocaldir fi
 +@c  LocalWords:  dmalloc ldmalloc REGEX regex DEPDIR DEP DEFUN aclocaldir fi
  @c  LocalWords:  mymacro myothermacro AMFLAGS autopoint autogen libtoolize yum
  @c  LocalWords:  autoheader README MAKEFLAGS subdir Inetutils sync COND endif
  @c  LocalWords:  Miller's installable includedir inc pkgdata EXEEXT libexec bsd
  @c  LocalWords:  LTALLOCA MALLOC malloc memcmp strdup alloca libcompat xyz DFOO
  @c  LocalWords:  unprefixed buildable preprocessed DBAZ DDATADIR WARNINGCFLAGS
  @c  LocalWords:  LIBFOOCFLAGS LIBFOOLDFLAGS ftable testSubDir obj LIBTOOLFLAGS
 -@c  LocalWords:  barexec Pinard's automatize initialize lzip lzma xz
 +@c  LocalWords:  barexec Pinard's automatize initialize lzip lzma xz cscope
diff --combined tests/Makefile.am
@@@ -1,7 -1,8 +1,8 @@@
  ## Process this file with automake to create Makefile.in
  
  # Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
- # 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, Inc.
+ # 2006, 2007, 2008, 2009, 2010, 2011, 2012 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
  # You should have received a copy of the GNU General Public License
  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
  
 +# Run the tests with the shell detected at configure time.
 +LOG_COMPILER = $(SHELL)
 +
 +TEST_EXTENSIONS = .test .tap
 +TEST_LOG_COMPILER = $(LOG_COMPILER)
 +TAP_LOG_COMPILER = $(LOG_COMPILER)
 +
 +TAP_LOG_DRIVER = AM_TAP_AWK='$(AWK)' $(SHELL) $(top_srcdir)/lib/tap-driver.sh
 +
 +AM_TAP_LOG_DRIVER_FLAGS = --merge --comments
 +## Avoid spurious TAP diagnostic.  We use an awful indirection with a
 +## shell command substitution here, since the string needs to contain
 +## `#' characters, and these can't be escaped portably in a make macro
 +## definition.
 +## FIXME: this is quite inefficient though, as it adds one extra fork
 +## FIXME: per TAP test script; this is OK for the moment, since we have
 +## FIXME: few such scripts, but might become an issue in the future.
 +## Keep this in sync with the definition of $diag_string_ in tests/defs.
 +AM_TAP_LOG_DRIVER_FLAGS += --diagnostic-string `printf '\043%%\043\n'`
 +
 +EXTRA_DIST = ChangeLog-old
 +
 +TESTS = ## Will be updated later.
 +
  XFAIL_TESTS = \
  all.test \
 -auxdir2.test \
  cond17.test \
 -dist-auxfile.test \
 -dist-auxfile-2.test \
  gcj6.test \
 +override-conditional-2.test \
  java-nobase.test \
+ objext-pr10128.test \
  pr8365-remake-timing.test \
  lex-subobj-nodep.test \
  remake-am-pr10111.test \
@@@ -53,133 -33,985 +55,133 @@@ remake-m4-pr10111.test 
  vala-vpath.test \
  txinfo5.test
  
 -include $(srcdir)/parallel-tests.am
 +# Some testsuite-influential variables should be overridable from the
 +# test scripts, but not from the environment.
 +AM_TESTS_ENVIRONMENT = \
 +  for v in \
 +    me \
 +    required \
 +    am_using_tap \
 +    am_parallel_tests \
 +    am_test_prefer_config_shell \
 +    am_original_AUTOMAKE \
 +    am_original_ACLOCAL \
 +  ; do \
 +    eval test x"\$${$$v}" = x || unset $$v; \
 +  done;
 +# The `AM_TESTS_REEXEC=no' setting tells the tests not to needlessly
 +# re-execute themselves with the shell detected at configure time, since
 +# we are already running them under it explicitly in our setup (see e.g.
 +# the definition of TEST_LOG_COMPILER above).
 +AM_TESTS_ENVIRONMENT += AM_TESTS_REEXEC=no; export AM_TESTS_REEXEC;
 +# We want warning messages and explanations for skipped tests to go to
 +# the console if possible, so set up `stderr_fileno_' properly.
 +AM_TESTS_FD_REDIRECT = 9>&2
 +AM_TESTS_ENVIRONMENT += stderr_fileno_=9; export stderr_fileno_;
  
 -$(srcdir)/parallel-tests.am: gen-parallel-tests Makefile.am
 -      (cd $(srcdir) && $(SHELL) ./gen-parallel-tests) >$@
 +# Hand-written tests.
  
 -$(parallel_tests): $(parallel_tests:-p.test=.test) Makefile.am
 -      input=`echo $@ | sed 's,.*/,,; s,-p.test$$,.test,'`; \
 -      sed 's|^\. \./defs.*|parallel_tests=yes; &|' \
 -        < $(srcdir)/$$input >$@
 -      chmod a+rx $@
 +include $(srcdir)/list-of-tests.mk
  
 -MAINTAINERCLEANFILES = $(parallel_tests)
 +TESTS += $(handwritten_TESTS)
 +EXTRA_DIST += $(handwritten_TESTS)
  
 -# Some testsuite-influential variables should be overridable from the
 -# test scripts, but not from the environment.
 -TESTS_ENVIRONMENT = \
 -  test x"$$me" = x || unset me; \
 -  test x"$$required" = x || unset required; \
 -  test x"$$parallel_tests" = x || unset parallel_tests;
 +# Automatically-generated tests wrapping hand-written ones.
 +# Also, automatically-computed dependencies for tests.
  
 -TESTS = \
 -get-sysconf.test \
 -self-check-env-sanitize.test \
 -self-check-report.test \
 -aclibobj.test \
 -aclocal.test \
 -aclocal3.test \
 -aclocal4.test \
 -aclocal5.test \
 -aclocal6.test \
 -aclocal7.test \
 -aclocal8.test \
 -aclocal9.test \
 -acloca10.test \
 -acloca11.test \
 -acloca12.test \
 -acloca13.test \
 -acloca14.test \
 -acloca15.test \
 -acloca16.test \
 -acloca17.test \
 -acloca18.test \
 -acloca19.test \
 -acloca20.test \
 -acloca21.test \
 -acloca22.test \
 -aclocal-acdir.test \
 -aclocal-install-absdir.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 \
 -acoutqnl.test \
 -acoutbs.test \
 -acoutbs2.test \
 -acsilent.test \
 -acsubst.test \
 -acsubst2.test \
 -all.test \
 -all2.test \
 -alloca.test \
 -alloca2.test \
 -alpha.test \
 -alpha2.test \
 -amhello-cflags.test \
 -amhello-cross-compile.test \
 -amhello-binpkg.test \
 -amassign.test \
 -ammissing.test \
 -amopt.test \
 -amsubst.test \
 -ansi2knr-deprecation.test \
 -ansi.test \
 -ansi2.test \
 -ansi3.test \
 -ansi3b.test \
 -ansi4.test \
 -ansi5.test \
 -ansi6.test \
 -ansi7.test \
 -ansi8.test \
 -ansi9.test \
 -ansi10.test \
 -ar.test \
 -ar2.test \
 -asm.test \
 -asm2.test \
 -asm3.test \
 -autodist.test \
 -autodist-subdir.test \
 -autodist-acconfig.test \
 -autodist-acconfig-no-subdir.test \
 -autodist-aclocal-m4.test \
 -autodist-config-headers.test \
 -autodist-configure-no-subdir.test \
 -autodist-no-duplicate.test \
 -autodist-stamp-vti.test \
 -autohdr.test \
 -autohdr2.test \
 -autohdr3.test \
 -autohdr4.test \
 -autohdrdry.test \
 -automake.test \
 -auxdir.test \
 -auxdir2.test \
 -auxdir3.test \
 -auxdir4.test \
 -backsl.test \
 -backsl2.test \
 -backsl3.test \
 -backsl4.test \
 -badline.test \
 -badopt.test \
 -badprog.test \
 -block.test \
 -bsource.test \
 -canon.test \
 -canon2.test \
 -canon3.test \
 -canon4.test \
 -canon5.test \
 -canon-name.test \
 -ccnoco.test \
 -ccnoco2.test \
 -ccnoco3.test \
 -check.test \
 -check2.test \
 -check3.test \
 -check4.test \
 -check5.test \
 -check6.test \
 -check7.test \
 -check8.test \
 -check9.test \
 -check10.test \
 -check11.test \
 -check-exported-srcdir.test \
 -check-tests-in-builddir.test \
 -check-tests_environment.test \
 -check-concurrency-bug9245.test \
 -tests-environment-backcompat.test \
 -checkall.test \
 -clean.test \
 -clean2.test \
 -colneq.test \
 -colneq2.test \
 -colon.test \
 -colon2.test \
 -colon3.test \
 -colon4.test \
 -colon5.test \
 -colon6.test \
 -colon7.test \
 -color.test \
 -color2.test \
 -comment.test \
 -comment2.test \
 -comment3.test \
 -comment4.test \
 -comment5.test \
 -comment6.test \
 -comment7.test \
 -comment8.test \
 -comment9.test \
 -commen10.test \
 -commen11.test \
 -comments-in-var-def.test \
 -compile.test \
 -compile2.test \
 -compile_f90_c_cxx.test \
 -compile_f_c_cxx.test \
 -cond.test \
 -cond2.test \
 -cond3.test \
 -cond4.test \
 -cond5.test \
 -cond6.test \
 -cond7.test \
 -cond8.test \
 -cond9.test \
 -cond10.test \
 -cond11.test \
 -cond13.test \
 -cond14.test \
 -cond15.test \
 -cond16.test \
 -cond17.test \
 -cond18.test \
 -cond19.test \
 -cond20.test \
 -cond21.test \
 -cond22.test \
 -cond23.test \
 -cond24.test \
 -cond25.test \
 -cond26.test \
 -cond27.test \
 -cond28.test \
 -cond29.test \
 -cond30.test \
 -cond31.test \
 -cond32.test \
 -cond33.test \
 -cond34.test \
 -cond35.test \
 -cond36.test \
 -cond37.test \
 -cond38.test \
 -cond39.test \
 -cond40.test \
 -cond41.test \
 -cond42.test \
 -cond43.test \
 -cond44.test \
 -cond45.test \
 -condd.test \
 -condhook.test \
 -condhook2.test \
 -condinc.test \
 -condinc2.test \
 -condlib.test \
 -condman.test \
 -condman2.test \
 -condman3.test \
 -configure.test \
 -confdeps.test \
 -conff.test \
 -conff2.test \
 -confh.test \
 -confh4.test \
 -confh5.test \
 -confh6.test \
 -confh7.test \
 -confh8.test \
 -confincl.test \
 -conflnk.test \
 -conflnk2.test \
 -conflnk3.test \
 -conflnk4.test \
 -confsub.test \
 -confvar.test \
 -confvar2.test \
 -copy.test \
 -ctarget1.test \
 -cxx.test \
 -cxx2.test \
 -cxxansi.test \
 -cxxcpp.test \
 -cxxlibobj.test \
 -cxxlink.test \
 -cxxnoc.test \
 -cxxo.test \
 -cygwin32.test \
 -dash.test \
 -defun.test \
 -defun2.test \
 -dejagnu.test \
 -dejagnu2.test \
 -dejagnu3.test \
 -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 \
 -deleted-am.test \
 -deleted-m4.test \
 -depacl2.test \
 -depcomp.test \
 -depcomp2.test \
 -depcomp3.test \
 -depcomp4.test \
 -depcomp5.test \
 -depcomp6.test \
 -depcomp7.test \
 -depcomp8a.test \
 -depcomp8b.test \
 -depcomp9.test \
 -depcomp10.test \
 -depdist.test \
 -depend.test \
 -depend2.test \
 -depend3.test \
 -depend4.test \
 -depend5.test \
 -depend6.test \
 -destdir.test \
 -dirlist.test \
 -dirlist2.test \
 -discover.test \
 -dist-auxfile.test \
 -dist-auxfile-2.test \
 -dist-included-parent-dir.test \
 -distcleancheck.test \
 -distcom2.test \
 -distcom3.test \
 -distcom4.test \
 -distcom5.test \
 -distcom6.test \
 -distcom7.test \
 -distdir.test \
 -distlinks.test \
 -distlinksbrk.test \
 -distname.test \
 -distcheck-configure-flags.test \
 -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 \
 -dollar.test \
 -dollarvar.test \
 -dollarvar2.test \
 -double.test \
 -dup2.test \
 -else.test \
 -empty.test \
 -empty2.test \
 -empty3.test \
 -empty4.test \
 -exdir.test \
 -exdir2.test \
 -exdir3.test \
 -exeext.test \
 -exeext2.test \
 -exeext3.test \
 -exeext4.test \
 -exsource.test \
 -ext.test \
 -ext2.test \
 -extra.test \
 -extra2.test \
 -extra3.test \
 -extra4.test \
 -extra5.test \
 -extra6.test \
 -extra7.test \
 -extra8.test \
 -extra10.test \
 -extra11.test \
 -extra12.test \
 -extradep.test \
 -extradep2.test \
 -f90only.test \
 -flavor.test \
 -flibs.test \
 -fn99.test \
 -fn99subdir.test \
 -fnoc.test \
 -fo.test \
 -forcemiss.test \
 -forcemiss2.test \
 -fort1.test \
 -fort2.test \
 -fort4.test \
 -fort5.test \
 -fonly.test \
 -fortdep.test \
 -gcj.test \
 -gcj2.test \
 -gcj3.test \
 -gcj4.test \
 -gcj5.test \
 -gcj6.test \
 -getopt.test \
 -gettext.test \
 -gettext2.test \
 -gettext3.test \
 -gnumake.test \
 -gnuwarn.test \
 -gnuwarn2.test \
 -gnits.test \
 -gnits2.test \
 -gnits3.test \
 -hdr-vars-defined-once.test \
 -header.test \
 -help.test \
 -help2.test \
 -help3.test \
 -help4.test \
 -help-depend.test \
 -help-depend2.test \
 -help-dmalloc.test \
 -help-init.test \
 -help-lispdir.test \
 -help-multilib.test \
 -help-python.test \
 -help-regex.test \
 -help-silent.test \
 -help-upc.test \
 -hfs.test \
 -hosts.test \
 -implicit.test \
 -info.test \
 -init.test \
 -init2.test \
 -insh2.test \
 -install2.test \
 -installdir.test \
 -install-info-dir.test \
 -instsh.test \
 -instsh2.test \
 -instsh3.test \
 -instdat.test \
 -instdat2.test \
 -instdir.test \
 -instdir2.test \
 -instdir-java.test \
 -instdir-lisp.test \
 -instdir-ltlib.test \
 -instdir-prog.test \
 -instdir-python.test \
 -instdir-texi.test \
 -instexec.test \
 -instfail.test \
 -instfail-info.test \
 -instfail-java.test \
 -instfail-libtool.test \
 -insthook.test \
 -instman.test \
 -instman2.test \
 -instmany.test \
 -instmany-mans.test \
 -instmany-python.test \
 -instspc.test \
 -interp.test \
 -interp2.test \
 -java.test \
 -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 \
 -lex2.test \
 -lex3.test \
 -lex4.test \
 -lex5.test \
 -lex-subobj-nodep.test \
 -lflags.test \
 -lflags2.test \
 -libexec.test \
 -libobj2.test \
 -libobj3.test \
 -libobj4.test \
 -libobj5.test \
 -libobj7.test \
 -libobj8.test \
 -libobj10.test \
 -libobj11.test \
 -libobj12.test \
 -libobj13.test \
 -libobj14.test \
 -library.test \
 -library2.test \
 -library3.test \
 -libtool.test \
 -libtool2.test \
 -libtool3.test \
 -libtool4.test \
 -libtool5.test \
 -libtool6.test \
 -libtool7.test \
 -libtool8.test \
 -libtool9.test \
 -libtoo10.test \
 -libtoo11.test \
 -license.test \
 -license2.test \
 -link_c_cxx.test \
 -link_dist.test \
 -link_f90_only.test \
 -link_fc.test \
 -link_fccxx.test \
 -link_fcxx.test \
 -link_f_only.test \
 -lisp2.test \
 -lisp3.test \
 -lisp4.test \
 -lisp5.test \
 -lisp6.test \
 -lisp7.test \
 -lisp8.test \
 -lispdry.test \
 -listval.test \
 -location.test \
 -longline.test \
 -longlin2.test \
 -ltcond.test \
 -ltcond2.test \
 -ltconv.test \
 -ltdeps.test \
 -ltinit.test \
 -ltinstloc.test \
 -ltlibobjs.test \
 -ltlibsrc.test \
 -ltorder.test \
 -lzip.test \
 -lzma.test \
 -m4-inclusion.test \
 -maintclean.test \
 -maintclean-vpath.test \
 -maintmode-configure-msg.test \
 -make.test \
 -makefile-deps.test \
 -makej.test \
 -makej2.test \
 -maken.test \
 -maken2.test \
 -maken3.test \
 -maken4.test \
 -makevars.test \
 -man.test \
 -man2.test \
 -man3.test \
 -man4.test \
 -man5.test \
 -mdate.test \
 -mdate2.test \
 -mdate3.test \
 -mdate4.test \
 -mdate5.test \
 -mdate6.test \
 -missing.test \
 -missing2.test \
 -missing3.test \
 -missing4.test \
 -missing5.test \
 -missing6.test \
 -missing-tar.test \
 -mkinstall.test \
 -mkinst2.test \
 -mkinst3.test \
 -mmode.test \
 -mmodely.test \
 -multlib.test \
 -nobase.test \
 -nobase-libtool.test \
 -nobase-python.test \
 -nobase-nodist.test \
 -nodef.test \
 -nodef2.test \
 -nodep.test \
 -nodep2.test \
 -nodepcomp.test \
 -nodist.test \
 -nodist2.test \
 -nodist3.test \
 -nogzip.test \
 -nogzip2.test \
 -noinst.test \
 -noinstdir.test \
 -nolink.test \
 -nostdinc.test \
 -notrans.test \
 -number.test \
 -objc.test \
 -objc2.test \
 -objext-pr10128.test \
 -obsolete.test \
 -order.test \
 -outdir.test \
 -output.test \
 -output2.test \
 -output3.test \
 -output4.test \
 -output5.test \
 -output6.test \
 -output7.test \
 -output8.test \
 -output9.test \
 -output10.test \
 -output11.test \
 -output12.test \
 -output13.test \
 -output-order.test \
 -overrid.test \
 -parallel-am.test \
 -parallel-am2.test \
 -parallel-am3.test \
 -parallel-tests.test \
 -parallel-tests2.test \
 -parallel-tests3.test \
 -parallel-tests4.test \
 -parallel-tests5.test \
 -parallel-tests6.test \
 -parallel-tests7.test \
 -parallel-tests8.test \
 -parallel-tests9.test \
 -parallel-tests10.test \
 -parallel-tests-harderror.test \
 -parallel-tests-unreadable-log.test \
 -parallel-tests-subdir.test \
 -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 \
 -phony.test \
 -pluseq.test \
 -pluseq2.test \
 -pluseq3.test \
 -pluseq4.test \
 -pluseq5.test \
 -pluseq6.test \
 -pluseq7.test \
 -pluseq8.test \
 -pluseq9.test \
 -pluseq10.test \
 -pluseq11.test \
 -postproc.test \
 -ppf77.test \
 -pr2.test \
 -pr9.test \
 -pr72.test \
 -pr87.test \
 -pr204.test \
 -pr211.test \
 -pr220.test \
 -pr224.test \
 -pr229.test \
 -pr243.test \
 -pr266.test \
 -pr279.test \
 -pr279-2.test \
 -pr287.test \
 -pr300-lib.test \
 -pr300-ltlib.test \
 -pr300-prog.test \
 -pr307.test \
 -pr401.test \
 -pr401b.test \
 -pr401c.test \
 -prefix.test \
 -primary.test \
 -primary2.test \
 -primary3.test \
 -primary-prefix-invalid-couples.test \
 -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 \
 -python4.test \
 -python5.test \
 -python6.test \
 -python7.test \
 -python8.test \
 -python9.test \
 -python10.test \
 -python11.test \
 -python12.test \
 -recurs.test \
 -recurs2.test \
 -remake.test \
 -remake2.test \
 -remake3.test \
 -remake4.test \
 -remake5.test \
 -remake6.test \
 -remake7.test \
 -remake-subdir-from-subdir.test \
 -remake-subdir-gnu.test \
 -remake-subdir.test \
 -remake-subdir2.test \
 -remake-subdir-long-time.test \
 -remake-am-pr10111.test \
 -remake-m4-pr10111.test \
 -remake-deleted-am.test \
 -remake-deleted-am-2.test \
 -remake-deleted-am-subdir.test \
 -remake-renamed-am.test \
 -pr8365-remake-timing.test \
 -regex.test \
 -regex-obsolete.test \
 -req.test \
 -reqd.test \
 -reqd2.test \
 -rulepat.test \
 -sanity.test \
 -scripts.test \
 -seenc.test \
 -silent.test \
 -silent2.test \
 -silent3.test \
 -silent4.test \
 -silent6.test \
 -silent7.test \
 -silent9.test \
 -silentcxx.test \
 -silentf77.test \
 -silentf90.test \
 -silent-many-gcc.test \
 -silent-many-generic.test \
 -silent-lex-gcc.test \
 -silent-lex-generic.test \
 -silent-nested-vars.test \
 -silent-yacc-gcc.test \
 -silent-yacc-generic.test \
 -silent-configsite.test \
 -srcsub.test \
 -srcsub2.test \
 -space.test \
 -specflg.test \
 -specflg2.test \
 -specflg3.test \
 -specflg6.test \
 -specflg7.test \
 -specflg8.test \
 -specflg9.test \
 -specflg10.test \
 -specflg-dummy.test \
 -spell.test \
 -spell2.test \
 -spell3.test \
 -spelling.test \
 -spy.test \
 -stdinc.test \
 -stamph2.test \
 -stdlib.test \
 -stdlib2.test \
 -strip.test \
 -strip2.test \
 -strip3.test \
 -subdir.test \
 -subdir2.test \
 -subdir3.test \
 -subdir4.test \
 -subdir5.test \
 -subdir6.test \
 -subdir7.test \
 -subdir8.test \
 -subdir9.test \
 -subdir10.test \
 -subdirbuiltsources.test \
 -subcond.test \
 -subcond2.test \
 -subcond3.test \
 -subobj.test \
 -subobj2.test \
 -subobj3.test \
 -subobj4.test \
 -subobj5.test \
 -subobj6.test \
 -subobj7.test \
 -subobj8.test \
 -subobj9.test \
 -subobj10.test \
 -subobj11a.test \
 -subobj11b.test \
 -subobj11c.test \
 -subobjname.test \
 -subpkg.test \
 -subpkg2.test \
 -subpkg3.test \
 -subpkg4.test \
 -subpkg-yacc.test \
 -subst.test \
 -subst2.test \
 -subst3.test \
 -subst4.test \
 -substref.test \
 -substre2.test \
 -substtarg.test \
 -suffix.test \
 -suffix2.test \
 -suffix3.test \
 -suffix4.test \
 -suffix5.test \
 -suffix6.test \
 -suffix7.test \
 -suffix8.test \
 -suffix9.test \
 -suffix10.test \
 -suffix11.test \
 -suffix12.test \
 -suffix13.test \
 -symlink.test \
 -symlink2.test \
 -syntax.test \
 -tags.test \
 -tagsub.test \
 -tar.test \
 -tar2.test \
 -tar3.test \
 -target-cflags.test \
 -targetclash.test \
 -txinfo.test \
 -txinfo2.test \
 -txinfo3.test \
 -txinfo4.test \
 -txinfo5.test \
 -txinfo5b.test \
 -txinfo6.test \
 -txinfo7.test \
 -txinfo8.test \
 -txinfo9.test \
 -txinfo10.test \
 -txinfo13.test \
 -txinfo16.test \
 -txinfo17.test \
 -txinfo18.test \
 -txinfo19.test \
 -txinfo20.test \
 -txinfo21.test \
 -txinfo22.test \
 -txinfo23.test \
 -txinfo24.test \
 -txinfo25.test \
 -txinfo26.test \
 -txinfo27.test \
 -txinfo28.test \
 -txinfo29.test \
 -txinfo30.test \
 -txinfo31.test \
 -txinfo32.test \
 -txinfo33.test \
 -transform.test \
 -transform2.test \
 -uninstall-pr9578.test \
 -uninstall-fail.test \
 -unused.test \
 -upc.test \
 -upc2.test \
 -upc3.test \
 -vala.test \
 -vala1.test \
 -vala2.test \
 -vala3.test \
 -vala4.test \
 -vala5.test \
 -vala-vpath.test \
 -vars.test \
 -vars3.test \
 -vartar.test \
 -version.test \
 -version2.test \
 -version3.test \
 -version4.test \
 -version6.test \
 -version7.test \
 -version8.test \
 -vpath.test \
 -vtexi.test \
 -vtexi2.test \
 -vtexi3.test \
 -vtexi4.test \
 -warnopts.test \
 -werror.test \
 -werror2.test \
 -werror3.test \
 -whoami.test \
 -xsource.test \
 -xz.test \
 -yacc.test \
 -yacc2.test \
 -yacc3.test \
 -yacc4.test \
 -yacc5.test \
 -yacc6.test \
 -yacc7.test \
 -yacc8.test \
 -yaccdry.test \
 -yaccpp.test \
 -yaccvpath.test \
 -yacc-dist-nobuild-subdir.test \
 -yflags.test \
 -yflags2.test \
 -libtool-macros.test \
 -gettext-macros.test \
 -$(parallel_tests)
 +include $(srcdir)/testsuite-part.am
 +
 +TESTS += $(generated_TESTS)
 +EXTRA_DIST += $(generated_TESTS)
  
 -# FIXME: make these automatically computed once we are merged into
 -# FIXME: the `testsuite-work' branch.
 -depcomp4.log: libtool-macros.log
 -depcomp7.log: libtool-macros.log
 -depcomp8b.log: libtool-macros.log
 -extradep2.log: libtool-macros.log
 -fort5.log: libtool-macros.log
 -instdir-ltlib.log: libtool-macros.log
 -instfail-libtool.log: libtool-macros.log
 -ldadd.log: libtool-macros.log
 -ldflags.log: libtool-macros.log
 -libobj13.log: libtool-macros.log
 -libtoo10.log: libtool-macros.log
 -libtoo11.log: libtool-macros.log
 -libtool.log: libtool-macros.log
 -libtool2.log: libtool-macros.log
 -libtool3.log: libtool-macros.log
 -libtool5.log: libtool-macros.log
 -libtool6.log: libtool-macros.log
 -libtool7.log: libtool-macros.log
 -libtool8.log: libtool-macros.log
 -libtool9.log: libtool-macros.log
 -listval.log: libtool-macros.log
 -ltcond.log: libtool-macros.log
 -ltcond2.log: libtool-macros.log
 -ltconv.log: libtool-macros.log
 -ltdeps.log: libtool-macros.log
 -ltinit.log: libtool-macros.log
 -ltinstloc.log: libtool-macros.log
 -ltlibobjs.log: libtool-macros.log
 -ltlibsrc.log: libtool-macros.log
 -ltorder.log: libtool-macros.log
 -nobase-libtool.log: libtool-macros.log
 -pr211.log: libtool-macros.log
 -pr300-ltlib.log: libtool-macros.log
 -pr307.log: libtool-macros.log
 -pr401b.log: libtool-macros.log
 -pr72.log: libtool-macros.log
 -reqd2.log: libtool-macros.log
 -silent3.log: libtool-macros.log
 -silent4.log: libtool-macros.log
 -silent9.log: libtool-macros.log
 -stdlib2.log: libtool-macros.log
 -strip3.log: libtool-macros.log
 -subobj9.log: libtool-macros.log
 -suffix10.log: libtool-macros.log
 -suffix2.log: libtool-macros.log
 -suffix5.log: libtool-macros.log
 -suffix8.log: libtool-macros.log
 -vala.log: libtool-macros.log
 -vala1.log: libtool-macros.log
 -vala2.log: libtool-macros.log
 -vala3.log: libtool-macros.log
 -vala4.log: libtool-macros.log
 -vala5.log: libtool-macros.log
 +$(srcdir)/testsuite-part.am:
 +      $(AM_V_at)rm -f testsuite-part.tmp $@
 +      $(AM_V_GEN)$(PERL) $(srcdir)/gen-testsuite-part \
 +        --srcdir $(srcdir) > testsuite-part.tmp
 +      $(AM_V_at)chmod a-w testsuite-part.tmp
 +      $(AM_V_at)mv -f testsuite-part.tmp $@
 +EXTRA_DIST += gen-testsuite-part
  
 -# FIXME: make these automatically computed once we are merged into
 -# FIXME: the `testsuite-work' branch.
 -gettext.log: gettext-macros.log
 -gettext2.log: gettext-macros.log
 -gettext3.log: gettext-macros.log
 -subcond.log: gettext-macros.log
 +$(generated_TESTS) $(srcdir)/testsuite-part.am: \
 +  gen-testsuite-part list-of-tests.mk Makefile.am $(handwritten_TESTS)
  
 -EXTRA_DIST = ChangeLog-old gen-parallel-tests $(TESTS)
 +# Static dependencies valid for each test case.
 +$(TEST_LOGS): defs defs-static aclocal-$(APIVERSION) automake-$(APIVERSION)
 +# FIXME: this should be made more granular once we have a cleaner
 +# subdivision of the tests.
 +$(TEST_LOGS): plain-functions.sh tap-functions.sh
 +EXTRA_DIST += tap-functions.sh plain-functions.sh
  
 +# Few more static dependencies.
  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)
 +# Keep in sync with AC_SUBST'd stuff in defs-static.in.
 +do_subst = sed \
 +  -e 's|@abs_srcdir[@]|$(abs_srcdir)|g' \
 +  -e 's|@abs_top_srcdir[@]|$(abs_top_srcdir)|g' \
 +  -e 's|@abs_builddir[@]|$(abs_builddir)|g' \
 +  -e 's|@abs_top_builddir[@]|$(abs_top_builddir)|g' \
 +  -e 's|@prefix[@]|$(prefix)|g' \
 +  -e 's|@amdir[@]|$(amdir)|g' \
 +  -e 's|@bindir[@]|$(bindir)|g' \
 +  -e 's|@datadir[@]|$(datadir)|g' \
 +  -e 's|@docdir[@]|$(docdir)|g' \
 +  -e 's|@automake_acdir[@]|$(automake_acdir)|g' \
 +  -e 's|@system_acdir[@]|$(system_acdir)|g' \
 +  -e 's|@scriptdir[@]|$(scriptdir)|g' \
 +  -e 's|@pkgvdatadir[@]|$(pkgvdatadir)|g' \
 +  -e 's|@host_alias[@]|$(host_alias)|g' \
 +  -e 's|@build_alias[@]|$(build_alias)|g' \
 +  -e 's|@APIVERSION[@]|$(APIVERSION)|g' \
 +  -e 's|@PATH_SEPARATOR[@]|$(PATH_SEPARATOR)|g' \
 +  -e 's|@SHELL[@]|$(SHELL)|g' \
 +  -e 's|@PERL[@]|$(PERL)|g' \
 +  -e 's|@EGREP[@]|$(EGREP)|g' \
 +  -e 's|@FGREP[@]|$(FGREP)|g' \
 +  -e 's|@TEX[@]|$(TEX)|g' \
 +  -e 's|@MODIFICATION_DELAY[@]|$(MODIFICATION_DELAY)|g' \
 +  -e 's|@am_AUTOCONF[@]|$(am_AUTOCONF)|g' \
 +  -e 's|@am_AUTOM4TE[@]|$(am_AUTOM4TE)|g' \
 +  -e 's|@am_AUTORECONF[@]|$(am_AUTORECONF)|g' \
 +  -e 's|@am_AUTOHEADER[@]|$(am_AUTOHEADER)|g' \
 +  -e 's|@am_AUTOUPDATE[@]|$(am_AUTOUPDATE)|g' \
 +  -e 's|@sh_errexit_works[@]|$(sh_errexit_works)|g' \
 +  -e 's|@configure_input[@]|Generated from $@.in.  DO NOT EDIT BY HAND!|'
 +
 +defs-static: defs-static.in
 +      $(AM_V_at)rm -f $@ $@-t
 +      $(AM_V_GEN)$(do_subst) $(srcdir)/defs-static.in >$@-t
 +      $(AM_V_at) : Sanity check on the substitutions; \
 +      if LC_ALL=C grep '@[a-zA-Z0-9_][a-zA-Z0-9_]*@' $@-t; then \
 +        echo "$@ contains unexpanded substitution (see lines above)"; \
 +        exit 1; \
 +      fi
 +      $(AM_V_at)chmod a-w $@-t && mv -f $@-t $@
 +EXTRA_DIST += defs-static.in
 +CLEANFILES = defs-static
 +
 +# If two test scripts have the same basename, they will end up sharing
 +# the same log file, leading to all sort of undefined and undesired
 +# behaviours.
 +check-no-repeated-test-name:
 +      @LC_ALL=C; export LC_ALL; \
 +       lst='$(TEST_LOGS)'; for log in $$lst; do echo $$log; done \
 +         | sort | uniq -c | awk '($$1 > 1) { print }' \
 +         | sed 's/\.log$$//' | grep . >&2 \
 +         && { \
 +           echo $@: test names listed above are duplicated >&2; \
 +           exit 1; \
 +         }; :
 +check-local: check-no-repeated-test-name
 +.PHONY: check-no-repeated-test-name
 +
 +## Checking the list of tests.
 +include $(top_srcdir)/CheckListOfTests.am
 +
 +# Run the testsuite with the installed aclocal and automake.
 +installcheck-local:
 +      am_running_installcheck=yes $(MAKE) $(AM_MAKEFLAGS) check
  
  clean-local: clean-local-check
  .PHONY: clean-local-check
@@@ -191,86 -1023,3 +193,86 @@@ clean-local-check
           find "$$@" -type d ! -perm -700 -exec chmod u+rwx {} ';'; \
           rm -rf "$$@"; \
         fi;
 +
 +## Run the testsuite through the `prove' utility.  Mostly for maintainers,
 +## and to find out possible incompatibilities between `prove' and the
 +## Automake own TAP driver.
 +
 +PROVE = prove
 +AM_PROVEFLAGS = --timer
 +AM_PROVECMD = \
 +  test -z "$$tests" || \
 +    { \
 +      $(AM_TESTS_ENVIRONMENT) $(TESTS_ENVIRONMENT) \
 +      $(PROVE) $(AM_PROVEFLAGS) -e $(srcdir)/prove-runner $(PROVEFLAGS) \
 +      $$tests $(AM_TESTS_FD_REDIRECT); \
 +    }
 +
 +EXTRA_DIST += prove-runner
 +
 +.PHONY: prove installprove
 +prove installprove: $(TESTS) prove-runner defs-static
 +      @exit_status=0; \
 +## The testsuite can be run either using the automake build tree or
 +## the already-installed automake package.
 +      case '$@' in \
 +        install*) am_running_installcheck=yes;; \
 +        *) am_running_installcheck=no;; \
 +      esac; \
 +      export am_running_installcheck; \
 +## XXX Our poor-man way to handle inter-tests dependencies without the
 +## XXX help of make.  This is obviously fragile and doesn't scale,
 +## XXX but for now it's good enough since we have only one possible
 +## XXX inter-tests dependency at the moment.
 +      need_tap_common_setup=no; \
 +      lst=' $(TESTS) '; for t in $$lst; do \
 +        case ' $(on_tap_with_common_setup_TESTS) ' in \
 +          *" $$t "*) need_tap_common_setup=yes; break;; \
 +        esac; \
 +      done; \
 +## For VPATH builds.
 +      if test $$need_tap_common_setup = yes; then \
 +        t=tap-common-setup.test; \
 +        if test -f ./$$t; then \
 +          tests=./$$t; \
 +        else \
 +          tests=$(srcdir)/$$t; \
 +        fi; \
 +## Do not stop if there's a failure here, we want to run the following
 +## tests anyway.
 +        echo "$@: running pre-requisite tests ..."; \
 +        $(AM_PROVECMD) || exits_status=$$?; \
 +        echo "$@: done.  We'll shortly run the main testsuite."; \
 +      fi; \
 +## Handle VPATH builds, and ensure that the tests have a properly
 +## qualified path.
 +      tests=`\
 +        for t in $(TESTS); do \
 +## XXX In next line, another hack for inter-tests dependencies: this
 +## XXX can't run concurrently to the tests that use the data files it
 +## XXX generates.
 +          case "$$need_tap_common_setup,/$$t" in \
 +            yes,*/tap-common-setup.test) continue;; \
 +          esac; \
 +          if test -f ./$$t; then \
 +            echo ./$$t; \
 +          else \
 +            echo $(srcdir)/$$t; \
 +          fi; \
 +        done`; \
 +## Extra environment, mostly for use by `prove-runner'.
 +## XFAIL_TESTS gets normalized to play nicer with VPATH builds.
 +      XFAIL_TESTS=`\
 +        for t in $(XFAIL_TESTS); do \
 +          echo $$t; echo ./$$t; echo $(srcdir)/$$t; \
 +        done | LC_ALL=C sort | uniq`; \
 +      XFAIL_TESTS=`echo $$XFAIL_TESTS`; \
 +      TAP_RUNNER='$(TAP_LOG_COMPILE)' \
 +      TEST_RUNER='$(TEST_LOG_COMPILE)' \
 +      export XFAIL_TESTS TAP_RUNNER TEST_RUNNER; \
 +## For consistency with the Automake testsuite harness, that exports
 +## this unconditionally in the test scripts' environment.
 +      srcdir='$(srcdir)'; export srcdir; \
 +## Here we go.
 +      $(AM_PROVECMD) || exit_status=$$?; \
 +      exit $$exit_status;
diff --combined tests/extradep.test
@@@ -1,5 -1,5 +1,5 @@@
  #! /bin/sh
- # Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+ # Copyright (C) 2010, 2011, 2012 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
  required=cc
  . ./defs || Exit 1
  
 -set -e
 -
  cat >> configure.in << 'END'
  AC_PROG_CC
 +AM_PROG_AR
  AC_PROG_RANLIB
  AC_SUBST([deps], [bardep])
  AM_CONDITIONAL([COND], [test -n "$cond"])
diff --combined tests/extradep2.test
@@@ -1,5 -1,5 +1,5 @@@
  #! /bin/sh
- # Copyright (C) 2010, 2011 Free Software Foundation, Inc.
+ # Copyright (C) 2010, 2011, 2012 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
  required='cc libtoolize'
  . ./defs || Exit 1
  
 -set -e
 -
  cat >> configure.in << 'END'
  AC_PROG_CC
 +AM_PROG_AR
  AC_PROG_LIBTOOL
  AC_SUBST([deps], [bardep])
  AC_OUTPUT
diff --combined tests/pr300-lib.test
@@@ -1,5 -1,5 +1,6 @@@
  #! /bin/sh
- # Copyright (C) 2002, 2007, 2010, 2011 Free Software Foundation, Inc.
 -# Copyright (C) 2002, 2007, 2010, 2012 Free Software Foundation, Inc.
++# Copyright (C) 2002, 2007, 2010, 2011, 2012 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
  # Make sure that installing subdirectory libraries works.
  # PR/300
  
 -required=gcc
 +required=cc
  . ./defs || Exit 1
  
 -set -e
 -
  cat >> configure.in << 'END'
  AC_PROG_RANLIB
  AC_PROG_CC
@@@ -43,9 -45,14 +44,14 @@@ EN
  
  $ACLOCAL
  $AUTOCONF
 -$AUTOMAKE --copy --add-missing
 +$AUTOMAKE -Wno-extra-portability --copy --add-missing
  
- ./configure --prefix "`pwd`/inst"
+ # We pass '--libdir' explicitly, to avoid spurious failures due to users
+ # or distributions possibly overriding '${libdir}' in their $CONFIG_SITE
+ # file (for example, defining it to '${prefix}/lib64' on 64-bit systems,
+ # as is the case with openSUSE 12.1).  See automake bug#10426.
+ cwd=`pwd` || Exit 99
+ ./configure --prefix "$cwd/inst" --libdir "$cwd/inst/lib"
  
  $MAKE
  
diff --combined tests/pr300-ltlib.test
@@@ -1,5 -1,5 +1,5 @@@
  #! /bin/sh
- # Copyright (C) 2002, 2007, 2008, 2009, 2010, 2011 Free Software
 -# Copyright (C) 2002, 2007, 2008, 2009, 2010, 2012 Free Software
++# Copyright (C) 2002, 2007, 2008, 2009, 2010, 2011, 2012 Free Software
  # Foundation, Inc.
  #
  # This program is free software; you can redistribute it and/or modify
  # Make sure that installing subdirectory libtool libraries works.
  # PR/300
  
 -required='libtoolize gcc'
 +required='cc libtoolize'
  . ./defs || Exit 1
  
 -set -e
 -
  cat >> configure.in << 'END'
  AC_PROG_CC
  AC_PROG_LIBTOOL
@@@ -39,18 -41,23 +39,23 @@@ cat > a.c << 'END
  int i = 3;
  END
  
 -## A rule in the Makefile should create subdir
 -# mkdir subdir
 -
  libtoolize
  $ACLOCAL
  $AUTOCONF
 -$AUTOMAKE --copy --add-missing
 +$AUTOMAKE -Wno-extra-portability --copy --add-missing
  
- ./configure --prefix "`pwd`/inst"
+ # We pass '--libdir' explicitly, to avoid spurious failures due to users
+ # or distributions possibly overriding '${libdir}' in their $CONFIG_SITE
+ # file (for example, defining it to '${prefix}/lib64' on 64-bit systems,
+ # as is the case with openSUSE 12.1).  See automake bug#10426.
+ cwd=`pwd` || Exit 99
+ ./configure --prefix "$cwd/inst" --libdir "$cwd/inst/lib"
  
 -$MAKE V=1 >stdout || { cat stdout; Exit 1; }
 +# A rule in the Makefile should create subdir.
 +test ! -d subdir
 +$MAKE >stdout || { cat stdout; Exit 1; }
  cat stdout
 +test -d subdir
  
  grep 'liba.la .*-rpath .*lib' stdout
  grep 'liba.la .*-rpath .*lib/subdir' stdout && Exit 1
  
  . ./defs || Exit 1
  
 -set -e
 +plan_ "later"
  
  oIFS=$IFS # Saved for later.
  
 +: > ar-lib
  : > ltmain.sh
  : > texinfo.tex
  : > elisp-comp
@@@ -36,7 -35,6 +36,7 @@@
  
  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
@@@ -44,7 -42,7 +44,7 @@@ AM_PATH_PYTHO
  AM_PATH_LISPDIR
  END
  
 -$ACLOCAL
 +$ACLOCAL || fatal_ "aclocal failure"
  
  # Please keep this list in sync with the list of "Directory Variables"
  # in the GNU Coding Standards and with the list additional directory
@@@ -81,7 -79,7 +81,7 @@@ for primary in $primaries; d
        prefixes_ok='bin sbin libexec pkglibexec'
        ;;
      SCRIPTS)
-       prefixes_ok='bin sbin libexec pkgdata'
+       prefixes_ok='bin sbin libexec pkglibexec pkgdata'
        ;;
      DATA)
        prefixes_ok='data dataroot pkgdata doc html dvi pdf ps
@@@ -167,18 -165,14 +167,18 @@@ cat Makefile.a
  
  set -x # Restore shell xtraces from now on.
  
 -AUTOMAKE_fails -a
 +AUTOMAKE_fails \
 +  -d "'automake -a' error out on mismatched prefix/primary couples" \
 +  -- --add-missing
  
  while read lineno prefix primary; do
    test -n "$prefix" && test -n "$primary" && test 0 -lt $lineno \
      || fatal_ "internal error in 'all.list'"
    grep "^${prefix}_${primary}$" allow.list >/dev/null && continue
    errmsg_rx=".*${prefix}dir.* not a legitimate directory .*$primary"
 -  grep "^Makefile\\.am:$lineno: $errmsg_rx" stderr || Exit 1
 +  command_ok_ \
 +    "mismatched prefix/primary in ${prefix}_${primary}" \
 +    grep "^Makefile\\.am:$lineno: $errmsg_rx" stderr
  done <all.list
  
  # Check that automake really failed only for the expected reason(s).
@@@ -187,8 -181,7 +187,8 @@@ grep -v 'dir.* not a legitimate directo
  # Check that the same failures are present without the `--add-missing'
  # option.
  mv stderr stderr.old
 -AUTOMAKE_fails
 -diff stderr.old stderr
 +AUTOMAKE_fails -d "automake error out on mismatched prefix/primary couples"
 +command_ok_ "... and with the same diagnostic of 'automake -a'" \
 +            diff stderr.old stderr
  
  :
  
  . ./defs || Exit 1
  
 -set -e
 -
  cat >> configure.in <<'END'
  AC_PROG_CC
 +AM_PROG_AR
  AC_PROG_RANLIB
  AC_PROG_LIBTOOL
  AM_PATH_PYTHON
@@@ -42,7 -43,6 +42,7 @@@ echo '@setfilename foo' > foo.tex
  : > texinfo.tex
  : > py-compile
  : > elisp-comp
 +: > ar-lib
  
  # Setup Makefile.am.
  
@@@ -57,7 -57,7 +57,7 @@@ for p in lib pkglib; d
    echo "${p}_LTLIBRARIES = libd-$p.la" >> Makefile.am
  done
  
- for p in bin sbin libexec pkgdata; do
+ for p in bin sbin libexec pkglibexec pkgdata; do
    echo "${p}_SCRIPTS = $p.sh" >> Makefile.am
  done