automake-commit
[Top][All Lists]
Advanced

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

[Automake-commit] [SCM] GNU Automake branch, ng/master, updated. v1.12.1


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, ng/master, updated. v1.12.1-320-gfd417d2
Date: Fri, 08 Jun 2012 15:39:24 +0000

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

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

The branch, ng/master has been updated
       via  fd417d2be3b26eb6cd99e828bb4bff0b8572087a (commit)
       via  c97d41b6cf5805d18c8541e290344182267be3f8 (commit)
       via  df3b0944630a84a79c11654664ac666f1750302e (commit)
       via  14fe163aa44992641c0730b0c399aa7d6845e775 (commit)
       via  63aa4a9f788b17558b9700729acc75c5ab11b435 (commit)
      from  9a1218de5ff036965a95e06c91acd03cf1b3e3bb (commit)

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

- Log -----------------------------------------------------------------
commit fd417d2be3b26eb6cd99e828bb4bff0b8572087a
Merge: 9a1218d c97d41b
Author: Stefano Lattarini <address@hidden>
Date:   Fri Jun 8 12:36:21 2012 +0200

    Merge branch 'ng/subdir-objects' into ng/master
    
    * ng/subdir-objects:
      [ng] cleanup: after enabling of subdir-objects unconditionally
      [ng] tests: remove explicit usages of the 'subdir-objects' option
      [ng] subdir-objects: enable unconditionally
      [ng] automake: don't define many identical 'lang_*_rewrite' subroutines

commit c97d41b6cf5805d18c8541e290344182267be3f8
Author: Stefano Lattarini <address@hidden>
Date:   Thu Jun 7 17:04:26 2012 +0200

    [ng] cleanup: after enabling of subdir-objects unconditionally
    
    Few minor cleanups made possible by earlier changes, plus other minor
    cleanups triggered in cascade.  No semantic change is intended.
    
    * automake.in (LANG_IGNORE, LANG_SUBDIR): Remove.
    (register_language ('name' => 'vala', ...)): Add '.vapi' to the entry
    'extensions', and simplify the entry 'output_extensions' to point to a
    dummy subroutine (since it wasn't really used anyway).
    (handle_single_transform): Don't expect the 'lang_*_rewrite' subroutines
    to return a 'LANG_*' constant anymore, but only a transformed extension,
    if required.  To decide whether further processing of the source file
    should be stopped, rely on a new set of 'lang_*_ignore' subroutines,
    defaulting to a subroutine that returns false.  Accordingly, don't special
    case the handling of '.vapi' files anymore, instead relying on ...
    (lang_vala_ignore, lang_header_ignore): ... these new subroutines to avoid
    extra processing of C/C++ headers and Vala '.vapi' headers.
    (lang_c_rewrite): Adjust to explicitly return an undefined value.
    (lang_java_rewrite): Remove.
    Remove an outdated comment.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit df3b0944630a84a79c11654664ac666f1750302e
Author: Stefano Lattarini <address@hidden>
Date:   Thu Jun 7 10:38:29 2012 +0200

    [ng] tests: remove explicit usages of the 'subdir-objects' option
    
    It is enabled unconditionally since the previous change.
    
    * Several tests: Adjust, extend, rework and simplify, as needed.
    * t/ax/depcomp-shuffle.sh, t/ax/depcomp.sh: Likewise.
    * t/subobj2.sh: Rename ...
    * t/subobj-cxx-grep.sh: ... to this, and adjust.
    * t/subobj.sh: Rename ...
    * t/subobj-c.sh: ... to this, and adjust.
    * t/subobj-cxx.sh: New test.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit 14fe163aa44992641c0730b0c399aa7d6845e775
Author: Stefano Lattarini <address@hidden>
Date:   Wed Jun 6 10:27:46 2012 +0200

    [ng] subdir-objects: enable unconditionally
    
    The fact that Automake-generated Makefiles places compiled
    object files in the current directory by default, also when the
    corresponding source file is in a subdirectory, is basically an
    historical accident, due to the fact that the 'subdir-objects'
    option had only been introduced in April 1999, starting with
    commit 'user-dep-gen-branchpoint-56-g88b5959', and never made
    the default, likely to avoid backwards-compatibility issues.
    
    Since we believe the behaviour enabled by the 'subdir-objects'
    is the only natural and most useful one, we make it the only
    only one available, simplifying the Automake implementation and
    APIs a little in the process.
    
    * NG-NEWS: Update.
    * doc/automake-ng.texi (Program and Library Variables): The output
    object files are not anymore placed in the current directory by
    default, but rather in the same directory of the source file.
    (LIBOBJS): Now the $(LIBOBJS) and $(ALLOCA) variables can also be
    be used outside of the directory where their sources lie.
    (List of Automake options): Don't document the 'subdir-objects'
    option anymore.
    Other related minor adjustments.
    * automake.in (LANG_PROCESS): Remove, it's not needed anymore.
    (handle_languages): Don't test whether option 'subdir-objects'
    is set (just assume it is), and do not use the '%SUBDIROBJ%'
    transform when processing '.am' fragments.
    (lang_sub_obj): Delete, it would just return 'LANG_SUBDIR'
    unconditionally now.
    (lang_c_rewrite): Adjust.  Don't test whether the option
    'subdir-objects' is set (just assume it is).
    (lang_yacc_rewrite): Likewise.
    (lang_lex_rewrite): Likewise.
    (handle_single_transform): Likewise.  Remove an obsolete
    comment.  Add a proper "FIXME" comments about a fragment
    of code that might have become dead code now.
    (handle_LIBOBJS_or_ALLOCA): Simplify assuming that the option
    'subdir-objects' is always set.  Accordingly, there's no need
    to warn anymore if '$(LIBOBJS)' or '$(ALLOCA)' are used outside
    the '$config_libobj_dir' directory (as specified by autoconf
    macro 'AC_CONFIG_LIBOBJ_DIR').
    * lib/am/depend2.am: Assume the '?SUBDIROBJ?' Automake time
    conditional is always true, and remove its use accordingly.
    lib/am/depend2.am
    * t/ax/depcomp.sh: Adjust to the fact that 'subdir-objects' is
    always in effect.
    * t/ccnoco2.sh: Likewise.
    * t/cscope.tap: Likewise.
    * t/depcomp8a.sh: Likewise.
    * t/depcomp8b.sh: Likewise.
    * t/libtool3.sh: Likewise.
    * t/pr401.sh: Likewise.
    * t/pr401b.sh: Likewise.
    * t/pr401c.sh: Likewise.
    * t/lex-line.sh: Likewise.
    * t/yacc-line.sh: Likewise.
    * t/yacc5.sh: Likewise.
    * t/parallel-tests-suffix-prog.sh: Likewise.
    * t/fort4.sh: Likewise, and extend a bit.
    * t/fort5.sh: Likewise.
    * t/gcj.sh: Likewise.
    * t/subpkg.sh: Likewise.
    * t/subpkg-yacc.sh: Likewise.
    * t/xsource.sh: Likewise.
    * t/libobj20a.sh: Remove as obsolete.
    * t/libobj20b.sh: Adjust heading comments.
    * t/libobj20c.sh: Likewise.
    * t/subdir3.sh: Remove as obsolete.
    * t/subobj4.sh: Likewise.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

commit 63aa4a9f788b17558b9700729acc75c5ab11b435
Author: Stefano Lattarini <address@hidden>
Date:   Wed Jun 6 09:52:22 2012 +0200

    [ng] automake: don't define many identical 'lang_*_rewrite' subroutines
    
    This is just a refactoring prompted by future planned changes.
    
    Signed-off-by: Stefano Lattarini <address@hidden>

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

Summary of changes:
 NG-NEWS                                 |   12 ++
 automake.in                             |  298 ++++++++----------------------
 doc/automake-ng.texi                    |   37 +---
 lib/am/depend2.am                       |    3 +-
 lib/am/lex.am                           |    2 +-
 lib/am/yacc.am                          |    2 +-
 t/amopts-variable-expansion.sh          |   11 +-
 t/ax/depcomp-shuffle.sh                 |    5 +-
 t/ax/depcomp.sh                         |    7 +-
 t/ccnoco2.sh                            |   35 ++--
 t/ccnoco3.sh                            |    1 -
 t/check8.sh                             |    1 -
 t/cscope.tap                            |    2 +
 t/depcomp-recover.sh                    |    1 -
 t/depcomp-shuffle-sub-vpath.sh          |    2 +-
 t/depcomp-shuffle-sub.sh                |    2 +-
 t/depcomp-shuffle-vpath.sh              |    2 +-
 t/depcomp-shuffle.sh                    |    2 +-
 t/depcomp8a.sh                          |   22 +---
 t/depcomp8b.sh                          |   22 +---
 t/fort4.sh                              |   41 +++--
 t/fort5.sh                              |   17 +-
 t/gcj.sh                                |   37 ++++-
 t/instdir-ltlib.sh                      |    1 -
 t/instdir-prog.sh                       |    1 -
 t/lex-line.sh                           |   28 +---
 t/lex-subobj-nodep.sh                   |    5 +-
 t/lex5.sh                               |    9 +-
 t/libobj19.sh                           |    1 -
 t/libobj20a.sh                          |   45 -----
 t/libobj20b.sh                          |    3 +-
 t/libobj20c.sh                          |    3 +-
 t/libtool3.sh                           |    9 +-
 t/libtool7.sh                           |    1 -
 t/parallel-am2.sh                       |    2 -
 t/parallel-tests-suffix-prog.sh         |    1 +
 t/pr224.sh                              |    1 -
 t/pr401.sh                              |   15 --
 t/pr401b.sh                             |   13 --
 t/pr401c.sh                             |   14 --
 t/repeated-options.sh                   |   48 +-----
 t/silent-lex.sh                         |   26 +---
 t/silent-many-gcc.sh                    |   74 +++-----
 t/silent-many-generic.sh                |   74 +++-----
 t/silent-yacc.sh                        |   37 +---
 t/silent.sh                             |   39 ++---
 t/silent2.sh                            |   41 ++---
 t/silent3.sh                            |   38 ++---
 t/silent4.sh                            |   38 ++---
 t/silent9.sh                            |   40 ++---
 t/silentcxx-gcc.sh                      |   37 ++--
 t/silentcxx.sh                          |   38 ++---
 t/silentf77.sh                          |   28 ++--
 t/silentf90.sh                          |   28 ++--
 t/specflg-dummy.sh                      |    8 +-
 t/subdir3.sh                            |   36 ----
 t/{subobj.sh => subobj-c.sh}            |    5 +-
 t/{subobj2.sh => subobj-cxx-grep.sh}    |   11 +-
 t/{subobj.sh => subobj-cxx.sh}          |   42 +++--
 t/subobj-libtool.sh                     |    1 -
 t/subobj10.sh                           |   22 ++-
 t/subobj11a.sh                          |    1 -
 t/subobj4.sh                            |   53 ------
 t/subobj5.sh                            |    1 -
 t/subobj8.sh                            |    4 +-
 t/subobj9.sh                            |    6 +-
 t/subpkg-yacc.sh                        |   15 ++-
 t/subpkg.sh                             |   10 +-
 t/suffix-custom-subobj.sh               |    1 -
 t/suffix13.sh                           |   12 +--
 t/vala3.sh                              |   39 +---
 t/warning-groups-win-over-strictness.sh |    5 +-
 t/warnings-override.sh                  |    8 +-
 t/warnings-precedence.sh                |    8 +-
 t/warnings-strictness-interactions.sh   |   10 +-
 t/warnings-win-over-strictness.sh       |    9 +-
 t/xsource.sh                            |   18 ++-
 t/yacc-d-cxx.sh                         |    1 -
 t/yacc-dist-nobuild-subdir.sh           |    4 +-
 t/yacc-line.sh                          |   37 ++---
 t/yacc-subobj-nodep.sh                  |    4 +-
 t/yacc5.sh                              |   28 +---
 t/yacc8.sh                              |    1 -
 83 files changed, 532 insertions(+), 1170 deletions(-)
 delete mode 100755 t/libobj20a.sh
 delete mode 100755 t/subdir3.sh
 copy t/{subobj.sh => subobj-c.sh} (95%)
 rename t/{subobj2.sh => subobj-cxx-grep.sh} (78%)
 rename t/{subobj.sh => subobj-cxx.sh} (77%)
 delete mode 100755 t/subobj4.sh

diff --git a/NG-NEWS b/NG-NEWS
index 8b2ad53..4d5431d 100644
--- a/NG-NEWS
+++ b/NG-NEWS
@@ -83,6 +83,18 @@ Warnings and diagnostic
         AM_VARTYPOS_WHITELIST = copy_LDADD
 
 
+Compilation and Object Files
+=============================
+
+* If a source file is placed in a subdirectory, the corresponding compiled
+  object will always be put into the subdirectory named after the source
+  file, rather than in the current directory.  For instance, 'src/file.c'
+  and 'src/file.f90' will be compiled to 'src/file.o', and 'sub/dir/mu.cc'
+  will be compiled to 'sub/dir/mu.o'.
+  That is, Automake-NG will unconditionally behave as Automake would do if
+  its 'subdir-objects' option were active.
+
+
 Serial testsuite harness (obsolescent)
 ======================================
 
diff --git a/automake.in b/automake.in
index 176e882..21a02a6 100644
--- a/automake.in
+++ b/automake.in
@@ -281,14 +281,6 @@ my $gen_copyright = "\
 # PARTICULAR PURPOSE.
 ";
 
-# These constants are returned by the lang_*_rewrite functions.
-# LANG_SUBDIR means that the resulting object file should be in a
-# subdir if the source file is.  In this case the file name cannot
-# have '..' components.
-use constant LANG_IGNORE  => 0;
-use constant LANG_PROCESS => 1;
-use constant LANG_SUBDIR  => 2;
-
 # These are used when keeping track of whether an object can be built
 # by two different paths.
 use constant COMPILE_LIBTOOL  => 1;
@@ -802,7 +794,7 @@ register_language ('name' => 'header',
                   # Nothing to do.
                   '_finish' => sub { });
 
-# Vala
+# Vala.
 register_language ('name' => 'vala',
                   'Name' => 'Vala',
                   'config_vars' => ['VALAC'],
@@ -810,9 +802,10 @@ register_language ('name' => 'vala',
                   'compile' => '$(VALAC) $(AM_VALAFLAGS) $(VALAFLAGS)',
                   'ccer' => 'VALAC',
                   'compiler' => 'VALACOMPILE',
-                  'extensions' => ['.vala'],
-                  'output_extensions' => sub { (my $ext = $_[0]) =~ s/vala$/c/;
-                                               return ($ext,) },
+                  'extensions' => ['.vala', '.vapi'],
+                   # Vala compilation must be handled in a special way, so
+                   # nothing to do or return here.
+                  'output_extensions' => sub { },
                   'rule_file' => 'vala',
                   '_finish' => \&lang_vala_finish,
                   '_target_hook' => \&lang_vala_target_hook,
@@ -1360,7 +1353,6 @@ sub handle_languages
                         '-c'      => $lang->compile_flag || '',
                         # These are not used, but they need to be defined
                         # so &transform do not complain.
-                        SUBDIROBJ     => 0,
                         'DERIVED-EXT' => 'BUG',
                         DIST_SOURCE   => 1,
                         VERBOSE   => $verbose,
@@ -1375,9 +1367,7 @@ sub handle_languages
            # needed.
            my $output_flag = $lang->output_flag || '';
            $output_flag = '-o'
-             if (! $output_flag
-                 && $lang->name eq 'c'
-                 && option 'subdir-objects');
+             if (! $output_flag && $lang->name eq 'c');
 
            # Compute a possible derived extension.
            # This is not used by depend2.am.
@@ -1400,8 +1390,7 @@ sub handle_languages
 
                             COMPILE   => '$(' . $lang->compiler . ')',
                             LTCOMPILE => '$(LT' . $lang->compiler . ')',
-                            -o        => $output_flag,
-                            SUBDIROBJ => !! option 'subdir-objects');
+                            -o        => $output_flag);
        }
 
        # Now include code for each specially handled object with this
@@ -1627,10 +1616,6 @@ sub handle_single_transform ($$$$$%)
          next;
        }
 
-       # If the source file is in a subdirectory then the '.o' is put
-       # into the current directory, unless the subdir-objects option
-       # is in effect.
-
        # Split file name into base and extension.
        next if ! /^(?:(.*)\/)?([^\/]*?)(\.[^.]+)$/;
         prog_error ("source file '$_' missing dotted extension")
@@ -1675,19 +1660,24 @@ sub handle_single_transform ($$$$$%)
                  }
              }
 
-           # Note: computed subr call.  The language rewrite function
-           # should return one of the LANG_* constants.  It could
-           # also return a list whose first value is such a constant
-           # and whose second value is a new source extension which
-           # should be applied.  This means this particular language
-           # generates another source file which we must then process
-           # further.
-           my $subr = \&{'lang_' . $lang->name . '_rewrite'};
-           my ($r, $source_extension)
-               = &$subr ($directory, $base, $extension,
-                         $obj, $have_per_exec_flags, $var);
-           # Skip this entry if we were asked not to process it.
-           next if $r == LANG_IGNORE;
+            # NOTE: computed subr calls here.
+
+            # The language ignore function can ask not to preprocess
+            # a source file further.
+            my $subr_ignore = \&{'lang_' . $lang->name . '_ignore'};
+            next if defined &$subr_ignore
+                    and &$subr_ignore ($directory, $base, $extension);
+            # The language rewrite function can return a new source
+            # extension which should be applied.  This means this
+            # particular language generates another source file which
+            # we must then process further.  This happens, for example,
+            # with yacc and lex.
+            my $subr_rewrite = \&{'lang_' . $lang->name . '_rewrite'};
+            $subr_rewrite = sub { } unless defined &$subr_rewrite;
+            my $source_extension = &$subr_rewrite ($directory, $base,
+                                                   $extension, $obj,
+                                                   $have_per_exec_flags,
+                                                   $var);
 
            # Now extract linker and other info.
            $linker = $lang->linker;
@@ -1737,24 +1727,17 @@ sub handle_single_transform ($$$$$%)
 
            # If rewrite said it was ok, put the object into a
            # subdir.
-           if ($r == LANG_SUBDIR && $directory ne '')
-           {
-               $object = $directory . '/' . $object;
-           }
+           $object = $directory . '/' . $object
+             unless $directory eq '';
 
            # If the object file has been renamed (because per-target
            # flags are used) we cannot compile the file with an
            # inference rule: we need an explicit rule.
            #
-           # If the source is in a subdirectory and the object is in
-           # the current directory, we also need an explicit rule.
-           #
            # If both source and object files are in a subdirectory
-           # (this happens when the subdir-objects option is used),
            # then the inference will work.
            #
            if ($renamed
-               || ($directory ne '' && ! option 'subdir-objects')
                # We must also use specific rules for a nodist_ source
                # if its language requests it.
                || ($lang->nodist_specific && ! $transform{'DIST_SOURCE'}))
@@ -1802,12 +1785,6 @@ sub handle_single_transform ($$$$$%)
                      address@hidden, %transform]);
            }
        }
-        elsif ($extension eq '.vapi')
-        {
-            # Explicitly pass vala headers through.  This is a bit of an
-            # hack, but good enough FTM.
-            next;
-        }
        else
        {
             # Assume the user has defined a proper explicit or pattern
@@ -1823,6 +1800,8 @@ sub handle_single_transform ($$$$$%)
            $linker = '';
        }
 
+        # FIXME: this is likely an internal error now that we use
+        # FIXME: subdir-objects unconditionally ...
        err_am "object '$object' created by '$full' and '$object_map{$object}'"
          if (defined $object_map{$object}
              && $object_map{$object} ne $full);
@@ -2153,25 +2132,17 @@ sub handle_LIBOBJS_or_ALLOCA ($)
   if ($config_libobj_dir
       && $relative_dir ne $config_libobj_dir)
     {
-      if (option 'subdir-objects')
-       {
-         # In the top-level Makefile we do not use $(top_builddir), because
-         # we are already there, and since the targets are built without
-         # a $(top_builddir), it helps BSD Make to match them with
-         # dependencies.
-         $dir = "$config_libobj_dir/" if $config_libobj_dir ne '.';
-         $dir = "$topsrcdir/$dir" if $relative_dir ne '.';
-         define_variable ('LIBOBJDIR', INTERNAL, $dir);
-         $clean_files{"\$($var)"} = MOSTLY_CLEAN;
-         # If LTLIBOBJS is used, we must also clear LIBOBJS (which might
-         # be created by libtool as a side-effect of creating LTLIBOBJS).
-         $clean_files{"\$($var)"} = MOSTLY_CLEAN if $var =~ s/^LT//;
-       }
-      else
-       {
-         error ("'\$($var)' cannot be used outside '$config_libobj_dir' if"
-                . " 'subdir-objects' is not set");
-       }
+      # In the top-level Makefile we do not use $(top_builddir), because
+      # we are already there, and since the targets are built without
+      # a $(top_builddir), it helps BSD Make to match them with
+      # dependencies.
+      $dir = "$config_libobj_dir/" if $config_libobj_dir ne '.';
+      $dir = "$topsrcdir/$dir" if $relative_dir ne '.';
+      define_variable ('LIBOBJDIR', INTERNAL, $dir);
+      $clean_files{"\$($var)"} = MOSTLY_CLEAN;
+      # If LTLIBOBJS is used, we must also clear LIBOBJS (which might
+      # be created by libtool as a side-effect of creating LTLIBOBJS).
+      $clean_files{"\$($var)"} = MOSTLY_CLEAN if $var =~ s/^LT//;
     }
 
   return $dir;
@@ -5087,190 +5058,81 @@ sub check_gnits_standards
 #
 # Functions to handle files of each language.
 
-# Each 'lang_X_rewrite($DIRECTORY, $BASE, $EXT)' function follows a
-# simple formula: Return value is LANG_SUBDIR if the resulting object
-# file should be in a subdir if the source file is, LANG_PROCESS if
-# file is to be dealt with, LANG_IGNORE otherwise.
-
 # Much of the actual processing is handled in
 # handle_single_transform.  These functions exist so that
 # auxiliary information can be recorded for a later cleanup pass.
 # Note that the calls to these functions are computed, so don't bother
 # searching for their precise names in the source.
 
-# This is just a convenience function that can be used to determine
-# when a subdir object should be used.
-sub lang_sub_obj
-{
-    return option 'subdir-objects' ? LANG_SUBDIR : LANG_PROCESS;
-}
-
 # Rewrite a single C source file.
 sub lang_c_rewrite
 {
   my ($directory, $base, $ext, $obj, $have_per_exec_flags, $var) = @_;
 
-  my $r = LANG_PROCESS;
-  if (option 'subdir-objects')
+  # libtool is always able to put the object at the proper place, so we
+  # do not have to require AM_PROG_CC_C_O when building '.lo' files.
+  if (! $seen_cc_c_o && $obj ne '.lo')
     {
-      $r = LANG_SUBDIR;
       if ($directory && $directory ne '.')
-       {
-         $base = $directory . '/' . $base;
-
-         # libtool is always able to put the object at the proper place,
-         # so we do not have to require AM_PROG_CC_C_O when building .lo files.
-         msg_var ('portability', $var,
-                  "compiling '$base.c' in subdir requires "
-                  . "'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 || $obj eq '.lo';
-       }
-    }
-
-  if (! $seen_cc_c_o
-      && $have_per_exec_flags
-      && ! option 'subdir-objects'
-      && $obj ne '.lo')
-    {
-      msg_var ('portability',
-              $var, "compiling '$base.c' with per-target flags requires "
-              . "'AM_PROG_CC_C_O' in '$configure_ac'",
-              uniq_scope => US_GLOBAL,
-              uniq_part => 'AM_PROG_CC_C_O per-target')
+        {
+          msg_var ('portability', $var,
+                   "compiling '$directory/$base.c' in subdir requires"
+                   . " 'AM_PROG_CC_C_O' in '$configure_ac'",
+                   uniq_scope => US_GLOBAL,
+                   uniq_part => 'AM_PROG_CC_C_O subdir');
+        }
+      elsif ($have_per_exec_flags)
+        {
+           msg_var ('portability', $var,
+                    "compiling '$base.c' with per-target flags requires"
+                    . " 'AM_PROG_CC_C_O' in '$configure_ac'",
+                    uniq_scope => US_GLOBAL,
+                    uniq_part => 'AM_PROG_CC_C_O per-target');
+       }
     }
-
-    return $r;
+  # Not a useless use of return: the caller of this subroutine will
+  # behave differently if a value is actually returned, and since perl
+  # returns the value of the last expressions seen by default, we
+  # need to explicitly return and undefined value.
+  return undef;
 }
 
-# Rewrite a single C++ source file.
-sub lang_cxx_rewrite
-{
-    return &lang_sub_obj;
-}
+# Header files are simply ignored.
+sub lang_header_ignore { 1; }
 
-# Rewrite a single header file.
-sub lang_header_rewrite
+# Vala '.vapi' are a kind of header files as well, and should
+# not be processed into compilation rules.
+ sub lang_vala_ignore
 {
-    # Header files are simply ignored.
-    return LANG_IGNORE;
+    my ($directory, $base, $ext) = @_;
+    return ($ext =~ m/\.vapi$/ ? 1 : 0);
 }
 
 # Rewrite a single Vala source file.
 sub lang_vala_rewrite
 {
     my ($directory, $base, $ext) = @_;
-
-    (my $newext = $ext) =~ s/vala$/c/;
-    return (LANG_SUBDIR, $newext);
+    $ext =~ s/vala$/c/;
+    return $ext;
 }
 
-# Rewrite a single yacc file.
+# Rewrite a single yacc/yacc++ file.
 sub lang_yacc_rewrite
 {
     my ($directory, $base, $ext) = @_;
-
-    my $r = &lang_sub_obj;
-    (my $newext = $ext) =~ tr/y/c/;
-    return ($r, $newext);
+    $ext =~ tr/y/c/;
+    return $ext;
 }
+sub lang_yaccxx_rewrite { lang_yacc_rewrite (@_); };
 
-# Rewrite a single yacc++ file.
-sub lang_yaccxx_rewrite
-{
-    my ($directory, $base, $ext) = @_;
-
-    my $r = &lang_sub_obj;
-    (my $newext = $ext) =~ tr/y/c/;
-    return ($r, $newext);
-}
-
-# Rewrite a single lex file.
+# Rewrite a single lex/lex++ file.
 sub lang_lex_rewrite
 {
     my ($directory, $base, $ext) = @_;
-
-    my $r = &lang_sub_obj;
-    (my $newext = $ext) =~ tr/l/c/;
-    return ($r, $newext);
-}
-
-# Rewrite a single lex++ file.
-sub lang_lexxx_rewrite
-{
-    my ($directory, $base, $ext) = @_;
-
-    my $r = &lang_sub_obj;
-    (my $newext = $ext) =~ tr/l/c/;
-    return ($r, $newext);
-}
-
-# Rewrite a single assembly file.
-sub lang_asm_rewrite
-{
-    return &lang_sub_obj;
-}
-
-# Rewrite a single preprocessed assembly file.
-sub lang_cppasm_rewrite
-{
-    return &lang_sub_obj;
-}
-
-# Rewrite a single Fortran 77 file.
-sub lang_f77_rewrite
-{
-    return &lang_sub_obj;
-}
-
-# Rewrite a single Fortran file.
-sub lang_fc_rewrite
-{
-    return &lang_sub_obj;
-}
-
-# Rewrite a single preprocessed Fortran file.
-sub lang_ppfc_rewrite
-{
-    return &lang_sub_obj;
-}
-
-# Rewrite a single preprocessed Fortran 77 file.
-sub lang_ppf77_rewrite
-{
-    return &lang_sub_obj;
-}
-
-# Rewrite a single ratfor file.
-sub lang_ratfor_rewrite
-{
-    return &lang_sub_obj;
-}
-
-# Rewrite a single Objective C file.
-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
-{
-    return &lang_sub_obj;
-}
-
-# Rewrite a single Java file.
-sub lang_java_rewrite
-{
-    return LANG_SUBDIR;
+    $ext =~ tr/l/c/;
+    return $ext;
 }
+sub lang_lexxx_rewrite { lang_lex_rewrite (@_); };
 
 # The lang_X_finish functions are called after all source file
 # processing is done.  Each should handle defining rules for the
diff --git a/doc/automake-ng.texi b/doc/automake-ng.texi
index a01136c..563a569 100644
--- a/doc/automake-ng.texi
+++ b/doc/automake-ng.texi
@@ -4019,7 +4019,7 @@ choose the assembler for you (by default the C compiler) 
and set
 This is like @code{AC_PROG_CC_C_O}, but it generates its results in
 the manner required by Automake.  You must use this instead of
 @code{AC_PROG_CC_C_O} when you need this functionality, that is, when
-using per-target flags or subdir-objects with C sources.
+using per-target flags or subdir objects with C sources.
 
 @item AM_PROG_LEX
 @acindex AM_PROG_LEX
@@ -5563,18 +5563,13 @@ nodist_maude_SOURCES = nodist.c
 dist_maude_SOURCES = dist-me.c
 @end example
 
-By default the output file (on Unix systems, the @file{.o} file) will
-be put into the current build directory.  However, if the option
address@hidden is in effect in the current directory then the
address@hidden file will be put into the subdirectory named after the
-source file.  For instance, with @option{subdir-objects} enabled,
address@hidden/dir/file.c} will be compiled to @file{sub/dir/file.o}.  Some
-people prefer this mode of operation.  You can specify
address@hidden in @code{AUTOMAKE_OPTIONS} (@pxref{Options}).
+The output file (on Unix systems, the @file{.o} file) will be put into the
+subdirectory named after the source file.  For instance @file{file.c} will
+compiled to @file{file.o}, while @file{sub/dir/file.c} will be compiled to
address@hidden/dir/file.o}.
 @cindex Subdirectory, objects in
 @cindex Objects in subdirectory
 
-
 @item EXTRA_maude_SOURCES
 Automake needs to know the list of files you intend to compile
 @emph{statically}.  For one thing, this is the only way Automake has of
@@ -5970,19 +5965,15 @@ tool1_SOURCES = @dots{}
 tool2_SOURCES = @dots{}
 @end example
 
-When option @option{subdir-objects} is not used, as in the above
-example, the variables @samp{$(LIBOBJS)} or @samp{$(ALLOCA)} can only
-be used in the directory where their sources lie.  E.g., here it would
-be wrong to use @samp{$(LIBOBJS)} or @samp{$(ALLOCA)} in
address@hidden/Makefile.am}.  However if both @option{subdir-objects} and
address@hidden are used, it is OK to use these variables
+The variables @samp{$(LIBOBJS)} or @samp{$(ALLOCA)} are typically
+used in the directory where their sources lie.  However, if
address@hidden is used, it is OK to use these variables
 in other directories.  For instance @file{src/Makefile.am} could be
 changed as follows.
 
 @example
 # src/Makefile.am
 
-AUTOMAKE_OPTIONS = subdir-objects
 LDADD = $(LIBOBJS) $(ALLOCA)
 
 bin_PROGRAMS = tool1 tool2 @dots{}
@@ -10120,18 +10111,6 @@ bin_SCRIPTS = true.sh ...
 AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = false$(EXEEXT) true.sh
 @end example
 
address@hidden @option{subdir-objects}
address@hidden Options, @option{subdir-objects}
address@hidden subdir-objects
-If this option is specified, then objects are placed into the
-subdirectory of the build directory corresponding to the subdirectory of
-the source file.  For instance, if the source file is
address@hidden/file.cxx}, then the output file would be
address@hidden/file.o}.
-
-In order to use this option with C sources, you should add
address@hidden to @file{configure.ac}.
-
 @anchor{tar-formats}
 @item @option{tar-v7}
 @itemx @option{tar-ustar}
diff --git a/lib/am/depend2.am b/lib/am/depend2.am
index e68bba7..faf685a 100644
--- a/lib/am/depend2.am
+++ b/lib/am/depend2.am
@@ -33,8 +33,7 @@
 ## and easily inline the dependency tracking.
 
 if %?FIRST%
-?SUBDIROBJ?am__depdir = $(dir $@)/$(DEPDIR)
-?!SUBDIROBJ?am__depdir = $(DEPDIR)
+am__depdir = $(dir $@)/$(DEPDIR)
 ## FIXME: more precise in the removal of the suffix?
 am__depbase = $(am__depdir)/$(basename $(notdir $@))
 ## Avoid useless forks when possible.
diff --git a/lib/am/lex.am b/lib/am/lex.am
index b5e2bb2..038c125 100644
--- a/lib/am/lex.am
+++ b/lib/am/lex.am
@@ -23,7 +23,7 @@ endif %?MAINTAINER-MODE%
 
 ?GENERIC?%%DERIVED-EXT%: %%EXT%
 ?!GENERIC?%OBJ%: %SOURCE%
-?SUBDIROBJ?    %SILENT%test -d $(dir $@) || $(MKDIR_P) $(dir $@)
+       %SILENT%test -d $(dir $@) || $(MKDIR_P) $(dir $@)
 ?GENERIC?      %VERBOSE%$(am__skiplex) \
 ?!GENERIC??DIST_SOURCE?        %VERBOSE%$(am__skiplex) \
        $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c %OBJ% -- %COMPILE%
diff --git a/lib/am/yacc.am b/lib/am/yacc.am
index 4393ce9..3ead3a5 100644
--- a/lib/am/yacc.am
+++ b/lib/am/yacc.am
@@ -41,7 +41,7 @@ endif %?FIRST%
 
 ?GENERIC?%%DERIVED-EXT%: %%EXT%
 ?!GENERIC?%OBJ%: %SOURCE%
-?SUBDIROBJ?    %SILENT%test -d $(dir $@) || $(MKDIR_P) $(dir $@)
+       %SILENT%test -d $(dir $@) || $(MKDIR_P) $(dir $@)
        %VERBOSE% \
 ?GENERIC?      $(am__skipyacc) \
 ?!GENERIC??DIST_SOURCE?        $(am__skipyacc) \
diff --git a/t/amopts-variable-expansion.sh b/t/amopts-variable-expansion.sh
index 2c39df8..1c085b2 100755
--- a/t/amopts-variable-expansion.sh
+++ b/t/amopts-variable-expansion.sh
@@ -16,6 +16,7 @@
 
 # Check that AUTOMAKE_OPTIONS support variable expansion.
 
+am_create_testdir=empty
 . ./defs || Exit 1
 
 # We want complete control over automake options.
@@ -30,12 +31,12 @@ END
 
 cat > Makefile.am <<'END'
 # The following should expand to:
-#   subdir-objects -Wnone -Wno-error foreign -Wportability
+#   no-dist -Wnone -Wno-error foreign -Wextra-portability
 AUTOMAKE_OPTIONS = $(foo) foreign
 AUTOMAKE_OPTIONS += ${bar}
 foo = $(foo1)
 foo1 = ${foo2}
-foo2 = subdir-objects -Wnone
+foo2 = no-dist -Wnone
 foo2 += $(foo3)
 foo3 = -Wno-error
 bar = -Wportability
@@ -46,10 +47,16 @@ foo_SOURCES = sub/foo.c
 install:
 END
 
+: > compile
+: > missing
+: > depcomp
+: > install-sh
+
 $ACLOCAL
 AUTOMAKE_run
 grep '^Makefile\.am:.*sub/foo\.c.*requires.*AM_PROG_CC_C_O' stderr
 grep README stderr && Exit 1
 $EGREP '(install|override)' stderr && Exit 1
+$EGREP 'distdir|\.tar' Makefile.in && Exit 1
 
 :
diff --git a/t/ax/depcomp-shuffle.sh b/t/ax/depcomp-shuffle.sh
index 56eb7a3..3e9f61b 100644
--- a/t/ax/depcomp-shuffle.sh
+++ b/t/ax/depcomp-shuffle.sh
@@ -74,10 +74,7 @@ echo AC_PROG_RANLIB                     >> configure.ac
 test -z "$xdir" || echo AM_PROG_CC_C_O  >> configure.ac
 echo AC_OUTPUT                          >> configure.ac
 
-if test -n "$xdir"; then
-  echo AUTOMAKE_OPTIONS = subdir-objects > Makefile.am
-fi
-cat >> Makefile.am <<END
+cat > Makefile.am <<END
 noinst_PROGRAMS = prg
 noinst_LIBRARIES = liber.a
 prg_SOURCES = ${xdir}main.c
diff --git a/t/ax/depcomp.sh b/t/ax/depcomp.sh
index a9180e9..ffa7721 100644
--- a/t/ax/depcomp.sh
+++ b/t/ax/depcomp.sh
@@ -200,18 +200,17 @@ ${normalized_target}_${LINKADD} = src/libbaz.$a
 grep-test:
 ## For debugging.
        cat \$(DEPDIR)/foo.$po || :
-       cat \$(DEPDIR)/subfoo.$po || :
+       cat sub/\$(DEPDIR)/subfoo.$po || :
        cat src/\$(DEPDIR)/baz.$po || :
        cat src/sub2/\$(DEPDIR)/sub2foo.$po || :
-## Checks done here.
+## Checks are done here.
        grep '^foo.$objext.*:' \$(DEPDIR)/foo.$po
-       grep '^subfoo\.$objext.*:' \$(DEPDIR)/subfoo.$po
+       grep '^sub/subfoo\.$objext.*:' sub/\$(DEPDIR)/subfoo.$po
        grep '^baz\.$objext.*:' src/\$(DEPDIR)/baz.$po
        grep '^sub2/sub2foo\.$objext.*:' src/sub2/\$(DEPDIR)/sub2foo.$po
 END
 
 cat > src/Makefile.am <<END
-AUTOMAKE_OPTIONS = subdir-objects
 noinst_${LIBPRIMARY} = libbaz.$a
 # We include sub2foo only to be sure that the munging in depcomp
 # doesn't remove too much from the object file name.
diff --git a/t/ccnoco2.sh b/t/ccnoco2.sh
index e6c9c64..6d4bf9c 100755
--- a/t/ccnoco2.sh
+++ b/t/ccnoco2.sh
@@ -15,41 +15,38 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Make sure Automake requires AM_PROG_CC_C_O when either per-targets
-# flags or subdir-objects are used.
+# flags or subdir objects are used.
 
 . ./defs || Exit 1
 
 cat >>configure.ac <<EOF
+AC_CONFIG_FILES([src/Makefile])
 AC_PROG_CC
 AC_OUTPUT
 EOF
 
+$ACLOCAL
+
 cat >Makefile.am <<EOF
+SUBDIRS = src
 bin_PROGRAMS = wish
 wish_SOURCES = a.c
 wish_CPPFLAGS = -DWHATEVER
 EOF
 
-touch a.c
-
-$ACLOCAL
-$AUTOCONF
-AUTOMAKE_fails --copy --add-missing
-grep '^Makefile\.am:2:.*per-target.*AM_PROG_CC_C_O' stderr
-
-
-cat >Makefile.am <<EOF
-bin_PROGRAMS = wish
-wish_SOURCES = sub/a.c
+mkdir src
+cat >src/Makefile.am <<EOF
+bin_PROGRAMS = wish2
+wish2_SOURCES = sub/a.c
 EOF
 
-mkdir sub
-mv a.c sub
-
-$AUTOMAKE --copy --add-missing
-
-echo 'AUTOMAKE_OPTIONS = subdir-objects' >> Makefile.am
 AUTOMAKE_fails --copy --add-missing
-grep '^Makefile\.am:2:.*subdir.*AM_PROG_CC_C_O' stderr
+grep "^Makefile\.am:3:.* 'a\.c' with per-target flags.* 'AM_PROG_CC_C_O'" 
stderr
+grep "^src/Makefile\.am:2:.* 'sub/a\.c' in subdir.* 'AM_PROG_CC_C_O'" stderr
+
+rm -rf autom4te*.cache
+echo AM_PROG_CC_C_O >> configure.ac
+$ACLOCAL
+$AUTOMAKE -a
 
 :
diff --git a/t/ccnoco3.sh b/t/ccnoco3.sh
index eb291ec..5069a7c 100755
--- a/t/ccnoco3.sh
+++ b/t/ccnoco3.sh
@@ -27,7 +27,6 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = wish
 wish_SOURCES = a.c
 END
diff --git a/t/check8.sh b/t/check8.sh
index 9e0c0ff..b50a512 100755
--- a/t/check8.sh
+++ b/t/check8.sh
@@ -27,7 +27,6 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
 TESTS = foo sub/foo $(check_PROGRAMS)
 XFAIL_TESTS = foo sub/baz
 check_PROGRAMS = bar sub/bar baz sub/baz
diff --git a/t/cscope.tap b/t/cscope.tap
index fb808cc..8362b9f 100755
--- a/t/cscope.tap
+++ b/t/cscope.tap
@@ -24,6 +24,8 @@ ocwd=`pwd` || fatal_ "getting top-level directory"
 
 cat >> configure.ac << 'END'
 AC_CONFIG_FILES([sub/Makefile])
+m4_define([AM_PROG_CC_C_O], [:])
+AM_PROG_CC_C_O
 AC_SUBST([CC],  [who-cares])
 AC_SUBST([CXX], [who-cares])
 AC_SUBST([FC],  [who-cares])
diff --git a/t/depcomp-recover.sh b/t/depcomp-recover.sh
index c8747cd..a93319c 100755
--- a/t/depcomp-recover.sh
+++ b/t/depcomp-recover.sh
@@ -55,7 +55,6 @@ echo 'int foo (void);' > foo.h
 
 mkdir sub sub/src
 cat > sub/Makefile.am <<'END'
-AUTOMAKE_OPTIONS = subdir-objects
 noinst_PROGRAMS = foo
 foo_SOURCES = src/main.c src/foo.c src/foo.h
 END
diff --git a/t/depcomp-shuffle-sub-vpath.sh b/t/depcomp-shuffle-sub-vpath.sh
index 67f7c19..223008f 100755
--- a/t/depcomp-shuffle-sub-vpath.sh
+++ b/t/depcomp-shuffle-sub-vpath.sh
@@ -16,7 +16,7 @@
 
 # Dependency tracking in the face of added/removed/renamed files.
 #  - VPATH build
-#  - use of subdir-objects
+#  - use of subdir objects
 
 . ./defs-static || exit '99'
 xdir='sub' vpath='yes'
diff --git a/t/depcomp-shuffle-sub.sh b/t/depcomp-shuffle-sub.sh
index a2bbf2f..57abf0c 100755
--- a/t/depcomp-shuffle-sub.sh
+++ b/t/depcomp-shuffle-sub.sh
@@ -16,7 +16,7 @@
 
 # Dependency tracking in the face of added/removed/renamed files.
 #  - in-tree build
-#  - use of subdir-objects
+#  - use of subdir objects
 
 . ./defs-static || exit '99'
 xdir='sub' vpath='no'
diff --git a/t/depcomp-shuffle-vpath.sh b/t/depcomp-shuffle-vpath.sh
index 2686a54..ea8cbda 100755
--- a/t/depcomp-shuffle-vpath.sh
+++ b/t/depcomp-shuffle-vpath.sh
@@ -16,7 +16,7 @@
 
 # Dependency tracking in the face of added/removed/renamed files.
 #  - VPATH build
-#  - no use of subdir-objects
+#  - no use of subdir objects
 
 . ./defs-static || exit '99'
 xdir='' vpath='yes'
diff --git a/t/depcomp-shuffle.sh b/t/depcomp-shuffle.sh
index e812608..3a284db 100755
--- a/t/depcomp-shuffle.sh
+++ b/t/depcomp-shuffle.sh
@@ -16,7 +16,7 @@
 
 # Dependency tracking in the face of added/removed/renamed files.
 #  - in-tree build
-#  - no use of subdir-objects
+#  - no use of subdir objects
 
 . ./defs-static || exit '99'
 xdir='' vpath='no'
diff --git a/t/depcomp8a.sh b/t/depcomp8a.sh
index 01a2403..7467f1c 100755
--- a/t/depcomp8a.sh
+++ b/t/depcomp8a.sh
@@ -24,7 +24,7 @@ required=cc
 
 cat >> configure.ac << 'END'
 AC_PROG_CC
-#x AM_PROG_CC_C_O
+AM_PROG_CC_C_O
 AC_OUTPUT
 END
 
@@ -49,26 +49,6 @@ $ACLOCAL
 $AUTOMAKE -a
 grep include Makefile.in # For debugging.
 grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in
-grep 'include.*\./\$(DEPDIR)/bar\.P' Makefile.in
-grep 'include.*/\./\$(DEPDIR)' Makefile.in && Exit 1
-
-$AUTOCONF
-# Don't reject slower dependency extractors, for better coverage.
-./configure --enable-dependency-tracking
-$MAKE
-cross_compiling || ./zardoz
-DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' $MAKE distcheck
-
-# Try again with subdir-objects option.
-
-sed 's/#x //' configure.ac >configure.int
-mv -f configure.int configure.ac
-echo AUTOMAKE_OPTIONS = subdir-objects >> Makefile.am
-
-$ACLOCAL
-$AUTOMAKE -a
-grep include Makefile.in # For debugging.
-grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in
 grep 'include.*[^a-zA-Z0-9_/]sub/\$(DEPDIR)/bar\.P' Makefile.in
 $EGREP 'include.*/(\.|sub)/\$\(DEPDIR\)' Makefile.in && Exit 1
 
diff --git a/t/depcomp8b.sh b/t/depcomp8b.sh
index b5f7371..1ecbbfd 100755
--- a/t/depcomp8b.sh
+++ b/t/depcomp8b.sh
@@ -24,7 +24,7 @@ required='cc libtoolize'
 
 cat >> configure.ac << 'END'
 AC_PROG_CC
-#x AM_PROG_CC_C_O
+AM_PROG_CC_C_O
 AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
@@ -40,26 +40,6 @@ echo 'extern int foo = 0;' > foo.c
 echo 'extern int bar = 0;' > sub/bar.c
 
 libtoolize
-
-$ACLOCAL
-$AUTOMAKE -a
-grep include Makefile.in # For debugging.
-grep 'include.*\./\$(DEPDIR)/foo\.P' Makefile.in
-grep 'include.*\./\$(DEPDIR)/bar\.P' Makefile.in
-grep 'include.*/\./\$(DEPDIR)' Makefile.in && Exit 1
-
-$AUTOCONF
-# Don't reject slower dependency extractors, for better coverage.
-./configure --enable-dependency-tracking
-$MAKE
-DISTCHECK_CONFIGURE_FLAGS='--enable-dependency-tracking' $MAKE distcheck
-
-# Try again with subdir-objects option.
-
-sed 's/#x //' configure.ac >configure.int
-mv -f configure.int configure.ac
-echo AUTOMAKE_OPTIONS = subdir-objects >> Makefile.am
-
 $ACLOCAL
 $AUTOMAKE -a
 grep include Makefile.in # For debugging.
diff --git a/t/fort4.sh b/t/fort4.sh
index a23c9bd..eb85bda 100755
--- a/t/fort4.sh
+++ b/t/fort4.sh
@@ -34,6 +34,7 @@ END
 cat >bye.f90 <<'END'
 program goodbye
   call baz
+  call zar
   stop
 end
 END
@@ -46,6 +47,7 @@ END
 
 sed s,foo,bar, foo.f90 > sub/bar.f90
 sed s,foo,baz, foo.f90 > sub/baz.f
+sed s,foo,zar, foo.f90 > sub/zardoz.f90
 
 cat >>configure.ac <<'END'
 AC_PROG_F77
@@ -59,9 +61,29 @@ END
 cat >Makefile.am <<'END'
 bin_PROGRAMS = hello goodbye
 hello_SOURCES = hello.f foo.f90 sub/bar.f90
-goodbye_SOURCES = bye.f90 sub/baz.f
+goodbye_SOURCES = bye.f90 sub/baz.f sub/zardoz.f90
 goodbye_FCFLAGS =
 LDADD = $(FCLIBS)
+
+.PHONY: test-obj
+test-obj:
+       ls -l . sub # For debugging.
+       test -f hello.$(OBJEXT)
+       test -f foo.$(OBJEXT)
+       test -f sub/bar.$(OBJEXT)
+       test ! -f bar.$(OBJEXT)
+       test -f goodbye-bye.$(OBJEXT)
+       test ! -f bye.$(OBJEXT)
+       test -f sub/goodbye-zardoz.$(OBJEXT)
+       test ! -f sub/zardoz.$(OBJEXT)
+       test ! -f goodbye-zardoz.$(OBJEXT)
+       test ! -f zardoz.$(OBJEXT)
+## The setting of FCFLAGS should only cause objects deriving from
+## Fortran 90, not Fortran 77, to be renamed.
+       test -f sub/baz.$(OBJEXT)
+       test ! -f sub/goodbye-baz.$(OBJEXT)
+       test ! -f goodbye-baz.$(OBJEXT)
+       test ! -f baz.$(OBJEXT)
 END
 
 $ACLOCAL
@@ -73,20 +95,9 @@ $AUTOCONF
 # ./configure may exit with status 77 if no compiler is found,
 # or if the compiler cannot compile Fortran 90 files).
 ./configure
-$MAKE
-subobjs=`echo sub/*.o sub/*.obj`
-test "$subobjs" = 'sub/*.o sub/*.obj'
-$MAKE distcheck
 
-$MAKE distclean
-echo 'AUTOMAKE_OPTIONS = subdir-objects' >> Makefile.am
-$AUTOMAKE
-./configure
 $MAKE
-test ! -f bar.o
-test ! -f bar.obj
-test ! -f baz.o
-test ! -f baz.obj
-test ! -f goodbye-baz.o
-test ! -f goodbye-baz.obj
+$MAKE test-obj
 $MAKE distcheck
+
+:
diff --git a/t/fort5.sh b/t/fort5.sh
index 4614b66..b9e5b80 100755
--- a/t/fort5.sh
+++ b/t/fort5.sh
@@ -88,18 +88,17 @@ grep " --tag=FC" Makefile.in
 # ./configure may exit with status 77 if no compiler is found,
 # or if the compiler cannot compile Fortran 90 files).
 ./configure
-$MAKE
-subobjs=`echo sub/*.lo`
-test "$subobjs" = 'sub/*.lo'
-$MAKE distcheck
 
-# The following will be fixed in a later patch:
-$MAKE distclean
-echo 'AUTOMAKE_OPTIONS = subdir-objects' >> Makefile.am
-$AUTOMAKE -a
-./configure
 $MAKE
+test -f sub/bar.lo
 test ! -f bar.lo
+## The setting of FCFLAGS should only cause objects deriving from
+## Fortran 90, not Fortran 77, to be renamed.
+test -f sub/baz.lo
 test ! -f baz.lo
+test ! -f sub/libgoodbye_la-baz.lo
 test ! -f libgoodbye_la-baz.lo
+
 $MAKE distcheck
+
+:
diff --git a/t/gcj.sh b/t/gcj.sh
index b510f1c..cad90b7 100755
--- a/t/gcj.sh
+++ b/t/gcj.sh
@@ -16,21 +16,50 @@
 
 # Test of compiled java.
 
+required='gcc gcj'
 . ./defs || Exit 1
 
 cat >> configure.ac << 'END'
-_AM_DEPENDENCIES([GCJ])
-AC_SUBST([GCJ])
+# FIXME: AM_PROG_GCJ should cause OBJEXT and EXEEXT to be set, but
+# FIXME: it currently does not.  See also xfailing test 'gcj6.sh'.
+AC_PROG_CC
+AM_PROG_GCJ
+AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 bin_PROGRAMS = convert
-convert_SOURCES = x/y/convert.java
+convert_SOURCES = $(my-java-source)
+convert_LDFLAGS = --main=convert
+my-java-source = x/y/convert.java
+$(my-java-source):
+       rm -f address@hidden $@
+       test -d $(@D) || $(MKDIR_P) $(@D)
+       echo 'public class convert {'                      >> address@hidden
+       echo '  public static void main (String[] args) {' >> address@hidden
+       echo '    System.out.println("Hello, World!");'    >> address@hidden
+       echo '  }'                                         >> address@hidden
+       echo '}'                                           >> address@hidden
+       chmod a-w address@hidden && mv -f address@hidden $@
+.PHONY: test-obj
+check-local: test-obj
+test-obj:
+       test -f x/y/convert.$(OBJEXT)
 END
 
 $ACLOCAL
 $AUTOMAKE
+$FGREP 'x/y/convert.$(OBJEXT)' Makefile.in
 
-grep '^x/y/convert' Makefile.in
+$AUTOCONF
+./configure
+
+$MAKE
+$MAKE test-obj
+if ! cross_compiling; then
+  ./convert
+  test "$(./convert)" = 'Hello, World!'
+fi
+$MAKE distcheck
 
 :
diff --git a/t/instdir-ltlib.sh b/t/instdir-ltlib.sh
index 5e1a31f..1234f49 100755
--- a/t/instdir-ltlib.sh
+++ b/t/instdir-ltlib.sh
@@ -33,7 +33,6 @@ END
 mkdir sub
 
 cat >Makefile.am <<'END'
-AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = p
 nobase_bin_PROGRAMS = np sub/np
 lib_LTIBRARIES = libfoo.la
diff --git a/t/instdir-prog.sh b/t/instdir-prog.sh
index 179041a..bef6374 100755
--- a/t/instdir-prog.sh
+++ b/t/instdir-prog.sh
@@ -33,7 +33,6 @@ END
 mkdir sub
 
 cat >Makefile.am <<'END'
-AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = p
 nobase_bin_PROGRAMS = np sub/np
 lib_LIBRARIES = libfoo.a
diff --git a/t/lex-line.sh b/t/lex-line.sh
index 4a0aed5..3db979f 100755
--- a/t/lex-line.sh
+++ b/t/lex-line.sh
@@ -15,7 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Check that automake lex support ensures that lex-generated C
-# files use correct "#line" directives.  Try also with the
+# files use correct "#line" directives.
 # 'subdir-object' option enabled.
 # See also sister test 'yacc-line.test'.
 
@@ -23,7 +23,6 @@ required='cc lex'
 . ./defs || Exit 1
 
 cat >> configure.ac << 'END'
-AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_LEX
@@ -33,7 +32,6 @@ END
 mkdir dir sub sub/dir
 
 cat > Makefile.am << 'END'
-SUBDIRS = sub
 bin_PROGRAMS = foo bar
 LDADD = $(LEXLIB)
 bar_LFLAGS = -v
@@ -41,16 +39,6 @@ foo_SOURCES = zardoz.l
 bar_SOURCES = dir/quux.l
 END
 
-cat > sub/Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
-noinst_PROGRAMS = foo bar
-## We already used $(LEXLIB) above, so try @LEXLIB@ now.
-LDADD = @LEXLIB@
-foo_LFLAGS = -v
-foo_SOURCES = zardoz.l
-bar_SOURCES = dir/quux.l
-END
-
 cat > zardoz.l << 'END'
 %{
 #define YY_NO_UNISTD_H 1
@@ -74,10 +62,8 @@ int yywrap (void)
 END
 
 cp zardoz.l dir/quux.l
-cp zardoz.l sub/zardoz.l
-cp zardoz.l sub/dir/quux.l
 
-c_outputs='zardoz.c bar-quux.c sub/foo-zardoz.c sub/dir/quux.c'
+c_outputs='zardoz.c dir/bar-quux.c'
 
 $ACLOCAL
 $AUTOCONF
@@ -97,7 +83,7 @@ for vpath in : false; do
   $MAKE
 
   # For debugging,
-  ls -l . sub sub/dir
+  ls -l . dir
   $EGREP 'line|\.l' $c_outputs
 
   grep '#.*line.*build.*\.l' $c_outputs && Exit 1
@@ -111,14 +97,10 @@ for vpath in : false; do
   grep "#.*\.l.*\.l" $c_outputs && Exit 1
   if $vpath; then
     grep '#.*line.*"\.\./zardoz\.l"' zardoz.c
-    grep '#.*line.*"\.\./dir/quux\.l"' bar-quux.c
-    grep '#.*line.*"\.\./\.\./sub/zardoz\.l"' sub/foo-zardoz.c
-    grep '#.*line.*"\.\./\.\./sub/dir/quux\.l"' sub/dir/quux.c
+    grep '#.*line.*"\.\./dir/quux\.l"' dir/bar-quux.c
   else
     grep '#.*line.*"zardoz\.l"' zardoz.c
-    grep '#.*line.*"dir/quux\.l"' bar-quux.c
-    grep '#.*line.*"zardoz\.l"' sub/foo-zardoz.c
-    grep '#.*line.*"dir/quux\.l"' sub/dir/quux.c
+    grep '#.*line.*"dir/quux\.l"' dir/bar-quux.c
   fi
 
   cd $srcdir
diff --git a/t/lex-subobj-nodep.sh b/t/lex-subobj-nodep.sh
index 44c9776..f2c9626 100755
--- a/t/lex-subobj-nodep.sh
+++ b/t/lex-subobj-nodep.sh
@@ -14,8 +14,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Ensure subdirs for subdir scanners are generated when subdir-objects
-# are used, even when dependency tracking is disabled.
+# Ensure subdirs for subdir scanners are generated, even when dependency
+# tracking is disabled.
 
 required='cc lex'
 . ./defs || Exit 1
@@ -28,7 +28,6 @@ AC_OUTPUT
 END
 
 cat >Makefile.am <<\END
-AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = p1 p2
 p1_SOURCES = sub1/s1.l
 p2_SOURCES = sub2/s2.l
diff --git a/t/lex5.sh b/t/lex5.sh
index 624ad2a..350ac3b 100755
--- a/t/lex5.sh
+++ b/t/lex5.sh
@@ -27,10 +27,8 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS  = subdir-objects
-LDADD             = @LEXLIB@
-
-bin_PROGRAMS    = foo/foo
+LDADD = @LEXLIB@
+bin_PROGRAMS = foo/foo
 foo_foo_SOURCES = foo/foo.l
 END
 
@@ -44,8 +42,7 @@ cat > foo/foo.l << 'END'
 "END"   return EOF;
 .
 %%
-int
-main ()
+int main (void)
 {
   while (yylex () != EOF)
     ;
diff --git a/t/libobj19.sh b/t/libobj19.sh
index 8105727..5301e37 100755
--- a/t/libobj19.sh
+++ b/t/libobj19.sh
@@ -30,7 +30,6 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
 noinst_LIBRARIES = libtu.a
 libtu_a_SOURCES =
 libtu_a_LIBADD = $(LIBOBJS)
diff --git a/t/libobj20a.sh b/t/libobj20a.sh
deleted file mode 100755
index d56be31..0000000
--- a/t/libobj20a.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2010-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 error reporting for AC_CONFIG_LIBOBJ_DIR.
-# See also sister tests 'libobj20b.test' and 'libobj20c.test' .
-
-. ./defs || Exit 1
-
-cat >> configure.ac << 'END'
-AC_CONFIG_LIBOBJ_DIR([libobj-dir])
-AC_PROG_CC
-AM_PROG_AR
-AC_PROG_RANLIB
-AC_LIBOBJ([foo])
-END
-
-cat > Makefile.am << 'END'
-noinst_LIBRARIES = libtu.a
-libtu_a_SOURCES =
-libtu_a_LIBADD = $(LIBOBJS)
-END
-
-mkdir libobj-dir
-: > libobj-dir/foo.c
-: > ar-lib
-
-$ACLOCAL
-AUTOMAKE_fails
-grep 'LIBOBJS.*used outside.*libobj-dir' stderr
-grep 'subdir-objects.*not set' stderr
-
-:
diff --git a/t/libobj20b.sh b/t/libobj20b.sh
index f8ca600..395bd7b 100755
--- a/t/libobj20b.sh
+++ b/t/libobj20b.sh
@@ -15,7 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test error reporting for AC_CONFIG_LIBOBJ_DIR.
-# See also sister tests 'libobj20a.test' and 'libobj20c.test' .
+# See also sister test 'libobj20c.sh'.
 
 . ./defs || Exit 1
 
@@ -31,7 +31,6 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
 noinst_LIBRARIES = libtu.a
 libtu_a_SOURCES =
 libtu_a_LIBADD = $(LIBOBJS)
diff --git a/t/libobj20c.sh b/t/libobj20c.sh
index 7ae51bf..e764e97 100755
--- a/t/libobj20c.sh
+++ b/t/libobj20c.sh
@@ -15,7 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Test error reporting for AC_CONFIG_LIBOBJ_DIR.
-# See also sister tests 'libobj20a.test' and 'libobj20b.test' .
+# See also sister test 'libobj20b.sh'.
 
 . ./defs || Exit 1
 
@@ -27,7 +27,6 @@ AC_LIBOBJ([foobar])
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
 noinst_LIBRARIES = libtu.a
 libtu_a_SOURCES =
 libtu_a_LIBADD = $(LIBOBJS)
diff --git a/t/libtool3.sh b/t/libtool3.sh
index dbcd519..5ac3b16 100755
--- a/t/libtool3.sh
+++ b/t/libtool3.sh
@@ -23,6 +23,7 @@ required='cc libtoolize'
 cat >> configure.ac << 'END'
 AC_PROG_CC
 AM_PROG_AR
+AM_PROG_CC_C_O
 AM_PROG_LIBTOOL
 AC_OUTPUT
 END
@@ -75,12 +76,8 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE --add-missing --copy
 
-# We need explicit rules to build 1.o and a.lo.  Make sure
-# Automake did not output additional rules for 1.lo and and a.lo.
-$FGREP '1.o:' Makefile.in
-$FGREP '1.lo:' Makefile.in && Exit 1
-$FGREP 'a.o:' Makefile.in && Exit 1
-$FGREP 'a.lo:' Makefile.in
+# We shouldn't need explicit rules.
+$EGREP '[^%]\.(o|obj|lo) *:' Makefile.in && Exit 1
 
 ./configure
 
diff --git a/t/libtool7.sh b/t/libtool7.sh
index bc8eaca..d18d2d3 100755
--- a/t/libtool7.sh
+++ b/t/libtool7.sh
@@ -29,7 +29,6 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
 AM_LIBTOOLFLAGS = --silent
 lib_LTLIBRARIES = libmod1.la mod2.la
 libmod1_la_SOURCES = sub/mod1.c
diff --git a/t/parallel-am2.sh b/t/parallel-am2.sh
index a8ee1b9..2636756 100755
--- a/t/parallel-am2.sh
+++ b/t/parallel-am2.sh
@@ -26,7 +26,6 @@ required=perl-threads
 mkdir sub
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = main
 main_SOURCES = sub/main.c
 SUBDIRS =
@@ -38,7 +37,6 @@ for i in $list; do
   echo "SUBDIRS += sub$i" >> Makefile.am
   mkdir sub$i sub$i/sub
   unindent > sub$i/Makefile.am << END
-    AUTOMAKE_OPTIONS = subdir-objects
     bin_PROGRAMS = sub$i
     sub${i}_SOURCES = sub/main$i.c
 END
diff --git a/t/parallel-tests-suffix-prog.sh b/t/parallel-tests-suffix-prog.sh
index 28dd349..d7b4140 100755
--- a/t/parallel-tests-suffix-prog.sh
+++ b/t/parallel-tests-suffix-prog.sh
@@ -23,6 +23,7 @@ required='cc native'
 
 cat >> configure.ac << 'END'
 AC_PROG_CC
+AM_PROG_CC_C_O
 AC_OUTPUT
 END
 
diff --git a/t/pr224.sh b/t/pr224.sh
index 51e3c17..ef44cdd 100755
--- a/t/pr224.sh
+++ b/t/pr224.sh
@@ -36,7 +36,6 @@ int main (void)
 EOF
 
 cat >Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = bar
 bar_SOURCES = foo/main.c
 EOF
diff --git a/t/pr401.sh b/t/pr401.sh
index 849ee5f..0a0cbcd 100755
--- a/t/pr401.sh
+++ b/t/pr401.sh
@@ -104,17 +104,6 @@ test ! -d lib/lib
 $MAKE distcheck
 
 ## -------------------------------------------- ##
-## Error message with usage in wrong directory. ##
-## -------------------------------------------- ##
-
-mv -f src/Makefile.am src/t
-sed 's/LDADD = .*/LDADD = @LIBOBJS@/' src/t > src/Makefile.am
-AUTOMAKE_fails
-grep 'cannot be used outside.*lib' stderr
-mv -f src/t src/Makefile.am
-
-
-## -------------------------------------------- ##
 ## Test using LIBOBJS from a sibling directory. ##
 ## -------------------------------------------- ##
 
@@ -126,8 +115,6 @@ SUBDIRS = src
 EOF
 
 cat > src/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-
 noinst_LIBRARIES = libfeep.a
 libfeep_a_SOURCES =
 libfeep_a_LIBADD = $(LIBOBJS)
@@ -159,8 +146,6 @@ sed 's/^.*src\/Makefile.*$//' configure.ac >configure.int
 mv -f configure.int configure.ac
 
 cat >Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-
 noinst_LIBRARIES = lib/libfeep.a
 lib_libfeep_a_SOURCES =
 lib_libfeep_a_LIBADD = $(LIBOBJS)
diff --git a/t/pr401b.sh b/t/pr401b.sh
index 382d118..f41dde9 100755
--- a/t/pr401b.sh
+++ b/t/pr401b.sh
@@ -104,15 +104,6 @@ $AUTOMAKE -a
 test ! -d lib/lib
 $MAKE distcheck
 
-## -------------------------------------------- ##
-## Error message with usage in wrong directory. ##
-## -------------------------------------------- ##
-
-mv -f src/Makefile.am src/t
-sed 's/LDADD = .*/LDADD = @LTLIBOBJS@/' src/t > src/Makefile.am
-AUTOMAKE_fails
-grep 'cannot be used outside.*lib' stderr
-mv -f src/t src/Makefile.am
 
 ## ---------------------------------------------- ##
 ## Test using LTLIBOBJS from a sibling directory. ##
@@ -126,8 +117,6 @@ SUBDIRS = src
 EOF
 
 cat > src/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-
 noinst_LTLIBRARIES = libfeep.la
 libfeep_la_SOURCES =
 libfeep_la_LIBADD = $(LTLIBOBJS)
@@ -159,8 +148,6 @@ sed 's/^.*src\/Makefile.*$//' configure.ac >configure.int
 mv -f configure.int configure.ac
 
 cat >Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-
 noinst_LTLIBRARIES = lib/libfeep.la
 lib_libfeep_la_SOURCES =
 lib_libfeep_la_LIBADD = $(LTLIBOBJS)
diff --git a/t/pr401c.sh b/t/pr401c.sh
index 12afade..c2fc06e 100755
--- a/t/pr401c.sh
+++ b/t/pr401c.sh
@@ -105,16 +105,6 @@ $AUTOMAKE
 test ! -d lib/lib
 $MAKE distcheck
 
-## -------------------------------------------- ##
-## Error message with usage in wrong directory. ##
-## -------------------------------------------- ##
-
-mv -f src/Makefile.am src/t
-sed 's/LDADD = .*/LDADD = @ALLOCA@/' src/t > src/Makefile.am
-AUTOMAKE_fails
-grep 'cannot be used outside.*lib' stderr
-mv -f src/t src/Makefile.am
-
 
 ## ------------------------------------------- ##
 ## Test using ALLOCA from a sibling directory. ##
@@ -128,8 +118,6 @@ SUBDIRS = src
 EOF
 
 cat > src/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-
 noinst_LIBRARIES = libfeep.a
 libfeep_a_SOURCES =
 libfeep_a_LIBADD = $(ALLOCA) $(LIBOBJS) # Add LIBOBJS for fun.
@@ -161,8 +149,6 @@ sed 's/^.*src\/Makefile.*$//' configure.ac >configure.int
 mv -f configure.int configure.ac
 
 cat >Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-
 noinst_LIBRARIES = lib/libfeep.a
 lib_libfeep_a_SOURCES =
 lib_libfeep_a_LIBADD = $(ALLOCA)
diff --git a/t/repeated-options.sh b/t/repeated-options.sh
index 8ad5765..e48a60f 100755
--- a/t/repeated-options.sh
+++ b/t/repeated-options.sh
@@ -17,65 +17,31 @@
 # Check that automake does not complain on repeated options, nor
 # generate broken or incorrect makefiles.
 
-required='cc bzip2'
+required=bzip2
 . ./defs || Exit 1
 
 cat >configure.ac <<END
 AC_INIT([$me], [1.0])
-AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip no-dist-gzip dist-bzip2])
+AM_INIT_AUTOMAKE([foreign foreign dist-bzip2 no-dist-gzip dist-bzip2])
 AC_PROG_CC
-AM_PROG_CC_C_O
 AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
 END
 
 cat > Makefile.am <<'END'
-AUTOMAKE_OPTIONS = parallel-tests subdir-objects subdir-objects
-AUTOMAKE_OPTIONS += dist-bzip2 parallel-tests
-TESTS = foo.test
-EXTRA_DIST = $(TESTS)
-TESTS_ENVIRONMENT = EXEEXT='$(EXEEXT)'
-bin_PROGRAMS = sub/foo
-.PHONY: test-build
-test-build:
-       ls -l . sub
-       test -f sub/foo.$(OBJEXT)
-       test -f sub/foo$(EXEEXT)
+AUTOMAKE_OPTIONS = no-dist-gzip no-dist-gzip dist-bzip2
+AUTOMAKE_OPTIONS += dist-bzip2 foreign
 END
 
-mkdir sub
-
-cat > foo.test <<'END'
-#!/bin/sh
-test -f sub/foo$EXEEXT && test -x sub/foo$EXEEXT
-END
-chmod a+x foo.test
-
-cat > sub/foo.c <<'END'
-int main (void)
-{
-  return 0;
-}
-END
-
-cp "$am_scriptdir"/compile "$am_scriptdir"/test-driver .
-
 $ACLOCAL
-$AUTOMAKE --foreign --foreign -Wall 2>stderr || { cat stderr >&2; Exit 1; }
-test -s stderr && { cat stderr >&2; Exit 1; }
-rm -f stderr
 $AUTOCONF
+$AUTOMAKE --foreign --foreign -Wall 2>stderr && test ! -s stderr \
+  || { cat stderr >&2; Exit 1; }
 
 ./configure
+
 $MAKE
-$MAKE test-build
-$MAKE check
-ls -l
-test -f foo.log
-test -f test-suite.log
-$MAKE clean
 $MAKE distcheck
-ls -l
 test -f $me-1.0.tar.bz2
 test ! -r $me-1.0.tar.gz
 
diff --git a/t/silent-lex.sh b/t/silent-lex.sh
index fa9623c..a663961 100755
--- a/t/silent-lex.sh
+++ b/t/silent-lex.sh
@@ -19,12 +19,9 @@
 required='cc lex'
 . ./defs || Exit 1
 
-mkdir sub
-
 cat >>configure.ac <<'EOF'
 AM_PROG_CC_C_O
 AC_PROG_LEX
-AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
 EOF
 
@@ -35,18 +32,6 @@ foo1_SOURCES = foo.l
 foo2_SOURCES = $(foo1_SOURCES)
 foo2_LFLAGS = -n
 foo2_CFLAGS = $(AM_CFLAGS)
-SUBDIRS = sub
-LDADD = $(LEXLIB)
-EOF
-
-cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-# Need generic and non-generic rules.
-bin_PROGRAMS = bar1 bar2
-bar1_SOURCES = bar.l
-bar2_SOURCES = $(bar1_SOURCES)
-bar2_LFLAGS = -n
-bar2_CFLAGS = $(AM_CFLAGS)
 LDADD = $(LEXLIB)
 EOF
 
@@ -62,7 +47,6 @@ cat > foo.l <<'EOF'
 int yywrap (void) { return 1; }
 int   main (void) { return 0; }
 EOF
-cp foo.l sub/bar.l
 
 $ACLOCAL
 $AUTOMAKE --add-missing
@@ -70,7 +54,6 @@ $AUTOCONF
 
 # Ensure per-target rules are used, to ensure their coverage below.
 $FGREP 'foo2-foo.c' Makefile.in || Exit 99
-$FGREP 'bar2-bar.c' sub/Makefile.in || Exit 99
 
 ./configure --enable-silent-rules
 
@@ -81,13 +64,9 @@ $EGREP ' (-c|-o)' stdout && Exit 1
 $EGREP '(mv|ylwrap) ' stdout && Exit 1
 
 grep 'LEX .*foo\.' stdout
-grep 'LEX .*bar\.' stdout
 grep ' CC .*foo\.' stdout
-grep ' CC .*bar\.' stdout
 grep 'CCLD .*foo1' stdout
-grep 'CCLD .*bar1' stdout
 grep 'CCLD .*foo2' stdout
-grep 'CCLD .*bar2' stdout
 
 # Cleaning and then rebuilding with the same V flag (and without
 # removing the generated sources in between) shouldn't trigger a
@@ -102,15 +81,12 @@ $EGREP '(mv|ylwrap) ' stdout && Exit 1
 
 # Don't look for LEX, as probably lex hasn't been re-run.
 grep ' CC .*foo\.' stdout
-grep ' CC .*bar\.' stdout
 grep 'CCLD .*foo1' stdout
-grep 'CCLD .*bar1' stdout
 grep 'CCLD .*foo2' stdout
-grep 'CCLD .*bar2' stdout
 
 # Ensure a truly clean rebuild.
 $MAKE clean
-rm -f *foo.c sub/*bar.c
+rm -f *foo.c
 
 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
 cat stdout
diff --git a/t/silent-many-gcc.sh b/t/silent-many-gcc.sh
index 8ad0720..f6eabbe 100755
--- a/t/silent-many-gcc.sh
+++ b/t/silent-many-gcc.sh
@@ -42,27 +42,20 @@ do_and_check_silent_build ()
   $EGREP ' (-c|-o)' stdout && Exit 1
   $EGREP '(mv|ylwrap) ' stdout && Exit 1
 
+  grep ' CC .*bar\.'  stdout
   grep 'CXX .*foo1\.' stdout
-  grep 'CXX .*baz1\.' stdout
-  grep 'FC .*foo2\.'  stdout
-  grep 'FC .*baz2\.'  stdout
+  grep ' FC .*foo2\.' stdout
   grep 'F77 .*foo3\.' stdout
-  grep 'F77 .*baz3\.' stdout
   grep ' CC .*foo5\.' stdout
-  grep ' CC .*baz5\.' stdout
   grep ' CC .*foo6\.' stdout
-  grep ' CC .*baz6\.' stdout
 
   grep 'CXXLD .*foo' stdout
-  grep 'CCLD .*bar'  stdout
+  grep ' CCLD .*bar' stdout
   grep 'CXXLD .*baz' stdout
-  grep 'CCLD .*bla'  stdout
 
   if $rebuild; then :; else
     grep 'YACC .*foo6\.' stdout
-    grep 'YACC .*baz6\.' stdout
     grep 'LEX .*foo5\.'  stdout
-    grep 'LEX .*baz5\.'  stdout
   fi
 
   unset rebuild
@@ -92,8 +85,6 @@ do_and_check_verbose_build ()
   unset rebuild
 }
 
-mkdir sub
-
 cat >>configure.ac <<'EOF'
 AM_PROG_CC_C_O
 AC_PROG_CXX
@@ -101,46 +92,37 @@ AC_PROG_F77
 AC_PROG_FC
 AC_PROG_LEX
 AC_PROG_YACC
-AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
 EOF
 
 cat > Makefile.am <<'EOF'
 # Need generic and non-generic rules.
-bin_PROGRAMS = foo bar fo2
+bin_PROGRAMS = foo bar baz
 bar_CFLAGS = $(AM_CFLAGS)
 foo_SOURCES = foo1.cpp foo2.f90 foo3.f foo5.l foo6.y
-fo2_SOURCES = $(foo_SOURCES)
-fo2_CPPFLAGS = $(AM_CPPFLAGS)
-fo2_FFLAGS = $(AM_FFLAGS)
-fo2_FCFLAGS = $(AM_FCFLAGS)
-fo2_YFLAGS = -v
-fo2_LFLAGS = -n
-SUBDIRS = sub
+baz_SOURCES = $(foo_SOURCES)
+baz_CPPFLAGS = $(AM_CPPFLAGS)
+baz_FFLAGS = $(AM_FFLAGS)
+baz_FCFLAGS = $(AM_FCFLAGS)
+baz_YFLAGS = -v
+baz_LFLAGS = -n
 AM_YFLAGS = -d
 LDADD = $(LEXLIB)
 BUILT_SOURCES = foo6.h
 EOF
 
-cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-# Need generic and non-generic rules.
-bin_PROGRAMS = baz bla ba2
-bla_CFLAGS = $(AM_CFLAGS)
-baz_SOURCES = baz1.cpp baz2.f90 baz3.f baz5.l baz6.y
-ba2_SOURCES = $(baz_SOURCES)
-ba2_CPPFLAGS = $(AM_CPPFLAGS)
-ba2_FFLAGS = $(AM_FFLAGS)
-ba2_FCFLAGS = $(AM_FCFLAGS)
-ba2_YFLAGS = -v
-ba2_LFLAGS = -n
-AM_YFLAGS = -d
-LDADD = $(LEXLIB)
-BUILT_SOURCES = baz6.h
+cat > bar.c <<'EOF'
+/* Valid C, invalid C++. */
+int main (void)
+{
+  int new = 0;
+  return new;
+}
 EOF
-
 cat > foo1.cpp <<'EOF'
-int main ()
+/* Valid C++, invalid C. */
+using namespace std;
+int main (void)
 {
   return 0;
 }
@@ -177,14 +159,6 @@ void yyerror (char *s) {}
 %%
 fubar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
 EOF
-cp foo1.cpp bar.c
-cp foo1.cpp sub/baz.c
-cp foo1.cpp sub/bla.c
-cp foo1.cpp sub/baz1.cpp
-cp foo2.f90 sub/baz2.f90
-cp foo3.f sub/baz3.f
-cp foo5.l sub/baz5.l
-cp foo6.y sub/baz6.y
 
 $ACLOCAL
 $AUTOMAKE --add-missing
@@ -196,9 +170,9 @@ $FGREP am_cv_CC_dependencies_compiler_type configure
 $FGREP am_cv_CXX_dependencies_compiler_type configure
 # Ensure per-target rules are used, to ensure their coverage below.
 # (We do not do an exhaustive check, that wouldn't be practical).
-$FGREP 'bar-bar.o' Makefile.in
-$FGREP 'fo2-foo5.c' Makefile.in
-$FGREP 'fo2-foo6.c' Makefile.in
+$FGREP 'bar-bar.o'  Makefile.in || Exit 99
+$FGREP 'baz-foo5.c' Makefile.in || Exit 99
+$FGREP 'baz-foo6.c' Makefile.in || Exit 99
 
 # Force gcc ("fast") depmode.
 depmodes="am_cv_CC_dependencies_compiler_type=gcc \
@@ -222,7 +196,7 @@ do
   $MAKE clean
   # This is required, since these files are not removed by 'make clean'
   # (as dictated by the GNU Coding Standards).
-  rm -f *foo5.c *foo6.[ch] sub/*baz5.c sub/*baz6.[ch]
+  rm -f *foo5.c *foo6.[ch]
 
   do_and_check_verbose_build
   # Cleaning and then rebuilding with the same V flag (and without
diff --git a/t/silent-many-generic.sh b/t/silent-many-generic.sh
index cd37672..a6b4a1e 100755
--- a/t/silent-many-generic.sh
+++ b/t/silent-many-generic.sh
@@ -43,27 +43,20 @@ do_and_check_silent_build ()
   $EGREP ' (-c|-o)' stdout && Exit 1
   $EGREP '(mv|ylwrap) ' stdout && Exit 1
 
+  grep ' CC .*bar\.'  stdout
   grep 'CXX .*foo1\.' stdout
-  grep 'CXX .*baz1\.' stdout
-  grep 'FC .*foo2\.'  stdout
-  grep 'FC .*baz2\.'  stdout
+  grep ' FC .*foo2\.' stdout
   grep 'F77 .*foo3\.' stdout
-  grep 'F77 .*baz3\.' stdout
   grep ' CC .*foo5\.' stdout
-  grep ' CC .*baz5\.' stdout
   grep ' CC .*foo6\.' stdout
-  grep ' CC .*baz6\.' stdout
 
   grep 'CXXLD .*foo' stdout
-  grep 'CCLD .*bar'  stdout
+  grep ' CCLD .*bar' stdout
   grep 'CXXLD .*baz' stdout
-  grep 'CCLD .*bla'  stdout
 
   if $rebuild; then :; else
     grep 'YACC .*foo6\.' stdout
-    grep 'YACC .*baz6\.' stdout
     grep 'LEX .*foo5\.'  stdout
-    grep 'LEX .*baz5\.'  stdout
   fi
 
   unset rebuild
@@ -93,8 +86,6 @@ do_and_check_verbose_build ()
   unset rebuild
 }
 
-mkdir sub
-
 cat >>configure.ac <<'EOF'
 AM_PROG_CC_C_O
 AC_PROG_F77
@@ -128,46 +119,37 @@ case " $CXX " in
     CXX=am--cxx
 esac
 
-AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
 EOF
 
 cat > Makefile.am <<'EOF'
 # Need generic and non-generic rules.
-bin_PROGRAMS = foo bar fo2
+bin_PROGRAMS = foo bar baz
 bar_CFLAGS = $(AM_CFLAGS)
 foo_SOURCES = foo1.cpp foo2.f90 foo3.f foo5.l foo6.y
-fo2_SOURCES = $(foo_SOURCES)
-fo2_CPPFLAGS = $(AM_CPPFLAGS)
-fo2_FFLAGS = $(AM_FFLAGS)
-fo2_FCFLAGS = $(AM_FCFLAGS)
-fo2_YFLAGS = -v
-fo2_LFLAGS = -n
-SUBDIRS = sub
+baz_SOURCES = $(foo_SOURCES)
+baz_CPPFLAGS = $(AM_CPPFLAGS)
+baz_FFLAGS = $(AM_FFLAGS)
+baz_FCFLAGS = $(AM_FCFLAGS)
+baz_YFLAGS = -v
+baz_LFLAGS = -n
 AM_YFLAGS = -d
 LDADD = $(LEXLIB)
 BUILT_SOURCES = foo6.h
 EOF
 
-cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-# Need generic and non-generic rules.
-bin_PROGRAMS = baz bla ba2
-bla_CFLAGS = $(AM_CFLAGS)
-baz_SOURCES = baz1.cpp baz2.f90 baz3.f baz5.l baz6.y
-ba2_SOURCES = $(baz_SOURCES)
-ba2_CPPFLAGS = $(AM_CPPFLAGS)
-ba2_FFLAGS = $(AM_FFLAGS)
-ba2_FCFLAGS = $(AM_FCFLAGS)
-ba2_YFLAGS = -v
-ba2_LFLAGS = -n
-AM_YFLAGS = -d
-LDADD = $(LEXLIB)
-BUILT_SOURCES = baz6.h
+cat > bar.c <<'EOF'
+/* Valid C, invalid C++. */
+int main (void)
+{
+  int new = 0;
+  return new;
+}
 EOF
-
 cat > foo1.cpp <<'EOF'
-int main ()
+/* Valid C++, invalid C. */
+using namespace std;
+int main (void)
 {
   return 0;
 }
@@ -204,14 +186,6 @@ void yyerror (char *s) {}
 %%
 fubar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
 EOF
-cp foo1.cpp bar.c
-cp foo1.cpp sub/baz.c
-cp foo1.cpp sub/bla.c
-cp foo1.cpp sub/baz1.cpp
-cp foo2.f90 sub/baz2.f90
-cp foo3.f sub/baz3.f
-cp foo5.l sub/baz5.l
-cp foo6.y sub/baz6.y
 
 mkdir bin
 saved_PATH=$PATH; export saved_PATH
@@ -223,9 +197,9 @@ $AUTOCONF
 
 # Ensure per-target rules are used, to ensure their coverage below.
 # (We do not do an exhaustive check, that wouldn't be practical).
-$FGREP 'bar-bar.o' Makefile.in
-$FGREP 'fo2-foo5.c' Makefile.in
-$FGREP 'fo2-foo6.c' Makefile.in
+$FGREP 'bar-bar.o'  Makefile.in || Exit 99
+$FGREP 'baz-foo5.c' Makefile.in || Exit 99
+$FGREP 'baz-foo6.c' Makefile.in || Exit 99
 
 # Force dependency tracking explicitly, so that slow dependency
 # extractors are not rejected.  Try also with dependency tracking
@@ -247,7 +221,7 @@ do
   $MAKE clean
   # This is required, since these files are not removed by 'make clean'
   # (as dictated by the GNU Coding Standards).
-  rm -f *foo5.c *foo6.[ch] sub/*baz5.c sub/*baz6.[ch]
+  rm -f *foo5.c *foo6.[ch]
 
   do_and_check_verbose_build
   # Cleaning and then rebuilding with the same V flag (and without
diff --git a/t/silent-yacc.sh b/t/silent-yacc.sh
index 4b493b5..9a075fc 100755
--- a/t/silent-yacc.sh
+++ b/t/silent-yacc.sh
@@ -20,12 +20,9 @@
 required='cc yacc'
 . ./defs || Exit 1
 
-mkdir sub
-
 cat >>configure.ac <<'EOF'
 AM_PROG_CC_C_O
 AC_PROG_YACC
-AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
 EOF
 
@@ -36,17 +33,6 @@ foo1_SOURCES = foo.y
 foo2_SOURCES = $(foo1_SOURCES)
 foo2_YFLAGS = -v
 foo2_CFLAGS = $(AM_CPPFLAGS)
-SUBDIRS = sub
-EOF
-
-cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-# Need generic and non-generic rules.
-bin_PROGRAMS = bar1 bar2
-bar1_SOURCES = bar.y
-bar2_SOURCES = $(bar1_SOURCES)
-bar2_YFLAGS = -v
-bar2_CFLAGS = $(AM_CPPFLAGS)
 EOF
 
 cat > foo.y <<'EOF'
@@ -59,7 +45,6 @@ int main (void) { return 0; }
 %%
 fubar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
 EOF
-cp foo.y sub/bar.y
 
 $ACLOCAL
 $AUTOMAKE --add-missing
@@ -67,7 +52,6 @@ $AUTOCONF
 
 # Ensure per-target rules are used, to ensure their coverage below.
 $FGREP 'foo2-foo.c' Makefile.in || Exit 99
-$FGREP 'bar2-bar.c' sub/Makefile.in || Exit 99
 
 ./configure --enable-silent-rules
 
@@ -78,13 +62,9 @@ $EGREP ' (-c|-o)' stdout && Exit 1
 $EGREP '(mv|ylwrap) ' stdout && Exit 1
 
 grep 'YACC .*foo\.' stdout
-grep 'YACC .*bar\.' stdout
-grep ' CC .*foo\.' stdout
-grep ' CC .*bar\.' stdout
-grep 'CCLD .*foo1' stdout
-grep 'CCLD .*bar1' stdout
-grep 'CCLD .*foo2' stdout
-grep 'CCLD .*bar2' stdout
+grep '  CC .*foo\.' stdout
+grep 'CCLD .*foo1'  stdout
+grep 'CCLD .*foo2'  stdout
 
 # Cleaning and then rebuilding with the same V flag (and without
 # removing the generated sources in between) shouldn't trigger a
@@ -98,16 +78,13 @@ $EGREP ' (-c|-o)' stdout && Exit 1
 $EGREP '(mv|ylwrap) ' stdout && Exit 1
 
 # Don't look for YACC, as probably yacc hasn't been re-run.
-grep ' CC .*foo\.' stdout
-grep ' CC .*bar\.' stdout
-grep 'CCLD .*foo1' stdout
-grep 'CCLD .*bar1' stdout
-grep 'CCLD .*foo2' stdout
-grep 'CCLD .*bar2' stdout
+grep '  CC .*foo\.' stdout
+grep 'CCLD .*foo1'  stdout
+grep 'CCLD .*foo2'  stdout
 
 # Ensure a truly clean rebuild.
 $MAKE clean
-rm -f *foo.[ch] sub/*bar.[ch]
+rm -f *foo.[ch]
 
 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
 cat stdout
diff --git a/t/silent.sh b/t/silent.sh
index 3cdbaff..f736c3b 100755
--- a/t/silent.sh
+++ b/t/silent.sh
@@ -24,7 +24,6 @@ required=cc
 mkdir sub
 
 cat >>configure.ac <<'EOF'
-AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_OUTPUT
@@ -32,24 +31,12 @@ EOF
 
 cat > Makefile.am <<'EOF'
 # Need generic and non-generic rules.
-bin_PROGRAMS = foo bar
+bin_PROGRAMS = foo bar sub/baz sub/bla
 bar_CFLAGS = $(AM_CFLAGS)
-SUBDIRS = sub
+sub_bla_CFLAGS = $(AM_CFLAGS)
 EOF
 
-cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-# Need generic and non-generic rules.
-bin_PROGRAMS = baz bla
-bla_CFLAGS = $(AM_CFLAGS)
-EOF
-
-cat > foo.c <<'EOF'
-int main ()
-{
-  return 0;
-}
-EOF
+echo 'int main (void) { return 0; }' > foo.c
 cp foo.c bar.c
 cp foo.c sub/baz.c
 cp foo.c sub/bla.c
@@ -61,22 +48,22 @@ $AUTOCONF
 ./configure --enable-silent-rules
 $MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
-$EGREP ' (-c|-o)' stdout && Exit 1
-grep 'mv ' stdout && Exit 1
-grep 'CC    .*foo\.' stdout
-grep 'CC .*bar\.' stdout
-grep 'CC .*baz\.' stdout
-grep 'CC .*bla\.' stdout
-grep 'CCLD .*foo' stdout
-grep 'CCLD .*bar' stdout
-grep 'CCLD .*baz' stdout
-grep 'CCLD .*bla' stdout
+$EGREP ' (-c|-o)|(mv|mkdir) '   stdout && Exit 1
+grep ' CC  *foo\.o'             stdout
+grep ' CC  *bar-bar\.o'         stdout
+grep ' CC  *sub/baz\.o'         stdout
+grep ' CC  *sub/sub_bla-bla\.o' stdout
+grep ' CCLD  *foo'              stdout
+grep ' CCLD  *bar'              stdout
+grep ' CCLD  *sub/baz'          stdout
+grep ' CCLD  *sub/bla'          stdout
 
 $MAKE clean
 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep ' -c' stdout
 grep ' -o foo' stdout
+grep ' -o sub/baz' stdout
 $EGREP '(CC|LD) ' stdout && Exit 1
 
 :
diff --git a/t/silent2.sh b/t/silent2.sh
index 6270104..ee5fc01 100755
--- a/t/silent2.sh
+++ b/t/silent2.sh
@@ -16,7 +16,7 @@
 
 # Check silent-rules mode, without libtool, non-fastdep case
 # (so that, with GCC, we also cover the other code paths in depend2).
-
+ 
 # Please keep this file in sync with silent.test.
 
 required=gcc
@@ -25,7 +25,6 @@ required=gcc
 mkdir sub
 
 cat >>configure.ac <<'EOF'
-AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_OUTPUT
@@ -33,24 +32,12 @@ EOF
 
 cat > Makefile.am <<'EOF'
 # Need generic and non-generic rules.
-bin_PROGRAMS = foo bar
+bin_PROGRAMS = foo bar sub/baz sub/bla
 bar_CFLAGS = $(AM_CFLAGS)
-SUBDIRS = sub
+sub_bla_CFLAGS = $(AM_CFLAGS)
 EOF
 
-cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-# Need generic and non-generic rules.
-bin_PROGRAMS = baz bla
-bla_CFLAGS = $(AM_CFLAGS)
-EOF
-
-cat > foo.c <<'EOF'
-int main ()
-{
-  return 0;
-}
-EOF
+echo 'int main (void) { return 0; }' > foo.c
 cp foo.c bar.c
 cp foo.c sub/baz.c
 cp foo.c sub/bla.c
@@ -62,22 +49,22 @@ $AUTOCONF
 ./configure am_cv_CC_dependencies_compiler_type=gcc --enable-silent-rules
 $MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
-$EGREP ' (-c|-o)' stdout && Exit 1
-grep 'mv ' stdout && Exit 1
-grep 'CC .*foo\.' stdout
-grep 'CC .*bar\.' stdout
-grep 'CC .*baz\.' stdout
-grep 'CC .*bla\.' stdout
-grep 'CCLD .*foo' stdout
-grep 'CCLD .*bar' stdout
-grep 'CCLD .*baz' stdout
-grep 'CCLD .*bla' stdout
+$EGREP ' (-c|-o)|(mv|mkdir) '   stdout && Exit 1
+grep ' CC  *foo\.o'             stdout
+grep ' CC  *bar-bar\.o'         stdout
+grep ' CC  *sub/baz\.o'         stdout
+grep ' CC  *sub/sub_bla-bla\.o' stdout
+grep ' CCLD  *foo'              stdout
+grep ' CCLD  *bar'              stdout
+grep ' CCLD  *sub/baz'          stdout
+grep ' CCLD  *sub/bla'          stdout
 
 $MAKE clean
 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep ' -c' stdout
 grep ' -o foo' stdout
+grep ' -o sub/baz' stdout
 $EGREP '(CC|LD) ' stdout && Exit 1
 
 :
diff --git a/t/silent3.sh b/t/silent3.sh
index cb3c629..325c7e7 100755
--- a/t/silent3.sh
+++ b/t/silent3.sh
@@ -24,7 +24,6 @@ required='cc libtoolize'
 mkdir sub
 
 cat >>configure.ac <<'EOF'
-AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
 AM_PROG_AR
 AM_PROG_CC_C_O
@@ -34,24 +33,13 @@ EOF
 
 cat > Makefile.am <<'EOF'
 # Need generic and non-generic rules.
-lib_LTLIBRARIES = libfoo.la libbar.la
+lib_LTLIBRARIES = libfoo.la libbar.la sub/libbaz.la sub/libbla.la
 libbar_la_CFLAGS = $(AM_CFLAGS)
-SUBDIRS = sub
-EOF
-
-cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
 # Need generic and non-generic rules.
-lib_LTLIBRARIES = libbaz.la libbla.la
-libbla_la_CFLAGS = $(AM_CFLAGS)
+sub_libbla_la_CFLAGS = $(AM_CFLAGS)
 EOF
 
-cat > libfoo.c <<'EOF'
-int main ()
-{
-  return 0;
-}
-EOF
+echo 'int main (void) { return 0; }' > libfoo.c
 cp libfoo.c libbar.c
 cp libfoo.c sub/libbaz.c
 cp libfoo.c sub/libbla.c
@@ -64,22 +52,22 @@ $AUTOCONF
 ./configure --enable-silent-rules
 $MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
-$EGREP ' (-c|-o)' stdout && Exit 1
-grep 'mv ' stdout && Exit 1
-grep ' CC .*foo\.' stdout
-grep ' CC .*bar\.' stdout
-grep ' CC .*baz\.' stdout
-grep ' CC .*bla\.' stdout
-grep ' CCLD .*foo' stdout
-grep ' CCLD .*bar' stdout
-grep ' CCLD .*baz' stdout
-grep ' CCLD .*bla' stdout
+$EGREP ' (-c|-o)|(mv|mkdir) '             stdout && Exit 1
+grep ' CC  *libfoo\.lo'                   stdout
+grep ' CC  *libbar_la-libbar\.lo'         stdout
+grep ' CC  *sub/libbaz\.lo'               stdout
+grep ' CC  *sub/sub_libbla_la-libbla\.lo' stdout
+grep ' CCLD  *libfoo\.la'                 stdout
+grep ' CCLD  *libbar\.la'                 stdout
+grep ' CCLD  *sub/libbaz\.la'             stdout
+grep ' CCLD  *sub/libbla\.la'             stdout
 
 $MAKE clean
 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep ' -c' stdout
 grep ' -o libfoo' stdout
+grep ' -o sub/libbaz' stdout
 # The libtool command line can contain e.g. a '--tag=CC' option.
 sed 's/--tag=[^ ]*/--tag=x/g' stdout | $EGREP '(CC|LD) ' && Exit 1
 
diff --git a/t/silent4.sh b/t/silent4.sh
index a44c718..eccb341 100755
--- a/t/silent4.sh
+++ b/t/silent4.sh
@@ -25,7 +25,6 @@ required="libtoolize gcc"
 mkdir sub
 
 cat >>configure.ac <<'EOF'
-AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
 AM_PROG_AR
 AM_PROG_CC_C_O
@@ -35,24 +34,13 @@ EOF
 
 cat > Makefile.am <<'EOF'
 # Need generic and non-generic rules.
-lib_LTLIBRARIES = libfoo.la libbar.la
+lib_LTLIBRARIES = libfoo.la libbar.la sub/libbaz.la sub/libbla.la
 libbar_la_CFLAGS = $(AM_CFLAGS)
-SUBDIRS = sub
-EOF
-
-cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
 # Need generic and non-generic rules.
-lib_LTLIBRARIES = libbaz.la libbla.la
-libbla_la_CFLAGS = $(AM_CFLAGS)
+sub_libbla_la_CFLAGS = $(AM_CFLAGS)
 EOF
 
-cat > libfoo.c <<'EOF'
-int main ()
-{
-  return 0;
-}
-EOF
+echo 'int main (void) { return 0; }' > libfoo.c
 cp libfoo.c libbar.c
 cp libfoo.c sub/libbaz.c
 cp libfoo.c sub/libbla.c
@@ -65,22 +53,22 @@ $AUTOCONF
 ./configure am_cv_CC_dependencies_compiler_type=gcc --enable-silent-rules
 $MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
-$EGREP ' (-c|-o)' stdout && Exit 1
-grep 'mv ' stdout && Exit 1
-grep ' CC .*foo\.' stdout
-grep ' CC .*bar\.' stdout
-grep ' CC .*baz\.' stdout
-grep ' CC .*bla\.' stdout
-grep ' CCLD .*foo' stdout
-grep ' CCLD .*bar' stdout
-grep ' CCLD .*baz' stdout
-grep ' CCLD .*bla' stdout
+$EGREP ' (-c|-o)|(mv|mkdir) '             stdout && Exit 1
+grep ' CC  *libfoo\.lo'                   stdout
+grep ' CC  *libbar_la-libbar\.lo'         stdout
+grep ' CC  *sub/libbaz\.lo'               stdout
+grep ' CC  *sub/sub_libbla_la-libbla\.lo' stdout
+grep ' CCLD  *libfoo\.la'                 stdout
+grep ' CCLD  *libbar\.la'                 stdout
+grep ' CCLD  *sub/libbaz\.la'             stdout
+grep ' CCLD  *sub/libbla\.la'             stdout
 
 $MAKE clean
 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep ' -c' stdout
 grep ' -o libfoo' stdout
+grep ' -o sub/libbaz' stdout
 # The libtool command line can contain e.g. a '--tag=CC' option.
 sed 's/--tag=[^ ]*/--tag=x/g' stdout | $EGREP '(CC|LD) ' && Exit 1
 
diff --git a/t/silent9.sh b/t/silent9.sh
index 9b311c6..6c23c9f 100755
--- a/t/silent9.sh
+++ b/t/silent9.sh
@@ -24,34 +24,22 @@ required='cc libtoolize'
 mkdir sub
 
 cat >>configure.ac <<'EOF'
-AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
-AM_PROG_CC_C_O
 AM_PROG_AR
+AM_PROG_CC_C_O
 AC_PROG_LIBTOOL
 AC_OUTPUT
 EOF
 
 cat > Makefile.am <<'EOF'
 # Need generic and non-generic rules.
-lib_LTLIBRARIES = libfoo.la libbar.la
+lib_LTLIBRARIES = libfoo.la libbar.la sub/libbaz.la sub/libbla.la
 libbar_la_CFLAGS = $(AM_CFLAGS)
-SUBDIRS = sub
-EOF
-
-cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
 # Need generic and non-generic rules.
-lib_LTLIBRARIES = libbaz.la libbla.la
-libbla_la_CFLAGS = $(AM_CFLAGS)
+sub_libbla_la_CFLAGS = $(AM_CFLAGS)
 EOF
 
-cat > libfoo.c <<'EOF'
-int main ()
-{
-  return 0;
-}
-EOF
+echo 'int main (void) { return 0; }' > libfoo.c
 cp libfoo.c libbar.c
 cp libfoo.c sub/libbaz.c
 cp libfoo.c sub/libbla.c
@@ -64,22 +52,22 @@ $AUTOCONF
 ./configure --disable-dependency-tracking --enable-silent-rules
 $MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
-$EGREP ' (-c|-o)' stdout && Exit 1
-grep 'mv ' stdout && Exit 1
-grep ' CC .*foo\.' stdout
-grep ' CC .*bar\.' stdout
-grep ' CC .*baz\.' stdout
-grep ' CC .*bla\.' stdout
-grep ' CCLD .*foo' stdout
-grep ' CCLD .*bar' stdout
-grep ' CCLD .*baz' stdout
-grep ' CCLD .*bla' stdout
+$EGREP ' (-c|-o)|(mv|mkdir) '             stdout && Exit 1
+grep ' CC  *libfoo\.lo'                   stdout
+grep ' CC  *libbar_la-libbar\.lo'         stdout
+grep ' CC  *sub/libbaz\.lo'               stdout
+grep ' CC  *sub/sub_libbla_la-libbla\.lo' stdout
+grep ' CCLD  *libfoo\.la'                 stdout
+grep ' CCLD  *libbar\.la'                 stdout
+grep ' CCLD  *sub/libbaz\.la'             stdout
+grep ' CCLD  *sub/libbla\.la'             stdout
 
 $MAKE clean
 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep ' -c' stdout
 grep ' -o libfoo' stdout
+grep ' -o sub/libbaz' stdout
 # The libtool command line can contain e.g. a '--tag=CC' option.
 sed 's/--tag=[^ ]*/--tag=x/g' stdout | $EGREP '(CC|LD) ' && Exit 1
 
diff --git a/t/silentcxx-gcc.sh b/t/silentcxx-gcc.sh
index fff3f91..35f01be 100755
--- a/t/silentcxx-gcc.sh
+++ b/t/silentcxx-gcc.sh
@@ -25,31 +25,23 @@ mkdir sub
 
 cat >>configure.ac <<'EOF'
 AC_PROG_CXX
-AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
 EOF
 
 cat > Makefile.am <<'EOF'
 # Need generic and non-generic rules.
-bin_PROGRAMS = foo1 foo2
+bin_PROGRAMS = foo1 foo2 bar1 bar2
 foo1_SOURCES = foo.cpp baz.cxx quux.cc
 foo2_SOURCES = $(foo1_SOURCES)
 foo2_CXXFLAGS = $(AM_CXXFLAGS)
-SUBDIRS = sub
-EOF
-
-cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-# Need generic and non-generic rules.
-bin_PROGRAMS = bar1 bar2
-bar1_SOURCES = bar.cpp
+bar1_SOURCES = sub/bar.cpp
 bar2_SOURCES = $(bar1_SOURCES)
 bar2_CXXFLAGS = $(AM_CXXFLAGS)
 EOF
 
 cat > foo.cpp <<'EOF'
 using namespace std; /* C compilers fail on this. */
-int main() { return 0; }
+int main (void) { return 0; }
 EOF
 
 # Let's try out other extensions too.
@@ -79,14 +71,18 @@ do
   $EGREP ' (-c|-o)' stdout && Exit 1
   grep 'mv ' stdout && Exit 1
 
-  grep 'CXX .*foo\.'  stdout
-  grep 'CXX .*baz\.'  stdout
-  grep 'CXX .*quux\.' stdout
-  grep 'CXX .*bar\.'  stdout
-  grep 'CXXLD .*foo1' stdout
-  grep 'CXXLD .*bar1' stdout
-  grep 'CXXLD .*foo2' stdout
-  grep 'CXXLD .*bar2' stdout
+  grep ' CXX  *foo\.o'          stdout
+  grep ' CXX  *baz\.o'          stdout
+  grep ' CXX  *quux\.o'         stdout
+  grep ' CXX  *foo2-foo\.o'     stdout
+  grep ' CXX  *foo2-baz\.o'     stdout
+  grep ' CXX  *foo2-quux\.o'    stdout
+  grep ' CXX  *sub/bar\.o'      stdout
+  grep ' CXX  *sub/bar2-bar\.o' stdout
+  grep ' CXXLD  *foo1'          stdout
+  grep ' CXXLD  *bar1'          stdout
+  grep ' CXXLD  *foo2'          stdout
+  grep ' CXXLD  *bar2'          stdout
 
   # Ensure a clean rebuild.
   $MAKE clean
@@ -95,7 +91,8 @@ do
   cat stdout
 
   grep ' -c ' stdout
-  grep ' -o ' stdout
+  grep ' -o quux' stdout
+  grep ' -o bar2' stdout
 
   $EGREP '(CC|CXX|LD) ' stdout && Exit 1
 
diff --git a/t/silentcxx.sh b/t/silentcxx.sh
index cc111d3..5090483 100755
--- a/t/silentcxx.sh
+++ b/t/silentcxx.sh
@@ -14,11 +14,10 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Check silent-rules mode for C++.
 # This test should work with generic C++ compilers; keep it in sync with
 # sister test 'silentcxx-gcc.test', which requires the GNU C++ compiler
 # and forces the use of gcc depmode.
-
+ 
 required=c++
 . ./defs || Exit 1
 
@@ -26,24 +25,16 @@ mkdir sub
 
 cat >>configure.ac <<'EOF'
 AC_PROG_CXX
-AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
 EOF
 
 cat > Makefile.am <<'EOF'
 # Need generic and non-generic rules.
-bin_PROGRAMS = foo1 foo2
+bin_PROGRAMS = foo1 foo2 bar1 bar2
 foo1_SOURCES = foo.cpp baz.cxx quux.cc
 foo2_SOURCES = $(foo1_SOURCES)
 foo2_CXXFLAGS = $(AM_CXXFLAGS)
-SUBDIRS = sub
-EOF
-
-cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-# Need generic and non-generic rules.
-bin_PROGRAMS = bar1 bar2
-bar1_SOURCES = bar.cpp
+bar1_SOURCES = sub/bar.cpp
 bar2_SOURCES = $(bar1_SOURCES)
 bar2_CXXFLAGS = $(AM_CXXFLAGS)
 EOF
@@ -80,14 +71,18 @@ do
   $EGREP ' (-c|-o)' stdout && Exit 1
   grep 'mv ' stdout && Exit 1
 
-  grep 'CXX .*foo\.'  stdout
-  grep 'CXX .*baz\.'  stdout
-  grep 'CXX .*quux\.' stdout
-  grep 'CXX .*bar\.'  stdout
-  grep 'CXXLD .*foo1' stdout
-  grep 'CXXLD .*bar1' stdout
-  grep 'CXXLD .*foo2' stdout
-  grep 'CXXLD .*bar2' stdout
+  grep ' CXX  *foo\.o'          stdout
+  grep ' CXX  *baz\.o'          stdout
+  grep ' CXX  *quux\.o'         stdout
+  grep ' CXX  *foo2-foo\.o'     stdout
+  grep ' CXX  *foo2-baz\.o'     stdout
+  grep ' CXX  *foo2-quux\.o'    stdout
+  grep ' CXX  *sub/bar\.o'      stdout
+  grep ' CXX  *sub/bar2-bar\.o' stdout
+  grep ' CXXLD  *foo1'          stdout
+  grep ' CXXLD  *bar1'          stdout
+  grep ' CXXLD  *foo2'          stdout
+  grep ' CXXLD  *bar2'          stdout
 
   # Ensure a clean rebuild.
   $MAKE clean
@@ -96,7 +91,8 @@ do
   cat stdout
 
   grep ' -c ' stdout
-  grep ' -o ' stdout
+  grep ' -o quux' stdout
+  grep ' -o bar2' stdout
 
   $EGREP '(CXX|LD) ' stdout && Exit 1
 
diff --git a/t/silentf77.sh b/t/silentf77.sh
index 87fbc23..0b8846e 100755
--- a/t/silentf77.sh
+++ b/t/silentf77.sh
@@ -24,25 +24,17 @@ mkdir sub
 
 cat >>configure.ac <<'EOF'
 AC_PROG_F77
-AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
 EOF
 
 cat > Makefile.am <<'EOF'
 # Need generic and non-generic rules.
-bin_PROGRAMS = foo1 foo2
+bin_PROGRAMS = foo1 foo2 sub/bar1 bar2
 foo1_SOURCES = foo.f
 foo2_SOURCES = $(foo1_SOURCES)
 foo2_FFLAGS = $(AM_FFLAGS)
-SUBDIRS = sub
-EOF
-
-cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-# Need generic and non-generic rules.
-bin_PROGRAMS = bar1 bar2
-bar1_SOURCES = bar.f
-bar2_SOURCES = $(bar1_SOURCES)
+sub_bar1_SOURCES = sub/bar.f
+bar2_SOURCES = $(sub_bar1_SOURCES)
 bar2_FFLAGS = $(AM_FFLAGS)
 EOF
 
@@ -68,12 +60,14 @@ cat stdout
 $EGREP ' (-c|-o)' stdout && Exit 1
 grep 'mv ' stdout && Exit 1
 
-grep 'F77 .*foo\.'  stdout
-grep 'F77 .*bar\.'  stdout
-grep 'F77LD .*foo1' stdout
-grep 'F77LD .*bar1' stdout
-grep 'F77LD .*foo2' stdout
-grep 'F77LD .*bar2' stdout
+grep ' F77  *foo\.'          stdout
+grep ' F77  *foo2-foo\.'     stdout
+grep ' F77  *sub/bar\.'      stdout
+grep ' F77  *sub/bar2-bar\.' stdout
+grep ' F77LD  *foo1'         stdout
+grep ' F77LD  *foo2'         stdout
+grep ' F77LD  *sub/bar1'     stdout
+grep ' F77LD  *bar2'         stdout
 
 $EGREP '(FC|FCLD) ' stdout && Exit 1
 
diff --git a/t/silentf90.sh b/t/silentf90.sh
index 65a35ed..3466b8a 100755
--- a/t/silentf90.sh
+++ b/t/silentf90.sh
@@ -24,25 +24,17 @@ mkdir sub
 
 cat >>configure.ac <<'EOF'
 AC_PROG_FC
-AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
 EOF
 
 cat > Makefile.am <<'EOF'
 # Need generic and non-generic rules.
-bin_PROGRAMS = foo1 foo2
+bin_PROGRAMS = foo1 foo2 sub/bar1 bar2
 foo1_SOURCES = foo.f90
 foo2_SOURCES = $(foo1_SOURCES)
 foo2_FCFLAGS = $(AM_FCLAGS)
-SUBDIRS = sub
-EOF
-
-cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = subdir-objects
-# Need generic and non-generic rules.
-bin_PROGRAMS = bar1 bar2
-bar1_SOURCES = bar.f90
-bar2_SOURCES = $(bar1_SOURCES)
+sub_bar1_SOURCES = sub/bar.f90
+bar2_SOURCES = $(sub_bar1_SOURCES)
 bar2_FCFLAGS = $(AM_FCLAGS)
 EOF
 
@@ -68,12 +60,14 @@ cat stdout
 $EGREP ' (-c|-o)' stdout && Exit 1
 grep 'mv ' stdout && Exit 1
 
-grep 'FC .*foo\.'  stdout
-grep 'FC .*bar\.'  stdout
-grep 'FCLD .*foo1' stdout
-grep 'FCLD .*bar1' stdout
-grep 'FCLD .*foo2' stdout
-grep 'FCLD .*bar2' stdout
+grep ' FC  *foo\.'          stdout
+grep ' FC  *foo2-foo\.'     stdout
+grep ' FC  *sub/bar\.'      stdout
+grep ' FC  *sub/bar2-bar\.' stdout
+grep ' FCLD  *foo1'         stdout
+grep ' FCLD  *foo2'         stdout
+grep ' FCLD  *sub/bar1'     stdout
+grep ' FCLD  *bar2'         stdout
 
 $EGREP '(F77|F77LD) ' stdout && Exit 1
 
diff --git a/t/specflg-dummy.sh b/t/specflg-dummy.sh
index 1486f4c..47a1c21 100755
--- a/t/specflg-dummy.sh
+++ b/t/specflg-dummy.sh
@@ -226,17 +226,13 @@ $AUTOMAKE -a
 do_check
 
 sed '
+
   s|^\(.*\)_SOURCES *= *|sub_\1_SOURCES = srcsub/|
   s|^\(.*\)PROGRAMS *+= *|\1PROGRAMS += sub/|
   s|^\(.*\)LIBRARIES *+= *|\1LIBRARIES += sub/|
   s|^\(.*\)FLAGS *=|sub_\1FLAGS =|
-' Makefile.am > t
-
-cat - t > Makefile.am <<'END'
-AUTOMAKE_OPTIONS = subdir-objects
-END
 
-rm -f t
+' Makefile.am > t && mv -f t Makefile.am
 
 # For debugging.
 cat Makefile.am
diff --git a/t/subdir3.sh b/t/subdir3.sh
deleted file mode 100755
index d9b160f..0000000
--- a/t/subdir3.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#! /bin/sh
-# Copyright (C) 1999-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 to make sure subdir source file generates explicit dependency.
-
-. ./defs || Exit 1
-
-cat > Makefile.am << 'END'
-bin_PROGRAMS = zardoz widdershins
-zardoz_SOURCES = y.c x/z.c
-widdershins_SOURCES = x/z.c
-END
-
-cat >> configure.ac << 'END'
-AC_PROG_CC
-END
-
-$ACLOCAL
-$AUTOMAKE
-
-grep '^z\.o: x/z\.c$' Makefile.in
-
-:
diff --git a/t/subobj.sh b/t/subobj-c.sh
similarity index 95%
copy from t/subobj.sh
copy to t/subobj-c.sh
index 1265a43..0bbeb2b 100755
--- a/t/subobj.sh
+++ b/t/subobj-c.sh
@@ -14,7 +14,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test of subdir objects with C.
+# Test subdir objects with C, building both a library and an executable.
+# Keep in sync with sister test 'subobj-cxx.sh'.
 
 required=cc
 . ./defs || Exit 1
@@ -28,7 +29,6 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = progs/wish
 lib_LIBRARIES = libs/libhope.a
 progs_wish_SOURCES = generic/a.c generic/b.c
@@ -51,6 +51,7 @@ remake-single-object:
 END
 
 mkdir generic sub sub/sub2
+
 cat > generic/a.c <<END
 int main (void)
 {
diff --git a/t/subobj2.sh b/t/subobj-cxx-grep.sh
similarity index 78%
rename from t/subobj2.sh
rename to t/subobj-cxx-grep.sh
index 3a3f861..1a03b16 100755
--- a/t/subobj2.sh
+++ b/t/subobj-cxx-grep.sh
@@ -14,16 +14,14 @@
 # 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 of subdir objects with C++.
+# Grepping checks on the use of subdir objects with C++.
+# See relate test 't/subobj-cxx-grep.sh' for semantic checks.
 
 . ./defs || Exit 1
 
-cat >> configure.ac << 'END'
-AC_PROG_CXX
-END
+echo AC_PROG_CXX >> configure.ac
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = wish
 wish_SOURCES = generic/a.cc generic/b.cxx
 END
@@ -32,7 +30,8 @@ $ACLOCAL
 $AUTOMAKE
 
 $FGREP 'generic/a.$(OBJEXT)' Makefile.in
-grep '[^/]a\.\$(OBJEXT)' Makefile.in && Exit 1
+$FGREP 'generic/b.$(OBJEXT)' Makefile.in
+grep '[^/][ab]\.\$(OBJEXT)' Makefile.in && Exit 1
 grep '.*-c -o' Makefile.in
 
 :
diff --git a/t/subobj.sh b/t/subobj-cxx.sh
similarity index 77%
rename from t/subobj.sh
rename to t/subobj-cxx.sh
index 1265a43..ccb9e77 100755
--- a/t/subobj.sh
+++ b/t/subobj-cxx.sh
@@ -14,25 +14,24 @@
 # 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 of subdir objects with C.
+# Test subdir objects with C++, building both a library and an executable.
+# Keep in sync with sister test 'subobj-c.sh'.
 
-required=cc
+required=c++
 . ./defs || Exit 1
 
 cat >> configure.ac << 'END'
-AC_PROG_CC
-AM_PROG_CC_C_O
+AC_PROG_CXX
 AM_PROG_AR
 AC_PROG_RANLIB
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = progs/wish
 lib_LIBRARIES = libs/libhope.a
-progs_wish_SOURCES = generic/a.c generic/b.c
-libs_libhope_a_SOURCES = sub/sub2/foo.c
+progs_wish_SOURCES = generic/a.cc generic/b.c++
+libs_libhope_a_SOURCES = sub/sub2/foo.cxx
 
 .PHONY: remake-single-object
 remake-single-object:
@@ -51,16 +50,26 @@ remake-single-object:
 END
 
 mkdir generic sub sub/sub2
-cat > generic/a.c <<END
+
+cat > generic/a.cc <<END
+using namespace std; // Make this valid C++ but invalid C.
+extern int b (void);
 int main (void)
 {
-  extern int i;
-  return i;
+  return b ();
 }
 END
-echo 'int i = 0;' > generic/b.c
 
-cat > sub/sub2/foo.c <<'END'
+cat > generic/b.c++ <<END
+using namespace std; // Make this valid C++ but invalid C.
+int b (void)
+{
+  return 0;
+}
+END
+
+cat > sub/sub2/foo.cxx <<'END'
+using namespace std; // Make this valid C++ but invalid C.
 int answer (void)
 {
   return 42;
@@ -68,13 +77,8 @@ int answer (void)
 END
 
 $ACLOCAL
-$AUTOMAKE --add-missing 2>stderr || { cat stderr >&2; Exit 1; }
-cat stderr >&2
-
-# Make sure compile is installed, and that Automake says so.
-grep 'install.*compile' stderr
-test -f compile
-
+$AUTOMAKE -a
+test ! -f compile # This is not needed by C++ support.
 $EGREP '[^/](a|b|foo)\.\$(OBJEXT)' Makefile.in && Exit 1
 
 $AUTOCONF
diff --git a/t/subobj-libtool.sh b/t/subobj-libtool.sh
index 366e999..fc9f8c7 100755
--- a/t/subobj-libtool.sh
+++ b/t/subobj-libtool.sh
@@ -28,7 +28,6 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
 noinst_LTLIBRARIES = libs/libfoo.la
 libs_libfoo_la_SOURCES = generic/1.c generic/2.c sub/subsub/3.c
 
diff --git a/t/subobj10.sh b/t/subobj10.sh
index db6bf72..ead6b6f 100755
--- a/t/subobj10.sh
+++ b/t/subobj10.sh
@@ -14,28 +14,35 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# PR 492: Test asm subdir-objects.
+# PR 492: Test asm subdir objects.
 
 required=gcc
 . ./defs || Exit 1
 
-cat > configure.ac << END
-AC_INIT([$me], [1.0])
-AM_INIT_AUTOMAKE([subdir-objects])
-
+cat >> configure.ac << 'END'
 AM_PROG_AS
 AM_PROG_AR
 AC_PROG_RANLIB
-
-AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
 noinst_LIBRARIES = libfoo.a libbar.a
+
 libfoo_a_SOURCES = src/a.s b.s
 libbar_a_SOURCES = src/c.s d.s
 libbar_a_CCASFLAGS =
+
+.PHONY: test-objs
+check-local: test-objs
+test-objs:
+       find -name '*.$(OBJEXT)' > o.lst && cat o.lst
+       test -f src/a.$(OBJEXT)
+       test -f b.$(OBJEXT)
+       test -f src/libbar_a-c.$(OBJEXT)
+       test -f libbar_a-d.$(OBJEXT)
+       test $$(wc -l <o.lst) -eq 4
+       rm -f o.lst
 END
 
 mkdir src
@@ -50,6 +57,7 @@ $AUTOMAKE -a
 
 ./configure
 $MAKE
+$MAKE test-objs
 $MAKE distcheck
 
 :
diff --git a/t/subobj11a.sh b/t/subobj11a.sh
index 3dbf52b..6fea19a 100755
--- a/t/subobj11a.sh
+++ b/t/subobj11a.sh
@@ -41,7 +41,6 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = foo
 ## The './/' below is meant.
 foo_SOURCES = .//src/foo.c
diff --git a/t/subobj4.sh b/t/subobj4.sh
deleted file mode 100755
index 6a3d221..0000000
--- a/t/subobj4.sh
+++ /dev/null
@@ -1,53 +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/>.
-
-# Make sure '../foo/foo.cpp' generates a rule.
-# Report from Dave Brolley.
-
-. ./defs || Exit 1
-
-cat >> configure.ac << 'END'
-AC_PROG_CC
-AM_PROG_CC_C_O
-AC_PROG_CXX
-AC_CONFIG_FILES([d1/Makefile d2/Makefile])
-AC_OUTPUT
-END
-
-mkdir d1 d2
-
-cat > Makefile.am << 'END'
-SUBDIRS = d1 d2
-END
-
-cat > d1/Makefile.am << 'END'
-bin_PROGRAMS = z
-z_SOURCES = ../d2/z.c
-END
-
-cat > d2/Makefile.am << 'END'
-END
-
-: > compile
-: > d2/z.c
-
-$ACLOCAL
-$AUTOMAKE
-
-grep '^z\.o:.* \.\./d2/z\.c *$' d1/Makefile.in
-grep "@address@hidden'\"]../d2/z.c['\"] " d1/Makefile.in
-
-:
diff --git a/t/subobj5.sh b/t/subobj5.sh
index 32b4049..c6e2e51 100755
--- a/t/subobj5.sh
+++ b/t/subobj5.sh
@@ -28,7 +28,6 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = wish
 wish_SOURCES = generic/a.c
 
diff --git a/t/subobj8.sh b/t/subobj8.sh
index 35b566f..6ab39d3 100755
--- a/t/subobj8.sh
+++ b/t/subobj8.sh
@@ -14,7 +14,8 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Make sure 'compile' is included when subdir-objects is used in a subdir.
+# Make sure 'compile' is included when subdir objects are used in a
+# subdir.
 
 . ./defs || Exit 1
 
@@ -35,7 +36,6 @@ SUBDIRS = foo
 END
 
 cat > foo/Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = mumble
 mumble_SOURCES = bar/a.c
 END
diff --git a/t/subobj9.sh b/t/subobj9.sh
index f706edf..12d83b5 100755
--- a/t/subobj9.sh
+++ b/t/subobj9.sh
@@ -25,13 +25,10 @@
 required='c++ libtoolize'
 . ./defs || Exit 1
 
-cat > configure.ac << END
-AC_INIT([$me], [1.0])
-AM_INIT_AUTOMAKE([subdir-objects])
+cat >> configure.ac << END
 AC_PROG_CXX
 AM_PROG_AR
 AM_PROG_LIBTOOL
-AC_CONFIG_FILES([Makefile])
 AC_OUTPUT
 END
 
@@ -60,7 +57,6 @@ int doit2 (void)
 }
 END
 
-
 libtoolize --force
 $ACLOCAL
 $AUTOCONF
diff --git a/t/subpkg-yacc.sh b/t/subpkg-yacc.sh
index 9d7ad88..022e653 100755
--- a/t/subpkg-yacc.sh
+++ b/t/subpkg-yacc.sh
@@ -20,13 +20,17 @@
 required='cc yacc'
 . ./defs || Exit 1
 
-cat >>configure.ac <<'END'
+cat > configure.ac <<'END'
+AC_INIT([suya], [0.5a], address@hidden)
+AM_INIT_AUTOMAKE([foreign -Wall])
 AC_PROG_CC
+AC_CONFIG_FILES([GNUmakefile])
 AC_CONFIG_SUBDIRS([lib])
 AC_OUTPUT
 END
 
-cat >Makefile.am <<'EOF'
+cat >GNUmakefile.am <<'EOF'
+AUTOMAKE_OPTIONS = -Wno-override
 SUBDIRS = lib
 bin_PROGRAMS = MU
 MU_LDADD = lib/liblib.a
@@ -55,6 +59,7 @@ AC_PROG_RANLIB
 AC_PROG_YACC
 dnl This comes after YACC and RANLIB checks, deliberately.
 AC_PROG_CC
+AM_PROG_CC_C_O
 AM_PROG_AR
 AC_CONFIG_HEADERS([config.h:config.hin])
 AC_CONFIG_FILES([Makefile])
@@ -107,14 +112,16 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE -Wno-override
+$AUTOMAKE
 
+test ! -f compile
 cd lib
 $ACLOCAL
 $AUTOCONF
 $AUTOHEADER
-$AUTOMAKE -Wno-override --add-missing
+$AUTOMAKE --add-missing
 cd ..
+test -f compile
 
 ./configure
 
diff --git a/t/subpkg.sh b/t/subpkg.sh
index 82bf338..18d3e20 100755
--- a/t/subpkg.sh
+++ b/t/subpkg.sh
@@ -23,7 +23,8 @@ mkdir m4
 
 cat >m4/foo.m4 <<'EOF'
 AC_DEFUN([FOO],[
-  AC_PROG_CC
+  AC_REQUIRE([AC_PROG_CC])
+  AC_REQUIRE([AM_PROG_CC_C_O])
   AC_OUTPUT
 ])
 EOF
@@ -92,6 +93,8 @@ int lib (void)
 }
 EOF
 
+cp "$am_scriptdir"/compile .
+
 $ACLOCAL -I m4
 $AUTOCONF
 $AUTOMAKE -Wno-override
@@ -104,7 +107,10 @@ $AUTOHEADER
 $AUTOMAKE -Wno-override --add-missing
 cd ..
 
-./configure
+./configure >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep '^checking whether cc understands -c and -o together' stdout
+
 $MAKE
 $MAKE distcheck
 test ! -d subpack-1 # Make sure distcheck cleans up after itself.
diff --git a/t/suffix-custom-subobj.sh b/t/suffix-custom-subobj.sh
index daaa5c7..54b6eff 100755
--- a/t/suffix-custom-subobj.sh
+++ b/t/suffix-custom-subobj.sh
@@ -26,7 +26,6 @@ AC_OUTPUT
 EOF
 
 cat >Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
 # We fake here:
 %.o: %.baz
        cp $< $@
diff --git a/t/suffix13.sh b/t/suffix13.sh
index f1d3b41..7917838 100755
--- a/t/suffix13.sh
+++ b/t/suffix13.sh
@@ -27,7 +27,6 @@ AC_OUTPUT
 EOF
 
 cat >Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
 %.c: %.baz
        test -d $(@D) || $(MKDIR_P) $(@D)
        cp $< $@
@@ -53,18 +52,9 @@ END
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
-./configure
-$MAKE
-
-$MAKE distcheck
-$MAKE distclean
-
-# Should also work without subdir-objects.
 
-sed '/subdir-objects/d' < Makefile.am > t
-mv -f t Makefile.am
-$AUTOMAKE
 ./configure
+
 $MAKE
 $MAKE distcheck
 
diff --git a/t/vala3.sh b/t/vala3.sh
index 0306290..6de68f8 100755
--- a/t/vala3.sh
+++ b/t/vala3.sh
@@ -55,44 +55,25 @@ grep PKG_CHECK_MODULES configure && skip_ "pkg-config m4 
macros not found"
 ./configure
 $MAKE
 test -f src/zardoz.c
+# FIXME: having 'src/zardoz_vala.stamp' should be more appropriate here.
 test -f src_zardoz_vala.stamp
 $MAKE distcheck
 $MAKE maintainer-clean
 test ! -f src/zardoz.c
+# FIXME: having 'src/zardoz_vala.stamp' should be more appropriate here.
 test ! -f src_zardoz_vala.stamp
 
 mkdir build
 cd build
 ../configure
 $MAKE
+test -f ../src/zardoz.c
+# FIXME: having 'src/zardoz_vala.stamp' should be more appropriate here.
+test -f ../src_zardoz_vala.stamp
 $MAKE distcheck
+$MAKE maintainer-clean
+test ! -f src/zardoz.c
+# FIXME: having 'src/zardoz_vala.stamp' should be more appropriate here.
+test ! -f src_zardoz_vala.stamp
 
-cd ..
-rm -rf build
-
-# Try again with subdir-objects.
-
-cat > 'Makefile.am' <<'END'
-AUTOMAKE_OPTIONS = subdir-objects
-
-bin_PROGRAMS = src/zardoz
-src_zardoz_CFLAGS = $(GOBJECT_CFLAGS)
-src_zardoz_LDADD = $(GOBJECT_LIBS)
-src_zardoz_SOURCES = src/zardoz.vala
-END
-
-$ACLOCAL
-$AUTOCONF
-$AUTOMAKE -a
-
-./configure || skip_ "configure failure"
-$MAKE
-$MAKE distcheck
-$MAKE distclean
-mkdir build
-cd build
-../configure
-$MAKE
-$MAKE distcheck
-
-
+:
diff --git a/t/warning-groups-win-over-strictness.sh 
b/t/warning-groups-win-over-strictness.sh
index 70b8b7a..e275131 100755
--- a/t/warning-groups-win-over-strictness.sh
+++ b/t/warning-groups-win-over-strictness.sh
@@ -38,7 +38,6 @@ AC_OUTPUT
 END
 
 cat > Makefile.am <<END
-AUTOMAKE_OPTIONS = subdir-objects
 include automake-options.am
 noinst_PROGRAMS = foo
 foo_SOURCES = sub/foo.c
@@ -49,7 +48,7 @@ rm -rf autom4te*.cache
 echo 'AM_INIT_AUTOMAKE' > am-init-automake.m4
 $ACLOCAL
 AUTOMAKE_fails -Werror -Wall --foreign
-grep '^Makefile\.am:4:.*sub/foo\.c.*requires.*AM_PROG_CC_C_O' stderr
+grep '^Makefile\.am:3:.*sub/foo\.c.*requires.*AM_PROG_CC_C_O' stderr
 
 rm -rf autom4te*.cache
 : > automake-options.am
@@ -58,7 +57,7 @@ $ACLOCAL
 $AUTOMAKE
 
 rm -rf autom4te*.cache
-echo 'AUTOMAKE_OPTIONS += -Werror -Wnone gnits' > automake-options.am
+echo 'AUTOMAKE_OPTIONS = -Werror -Wnone gnits' > automake-options.am
 echo 'AM_INIT_AUTOMAKE' > am-init-automake.m4
 $ACLOCAL
 $AUTOMAKE
diff --git a/t/warnings-override.sh b/t/warnings-override.sh
index 956bf81..a487ffa 100755
--- a/t/warnings-override.sh
+++ b/t/warnings-override.sh
@@ -29,7 +29,7 @@ AUTOMAKE="$am_original_AUTOMAKE -Werror"
 set_warnings ()
 {
   set +x
-  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *+=.*|\\1 += $1|" \
+  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
                 -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
   mv -f $2-t $2
   set -x
@@ -44,15 +44,13 @@ ok ()
 ko ()
 {
   AUTOMAKE_fails $*
-  grep '^Makefile\.am:5:.*sub/foo\.c.*requires.*AM_PROG_CC_C_O' stderr
+  grep '^Makefile\.am:.*sub/foo\.c.*requires.*AM_PROG_CC_C_O' stderr
 }
 
 echo AC_PROG_CC >> configure.ac
 
 cat > Makefile.am <<END
-AUTOMAKE_OPTIONS = subdir-objects
-## For later editing by 'set_am_opts'.
-AUTOMAKE_OPTIONS +=
+AUTOMAKE_OPTIONS = ## For later editing by 'set_am_opts'.
 noinst_PROGRAMS = foo
 foo_SOURCES = sub/foo.c
 END
diff --git a/t/warnings-precedence.sh b/t/warnings-precedence.sh
index 715e294..53705e4 100755
--- a/t/warnings-precedence.sh
+++ b/t/warnings-precedence.sh
@@ -26,7 +26,7 @@ AUTOMAKE="$am_original_AUTOMAKE -Werror"
 set_warnings ()
 {
   set +x
-  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *+=.*|\\1 += $1|" \
+  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
                 -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
   mv -f $2-t $2
   set -x
@@ -41,7 +41,7 @@ ok ()
 ko ()
 {
   AUTOMAKE_fails $*
-  grep '^Makefile\.am:5:.*sub/foo\.c.*requires.*AM_PROG_CC_C_O' stderr
+  grep '^Makefile\.am:.*sub/foo\.c.*requires.*AM_PROG_CC_C_O' stderr
 }
 
 # Files required in gnu strictness.
@@ -50,9 +50,7 @@ touch README INSTALL NEWS AUTHORS ChangeLog COPYING
 echo AC_PROG_CC >> configure.ac
 
 cat > Makefile.am <<END
-AUTOMAKE_OPTIONS = subdir-objects
-## For later editing by 'set_warnings'.
-AUTOMAKE_OPTIONS +=
+AUTOMAKE_OPTIONS = ## For later editing by 'set_warnings'.
 noinst_PROGRAMS = foo
 foo_SOURCES = sub/foo.c
 END
diff --git a/t/warnings-strictness-interactions.sh 
b/t/warnings-strictness-interactions.sh
index c5e70e6..612c019 100755
--- a/t/warnings-strictness-interactions.sh
+++ b/t/warnings-strictness-interactions.sh
@@ -24,11 +24,10 @@
 AUTOMAKE="$am_original_AUTOMAKE -Werror"
 
 echo AC_PROG_CC >> configure.ac
+$ACLOCAL
 
 cat > Makefile.am <<END
-AUTOMAKE_OPTIONS = subdir-objects
-## For later editing by 'set_am_opts'.
-AUTOMAKE_OPTIONS +=
+AUTOMAKE_OPTIONS = ## For later editing by 'set_am_opts'.
 noinst_PROGRAMS = foo
 foo_SOURCES = sub/foo.c
 END
@@ -36,7 +35,7 @@ END
 set_am_opts ()
 {
   set +x
-  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *+=.*|\\1 += $1|" \
+  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
                 -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
   mv -f $2-t $2
   set -x
@@ -46,7 +45,6 @@ set_am_opts ()
 set_am_opts '-Wportability' configure.ac
 set_am_opts 'foreign' Makefile.am
 
-$ACLOCAL
 $AUTOMAKE
 
 rm -rf autom4te*.cache
@@ -58,6 +56,6 @@ set_am_opts '-Wno-portability' configure.ac
 set_am_opts 'gnu' Makefile.am
 
 AUTOMAKE_fails
-grep '^Makefile\.am:5:.*sub/foo\.c.*requires.*AM_PROG_CC_C_O' stderr
+grep '^Makefile\.am:.*sub/foo\.c.*requires.*AM_PROG_CC_C_O' stderr
 
 :
diff --git a/t/warnings-win-over-strictness.sh 
b/t/warnings-win-over-strictness.sh
index 4deb27d..e9534f5 100755
--- a/t/warnings-win-over-strictness.sh
+++ b/t/warnings-win-over-strictness.sh
@@ -38,7 +38,7 @@ ko ()
 set_am_opts ()
 {
   set +x
-  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *+=.*|\\1 += $1|" \
+  sed <$2 >$2-t -e "s|^\\(AUTOMAKE_OPTIONS\\) *=.*|\\1 = $1|" \
                 -e "s|^\\(AM_INIT_AUTOMAKE\\).*|\\1([$1])|"
   mv -f $2-t $2
   set -x
@@ -49,17 +49,14 @@ set_am_opts ()
 touch README INSTALL NEWS AUTHORS ChangeLog COPYING
 
 echo AC_PROG_CC >> configure.ac
+$ACLOCAL
 
 cat > Makefile.am <<END
-AUTOMAKE_OPTIONS = subdir-objects
-## For later editing by 'set_am_opts'.
-AUTOMAKE_OPTIONS +=
+AUTOMAKE_OPTIONS = ## For later editing by 'set_am_opts'.
 noinst_PROGRAMS = foo
 foo_SOURCES = sub/foo.c
 END
 
-$ACLOCAL
-
 ko --foreign -Wportability
 ko -Wportability --foreign
 ok --gnu -Wno-portability
diff --git a/t/xsource.sh b/t/xsource.sh
index 5f89dc9..677670f 100755
--- a/t/xsource.sh
+++ b/t/xsource.sh
@@ -21,18 +21,22 @@
 
 cat > Makefile.am << 'END'
 bin_PROGRAMS = zardoz
-zardoz_SOURCES = z.c x/z.c
+lib_LTLIBRARIES = libfoo.la
+zardoz_SOURCES = z.c
+libfoo_la_SOURCES = z.c
 END
 
+: > ltmain.sh
+: > config.guess
+: > config.sub
+
 cat >> configure.ac << 'END'
 AC_PROG_CC
+AC_SUBST([LIBTOOL], [unused])
 END
 
-mkdir x
-
-: > z.c
-: > x/z.c
-
 $ACLOCAL
 AUTOMAKE_fails
-$FGREP 'z.$(OBJEXT)' stderr
+$FGREP "object 'z.\$(OBJEXT)' created both with libtool and without" stderr
+
+:
diff --git a/t/yacc-d-cxx.sh b/t/yacc-d-cxx.sh
index d4c4af2..34970f8 100755
--- a/t/yacc-d-cxx.sh
+++ b/t/yacc-d-cxx.sh
@@ -114,7 +114,6 @@ write_main parse.hpp > bar/main.cpp
 
 # Try with -d in $(AM_YFLAGS), and a subdir parser.
 cat >> baz/Makefile.am <<END
-AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = joe
 joe_SOURCES = sub/parse.y++ sub/main.c++
 BUILT_SOURCES = sub/parse.h++
diff --git a/t/yacc-dist-nobuild-subdir.sh b/t/yacc-dist-nobuild-subdir.sh
index 94fb07c..0e8612f 100755
--- a/t/yacc-dist-nobuild-subdir.sh
+++ b/t/yacc-dist-nobuild-subdir.sh
@@ -15,8 +15,7 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Check that VPATH builds and "make distcheck" works with packages
-# using yacc and the automake 'subdir-objects' option.
-# Exposes automake bug#8485.
+# using yacc sources in a subdir option.  Exposes automake bug#8485.
 
 required='cc yacc'
 . ./defs || Exit 1
@@ -45,7 +44,6 @@ int main (void)
 END
 
 cat > Makefile.am <<'END'
-AUTOMAKE_OPTIONS = subdir-objects
 noinst_PROGRAMS = foo bar
 foo_SOURCES = sub/parse.y
 bar_SOURCES = $(foo_SOURCES)
diff --git a/t/yacc-line.sh b/t/yacc-line.sh
index 23b5a1b..1d536ee 100755
--- a/t/yacc-line.sh
+++ b/t/yacc-line.sh
@@ -15,38 +15,27 @@
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
 # Check that automake yacc support ensures that yacc-generated C
-# files use correct "#line" directives.  Try also with the
-# 'subdir-object' option enabled.
+# files use correct "#line" directives.
 # See also sister test 'lex-line.test'.
 
 required='cc yacc'
 . ./defs || Exit 1
 
 cat >> configure.ac << 'END'
-AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
 AM_PROG_CC_C_O
 AC_PROG_YACC
 AC_OUTPUT
 END
 
-mkdir dir sub sub/dir
+mkdir dir
 
 cat > Makefile.am << 'END'
-SUBDIRS = sub
-bin_PROGRAMS = foo bar
-AM_YFLAGS = -d
-bar_YFLAGS =
-foo_SOURCES = zardoz.y
-bar_SOURCES = dir/quux.y
-END
-
-cat > sub/Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
-noinst_PROGRAMS = foo bar
-foo_YFLAGS = -d
+noinst_PROGRAMS = foo bar baz
+baz_YFLAGS = -d
 foo_SOURCES = zardoz.y
 bar_SOURCES = dir/quux.y
+baz_SOURCES = zardoz.y
 END
 
 cat > zardoz.y << 'END'
@@ -64,10 +53,8 @@ int main(void)
 END
 
 cp zardoz.y dir/quux.y
-cp zardoz.y sub/zardoz.y
-cp zardoz.y sub/dir/quux.y
 
-c_outputs='zardoz.c bar-quux.c sub/foo-zardoz.c sub/dir/quux.c'
+c_outputs='zardoz.c dir/quux.c baz-zardoz.c'
 
 $ACLOCAL
 $AUTOCONF
@@ -87,7 +74,7 @@ for vpath in : false; do
   $MAKE
 
   # For debugging,
-  ls -l . sub sub/dir
+  ls -l . dir
   $EGREP 'line|\.y' $c_outputs
 
   # Adjusted "#line" should not contain reference to the builddir.
@@ -102,14 +89,12 @@ for vpath in : false; do
   grep "#.*\.y.*\.y" $c_outputs && Exit 1
   if $vpath; then
     grep '#.*line.*"\.\./zardoz\.y"' zardoz.c
-    grep '#.*line.*"\.\./dir/quux\.y"' bar-quux.c
-    grep '#.*line.*"\.\./\.\./sub/zardoz\.y"' sub/foo-zardoz.c
-    grep '#.*line.*"\.\./\.\./sub/dir/quux\.y"' sub/dir/quux.c
+    grep '#.*line.*"\.\./zardoz\.y"' baz-zardoz.c
+    grep '#.*line.*"\.\./dir/quux\.y"' dir/quux.c
   else
     grep '#.*line.*"zardoz\.y"' zardoz.c
-    grep '#.*line.*"dir/quux\.y"' bar-quux.c
-    grep '#.*line.*"zardoz\.y"' sub/foo-zardoz.c
-    grep '#.*line.*"dir/quux\.y"' sub/dir/quux.c
+    grep '#.*line.*"zardoz\.y"' baz-zardoz.c
+    grep '#.*line.*"dir/quux\.y"' dir/quux.c
   fi
 
   cd $srcdir
diff --git a/t/yacc-subobj-nodep.sh b/t/yacc-subobj-nodep.sh
index 80783a1..e0c415f 100755
--- a/t/yacc-subobj-nodep.sh
+++ b/t/yacc-subobj-nodep.sh
@@ -14,7 +14,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Ensure subdirs for subdir parsers are generated when subdir-objects
+# Ensure subdirs for subdir parsers are generated when subdir objects
 # are used, even when dependency tracking is disabled.
 
 required='cc yacc'
@@ -22,7 +22,7 @@ required='cc yacc'
 
 cat >configure.ac <<END
 AC_INIT([$me], [1.0])
-AM_INIT_AUTOMAKE([no-dependencies subdir-objects])
+AM_INIT_AUTOMAKE([no-dependencies])
 AC_CONFIG_FILES([Makefile])
 AC_PROG_CC
 AM_PROG_CC_C_O
diff --git a/t/yacc5.sh b/t/yacc5.sh
index ab24b56..b24dcd3 100755
--- a/t/yacc5.sh
+++ b/t/yacc5.sh
@@ -25,55 +25,31 @@ AM_PROG_CC_C_O
 AC_PROG_YACC
 END
 
-cat > Makefile.am << 'END'
-bin_PROGRAMS = maude
-maude_SOURCES = sub/maude.y
-END
-
-mkdir sub
-
-: > sub/maude.y
-
 $ACLOCAL
-$AUTOMAKE -a
-
-grep '^maude\.c:.*maude\.y' Makefile.in
-
-
-## Try again with subdir-objects.
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = maude
 maude_SOURCES = sub/maude.y
 END
-
-$ACLOCAL
 $AUTOMAKE -a
-
 # No rule needed, the default .y.c: inference rule is enough
 # (but there may be an additional dependency on a dirstamp file).
 grep '^sub/maude\.c:.*maude\.y' Makefile.in && Exit 1
 
-
 ## Try again with per-exe flags.
 
 cat > Makefile.am << 'END'
 bin_PROGRAMS = maude
 maude_SOURCES = sub/maude.y
-## A particularly trickey case.
+## A particularly tricky case.
 maude_YFLAGS = -d
 END
-
-$ACLOCAL
 $AUTOMAKE -a
-
+grep '^sub/maude-maude\.c:.*sub/maude\.y' Makefile.in
 # Rule should use maude_YFLAGS.
 grep 'AM_YFLAGS.*maude' Makefile.in && Exit 1
-
 # Silly regression.
 grep 'maudec' Makefile.in && Exit 1
-
 # Make sure the .o file is required.
 grep '^am_maude_OBJECTS.*maude' Makefile.in
 
diff --git a/t/yacc8.sh b/t/yacc8.sh
index bab627d..35c3133 100755
--- a/t/yacc8.sh
+++ b/t/yacc8.sh
@@ -28,7 +28,6 @@ AC_OUTPUT
 END
 
 cat > Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
 bin_PROGRAMS = foo/foo
 foo_foo_SOURCES = foo/parse.y
 AM_YFLAGS = -d


hooks/post-receive
-- 
GNU Automake



reply via email to

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