automake
[Top][All Lists]
Advanced

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

Re: silent build rules


From: Ralf Wildenhues
Subject: Re: silent build rules
Date: Tue, 14 Apr 2009 08:09:12 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

[ dropping m4-discuss ]

Hello Bob, Eric, all,

* Bob Friesenhahn wrote on Fri, Apr 03, 2009 at 08:55:39PM CEST:
> On Fri, 3 Apr 2009, Ralf Wildenhues wrote:
>> 1) The developer can choose to enable the silent-rules option in
>> configure.ac (as argument to AM_INIT_AUTOMAKE) or Makefile.am (adding
>> the option to the AUTOMAKE_OPTIONS variable).  Without this option,
>> there will never be less verbose output.
>>
>> 2) The developer or the maintainer can achieve the same effect as in (1)
>> by adding the command line argument --silent-rules when running
>> automake.
>>
>> 3) If (1) or (2) were done, then the user can enable less verbose output
>> with ./configure --enable-silent-rules (the default is verbose).
>>
>> 4) If (3) as well as either (1) or (2) were done, then, at 'make' run
>> time, less verbose output can be disabled with
>>  make V=1
>>
>> Is that a compromise everybody can live with?
>
> This is an approach that I am happy with.  I would not want to deny  
> anyone access to silent rules if they want it (and I will am likely use 
> it for my own developer builds), but feel that traditional verbose  
> should continue to be the default.  Without traditional verbose being  
> the default then GNU packages suddenly start to build differently, and  
> the user is much less likely to be able to diagnose a problem by  
> themselves without consuming time from the package maintainer.

This patch introduces such an --enable-silent-rules switch.  However, it
has additional restrictions over the above semantics: I had to drop (2)
completely, and (1) works only when adding `silent-rules' as argument to
AM_INIT_AUTOMAKE in configure.ac, not in AUTOMAKE_OPTIONS in
Makefile.am.

Here's why:

The contents of `configure' may not depend upon the contents of
Makefile.am files, neither upon the command line options of `automake'.
This is because otherwise, the dependency graph between autotools files
disallows `configure' to depend upon `Makefile.am'; rebuild rules will
not do the right thing then.

One way out would be to present the --enable-silent-rules switch to the
user unconditionally.  I don't like enabling silent-rules
unconditionally, for reasons stated earlier; and I don't like presenting
--enable switches that then don't work either (e.g., if the machinery
hasn't been added to Makefile.in).

Another way out would be to go the way Automake has gone with
no-dependencies: enable the silent-rules machinery always, unless the
developer opts out by using `no-silent-rules'.  Big drawback of this
approach: it is a backward incompatibility.

Yet another way out: remove per-Makefile.am `AUTOMAKE_OPTIONS =
silent-rules' as well as `automake --silent-rules' so that the only way
to specify them is as option listed in AM_INIT_AUTOMAKE.  This may be
inconvenient for those who do not govern the AM_INIT_AUTOMAKE call,
but do govern other parts of (or included files from) configure.ac.

The last choice seemed to be the best way out, so I went with that.
I've pushed the patch to the 'next' branch.

Cheers,
Ralf

    silent-rules reorganization, --enable-silent-rules switch.
    
    This patch introduces a configure-time option to set the default
    verbosity.  Since configure now needs to know whether the
    `silent-rules' automake option was set, the latter can only be
    set within AM_INIT_AUTOMAKE, or with a new AM_SILENT_RULES macro
    but not any more through AUTOMAKE_OPTIONS or the automake
    command line option `--silent-rules'.
    
    * automake.in (define_verbose_var): Define the default verbose
    variable in terms of `$(AM_DEFAULT_VERBOSITY)'.
    (handle_configure): Do not pass `--silent-rules' to automake.
    (scan_autoconf_traces): Trace `AM_SILENT_RULES'.  If seen,
    enable global `silent-rules' option.
    (usage): Do not document `--silent-rules'.
    (parse_arguments): Do not accept `--silent-rules'.
    * doc/automake.texi (Options): Overhaul.  Document
    AM_SILENT_RULES, --enable-silent-rules, --disable-silent-rules,
    AM_DEFAULT_VERBOSITY.  Show an example for user-added variables
    for less verbose output.
    (Invoking Automake): Remove documentation for `--silent-rules'.
    (Public Macros): Document `AM_SILENT_RULES'.
    * NEWS: Update.
    * lib/Automake/Options.pm (_process_option_list): Accept
    `silent-rules' only as option in configure.ac.
    * m4/init.m4 (AM_INIT_AUTOMAKE): If the `silent-rules' option
    was enabled, require `AM_SILENT_RULES'; move AM_BACKSLASH
    initialization to ...
    * m4/silent.m4 (AM_SILENT_RULES): ... this new file, new macro.
    Deal with `--enable-silent-rules' switch; define
    AM_DEFAULT_VERBOSITY.
    * m4/Makefile.am (dist_m4data_DATA): Add silent.m4.
    * tests/dollarvar.test: Remove tests for `--silent-rules', use
    `AM_SILENT_RULES'.
    * tests/flavor.test: Remove test for `--silent-rules'.
    * tests/silent.test: Use `AM_SILENT_RULES' instead of
    `AUTOMAKE_OPTIONS = silent-rules'; use `--enable-silent-rules'.
    * tests/silent2.test: Likewise.
    * tests/silent3.test: Likewise.
    * tests/silent4.test: Likewise.
    * tests/silent5.test: Likewise.
    * tests/silent6.test: Likewise. Test `AM_SILENT_RULES' as well
    as `AM_INIT_AUTOMAKE([silent-rules])' instead of
    `--silent-rules'.
    * tests/silent7.test: Use `AM_SILENT_RULES' instead of
    `AUTOMAKE_OPTIONS = silent-rules'; ensure the latter is rejected.
    Test combinations of --enable-silent-rules and
    --disable-silent-rules with `make V=0' and `make V=1'.
    Suggestion for configure-time switch by Bob Friesenhahn.

diff --git a/NEWS b/NEWS
index 64756fe..db639f9 100644
--- a/NEWS
+++ b/NEWS
@@ -17,6 +17,14 @@ New in 1.10c:
   - The new `parallel-tests' targets `recheck' and `recheck-html' will not run
     any tests that have not run yet.
 
+  - The `silent-rules' mode introduces a configure-time `--enable-silent-rules'
+    option to specify the default build verbosity; it can still be overridden
+    with an explicit `make V=[0|1]'.  The configure switch necessitated to
+    remove the automake command-line switch `--silent-rules' and 
per-Makefile.am
+    settings `AUTOMAKE_OPTIONS = silent-rules', so the feature needs to be
+    enabled in configure.ac now, either by adding the `silent-rules' option
+    to `AM_INIT_AUTOMAKE', or by calling the new `AM_SILENT_RULES' macro.
+
 Bugs fixed in 1.10c:
 
 * Long standing bugs:
diff --git a/automake.in b/automake.in
index 10927a1..137b8da 100755
--- a/automake.in
+++ b/automake.in
@@ -1144,7 +1144,7 @@ sub define_verbose_var ($$)
       {
        # Using `$V' instead of `$(V)' breaks IRIX make.
        define_variable ($var, '$(' . $pvar . '_$(V))', INTERNAL);
-       define_variable ($pvar . '_', $val, INTERNAL);
+       define_variable ($pvar . '_', '$(' . $pvar . 
'_$(AM_DEFAULT_VERBOSITY))', INTERNAL);
        define_variable ($pvar . '_0', $val, INTERNAL);
       }
 }
@@ -4197,8 +4197,7 @@ sub handle_configure ($$$@)
                          @configuredeps);
 
   my $automake_options = '--' . (global_option 'cygnus' ? 'cygnus' : 
$strictness_name)
-                        . (global_option 'no-dependencies' ? ' --ignore-deps' 
: '')
-                        . (global_option 'silent-rules' ? ' --silent-rules' : 
'');
+                        . (global_option 'no-dependencies' ? ' --ignore-deps' 
: '');
 
   $output_rules .= file_contents
     ('configure',
@@ -5212,6 +5211,7 @@ sub scan_autoconf_traces ($)
                AM_INIT_AUTOMAKE => 0,
                AM_MAINTAINER_MODE => 0,
                AM_PROG_CC_C_O => 0,
+               AM_SILENT_RULES => 0,
                _AM_SUBST_NOTMAKE => 1,
                _AM_COND_IF => 1,
                _AM_COND_ELSE => 1,
@@ -5405,6 +5405,10 @@ sub scan_autoconf_traces ($)
        {
          $seen_cc_c_o = $where;
        }
+      elsif ($macro eq 'AM_SILENT_RULES')
+        {
+         set_global_option ('silent-rules', $where);
+       }
       elsif ($macro eq '_AM_COND_IF')
         {
          cond_stack_if ('', $args[1], $where);
@@ -8158,9 +8162,6 @@ Dependency tracking:
   -i, --ignore-deps      disable dependency tracking code
       --include-deps     enable dependency tracking code
 
-Verbosity of generated rules:
-      --silent-rules     enable silent build rules
-
 Flavors:
       --cygnus           assume program is part of Cygnus-style tree
       --foreign          set strictness to foreign
@@ -8272,8 +8273,6 @@ sub parse_arguments ()
      'o|output-dir=s'  => \$output_directory,
      'a|add-missing'   => \$add_missing,
      'c|copy'          => \$copy_missing,
-     'silent-rules'    => sub { set_global_option ('silent-rules',
-                                                   $cli_where); },
      'v|verbose'       => sub { setup_channel 'verb', silent => 0; },
      'W|warnings=s'     => \&parse_warnings,
      # These long options (--Werror and --Wno-error) for backward
diff --git a/doc/automake.texi b/doc/automake.texi
index 453fff9..0094fa0 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -2559,10 +2559,6 @@ Ordinarily each @file{Makefile.in} is created in the 
directory of the
 corresponding @file{Makefile.am}.  This option is deprecated and will be
 removed in a future release.
 
address@hidden --silent-rules
address@hidden --silent-rules
-Enable the @option{silent-rules} option globally (@pxref{Options}).
-
 @item -v
 @itemx --verbose
 @opindex -v
@@ -3889,6 +3885,10 @@ variable.  The default @var{compiler-search-list} is 
@samp{upcc upc}.
 This macro will abort @command{configure} if no Unified Parallel C
 compiler is found.
 
address@hidden AM_SILENT_RULES
address@hidden AM_SILENT_RULES
+Enable the machinery for less verbose build output (@pxref{Options}).
+
 @item AM_WITH_DMALLOC
 @acindex AM_WITH_DMALLOC
 @cindex @command{dmalloc}, support for
@@ -9022,8 +9022,8 @@ letter; it should be omitted for non-alpha releases.
 @item @option{silent-rules}
 @cindex Option, @option{silent-rules}
 @opindex silent-rules
-Enable silent build rules.  This will cause many build rules to output a
-status line of the form
+Enable less verbose build rules.  This can be used to let build rules
+output a status line of the form
 
 @example
   GEN @var{output-file}
@@ -9031,12 +9031,38 @@ status line of the form
 
 @noindent
 instead of printing the command that will be executed to update
address@hidden  It will also silence @command{libtool} output.
address@hidden  It can also silence @command{libtool} output.
+
+To enable less verbose build rules, both the developer and the user
+of the package have to take a number of steps.  The developer needs
+to do either of the following:
+
address@hidden @bullet
address@hidden
+Add the @option{silent-rules} option as argument to @code{AM_INIT_AUTOMAKE}.
address@hidden
+Call the @code{AM_SILENT_RULES} macro from within the @file{configure.ac}
+file.
address@hidden itemize
 
address@hidden default verbosity for silent-rules
+If the developer has done either of the above, then the user of the
+package may influence the verbosity at @command{configure} run time as
+well as at @command{make} run time:
+
address@hidden @bullet
address@hidden
address@hidden --enable-silent-rules
address@hidden --disable-silent-rules
+Passing @option{--enable-silent-rules} to @command{configure} will cause
+build rules to be less verbose; the option @option{--disable-silent-rules}
+is the default and will cause normal verbose output.
address@hidden
 @vindex @code{V}
-The verbosity can be influenced at @command{make} run time by setting the
-variable @code{V}: @samp{make V=0} is equivalent to @code{V} being unset,
-while @samp{make V=1} will produce verbose output.
+At @command{make} run time, the default chosen at @command{configure}
+time may be overridden: @code{make V=1} will produce verbose output,
address@hidden V=0} less verbose output.
address@hidden itemize
 
 For portability to different @command{make} implementations, package authors
 are advised to not set the variable @code{V} inside the @file{Makefile.am}
@@ -9053,11 +9079,31 @@ expansion, which are in turn enabled by 
@option{-Wportability}
 
 @vindex @code{AM_V_GEN}
 @vindex @code{AM_V_at}
-To extend the silent mode to your own rules, 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.  With @code{V=1}, these
-variables will expand to empty strings.
address@hidden @code{AM_DEFAULT_VERBOSITY}
+To extend the silent mode to your own rules, you have two choices:
+
address@hidden @bullet
address@hidden
+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
address@hidden 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.
address@hidden
+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
address@hidden:
+
address@hidden
+pkg_verbose = $(pkg_verbose_$(V))
+pkg_verbose_ = $(pkg_verbose_$(AM_DEFAULT_VERBOSITY))
+pkg_verbose_0 = @@echo GEN $@@;
+
+foo: foo.in
+        $(pkg_verbose)cp $(srcdir)/foo.in $@@
address@hidden example
address@hidden itemize
+
 
 @item @option{std-options}
 @cindex Options, @option{std-options}
diff --git a/lib/Automake/Options.pm b/lib/Automake/Options.pm
index 5e05792..ea4e6bb 100644
--- a/lib/Automake/Options.pm
+++ b/lib/Automake/Options.pm
@@ -265,7 +265,7 @@ sub _process_option_list (\%$@)
             || $_ eq 'readme-alpha' || $_ eq 'check-news'
             || $_ eq 'subdir-objects' || $_ eq 'nostdinc'
             || $_ eq 'no-exeext' || $_ eq 'no-define'
-            || $_ eq 'std-options' || $_ eq 'silent-rules'
+            || $_ eq 'std-options'
             || $_ eq 'color-tests' || $_ eq 'parallel-tests'
             || $_ eq 'cygnus' || $_ eq 'no-dependencies')
        {
@@ -276,6 +276,12 @@ sub _process_option_list (\%$@)
          delete $options->{$_};
          $options->{'filename-length-max'} = [$_, $1];
        }
+      elsif ($_ eq  'silent-rules')
+        {
+         error ($where,
+                "option `$_' must be an argument of AM_INIT_AUTOMAKE")
+           if $where->get !~ /^configure\./;
+       }
       elsif ($_ eq 'tar-v7' || $_ eq 'tar-ustar' || $_ eq 'tar-pax')
        {
          error ($where,
diff --git a/m4/Makefile.am b/m4/Makefile.am
index 9f5e1c2..0ce26d1 100644
--- a/m4/Makefile.am
+++ b/m4/Makefile.am
@@ -3,7 +3,7 @@
 ## Makefile for Automake m4.
 
 ## Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2006,
-## 2008 Free Software Foundation, Inc.
+## 2008, 2009 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
@@ -52,6 +52,7 @@ python.m4 \
 regex.m4 \
 runlog.m4 \
 sanity.m4 \
+silent.m4 \
 strip.m4 \
 substnot.m4 \
 tar.m4 \
diff --git a/m4/init.m4 b/m4/init.m4
index 5978502..365c9ac 100644
--- a/m4/init.m4
+++ b/m4/init.m4
@@ -100,9 +100,7 @@ AC_PROVIDE_IFELSE([AC_PROG_OBJC],
                  [define([AC_PROG_OBJC],
                          defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
 ])
-AM_BACKSLASH='\'
-AC_SUBST([AM_BACKSLASH])dnl
-_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
+_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
 dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
 dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen.  This macro
 dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
diff --git a/m4/silent.m4 b/m4/silent.m4
new file mode 100644
index 0000000..6d2a1a2
--- /dev/null
+++ b/m4/silent.m4
@@ -0,0 +1,27 @@
+##                                                          -*- Autoconf -*-
+# Copyright (C) 2009  Free Software Foundation, Inc.
+#
+# This file is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# serial 1
+
+# AM_SILENT_RULES([DEFAULT])
+# --------------------------
+# Enable less verbose build rules; with the default set to DEFAULT
+# (`yes' being less verbose, `no' or empty being verbose).
+AC_DEFUN([AM_SILENT_RULES],
+[AC_ARG_ENABLE([silent-rules],
+[  --enable-silent-rules          less verbose build output (undo: `make V=1')
+  --disable-silent-rules         verbose build output (undo: `make V=0')])
+case $enable_silent_rules in
+yes) AM_DEFAULT_VERBOSITY=0;;
+no)  AM_DEFAULT_VERBOSITY=1;;
+*)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
+esac
+AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
+AM_BACKSLASH='\'
+AC_SUBST([AM_BACKSLASH])dnl
+_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
+])
diff --git a/tests/dollarvar.test b/tests/dollarvar.test
index 8dc54f7..ea042b5 100755
--- a/tests/dollarvar.test
+++ b/tests/dollarvar.test
@@ -48,18 +48,11 @@ grep 'Makefile.am:7' stderr
 # On the other hand, if we allow `silent-rules' mode, then we need to
 # allow recursive variable expansion, too.
 
-# This should work with the `--silent-rules' command line switch.
-AUTOMAKE_fails -Wportability --silent-rules
-grep 'Makefile.am:2' stderr
-grep 'Makefile.am:3' stderr
-grep 'Makefile.am:4' stderr
-grep 'Makefile.am:5' stderr
-grep 'Makefile.am:6' stderr && Exit 1
-grep 'Makefile.am:7' stderr && Exit 1
-
-# This should work with AUTOMAKE_OPTIONS.
-echo 'AUTOMAKE_OPTIONS = silent-rules' >> Makefile.am
+# This should work with the AM_SILENT_RULES macro.
+$sleep
+echo 'AM_SILENT_RULES' >> configure.in
 
+$ACLOCAL --force
 AUTOMAKE_fails -Wportability
 grep 'Makefile.am:2' stderr
 grep 'Makefile.am:3' stderr
diff --git a/tests/flavor.test b/tests/flavor.test
index 6c4756b..c9ea970 100755
--- a/tests/flavor.test
+++ b/tests/flavor.test
@@ -37,7 +37,7 @@ END
 $ACLOCAL
 $AUTOCONF
 # Order flavors so that all needed files are installed early.
-for flavor in --gnits --gnu --foreign --cygnus --ignore-deps --silent-rules
+for flavor in --gnits --gnu --foreign --cygnus --ignore-deps
 do
   $AUTOMAKE --add-missing $flavor
   ./configure --enable-maintainer-mode
diff --git a/tests/silent.test b/tests/silent.test
index b39d49c..4eb11d5 100755
--- a/tests/silent.test
+++ b/tests/silent.test
@@ -25,6 +25,7 @@ set -e
 mkdir sub
 
 cat >>configure.in <<'EOF'
+AM_SILENT_RULES
 AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
 AM_PROG_CC_C_O
@@ -32,7 +33,6 @@ AC_OUTPUT
 EOF
 
 cat > Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = silent-rules
 # Need generic and non-generic rules.
 bin_PROGRAMS = foo bar
 bar_CFLAGS = $(AM_CFLAGS)
@@ -40,7 +40,7 @@ SUBDIRS = sub
 EOF
 
 cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = silent-rules subdir-objects
+AUTOMAKE_OPTIONS = subdir-objects
 # Need generic and non-generic rules.
 bin_PROGRAMS = baz bla
 bla_CFLAGS = $(AM_CFLAGS)
@@ -60,7 +60,7 @@ $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
-./configure
+./configure --enable-silent-rules
 $MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep ' -c' stdout && Exit 1
diff --git a/tests/silent2.test b/tests/silent2.test
index a1149f4..a208151 100755
--- a/tests/silent2.test
+++ b/tests/silent2.test
@@ -27,6 +27,7 @@ set -e
 mkdir sub
 
 cat >>configure.in <<'EOF'
+AM_SILENT_RULES
 AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
 AM_PROG_CC_C_O
@@ -34,7 +35,6 @@ AC_OUTPUT
 EOF
 
 cat > Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = silent-rules
 # Need generic and non-generic rules.
 bin_PROGRAMS = foo bar
 bar_CFLAGS = $(AM_CFLAGS)
@@ -42,7 +42,7 @@ SUBDIRS = sub
 EOF
 
 cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = silent-rules subdir-objects
+AUTOMAKE_OPTIONS = subdir-objects
 # Need generic and non-generic rules.
 bin_PROGRAMS = baz bla
 bla_CFLAGS = $(AM_CFLAGS)
@@ -62,7 +62,7 @@ $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
-./configure am_cv_CC_dependencies_compiler_type=gcc
+./configure am_cv_CC_dependencies_compiler_type=gcc --enable-silent-rules
 $MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep ' -c' stdout && Exit 1
diff --git a/tests/silent3.test b/tests/silent3.test
index 5e2ecda..c1266b7 100755
--- a/tests/silent3.test
+++ b/tests/silent3.test
@@ -26,6 +26,7 @@ set -e
 mkdir sub
 
 cat >>configure.in <<'EOF'
+AM_SILENT_RULES
 AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
 AM_PROG_CC_C_O
@@ -34,7 +35,6 @@ AC_OUTPUT
 EOF
 
 cat > Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = silent-rules
 # Need generic and non-generic rules.
 lib_LTLIBRARIES = libfoo.la libbar.la
 libbar_la_CFLAGS = $(AM_CFLAGS)
@@ -42,7 +42,7 @@ SUBDIRS = sub
 EOF
 
 cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = silent-rules subdir-objects
+AUTOMAKE_OPTIONS = subdir-objects
 # Need generic and non-generic rules.
 lib_LTLIBRARIES = libbaz.la libbla.la
 libbla_la_CFLAGS = $(AM_CFLAGS)
@@ -63,7 +63,7 @@ $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
-./configure
+./configure --enable-silent-rules
 $MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep ' -c' stdout && Exit 1
diff --git a/tests/silent4.test b/tests/silent4.test
index 7ed8922..7f96f60 100755
--- a/tests/silent4.test
+++ b/tests/silent4.test
@@ -27,6 +27,7 @@ set -e
 mkdir sub
 
 cat >>configure.in <<'EOF'
+AM_SILENT_RULES
 AC_CONFIG_FILES([sub/Makefile])
 AC_PROG_CC
 AM_PROG_CC_C_O
@@ -35,7 +36,6 @@ AC_OUTPUT
 EOF
 
 cat > Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = silent-rules
 # Need generic and non-generic rules.
 lib_LTLIBRARIES = libfoo.la libbar.la
 libbar_la_CFLAGS = $(AM_CFLAGS)
@@ -43,7 +43,7 @@ SUBDIRS = sub
 EOF
 
 cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = silent-rules subdir-objects
+AUTOMAKE_OPTIONS = subdir-objects
 # Need generic and non-generic rules.
 lib_LTLIBRARIES = libbaz.la libbla.la
 libbla_la_CFLAGS = $(AM_CFLAGS)
@@ -64,7 +64,7 @@ $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
-./configure am_cv_CC_dependencies_compiler_type=gcc
+./configure am_cv_CC_dependencies_compiler_type=gcc --enable-silent-rules
 $MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep ' -c' stdout && Exit 1
diff --git a/tests/silent5.test b/tests/silent5.test
index 90e21b9..08c22d8 100755
--- a/tests/silent5.test
+++ b/tests/silent5.test
@@ -24,6 +24,7 @@ set -e
 mkdir sub
 
 cat >>configure.in <<'EOF'
+AM_SILENT_RULES
 AM_PROG_CC_C_O
 AC_PROG_CXX
 AC_PROG_F77
@@ -35,7 +36,6 @@ AC_OUTPUT
 EOF
 
 cat > Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = silent-rules
 # Need generic and non-generic rules.
 bin_PROGRAMS = foo bar
 bar_CFLAGS = $(AM_CFLAGS)
@@ -47,7 +47,7 @@ BUILT_SOURCES = foo6.h
 EOF
 
 cat > sub/Makefile.am <<'EOF'
-AUTOMAKE_OPTIONS = silent-rules subdir-objects
+AUTOMAKE_OPTIONS = subdir-objects
 # Need generic and non-generic rules.
 bin_PROGRAMS = baz bla
 bla_CFLAGS = $(AM_CFLAGS)
@@ -103,7 +103,7 @@ $AUTOCONF
 # configure once for fastdep, once for non-fastdep
 for config_args in '' am_cv_CC_dependencies_compiler_type=gcc
 do
-  ./configure $config_args
+  ./configure $config_args --enable-silent-rules
   $MAKE >stdout || { cat stdout; Exit 1; }
   cat stdout
   grep ' -c' stdout && Exit 1
diff --git a/tests/silent6.test b/tests/silent6.test
index b0cacc8..1f6a718 100755
--- a/tests/silent6.test
+++ b/tests/silent6.test
@@ -21,19 +21,14 @@
 set -e
 
 cat >>configure.in <<'EOF'
-# Layering violation: this conditional should be decided
-# by the package author, not the user.  We just do it here
-# for testing convenience.
-AM_CONDITIONAL([SILENT], [test "$silent_rules" = yes])
+AM_SILENT_RULES
 AC_OUTPUT
 EOF
 
 cat > Makefile.am <<'EOF'
-if SILENT
 my_verbose = $(my_verbose_$(V))
-my_verbose_ = $(my_verbose_0)
+my_verbose_ = $(my_verbose_$(AM_DEFAULT_VERBOSITY))
 my_verbose_0 = @echo GEN $@;
-endif
 
 all-local: foo
 
@@ -46,10 +41,10 @@ EOF
 : >foo.in
 
 $ACLOCAL
-$AUTOMAKE --add-missing --silent-rules
+$AUTOMAKE --add-missing
 $AUTOCONF
 
-./configure silent_rules=yes
+./configure --enable-silent-rules
 $MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'GEN foo' stdout
@@ -63,7 +58,7 @@ grep 'cp ' stdout
 
 $MAKE distclean
 
-./configure silent_rules=no
+./configure --disable-silent-rules
 $MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'GEN foo' stdout && Exit 1
@@ -71,26 +66,36 @@ grep 'cp ' stdout
 
 $MAKE distclean
 
+$sleep
 # Things should also work with -Wall in AM_INIT_AUTOMAKE.
 cat > configure.in <<'END'
 AC_INIT([silent6], [1.0])
 AM_INIT_AUTOMAKE([-Wall])
-AM_CONDITIONAL([SILENT], [:])
 AC_CONFIG_FILES([Makefile])
-AC_OUTPUT
 END
 
 $ACLOCAL
-AUTOMAKE_fails --force
-$AUTOMAKE --force -Wno-error
-grep ' --silent-rules' Makefile.in && Exit 1
-$AUTOMAKE --force --silent-rules
-grep ' --silent-rules' Makefile.in
-$AUTOMAKE --force -Wno-all -Wportability --silent-rules
-grep ' --silent-rules' Makefile.in
-
-echo 'AUTOMAKE_OPTIONS = silent-rules' >> Makefile.am
-$AUTOMAKE --force
+AUTOMAKE_fails
+$AUTOMAKE -Wno-error
+
+# AM_SILENT_RULES should turn off the warning
+$sleep
+echo 'AM_SILENT_RULES' >> configure.in
+$ACLOCAL
+$AUTOMAKE
+grep 'AM_V_GEN' Makefile.in
+$AUTOMAKE --force -Wno-all -Wportability
+grep 'AM_V_GEN' Makefile.in
+
+# The `silent-rules' option to AM_INIT_AUTOMAKE should work likewise.
+$sleep
+cat > configure.in <<'END'
+AC_INIT([silent6], [1.0])
+AM_INIT_AUTOMAKE([silent-rules])
+AC_CONFIG_FILES([Makefile])
+END
+$ACLOCAL
+$AUTOMAKE
 grep 'AM_V_GEN' Makefile.in
 $AUTOMAKE --force -Wno-all -Wportability
 grep 'AM_V_GEN' Makefile.in
diff --git a/tests/silent7.test b/tests/silent7.test
index 68a0e89..cca2644 100755
--- a/tests/silent7.test
+++ b/tests/silent7.test
@@ -21,6 +21,7 @@
 set -e
 
 cat >>configure.in <<'EOF'
+AM_SILENT_RULES
 AC_OUTPUT
 EOF
 
@@ -42,19 +43,31 @@ $ACLOCAL
 $AUTOMAKE --add-missing
 $AUTOCONF
 
-./configure
+./configure --disable-silent-rules
 $MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'GEN.*foo' stdout && Exit 1
 grep 'cp ' stdout
 grep 'echo ' stdout
 
-$MAKE distclean
+$MAKE clean
+$MAKE V=1 >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep 'GEN.*foo' stdout && Exit 1
+grep 'cp ' stdout
+grep 'echo ' stdout
 
-echo 'AUTOMAKE_OPTIONS = silent-rules' >> Makefile.am
-$AUTOMAKE
+$MAKE clean
+$MAKE V=0 >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep 'GEN.*foo' stdout
+grep 'cp ' stdout && Exit 1
+grep 'echo ' stdout && Exit 1
+
+
+$MAKE distclean
 
-./configure
+./configure --enable-silent-rules
 $MAKE >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'GEN.*foo' stdout
@@ -62,10 +75,21 @@ grep 'cp ' stdout && Exit 1
 grep 'echo ' stdout && Exit 1
 
 $MAKE clean
+$MAKE V=0 >stdout || { cat stdout; Exit 1; }
+cat stdout
+grep 'GEN.*foo' stdout
+grep 'cp ' stdout && Exit 1
+grep 'echo ' stdout && Exit 1
+
+$MAKE clean
 $MAKE V=1 >stdout || { cat stdout; Exit 1; }
 cat stdout
 grep 'GEN.*foo' stdout && Exit 1
 grep 'cp ' stdout
 grep 'echo ' stdout
 
+# Ensure that setting `silent-rules' in a Makefile.am produces an error.
+echo 'AUTOMAKE_OPTIONS = silent-rules' >> Makefile.am
+AUTOMAKE_fails --force
+
 :




reply via email to

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