Merge branch 'maint'
authorStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 15 Jun 2012 08:27:27 +0000 (10:27 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Fri, 15 Jun 2012 08:36:41 +0000 (10:36 +0200)
* maint:
  tests: minor reorganization of few tests
  fixup: adjust t/list-of-tests.mk for renamed/added tests
  subdirs: enhance coverage, tweak and rename few tests
  sync: update files from upstream with "make fetch"
  py-compile: consistently quote 'like this', not `like this'.
  docs: recursive make considered harmful
  docs: clean rules are not run in reverse order of build rules anymore
  silent: new $(AM_V_P) variable, tell if we're running in silent mode
  refactor: silent rules handling (a little)
  refactor: &define_verbose_var: accept a third optional argument

+ Extra non-trivial edits:

These are due to the fact that support for silent rules is enabled
unconditionally these days (since commit 'v1.12-34-g14141f2' of
2012-05-01, "silent rules: support for them is always active now").

* automake.in: In the new silent related code, do not ever check
whether the 'silent-rules' option is active; just assume support
for silent rules is enabled.
* t/silent-obsolescent-warns.sh: Remove as obsolete.
* t/list-of-tests.mk: Adjust.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
24 files changed:
NEWS
automake.in
doc/automake.texi
lib/config.guess
lib/gnupload
lib/py-compile
lib/texinfo.tex
t/confh-subdir-clean.sh [moved from t/subdir6.sh with 100% similarity]
t/depcomp-implicit-auxdir.sh [moved from t/subdir4.sh with 100% similarity]
t/dir-named-obj-is-bad.sh [moved from t/subdir7.sh with 71% similarity]
t/list-of-tests.mk
t/silent6.sh
t/sourcefile-in-subdir.sh [moved from t/subdir3.sh with 100% similarity]
t/src-acsubst.sh [moved from t/srcsub.sh with 58% similarity]
t/srcsub2.sh [deleted file]
t/subdir-ac-subst.sh [moved from t/subcond3.sh with 97% similarity]
t/subdir-add-pr46.sh [moved from t/subdir5.sh with 100% similarity]
t/subdir-add2-pr46.sh [moved from t/subdir8.sh with 100% similarity]
t/subdir-am-cond.sh [moved from t/subcond2.sh with 97% similarity]
t/subdir-cond-err.sh [moved from t/cond2.sh with 100% similarity]
t/subdir-cond-gettext.sh [moved from t/subcond.sh with 94% similarity]
t/subdir-order.sh [new file with mode: 0644]
t/subdir-subsub.sh [moved from t/subdir2.sh with 91% similarity]
t/subdir-with-slash.sh [moved from t/subdir9.sh with 97% similarity]

diff --git a/NEWS b/NEWS
index 8a9d69d..33812db 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -109,6 +109,12 @@ New in 1.12.2:
     compiled object file that is in the same directory of a subdir
     object.  See automake bug#10697.
 
+* Silent rules support:
+
+  - A new predefined $(AM_V_P) make variable is provided; it expands
+    to a shell conditional that can be used in recipes to know whether
+    make is being run in silent or verbose mode.
+
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 New in 1.12.1:
index e5f95ee..373e259 100644 (file)
@@ -1138,15 +1138,19 @@ sub verbose_private_var ($)
     return 'am__v_' . $name;
 }
 
-# define_verbose_var (NAME, VAL)
-# ------------------------------
-# For silent rules, setup VAR and dispatcher, to expand to VAL if silent.
-sub define_verbose_var ($$)
-{
-    my ($name, $val) = @_;
+# define_verbose_var (NAME, VAL-IF-SILENT, [VAL-IF-VERBOSE])
+# ----------------------------------------------------------
+# For  silent rules, setup VAR and dispatcher, to expand to
+# VAL-IF-SILENT if silent, to VAL-IF-VERBOSE (defaulting to
+# empty) if not.
+sub define_verbose_var ($$;$)
+{
+    my ($name, $silent_val, $verbose_val) = @_;
+    $verbose_val = '' unless defined $verbose_val;
     my $var = verbose_var ($name);
     my $pvar = verbose_private_var ($name);
     my $silent_var = $pvar . '_0';
+    my $verbose_var = $pvar . '_1';
     # For typical 'make's, 'configure' replaces AM_V (inside @@) with $(V)
     # and AM_DEFAULT_V (inside @@) with $(AM_DEFAULT_VERBOSITY).
     # For strict POSIX 2008 'make's, it replaces them with 0 or 1 instead.
@@ -1154,9 +1158,12 @@ sub define_verbose_var ($$)
     define_variable ($var, '$(' . $pvar . '_@'.'AM_V'.'@)', INTERNAL);
     define_variable ($pvar . '_', '$(' . $pvar . '_@'.'AM_DEFAULT_V'.'@)',
                      INTERNAL);
-    Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE, $val,
-                                '', INTERNAL, VAR_ASIS)
+    Automake::Variable::define ($silent_var, VAR_AUTOMAKE, '', TRUE,
+                                $silent_val, '', INTERNAL, VAR_ASIS)
       if (! vardef ($silent_var, TRUE));
+    Automake::Variable::define ($verbose_var, VAR_AUTOMAKE, '', TRUE,
+                                $verbose_val, '', INTERNAL, VAR_ASIS)
+      if (! vardef ($verbose_var, TRUE));
 }
 
 # Above should not be needed in the general automake code.
@@ -1191,7 +1198,6 @@ sub define_verbose_tagvar ($)
 {
     my ($name) = @_;
     define_verbose_var ($name, '@echo "  '. $name . ' ' x (8 - length ($name)) . '" $@;');
-    define_verbose_var ('at', '@');
 }
 
 # define_verbose_texinfo
@@ -1217,6 +1223,20 @@ sub define_verbose_libtool ()
     return verbose_flag ('lt');
 }
 
+sub handle_silent ()
+{
+    # Define "$(AM_V_P)", expanding to a shell conditional that can be
+    # used in make recipes to determine whether we are being run in
+    # silent mode or not.  The choice of the name derives from the LISP
+    # convention of appending the letter 'P' to denote a predicate (see
+    # also "the '-P' convention" in the Jargon File); we do so for lack
+    # of a better convention.
+    define_verbose_var ('P', 'false', ':');
+    # *Always* provide the user with '$(AM_V_GEN)', unconditionally.
+    define_verbose_tagvar ('GEN');
+    define_verbose_var ('at', '@');
+}
+
 
 ################################################################
 
@@ -1570,9 +1590,6 @@ sub handle_languages
          unless defined $done{$languages{'c'}};
        define_linker_variable ($languages{'c'});
       }
-
-    # Always provide the user with 'AM_V_GEN' for silent rules.
-    define_verbose_tagvar ('GEN');
 }
 
 
@@ -8000,6 +8017,8 @@ sub generate_makefile ($$)
   handle_programs;
   handle_scripts;
 
+  handle_silent;
+
   # These must be run after all the sources are scanned.  They
   # use variables defined by &handle_libraries, &handle_ltlibraries,
   # or &handle_programs.
index 02d1bb4..0ed2bfe 100644 (file)
@@ -4104,13 +4104,25 @@ For simple projects that distribute all files in the same directory
 it is enough to have a single @file{Makefile.am} that builds
 everything in place.
 
-In larger projects it is common to organize files in different
-directories, in a tree.  For instance one directory per program, per
-library or per module.  The traditional approach is to build these
-subdirectories recursively: each directory contains its @file{Makefile}
-(generated from @file{Makefile.am}), and when @command{make} is run
-from the top level directory it enters each subdirectory in turn to
-build its contents.
+In larger projects, it is common to organize files in different
+directories, in a tree.  For example, there could be a directory
+for the program's source, one for the testsuite, and one for the
+documentation; or, for very large projects, there could be one
+directory per program, per library or per module.
+
+The traditional approach is to build these subdirectories recursively,
+employing @emph{make recursion}: each directory contains its
+own @file{Makefile}, and when @command{make} is run from the top-level
+directory, it enters each subdirectory in turn, and invokes there a
+new @command{make} instance to build the directory's contents.
+
+Because this approach is very widespread, Automake offers built-in
+support for it.  However, it is worth nothing that the use of make
+recursion has its own serious issues and drawbacks, and that it's
+well possible to have packages with a multi directory layout that
+make little or no use of such recursion (examples of such packages
+are GNU Bison and GNU Automake itself); see also the @ref{Alternative}
+section below.
 
 @menu
 * Subdirectories::              Building subdirectories recursively
@@ -4124,7 +4136,7 @@ build its contents.
 
 @cindex @code{SUBDIRS}, explained
 
-In packages with subdirectories, the top level @file{Makefile.am} must
+In packages using make recursion, the top level @file{Makefile.am} must
 tell Automake which subdirectories are to be built.  This is done via
 the @code{SUBDIRS} variable.
 @vindex SUBDIRS
@@ -4182,8 +4194,6 @@ will be built.  It is customary to arrange test directories to be
 built after everything else since they are meant to test what has
 been constructed.
 
-All @code{clean} rules are run in reverse order of build rules.
-
 @node Conditional Subdirectories
 @section Conditional Subdirectories
 @cindex Subdirectories, building conditionally
@@ -4261,7 +4271,7 @@ does not know the possible values of these variables.  In this case
 @cindex @code{SUBDIRS} and @code{AM_CONDITIONAL}
 @cindex @code{AM_CONDITIONAL} and @code{SUBDIRS}
 
-@c Keep in sync with subcond2.sh
+@c Keep in sync with subdir-am-cond.sh
 
 @file{configure} should output the @file{Makefile} for each directory
 and define a condition into which @file{opt/} should be built.
@@ -4301,7 +4311,7 @@ automatically because it knows that @code{MAYBE_OPT} can contain
 @cindex @code{SUBDIRS} and @code{AC_SUBST}
 @cindex @code{AC_SUBST} and @code{SUBDIRS}
 
-@c Keep in sync with subcond3.sh
+@c Keep in sync with subdir-ac-subst.sh
 
 Another possibility is to define @code{MAYBE_OPT} from
 @file{./configure} using @code{AC_SUBST}:
@@ -4407,7 +4417,7 @@ variables it cannot ensure the corresponding directory exists.
 If you've ever read Peter Miller's excellent paper,
 @uref{http://miller.emu.id.au/pmiller/books/rmch/,
 Recursive Make Considered Harmful}, the preceding sections on the use of
-subdirectories will probably come as unwelcome advice.  For those who
+make recursion will probably come as unwelcome advice.  For those who
 haven't read the paper, Miller's main thesis is that recursive
 @command{make} invocations are both slow and error-prone.
 
@@ -4417,7 +4427,6 @@ believe.  This work is new and there are probably warts.
 to write a single @file{Makefile.am} for a complex multi-directory
 package.
 
-
 By default an installable file specified in a subdirectory will have its
 directory name stripped before installation.  For instance, in this
 example, the header file will be installed as
@@ -10818,15 +10827,31 @@ limitation should go away with time.
 @vindex @code{AM_DEFAULT_VERBOSITY}
 @vindex @code{AM_V}
 @vindex @code{AM_DEFAULT_V}
-To extend the silent mode to your own rules, you have two choices:
+To extend the silent mode to your own rules, you have few choices:
 
 @itemize @bullet
+
 @item
 You can use the predefined variable @code{AM_V_GEN} as a prefix to
 commands that should output a status line in silent mode, and
 @code{AM_V_at} as a prefix to commands that should not output anything
 in silent mode.  When output is to be verbose, both of these variables
 will expand to the empty string.
+
+@item
+You can silence a recipe unconditionally with @code{@@}, and then use
+the predefined variable @code{AM_V_P} to know whether make is being run
+in silent or verbose mode, adjust the verbose information your recipe
+displays accordingly:
+
+@example
+generate-headers:
+        @set -e; \
+        ... [commands defining a shell variable '$headers'] ...; \
+        if $(AM_V_P); then set -x; else echo " GEN   [headers]"; fi; \
+        rm -f $$headers && generate-header --flags $$headers
+@end example
+
 @item
 You can add your own variables, so strings of your own choice are shown.
 The following snippet shows how you would define your own equivalent of
index d622a44..c0adba9 100755 (executable)
@@ -4,7 +4,7 @@
 #   2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010,
 #   2011, 2012 Free Software Foundation, Inc.
 
-timestamp='2012-02-10'
+timestamp='2012-06-10'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -1256,7 +1256,7 @@ EOF
     NEO-?:NONSTOP_KERNEL:*:*)
        echo neo-tandem-nsk${UNAME_RELEASE}
        exit ;;
-    NSE-?:NONSTOP_KERNEL:*:*)
+    NSE-*:NONSTOP_KERNEL:*:*)
        echo nse-tandem-nsk${UNAME_RELEASE}
        exit ;;
     NSR-?:NONSTOP_KERNEL:*:*)
index b71ddfd..186d2ad 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 # Sign files and upload them.
 
-scriptversion=2012-01-15.15; # UTC
+scriptversion=2012-06-11.00; # UTC
 
 # Copyright (C) 2004-2012 Free Software Foundation, Inc.
 #
@@ -28,6 +28,7 @@ GPG='gpg --batch --no-tty'
 conffile=.gnuploadrc
 to=
 dry_run=false
+replace=
 symlink_files=
 delete_files=
 delete_symlinks=
@@ -53,8 +54,10 @@ Options:
   --to DEST                specify one destination for FILES
                            (multiple --to options are allowed)
   --user NAME              sign with key NAME
+  --replace                allow replacements of existing files
   --symlink-regex[=EXPR]   use sed script EXPR to compute symbolic link names
   --dry-run                do nothing, show what would have been done
+                           (including the constructed directive file)
   --version                output version information and exit
 
 If --symlink-regex is given without EXPR, then the link target name
@@ -146,6 +149,9 @@ while test -n "$1"; do
     --delete)
       collect_var=delete_files
       ;;
+    --replace)
+      replace="replace: true"
+      ;;
     --rmsymlink)
       collect_var=delete_symlinks
       ;;
@@ -243,11 +249,13 @@ unset passphrase
 # listings with their arguments...).
 # Remember this script runs with 'set -e', so if echo is not built-in
 # it will exit now.
-PATH=/empty echo -n "Enter GPG passphrase: "
-stty -echo
-read -r passphrase
-stty echo
-echo
+if $dry_run; then :; else
+  PATH=/empty echo -n "Enter GPG passphrase: "
+  stty -echo
+  read -r passphrase
+  stty echo
+  echo
+fi
 
 if test $# -ne 0; then
   for file
@@ -270,7 +278,7 @@ filename: $3$stmt"
   fi
 
   cat >${2}.directive<<EOF
-version: 1.1
+version: 1.2
 directory: $1
 comment: gnupload v. $scriptversion$stmt
 EOF
@@ -393,6 +401,12 @@ do
   do
     echo "Uploading $file to $dest ..."
     stmt=
+    #
+    # allowing file replacement is all or nothing.
+    if test -n "$replace"; then stmt="$stmt
+$replace"
+    fi
+    #
     files="$file $file.sig"
     destdir=`echo $dest | sed 's/[^:]*://'`
     if test -n "$symlink_expr"; then
index 699e28f..6916903 100755 (executable)
@@ -36,7 +36,7 @@ me=py-compile
 usage_error ()
 {
   echo "$me: $*" >&2
-  echo "Try \`$me --help' for more information." >&2
+  echo "Try '$me --help' for more information." >&2
   exit 1
 }
 
index c2901b9..a5a7b2b 100644 (file)
@@ -3,7 +3,7 @@
 % Load plain if necessary, i.e., if running under initex.
 \expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi
 %
-\def\texinfoversion{2012-05-16.16}
+\def\texinfoversion{2012-06-05.14}
 %
 % Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
 % 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
@@ -1117,7 +1117,7 @@ where each line of input produces a line of output.}
 % #1 is a control sequence in which to do the replacements,
 % which we \xdef.
 \def\txiescapepdf#1{%
-  \ifx\pdfescapestring\relax
+  \ifx\pdfescapestring\thisisundefined
     % No primitive available; should we give a warning or log?
     % Many times it won't matter.
   \else
@@ -6150,7 +6150,7 @@ end
 % Same as \defaultparindent.
 \newdimen\tocindent \tocindent = 15pt
 
-% Now for the actual typesetting. In all of these, #1 is the text and #2 is the
+% Now for the actual typesetting. In all these, #1 is the text and #2 is the
 % page number.
 %
 % If the toc has to be broken over pages, we want it to be at chapters
similarity index 100%
rename from t/subdir6.sh
rename to t/confh-subdir-clean.sh
similarity index 100%
rename from t/subdir4.sh
rename to t/depcomp-implicit-auxdir.sh
similarity index 71%
rename from t/subdir7.sh
rename to t/dir-named-obj-is-bad.sh
index a2c47a1..e422f19 100755 (executable)
@@ -26,12 +26,12 @@ AC_OUTPUT
 END
 
 : > obj/Makefile.am
-echo 'SUBDIRS = obj' >Makefile.am
+echo 'SUBDIRS = obj' > Makefile.am
 
 $ACLOCAL
 
 AUTOMAKE_fails
-grep 'Makefile.am:1:.*obj.*BSD' stderr
+grep "^Makefile\.am:1:.*'obj'.*BSD make" stderr
 
 cat >Makefile.am <<'END'
 SUBDIRS = @STH@
@@ -40,6 +40,22 @@ DIST_SUBDIRS = $(FOO)
 END
 
 AUTOMAKE_fails
-grep 'Makefile.am:2:.*obj.*BSD' stderr
+grep "^Makefile\\.am:2:.*'obj'.*BSD make" stderr
+
+rm -rf autom4te*.cache
+
+cat >configure.ac << 'END'
+AC_INIT([x], [1.0])
+AC_CONFIG_AUX_DIR([obj])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+END
+
+rm -f obj/Makefile.am
+: > Makefile.am
+
+$ACLOCAL
+AUTOMAKE_fails -a
+grep "^configure\.ac:2:.*'obj'.*BSD make" stderr
 
 :
index ab35162..b80c071 100644 (file)
@@ -248,7 +248,6 @@ t/compile_f90_c_cxx.sh \
 t/compile_f_c_cxx.sh \
 t/cond-basic.sh \
 t/cond.sh \
-t/cond2.sh \
 t/cond3.sh \
 t/cond4.sh \
 t/cond5.sh \
@@ -310,6 +309,7 @@ t/confh5.sh \
 t/confh6.sh \
 t/confh7.sh \
 t/confh8.sh \
+t/confh-subdir-clean.sh \
 t/confincl.sh \
 t/conflnk.sh \
 t/conflnk2.sh \
@@ -356,6 +356,7 @@ t/depcomp.sh \
 t/depcomp2.sh \
 t/depcomp8a.sh \
 t/depcomp8b.sh \
+t/depcomp-implicit-auxdir.sh \
 t/depdist.sh \
 t/depend.sh \
 t/depend3.sh \
@@ -364,6 +365,7 @@ t/depend5.sh \
 t/depend6.sh \
 t/deprecated-acinit.sh \
 t/destdir.sh \
+t/dir-named-obj-is-bad.sh \
 t/dirlist.sh \
 t/dirlist2.sh \
 t/dirlist-abspath.sh \
@@ -972,8 +974,8 @@ t/silent-nested-vars.sh \
 t/silent-lex.sh \
 t/silent-yacc.sh \
 t/silent-yacc-headers.sh \
-t/srcsub.sh \
-t/srcsub2.sh \
+t/src-acsubst.sh \
+t/sourcefile-in-subdir.sh \
 t/space.sh \
 t/specflg.sh \
 t/specflg2.sh \
@@ -1000,20 +1002,18 @@ t/strip.sh \
 t/strip2.sh \
 t/strip3.sh \
 t/subdir.sh \
-t/subdir2.sh \
-t/subdir3.sh \
-t/subdir4.sh \
-t/subdir5.sh \
-t/subdir6.sh \
-t/subdir7.sh \
-t/subdir8.sh \
-t/subdir9.sh \
+t/subdir-ac-subst.sh \
+t/subdir-add-pr46.sh \
+t/subdir-add2-pr46.sh \
+t/subdir-am-cond.sh \
+t/subdir-cond-err.sh \
+t/subdir-cond-gettext.sh \
+t/subdir-order.sh \
+t/subdir-with-slash.sh \
+t/subdir-subsub.sh \
 t/subdir10.sh \
 t/subdir-distclean.sh \
 t/subdirbuiltsources.sh \
-t/subcond.sh \
-t/subcond2.sh \
-t/subcond3.sh \
 t/subobj.sh \
 t/subobj2.sh \
 t/subobj4.sh \
index f8ad681..c7e7819 100755 (executable)
 . ./defs || Exit 1
 
 cat >>configure.ac <<'EOF'
+AC_CONFIG_FILES([sub/Makefile])
 AC_OUTPUT
 EOF
 
-cat > Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = -Wno-portability-recursive
+# We delegate all the work to the subdir makefile.  This is done
+# to ensure any command-line setting of $(V) gets correctly passed
+# down to recursive make invocations.
+echo SUBDIRS = sub > Makefile.am
 
+mkdir sub
+cat > sub/Makefile.am <<'EOF'
+AUTOMAKE_OPTIONS = -Wno-portability-recursive
 my_verbose = $(my_verbose_$(V))
 my_verbose_ = $(my_verbose_$(AM_DEFAULT_VERBOSITY))
-my_verbose_0 = @echo GEN $@;
+my_verbose_0 = @echo " XGEN    $@";
 
-all-local: foo
+all-local: foo gen-headers
+
+list = 0 1 2
+.PHONY: gen-headers
+gen-headers:
+       @headers=`for i in $(list); do echo sub/$$i.h; done`; \
+       if $(AM_V_P); then set -x; else \
+         echo " GEN     [headers]"; \
+       fi; \
+       rm -f $$headers || exit 1; \
+## Only fake header generation.
+       : generate-header --flags $$headers
 
 foo: foo.in
        $(my_verbose)cp $(srcdir)/foo.in $@
@@ -37,36 +54,48 @@ EXTRA_DIST = foo.in
 CLEANFILES = foo
 EOF
 
-: >foo.in
+: > sub/foo.in
 
 $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
-./configure --enable-silent-rules
-$MAKE >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep '^ *GEN foo *$' stdout
-grep 'cp ' stdout && Exit 1
+do_check ()
+{
+  case ${1-} in
+    --silent) silent=:;;
+    --verbose) silent=false;;
+    *) fatal_ "do_check(): incorrect usage";;
+  esac
+  shift
+  $MAKE clean
+  $MAKE ${1+"$@"} >output 2>&1 || { cat output; Exit 1; }
+  sed 's/^/  /' output
+  if $silent; then
+    $FGREP 'cp ' output && Exit 1
+    $FGREP 'generate-header' output && Exit 1
+    $FGREP 'rm -f' output && Exit 1
+    grep '[012]\.h' output && Exit 1
+    grep '^ XGEN    foo$' output
+    grep '^ GEN     \[headers\]$' output
+  else
+    $FGREP 'GEN ' output && Exit 1
+    $FGREP 'cp ./foo.in foo' output
+    $FGREP "rm -f sub/0.h sub/1.h sub/2.h" output
+    $FGREP "generate-header --flags sub/0.h sub/1.h sub/2.h" output
+  fi
+}
 
-$MAKE clean
-$MAKE V=1 >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep 'GEN ' stdout && Exit 1
-grep 'cp \.*/foo\.in foo' stdout
+./configure --enable-silent-rules
+do_check --silent
+do_check --verbose V=1
 
 $MAKE distclean
 
 ./configure --disable-silent-rules
-$MAKE >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep 'GEN ' stdout && Exit 1
-grep 'cp \.*/foo\.in foo' stdout
-
-$MAKE clean
-$MAKE V=0 >stdout || { cat stdout; Exit 1; }
-cat stdout
-grep '^ *GEN foo *$' stdout
-grep 'cp ' stdout && Exit 1
+do_check --verbose
+do_check --silent V=0
+
+$MAKE distclean
 
 :
similarity index 100%
rename from t/subdir3.sh
rename to t/sourcefile-in-subdir.sh
similarity index 58%
rename from t/srcsub.sh
rename to t/src-acsubst.sh
index 978a105..97d536c 100755 (executable)
 # 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 config sub in _SOURCES fails.
+# Test to make sure config substitution in _SOURCES fails.
 
 . ./defs || Exit 1
 
-cat >> configure.ac << 'END'
-AC_PROG_CC
-END
+echo AC_PROG_CC >> configure.ac
 
 cat > Makefile.am << 'END'
-bin_PROGRAMS = x
+bin_PROGRAMS = x y
 x_SOURCES = x.c @FOO@
-EXTRA_x_SOURCES = y.c
+bar = @FOO@
+foo = $(bar)
+EXTRA_y_SOURCES = $(foo) y.c
 END
 
 $ACLOCAL
 AUTOMAKE_fails
-grep 'Makefile.am:2:.*x_SOURCES.*substitution' stderr
+
+cat > exp-err << 'END'
+Makefile.am:2: error: 'x_SOURCES' includes configure substitution '@FOO@';
+Makefile.am:2: configure substitutions are not allowed in _SOURCES variables
+Makefile.am:3: error: 'bar' includes configure substitution '@FOO@'
+Makefile.am:3: and is referred to from 'EXTRA_y_SOURCES';
+Makefile.am:3: configure substitutions are not allowed in _SOURCES variables
+END
+
+diff exp-err stderr
+
+:
diff --git a/t/srcsub2.sh b/t/srcsub2.sh
deleted file mode 100755 (executable)
index 2d6da97..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#! /bin/sh
-# Copyright (C) 2001-2012 Free Software Foundation, Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2, or (at your option)
-# any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program.  If not, see <http://www.gnu.org/licenses/>.
-
-# Test to make sure config sub in _SOURCES fails.
-
-. ./defs || Exit 1
-
-cat >> configure.ac << 'END'
-AC_PROG_CC
-END
-
-cat > Makefile.am << 'END'
-bin_PROGRAMS = x
-bar = @FOO@
-foo = $(bar)
-x_SOURCES = x.c $(foo)
-EXTRA_x_SOURCES = y.c
-END
-
-$ACLOCAL
-AUTOMAKE_fails
-grep 'Makefile.am:2:.*bar.*substitution' stderr
-grep 'Makefile.am:2:.*x_SOURCES' stderr
similarity index 97%
rename from t/subcond3.sh
rename to t/subdir-ac-subst.sh
index e84aa41..0ef238b 100755 (executable)
@@ -16,7 +16,7 @@
 
 # The for conditional SUBDIRS.
 # SUBDIRS + AC_SUBST setup from the manual.
-# Lots of lines here are duplicated in subcond2.test.
+# Lots of lines here are duplicated in subcond-am-cond.test.
 
 . ./defs || Exit 1
 
@@ -88,3 +88,5 @@ $MAKE distcheck
 test -f sanity1
 DISTCHECK_CONFIGURE_FLAGS=want_opt=yes $MAKE distcheck
 test -f sanity2
+
+:
similarity index 100%
rename from t/subdir5.sh
rename to t/subdir-add-pr46.sh
similarity index 100%
rename from t/subdir8.sh
rename to t/subdir-add2-pr46.sh
similarity index 97%
rename from t/subcond2.sh
rename to t/subdir-am-cond.sh
index 0e9f451..7f5e34a 100755 (executable)
@@ -16,7 +16,7 @@
 
 # The for conditional SUBDIRS.
 # SUBDIRS + AM_CONDITIONAL setup from the manual.
-# Lots of lines here are duplicated in subcond3.test.
+# Lots of lines here are duplicated in subdir-ac-subst.test.
 
 . ./defs || Exit 1
 
@@ -87,3 +87,5 @@ $MAKE distcheck
 test -f sanity1
 DISTCHECK_CONFIGURE_FLAGS=want_opt=yes $MAKE distcheck
 test -f sanity2
+
+:
similarity index 100%
rename from t/cond2.sh
rename to t/subdir-cond-err.sh
similarity index 94%
rename from t/subcond.sh
rename to t/subdir-cond-gettext.sh
index c09e5ad..459f639 100755 (executable)
@@ -21,9 +21,9 @@ required=gettext
 
 cat >> configure.ac << 'END'
 AM_GNU_GETTEXT
-AM_CONDITIONAL(MAUDE, true)
+AM_CONDITIONAL([MAUDE], [true])
 ALL_LINGUAS=
-AC_SUBST(ALL_LINGUAS)
+AC_SUBST([ALL_LINGUAS])
 END
 
 mkdir po intl
@@ -40,3 +40,5 @@ END
 $ACLOCAL
 # Gettext wants config.guess etc.
 $AUTOMAKE --add-missing
+
+:
diff --git a/t/subdir-order.sh b/t/subdir-order.sh
new file mode 100644 (file)
index 0000000..0321c25
--- /dev/null
@@ -0,0 +1,147 @@
+#! /bin/sh
+# Copyright (C) 2012 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# The $(SUDBIRS) entries are processed in the order they are specified.
+
+. ./defs || Exit 1
+
+cat >> configure.ac << 'END'
+AC_CONFIG_FILES([
+  sub0/Makefile
+  sub1/Makefile
+  sub2/Makefile
+  sub3/Makefile
+  sub3/a/Makefile
+  sub3/b/Makefile
+])
+AC_OUTPUT
+END
+
+mkdir sub0 sub1 sub2 sub3 sub3/a sub3/b
+
+cat > Makefile.am << 'END'
+SUBDIRS = sub2 sub1 sub3 sub0
+all-local:
+       test -f sub0/run
+       test -f sub1/run
+       test -f sub2/run
+       test -f sub3/run
+       test -f sub3/a/run
+       test -f sub3/b/run
+       test ! -f run
+       : > run
+
+CLEANFILES = \
+  run \
+  sub0/run \
+  sub1/run \
+  sub2/run \
+  sub3/run \
+  sub3/a/run \
+  sub3/b/run
+END
+
+cat > sub0/Makefile.am << 'END'
+all-local:
+       test ! -f $(top_builddir)/run
+       test -f $(top_builddir)/sub1/run
+       test -f $(top_builddir)/sub3/run
+       test -f $(top_builddir)/sub3/a/run
+       test -f $(top_builddir)/sub3/b/run
+       test ! -f run
+       : > run
+END
+
+cat > sub1/Makefile.am << 'END'
+all-local:
+       test ! -f $(top_builddir)/run
+       test ! -f $(top_builddir)/sub0/run
+       test -f $(top_builddir)/sub2/run
+       test ! -f $(top_builddir)/sub3/run
+       test ! -f $(top_builddir)/sub3/a/run
+       test ! -f $(top_builddir)/sub3/b/run
+       test ! -f run
+       : > run
+END
+
+
+cat > sub2/Makefile.am << 'END'
+all-local:
+       test ! -f $(top_builddir)/run
+       test ! -f $(top_builddir)/sub0/run
+       test ! -f $(top_builddir)/sub1/run
+       test ! -f $(top_builddir)/sub3/run
+       test ! -f $(top_builddir)/sub3/a/run
+       test ! -f $(top_builddir)/sub3/b/run
+       test ! -f run
+       : > run
+END
+
+cat > sub3/Makefile.am << 'END'
+SUBDIRS = b . a
+all-local:
+       test ! -f $(top_builddir)/run
+       test ! -f $(top_builddir)/sub0/run
+       test -f $(top_builddir)/sub1/run
+       test ! -f $(top_builddir)/sub3/a/run
+       test -f $(top_builddir)/sub3/b/run
+       test ! -f run
+       : > run
+END
+
+cat > sub3/a/Makefile.am << 'END'
+all-local:
+       test ! -f $(top_builddir)/run
+       test ! -f $(top_builddir)/sub0/run
+       test -f $(top_builddir)/sub1/run
+       test -f $(top_builddir)/sub3/b/run
+       test -f $(top_builddir)/sub3/run
+       test ! -f run
+       : > run
+END
+
+cat > sub3/b/Makefile.am << 'END'
+all-local:
+       test ! -f $(top_builddir)/run
+       test ! -f $(top_builddir)/sub0/run
+       test -f $(top_builddir)/sub1/run
+       test ! -f $(top_builddir)/sub3/b/run
+       test ! -f $(top_builddir)/sub3/run
+       test ! -f run
+       : > run
+END
+
+
+$ACLOCAL
+$AUTOCONF
+$AUTOMAKE -c --add-missing
+
+./configure
+
+for j in '' -j12; do
+  $MAKE $j
+  test -f run
+  test -f sub0/run
+  test -f sub1/run
+  test -f sub3/run
+  test -f sub3/a/run
+  test -f sub3/b/run
+  $MAKE clean
+  find . | grep 'run$' && Exit 1
+  : # For shells with busted 'set -e'
+done
+
+:
similarity index 91%
rename from t/subdir2.sh
rename to t/subdir-subsub.sh
index 31e3c61..15f2f93 100755 (executable)
@@ -43,10 +43,17 @@ SUBDIRS = two
 END
 
 cat > one/two/Makefile.am << 'END'
-pkgdata_DATA =
+pkgdata_DATA = data.txt
+data.txt:
+       echo dummy >$@
 END
 
 $ACLOCAL
+$AUTOCONF
 $AUTOMAKE --gnu
 
+./configure
+$MAKE
+test -f one/two/data.txt
+
 :
similarity index 97%
rename from t/subdir9.sh
rename to t/subdir-with-slash.sh
index 116e1c3..eb9f4fe 100755 (executable)
@@ -14,7 +14,7 @@
 # You should have received a copy of the GNU General Public License
 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
-# Test SUDBIRS with /.
+# Test SUDBIRS with '/' in them.
 
 . ./defs || Exit 1