automake-patches
[Top][All Lists]
Advanced

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

[PATCH 02/11] subdir-objects: enable unconditionally


From: Stefano Lattarini
Subject: [PATCH 02/11] subdir-objects: enable unconditionally
Date: Sat, 12 Jan 2013 13:51:55 +0100

See automake bug#13378.

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.

This change is basically an adjusted backport of Automake-NG commit
'v1.12.1-313-g14fe163' of 2012-06-07, "[ng] subdir-objects: enable
unconditionally".

* NEWS: Update.
* doc/automake.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_lex_rewrite): Adjust.  Don't test whether the option
'subdir-objects' is set (just assume it is).
(lang_yacc_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.
* t/ax/depcomp.sh: Adjust.
* t/compile_f_c_cxx.sh: Likewise.
* t/cscope.tap: Likewise.
* t/depcomp8a.sh: Likewise.
* t/depcomp8b.sh: Likewise.
* t/libtool3.sh: Likewise.
* t/ltlibsrc.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/parallel-tests-suffix-prog.sh: Likewise.
* t/yacc5.sh: Likewise.
* t/vala-libs.sh: Likewise.
* t/fort2.sh: Likewise, and extend a bit.
* t/fort4.sh: Likewise.
* 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/subobj4.sh: Remove as obsolete.
* t/sourcefile-in-subdir.sh: Likewise.

Signed-off-by: Stefano Lattarini <address@hidden>
---
 NEWS                            | 14 ++++++++
 automake.in                     | 72 ++++++++++++-----------------------------
 doc/automake.texi               | 32 ++++--------------
 lib/am/depend2.am               | 24 ++++++--------
 t/ax/depcomp.sh                 |  6 ++--
 t/compile_f_c_cxx.sh            | 14 ++++++--
 t/cscope.tap                    |  2 ++
 t/depcomp8a.sh                  | 19 +----------
 t/depcomp8b.sh                  | 20 +-----------
 t/fort2.sh                      | 56 ++++++++++++++++++++++++--------
 t/fort4.sh                      | 39 +++++++++++++---------
 t/fort5.sh                      | 15 ++++-----
 t/gcj.sh                        | 37 ++++++++++++++++++---
 t/lex-line.sh                   | 32 +++---------------
 t/libobj20a.sh                  | 45 --------------------------
 t/libobj20b.sh                  |  2 +-
 t/libobj20c.sh                  |  2 +-
 t/libtool3.sh                   | 11 +++----
 t/list-of-tests.mk              |  3 --
 t/ltlibsrc.sh                   |  2 +-
 t/parallel-tests-suffix-prog.sh |  1 +
 t/pr401.sh                      | 11 -------
 t/pr401b.sh                     |  9 ------
 t/pr401c.sh                     | 10 ------
 t/sourcefile-in-subdir.sh       | 36 ---------------------
 t/subobj4.sh                    | 50 ----------------------------
 t/subpkg-yacc.sh                | 14 ++++++--
 t/subpkg.sh                     | 10 ++++--
 t/vala-libs.sh                  |  2 +-
 t/xsource.sh                    | 18 +++++++----
 t/yacc-grepping2.sh             | 28 ++--------------
 t/yacc-line.sh                  | 45 +++++++-------------------
 32 files changed, 234 insertions(+), 447 deletions(-)
 delete mode 100755 t/libobj20a.sh
 delete mode 100755 t/sourcefile-in-subdir.sh
 delete mode 100755 t/subobj4.sh

diff --git a/NEWS b/NEWS
index 09bfc1e..ff22524 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,17 @@
+New in 1.14:
+
+* 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'.  Put in another way, Automake 1.14
+   and later will *unconditionally* behave as older Automake versions did
+   when the 'subdir-objects' option was given.
+
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
 New in 1.13.2:
 
 * WARNING: Future backward-incompatibilities!
diff --git a/automake.in b/automake.in
index 990b60d..71a7feb 100644
--- a/automake.in
+++ b/automake.in
@@ -270,7 +270,6 @@ my $gen_copyright = "\
 # 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
@@ -1382,7 +1381,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,
@@ -1398,9 +1396,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.
@@ -1425,8 +1421,7 @@ sub handle_languages
            # Plo, TPlo will be added later as appropriate).  It is
            # either hardcoded, or a shell variable ('$depbase') that
            # will be computed by the rule.
-           my $depbase =
-             option ('subdir-objects') ? '$$depbase' : '$(DEPDIR)/$*';
+           my $depbase = '$$depbase';
            $output_rules .=
              file_contents ($rule_file,
                             new Automake::Location,
@@ -1445,8 +1440,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
@@ -1683,10 +1677,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 ! /^(?:(.*)\/)?([^\/]*)($KNOWN_EXTENSIONS_PATTERN)$/;
        my $full = $_;
@@ -1738,7 +1728,7 @@ sub handle_single_transform ($$$$$%)
            # generates another source file which we must then process
            # further.
            my $subr = \&{'lang_' . $lang->name . '_rewrite'};
-           defined &$subr or $subr = \&lang_sub_obj;
+            defined &$subr or $subr = sub { return LANG_SUBDIR; };
            my ($r, $source_extension)
                = &$subr ($directory, $base, $extension,
                          $obj, $have_per_exec_flags, $var);
@@ -1802,11 +1792,7 @@ sub handle_single_transform ($$$$$%)
            # 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.
            #
            # The latter case deserves a historical note.  When the
@@ -1828,7 +1814,6 @@ sub handle_single_transform ($$$$$%)
            # with GNU make, Solaris make, Ultrix make, BSD make,
            # HP-UX make, and OSF1 make successfully.
            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'}))
@@ -1895,6 +1880,8 @@ sub handle_single_transform ($$$$$%)
            next;
        }
 
+        # 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);
@@ -2281,27 +2268,19 @@ 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 = backname ($relative_dir) . "/$dir"
-           if $relative_dir ne '.';
-         define_variable ('LIBOBJDIR', "$dir", INTERNAL);
-         $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 = backname ($relative_dir) . "/$dir"
+      if $relative_dir ne '.';
+      define_variable ('LIBOBJDIR', "$dir", INTERNAL);
+      $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;
@@ -5592,13 +5571,6 @@ sub check_gnits_standards
 # 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 header file.
 sub lang_header_rewrite
 {
@@ -5620,9 +5592,8 @@ sub lang_yacc_rewrite
 {
     my ($directory, $base, $ext) = @_;
 
-    my $r = &lang_sub_obj;
     (my $newext = $ext) =~ tr/y/c/;
-    return ($r, $newext);
+    return (LANG_SUBDIR, $newext);
 }
 sub lang_yaccxx_rewrite { lang_yacc_rewrite (@_); };
 
@@ -5631,9 +5602,8 @@ sub lang_lex_rewrite
 {
     my ($directory, $base, $ext) = @_;
 
-    my $r = &lang_sub_obj;
     (my $newext = $ext) =~ tr/l/c/;
-    return ($r, $newext);
+    return (LANG_SUBDIR, $newext);
 }
 sub lang_lexxx_rewrite { lang_lex_rewrite (@_); };
 
diff --git a/doc/automake.texi b/doc/automake.texi
index a333a1c..97c4a6e 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -5644,18 +5644,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
@@ -6049,19 +6044,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{}
@@ -10241,15 +10232,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}.
-
 @anchor{tar-formats}
 @item @option{tar-v7}
 @itemx @option{tar-ustar}
diff --git a/lib/am/depend2.am b/lib/am/depend2.am
index 5c6439a..a13379a 100644
--- a/lib/am/depend2.am
+++ b/lib/am/depend2.am
@@ -40,11 +40,9 @@ if %FASTDEP%
 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
 ?!GENERIC?     %VERBOSE%%COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o 
%OBJ% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
 ?!GENERIC?     %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
-?GENERIC??!SUBDIROBJ?  %VERBOSE%%COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo 
%-c% -o %OBJ% %SOURCEFLAG%%SOURCE%
-?GENERIC??!SUBDIROBJ?  %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
-?GENERIC??SUBDIROBJ?   %VERBOSE%depbase=`echo %OBJ% | sed 
's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
-?GENERIC??SUBDIROBJ?   %COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o 
%OBJ% %SOURCEFLAG%%SOURCE% &&\
-?GENERIC??SUBDIROBJ?   $(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
+?GENERIC?      %VERBOSE%depbase=`echo %OBJ% | sed 
's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
+?GENERIC?      %COMPILE% -MT %OBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o %OBJ% 
%SOURCEFLAG%%SOURCE% &&\
+?GENERIC?      $(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
 else !%FASTDEP%
 if %AMDEP%
        %VERBOSE%source='%SOURCE%' object='%OBJ%' libtool=no @AMDEPBACKSLASH@
@@ -67,11 +65,9 @@ if %FASTDEP%
 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
 ?!GENERIC?     %VERBOSE%%COMPILE% -MT %OBJOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% 
-o %OBJOBJ% %SOURCEFLAG%`if test -f '%SOURCE%'; then $(CYGPATH_W) '%SOURCE%'; 
else $(CYGPATH_W) '$(srcdir)/%SOURCE%'; fi`
 ?!GENERIC?     %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
-?GENERIC??!SUBDIROBJ?  %VERBOSE%%COMPILE% -MT %OBJOBJ% -MD -MP -MF 
%DEPBASE%.Tpo %-c% -o %OBJOBJ% %SOURCEFLAG%`$(CYGPATH_W) '%SOURCE%'`
-?GENERIC??!SUBDIROBJ?  %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
-?GENERIC??SUBDIROBJ?   %VERBOSE%depbase=`echo %OBJ% | sed 
's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
-?GENERIC??SUBDIROBJ?   %COMPILE% -MT %OBJOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% 
-o %OBJOBJ% %SOURCEFLAG%`$(CYGPATH_W) '%SOURCE%'` &&\
-?GENERIC??SUBDIROBJ?   $(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
+?GENERIC?      %VERBOSE%depbase=`echo %OBJ% | sed 
's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\
+?GENERIC?      %COMPILE% -MT %OBJOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o 
%OBJOBJ% %SOURCEFLAG%`$(CYGPATH_W) '%SOURCE%'` &&\
+?GENERIC?      $(am__mv) %DEPBASE%.Tpo %DEPBASE%.Po
 else !%FASTDEP%
 if %AMDEP%
        %VERBOSE%source='%SOURCE%' object='%OBJOBJ%' libtool=no @AMDEPBACKSLASH@
@@ -96,11 +92,9 @@ if %FASTDEP%
 ## For non-suffix rules, we must emulate a VPATH search on %SOURCE%.
 ?!GENERIC?     %VERBOSE%%LTCOMPILE% -MT %LTOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% 
-o %LTOBJ% %SOURCEFLAG%`test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
 ?!GENERIC?     %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Plo
-?GENERIC??!SUBDIROBJ?  %VERBOSE%%LTCOMPILE% -MT %LTOBJ% -MD -MP -MF 
%DEPBASE%.Tpo %-c% -o %LTOBJ% %SOURCEFLAG%%SOURCE%
-?GENERIC??!SUBDIROBJ?  %SILENT%$(am__mv) %DEPBASE%.Tpo %DEPBASE%.Plo
-?GENERIC??SUBDIROBJ?   %VERBOSE%depbase=`echo %OBJ% | sed 
's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
-?GENERIC??SUBDIROBJ?   %LTCOMPILE% -MT %LTOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% 
-o %LTOBJ% %SOURCEFLAG%%SOURCE% &&\
-?GENERIC??SUBDIROBJ?   $(am__mv) %DEPBASE%.Tpo %DEPBASE%.Plo
+?GENERIC?      %VERBOSE%depbase=`echo %OBJ% | sed 
's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\
+?GENERIC?      %LTCOMPILE% -MT %LTOBJ% -MD -MP -MF %DEPBASE%.Tpo %-c% -o 
%LTOBJ% %SOURCEFLAG%%SOURCE% &&\
+?GENERIC?      $(am__mv) %DEPBASE%.Tpo %DEPBASE%.Plo
 else !%FASTDEP%
 if %AMDEP%
        %VERBOSE%source='%SOURCE%' object='%LTOBJ%' libtool=yes @AMDEPBACKSLASH@
diff --git a/t/ax/depcomp.sh b/t/ax/depcomp.sh
index 0e5b6a5..10fd6e9 100644
--- a/t/ax/depcomp.sh
+++ b/t/ax/depcomp.sh
@@ -199,12 +199,12 @@ ${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
diff --git a/t/compile_f_c_cxx.sh b/t/compile_f_c_cxx.sh
index a0b0e21..2562d7d 100755
--- a/t/compile_f_c_cxx.sh
+++ b/t/compile_f_c_cxx.sh
@@ -38,9 +38,17 @@ END
 $ACLOCAL
 $AUTOMAKE
 
+$FGREP COMPILE Makefile.in # For debugging.
+
 # Look for the macros at the beginning of rules.
-$FGREP "$tab\$(AM_V_CC)\$(COMPILE)"     Makefile.in
-$FGREP "$tab\$(AM_V_CXX)\$(CXXCOMPILE)" Makefile.in
-$FGREP "$tab\$(AM_V_F77)\$(F77COMPILE)" Makefile.in
+sed < Makefile.in > mk \
+    -e 's|$(AM_V_CC)||g' \
+    -e 's|$(AM_V_CXX)||g' \
+    -e 's|$(AM_V_F77)||g'
+diff -u Makefile.in mk || : # For debugging.
+
+$FGREP "$tab\$(COMPILE)"    mk
+$FGREP "$tab\$(CXXCOMPILE)" mk
+$FGREP "$tab\$(F77COMPILE)" mk
 
 :
diff --git a/t/cscope.tap b/t/cscope.tap
index 29feec2..f0aaef0 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/depcomp8a.sh b/t/depcomp8a.sh
index 76aa376..72308a5 100755
--- a/t/depcomp8a.sh
+++ b/t/depcomp8a.sh
@@ -51,24 +51,7 @@ $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.
-
-echo AUTOMAKE_OPTIONS = subdir-objects >> Makefile.am
-
-$AUTOMAKE
-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
+LC_ALL=C grep 'include.*[^a-zA-Z0-9_/]sub/\$(DEPDIR)/bar\.P' Makefile.in
 $EGREP 'include.*/(\.|sub)/\$\(DEPDIR\)' Makefile.in && exit 1
 
 $AUTOCONF
diff --git a/t/depcomp8b.sh b/t/depcomp8b.sh
index 52382f1..c06c3c1 100755
--- a/t/depcomp8b.sh
+++ b/t/depcomp8b.sh
@@ -24,7 +24,6 @@ required='cc libtoolize'
 
 cat >> configure.ac << 'END'
 AC_PROG_CC
-#x AM_PROG_CC_C_O
 AM_PROG_AR
 AC_PROG_LIBTOOL
 AC_OUTPUT
@@ -44,24 +43,7 @@ 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.
-
-echo AUTOMAKE_OPTIONS = subdir-objects >> Makefile.am
-
-$AUTOMAKE
-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
+LC_ALL=C grep 'include.*[^a-zA-Z0-9_/]sub/\$(DEPDIR)/bar\.P' Makefile.in
 $EGREP 'include.*/(\.|sub)/\$\(DEPDIR\)' Makefile.in && exit 1
 
 $AUTOCONF
diff --git a/t/fort2.sh b/t/fort2.sh
index c99e8b7..40689cc 100755
--- a/t/fort2.sh
+++ b/t/fort2.sh
@@ -19,6 +19,7 @@
 
 # Cf. 'fort1.sh' and 'link_f90_only.sh'.
 
+required=gfortran # Required only in order to run ./configure.
 . test-init.sh
 
 mkdir sub
@@ -30,33 +31,62 @@ AC_FC_SRCEXT([f95])
 AC_FC_SRCEXT([f03])
 AC_FC_SRCEXT([f08])
 AC_FC_SRCEXT([blabla])
+AC_OUTPUT
 END
 
 cat >Makefile.am <<'END'
 bin_PROGRAMS = hello goodbye
-hello_SOURCES = hello.f90 foo.f95 sub/bar.f95 hi.f03 sub/howdy.f03 greets.f08 
sub/bonjour.f08
+hello_SOURCES = hello.f90 foo.f95 sub/bar.f95 hi.f03 sub/howdy.f03 \
+                greets.f08 sub/bonjour.f08
 goodbye_SOURCES = bye.f95 sub/baz.f90
-goodbye_FCFLAGS =
+goodbye_FCFLAGS = --gby
 END
 
 $ACLOCAL
 $AUTOMAKE
-# The following tests aren't fool-proof, but they don't
-# need a Fortran compiler.
 grep '.\$(LINK)'       Makefile.in && exit 1
 grep '.\$(FCLINK)'     Makefile.in
 grep '.\$(FCCOMPILE)'  Makefile.in > stdout
 cat stdout
 grep -v '\$(FCFLAGS_f' stdout && exit 1
 grep '.\$(FC.*\$(FCFLAGS_blabla' Makefile.in && exit 1
-# Notice the TAB:
-grep '^[       ].*\$(FC.*\$(FCFLAGS_f90).*\.f90' Makefile.in
-grep '^[       ].*\$(FC.*\$(FCFLAGS_f95).*\.f95' Makefile.in
-grep '^[       ].*\$(FC.*\$(FCFLAGS_f03).*\.f03' Makefile.in
-grep '^[       ].*\$(FC.*\$(FCFLAGS_f08).*\.f08' Makefile.in
-grep '^[       ].*\$(FC.*\$(FCFLAGS_f90).*\.f95' Makefile.in && exit 1
-grep '^[       ].*\$(FC.*\$(FCFLAGS_f95).*\.f90' Makefile.in && exit 1
-grep '^[       ].*\$(FC.*\$(FCFLAGS_f90).*\.f03' Makefile.in && exit 1
-grep '^[       ].*\$(FC.*\$(FCFLAGS_f08).*\.f90' Makefile.in && exit 1
+
+sed '/^AC_FC_SRCEXT.*blabla/d' configure.ac >t
+mv -f t configure.ac
+
+rm -rf autom4te*.cache
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure
+
+touch hello.f90 foo.f95 sub/bar.f95 hi.f03 sub/howdy.f03 greets.f08 \
+      sub/bonjour.f08 bye.f95 sub/baz.f90
+
+$MAKE -n FC=fake-fc \
+  address@hidden address@hidden address@hidden address@hidden \
+  > stdout || { cat stdout; exit 1; }
+cat stdout
+# To make it easier to have  stricter grepping below.
+sed -e 's/[    ][      ]*/  /g' -e 's/^/ /' -e 's/$/ /' stdout > out
+cat out
+
+grep ' fake-fc .* address@hidden .* hello\.f90 ' out
+grep ' fake-fc .* address@hidden .* foo\.f95 ' out
+grep ' fake-fc .* address@hidden .* sub/bar\.f95 ' out
+grep ' fake-fc .* address@hidden .* hi\.f03 ' out
+grep ' fake-fc .* address@hidden .* sub/howdy\.f03 ' out
+grep ' fake-fc .* address@hidden .* greets\.f08 ' out
+grep ' fake-fc .* address@hidden .* sub/bonjour\.f08 ' out
+grep ' fake-fc .* --gby .* address@hidden .*[` ]bye\.f95 ' out
+grep ' fake-fc .* --gby .* address@hidden .*[` ]sub/baz\.f90 ' out
+
+test $(grep -c '.*--gby.*\.f' out) -eq 2
+
+$EGREP 'fake-fc.*--@(95|03|08).*\.f90' out && exit 1
+$EGREP 'fake-fc.*--@(90|03|08).*\.f95' out && exit 1
+$EGREP 'fake-fc.*--@(90|95|08).*\.f03' out && exit 1
+$EGREP 'fake-fc.*--@(95|95|03).*\.f08' out && exit 1
 
 :
diff --git a/t/fort4.sh b/t/fort4.sh
index 822edb8..c14b926 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,22 +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 ! -e bar.o
-test ! -e bar.obj
-test ! -e baz.o
-test ! -e baz.obj
-test ! -e goodbye-baz.o
-test ! -e goodbye-baz.obj
+$MAKE test-obj
 $MAKE distcheck
 
 :
diff --git a/t/fort5.sh b/t/fort5.sh
index 0272706..88fefe5 100755
--- a/t/fort5.sh
+++ b/t/fort5.sh
@@ -88,20 +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 ! -e 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 ! -e baz.lo
+test ! -e sub/libgoodbye_la-baz.lo
 test ! -e libgoodbye_la-baz.lo
+
 $MAKE distcheck
 
 :
diff --git a/t/gcj.sh b/t/gcj.sh
index 3de2953..3b058a5 100755
--- a/t/gcj.sh
+++ b/t/gcj.sh
@@ -16,21 +16,50 @@
 
 # Test of compiled java.
 
+required='gcc gcj'
 . test-init.sh
 
 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/lex-line.sh b/t/lex-line.sh
index 9b27c0b..5c069e6 100755
--- a/t/lex-line.sh
+++ b/t/lex-line.sh
@@ -15,15 +15,13 @@
 # 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
-# 'subdir-object' option enabled.
+# files use correct "#line" directives.
 # See also sister test 'yacc-line.sh'.
 
 required='cc lex'
 . test-init.sh
 
 cat >> configure.ac << 'END'
-AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
 AC_PROG_LEX
 AC_OUTPUT
@@ -32,7 +30,6 @@ END
 mkdir dir sub sub/dir
 
 cat > Makefile.am << 'END'
-SUBDIRS = sub
 bin_PROGRAMS = foo bar
 LDADD = $(LEXLIB)
 bar_LFLAGS = -v
@@ -43,19 +40,6 @@ address@hidden@: zardoz.c
 address@hidden@: bar-quux.c
 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
-## Avoid spurious failures with Solaris make.
address@hidden@: foo-zardoz.c
-dir/address@hidden@: dir/quux.c
-END
-
 cat > zardoz.l << 'END'
 %{
 #define YY_NO_UNISTD_H 1
@@ -79,10 +63,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
@@ -102,7 +84,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
@@ -116,14 +98,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/libobj20a.sh b/t/libobj20a.sh
deleted file mode 100755
index 635798c..0000000
--- a/t/libobj20a.sh
+++ /dev/null
@@ -1,45 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2010-2013 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.sh' and 'libobj20c.sh'.
-
-. test-init.sh
-
-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 f86a46c..70442dd 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.sh' and 'libobj20c.sh'.
+# See also sister test 'libobj20c.sh'.
 
 . test-init.sh
 
diff --git a/t/libobj20c.sh b/t/libobj20c.sh
index 7b91802..5f8eb68 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.sh' and 'libobj20b.sh'.
+# See also sister test 'libobj20b.sh'.
 
 . test-init.sh
 
diff --git a/t/libtool3.sh b/t/libtool3.sh
index fb8c194..dbeb739 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,10 @@ $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.
+grep -v '^\.c' Makefile.in \
+  | $FGREP -v '$(am__dirstamp)' \
+  | $EGREP '\.(o|obj|lo).*:' && exit 1
 
 ./configure
 
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index a6e1cee..d679bb9 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -599,7 +599,6 @@ t/libobj16b.sh \
 t/libobj17.sh \
 t/libobj18.sh \
 t/libobj19.sh \
-t/libobj20a.sh \
 t/libobj20b.sh \
 t/libobj20c.sh \
 t/library.sh \
@@ -982,7 +981,6 @@ t/silent-configsite.sh \
 t/silent-nested-vars.sh \
 t/silent-custom.sh \
 t/src-acsubst.sh \
-t/sourcefile-in-subdir.sh \
 t/space.sh \
 t/specflg6.sh \
 t/specflg7.sh \
@@ -1018,7 +1016,6 @@ t/subdir-subsub.sh \
 t/subdir-distclean.sh \
 t/subobj.sh \
 t/subobj2.sh \
-t/subobj4.sh \
 t/subobj5.sh \
 t/subobj6.sh \
 t/subobj7.sh \
diff --git a/t/ltlibsrc.sh b/t/ltlibsrc.sh
index e58bba7..918d36e 100755
--- a/t/ltlibsrc.sh
+++ b/t/ltlibsrc.sh
@@ -33,7 +33,7 @@ AM_LDFLAGS = -module
 pkglib_LTLIBRARIES = zoo.d/bar.la old.la
 noinst_LTLIBRARIES = foo.la zoo.d/old2.la
 
-$(srcdir)/zoo_d_old2_la.c: $(srcdir)/old_la.c
+zoo_d_old2_la.c: $(srcdir)/old_la.c
        cp $(srcdir)/old_la.c $@
 END
 
diff --git a/t/parallel-tests-suffix-prog.sh b/t/parallel-tests-suffix-prog.sh
index 64f103c..edef428 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/pr401.sh b/t/pr401.sh
index 89094de..090b2e9 100755
--- a/t/pr401.sh
+++ b/t/pr401.sh
@@ -103,17 +103,6 @@ test ! -e 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. ##
 ## -------------------------------------------- ##
 
diff --git a/t/pr401b.sh b/t/pr401b.sh
index cf7a698..f993108 100755
--- a/t/pr401b.sh
+++ b/t/pr401b.sh
@@ -103,15 +103,6 @@ $AUTOMAKE -a
 test ! -e 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. ##
diff --git a/t/pr401c.sh b/t/pr401c.sh
index 22e5876..eb2f4fb 100755
--- a/t/pr401c.sh
+++ b/t/pr401c.sh
@@ -104,16 +104,6 @@ $AUTOMAKE
 test ! -e 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. ##
diff --git a/t/sourcefile-in-subdir.sh b/t/sourcefile-in-subdir.sh
deleted file mode 100755
index a010776..0000000
--- a/t/sourcefile-in-subdir.sh
+++ /dev/null
@@ -1,36 +0,0 @@
-#! /bin/sh
-# Copyright (C) 1999-2013 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.
-
-. test-init.sh
-
-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/subobj4.sh b/t/subobj4.sh
deleted file mode 100755
index 816f506..0000000
--- a/t/subobj4.sh
+++ /dev/null
@@ -1,50 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2001-2013 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.
-
-. test-init.sh
-
-cat >> configure.ac << 'END'
-AC_PROG_CC
-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
-
-: > d2/z.c
-
-$ACLOCAL
-$AUTOMAKE
-
-grep '\$(CC) .*\.\./d2/z\.c' d1/Makefile.in
-
-:
diff --git a/t/subpkg-yacc.sh b/t/subpkg-yacc.sh
index 639e415..247c769 100755
--- a/t/subpkg-yacc.sh
+++ b/t/subpkg-yacc.sh
@@ -20,13 +20,17 @@
 required='cc yacc'
 . test-init.sh
 
-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([Makefile])
 AC_CONFIG_SUBDIRS([lib])
 AC_OUTPUT
 END
 
 cat >Makefile.am <<'EOF'
+AUTOMAKE_OPTIONS = -Wno-override
 SUBDIRS = lib
 bin_PROGRAMS = MU
 MU_LDADD = lib/liblib.a
@@ -106,14 +110,18 @@ EOF
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE -Wno-override
+$AUTOMAKE
 
+test ! -e ylwrap
+test ! -e ar-lib
 cd lib
 $ACLOCAL
 $AUTOCONF
 $AUTOHEADER
-$AUTOMAKE -Wno-override --add-missing
+$AUTOMAKE --add-missing
 cd ..
+test -f ylwrap
+test -f ar-lib
 
 ./configure
 
diff --git a/t/subpkg.sh b/t/subpkg.sh
index 6f59ac5..c2bdf14 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
@@ -90,6 +91,8 @@ int lib (void)
 }
 EOF
 
+cp "$am_scriptdir"/compile .
+
 $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -Wno-override
@@ -102,7 +105,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 ! -e subpack-1 # Make sure distcheck cleans up after itself.
diff --git a/t/vala-libs.sh b/t/vala-libs.sh
index 66fd243..e48b5f6 100755
--- a/t/vala-libs.sh
+++ b/t/vala-libs.sh
@@ -75,7 +75,7 @@ int main ()
 }
 END
 
-mkdir src
+mkdir -p src
 cat > src/zardoz-foo.vala << 'END'
 using GLib;
 public class Foo {
diff --git a/t/xsource.sh b/t/xsource.sh
index a3fe6e5..70dfd4e 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-grepping2.sh b/t/yacc-grepping2.sh
index 58a963c..8231fbf 100755
--- a/t/yacc-grepping2.sh
+++ b/t/yacc-grepping2.sh
@@ -24,55 +24,31 @@ AC_PROG_CC
 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/yacc-line.sh b/t/yacc-line.sh
index 9067a2d..5b94871 100755
--- a/t/yacc-line.sh
+++ b/t/yacc-line.sh
@@ -15,43 +15,26 @@
 # 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.
-# See also sister test 'lex-line.sh'.
+# files use correct "#line" directives.
+# See also sister test 'lex-line.test'.
 
 required='cc yacc'
 . test-init.sh
 
 cat >> configure.ac << 'END'
-AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
 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 =
+noinst_PROGRAMS = foo bar baz
+baz_YFLAGS = -d
 foo_SOURCES = zardoz.y
 bar_SOURCES = dir/quux.y
-## Avoid spurious failures with Solaris make.
address@hidden@: zardoz.c
address@hidden@: bar-quux.c
-END
-
-cat > sub/Makefile.am << 'END'
-AUTOMAKE_OPTIONS = subdir-objects
-noinst_PROGRAMS = foo bar
-foo_YFLAGS = -d
-foo_SOURCES = zardoz.y
-bar_SOURCES = dir/quux.y
-## Avoid spurious failures with Solaris make.
address@hidden@: foo-zardoz.c
-dir/address@hidden@: dir/quux.c
+baz_SOURCES = zardoz.y
 END
 
 cat > zardoz.y << 'END'
@@ -69,10 +52,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
@@ -92,7 +73,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.
@@ -107,14 +88,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
-- 
1.8.1.rc3.192.g2d0029e




reply via email to

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