automake-commit
[Top][All Lists]
Advanced

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

[Automake-commit] [SCM] GNU Automake branch, test-protocols, updated. v1


From: Stefano Lattarini
Subject: [Automake-commit] [SCM] GNU Automake branch, test-protocols, updated. v1.11-1230-g6042b46
Date: Thu, 20 Oct 2011 13:22:26 +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=6042b46f7dd2541d1432b73039b590267eef1f49

The branch, test-protocols has been updated
       via  6042b46f7dd2541d1432b73039b590267eef1f49 (commit)
       via  b99f7a6a3a364c9db282468ee10baeb072ff1579 (commit)
       via  d00899b78a705f0d45cad78f8fcc465275c1aff6 (commit)
       via  f672944356eaaf47b1cdb3a167431ec33a3f6b9c (commit)
       via  75ce360ef4fde820ba6f1f974c6a1a9911b68461 (commit)
       via  7318775d14414207c3254775b4d1232cf09e602b (commit)
       via  6571c2fd4e7eca643f7d994efad52a4120118ccc (commit)
       via  dccae6a9e49b6554b5026883ce0fc38136e59d53 (commit)
       via  851b1ae2eb3b3654c882f59f509ec9d2ac6ebffd (commit)
       via  326ecba2f886bac40063d8d14d99065bc15317af (commit)
      from  e6091c2d48557906582cd06eadf8ad08775e6392 (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 -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 ChangeLog                                          |  163 ++++++++
 Makefile.in                                        |    7 +-
 NEWS                                               |   13 +-
 automake.in                                        |  413 +++++++++-----------
 doc/Makefile.in                                    |    3 +-
 lib/Automake/Makefile.in                           |    2 +-
 lib/Automake/tests/Makefile.in                     |    3 +-
 lib/am/Makefile.in                                 |    2 +-
 lib/am/distdir.am                                  |    1 +
 m4/Makefile.in                                     |    3 +-
 tests/Makefile.am                                  |   10 +-
 tests/Makefile.in                                  |   20 +-
 tests/dist-auxdir-many-subdirs.test                |  142 +++++++
 tests/dist-auxfile.test                            |    4 +-
 tests/dist-readonly.test                           |   60 +++
 tests/dist-repeated.test                           |  102 +++++
 tests/{distcom7.test => distcom-subdir.test}       |   40 ++-
 tests/distcom2.test                                |   68 ++--
 tests/distcom6.test                                |   71 ----
 tests/java-compile-run-nested.test                 |    2 +-
 tests/libobj19.test                                |   42 ++-
 .../missing-auxfile-stops-makefiles-creation.test  |   65 +++
 tests/test-driver-is-distributed.test              |   44 ++-
 23 files changed, 920 insertions(+), 360 deletions(-)
 create mode 100755 tests/dist-auxdir-many-subdirs.test
 create mode 100755 tests/dist-readonly.test
 create mode 100755 tests/dist-repeated.test
 rename tests/{distcom7.test => distcom-subdir.test} (58%)
 delete mode 100755 tests/distcom6.test
 create mode 100755 tests/missing-auxfile-stops-makefiles-creation.test

diff --git a/ChangeLog b/ChangeLog
index 9632de5..03efa25 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,166 @@
+2011-10-17  Stefano Lattarini  <address@hidden>
+
+       cosmetics: remove obsolete comment
+       * automake.in (push_required_file): Remove "FIXME" comment stating
+       that the special handling of `$config_aux_dir' breaks threaded
+       automake: this is not true anymore after the recent commits (see
+       in particular commit `v1.11-1225-gf672944').
+
+2011-10-08  Stefano Lattarini  <address@hidden>
+
+       tests: fix spurious failure with Solaris /bin/sh
+       * tests/dist-auxfile.test: Don't use redirected `:' in a loop,
+       it hits a bug in Solaris 10 /bin/sh.
+
+2011-10-08  Stefano Lattarini  <address@hidden>
+
+       threaded-am: better serialization for required config files
+       With this change, we make serialization/de-serialization of
+       required config files installs more granular, and in the process
+       fix the bug introduced by commit `v1.11-1219-g326ecba'.
+       * automake.in ($required_conf_file_queue): Move its declaration
+       earlier.
+       (require_file_internal): Add a new argument telling whether the
+       function should act immediately or queue its action for the master
+       thread to handle.
+       (queue_required_conf_file): Renamed ...
+       (queue_required_file_check_or_copy): ... to this.
+       (require_queued_conf_file): Renamed ...
+       (require_queued_file_check_or_copy): ... to this, and make it call
+       `required_file_check_or_copy' instead of `require_file_internal'.
+       (require_conf_file, handle_makefiles_threaded): Adjust and simplify
+       accordingly.
+       * tests/Makefile.am (XFAIL_TESTS): Remove `parallel-am.test'.
+
+2011-10-08  Stefano Lattarini  <address@hidden>
+
+       automake: refactor, break up 'require_file_internal'
+       This refactoring is only required in view of future changes.
+       * automake.in (require_file_internal): Move the guts of this
+       function ...
+       (required_file_check_or_copy): ... into this new function.  This
+       ensures that calls to `push_required_file' and code that copies
+       required files are placed in separate functions; this will be
+       very useful for reorganizing de-serialization of file installs
+       in future changes.
+
+2011-10-08  Stefano Lattarini  <address@hidden>
+
+       dist: separate auxiliary file instantiation from DIST_COMMON update
+       This change simplifies the automake internals dealing with the
+       checking, copying and distributing of required auxiliary files.
+       With this change, a required auxiliary file is *unconditionally*
+       added to the contents of the DIST_COMMON variable in the generated
+       Makefile.in, before checking whether it exists, or trying to copy
+       it (if `--add-missing' is in use).  This shouldn't be a problem,
+       since if the checking or copying of the file fails, automake will
+       bail out, the Makefile.in won't be created, and thus its content
+       will not matter.  OK, this is not completely true when threaded
+       automake is in use, but then, such a situation was also possible
+       before this patch, so no regression here, which is enough for us.
+       This change is the first of a series of steps aimed at fixing
+       the regression introduced in threaded automake usage by commit
+       `v1.11-1219-g326ecba'.
+       * automake.in (require_file_internal): Add the required file to
+       DIST_COMMON unconditionally.
+       * tests/missing-auxfile-stops-makefiles-creation.test: New test.
+       * tests/Makefile.am (TESTS): Add it.
+
+2011-10-08  Stefano Lattarini  <address@hidden>
+
+       refactor: rename a subroutine to a more proper name
+       * automake.in (maybe_push_require_file): Renamed ...
+       (push_required_file): ... to this.
+       All callers adjusted.
+
+2011-10-08  Stefano Lattarini  <address@hidden>
+
+       dist: truly always distribute files in AC_REQUIRE_AUX_FILE
+       This change fixes automake bug#9651.
+       * automake.in (handle_dist): Files whose distribution is required
+       by configure.ac are now correctly distributed even if the build-aux
+       directory coincides with the top-level directory.
+       * tests/Makefile.am (XFAIL_TESTS): Remove `dist-auxfile.test'.
+       * NEWS: Update.
+
+2011-10-08  Stefano Lattarini  <address@hidden>
+
+       dist: simplify automake code accordingly to the previous changes
+       After the previous change `v1.11-1219-g326ecba', every Makefile.am
+       requiring a file in the "config auxdir" will cause it to be listed
+       in the DIST_COMMON variable of the corresponding generated
+       Makefile.in, not only of the top-level Makefile.in.  Thus we don't
+       need to worry anymore about trying to distribute files in the
+       config auxdir from the top-level Makefile or the Makefile in
+       config auxdir (if any).  This allows us to carry out some useful
+       simplifications in the automake script.
+       This will however cause some changes in the generated Makefile;
+       for example, if the `PROGRAMS' primary is used only in a subdir
+       Makefile.am, the `depcomp' script will be distributed only by
+       `subdir/Makefile', not by the top-level Makefile.  This change
+       can be seen as an internal detail though, and definitely warranted
+       by the nice simplifications the current commit provides.
+       * automake.in ($automake_will_process_aux_dir): Variable removed.
+       (scan_autoconf_files): Adjust and simplify.
+       (handle_makefiles_threaded): Likewise.
+       (get_number_of_threads): Likewise.
+       (require_file_internal): Likewise.
+       (maybe_push_required_file): Its return value is not used anymore,
+       so return nothing.  Add special handling for distributed files from
+       `$config_libobj_dir'.  Also, catch "this can't happen" situations,
+       and abort accordingly.  Fix function description to better fit its
+       new role.
+       * tests/libobj19.test: Extend to also check situations where the
+       Makefile.am using $(LIBOBJS) is not the top-level one.
+       * tests/distcom6.test: Delete, merged into ...
+       * tests/distcom2.test: ... this test, which has been update to
+       account for the changed automake semantics.
+       * tests/Makefile.am (TESTS): Update.
+       * NEWS: Update.
+
+2011-10-08  Stefano Lattarini  <address@hidden>
+
+       dist: auxiliary files can be distributed from subdir Makefiles
+       With this change, we make it possible for a subdir Makefile.am
+       to distribute files in the config auxdir; while this means that
+       some files might be copied multiple times, it simplify some logic
+       in the automake script, and fix at least one important bug.  In
+       fact, before this change, the auxiliary script `test-driver' was
+       not being distributed as expected when TESTS was defined only in
+       a subdir Makefile (which is a pretty common setup indeed).  Now
+       this does not happen anymore: so the present change fixes automake
+       bug#9546.
+       Another welcome collateral effect is that `dist-auxfile-2.test'
+       now passes.
+       OTOH, the present changes *breaks threaded automake*.  The reason
+       is that automake needs to serialize file installations spawned
+       by `--add-missing' (this isn't for cosmetic reasons, but is
+       really needed to avoid possible race conditions and botched output
+       files).  Currently the code that installs required files is
+       intertwined with the code that declares the DIST_COMMON variables;
+       so, upon de-serialization, the definition of DIST_COMMON might get
+       emitted in the wrong Makefile.in.
+       Some follow-up refactoring in automake will soon take care of
+       remedying this situation.  For the moment, we just declare some
+       "parallel-am" tests as xfailing.
+       * automake.in (maybe_push_required_file): Add ad-hoc handling for
+       the case where the directory part of the required file is different
+       from the subdir where the current Makefile.am resides, but is equal
+       to the "config-aux directory" ($config_auxdir).  This is needed to
+       allow a construct in a non-top-level Makefile.am to require a file
+       in the config-aux directory.
+       * tests/test-driver-is-distributed.test: Extend and adjust.  This
+       test now passes.
+       * tests/java-compile-run-nested.test: Call automake with the `-a'
+       option to ensure that the `test-driver' auxiliary script gets
+       correctly installed.  This test now passes.
+       * tests/distcom-subdir.test: New test.
+       * tests/dist-readonly.test: Likewise.
+       * tests/dist-repeated.test: Likewise.
+       * tests/dist-auxdir-many-subdirs.test: Likewise.
+       * tests/distcom7.test: Removed, it's obsolete now.
+       * tests/Makefile.am (TESTS, XFAIL_TESTS): Update.
+
 2011-10-11  Stefano Lattarini  <address@hidden>
 
        coverage: conditional contents in LOG_DRIVER variables
diff --git a/Makefile.in b/Makefile.in
index 24a6c7f..5104e29 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -52,8 +52,11 @@ POST_UNINSTALL = :
 build_triplet = @build@
 subdir = .
 DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
-       $(srcdir)/Makefile.in $(top_srcdir)/configure AUTHORS COPYING \
-       ChangeLog INSTALL NEWS THANKS TODO
+       $(srcdir)/Makefile.in $(top_srcdir)/configure \
+       $(top_srcdir)/lib/config.guess $(top_srcdir)/lib/config.sub \
+       $(top_srcdir)/lib/install-sh $(top_srcdir)/lib/missing \
+       $(top_srcdir)/lib/mkinstalldirs AUTHORS COPYING ChangeLog \
+       INSTALL NEWS THANKS TODO
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
        $(top_srcdir)/m4/auxdir.m4 $(top_srcdir)/m4/init.m4 \
diff --git a/NEWS b/NEWS
index 01442c3..3921705 100644
--- a/NEWS
+++ b/NEWS
@@ -97,7 +97,7 @@ New in 1.11a:
   - Initial and still experimental support for the TAP test protocol is
     now provided.
 
-* Miscellaneous changes:
+* Changes related to distribution tarballs:
 
   - The `dist' and `dist-all' targets now can run compressors in parallel.
 
@@ -111,6 +111,13 @@ New in 1.11a:
     level via the XZ_OPT and BZIP2 envvars respectively.  E.g.,
     "make dist-xz XZ_OPT=-7" or "make dist-xz BZIP2=-5"
 
+  - Some auxiliary files that are automatically distributed by Automake
+    (e.g., `install-sh', or the `depcomp' script for packages compiling
+    C sources) might now be listed in the DIST_COMMON variable in many
+    Makefile.in files, rather than in the top-level one.
+
+* Miscellaneous changes:
+
   - Messages of types warning or error from `automake' and `aclocal' are now
     prefixed with the respective type, and presence of -Werror is noted.
 
@@ -175,6 +182,10 @@ Bugs fixed in 1.11a:
 
 * Long standing bugs:
 
+  - Files listed with the AC_REQUIRE_AUX_FILE macro in configure.ac are
+    now automatically distributed also if the directory of the auxiliary
+    files coincides with the top-level directory.
+
   - "make distcheck" now correctly complains also when "make uninstall"
     leaves one and only one file installed in $(prefix).
 
diff --git a/automake.in b/automake.in
index 9d6acc0..b3a454f 100644
--- a/automake.in
+++ b/automake.in
@@ -470,9 +470,8 @@ my %required_targets =
    'install-man' => 1,
   );
 
-# Set to 1 if this run will create the Makefile.in that distributes
-# the files in config_aux_dir.
-my $automake_will_process_aux_dir = 0;
+# Queue to push require_conf_file requirements to.
+my $required_conf_file_queue;
 
 # The name of the Makefile currently being processed.
 my $am_file = 'BUG';
@@ -3834,12 +3833,19 @@ sub handle_dist ()
   # directory, we would have discovered it already, so we don't
   # check that.  But if the file is in a subdir without a Makefile,
   # we want to distribute it here if we are doing `.'.  Ugly!
+  # Also, in some corner cases, it's possible that the following code
+  # will cause the same file to appear in the $(DIST_COMMON) variables
+  # of two distinct Makefiles; but this is not a problem, since the
+  # `distdir' target in `lib/am/distdir.am' can deal with the same
+  # file being distributed multiple times.
+  # See also automake bug#9651.
   if ($relative_dir eq '.')
     {
       foreach my $file (split (' ' , $configure_dist_common))
        {
+         my $dir = dirname ($file);
          push_dist_common ($file)
-           unless is_make_dir (dirname ($file));
+           if ($dir eq '.' || ! is_make_dir ($dir));
        }
     }
 
@@ -5545,41 +5551,10 @@ sub scan_autoconf_files ()
 
   locate_aux_dir ();
 
-  # Reorder @input_files so that the Makefile that distributes aux
-  # files is processed last.  This is important because each directory
-  # can require auxiliary scripts and we should wait until they have
-  # been installed before distributing them.
-
-  # The Makefile.in that distribute the aux files is the one in
-  # $config_aux_dir or the top-level Makefile.
-  my $auxdirdist = is_make_dir ($config_aux_dir) ? $config_aux_dir : '.';
-  my @new_input_files = ();
-  while (@input_files)
-    {
-      my $in = pop @input_files;
-      my @ins = split (/:/, $output_files{$in});
-      if (dirname ($ins[0]) eq $auxdirdist)
-       {
-         push @new_input_files, $in;
-         $automake_will_process_aux_dir = 1;
-       }
-      else
-       {
-         unshift @new_input_files, $in;
-       }
-    }
-  @input_files = @new_input_files;
-
-  # If neither the auxdir/Makefile nor the ./Makefile are generated
-  # by Automake, we won't distribute the aux files anyway.  Assume
-  # the user know what (s)he does, and pretend we will distribute
-  # them to disable the error in require_file_internal.
-  $automake_will_process_aux_dir = 1 if ! is_make_dir ($auxdirdist);
-
   # Look for some files we need.  Always check for these.  This
   # check must be done for every run, even those where we are only
   # looking at a subdir Makefile.  We must set relative_dir for
-  # maybe_push_required_file to work.
+  # push_required_file to work.
   # Sort the files for stable verbose output.
   $relative_dir = '.';
   foreach my $file (sort keys %required_aux_file)
@@ -7606,18 +7581,42 @@ sub locate_aux_dir ()
 }
 
 
-# &maybe_push_required_file ($DIR, $FILE, $FULLFILE)
+# &push_required_file ($DIR, $FILE, $FULLFILE)
 # --------------------------------------------------
-# See if we want to push this file onto dist_common.  This function
-# encodes the rules for deciding when to do so.
-sub maybe_push_required_file
+# Push the given file onto DIST_COMMON.
+sub push_required_file
 {
   my ($dir, $file, $fullfile) = @_;
 
+  # If the file to be distributed is in the same directory of the
+  # currently processed Makefile.am, then we want to distribute it
+  # from this same Makefile.am.
   if ($dir eq $relative_dir)
     {
       push_dist_common ($file);
-      return 1;
+    }
+  # This is needed to allow a construct in a non-top-level Makefile.am
+  # to require a file in the build-aux directory (see at least the test
+  # script `test-driver-is-distributed.test').  This is related to the
+  # automake bug#9546.  Note that the use of $config_aux_dir instead
+  # of $am_config_aux_dir here is deliberate and necessary.
+  elsif ($dir eq $config_aux_dir)
+    {
+      push_dist_common ("$am_config_aux_dir/$file");
+    }
+  # FIXME: another spacial case, for AC_LIBOBJ/AC_LIBSOURCE support.
+  # We probably need some refactoring of this function and its callers,
+  # to have a more explicit and systematic handling of all the special
+  # cases; but, since there are only two of them, this is low-priority
+  # ATM.
+  elsif ($config_libobj_dir && $dir eq $config_libobj_dir)
+    {
+      # Avoid unsightly '/.'s.
+      my $am_config_libobj_dir =
+        '$(top_srcdir)' .
+        ($config_libobj_dir eq '.' ? "" : "/$config_libobj_dir");
+      $am_config_libobj_dir =~ s|/*$||;
+      push_dist_common ("$am_config_libobj_dir/$file");
     }
   elsif ($relative_dir eq '.' && ! &is_make_dir ($dir))
     {
@@ -7655,9 +7654,12 @@ sub maybe_push_required_file
        if $dir =~ m,^\.\.(?:$|/),;
 
       push_dist_common ($fullfile);
-      return 1;
     }
-  return 0;
+  else
+    {
+      prog_error "a Makefile in relative directory $relative_dir " .
+                 "can't add files in directory $dir to DIST_COMMON";
+    }
 }
 
 
@@ -7666,141 +7668,141 @@ sub maybe_push_required_file
 # than once.
 my %required_file_not_found = ();
 
-# &require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, @FILES)
-# --------------------------------------------------------------
+# &required_file_check_or_copy ($WHERE, $DIRECTORY, $FILE)
+# --------------------------------------------------------
 # Verify that the file must exist in $DIRECTORY, or install it.
-# $MYSTRICT is the strictness level at which this file becomes required.
-sub require_file_internal ($$$@)
+sub required_file_check_or_copy ($$$)
 {
-  my ($where, $mystrict, $dir, @files) = @_;
+  my ($where, $dir, $file) = @_;
 
-  foreach my $file (@files)
+  my $fullfile = "$dir/$file";
+  my $found_it = 0;
+  my $dangling_sym = 0;
+
+  if (-l $fullfile && ! -f $fullfile)
+    {
+      $dangling_sym = 1;
+    }
+  elsif (dir_has_case_matching_file ($dir, $file))
     {
-      my $fullfile = "$dir/$file";
-      my $found_it = 0;
-      my $dangling_sym = 0;
+      $found_it = 1;
+    }
 
-      if (-l $fullfile && ! -f $fullfile)
-       {
-         $dangling_sym = 1;
-       }
-      elsif (dir_has_case_matching_file ($dir, $file))
-       {
-         $found_it = 1;
-         maybe_push_required_file ($dir, $file, $fullfile);
-       }
+  # `--force-missing' only has an effect if `--add-missing' is
+  # specified.
+  return
+    if $found_it && (! $add_missing || ! $force_missing);
 
-      # `--force-missing' only has an effect if `--add-missing' is
-      # specified.
-      if ($found_it && (! $add_missing || ! $force_missing))
-       {
-         next;
-       }
-      else
-       {
-         # If we've already looked for it, we're done.  You might
-         # wonder why we don't do this before searching for the
-         # file.  If we do that, then something like
-         # AC_OUTPUT(subdir/foo foo) will fail to put foo.in into
-         # DIST_COMMON.
-         if (! $found_it)
-           {
-             next if defined $required_file_not_found{$fullfile};
-             $required_file_not_found{$fullfile} = 1;
-           }
+  # If we've already looked for it, we're done.  You might
+  # wonder why we don't do this before searching for the
+  # file.  If we do that, then something like
+  # AC_OUTPUT(subdir/foo foo) will fail to put foo.in into
+  # DIST_COMMON.
+  if (! $found_it)
+    {
+      return if defined $required_file_not_found{$fullfile};
+      $required_file_not_found{$fullfile} = 1;
+    }
+  if ($dangling_sym && $add_missing)
+    {
+      unlink ($fullfile);
+    }
 
-         if ($strictness >= $mystrict)
-           {
-             if ($dangling_sym && $add_missing)
-               {
-                 unlink ($fullfile);
-               }
+  my $trailer = '';
+  my $trailer2 = '';
+  my $suppress = 0;
 
-             my $trailer = '';
-             my $trailer2 = '';
-             my $suppress = 0;
+  # Only install missing files according to our desired
+  # strictness level.
+  my $message = "required file `$fullfile' not found";
+  if ($add_missing)
+    {
+      if (-f "$libdir/$file")
+        {
+          $suppress = 1;
 
-             # Only install missing files according to our desired
-             # strictness level.
-             my $message = "required file `$fullfile' not found";
-             if ($add_missing)
-               {
-                 if (-f "$libdir/$file")
-                   {
-                     $suppress = 1;
-
-                     # Install the missing file.  Symlink if we
-                     # can, copy if we must.  Note: delete the file
-                     # first, in case it is a dangling symlink.
-                     $message = "installing `$fullfile'";
-
-                     # The license file should not be volatile.
-                     if ($file eq "COPYING")
-                       {
-                         $message .= " using GNU General Public License v3 
file";
-                         $trailer2 = "\n    Consider adding the COPYING file"
-                                   . " to the version control system"
-                                   . "\n    for your code, to avoid questions"
-                                   . " about which license your project uses";
-                       }
+          # Install the missing file.  Symlink if we
+          # can, copy if we must.  Note: delete the file
+          # first, in case it is a dangling symlink.
+          $message = "installing `$fullfile'";
 
-                     # Windows Perl will hang if we try to delete a
-                     # file that doesn't exist.
-                     unlink ($fullfile) if -f $fullfile;
-                     if ($symlink_exists && ! $copy_missing)
-                       {
-                         if (! symlink ("$libdir/$file", $fullfile)
-                             || ! -e $fullfile)
-                           {
-                             $suppress = 0;
-                             $trailer = "; error while making link: $!";
-                           }
-                       }
-                     elsif (system ('cp', "$libdir/$file", $fullfile))
-                       {
-                         $suppress = 0;
-                         $trailer = "\n    error while copying";
-                       }
-                     set_dir_cache_file ($dir, $file);
-                   }
+          # The license file should not be volatile.
+          if ($file eq "COPYING")
+            {
+              $message .= " using GNU General Public License v3 file";
+              $trailer2 = "\n    Consider adding the COPYING file"
+                        . " to the version control system"
+                        . "\n    for your code, to avoid questions"
+                        . " about which license your project uses";
+            }
 
-                 if (! maybe_push_required_file (dirname ($fullfile),
-                                                 $file, $fullfile))
-                   {
-                     if (! $found_it && ! $automake_will_process_aux_dir)
-                       {
-                         # We have added the file but could not push it
-                         # into DIST_COMMON, probably because this is
-                         # an auxiliary file and we are not processing
-                         # the top level Makefile.  Furthermore Automake
-                         # hasn't been asked to create the Makefile.in
-                         # that distributes the aux dir files.
-                         error ($where, 'please rerun automake without '
-                                . "Makefile arguments\n"
-                                . "so $fullfile gets distributed");
-                       }
-                   }
-               }
-             else
-               {
-                 $trailer = "\n  `automake --add-missing' can install `$file'"
-                   if -f "$libdir/$file";
-               }
+          # Windows Perl will hang if we try to delete a
+          # file that doesn't exist.
+          unlink ($fullfile) if -f $fullfile;
+          if ($symlink_exists && ! $copy_missing)
+            {
+              if (! symlink ("$libdir/$file", $fullfile)
+                  || ! -e $fullfile)
+                {
+                  $suppress = 0;
+                  $trailer = "; error while making link: $!";
+                }
+            }
+          elsif (system ('cp', "$libdir/$file", $fullfile))
+            {
+              $suppress = 0;
+              $trailer = "\n    error while copying";
+            }
+          set_dir_cache_file ($dir, $file);
+        }
+    }
+  else
+    {
+      $trailer = "\n  `automake --add-missing' can install `$file'"
+        if -f "$libdir/$file";
+    }
 
-             # If --force-missing was specified, and we have
-             # actually found the file, then do nothing.
-             next
-               if $found_it && $force_missing;
+  # If --force-missing was specified, and we have
+  # actually found the file, then do nothing.
+  return
+    if $found_it && $force_missing;
 
-             # If we couldn't install the file, but it is a target in
-             # the Makefile, don't print anything.  This allows files
-             # like README, AUTHORS, or THANKS to be generated.
-             next
-               if !$suppress && rule $file;
+  # If we couldn't install the file, but it is a target in
+  # the Makefile, don't print anything.  This allows files
+  # like README, AUTHORS, or THANKS to be generated.
+  return
+    if !$suppress && rule $file;
 
-             msg ($suppress ? 'note' : 'error', $where, 
"$message$trailer$trailer2");
-           }
-       }
+  msg ($suppress ? 'note' : 'error', $where, "$message$trailer$trailer2");
+}
+
+
+# &require_file_internal ($WHERE, $MYSTRICT, $DIRECTORY, $QUEUE, @FILES)
+# ----------------------------------------------------------------------
+# Verify that the file must exist in $DIRECTORY, or install it.
+# $MYSTRICT is the strictness level at which this file becomes required.
+# Worker threads may queue up the action to be serialized by the master,
+# if $QUEUE is true
+sub require_file_internal ($$$@)
+{
+  my ($where, $mystrict, $dir, $queue, @files) = @_;
+
+  return
+    unless $strictness >= $mystrict;
+
+  foreach my $file (@files)
+    {
+      push_required_file ($dir, $file, "$dir/$file");
+      if ($queue)
+        {
+          queue_required_file_check_or_copy ($required_conf_file_queue,
+                                             QUEUE_CONF_FILE, $relative_dir,
+                                             $where, $mystrict, @files);
+        }
+      else
+        {
+          required_file_check_or_copy ($where, $dir, $file);
+        }
     }
 }
 
@@ -7809,7 +7811,7 @@ sub require_file_internal ($$$@)
 sub require_file ($$@)
 {
     my ($where, $mystrict, @files) = @_;
-    require_file_internal ($where, $mystrict, $relative_dir, @files);
+    require_file_internal ($where, $mystrict, $relative_dir, 0, @files);
 }
 
 # &require_file_with_macro ($COND, $MACRO, $MYSTRICT, @FILES)
@@ -7832,7 +7834,7 @@ sub require_libsource_with_macro ($$$@)
     if ($config_libobj_dir)
       {
        require_file_internal ($macro->rdef ($cond)->location, $mystrict,
-                              $config_libobj_dir, @files);
+                              $config_libobj_dir, 0, @files);
       }
     else
       {
@@ -7840,12 +7842,10 @@ sub require_libsource_with_macro ($$$@)
       }
 }
 
-# Queue to push require_conf_file requirements to.
-my $required_conf_file_queue;
-
-# &queue_required_conf_file ($QUEUE, $KEY, $DIR, $WHERE, $MYSTRICT, @FILES)
-# -------------------------------------------------------------------------
-sub queue_required_conf_file ($$$$@)
+# &queue_required_file_check_or_copy ($QUEUE, $KEY, $DIR, $WHERE,
+#                                     $MYSTRICT, @FILES)
+# ---------------------------------------------------------------
+sub queue_required_file_check_or_copy ($$$$@)
 {
     my ($queue, $key, $dir, $where, $mystrict, @files) = @_;
     my @serial_loc;
@@ -7860,9 +7860,9 @@ sub queue_required_conf_file ($$$$@)
     $queue->enqueue ($key, $dir, @serial_loc, $mystrict, 0 + @files, @files);
 }
 
-# &require_queued_conf_file ($QUEUE)
-# ----------------------------------
-sub require_queued_conf_file ($)
+# &require_queued_file_check_or_copy ($QUEUE)
+# -------------------------------------------
+sub require_queued_file_check_or_copy ($)
 {
     my ($queue) = @_;
     my $where;
@@ -7885,35 +7885,23 @@ sub require_queued_conf_file ($)
     my @files;
     push @files, $queue->dequeue ()
       foreach (1 .. $nfiles);
-
-    # Dequeuing happens outside of per-makefile context, so we have to
-    # set the variables used by require_file_internal and the functions
-    # it calls.  Gross!
-    $relative_dir = $dir;
-    require_file_internal ($where, $mystrict, $config_aux_dir, @files);
+    return
+      unless $strictness >= $mystrict;
+    foreach my $file (@files)
+      {
+        required_file_check_or_copy ($where, $config_aux_dir, $file);
+      }
 }
 
 # &require_conf_file ($WHERE, $MYSTRICT, @FILES)
 # ----------------------------------------------
-# Looks in configuration path, as specified by AC_CONFIG_AUX_DIR;
-# worker threads may queue up the action to be serialized by the master.
-#
-# FIXME: this seriously relies on the semantics of require_file_internal
-# and maybe_push_required_file, in that we exploit the fact that only the
-# contents of the last handled output file may be impacted (which in turn
-# is dealt with by the master thread).
+# Looks in configuration path, as specified by AC_CONFIG_AUX_DIR.
 sub require_conf_file ($$@)
 {
     my ($where, $mystrict, @files) = @_;
-    if (defined $required_conf_file_queue)
-      {
-       queue_required_conf_file ($required_conf_file_queue, QUEUE_CONF_FILE,
-                                 $relative_dir, $where, $mystrict, @files);
-      }
-    else
-      {
-       require_file_internal ($where, $mystrict, $config_aux_dir, @files);
-      }
+    my $queue = defined $required_conf_file_queue ? 1 : 0;
+    require_file_internal ($where, $mystrict, $config_aux_dir,
+                           $queue, @files);
 }
 
 
@@ -8472,11 +8460,6 @@ sub get_number_of_threads
   # It doesn't make sense to use more threads than makefiles,
   my $max_threads = @input_files;
 
-  # but a single worker thread is helpful for exposing bugs.
-  if ($automake_will_process_aux_dir && $max_threads > 1)
-    {
-      $max_threads--;
-    }
   if ($nthreads > $max_threads)
     {
       $nthreads = $max_threads;
@@ -8500,18 +8483,11 @@ sub handle_makefiles_threaded ($)
 {
   my ($nthreads) = @_;
 
-  my @queued_input_files = @input_files;
-  my $last_input_file = undef;
-  if ($automake_will_process_aux_dir)
-    {
-      $last_input_file = pop @queued_input_files;
-    }
-
   # The file queue distributes all makefiles, the message queues
   # collect all serializations needed for respective files.
   my $file_queue = Thread::Queue->new;
   my %msg_queues;
-  foreach my $file (@queued_input_files)
+  foreach my $file (@input_files)
     {
       $msg_queues{$file} = Thread::Queue->new;
     }
@@ -8537,12 +8513,12 @@ sub handle_makefiles_threaded ($)
        });
     }
 
-  # Queue all normal makefiles.
-  verb "queuing " . @queued_input_files . " input files";
-  $file_queue->enqueue (@queued_input_files, (undef) x @threads);
+  # Queue all makefiles.
+  verb "queuing " . @input_files . " input files";
+  $file_queue->enqueue (@input_files, (undef) x @threads);
 
   # Collect and process serializations.
-  foreach my $file (@queued_input_files)
+  foreach my $file (@input_files)
     {
       verb "dequeuing messages for " . $file;
       reset_local_duplicates ();
@@ -8555,7 +8531,7 @@ sub handle_makefiles_threaded ($)
            }
          elsif ($key eq QUEUE_CONF_FILE)
            {
-             require_queued_conf_file ($queue);
+             require_queued_file_check_or_copy ($queue);
            }
          else
            {
@@ -8570,13 +8546,6 @@ sub handle_makefiles_threaded ($)
       $exit_code = $exit_thread[0]
        if ($exit_thread[0] > $exit_code);
     }
-
-  # The master processes the last file.
-  if ($automake_will_process_aux_dir)
-    {
-      verb "processing last input file";
-      handle_makefile ($last_input_file);
-    }
 }
 
 ################################################################
diff --git a/doc/Makefile.in b/doc/Makefile.in
index b0d06f2..ab3e552 100644
--- a/doc/Makefile.in
+++ b/doc/Makefile.in
@@ -52,7 +52,8 @@ subdir = doc
 DIST_COMMON = $(automake_TEXINFOS) $(dist_doc_DATA) $(dist_man1_MANS) \
        $(dist_noinst_DATA) $(srcdir)/Makefile.am \
        $(srcdir)/Makefile.in $(srcdir)/stamp-vti \
-       $(srcdir)/version.texi
+       $(srcdir)/version.texi $(top_srcdir)/lib/mdate-sh \
+       $(top_srcdir)/lib/mkinstalldirs $(top_srcdir)/lib/texinfo.tex
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
        $(top_srcdir)/m4/auxdir.m4 $(top_srcdir)/m4/init.m4 \
diff --git a/lib/Automake/Makefile.in b/lib/Automake/Makefile.in
index 2ea1a18..b83778b 100644
--- a/lib/Automake/Makefile.in
+++ b/lib/Automake/Makefile.in
@@ -51,7 +51,7 @@ POST_UNINSTALL = :
 build_triplet = @build@
 subdir = lib/Automake
 DIST_COMMON = $(dist_perllib_DATA) $(srcdir)/Makefile.am \
-       $(srcdir)/Makefile.in
+       $(srcdir)/Makefile.in $(top_srcdir)/lib/mkinstalldirs
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
        $(top_srcdir)/m4/auxdir.m4 $(top_srcdir)/m4/init.m4 \
diff --git a/lib/Automake/tests/Makefile.in b/lib/Automake/tests/Makefile.in
index 3e5def5..ead6233 100644
--- a/lib/Automake/tests/Makefile.in
+++ b/lib/Automake/tests/Makefile.in
@@ -48,7 +48,8 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 subdir = lib/Automake/tests
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(top_srcdir)/lib/mkinstalldirs $(top_srcdir)/lib/test-driver
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
        $(top_srcdir)/m4/auxdir.m4 $(top_srcdir)/m4/init.m4 \
diff --git a/lib/am/Makefile.in b/lib/am/Makefile.in
index 53ce53d..050806a 100644
--- a/lib/am/Makefile.in
+++ b/lib/am/Makefile.in
@@ -51,7 +51,7 @@ POST_UNINSTALL = :
 build_triplet = @build@
 subdir = lib/am
 DIST_COMMON = $(dist_am_DATA) $(srcdir)/Makefile.am \
-       $(srcdir)/Makefile.in
+       $(srcdir)/Makefile.in $(top_srcdir)/lib/mkinstalldirs
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
        $(top_srcdir)/m4/auxdir.m4 $(top_srcdir)/m4/init.m4 \
diff --git a/lib/am/distdir.am b/lib/am/distdir.am
index 7e31f2c..0eed248 100644
--- a/lib/am/distdir.am
+++ b/lib/am/distdir.am
@@ -216,6 +216,7 @@ endif %?TOPDIR_P%
 ## Test for file existence because sometimes a file gets included in
 ## DISTFILES twice.  For example this happens when a single source
 ## file is used in building more than one program.
+## See also test `dist-repeated.test'.
            test -f "$(distdir)/$$file" \
            || cp -p $$d/$$file "$(distdir)/$$file" \
            || exit 1; \
diff --git a/m4/Makefile.in b/m4/Makefile.in
index 8bc9b70..66ca138 100644
--- a/m4/Makefile.in
+++ b/m4/Makefile.in
@@ -51,7 +51,8 @@ POST_UNINSTALL = :
 build_triplet = @build@
 subdir = m4
 DIST_COMMON = $(dist_automake_ac_DATA) $(dist_system_ac_DATA) \
-       $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+       $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
+       $(top_srcdir)/lib/mkinstalldirs
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
        $(top_srcdir)/m4/auxdir.m4 $(top_srcdir)/m4/init.m4 \
diff --git a/tests/Makefile.am b/tests/Makefile.am
index b97d84a..a12c0b2 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -27,15 +27,12 @@ XFAIL_TESTS = \
 all.test \
 auxdir2.test \
 cond17.test \
-dist-auxfile.test \
-dist-auxfile-2.test \
 gcj6.test \
 override-conditional-2.test \
 java-nobase.test \
 pr8365-remake-timing.test \
 yacc-dist-nobuild-subdir.test \
 vala-vpath.test \
-test-driver-is-distributed.test \
 txinfo5.test
 
 
@@ -405,13 +402,15 @@ discover.test \
 dist-auxfile.test \
 dist-auxfile-2.test \
 dist-included-parent-dir.test \
+dist-readonly.test \
+dist-repeated.test \
+dist-auxdir-many-subdirs.test \
 distcleancheck.test \
 distcom2.test \
 distcom3.test \
 distcom4.test \
 distcom5.test \
-distcom6.test \
-distcom7.test \
+distcom-subdir.test \
 distdir.test \
 distlinks.test \
 distlinksbrk.test \
@@ -681,6 +680,7 @@ missing3.test \
 missing4.test \
 missing5.test \
 missing6.test \
+missing-auxfile-stops-makefiles-creation.test \
 mkinstall.test \
 mkinst2.test \
 mkinst3.test \
diff --git a/tests/Makefile.in b/tests/Makefile.in
index 291bf85..5e75ffc 100644
--- a/tests/Makefile.in
+++ b/tests/Makefile.in
@@ -51,7 +51,8 @@ build_triplet = @build@
 DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
        $(srcdir)/aclocal.in $(srcdir)/automake.in $(srcdir)/defs \
        $(srcdir)/defs-static.in $(srcdir)/instspc-tests.am \
-       $(srcdir)/parallel-tests.am
+       $(srcdir)/parallel-tests.am $(top_srcdir)/lib/mkinstalldirs \
+       $(top_srcdir)/lib/test-driver
 subdir = tests
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/amversion.m4 \
@@ -293,12 +294,10 @@ EXTRA_DIST = ChangeLog-old gen-parallel-tests 
instspc-tests.sh \
        trivial-test-driver testsuite-summary-checks.sh \
        extract-testsuite-summary tap-setup.sh tap-summary-aux.sh \
        distcheck-hook-m4.am
-XFAIL_TESTS = all.test auxdir2.test cond17.test dist-auxfile.test \
-       dist-auxfile-2.test gcj6.test override-conditional-2.test \
-       java-nobase.test pr8365-remake-timing.test \
-       yacc-dist-nobuild-subdir.test vala-vpath.test \
-       test-driver-is-distributed.test txinfo5.test \
-       $(instspc_xfail_tests)
+XFAIL_TESTS = all.test auxdir2.test cond17.test gcj6.test \
+       override-conditional-2.test java-nobase.test \
+       pr8365-remake-timing.test yacc-dist-nobuild-subdir.test \
+       vala-vpath.test txinfo5.test $(instspc_xfail_tests)
 parallel_tests = check-concurrency-bug9245-p.test \
        check-exported-srcdir-p.test check-fd-redirect-p.test \
        check-tests-in-builddir-p.test check-p.test check11-p.test \
@@ -668,13 +667,15 @@ discover.test \
 dist-auxfile.test \
 dist-auxfile-2.test \
 dist-included-parent-dir.test \
+dist-readonly.test \
+dist-repeated.test \
+dist-auxdir-many-subdirs.test \
 distcleancheck.test \
 distcom2.test \
 distcom3.test \
 distcom4.test \
 distcom5.test \
-distcom6.test \
-distcom7.test \
+distcom-subdir.test \
 distdir.test \
 distlinks.test \
 distlinksbrk.test \
@@ -944,6 +945,7 @@ missing3.test \
 missing4.test \
 missing5.test \
 missing6.test \
+missing-auxfile-stops-makefiles-creation.test \
 mkinstall.test \
 mkinst2.test \
 mkinst3.test \
diff --git a/tests/dist-auxdir-many-subdirs.test 
b/tests/dist-auxdir-many-subdirs.test
new file mode 100755
index 0000000..4f32f64
--- /dev/null
+++ b/tests/dist-auxdir-many-subdirs.test
@@ -0,0 +1,142 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# It should be legitimate for many subdir Makefiles to require the
+# same config-aux files.
+
+am_create_testdir=empty
+parallel_tests=yes
+required=cc
+. ./defs || Exit 1
+
+count=0
+ocwd=`pwd` || fatal_ "cannot get current working directory"
+
+# Usage: do_check [--add-missing] [CONFIG-AUXDIR-PATH=.]
+do_check ()
+{
+  case $1 in
+    -a|--add-missing) add_missing=yes; shift;;
+    *) add_missing=no;;
+  esac
+  auxdir=${1-.}
+
+  count=`expr $count + 1`
+  mkdir T$count.d
+  cd T$count.d
+
+  distdir=$me-$count
+  unindent > configure.in << END
+    AC_INIT([$me], [$count])
+    AC_CONFIG_AUX_DIR([$auxdir])
+    AM_INIT_AUTOMAKE([parallel-tests])
+    AC_PROG_CC
+    # We don't want to require python or emcas in this test, so
+    # the tricks below.
+    AM_PATH_PYTHON([2.2], [], [:])
+    EMACS=no; AM_PATH_LISPDIR
+    AC_CONFIG_FILES([Makefile])
+END
+
+  unindent > Makefile.stub <<'END'
+    ## For depcomp.
+    bin_PROGRAMS = foo
+    foo_SOURCES = foo.c
+    ## For py-compile.
+    python_PYTHON = bar.py
+    ## For elisp-comp.
+    lisp_LISP = baz.el
+    ## For test-driver.
+    TESTS =
+END
+
+  required_files='
+    install-sh
+    missing
+    depcomp
+    py-compile
+    elisp-comp
+    test-driver
+  '
+
+  echo "SUBDIRS =" > Makefile.am
+
+  suffixes='0 1 2 3 4 5 6 7 8 9'
+
+  for x in $suffixes; do
+    mkdir sub$x
+    echo "SUBDIRS += sub$x" >> Makefile.am
+    echo "AC_CONFIG_FILES([sub$x/Makefile])" >> configure.in
+    cp Makefile.stub sub$x/Makefile.am
+    echo 'int main (void) { return 0; }' > sub$x/foo.c
+    touch sub$x/bar.py sub$x/baz.el
+  done
+  echo AC_OUTPUT >> configure.in
+
+  $ACLOCAL
+  $AUTOCONF
+
+  # FIXME: this is not good for installcheck; fix after merging
+  # into testsuite-work.
+  "$top_testsrcdir"/lib/install-sh -d $auxdir
+  if test $add_missing = yes; then
+    $AUTOMAKE -a --copy
+    for f in $required_files; do
+      test -f $auxdir/$f
+      # To ensure that if a auxiliary file is required and distributed
+      # by many Makefiles, the "dist" rule won't try to copy it multiple
+      # times in $(distdir).
+      chmod a-w $auxdir/$f
+    done
+  else
+    for f in $required_files; do
+      # FIXME: this is not good for installcheck; fix after merging
+      # into testsuite-work.
+      cp "$top_testsrcdir"/lib/$f $auxdir/$f
+      # See comments above.
+      chmod a-w $auxdir/$f
+    done
+    $AUTOMAKE
+  fi
+
+  for vpath in : false; do
+    if $vpath; then
+      mkdir build
+      cd build
+      srcdir=..
+    else
+      srcdir=.
+    fi
+    $srcdir/configure
+    $MAKE distdir
+    find $distdir # For debugging.
+    for f in $required_files; do
+      test -f $distdir/$auxdir/$f
+    done
+    cd $srcdir
+  done
+
+  cd "$ocwd" || fatal_ "cannot chdir back to '$ocwd'"
+}
+
+do_check .
+do_check --add-missing .
+do_check build-aux
+do_check --add-missing build-aux
+do_check a/b/c
+do_check --add-missing a/b/c
+
+:
diff --git a/tests/dist-auxfile.test b/tests/dist-auxfile.test
index 2776a25..6efd737 100755
--- a/tests/dist-auxfile.test
+++ b/tests/dist-auxfile.test
@@ -61,8 +61,8 @@ END
 END
 
   mkdir subdir
-  : > subdir/Makefile.am
-  
+  echo > subdir/Makefile.am # `echo', not `:', for Solaris /bin/sh.
+
   test -z "$auxdir" || mkdir "$auxdir" || Exit 99
 
   if test -z "$auxdir"; then
diff --git a/tests/dist-readonly.test b/tests/dist-readonly.test
new file mode 100755
index 0000000..3b558c9
--- /dev/null
+++ b/tests/dist-readonly.test
@@ -0,0 +1,60 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test that a readonly files are distributed as such, and not make
+# writable while being copied in the $(distdir).
+
+required=cc
+. ./defs || Exit 1
+
+cat >> configure.in << 'END'
+AC_PROG_CC
+AC_OUTPUT
+END
+
+cat > Makefile.am << 'END'
+bin_PROGRAMS = foo
+foo_SOURCES = foo.c
+EXTRA_DIST = bar.txt
+check-local: test
+.PHONY: test
+test:
+       test -f $(srcdir)/foo.c && test ! -w $(srcdir)/foo.c
+       if (echo x > $(srcdir)/foo.c); then exit 1; else :; fi
+       grep 'main (void)' $(srcdir)/foo.c
+       test -f $(srcdir)/bar.txt && test ! -w $(srcdir)/bar.txt
+       if (echo x > $(srcdir)/bar.txt); then exit 1; else :; fi
+       grep 'To be, or not to be' $(srcdir)/bar.txt
+END
+
+echo 'int main (void) { return 0; }' > foo.c
+echo To be, or not to be ... > bar.txt
+chmod a-w foo.c bar.txt
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE distdir
+ls -l $distdir # For debugging.
+test -f foo.c && test ! -w foo.c || Exit 1
+(echo x > foo.c) && Exit 1
+test -f bar.txt && test ! -w bar.txt || Exit 1
+(echo x > bar.txt) && Exit 1
+$MAKE distcheck
+
+:
diff --git a/tests/dist-repeated.test b/tests/dist-repeated.test
new file mode 100755
index 0000000..7dd8bdd
--- /dev/null
+++ b/tests/dist-repeated.test
@@ -0,0 +1,102 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Test that we can distribute the same file as many times as we want.
+# The distdir target should take care of not copying it more than one
+# time anyway.
+
+. ./defs || Exit 1
+
+echo AC_OUTPUT >> configure.in
+
+cat > Makefile.am <<'END'
+bin_PROGRAMS = foo bar
+foo_SOURCES = foo.c
+bar_SOURCES = foo.c
+python_PYTHON = bar.py
+EXTRA_DIST = foo.c bar.py
+
+.PHONY: sanity-check
+sanity-check:
+       for f in $(DISTFILES); do echo " $$f "; done > dist.txt
+       cat dist.txt
+       test `grep ' foo\.c '  dist.txt | wc -l` -eq 3
+       test `grep ' bar\.py ' dist.txt | wc -l` -eq 2
+
+# So that we don't have to require a C compiler.
+AUTOMAKE_OPTIONS = no-dependencies
+CC = false
+
+# So that we don't have to require a Python interpreter.
+pythondir = ${prefix}/py
+PYTHON = false
+END
+
+ocwd=`pwd` || fatal_ "cannot get current working directory"
+
+# Help to ensure cp won't see the same file twice.
+mkdir bin
+cat > bin/cp <<END
+#!/bin/sh
+PATH='$PATH'; export PATH
+
+case " \$* " in
+  *foo.c\ *)
+    if test -f '$ocwd'/foo-c-copied; then
+      echo "\$0: we tried to copy foo.c twice" >&2
+      exit 1
+    else
+      # For a sanity check later.
+      echo ok > '$ocwd'/cp-wrapper-has-seen-foo-c
+    fi
+    ;;
+esac
+
+case " \$* " in
+  *bar.py\ *)
+    if test -f '$ocwd'/bar-py-copied; then
+      echo "\$0: we tried to copy bar.py twice" >&2
+      exit 1
+    else
+      # For a sanity check later.
+      echo ok > '$ocwd'/cp-wrapper-has-seen-bar-py
+    fi
+    ;;
+esac
+
+exec cp "\$@"
+END
+chmod a+x bin/cp
+PATH=`pwd`/bin$PATH_SEPARATOR$PATH; export PATH;
+
+: > foo.c
+: > bar.py
+: > py-compile
+
+# Help to ensure cp won't try to copy the same file twice.
+chmod a-w foo.c bar.py
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+$MAKE sanity-check || fatal_ "expected invariants not verified"
+$MAKE distdir
+test -f cp-wrapper-has-seen-foo-c && test -f cp-wrapper-has-seen-bar-py \
+  || fatal_ "our cp wrapper hasn't run correctly"
+
+:
diff --git a/tests/distcom7.test b/tests/distcom-subdir.test
similarity index 58%
rename from tests/distcom7.test
rename to tests/distcom-subdir.test
index 129bb57..f873682 100755
--- a/tests/distcom7.test
+++ b/tests/distcom-subdir.test
@@ -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/>.
 
-# Test to make sure that Automake complains when an auxfile (here depcomp)
-# is installed, but the Makefile that distributes it is not processed.
+# Test to make sure that if an auxfile (here depcomp) is required
+# by a subdir Makefile.am, it is distributed by that Makefile.am.
 
 . ./defs || Exit 1
 
@@ -32,14 +32,44 @@ END
 rm -f depcomp
 mkdir subdir
 
+: > subdir/Makefile.am
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+test ! -f depcomp
+
 cat > subdir/Makefile.am << 'END'
 bin_PROGRAMS = foo
 END
 
 : > subdir/foo.c
 
-$ACLOCAL
-AUTOMAKE_fails --add-missing subdir/Makefile
-grep 'without.*Makefile.*arguments' stderr
+$AUTOMAKE -a subdir/Makefile
+test -f depcomp
+
+# FIXME: the logic of this check and other similar ones in other
+# FIXME: `distcom*.test' files should be factored out in a common
+# FIXME: subroutine in `defs'...
+sed -n -e "
+  /^DIST_COMMON =.*\\\\$/ {
+    :loop
+    p
+    n
+    t clear
+    :clear
+    s/\\\\$/\\\\/
+    t loop
+    s/$/ /
+    s/[$tab ][$tab ]*/ /g
+    p
+    n
+  }" subdir/Makefile.in > dc.txt
+cat dc.txt
+$FGREP ' $(top_srcdir)/depcomp ' dc.txt
+
+./configure
+$MAKE distdir
+test -f $distdir/depcomp
 
 :
diff --git a/tests/distcom2.test b/tests/distcom2.test
index e093e06..7dd020d 100755
--- a/tests/distcom2.test
+++ b/tests/distcom2.test
@@ -15,9 +15,9 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test to make sure that depcomp and compile are added to DIST_COMMON
-# From Pavel Roskin.
-# Please keep this in sync with sister test 'distcom6.test'.
+# Test to make sure that depcomp and compile are added to DIST_COMMON.
+# Report from Pavel Roskin.  Report of problems with `--no-force' from
+# Scott James Remnant (Debian #206299)
 
 . ./defs || Exit 1
 
@@ -41,29 +41,45 @@ foo_SOURCES = foo.c
 foo_CFLAGS = -DBAR
 END
 
-rm -f compile depcomp
-
 $ACLOCAL
-$AUTOMAKE --add-missing
-
-test -f compile
-test -f depcomp
-
-sed -n -e '/^DIST_COMMON =.*\\$/ {
-   :loop
-   p
-   n
-   t clear
-   :clear
-   s/\\$/\\/
-   t loop
-   p
-   n
-   }' -e 's/$/ /' -e '/^DIST_COMMON =/p' Makefile.in > dc.txt
-
-cat dc.txt # might be useful for debugging
-
-$FGREP ' compile ' dc.txt
-$FGREP ' depcomp ' dc.txt
+
+rm -f compile depcomp Makefile.in subdir/Makefile.in dc.txt subdir/dc.txt
+
+for opt in '' --no-force; do
+
+  $AUTOMAKE $opt --add-missing
+
+  test -f compile
+  test -f depcomp
+
+  for dir in . subdir; do
+    # FIXME: the logic of this check and other similar ones in other
+    # FIXME: `distcom*.test' files should be factored out in a common
+    # FIXME: subroutine in `defs'...
+    sed -n -e "
+      /^DIST_COMMON =.*\\\\$/ {
+        :loop
+        p
+        n
+        t clear
+        :clear
+        s/\\\\$/\\\\/
+        t loop
+        s/$/ /
+        s/[$tab ][$tab ]*/ /g
+        p
+        n
+      }" $dir/Makefile.in > $dir/dc.txt
+  done
+
+  cat dc.txt # For debugging.
+  cat subdir/dc.txt # Likewise.
+
+  $FGREP ' $(top_srcdir)/depcomp ' subdir/dc.txt
+  # The `compile' script will be listed in the DIST_COMMON of the top-level
+  # Makefile because it's required in configure.in (by AM_PROG_CC_C_O).
+  $FGREP ' $(top_srcdir)/compile ' dc.txt || $FGREP ' compile ' dc.txt
+
+done
 
 :
diff --git a/tests/distcom6.test b/tests/distcom6.test
deleted file mode 100755
index fd7f0ab..0000000
--- a/tests/distcom6.test
+++ /dev/null
@@ -1,71 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2003, 2004, 2006, 2010, 2011 Free Software Foundation,
-# Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# 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 that depcomp and compile required in subdirectories
-# are added to the top-level DIST_COMMON even with --no-force.
-# This is similar to distcom2.test, but with --no-force added.
-# Report from Scott James Remnant (Debian #206299).
-# Please keep this in sync with sister test 'distcom2.test'.
-
-. ./defs || Exit 1
-
-cat >> configure.in << 'END'
-AC_PROG_CC
-AM_PROG_CC_C_O
-AC_CONFIG_FILES([subdir/Makefile])
-AC_OUTPUT
-END
-
-cat > Makefile.am << 'END'
-SUBDIRS = subdir
-END
-
-mkdir subdir
-: > subdir/foo.c
-
-cat > subdir/Makefile.am << 'END'
-noinst_PROGRAMS = foo
-foo_SOURCES = foo.c
-foo_CFLAGS = -DBAR
-END
-
-rm -f compile depcomp
-
-$ACLOCAL
-$AUTOMAKE --add-missing --no-force
-
-test -f compile
-test -f depcomp
-
-sed -n -e '/^DIST_COMMON =.*\\$/ {
-   :loop
-   p
-   n
-   t clear
-   :clear
-   s/\\$/\\/
-   t loop
-   p
-   n
-   }' -e 's/$/ /' -e '/^DIST_COMMON =/p' Makefile.in > dc.txt
-
-cat dc.txt # might be useful for debugging
-
-$FGREP ' compile ' dc.txt
-$FGREP ' depcomp ' dc.txt
-
-:
diff --git a/tests/java-compile-run-nested.test 
b/tests/java-compile-run-nested.test
index ec75c92..2019208 100755
--- a/tests/java-compile-run-nested.test
+++ b/tests/java-compile-run-nested.test
@@ -238,7 +238,7 @@ chmod a+x tests/*.test
 
 $ACLOCAL
 $AUTOCONF
-$AUTOMAKE
+$AUTOMAKE -a
 
 # To have the parallel testsuite more verbose.
 VERBOSE=yes; export VERBOSE
diff --git a/tests/libobj19.test b/tests/libobj19.test
index bc495b5..2f2a3d6 100755
--- a/tests/libobj19.test
+++ b/tests/libobj19.test
@@ -31,13 +31,17 @@ AUTOMAKE_OPTIONS = subdir-objects
 noinst_LIBRARIES = libtu.a
 libtu_a_SOURCES =
 libtu_a_LIBADD = $(LIBOBJS)
-check-local: distdir
-       ls -l $(srcdir)/* $(builddir)/* $(distdir)/*
+## Hack with this variable ans with extra make recursion in the check-local
+## rule are required for when we move this Makefile in a subdir, later.
+my_distdir = $(top_builddir)/$(PACKAGE)-$(VERSION)
+check-local:
+       (cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) distdir)
+       ls -l $(top_srcdir)/* $(top_builddir)/* $(my_distdir)/*
        test -f libtu.a
-       test ! -r $(srcdir)/foobar.c
-       test -f $(srcdir)/libobj-dir/foobar.c
-       test ! -r $(distdir)/foobar.c
-       test -f $(distdir)/libobj-dir/foobar.c
+       test ! -r $(top_srcdir)/foobar.c
+       test -f $(top_srcdir)/libobj-dir/foobar.c
+       test ! -r $(my_distdir)/foobar.c
+       test -f $(my_distdir)/libobj-dir/foobar.c
        $(AR) t libtu.a
        $(AR) t libtu.a | grep foobar
 END
@@ -57,4 +61,30 @@ $MAKE
 $MAKE check
 $MAKE distcheck
 
+# Same check, but with the Makefile.am using $(LIBOBJS) not being
+# the top-level one.
+
+$MAKE distclean
+rm -rf autom4te*.cache aclocal.m4 configure
+
+mkdir sub
+mv -f Makefile.am sub
+echo SUBDIRS = sub > Makefile.am
+
+sed '/^AC_OUTPUT/i\
+AC_CONFIG_FILES([sub/Makefile])
+' configure.in > t
+mv -f t configure.in
+cat configure.in # For debugging.
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE
+
+./configure
+
+$MAKE
+$MAKE check
+$MAKE distcheck
+
 :
diff --git a/tests/missing-auxfile-stops-makefiles-creation.test 
b/tests/missing-auxfile-stops-makefiles-creation.test
new file mode 100755
index 0000000..6492a14
--- /dev/null
+++ b/tests/missing-auxfile-stops-makefiles-creation.test
@@ -0,0 +1,65 @@
+#! /bin/sh
+# Copyright (C) 2011 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# Automake should stop the creation of Makefile.in files at the first
+# encountered error due to a required auxiliary file not found.
+
+. ./defs || Exit 1
+
+cat >> configure.in <<END
+AM_PATH_PYTHON
+END
+
+echo SUBDIRS = > Makefile.am
+
+for i in 1 2 3 4 5; do
+  echo "AC_CONFIG_FILES([sub$i/Makefile])" >> configure.in
+  echo "SUBDIRS += sub$i" >> Makefile.am
+  mkdir sub$i
+  echo python_PYTHON = foo.py > sub$i/Makefile.am
+done
+
+: > sub1/Makefile.am
+
+$ACLOCAL
+
+unset AUTOMAKE_JOBS || :
+
+AUTOMAKE_fails
+ls -l Makefile.in */Makefile.in || : # For debugging.
+# Top-level Makefile.in might be created or not, we don't want to set
+# too strict semantics here, so don't check for it.  But the later
+# files shouldn't exist.
+test -f sub1/Makefile.in
+test ! -f sub2/Makefile.in
+test ! -f sub3/Makefile.in
+test ! -f sub4/Makefile.in
+test ! -f sub5/Makefile.in
+
+rm -f Makefile.in */Makefile.in
+
+: > sub2/Makefile.am
+: > sub3/Makefile.am
+
+AUTOMAKE_fails
+ls -l Makefile.in */Makefile.in || : # For debugging.
+test -f sub1/Makefile.in
+test -f sub2/Makefile.in
+test -f sub3/Makefile.in
+test ! -f sub4/Makefile.in
+test ! -f sub5/Makefile.in
+
+:
diff --git a/tests/test-driver-is-distributed.test 
b/tests/test-driver-is-distributed.test
index 09ea45a..e9a3f14 100755
--- a/tests/test-driver-is-distributed.test
+++ b/tests/test-driver-is-distributed.test
@@ -26,19 +26,23 @@ AC_CONFIG_FILES([tests/Makefile])
 AC_OUTPUT
 END
 
+rm -f depcomp # It's unneeded.
+
 mkdir tests
 
 cat > Makefile.am << 'END'
 SUBDIRS = tests
-test0:
-       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]test-driver '
-test1: distdir
+check-local: test-top
+test-top: distdir
        ls -l $(distdir) $(distdir)/* ;: For debugging.
        test -f $(distdir)/test-driver
-.PHONY: test0 test1
+.PHONY: test-top
 END
 
 cat > tests/Makefile.am << 'END'
+check-local: test-sub
+test-sub:
+       echo ' ' $(DIST_COMMON) ' ' | grep '[ /]test-driver '
 TESTS = foo.test
 EXTRA_DIST = $(TESTS)
 END
@@ -53,7 +57,37 @@ $ACLOCAL
 $AUTOCONF
 $AUTOMAKE -a
 ./configure
-$MAKE test0 test1
+$MAKE test-top
+cd tests; $MAKE test-sub; cd ..;
+$MAKE distcheck
+
+# Try again, with a `config_auxdir' != `.' this time.
+
+$MAKE distclean
+
+mkdir build-aux
+mv missing install-sh test-driver build-aux
+
+for d in . tests; do
+  sed 's|test-driver|build-aux/test-driver|' $d/Makefile.am > $d/t
+  mv -f $d/t $d/Makefile.am
+  cat $d/Makefile.am # For debugging.
+done
+
+# Extra newline possibly required by OpenBSD 3.9 sed, see the autoconf
+# manual for details.
+sed '/^AC_INIT/i\
+AC_CONFIG_AUX_DIR([build-aux])
+' configure.in > t
+mv -f t configure.in
+cat configure.in # For debugging.
+
+touch aclocal.m4 # To avoid useless remakes.
+$AUTOCONF
+$AUTOMAKE
+./configure
+$MAKE test-top
+cd tests; $MAKE test-sub; cd ..;
 $MAKE distcheck
 
 :


hooks/post-receive
-- 
GNU Automake



reply via email to

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