Merge branch 'testsuite-saner-shell' into maint
authorStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 7 May 2012 20:11:28 +0000 (22:11 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Mon, 7 May 2012 20:11:28 +0000 (22:11 +0200)
* testsuite-saner-shell:
  tests: fix a spurious failure with dash
  test defs: fix indentation (cosmetic change)
  tests: remove obsolete uses of $sh_errexit_works
  configure: search a sturdy POSIX shell to be used in the testsuite
  tests: shell running test scripts is now named AM_TEST_RUNNER_SHELL

61 files changed:
Makefile.am
NEWS
aclocal.in
automake.in
doc/automake.texi
lib/Automake/Variable.pm
lib/am/check.am
m4/depend.m4
m4/init.m4
syntax-checks.mk
t/ac-output-old.tap
t/aclocal.sh
t/aminit-moreargs-deprecation.sh [new file with mode: 0755]
t/auxdir-autodetect.sh
t/backcompat.sh
t/backcompat3.sh
t/backcompat5.sh
t/backcompat6.sh
t/clean2.sh
t/cond5.sh
t/confsub.sh
t/cygnus-check-without-all.sh
t/cygnus-dependency-tracking.sh
t/cygnus-deprecation.sh [new file with mode: 0755]
t/cygnus-no-dist.sh
t/cygnus-no-installinfo.sh
t/cygnus-requires-maintainer-mode.sh
t/dist-formats.tap
t/ext.sh
t/flavor.sh
t/install2.sh
t/library.sh
t/lisp8.sh
t/list-of-tests.mk
t/location.sh
t/nodep2.sh
t/objc-basic.sh [moved from t/objc2.sh with 58% similarity]
t/objc-deps.sh [new file with mode: 0755]
t/objc-flags.sh [new file with mode: 0755]
t/objc-megademo.sh [new file with mode: 0755]
t/objc-minidemo.sh [new file with mode: 0755]
t/objc.sh [deleted file]
t/objcxx-basic.sh [new file with mode: 0755]
t/objcxx-deps.sh [new file with mode: 0755]
t/objcxx-flags.sh [new file with mode: 0755]
t/objcxx-minidemo.sh [new file with mode: 0755]
t/parallel-tests3.sh
t/pr2.sh
t/pr87.sh
t/rst-formatting.sh [deleted file]
t/suffix.sh
t/tap-more.sh
t/tap-signal.tap
t/test-trs-recover2.sh
t/testsuite-recheck-speed.sh [new file with mode: 0755]
t/testsuite-summary-count-many.sh
t/testsuite-summary-speed.sh [new file with mode: 0755]
t/txinfo5.sh
t/txinfo5b.sh
t/version.sh
t/version2.sh

index 0b79a16..27f65e4 100644 (file)
@@ -328,7 +328,7 @@ TAP_LOG_DRIVER = AM_TAP_AWK='$(AWK)' $(SHELL) $(srcdir)/lib/tap-driver.sh
 
 AM_TAP_LOG_DRIVER_FLAGS = --merge
 
-EXTRA_DIST += t/ax/is
+EXTRA_DIST += t/README t/ax/is
 
 TESTS = ## Will be updated later.
 
diff --git a/NEWS b/NEWS
index 0707a82..d0575e6 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -36,10 +36,6 @@ New in 1.12.1:
   - All the "old alias" macros in 'm4/obsolete.m4' will be removed in
     the next major Automake version (1.13).
 
-  - Support for the "Cygnus-style" trees (enabled by the 'cygnus' option)
-    will be deprecated in the next minor version of Automake (1.12.1) and
-    removed in the next major version (1.13).
-
   - Support for the two- and three-arguments invocation forms of the
     AM_INIT_AUTOMAKE macro will be deprecated in the next minor version
     of Automake (1.12.1) and removed in the next major version (1.13).
@@ -53,8 +49,22 @@ New in 1.12.1:
     search path are looked up is probably going to be changed in the
     next Automake release (1.13).
 
+* New supported languages:
+
+  - Support for Objective C++ has been added; it should work similarly to
+    the support for Objective C.
+
 * Deprecated obsolescent features:
 
+  - Use of the long-deprecated two- and three-arguments invocation forms
+    of the AM_INIT_AUTOMAKE macro now elicits a warning in the 'obsolete'
+    category.  Starting from the next major Automake release (1.13), such
+    usages won't be allowed anymore.
+
+  - Support for the "Cygnus-style" trees (enabled by the 'cygnus' option) is
+    now deprecated (its use triggers a warning in the 'obsolete' category).
+    It will be removed in the next major Automake release (1.13).
+
   - The long-obsolete (since 1.10) automake-provided $(mkdir_p) make
     variable, @mkdir_p@ configure-time substitution and AM_PROG_MKDIR
     m4 macro are deprecated, eliciting a warning in the 'obsolete'
@@ -75,8 +85,13 @@ Bugs fixed in 1.12.1:
 
 * Bugs introduced by 1.12:
 
-   - Several weaknesses in the Automake's own build system test suite
-     have been fixed.
+  - Several weaknesses in Automake's own build system and test suite
+    have been fixed.
+
+* Bugs introduced by 1.11.3:
+
+  - When given non-option arguments, aclocal rejects them, instead of
+    silently ignoring them.
 
 * Long-standing bugs:
 
@@ -85,6 +100,9 @@ Bugs fixed in 1.12.1:
     a non-ANSI one, i.e., if the TERM environment variable has a value of
     "dumb".
 
+  - Several inefficiencies and poor performances in the implementation
+    of the parallel-tests 'check' and 'recheck' targets have been fixed.
+
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 New in 1.12:
index 09e1da4..dfb851b 100644 (file)
@@ -982,6 +982,12 @@ sub parse_arguments ()
   use Automake::Getopt ();
   Automake::Getopt::parse_options %cli_options;
 
+  if (@ARGV > 0)
+    {
+      fatal ("non-option arguments are not accepted: '$ARGV[0]'.\n"
+             . "Try '$0 --help' for more information.");
+    }
+
   if ($print_and_exit)
     {
       print "@system_includes\n";
index a993451..5cf5a2c 100644 (file)
@@ -759,6 +759,24 @@ register_language ('name' => 'objc',
                   'pure' => 1,
                   'extensions' => ['.m']);
 
+# Objective C++.
+register_language ('name' => 'objcxx',
+                  'Name' => 'Objective C++',
+                  'config_vars' => ['OBJCXX'],
+                  'linker' => 'OBJCXXLINK',
+                  'link' => '$(OBJCXXLD) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@',
+                  'autodep' => 'OBJCXX',
+                  'flags' => ['OBJCXXFLAGS', 'CPPFLAGS'],
+                  'compile' => '$(OBJCXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_OBJCXXFLAGS) $(OBJCXXFLAGS)',
+                  'ccer' => 'OBJCXX',
+                  'compiler' => 'OBJCXXCOMPILE',
+                  'compile_flag' => '-c',
+                  'output_flag' => '-o',
+                  'lder' => 'OBJCXXLD',
+                  'ld' => '$(OBJCXX)',
+                  'pure' => 1,
+                  'extensions' => ['.mm']);
+
 # Unified Parallel C.
 register_language ('name' => 'upc',
                   'Name' => 'Unified Parallel C',
@@ -5391,6 +5409,10 @@ EOF
          $seen_init_automake = $where;
          if (defined $args[2])
            {
+              msg 'obsolete', $where, <<'EOF';
+AM_INIT_AUTOMAKE: two- and three-arguments forms are deprecated.  For more info, see:
+http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation
+EOF
              $package_version = $args[2];
              $package_version_location = $where;
            }
@@ -5579,6 +5601,11 @@ sub check_cygnus
   my $cygnus = option 'cygnus';
   return unless $cygnus;
 
+  # This feature is deprecated, will be removed in the next
+  # Automake major release.
+  msg 'obsolete', $cygnus->get,
+      "support for Cygnus-style trees is deprecated";
+
   set_strictness ('foreign');
   set_option ('no-installinfo', $cygnus);
   set_option ('no-dependencies', $cygnus);
@@ -5801,6 +5828,12 @@ sub lang_objc_rewrite
     return &lang_sub_obj;
 }
 
+# Rewrite a single Objective C++ file.
+sub lang_objcxx_rewrite
+{
+    return &lang_sub_obj;
+}
+
 # Rewrite a single Unified Parallel C file.
 sub lang_upc_rewrite
 {
@@ -6065,7 +6098,7 @@ sub resolve_linker
 {
     my (%linkers) = @_;
 
-    foreach my $l (qw(GCJLINK CXXLINK F77LINK FCLINK OBJCLINK UPCLINK))
+    foreach my $l (qw(GCJLINK OBJCXXLINK CXXLINK F77LINK FCLINK OBJCLINK UPCLINK))
     {
        return $l if defined $linkers{$l};
     }
@@ -6253,13 +6286,14 @@ sub make_conditional_string ($$)
 my %_am_macro_for_cond =
   (
   AMDEP => "one of the compiler tests\n"
-          . "    AC_PROG_CC, AC_PROG_CXX, AC_PROG_CXX, AC_PROG_OBJC,\n"
+          . "    AC_PROG_CC, AC_PROG_CXX, AC_PROG_OBJC, AC_PROG_OBJCXX,\n"
           . "    AM_PROG_AS, AM_PROG_GCJ, AM_PROG_UPC",
   am__fastdepCC => 'AC_PROG_CC',
   am__fastdepCCAS => 'AM_PROG_AS',
   am__fastdepCXX => 'AC_PROG_CXX',
   am__fastdepGCJ => 'AM_PROG_GCJ',
   am__fastdepOBJC => 'AC_PROG_OBJC',
+  am__fastdepOBJCXX => 'AC_PROG_OBJCXX',
   am__fastdepUPC => 'AM_PROG_UPC'
   );
 
index c21a5b7..2f2ebb0 100644 (file)
@@ -220,6 +220,7 @@ Building Programs and Libraries
 * Yacc and Lex::                Yacc and Lex support
 * C++ Support::                 Compiling C++ sources
 * Objective C Support::         Compiling Objective C sources
+* Objective C++ Support::       Compiling Objective C++ sources
 * Unified Parallel C Support::  Compiling Unified Parallel C sources
 * Assembly Support::            Compiling assembly sources
 * Fortran 77 Support::          Compiling Fortran 77 sources
@@ -1958,9 +1959,9 @@ Automake also has a special (and @emph{today deprecated}) ``cygnus'' mode
 that is similar to strictness but handled differently.  This mode is
 useful for packages that are put into a ``Cygnus'' style tree (e.g., older
 versions of the GCC and gdb trees).  @xref{Cygnus}, for more information
-on this mode.  Please note that this mode is deprecated and @emph{will be
-removed in the future automake versions}; you must avoid its use in new
-packages, and should stop using it in existing packages as well.
+on this mode.  Please note that this mode @emph{is deprecated and will be
+removed in the next major Automake release (1.13)}; you must avoid its use
+in new packages, and should stop using it in existing packages as well.
 
 
 @node Uniform
@@ -2604,7 +2605,7 @@ copied.  The default is to make a symbolic link.
 Causes the generated @file{Makefile.in}s to follow Cygnus rules, instead
 of GNU or Gnits rules.  For more information, see @ref{Cygnus}.
 Note that @emph{this mode of operation is deprecated, and will be removed}
-in a future Automake release.
+in the next major Automake release (1.13).
 
 @item -f
 @opindex -f
@@ -3027,6 +3028,10 @@ Programs, , Particular Program Checks, autoconf, The Autoconf Manual}.
 This is required if any Objective C source is included.  @xref{Particular
 Programs, , Particular Program Checks, autoconf, The Autoconf Manual}.
 
+@item AC_PROG_OBJCXX
+This is required if any Objective C++ source is included.  @xref{Particular
+Programs, , Particular Program Checks, autoconf, The Autoconf Manual}.
+
 @item AC_PROG_F77
 This is required if any Fortran 77 source is included.  @xref{Particular
 Programs, , Particular Program Checks, autoconf, The Autoconf Manual}.
@@ -3941,13 +3946,14 @@ each option were listed in @code{AUTOMAKE_OPTIONS} (@pxref{Options}).
 
 @acindex AC_INIT
 This macro can also be called in @emph{another, deprecated form} (support
-for which will be @emph{removed in the next major Automake release}):
+for which will be @emph{removed in the next major Automake release (1.13)}):
 @code{AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])}.  In this form,
 there are two required arguments: the package and the version number.
 This form is obsolete because the @var{package} and @var{version} can
 be obtained from Autoconf's @code{AC_INIT} macro (which itself has an
 old and a new form).
 
+@anchor{Modernize AM_INIT_AUTOMAKE invocation}
 If your @file{configure.ac} has:
 
 @example
@@ -4670,6 +4676,7 @@ to build programs and libraries.
 * Yacc and Lex::                Yacc and Lex support
 * C++ Support::                 Compiling C++ sources
 * Objective C Support::         Compiling Objective C sources
+* Objective C++ Support::       Compiling Objective C++ sources
 * Unified Parallel C Support::  Compiling Unified Parallel C sources
 * Assembly Support::            Compiling assembly sources
 * Fortran 77 Support::          Compiling Fortran 77 sources
@@ -5787,6 +5794,7 @@ they apply.
 @itemx maude_GCJFLAGS
 @itemx maude_LFLAGS
 @itemx maude_OBJCFLAGS
+@itemx maude_OBJCXXFLAGS
 @itemx maude_RFLAGS
 @itemx maude_UPCFLAGS
 @itemx maude_YFLAGS
@@ -5804,6 +5812,7 @@ Automake.  These @dfn{per-target compilation flags} are
 @samp{_GCJFLAGS},
 @samp{_LFLAGS},
 @samp{_OBJCFLAGS},
+@samp{_OBJCXXFLAGS},
 @samp{_RFLAGS},
 @samp{_UPCFLAGS}, and
 @samp{_YFLAGS}.
@@ -6380,6 +6389,41 @@ The command used to actually link an Objective C program.
 @end vtable
 
 
+@node Objective C++ Support
+@section Objective C++ Support
+
+@cindex Objective C++ support
+@cindex Support for Objective C++
+
+Automake includes some support for Objective C++.
+
+Any package including Objective C++ code must define the output variable
+@code{OBJCXX} in @file{configure.ac}; the simplest way to do this is to use
+the @code{AC_PROG_OBJCXX} macro (@pxref{Particular Programs, , Particular
+Program Checks, autoconf, The Autoconf Manual}).
+
+A few additional variables are defined when an Objective C++ source file
+is seen:
+
+@vtable @code
+@item OBJCXX
+The name of the Objective C++ compiler.
+
+@item OBJCXXFLAGS
+Any flags to pass to the Objective C++ compiler.
+
+@item AM_OBJCXXFLAGS
+The maintainer's variant of @code{OBJCXXFLAGS}.
+
+@item OBJCXXCOMPILE
+The command used to actually compile an Objective C++ source file.  The
+file name is appended to form the complete command line.
+
+@item OBJCXXLINK
+The command used to actually link an Objective C++ program.
+@end vtable
+
+
 @node Unified Parallel C Support
 @section Unified Parallel C Support
 
@@ -6645,6 +6689,9 @@ parentheses are the variables containing the link command.)
 @vindex GCJLINK
 Native Java (@code{GCJLINK})
 @item
+@vindex OBJCXXLINK
+Objective C++ (@code{OBJCXXLINK})
+@item
 @vindex CXXLINK
 C++ (@code{CXXLINK})
 @item
@@ -6854,7 +6901,9 @@ source file.
 @section Support for Other Languages
 
 Automake currently only includes full support for C, C++ (@pxref{C++
-Support}), Objective C (@pxref{Objective C Support}), Fortran 77
+Support}), Objective C (@pxref{Objective C Support}),
+Objective C++ (@pxref{Objective C++ Support}),
+Fortran 77
 (@pxref{Fortran 77 Support}), Fortran 9x (@pxref{Fortran 9x Support}),
 and Java (@pxref{Java Support with gcj}).  There is only rudimentary
 support for other languages, support for which will be improved based
@@ -8789,9 +8838,8 @@ 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}).
+going to concentrate mostly on protocol-less tests, since we cover
+test protocols in a later section (again, @pxref{Custom Test Drivers}).
 
 @cindex Exit status 77, special interpretation
 @cindex Exit status 99, special interpretation
@@ -11026,8 +11074,8 @@ The file @file{THANKS} is required.
 
 @emph{The features described in this section are deprecated; you must
 not use any of them in new code, and should remove their use from older
-but still maintained code: they will be withdrawn in a future Automake
-release.}
+but still maintained code: they will be withdrawn the next major Automake
+release (1.13).}
 
 Some packages, notably GNU GCC and GNU gdb, used to have a build
 environment originally written at Cygnus Support (subsequently renamed
@@ -12194,6 +12242,7 @@ flags, not appended.
 @cindex @code{AM_LFLAGS} and @code{LFLAGS}
 @cindex @code{AM_LIBTOOLFLAGS} and @code{LIBTOOLFLAGS}
 @cindex @code{AM_OBJCFLAGS} and @code{OBJCFLAGS}
+@cindex @code{AM_OBJCXXFLAGS} and @code{OBJXXCFLAGS}
 @cindex @code{AM_RFLAGS} and @code{RFLAGS}
 @cindex @code{AM_UPCFLAGS} and @code{UPCFLAGS}
 @cindex @code{AM_YFLAGS} and @code{YFLAGS}
@@ -12208,6 +12257,7 @@ flags, not appended.
 @cindex @code{LFLAGS} and @code{AM_LFLAGS}
 @cindex @code{LIBTOOLFLAGS} and @code{AM_LIBTOOLFLAGS}
 @cindex @code{OBJCFLAGS} and @code{AM_OBJCFLAGS}
+@cindex @code{OBJCXXFLAGS} and @code{AM_OBJCXXFLAGS}
 @cindex @code{RFLAGS} and @code{AM_RFLAGS}
 @cindex @code{UPCFLAGS} and @code{AM_UPCFLAGS}
 @cindex @code{YFLAGS} and @code{AM_YFLAGS}
@@ -12217,8 +12267,8 @@ mostly discuss @code{CPPFLAGS} in our examples, but actually the
 answer holds for all the compile flags used in Automake:
 @code{CCASFLAGS}, @code{CFLAGS}, @code{CPPFLAGS}, @code{CXXFLAGS},
 @code{FCFLAGS}, @code{FFLAGS}, @code{GCJFLAGS}, @code{LDFLAGS},
-@code{LFLAGS}, @code{LIBTOOLFLAGS}, @code{OBJCFLAGS}, @code{RFLAGS},
-@code{UPCFLAGS}, and @code{YFLAGS}.
+@code{LFLAGS}, @code{LIBTOOLFLAGS}, @code{OBJCFLAGS}, @code{OBJCXXFLAGS},
+@code{RFLAGS}, @code{UPCFLAGS}, and @code{YFLAGS}.
 
 @code{CPPFLAGS}, @code{AM_CPPFLAGS}, and @code{mumble_CPPFLAGS} are
 three variables that can be used to pass flags to the C preprocessor
@@ -13124,6 +13174,7 @@ suite failures, please attach the @file{tests/test-suite.log} file.
 @c  LocalWords:  subsubsection OBJEXT esac lib LTLIBRARIES liblob LIBADD AR ar
 @c  LocalWords:  ARFLAGS cru ing maude libgettext lo LTLIBOBJS rpath SGI PRE yy
 @c  LocalWords:  libmaude CCLD CXXFLAGS FFLAGS LFLAGS OBJCFLAGS RFLAGS DEFS cc
+@c  LocalWords:  OBJCXXFLAGS
 @c  LocalWords:  SHORTNAME vtable srcdir nostdinc basename yxx cxx ll lxx gdb
 @c  LocalWords:  lexers yymaxdepth maxdepth yyparse yylex yyerror yylval lval
 @c  LocalWords:  yychar yydebug yypact yyr yydef def yychk chk yypgo pgo yyact
index 4d346f0..d4d230f 100644 (file)
@@ -185,6 +185,8 @@ my %_ac_macro_for_var =
    FCFLAGS => 'AC_PROG_FC',
    OBJC => 'AC_PROG_OBJC',
    OBJCFLAGS => 'AC_PROG_OBJC',
+   OBJCXX => 'AC_PROG_OBJCXX',
+   OBJCXXFLAGS => 'AC_PROG_OBJCXX',
    RANLIB => 'AC_PROG_RANLIB',
    UPC => 'AM_PROG_UPC',
    UPCFLAGS => 'AM_PROG_UPC',
index 73febb1..9cda82a 100644 (file)
@@ -59,9 +59,113 @@ include inst-vars.am
 ## of more test metadata, and the use of custom test derivers and protocols
 ## (among them, TAP).
 
-# Restructured Text title and section.
+am__recheck_rx = ^[    ]*:recheck:[    ]*
+am__global_test_result_rx = ^[         ]*:global-test-result:[         ]*
+am__copy_in_global_log_rx = ^[         ]*:copy-in-global-log:[         ]*
+
+# A command that, given a newline-separated list of test names on the
+# standard input, print the name of the tests that are to be re-run
+# upon "make recheck".
+am__list_recheck_tests = $(AWK) '{ \
+## By default, we assume the test is to be re-run.
+  recheck = 1; \
+  while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+    { \
+      if (rc < 0) \
+        { \
+## If we've encountered an I/O error here, there are three possibilities:
+##
+##  [1] The '.log' file exists, but the '.trs' does not; in this case,
+##      we "gracefully" recover by assuming the corresponding test is
+##      to be re-run (which will re-create the missing '.trs' file).
+##
+##  [2] Both the '.log' and '.trs' files are missing; this means that
+##      the corresponding test has not been run, and is thus *not* to
+##      be re-run.
+##
+##  [3] We have encountered some corner-case problem (e.g., a '.log' or
+##      '.trs' files somehow made unreadable, or issues with a bad NFS
+##      connection, or whatever); we don't handle such corner cases.
+##
+          if ((getline line2 < ($$0 ".log")) < 0) \
+           recheck = 0; \
+          break; \
+        } \
+      else if (line ~ /$(am__recheck_rx)[nN][Oo]/) \
+## A directive explicitly specifying the test is *not* to be re-run.
+        { \
+          recheck = 0; \
+          break; \
+        } \
+      else if (line ~ /$(am__recheck_rx)[yY][eE][sS]/) \
+        { \
+## A directive explicitly specifying the test *is* to be re-run.
+          break; \
+        } \
+## else continue with the next iteration.
+    }; \
+  if (recheck) \
+    print $$0; \
+## Don't leak open file descriptors, as this could cause serious
+## problems when there are many tests (yes, even on Linux).
+  close ($$0 ".trs"); \
+  close ($$0 ".log"); \
+}'
+
+# A command that, given a newline-separated list of test names on the
+# standard input, create the global log from their .trs and .log files.
+am__create_global_log = $(AWK) ' \
+function fatal(msg) \
+{ \
+  print "fatal: making $@: " msg | "cat >&2"; \
+  exit 1; \
+} \
+function rst_section(header) \
+{ \
+  print header; \
+  len = length(header); \
+  for (i = 1; i <= len; i = i + 1) \
+    printf "="; \
+  printf "\n\n"; \
+} \
+{ \
+## By default, we assume the test log is to be copied in the global log,
+## and that its result is simply "RUN" (i.e., we still don't know what
+## it outcome was, but we know that at least it has run).
+  copy_in_global_log = 1; \
+  global_test_result = "RUN"; \
+  while ((rc = (getline line < ($$0 ".trs"))) != 0) \
+    { \
+      if (rc < 0) \
+         fatal("failed to read from " $$0 ".trs"); \
+      if (line ~ /$(am__global_test_result_rx)/) \
+        { \
+          sub("$(am__global_test_result_rx)", "", line); \
+          sub("[       ]*$$", "", line); \
+          global_test_result = line; \
+        } \
+      else if (line ~ /$(am__copy_in_global_log_rx)[nN][oO]/) \
+        copy_in_global_log = 0; \
+    }; \
+  if (copy_in_global_log) \
+    { \
+      rst_section(global_test_result ": " $$0); \
+      while ((rc = (getline line < ($$0 ".log"))) != 0) \
+      { \
+        if (rc < 0) \
+          fatal("failed to read from " $$0 ".log"); \
+        print line; \
+      }; \
+      printf "\n"; \
+    }; \
+## Don't leak open file descriptors, as this could cause serious
+## problems when there are many tests (yes, even on Linux).
+  close ($$0 ".trs"); \
+  close ($$0 ".log"); \
+}'
+
+# Restructured Text title.
 am__rst_title = { sed 's/.*/   &   /;h;s/./=/g;p;x;s/ *$$//;p;g' && echo; }
-am__rst_section = { sed 'p;s/./=/g;' && echo; }
 
 # Solaris 10 'make', and several other traditional 'make' implementations,
 # pass "-e" to $(SHELL), and POSIX 2008 even requires this.  Work around it
@@ -86,8 +190,12 @@ $(am__sh_e_setup);                                  \
 $(am__vpath_adj_setup) $(am__vpath_adj)                        \
 $(am__tty_colors);                                     \
 srcdir=$(srcdir); export srcdir;                       \
-am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;           \
-test "x$$am__odir" = x. || $(MKDIR_P) "$$am__odir" || exit $$?;        \
+case "$@" in                                           \
+  */*) am__odir=`echo "./$@" | sed 's|/[^/]*$$||'`;;   \
+    *) am__odir=.;;                                    \
+esac;                                                  \
+test "x$$am__odir" = x"." || test -d "$$am__odir"      \
+  || $(MKDIR_P) "$$am__odir" || exit $$?;              \
 if test -f "./$$f"; then dir=./;                       \
 elif test -f "$$f"; then dir=;                         \
 else dir="$(srcdir)/"; fi;                             \
@@ -248,29 +356,9 @@ $(TEST_SUITE_LOG): $(TEST_LOGS)
          echo;                                                         \
          echo ".. contents:: :depth: 2";                               \
          echo;                                                         \
-         for i in $$bases; do                                          \
-## FIXME: one fork per test -- this is horrendously inefficient!
-           if grep "^$$ws*:copy-in-global-log:$$ws*no$$ws*$$" $$i.trs \
-                >/dev/null; then continue; \
-           fi; \
-## Get the declared "global result" of the test.
-## FIXME: yet another one fork per test here!
-           glob_res=`sed -n -e "s/$$ws*$$//" \
-                            -e "s/^$$ws*:global-test-result:$$ws*//p" \
-                       $$i.trs`; \
-## If no global result is explicitly declared, we'll merely mark the
-## test as "RUN" in the global test log.
-           test -n "$$glob_res" || glob_res=RUN; \
-## Write the name and result of the test as an RST section title.
-           echo "$$glob_res: $$i" | $(am__rst_section); \
-## If we should have remade any unreadable '.log', above.
-           if test ! -r $$i.log; then \
-             echo "fatal: making $@: $$i.log is unreadable" >&2; \
-             exit 1; \
-           fi; \
-           cat $$i.log; echo; \
-         done; \
-       } >$(TEST_SUITE_LOG).tmp;                                       \
+         for b in $$bases; do echo $$b; done                           \
+           | $(am__create_global_log);                                 \
+       } >$(TEST_SUITE_LOG).tmp || exit 1;                             \
        mv $(TEST_SUITE_LOG).tmp $(TEST_SUITE_LOG);                     \
 ## Emit the test summary on the console.
        if $$success; then                                              \
@@ -330,36 +418,22 @@ check-TESTS recheck:
 ## cannot use '$?' to compute the set of lazily rerun tests, lest
 ## we rely on .PHONY to work portably.
        @test -z "$(TEST_SUITE_LOG)" || rm -f $(TEST_SUITE_LOG)
-       @ws='[  ]'; \
-       log_list='' trs_list=''; $(am__set_TESTS_bases); \
-       for i in $$bases; do \
+       @$(am__set_TESTS_bases); \
+       if test $@ = recheck; then \
 ## If running a "make recheck", we must only consider tests that had an
-## unexpected outcome (FAIL or XPASS) in the earlier run.  In particular,
-## skip tests that haven't been run.  But recover gracefully from deleted
-## '.trs' files.
-         if test $@ = recheck; then \
-           test -f $$i.trs || test -f $$i.log || continue; \
-## FIXME: one fork per test -- this is horrendously inefficient!
-           grep "^$$ws*:recheck:$$ws*no$$ws*$$" $$i.trs \
-             >/dev/null 2>&1 && continue; \
-         else :; fi; \
-## Be careful to avoid extra whitespace in the definition of $list, since
-## its value will be passed to the recursive make invocation below through
-## the TEST_LOGS macro, and leading/trailing white space in a make macro
-## definition can be problematic.  In this particular case, trailing white
-## space was known to cause a segmentation fault on Solaris 10 XPG4 make:
-## <http://lists.gnu.org/archive/html/bug-automake/2010-08/msg00004.html>
-         if test -z "$$log_list"; then \
-           log_list="$$i.log"; \
-         else \
-           log_list="$$log_list $$i.log"; \
-         fi; \
-         if test -z "$$trs_list"; then \
-           trs_list="$$i.trs"; \
-         else \
-           trs_list="$$trs_list $$i.trs"; \
-         fi; \
-       done; \
+## unexpected outcome (FAIL or XPASS) in the earlier run.
+         bases=`for i in $$bases; do echo $$i; done \
+                  | $(am__list_recheck_tests)` || exit 1; \
+       fi; \
+       log_list=`for i in $$bases; do echo $$i.log; done`; \
+       trs_list=`for i in $$bases; do echo $$i.trs; done`; \
+## Remove newlines and normalize whitespace, being careful to avoid extra
+## whitespace in the definition of $log_list, since its value will be
+## passed to the recursive make invocation below through the TEST_LOGS
+## macro, and leading/trailing white space in a make macro definition can
+## be problematic.  In this particular case, trailing white space is known
+## to have caused segmentation faults on Solaris 10 XPG4 make:
+       log_list=`echo $$log_list`; trs_list=`echo $$trs_list`; \
 ## Under "make recheck", remove the .log and .trs files associated
 ## with the files to recheck, so that those will be rerun by the
 ## "make test-suite.log" recursive invocation below.  But use a proper
index 8d7adf6..cee3199 100644 (file)
@@ -5,7 +5,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 16
+# serial 17
 
 # There are a few dirty hacks below to avoid letting 'AC_PROG_CC' be
 # written in clear, in which case automake, when reading aclocal.m4,
@@ -17,7 +17,7 @@
 # _AM_DEPENDENCIES(NAME)
 # ----------------------
 # See how the compiler implements dependency checking.
-# NAME is "CC", "CXX", "GCJ", or "OBJC".
+# NAME is "CC", "CXX", "OBJC", "OBJCXX", "UPC", or "GJC".
 # We try a few techniques and use that to set a single cache variable.
 #
 # We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
@@ -33,6 +33,7 @@ AC_REQUIRE([AM_DEP_TRACK])dnl
 m4_if([$1], [CC],   [depcc="$CC"   am_compiler_list=],
       [$1], [CXX],  [depcc="$CXX"  am_compiler_list=],
       [$1], [OBJC], [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
+      [$1], [OBJCXX], [depcc="$OBJCXX" am_compiler_list='gcc3 gcc'],
       [$1], [UPC],  [depcc="$UPC"  am_compiler_list=],
       [$1], [GCJ],  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
                     [depcc="$$1"   am_compiler_list=])
index 3520dcb..85228ba 100644 (file)
@@ -6,7 +6,7 @@
 # gives unlimited permission to copy and/or distribute it,
 # with or without modifications, as long as this notice is preserved.
 
-# serial 18
+# serial 19
 
 # This macro actually does too much.  Some checks are only needed if
 # your package does certain things.  But this isn't really a big deal.
@@ -52,7 +52,10 @@ AC_SUBST([CYGPATH_W])
 # Define the identity of the package.
 dnl Distinguish between old-style and new-style calls.
 m4_ifval([$2],
-[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
+[AC_DIAGNOSE([obsolete],
+[$0: two- and three-arguments forms are deprecated.  For more info, see:
+http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation])
+m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
  AC_SUBST([PACKAGE], [$1])dnl
  AC_SUBST([VERSION], [$2])],
 [_AM_SET_OPTIONS([$1])dnl
@@ -90,16 +93,23 @@ _AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
 _AM_IF_OPTION([no-dependencies],,
 [AC_PROVIDE_IFELSE([AC_PROG_CC],
                  [_AM_DEPENDENCIES([CC])],
-                 [define([AC_PROG_CC],
-                         defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
+                 [m4_define([AC_PROG_CC],
+                            m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_CXX],
                  [_AM_DEPENDENCIES([CXX])],
-                 [define([AC_PROG_CXX],
-                         defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
+                 [m4_define([AC_PROG_CXX],
+                            m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl
 AC_PROVIDE_IFELSE([AC_PROG_OBJC],
                  [_AM_DEPENDENCIES([OBJC])],
-                 [define([AC_PROG_OBJC],
-                         defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
+                 [m4_define([AC_PROG_OBJC],
+                            m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl
+dnl Support for Objective C++ was only introduced in Autoconf 2.65,
+dnl but we still cater to Autoconf 2.62.
+m4_ifdef([AC_PROG_OBJCXX],
+[AC_PROVIDE_IFELSE([AC_PROG_OBJCXX],
+                 [_AM_DEPENDENCIES([OBJCXX])],
+                 [m4_define([AC_PROG_OBJCXX],
+                            m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])])dnl
 ])
 _AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
 dnl The 'parallel-tests' driver may need to know about EXEEXT, so add the
index 130d469..bac6c7b 100644 (file)
@@ -38,6 +38,7 @@ ams := $(shell find $(srcdir) -name '*.dir' -prune -o -name '*.am' -print)
 # Some simple checks, and then ordinary check.  These are only really
 # guaranteed to work on my machine.
 syntax_check_rules = \
+$(sc_tests_plain_check_rules) \
 sc_test_names \
 sc_diff_automake_in_automake \
 sc_diff_aclocal_in_automake \
@@ -56,22 +57,13 @@ sc_perl_local \
 sc_AMDEP_TRUE_in_automake_in \
 sc_tests_make_without_am_makeflags \
 sc_tests_obsolete_variables \
-sc_tests_plain_make \
-sc_tests_plain_autoconf \
-sc_tests_plain_autoupdate \
-sc_tests_plain_automake \
-sc_tests_plain_autom4te \
-sc_tests_plain_autoheader \
-sc_tests_plain_autoreconf \
 sc_tests_here_document_format \
 sc_tests_Exit_not_exit \
 sc_tests_automake_fails \
-sc_tests_plain_aclocal \
-sc_tests_plain_perl \
 sc_tests_required_after_defs \
 sc_tests_overriding_macros_on_cmdline \
 sc_tests_plain_sleep \
-sc_tests_plain_egrep_fgrep \
+sc_m4_am_plain_egrep_fgrep \
 sc_tests_no_configure_in \
 sc_tests_PATH_SEPARATOR \
 sc_tests_logs_duplicate_prefixes \
@@ -81,14 +73,6 @@ sc_unquoted_DESTDIR \
 sc_tabs_in_texi \
 sc_at_in_texi
 
-$(syntax_check_rules): automake aclocal
-maintainer-check: $(syntax_check_rules)
-.PHONY: maintainer-check $(syntax_check_rules)
-
-## Check that the list of tests given in the Makefile is equal to the
-## list of all test scripts in the Automake testsuite.
-maintainer-check: maintainer-check-list-of-tests
-
 ## Look for test whose names can cause spurious failures when used as
 ## first argument to AC_INIT (chiefly because they might contain an
 ## m4/m4sugar builtin or macro name).
@@ -311,53 +295,36 @@ sc_tests_obsolete_variables:
          exit 1; \
        else :; fi
 
-## Tests should never call make directly.
-sc_tests_plain_make:
-       @if grep -v '^#' $(xtests) | $(EGREP) ':[       ]*make( |$$)'; then \
-         echo 'Do not run "make" in the above tests.  Use "$$MAKE" instead.' 1>&2; \
-         exit 1; \
-       fi
-
-## Tests should never call autoconf directly.
-sc_tests_plain_autoconf:
-       @if grep -v '^#' $(xtests) | grep ':[   ]*autoconf\>'; then \
-         echo 'Do not run "autoconf" in the above tests.  Use "$$AUTOCONF" instead.' 1>&2; \
-         exit 1; \
-       fi
-
-## Tests should never call autoupdate directly.
-sc_tests_plain_autoupdate:
-       @if grep -v '^#' $(xtests) | grep ':[   ]*autoupdate\>'; then \
-         echo 'Do not run "autoupdate" in the above tests.  Use "$$AUTOUPDATE" instead.' 1>&2; \
-         exit 1; \
-       fi
-
-## Tests should never call automake directly.
-sc_tests_plain_automake:
-       @if grep -v '^#' $(xtests) | grep -E ':[        ]*automake\>([^:]|$$)'; then \
-         echo 'Do not run "automake" in the above tests.  Use "$$AUTOMAKE" instead.' 1>&2;  \
-         exit 1; \
-       fi
-
-## Tests should never call autoheader directly.
-sc_tests_plain_autoheader:
-       @if grep -v '^#' $(xtests) | grep ':[   ]*autoheader\>'; then \
-         echo 'Do not run "autoheader" in the above tests.  Use "$$AUTOHEADER" instead.' 1>&2;  \
-         exit 1; \
-       fi
-
-## Tests should never call autoreconf directly.
-sc_tests_plain_autoreconf:
-       @if grep -v '^#' $(xtests) | grep ':[   ]*autoreconf\>'; then \
-         echo 'Do not run "autoreconf" in the above tests.  Use "$$AUTORECONF" instead.' 1>&2;  \
-         exit 1; \
-       fi
-
-## Tests should never call autom4te directly.
-sc_tests_plain_autom4te:
-       @if grep -v '^#' $(xtests) | grep ':[   ]*autom4te\>'; then \
-         echo 'Do not run "autom4te" in the above tests.  Use "$$AUTOM4TE" instead.' 1>&2;  \
-         exit 1; \
+## Tests should never call some programs directly, but only through the
+## corresponding variable (e.g., '$MAKE', not 'make').  This will allow
+## the programs to be overridden at configure time (for less brittleness)
+## or by the user at make time (to allow better testsuite coverage).
+sc_tests_plain_check_rules = \
+  sc_tests_plain_egrep \
+  sc_tests_plain_fgrep \
+  sc_tests_plain_make \
+  sc_tests_plain_perl \
+  sc_tests_plain_automake \
+  sc_tests_plain_aclocal \
+  sc_tests_plain_autoconf \
+  sc_tests_plain_autoupdate \
+  sc_tests_plain_autom4te \
+  sc_tests_plain_autoheader \
+  sc_tests_plain_autoreconf
+
+toupper = $(shell echo $(1) | LC_ALL=C tr '[a-z]' '[A-Z]')
+
+$(sc_tests_plain_check_rules): sc_tests_plain_% :
+       @# The leading ':' in the grep below is what is printed by the
+       @# preceding 'grep -v' after the file name.
+       @# It works here as a poor man's substitute for beginning-of-line
+       @# marker.
+       @if grep -v '^[         ]*#' $(xtests) \
+          | $(EGREP) '(:|\bif|\bnot|[;!{\|\(]|&&|\|\|)[        ]*?$*\b'; \
+        then \
+          echo 'Do not run "$*" in the above tests.' \
+               'Use "$$$(call toupper,$*)" instead.' 1>&2; \
+          exit 1; \
        fi
 
 ## Tests should only use END and EOF for here documents
@@ -393,20 +360,6 @@ sc_tests_automake_fails:
          exit 1; \
        fi
 
-## Tests should never call aclocal directly.
-sc_tests_plain_aclocal:
-       @if grep -v '^#' $(xtests) | grep ':[   ]*aclocal\>'; then \
-         echo 'Do not run "aclocal" in the above tests.  Use "$$ACLOCAL" instead.' 1>&2;  \
-         exit 1; \
-       fi
-
-## Tests should never call perl directly.
-sc_tests_plain_perl:
-       @if grep -v '^#' $(xtests) | grep ':[   ]*perl\>'; then \
-         echo 'Do not run "perl" in the above tests.  Use "$$PERL" instead.' 1>&2; \
-         exit 1; \
-       fi
-
 ## Setting 'required' after sourcing './defs' is a bug.
 sc_tests_required_after_defs:
        @for file in $(xtests); do \
@@ -468,13 +421,10 @@ sc_tests_plain_sleep:
        fi
 
 ## fgrep and egrep are not required by POSIX.
-sc_tests_plain_egrep_fgrep:
-       @if grep -E '\b[ef]grep\b' $(xtests) ; then \
-         echo 'Do not use egrep or fgrep in test cases.  Use $$FGREP or $$EGREP.' 1>&2; \
-         exit 1; \
-       fi
+sc_m4_am_plain_egrep_fgrep:
        @if grep -E '\b[ef]grep\b' $(ams) $(srcdir)/m4/*.m4; then \
-         echo 'Do not use egrep or fgrep in the above files, they are not portable.' 1>&2; \
+         echo 'Do not use egrep or fgrep in the above files,' \
+              'they are not portable.' 1>&2; \
          exit 1; \
        fi
 
@@ -574,3 +524,11 @@ sc_at_in_texi:
          echo 'Unescaped @.' 1>&2; \
          exit 1; \
        fi
+
+$(syntax_check_rules): automake aclocal
+maintainer-check: $(syntax_check_rules)
+.PHONY: maintainer-check $(syntax_check_rules)
+
+## Check that the list of tests given in the Makefile is equal to the
+## list of all test scripts in the Automake testsuite.
+maintainer-check: maintainer-check-list-of-tests
index 5c906a2..5ba3d3e 100755 (executable)
@@ -24,6 +24,8 @@ plan_ 22
 
 rm -f configure.ac depcomp # Not required.
 
+AUTOMAKE="$AUTOMAKE -Wno-obsolete"
+
 # -----------------------------------------------------------------------
 
 # Test for bug reported by François Pinard.
index 4030b13..3e0cac6 100755 (executable)
@@ -34,6 +34,11 @@ cat stderr >&2
 grep 'unrecognized option.*--unknown-option' stderr
 grep '[Tt]ry.*--help.*for more information' stderr
 
+$ACLOCAL foobar 2>stderr && { cat stderr >&2; Exit 1; }
+cat stderr >&2
+grep 'non-option argument.*foobar' stderr
+grep '[Tt]ry.*--help.*for more information' stderr
+
 $ACLOCAL --ver 2>stderr && { cat stderr >&2; Exit 1; }
 cat stderr >&2
 grep 'unrecognized option.*--ver' stderr
diff --git a/t/aminit-moreargs-deprecation.sh b/t/aminit-moreargs-deprecation.sh
new file mode 100755 (executable)
index 0000000..ac91d1d
--- /dev/null
@@ -0,0 +1,51 @@
+#! /bin/sh
+# Copyright (C) 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that automake warns against old-style usages of AM_INIT_AUTOMAKE
+# (i.e., calls with two or three arguments).
+
+. ./defs || Exit 1
+
+warn_rx='AM_INIT_AUTOMAKE.* two-.* three-arguments form.*deprecated'
+
+cat > configure.ac <<'END'
+AC_INIT([Makefile.am])
+AM_INIT_AUTOMAKE([twoargs], [1.0])
+AC_CONFIG_FILES([Makefile])
+END
+
+$ACLOCAL
+
+do_check()
+{
+  rm -rf autom4te*.cache
+  for cmd in "$AUTOCONF" "$AUTOMAKE"; do
+    $cmd -Werror -Wnone -Wobsolete 2>stderr && { cat stderr; Exit 1; }
+    cat stderr >&2
+    grep "^configure\.ac:2:.*$warn_rx" stderr
+    $cmd -Werror -Wall -Wno-obsolete || Exit 1
+  done
+}
+
+: > Makefile.am
+do_check
+
+sed "/^AM_INIT_AUTOMAKE/s|)$|, [NODEFINE])|" configure.ac > t
+diff configure.ac t && fatal_ "failed to edit configure.ac"
+mv -f t configure.ac
+do_check
+
+:
index 790d1b1..41a73d5 100755 (executable)
@@ -121,7 +121,7 @@ grep '%%d[013]' out2 && Exit 1
 rm -f ../../missing ../../install-sh
 
 # --------------------------------------------------------- #
-:  AC_CONFIG_AUX_DIR will not be found: automake must fail  #
+:  AC_CONFIG_AUX_DIR will not be found: Automake must fail  #
 # --------------------------------------------------------- #
 
 AUTOMAKE_fails
index ec8292c..8a93141 100755 (executable)
@@ -55,7 +55,7 @@ END
     cat configure.in # For debugging.
     $ACLOCAL
     $AUTOCONF
-    $AUTOMAKE
+    $AUTOMAKE -Wno-obsolete
     ./configure
     $MAKE test
   done
index 2377e88..5dc78f6 100755 (executable)
@@ -22,6 +22,8 @@ am_create_testdir=empty
 
 empty=''
 
+AUTOMAKE="$AUTOMAKE -Wno-obsolete"
+
 cat > Makefile.am <<'END'
 ## Leading ':;' here required to work around bugs of (at least) bash 3.2
 got: Makefile
index 3aa9067..6bfb1c2 100755 (executable)
@@ -94,10 +94,10 @@ END
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE -a
+$AUTOMAKE -a -Wno-obsolete
 test -f install-sh
 for f in $makefiles; do mv -f $f.in $f.sav; done
-$AUTOMAKE
+$AUTOMAKE -Wno-obsolete
 for f in $makefiles; do diff $f.sav $f.in; done
 
 ./configure
index fde118b..4523a65 100755 (executable)
@@ -78,7 +78,7 @@ int main (void)
 END
 
 $ACLOCAL
-$AUTOMAKE --add-missing
+$AUTOMAKE -Wno-obsolete --add-missing
 $AUTOCONF
 
 ./configure
index 2599e97..b5f5df2 100755 (executable)
@@ -49,7 +49,7 @@ END
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --cygnus
+$AUTOMAKE --cygnus -Wno-obsolete
 
 ./configure
 $MAKE
index dd45678..3961303 100755 (executable)
@@ -64,6 +64,6 @@ while test $try -le 30; do
   fi
 done
 # The automake process probably hung.  Kill it, and exit with failure.
-echo "$me: automake process $pid hung"
+echo "$me: Automake process $pid hung"
 kill $pid
 Exit 1
index 1887046..b13f26a 100755 (executable)
 
 . ./defs || Exit 1
 
-cat > configure.ac << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AM_CONFIG_HEADER(subdir/config.h:subdir/config.hin)
-AC_OUTPUT(Makefile subdir/Makefile)
+cat >> configure.ac << 'END'
+AC_CONFIG_FILES([subdir/Makefile])
+AM_CONFIG_HEADER([subdir/config.h:subdir/config.hin])
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
index f428e95..121c657 100755 (executable)
@@ -33,7 +33,7 @@ check-local:
 END
 
 $ACLOCAL
-$AUTOMAKE --cygnus
+$AUTOMAKE --cygnus -Wno-obsolete
 
 $EGREP '(^| )all.*(:|:.* )check' Makefile.in && Exit 1
 
index f07c6fc..6c858c1 100755 (executable)
@@ -27,6 +27,7 @@ AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
+AUTOMAKE_OPTIONS = -Wno-obsolete
 bin_PROGRAMS = foo
 foo_SOURCES = foo.c
 .PHONY: test-nodeps
diff --git a/t/cygnus-deprecation.sh b/t/cygnus-deprecation.sh
new file mode 100755 (executable)
index 0000000..779914b
--- /dev/null
@@ -0,0 +1,68 @@
+#! /bin/sh
+# Copyright (C) 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check that support for Cygnus-style trees is deprecated.
+# That feature will be removed in the next major Automake release.
+# See automake bug#11034.
+
+. ./defs || Exit 1
+
+warn_rx='support for Cygnus.*trees.*deprecated'
+
+cat >> configure.ac <<'END'
+AC_PROG_CC
+AM_MAINTAINER_MODE
+END
+
+$ACLOCAL
+$AUTOCONF
+
+: > Makefile.am
+
+# 'cygnus' option from command line
+$AUTOMAKE --cygnus -Wno-obsolete
+AUTOMAKE_fails --cygnus
+grep "^automake.*: .*$warn_rx" stderr
+AUTOMAKE_fails -Wnone -Wobsolete --cygnus
+grep "^automake.*: .*$warn_rx" stderr
+AUTOMAKE_fails --cygnus -Wnone -Wobsolete
+grep "^automake.*: .*$warn_rx" stderr
+
+rm -rf autom4te*.cache
+
+# 'cygnus' option in Makefile.am
+echo "AUTOMAKE_OPTIONS = cygnus" > Makefile.am
+cat Makefile.am # For debugging.
+$AUTOMAKE -Wno-obsolete
+AUTOMAKE_fails
+grep "^Makefile\.am:1:.*$warn_rx" stderr
+AUTOMAKE_fails -Wnone -Wobsolete
+grep "^Makefile\.am:1:.*$warn_rx" stderr
+
+rm -rf autom4te*.cache
+
+# 'cygnus' option in configure.ac
+: > Makefile.am
+sed "s|^\\(AM_INIT_AUTOMAKE\\).*|\1([cygnus])|" configure.ac > t
+diff configure.ac t && fatal_ "failed to edit configure.ac"
+mv -f t configure.ac
+$AUTOMAKE -Wno-obsolete
+AUTOMAKE_fails
+grep "^configure\.ac:2:.*$warn_rx" stderr
+AUTOMAKE_fails -Wnone -Wobsolete
+grep "^configure\.ac:2:.*$warn_rx" stderr
+
+:
index 519f0c2..d94a8f5 100755 (executable)
@@ -29,7 +29,7 @@ END
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE --cygnus
+$AUTOMAKE --cygnus -Wno-obsolete
 
 ./configure
 $MAKE
@@ -55,6 +55,8 @@ cat > sub2/Makefile.am <<'END'
 # in override warnings, for when (below) we add the 'distdir'
 # target.
 AUTOMAKE_OPTIONS = cygnus -Wall
+# This is required because the 'cygnus' option is now deprecated.
+AUTOMAKE_OPTIONS += -Wno-obsolete
 END
 
 cat configure.stub - > configure.ac <<'END'
index 6f3f322..d46b6b3 100755 (executable)
@@ -33,9 +33,11 @@ cat > foo.texi <<'END'
 END
 
 $ACLOCAL
-# FIXME: -Wno-override works around a buglet in definition of $(MAKEINFO)
+# -Wno-override works around a buglet in definition of $(MAKEINFO)
 # in cygnus mode; see also xfailing test 'txinfo5.test'.
-$AUTOMAKE --cygnus -Wno-override
+# -Wno-obsolete accounts for the fact that the cygnus mode is now
+# deprecated.
+$AUTOMAKE --cygnus -Wno-override -Wno-obsolete
 $AUTOCONF
 
 cwd=`pwd` || Exit 1
index b01dfbc..546e898 100755 (executable)
@@ -21,7 +21,7 @@
 : > Makefile.am
 
 $ACLOCAL
-AUTOMAKE_fails --cygnus
+AUTOMAKE_fails -Wno-obsolete --cygnus
 grep '^configure\.ac:.*AM_MAINTAINER_MODE.*required.*cygnus' stderr
 
 cat >> configure.ac <<'END'
@@ -34,7 +34,7 @@ END
 
 mkdir sub
 cat > sub/Makefile.am <<'END'
-AUTOMAKE_OPTIONS = cygnus
+AUTOMAKE_OPTIONS = -Wno-obsolete cygnus
 END
 
 rm -rf autom4te.cache
@@ -48,6 +48,6 @@ END
 
 rm -rf autom4te.cache
 $ACLOCAL
-$AUTOMAKE --cygnus
+$AUTOMAKE --cygnus -Wno-obsolete
 
 :
index d627cf8..26c6c97 100755 (executable)
@@ -168,7 +168,7 @@ can_compress ()
   command_ok_if_have_compressor "'make dist-$format' work by default" \
     eval '
       rm -rf *$tarname* \
-        && make dist-$format \
+        && $MAKE dist-$format \
         && test -f $tarname-1.0.$suffix \
         && ls -l *$tarname* \
         && test "`ls *$tarname*`" = $tarname-1.0.$suffix'
index dd92e85..c62dbd3 100755 (executable)
--- a/t/ext.sh
+++ b/t/ext.sh
@@ -22,18 +22,24 @@ cat >> configure.ac << 'END'
 AC_PROG_F77
 AC_PROG_FC
 AC_PROG_OBJC
+# FIXME: this is to cater to older autoconf; remove this once we
+# FIXME: automake requires Autoconf 2.65 or later.
+m4_ifdef([AC_PROG_OBJCXX], [AC_PROG_OBJCXX], [
+  AC_SUBST([OBJCXX], [whocares])
+  AM_CONDITIONAL([am__fastdepOBJCXX], [whocares])
+])
 AM_PROG_UPC
 END
 
 cat > Makefile.am << 'END'
 bin_PROGRAMS = foo
-foo_SOURCES = 1.f 2.for 3.f90 4.f95 5.F 6.F90 7.F95 8.r 9.m 10.upc
+foo_SOURCES = 1.f 2.for 3.f90 4.f95 5.F 6.F90 7.F95 8.r 9.m 10.mm 11.upc
 END
 
 $ACLOCAL
 $AUTOMAKE
 
-for ext in f for f90 f95 F F90 F95 r m upc
+for ext in f for f90 f95 F F90 F95 r m mm upc
 do
    # Some versions of the BSD shell wrongly exit when 'set -e' is active
    # if the last command within a compound statement fails and is guarded
index f532406..6a1fddb 100755 (executable)
@@ -35,8 +35,8 @@ END
 $ACLOCAL
 $AUTOCONF
 # Order flavors so that all needed files are installed early.
-for flavor in --gnits --gnu --foreign --cygnus --ignore-deps
-do
+for flavor in --gnits --gnu --foreign --ignore-deps; do
+
   $AUTOMAKE --add-missing $flavor
   ./configure --enable-maintainer-mode
   grep " $flavor" Makefile
@@ -54,6 +54,24 @@ do
   touch Makefile.am
   $MAKE
   grep " $flavor" Makefile
+
 done
 
+# Cygnus mode is deprecated now, and must be handled separately.
+$AUTOMAKE --cygnus -Wno-obsolete
+./configure --enable-maintainer-mode
+grep " --cygnus" Makefile
+$MAKE
+# Two code paths in configure.am:
+# - either a file in $(am__configure_deps) has been updated ...
+$sleep
+touch aclocal.m4
+$MAKE
+grep " --cygnus" Makefile
+# - ... or not; i.e., Makefile.am or an included file has.
+$sleep
+touch Makefile.am
+$MAKE
+grep " --cygnus" Makefile
+
 :
index f1992e8..bd400f4 100755 (executable)
 # Test for bug in 'make dist'
 # From Pavel Roskin.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
-cat > configure.ac << 'END'
-AC_INIT
+cat > configure.ac << END
+AC_INIT([$me], [1.0])
 dnl Prevent automake from looking in .. and ../..
-AC_CONFIG_AUX_DIR(.)
-AM_INIT_AUTOMAKE(foo, 0.1)
-AC_OUTPUT(Makefile)
+AC_CONFIG_AUX_DIR([.])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
index dffe658..1bf34de 100755 (executable)
 
 cat >> configure.ac << 'END'
 AC_PROG_RANLIB
-AM_MAINTAINER_MODE
 AC_PROG_CC
 AM_PROG_AR
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = dejagnu cygnus
 lib_LIBRARIES = libfoo.a
 libfoo_a_DEPENDENCIES = libzot.a
 END
index 299ecd0..738cbd6 100755 (executable)
@@ -37,6 +37,7 @@ $AUTOCONF
 $AUTOMAKE --add-missing
 ./configure
 
+# Use append mode here to avoid dropping output.  See automake bug#11413.
 : >stdout
 $MAKE -j >>stdout || { cat stdout; Exit 1; }
 
@@ -50,6 +51,7 @@ test -f elc-stamp
 
 rm -f am-*.elc
 
+# Use append mode here to avoid dropping output.  See automake bug#11413.
 : >stdout
 $MAKE -j >>stdout || { cat stdout; Exit 1; }
 
index d692561..e9f8d23 100644 (file)
@@ -117,6 +117,7 @@ t/alpha2.sh \
 t/amhello-cflags.sh \
 t/amhello-cross-compile.sh \
 t/amhello-binpkg.sh \
+t/aminit-moreargs-deprecation.sh \
 t/amassign.sh \
 t/ammissing.sh \
 t/amopt.sh \
@@ -330,6 +331,7 @@ t/cxxlibobj.sh \
 t/cxxlink.sh \
 t/cxxnoc.sh \
 t/cxxo.sh \
+t/cygnus-deprecation.sh \
 t/cygnus-check-without-all.sh \
 t/cygnus-dependency-tracking.sh \
 t/cygnus-imply-foreign.sh \
@@ -702,8 +704,15 @@ t/nolink.sh \
 t/nostdinc.sh \
 t/notrans.sh \
 t/number.sh \
-t/objc.sh \
-t/objc2.sh \
+t/objc-basic.sh \
+t/objc-minidemo.sh \
+t/objc-flags.sh \
+t/objc-deps.sh \
+t/objcxx-basic.sh \
+t/objcxx-minidemo.sh \
+t/objcxx-flags.sh \
+t/objcxx-deps.sh \
+t/objc-megademo.sh \
 t/objext-pr10128.sh \
 t/obsolete.sh \
 t/oldvars.sh \
@@ -776,6 +785,8 @@ t/testsuite-summary-color.sh \
 t/testsuite-summary-count.sh \
 t/testsuite-summary-count-many.sh \
 t/testsuite-summary-reference-log.sh \
+t/testsuite-recheck-speed.sh \
+t/testsuite-summary-speed.sh \
 t/test-driver-acsubst.sh \
 t/test-driver-cond.sh \
 t/test-driver-custom-no-extra-driver.sh \
@@ -933,7 +944,6 @@ t/req.sh \
 t/reqd.sh \
 t/reqd2.sh \
 t/repeated-options.sh \
-t/rst-formatting.sh \
 t/rulepat.sh \
 t/self-check-cleanup.tap \
 t/self-check-configure-help.sh \
index e496ca6..f9dd289 100755 (executable)
@@ -48,10 +48,10 @@ END
 # Smash the useless difference of lib file locations.
 smash_useless_diffs ()
 {
-  # FIXME: we could get rid of the second 's|||' once we improve our
+  # FIXME: we could get rid of the second 's,,,' once we improve our
   # wrapper scripts ...
-  sed -e "s|^$am_amdir/\\([a-z]*\.am\\)|\\1|" \
-      -e "s|^automake-$APIVERSION:|automake:|" ${1+"$@"};
+  sed -e "s,^$am_amdir/\\([a-z]*\.am\\),\\1," \
+      -e "s,^automake-$APIVERSION:,automake:," ${1+"$@"};
 }
 
 $ACLOCAL
@@ -59,26 +59,28 @@ AUTOMAKE_fails -Wno-error
 
 smash_useless_diffs stderr >observed
 
-cat >expected <<\EOF
-Makefile.am:12: warning: VAR multiply defined in condition TRUE ...
-Makefile.am:8: ... 'VAR' previously defined here
-automake: error: libfoo_a_OBJECTS should not be defined
-Makefile.am:3:   while processing library 'libfoo.a'
-automake: error: use 'libfoo_a_LDADD', not 'libfoo_a_LIBADD'
-Makefile.am:3:   while processing library 'libfoo.a'
-library.am: warning: deprecated feature: target 'libfoo.a' overrides 'libfoo.a$(EXEEXT)'
-library.am: change your target to read 'libfoo.a$(EXEEXT)'
-Makefile.am:3:   while processing library 'libfoo.a'
-program.am: target 'libfoo.a$(EXEEXT)' was defined here
-Makefile.am:1:   while processing program 'libfoo.a'
-program.am: warning: redefinition of 'libfoo.a$(EXEEXT)' ...
-Makefile.am:1:   while processing program 'libfoo.a'
-library.am: ... 'libfoo.a' previously defined here
-Makefile.am:3:   while processing library 'libfoo.a'
-tags.am: warning: redefinition of 'ctags' ...
-program.am: ... 'ctags$(EXEEXT)' previously defined here
-Makefile.am:6:   while processing program 'ctags'
-EOF
+# Apparently useless use of sed here required to avoid spuriously
+# triggering some maintainer-checks failures.
+sed 's/^> //' > expected << 'END'
+> Makefile.am:12: warning: VAR multiply defined in condition TRUE ...
+> Makefile.am:8: ... 'VAR' previously defined here
+> automake: error: libfoo_a_OBJECTS should not be defined
+> Makefile.am:3:   while processing library 'libfoo.a'
+> automake: error: use 'libfoo_a_LDADD', not 'libfoo_a_LIBADD'
+> Makefile.am:3:   while processing library 'libfoo.a'
+> library.am: warning: deprecated feature: target 'libfoo.a' overrides 'libfoo.a$(EXEEXT)'
+> library.am: change your target to read 'libfoo.a$(EXEEXT)'
+> Makefile.am:3:   while processing library 'libfoo.a'
+> program.am: target 'libfoo.a$(EXEEXT)' was defined here
+> Makefile.am:1:   while processing program 'libfoo.a'
+> program.am: warning: redefinition of 'libfoo.a$(EXEEXT)' ...
+> Makefile.am:1:   while processing program 'libfoo.a'
+> library.am: ... 'libfoo.a' previously defined here
+> Makefile.am:3:   while processing library 'libfoo.a'
+> tags.am: warning: redefinition of 'ctags' ...
+> program.am: ... 'ctags$(EXEEXT)' previously defined here
+> Makefile.am:6:   while processing program 'ctags'
+END
 
 cat expected
 cat observed
index edf0fa9..cc80058 100755 (executable)
@@ -20,7 +20,7 @@
 
 cat > Makefile.am << 'END'
 bin_PROGRAMS = foo
-foo_SOURCES = a.c b.cpp c.m d.S e.java f.upc
+foo_SOURCES = a.c b.cpp c.m cxx.mm d.S e.java f.upc
 END
 
 cat > configure.ac << 'END'
@@ -30,6 +30,12 @@ AC_CONFIG_FILES([Makefile])
 AC_PROG_CC
 AC_PROG_CXX
 AC_PROG_OBJC
+# FIXME: this is to cater to older autoconf; remove this once we
+# FIXME: automake requires Autoconf 2.65 or later.
+m4_ifdef([AC_PROG_OBJCXX], [AC_PROG_OBJCXX], [
+  AC_SUBST([OBJCXX], [whocares])
+  AM_CONDITIONAL([am__fastdepOBJCXX], [whocares])
+])
 AM_PROG_AS
 AM_PROG_GCJ
 AM_PROG_UPC
similarity index 58%
rename from t/objc2.sh
rename to t/objc-basic.sh
index 290bf26..f608fbc 100755 (executable)
@@ -1,5 +1,5 @@
 #! /bin/sh
-# Copyright (C) 2002-2012 Free Software Foundation, Inc.
+# Copyright (C) 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
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 # GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test that Automake suggests using AC_PROG_OBJC if Objective C sources
-# are used.
+# Basic tests on the Objective C support that don't actually
+# require an Objective-C compiler.
+# See also sister test 'objcxx-basic.sh'.
 
 . ./defs || Exit 1
 
-echo AC_PROG_CC >>configure.ac
-
-cat >Makefile.am <<'END'
+cat > Makefile.am <<'END'
 bin_PROGRAMS = hello
 hello_SOURCES = hello.m
 END
 
 $ACLOCAL
 AUTOMAKE_fails
-grep AC_PROG_OBJC stderr
+grep "'OBJC'.* undefined" stderr
+grep "add .*'AC_PROG_OBJC'" stderr
+
+rm -rf autom4te*.cache
+
+echo AC_PROG_OBJC >> configure.ac
+
+$ACLOCAL
+$AUTOMAKE
+$EGREP '^\.SUFFIXES:.* \.m( |$)' Makefile.in
+
+:
diff --git a/t/objc-deps.sh b/t/objc-deps.sh
new file mode 100755 (executable)
index 0000000..a2e4212
--- /dev/null
@@ -0,0 +1,72 @@
+#! /bin/sh
+# Copyright (C) 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Automatic dependency tracking for Objective C.
+# See also sister test 'objcxx-deps.sh'.
+
+. ./defs || Exit 1
+
+cat >> configure.ac << 'END'
+AC_PROG_OBJC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+foo_SOURCES = bar.m baz.h baz2.h
+END
+
+cat > baz.h << 'END'
+#include <stdio.h>
+#include <stdlib.h>
+#include "baz2.h"
+END
+
+cat > baz2.h << 'END'
+#define MSG "Hello, World"
+END
+
+cat > bar.m << 'END'
+/* The use of #import makes this valid Object C but invalid C. */
+#import "baz.h"
+int main (void)
+{
+    fprintf (stdout, "%s\n", MSG);
+    return EXIT_SUCCESS;
+}
+END
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure --enable-dependency-tracking
+$MAKE
+cross_compiling || (./foo | $FGREP 'Hello, World') || Exit 1
+$sleep
+: > old
+echo '#define MSG "Howdy, Earth"' > baz2.h
+$MAKE
+if test -f foo; then
+  is_newest foo old
+else
+  is_newest foo.exe old
+fi
+cross_compiling || (./foo | $FGREP 'Howdy, Earth') || Exit 1
+
+$MAKE distcheck
+
+:
diff --git a/t/objc-flags.sh b/t/objc-flags.sh
new file mode 100755 (executable)
index 0000000..6c2b1e6
--- /dev/null
@@ -0,0 +1,62 @@
+#! /bin/sh
+# Copyright (C) 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test Objective C compilation flags.
+
+. ./defs || Exit 1
+
+cat >> configure.ac << 'END'
+AC_PROG_OBJC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AM_DEFAULT_SOURCE_EXT = .m
+bin_PROGRAMS = foo2 foo4
+AM_OBJCFLAGS = -DVALUE=2 -DERROR=1
+foo4_OBJCFLAGS = -DVALUE=4 -DERROR=1
+END
+
+for i in 2 4; do
+  unindent > foo$i.m << END
+    /* Let's make this file valid Objective C but invalid C. */
+    #import <stdlib.h>
+    @interface Who_Cares { } @end
+    #ifdef ERROR
+    #  error "macro ERROR is defined for foo.m"
+    #else
+    #  if VALUE == $i
+         int main (void) { exit (0); }
+    #  else
+    #    error "VALUE is != $i in foo.m"
+    #  endif
+    #endif
+END
+done
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+$FGREP OBJCFLAGS Makefile.in # For debugging.
+grep '\$(OBJCFLAGS).*\$(AM_OBJCFLAGS)'       Makefile.in && Exit 1
+grep '\$(OBJCFLAGS).*\$(foo.*_OBJCFLAGS)'    Makefile.in && Exit 1
+grep '\$(foo.*_OBJCFLAGS).*\$(AM_OBJCFLAGS)' Makefile.in && Exit 1
+
+./configure OBJCFLAGS=-UERROR
+$MAKE 
+
+:
diff --git a/t/objc-megademo.sh b/t/objc-megademo.sh
new file mode 100755 (executable)
index 0000000..bad2aee
--- /dev/null
@@ -0,0 +1,347 @@
+#! /bin/sh
+# Copyright (C) 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Stress test on Objective C/C++.
+
+required=libtoolize
+. ./defs || Exit 1
+
+## Autotools Input Files.
+
+cat > configure.ac << 'END'
+AC_INIT([play], [1.3], [bug-automake@gnu.org])
+
+dnl Support for Object C++ was introduced only in Autoconf 2.65.
+AC_PREREQ([2.65])
+AC_CONFIG_SRCDIR([play.c])
+AC_CONFIG_AUX_DIR([build-aux])
+AC_CONFIG_MACRO_DIR([m4])
+
+AM_INIT_AUTOMAKE
+
+AM_PROG_AR
+LT_INIT
+
+AC_PROG_CC
+AC_PROG_CXX
+AC_PROG_OBJC
+AC_PROG_OBJCXX
+
+AC_LANG_PUSH([Objective C])
+AC_CACHE_CHECK(
+  [whether the Objective C compiler really works],
+  [my_cv_objc_works],
+  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#import <stdio.h>]],
+                                   [[printf ("foo\n");]])],
+                  [my_cv_objc_works=yes],
+                  [my_cv_objc_works=no])])
+AC_LANG_POP([Objective C])
+
+AC_LANG_PUSH([Objective C++])
+AC_CACHE_CHECK(
+  [whether the Objective C++ compiler really works],
+  [my_cv_objcxx_works],
+  [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#import <iostream>]],
+                                   [[std::cout << "foo" << "\n";]])],
+                  [my_cv_objcxx_works=yes],
+                  [my_cv_objcxx_works=no])])
+AC_LANG_POP([Objective C++])
+
+if test $my_cv_objc_works != yes; then
+  AC_MSG_ERROR([couldn't find a working Objective C compiler], [77])
+fi
+
+if test $my_cv_objcxx_works != yes; then
+  AC_MSG_ERROR([couldn't find a working Objective C++ compiler], [77])
+fi
+
+AC_CONFIG_HEADERS([config.h])
+AC_CONFIG_FILES([Makefile])
+
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = play
+play_SOURCES = play.h play.c playxx.cxx playo.m playoxx.mm
+play_LDADD = libfoo.la
+play_LDFLAGS = -lobjc
+lib_LTLIBRARIES = libfoo.la
+libfoo_la_SOURCES = foo.h foo.c fooxx.cxx fooo.m foooxx.mm
+END
+
+## Run Autotools.
+
+libtoolize
+if $ACLOCAL; then
+  : We have a modern enough autoconf, go ahead.
+elif test $? -eq 63; then
+  skip_ "Object C++ support requires Autoconf 2.65 or later"
+else
+  Exit 1 # Some other aclocal failure.
+fi
+$AUTOHEADER
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+## Program Sources.
+
+cat > play.h << 'END'
+#ifndef PLAY_H
+#define PLAY_H
+
+#include "foo.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+void hello_cxx (void);
+void hello_objc (void);
+void hello_objcxx (void);
+
+#ifdef __OBJC__
+@interface Hello_ObjC
+{ }
++ (void)display;
+@end
+#endif /* __OBJC__ */
+
+#ifdef __cplusplus
+}
+
+class Hello_CXX
+{
+  public:
+    Hello_CXX() { }
+    virtual ~Hello_CXX () { }
+    void hello_cxx ();
+};
+
+#ifdef __OBJC__
+@interface Hello_ObjCXX
+{ }
++ (void)display;
+@end
+
+class Hello_OBJCXX
+{
+  public:
+    Hello_OBJCXX () { }
+    virtual ~Hello_OBJCXX () { }
+    void hello_objcxx();
+};
+#endif /* __OBJC__ */
+
+#endif /* __cplusplus */
+
+#endif /* PLAY_H */
+END
+
+cat > play.c << 'END'
+#include "play.h"
+int main (void)
+{
+  printf ("[Hello C,");
+  world_c ();
+  hello_cxx ();
+  hello_objc ();
+  hello_objcxx ();
+  return 0;
+}
+END
+
+cat > playxx.cxx << 'END'
+#include "play.h"
+
+void hello_cxx(void)
+{
+  Hello_CXX *hello = new Hello_CXX;
+  hello->hello_cxx();
+}
+
+void Hello_CXX::hello_cxx()
+{
+  std::cout << "[Hello C++,";
+  World_CXX *world = new World_CXX;
+  world->world_cxx();
+}
+END
+
+cat > playo.m << 'END'
+#import "play.h"
+
+void hello_objc (void)
+{
+  [Hello_ObjC display];
+}
+
+@implementation Hello_ObjC
++ (void)display
+{
+  printf ("[Hello ObjC,");
+  [World_ObjC display];
+}
+@end
+END
+
+cat > playoxx.mm << 'END'
+#import "play.h"
+
+// Calling: C -> C++ -> ObjC
+
+void hello_objcxx (void)
+{
+  Hello_OBJCXX *hello = new Hello_OBJCXX;
+  hello->hello_objcxx ();
+}
+
+void Hello_OBJCXX::hello_objcxx ()
+{
+  [Hello_ObjCXX display];
+}
+
+@implementation Hello_ObjCXX
++ (void)display
+{
+  std::cout << "[Hello ObjC++,";
+  [World_ObjCXX display];
+}
+@end
+END
+
+## Library Sources.
+
+cat > foo.h << 'END'
+#ifndef FOO_H
+#define FOO_H
+
+#ifdef __cplusplus
+#include <iostream>
+extern "C" {
+#else
+#include <stdio.h>
+#endif
+
+void world_c (void);
+
+#ifdef __OBJC__
+@interface World_ObjC
+{ }
++ (void)display;
+@end
+#endif /* __OBJC__ */
+
+#ifdef __cplusplus
+}
+
+class World_CXX
+{
+  public:
+    World_CXX() { }
+    virtual ~World_CXX () { }
+    void world_cxx ();
+};
+
+#ifdef __OBJC__
+class World_OBJCXX
+{
+  public:
+    World_OBJCXX () { }
+    virtual ~World_OBJCXX () { }
+    void world_objcxx ();
+};
+
+@interface World_ObjCXX
+{ }
++ (void)display;
+@end
+#endif /* __OBJC__ */
+
+#endif /* __cplusplus */
+
+#endif /* FOO_H */
+END
+
+cat > foo.c << 'END'
+#include "foo.h"
+
+void world_c (void)
+{
+  printf (" world C]\n");
+}
+END
+
+cat > fooxx.cxx << 'END'
+#include "foo.h"
+
+void World_CXX::world_cxx ()
+{
+  std::cout << " world C++]" << "\n";
+}
+END
+
+cat > fooo.m << 'END'
+#import "foo.h"
+
+@implementation World_ObjC
++ (void)display
+{
+  printf (" world ObjC]\n");
+}
+@end
+END
+
+cat > foooxx.mm << 'END'
+#import "foo.h"
+
+// Calling: ObjC -> C++
+
+@implementation World_ObjCXX
++ (void)display
+{
+  World_OBJCXX *world = new World_OBJCXX;
+  world->world_objcxx ();
+}
+@end
+
+void World_OBJCXX::world_objcxx ()
+{
+  std::cout << " world ObjC++]" << "\n";
+}
+END
+
+## Configure and build.
+
+./configure
+$MAKE
+
+if cross_compiling; then :; else
+  unindent > exp << 'END'
+    [Hello C, world C]
+    [Hello C++, world C++]
+    [Hello ObjC, world ObjC]
+    [Hello ObjC++, world ObjC++]
+END
+  ./play > got || { cat got; Exit 1; }
+  cat exp
+  cat got
+  diff exp got
+fi
+
+$MAKE distcheck
+
+:
diff --git a/t/objc-minidemo.sh b/t/objc-minidemo.sh
new file mode 100755 (executable)
index 0000000..acd7e19
--- /dev/null
@@ -0,0 +1,76 @@
+#! /bin/sh
+# Copyright (C) 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Dummy demo package using Objective C and doing distcheck.
+# See also sister test 'objcxx-minidemo.sh'.
+
+required=native
+. ./defs || Exit 1
+
+cat >> configure.ac << 'END'
+AC_PROG_OBJC
+AC_CONFIG_HEADERS([config.h])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AM_DEFAULT_SOURCE_EXT = .m
+bin_PROGRAMS = ok
+noinst_PROGRAMS = ko
+TESTS = $(bin_PROGRAMS) $(XFAIL_TESTS)
+XFAIL_TESTS = $(noinst_PROGRAMS)
+END
+
+cat > ok.m << 'END'
+/* The use of #import makes this valid Object C but invalid C. */
+#import <stdio.h>
+#import <config.h>
+int main (void)
+{
+    printf ("Success (%s)\n", PACKAGE_STRING);
+    return 0;
+}
+END
+
+cat > ko.m << 'END'
+/* The use of #import makes this valid Object C but invalid C. */
+#import <stdio.h>
+int main (void)
+{
+    printf("Failure\n");
+    return 1;
+}
+END
+
+if $ACLOCAL; then
+  : We have a modern enough autoconf, go ahead.
+elif test $? -eq 63; then
+  skip_ "Object C++ support requires Autoconf 2.65 or later"
+else
+  Exit 1 # Some other aclocal failure.
+fi
+
+$ACLOCAL
+$AUTOCONF
+$AUTOHEADER
+$AUTOMAKE --add-missing
+
+./configure
+$MAKE
+$MAKE check
+$MAKE distcheck
+
+:
diff --git a/t/objc.sh b/t/objc.sh
deleted file mode 100755 (executable)
index f56c76d..0000000
--- a/t/objc.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2001-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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Test that '.m' extension works.
-# From Ralf Corsepius (for C++).
-
-. ./defs || Exit 1
-
-cat >> configure.ac << 'END'
-AC_PROG_OBJC
-END
-
-cat > Makefile.am << 'END'
-bin_PROGRAMS = hello
-hello_SOURCES = hello.m
-END
-
-$ACLOCAL
-$AUTOMAKE
-
-grep '^\.SUFFIXES:.*\.m' Makefile.in
-
-:
diff --git a/t/objcxx-basic.sh b/t/objcxx-basic.sh
new file mode 100755 (executable)
index 0000000..be2cdf7
--- /dev/null
@@ -0,0 +1,49 @@
+#! /bin/sh
+# Copyright (C) 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# Basic tests on the Objective C++ support that don't actually
+# require an Objective-C++ compiler.
+# See also sister test 'objc-basic.sh'.
+
+. ./defs || Exit 1
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = hello
+hello_SOURCES = hello.mm
+END
+
+$ACLOCAL
+AUTOMAKE_fails
+grep "'OBJCXX'.* undefined" stderr
+grep "add .*'AC_PROG_OBJCXX'" stderr
+
+rm -rf autom4te*.cache
+
+cat >> configure.ac <<'END'
+dnl Support for Object C++ was introduced only in Autoconf 2.65.
+AC_PREREQ([2.65])
+AC_PROG_OBJCXX
+END
+
+if $ACLOCAL; then
+  : We have a modern enough autoconf, go ahead.
+elif test $? -eq 63; then
+  skip_ "Object C++ support requires Autoconf 2.65 or later"
+else
+  Exit 1 # Some other aclocal failure.
+fi
+
+$AUTOMAKE
+$EGREP '^\.SUFFIXES:.* \.mm( |$)' Makefile.in
+
+:
diff --git a/t/objcxx-deps.sh b/t/objcxx-deps.sh
new file mode 100755 (executable)
index 0000000..782193a
--- /dev/null
@@ -0,0 +1,80 @@
+#! /bin/sh
+# Copyright (C) 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Automatic dependency tracking for Objective C++.
+# See also sister test 'objc-deps.sh'.
+
+. ./defs || Exit 1
+
+cat >> configure.ac << 'END'
+dnl Support for Object C++ was introduced only in Autoconf 2.65.
+AC_PREREQ([2.65])
+AC_PROG_OBJCXX
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+foo_SOURCES = bar.mm baz.h++ baz2.hh
+END
+
+cat > baz.h++ << 'END'
+#include <iostream>
+#include "baz2.hh"
+END
+
+cat > baz2.hh << 'END'
+#define MSG "Hello, World"
+END
+
+cat > bar.mm << 'END'
+/* The use of #import makes this valid Object C++ but invalid C++. */
+#import "baz.h++"
+int main (void)
+{
+    std::cout << MSG << "\n";
+    return 0;
+}
+END
+
+if $ACLOCAL; then
+  : We have a modern enough autoconf, go ahead.
+elif test $? -eq 63; then
+  skip_ "Object C++ support requires Autoconf 2.65 or later"
+else
+  Exit 1 # Some other aclocal failure.
+fi
+$AUTOCONF
+$AUTOMAKE --add-missing
+
+./configure --enable-dependency-tracking
+$MAKE
+cross_compiling || (./foo | $FGREP 'Hello, World') || Exit 1
+
+$sleep
+: > old
+echo '#define MSG "Howdy, Earth"' > baz2.hh
+$MAKE
+if test -f foo; then
+  is_newest foo old
+else
+  is_newest foo.exe old
+fi
+cross_compiling || (./foo | $FGREP 'Howdy, Earth') || Exit 1
+
+$MAKE distcheck
+
+:
diff --git a/t/objcxx-flags.sh b/t/objcxx-flags.sh
new file mode 100755 (executable)
index 0000000..aea7e19
--- /dev/null
@@ -0,0 +1,72 @@
+#! /bin/sh
+# Copyright (C) 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test Objective C++ compilation flags.
+# See also sister test 'objc-flags.sh'.
+
+. ./defs || Exit 1
+
+cat >> configure.ac << 'END'
+dnl Support for Object C++ was introduced only in Autoconf 2.65.
+AC_PREREQ([2.65])
+AC_PROG_OBJCXX
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AM_DEFAULT_SOURCE_EXT = .mm
+bin_PROGRAMS = foo2 foo4
+AM_OBJCXXFLAGS = -DVALUE=2 -DERROR=1
+foo4_OBJCXXFLAGS = -DVALUE=4 -DERROR=1
+END
+
+for i in 2 4; do
+  unindent > foo$i.mm << END
+    /* Let's make this file valid Objective C but invalid C. */
+    #import <stdlib.h>
+    @interface Who_Cares { } @end
+    #ifdef ERROR
+    #  error "macro ERROR is defined for foo.mm"
+    #else
+    #  if VALUE == $i
+         int main (void) { exit (0); }
+    #  else
+    #    error "VALUE is != $i in foo.mm"
+    #  endif
+    #endif
+END
+done
+
+if $ACLOCAL; then
+  : We have a modern enough autoconf, go ahead.
+elif test $? -eq 63; then
+  skip_ "Object C++ support requires Autoconf 2.65 or later"
+else
+  Exit 1 # Some other aclocal failure.
+fi
+
+$AUTOCONF
+$AUTOMAKE -a
+
+$FGREP OBJCXXFLAGS Makefile.in # For debugging.
+grep '\$(OBJCXXFLAGS).*\$(AM_OBJCXXFLAGS)'       Makefile.in && Exit 1
+grep '\$(OBJCXXFLAGS).*\$(foo.*_OBJCXXFLAGS)'    Makefile.in && Exit 1
+grep '\$(foo.*_OBJCXXFLAGS).*\$(AM_OBJCXXFLAGS)' Makefile.in && Exit 1
+
+./configure OBJCXXFLAGS=-UERROR
+$MAKE 
+
+:
diff --git a/t/objcxx-minidemo.sh b/t/objcxx-minidemo.sh
new file mode 100755 (executable)
index 0000000..74e152c
--- /dev/null
@@ -0,0 +1,76 @@
+#! /bin/sh
+# Copyright (C) 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Dummy demo package using Objective C++ and doing distcheck.
+# See also sister test 'objc-minidemo.sh'.
+
+required=native
+. ./defs || Exit 1
+
+cat >> configure.ac << 'END'
+dnl Support for Object C++ was introduced only in Autoconf 2.65.
+AC_PREREQ([2.65])
+AC_PROG_OBJCXX
+AC_CONFIG_HEADERS([config.h])
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+AM_DEFAULT_SOURCE_EXT = .mm
+bin_PROGRAMS = ok
+noinst_PROGRAMS = ko
+TESTS = $(bin_PROGRAMS) $(XFAIL_TESTS)
+XFAIL_TESTS = $(noinst_PROGRAMS)
+END
+
+cat > ok.mm << 'END'
+/* The use of #import makes this valid Object C++ but invalid C++. */
+#import <iostream>
+#import <config.h>
+int main (void)
+{
+    std::cout << "Success (" << PACKAGE_STRING << ")\n";
+    return 0;
+}
+END
+
+cat > ko.mm << 'END'
+/* The use of #import makes this valid Object C++ but invalid C++. */
+#import <cstdio>
+int main (void)
+{
+    printf("Failure\n");
+    return 1;
+}
+END
+
+if $ACLOCAL; then
+  : We have a modern enough autoconf, go ahead.
+elif test $? -eq 63; then
+  skip_ "Object C++ support requires Autoconf 2.65 or later"
+else
+  Exit 1 # Some other aclocal failure.
+fi
+$AUTOCONF
+$AUTOHEADER
+$AUTOMAKE --add-missing
+
+./configure
+$MAKE
+$MAKE check
+$MAKE distcheck
+
+:
index f06d093..98467e6 100755 (executable)
@@ -90,9 +90,8 @@ cd serial
 $MAKE ${j}1 check &
 cd ../parallel
 $sleep
-# Use append mode here to avoid dropping output.
-# Yes, this actually happens.
-: >stdout
+# Use append mode here to avoid dropping output.  See automake bug#11413.
+: > stdout
 $MAKE ${j}4 check >> stdout
 cd ..
 # Ensure the tests are really being run in parallel mode: if this is
index ffe4a81..9aa7bc5 100755 (executable)
--- a/t/pr2.sh
+++ b/t/pr2.sh
 
 . ./defs || Exit 1
 
-# Please keep this underquoted and old-style.
-cat > configure.ac << 'END'
-AC_INIT
-AM_INIT_AUTOMAKE(nonesuch, nonesuch)
-AC_OUTPUT(README.foo:templ/README.foo.in Makefile)
+cat >> configure.ac << 'END'
+AC_OUTPUT([README.foo:templ/README.foo.in])
 END
 
 : > Makefile.am
@@ -46,6 +43,6 @@ $AUTOCONF
 $AUTOMAKE
 ./configure
 $MAKE distdir
-test -f nonesuch-nonesuch/templ/README.foo.in
+test -f $distdir/templ/README.foo.in
 
 :
index d98b661..121328d 100755 (executable)
--- a/t/pr87.sh
+++ b/t/pr87.sh
@@ -37,12 +37,16 @@ EOF
 done
 
 echo "SUBDIRS = $subdirs" > Makefile.am
-cat >configure.ac <<EOF
-AC_INIT(`echo $subdirs | sed 's|\([a-z][a-z]*\).*|\1/\1.c|'`)
-AC_CONFIG_AUX_DIR(.)
-AM_INIT_AUTOMAKE($me, 1.0)
+
+cat > configure.ac <<EOF
+AC_INIT([$me], [1.0])
+AC_CONFIG_SRCDIR([foo/foo.c])
+AC_CONFIG_AUX_DIR([.])
+AM_INIT_AUTOMAKE
 AC_PROG_CC
-AC_OUTPUT(Makefile `echo $subdirs | sed 's|\([a-z][a-z]*\)|\1/Makefile|g'`)
+AC_CONFIG_FILES([Makefile])
+AC_CONFIG_FILES([`echo $subdirs | sed 's|\([a-z][a-z]*\)|\1/Makefile|g'`])
+AC_OUTPUT
 EOF
 
 mkdir build
diff --git a/t/rst-formatting.sh b/t/rst-formatting.sh
deleted file mode 100755 (executable)
index f23c28c..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-#! /bin/sh
-# Copyright (C) 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
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Parallel testsuite harness: check APIs for the registering the
-# "global test result" in '*.trs' files, as documented in the automake
-# manual.
-
-am_create_testdir=empty
-. ./defs || Exit 1
-
-sed -n '/^am__rst_[a-z_][a-z_]* =/p' "$am_amdir"/check.am > Makefile \
-  || framework_failure_ "fetching definitions from check.am"
-
-cat >> Makefile << 'END'
-test:
-       printf '%s\n' "$$in" | $(am__rst_title) > title-got
-       printf '%s\n' "$$in" | $(am__rst_section) > section-got
-       cat title-exp
-       cat title-got
-       diff title-exp title-got
-       cat section-exp
-       cat section-got
-       diff section-exp section-got
-END
-
-# -------------------------------------------------------------------------
-
-cat > title-exp <<'END'
-==============
-   ab cd ef
-==============
-
-END
-
-cat > section-exp <<'END'
-ab cd ef
-========
-
-END
-
-env in='ab cd ef' $MAKE test
-
-# -------------------------------------------------------------------------
-
-cat > title-exp <<'END'
-============================================================================
-   0123456789012345678901234567890123456789012345678901234567890123456789
-============================================================================
-
-END
-
-cat > section-exp <<'END'
-0123456789012345678901234567890123456789012345678901234567890123456789
-======================================================================
-
-END
-
-in=0123456789012345678901234567890123456789012345678901234567890123456789
-env in=$in $MAKE test
-
-# -------------------------------------------------------------------------
-
-cat > title-exp <<'END'
-=======
-   x
-=======
-
-END
-
-cat > section-exp <<'END'
-x
-=
-
-END
-
-env in=x $MAKE test
-
-# -------------------------------------------------------------------------
-
-:
index f9944cb..600aedf 100755 (executable)
@@ -32,6 +32,8 @@ END
 
 for use_arlib in false :; do
 
+  rm -rf autom4te*.cache
+
   if $use_arlib; then
     am_warns=
     echo AM_PROG_AR >> configure.ac
@@ -40,7 +42,7 @@ for use_arlib in false :; do
     am_warns=-Wno-extra-portability
   fi
 
-  $ACLOCAL --force
+  $ACLOCAL
 
   $AUTOMAKE $am_warns -i
   grep '^ *\.c' Makefile.in # For debugging.
index 6f5d5fe..d275bd9 100755 (executable)
@@ -118,7 +118,12 @@ for try in 0 1; do
 
   # Success.
 
-  $run_make check >stdout || { cat stdout; Exit 1; }
+  # Use append mode here to avoid dropping output.  See automake bug#11413.
+  # Also, use 'echo' here to "nullify" the previous contents of 'stdout',
+  # since Solaris 10 /bin/sh would try to optimize a ':' away after the
+  # first iteration, even if it is redirected.
+  echo " " >stdout
+  $run_make check >>stdout || { cat stdout; Exit 1; }
   cat stdout
   count_test_results total=6 pass=4 fail=0 xpass=0 xfail=1 skip=1 error=0
   grep '^PASS: 1\.test 1 - mu$' stdout
@@ -138,7 +143,12 @@ for try in 0 1; do
   # a ':' away after the first iteration, even if it is redirected.
   echo dummy > not-skip
   echo dummy > bail-out
-  $run_make check >stdout && { cat stdout; Exit 1; }
+  # Use append mode here to avoid dropping output.  See automake bug#11413.
+  # Also, use 'echo' here to "nullify" the previous contents of 'stdout',
+  # since Solaris 10 /bin/sh would try to optimize a ':' away after the
+  # first iteration, even if it is redirected.
+  echo " " >stdout
+  $run_make check >>stdout && { cat stdout; Exit 1; }
   cat stdout
   count_test_results total=7 pass=4 fail=1 xpass=0 xfail=1 skip=0 error=1
   grep '^PASS: 1\.test 1 - mu$' stdout
index ab1cd40..cf5c945 100755 (executable)
@@ -49,7 +49,7 @@ for sig in $all_signals; do
   # to themselves consistently).  The shebang is dummy here, as we prefer
   # to rely on the definition of TEST_LOG_COMPILER instead.
   unindent > signal-$sig.test <<END
-    #! perl
+    #! /usr/bin/env perl
     # We need autoflush to avoid losing output, which could cause spurious
     # "no test plan seen" in the TAP driver.
     BEGIN { $| = 1 }
@@ -95,7 +95,8 @@ signal_caught ()
   wbound_re="($|[^a-zA-Z0-9_-])"
   pfx_re="^ERROR: signal-$numeric\\.test"
   case $am_tap_implementation in
-    perl) rx="$pfx_re - terminated by signal $sig_re$";;
+    # Dummy escape to please maintainer-check.
+    per\l) rx="$pfx_re - terminated by signal $sig_re$";;
     shell) rx="$pfx_re .*terminated by signal $sig_re$wbound_re";;
     *) fatal_ "invalid \$am_tap_implementation '$am_tap_implementation'";;
   esac
index 9726870..a154ce7 100755 (executable)
@@ -80,16 +80,6 @@ test -r bar.trs
 grep '^PASS: foo\.test' stdout
 grep '^PASS: bar\.test' stdout
 
-: More complex interactions with "make recheck" are OK.
-chmod a-r bar.log bar.trs
-$MAKE recheck >stdout || { cat stdout; Exit 1; }
-cat stdout
-test -f bar.trs
-test -r bar.trs
-grep '^PASS: bar\.test' stdout
-grep 'foo\.test' stdout && Exit 1
-count_test_results total=1 pass=1 fail=0 xpass=0 xfail=0 skip=0 error=0
-
 : Recreate by remaking the global test log.
 chmod a-r foo.trs
 rm -f test-suite.log
diff --git a/t/testsuite-recheck-speed.sh b/t/testsuite-recheck-speed.sh
new file mode 100755 (executable)
index 0000000..9b37262
--- /dev/null
@@ -0,0 +1,99 @@
+#! /bin/sh
+# Copyright (C) 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check performance of recheck target in the face of many failed tests.
+# FIXME: this test is not currently able to detect whether the measured
+# FIXME: performance is too low, and FAIL accordingly; it just offers an
+# FIXME: easy way to verify how effective a performance optimization is.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+count=5000
+
+cat >> configure.ac <<'END'
+AC_OUTPUT
+END
+
+cat > Makefile.am <<END
+count_expected = $count
+TEST_EXTENSIONS = .t
+## Updated later.
+TESTS =
+END
+
+# This should ensure that our timing won't be disturbed by the time
+# that would be actually required to run any of:
+#  - the test cases
+#  - the test driver executing them
+#  - the recipe to create the final test-suite log.
+cat >> Makefile.am << 'END'
+AUTOMAKE_OPTIONS = -Wno-override
+## These should never be run.
+T_LOG_COMPILER = false
+T_LOG_DRIVER = false
+
+# The recipe of this also serves as a sanity check.
+$(TEST_SUITE_LOG):
+## For debugging.
+       @echo "RE-RUN:"; for i in $(TEST_LOGS); do echo "  $$i"; done
+## All the test cases should have been re-run.
+       @count_got=`for i in $(TEST_LOGS); do echo $$i; done | wc -l` \
+         && echo "Count expected: $(count_expected)" \
+         && echo "Count obtained: $$count_got" \
+         && test $$count_got -eq $(count_expected)
+## Pre-existing log files of the tests to re-run should have been
+## removed by the 'recheck' target
+       @for i in $(TEST_LOGS); do \
+         test ! -f $$i.log || { echo "$$i.log exists!"; exit 1; }; \
+       done
+## Actually create the target file, for extra safety.
+       @echo dummy > $@
+END
+
+# Updated later.
+: > all
+
+# Temporarily disable shell traces, to avoid bloating the log file.
+set +x
+
+for i in `seq_ 1 $count`; do
+  echo dummy $i > $i.log
+  echo :global-test-result: PASS > $i.trs
+  echo :test-result: PASS >> $i.trs
+  echo :recheck: yes >> $i.trs
+  echo TESTS += $i.t >> Makefile.am
+  echo $i >> all
+done
+
+# Re-enable shell traces.
+set -x
+
+# So that we don't need to create a ton of dummy tests.
+echo '$(TESTS):' >> Makefile.am
+
+head -n 100 Makefile.am || : # For debugging.
+tail -n 100 Makefile.am || : # Likewise.
+cat $count.trs               # Likewise, just the last specimen though.
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+$MAKE recheck
+
+:
index 58157ad..ff38097 100755 (executable)
@@ -56,9 +56,7 @@ $PERL -w -e '
   use warnings FATAL => "all";
   use strict;
 
-  # FIXME: we would like this to be 1000 or even 10000, but the current
-  # implementation is too slow to handle that :-(
-  my $base = 5;
+  my $base = 1000;
   my %count = (
     TOTAL => $base * 1000,
     PASS  => $base * 700,
diff --git a/t/testsuite-summary-speed.sh b/t/testsuite-summary-speed.sh
new file mode 100755 (executable)
index 0000000..4d18c61
--- /dev/null
@@ -0,0 +1,76 @@
+#! /bin/sh
+# Copyright (C) 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
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Check performanceof recipe generating test-suite.log file and testsuite
+# summary.  That has suffered of huge inefficiencies in the past.
+# FIXME: this test is not currently able to detect whether the measured
+# FIXME: performance is too low, and FAIL accordingly; it just offers
+# FIXME: an easy way verify how effective a performance optimization is.
+
+am_parallel_tests=yes
+. ./defs || Exit 1
+
+count=10000
+
+echo AC_OUTPUT >> configure.ac
+
+cat > Makefile.am <<'END'
+TEST_EXTENSIONS = .t
+## Will be updated later.
+TESTS =
+## None of these should ever be run.
+T_LOG_COMPILER = false
+T_LOG_DRIVER = false
+END
+
+# Temporarily disable shell traces, to avoid bloating the log file.
+set +x
+
+for i in `seq_ 1 $count`; do
+  echo false > $i.t
+  echo dummy $i > $i.log
+  echo :global-test-result: PASS > $i.trs
+  echo :test-result: PASS >> $i.trs
+  echo :copy-in-global-log: yes >> $i.trs
+  echo TESTS += $i.t
+done >> Makefile.am 
+
+# Re-enable shell traces.
+set -x
+
+head -n 100 Makefile.am || : # For debugging.
+tail -n 100 Makefile.am || : # Likewise.
+cat $count.trs               # Likewise, just the last specimen though.
+
+# So that we don't need to create a ton of dummy tests.
+#echo '$(TESTS):' >> Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -a
+
+./configure
+
+$MAKE test-suite.log >stdout || { cat stdout; Exit 1; }
+cat stdout
+
+# Sanity checks.
+grep "^# TOTAL: $count$" stdout
+grep "^dummy $count$" test-suite.log
+specimen=347 # Could be any number <= $count.
+grep "^dummy $specimen$" test-suite.log
+
+:
index 9e42823..d515617 100755 (executable)
@@ -33,6 +33,6 @@ END
 echo '@setfilename ian.info' > ian.texi
 
 $ACLOCAL
-$AUTOMAKE --cygnus
+$AUTOMAKE --cygnus -Wno-obsolete
 
 :
index c4eac53..a99f607 100755 (executable)
@@ -25,9 +25,10 @@ AM_MAINTAINER_MODE
 END
 
 cat > Makefile.am << 'END'
-# Disable 'override' warning to work around an unrelated
+# Disable 'override' warnings to work around an unrelated
 # texi+cygnus bug.
-AUTOMAKE_OPTIONS = -Wno-override
+# Disable obsolete warnings because the 'cygnus' mode is now deprecated.
+AUTOMAKE_OPTIONS = -Wno-override -Wno-obsolete
 info_TEXINFOS = ian.texi
 END
 
index 98664e2..431eb0d 100755 (executable)
@@ -38,4 +38,4 @@ END
 : > THANKS
 
 $ACLOCAL
-$AUTOMAKE --gnits
+$AUTOMAKE --gnits -Wno-obsolete
index 71749f6..273bd36 100755 (executable)
@@ -38,4 +38,4 @@ END
 : > THANKS
 
 $ACLOCAL
-$AUTOMAKE --gnits
+$AUTOMAKE --gnits -Wno-obsolete