# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
-# 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], [dnl
+# _AM_SILENT_RULES
+# ----------------
+# Enable less verbose build rules support.
+AC_DEFUN([_AM_SILENT_RULES],
+[AM_DEFAULT_VERBOSITY=1
+AC_ARG_ENABLE([silent-rules], [dnl
AS_HELP_STRING(
[--enable-silent-rules],
[less verbose build output (undo: "make V=1")])
[--disable-silent-rules],
[verbose build output (undo: "make V=0")])dnl
])
-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
dnl
dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
dnl do not support nested variable expansions.
else
am_cv_make_support_nested_variables=no
fi])
-if test $am_cv_make_support_nested_variables = yes; then
- dnl Using '$V' instead of '$(V)' breaks IRIX make.
- AM_V='$(V)'
- AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
-else
- AM_V=$AM_DEFAULT_VERBOSITY
- AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
-fi
AC_SUBST([AM_V])dnl
AM_SUBST_NOTMAKE([AM_V])dnl
AC_SUBST([AM_DEFAULT_V])dnl
AM_BACKSLASH='\'
AC_SUBST([AM_BACKSLASH])dnl
_AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
+dnl Delay evaluation of AM_DEFAULT_VERBOSITY to the end to allow multiple calls
+dnl to AM_SILENT_RULES to change the default value.
+AC_CONFIG_COMMANDS_PRE([dnl
+case $enable_silent_rules in @%:@ (((
+ yes) AM_DEFAULT_VERBOSITY=0;;
+ no) AM_DEFAULT_VERBOSITY=1;;
+esac
+if test $am_cv_make_support_nested_variables = yes; then
+ dnl Using '$V' instead of '$(V)' breaks IRIX make.
+ AM_V='$(V)'
+ AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
+else
+ AM_V=$AM_DEFAULT_VERBOSITY
+ AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
+fi
+])dnl
])
+
+# AM_SILENT_RULES([DEFAULT])
+# --------------------------
+# Set the default verbosity level to DEFAULT ("yes" being less verbose, "no" or
+# empty being verbose).
+AC_DEFUN([AM_SILENT_RULES],
+[AC_REQUIRE([_AM_SILENT_RULES])
+AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
--- /dev/null
+#!/bin/sh
+# Copyright (C) 2022 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 <https://www.gnu.org/licenses/>.
+
+# Check verbose mode defaults and behavior.
+
+. test-init.sh
+
+: > Makefile.am
+
+# Default behavior is currently verbose.
+cat <<EOF >configure.ac
+AC_INIT([silent-defaults], [1.0])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+EOF
+
+$ACLOCAL
+$AUTOMAKE
+$AUTOCONF
+
+./configure -C
+grep '^AM_DEFAULT_VERBOSITY = 1' Makefile
+
+./configure -C --enable-silent-rules
+grep '^AM_DEFAULT_VERBOSITY = 0' Makefile
+
+./configure -C --disable-silent-rules
+grep '^AM_DEFAULT_VERBOSITY = 1' Makefile
+
+# User doesn't pick a silent mode default before AM_INIT_AUTOMAKE.
+cat <<EOF >configure.ac
+AC_INIT([silent-defaults], [1.0])
+AM_SILENT_RULES
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+EOF
+
+$AUTOCONF
+
+./configure -C
+grep '^AM_DEFAULT_VERBOSITY = 1' Makefile
+
+./configure -C --enable-silent-rules
+grep '^AM_DEFAULT_VERBOSITY = 0' Makefile
+
+./configure -C --disable-silent-rules
+grep '^AM_DEFAULT_VERBOSITY = 1' Makefile
+
+# User disables silent mode default before AM_INIT_AUTOMAKE.
+cat <<EOF >configure.ac
+AC_INIT([silent-defaults], [1.0])
+AM_SILENT_RULES([no])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+EOF
+
+$AUTOCONF
+
+./configure -C
+grep '^AM_DEFAULT_VERBOSITY = 1' Makefile
+
+./configure -C --enable-silent-rules
+grep '^AM_DEFAULT_VERBOSITY = 0' Makefile
+
+./configure -C --disable-silent-rules
+grep '^AM_DEFAULT_VERBOSITY = 1' Makefile
+
+# User enables silent mode default before AM_INIT_AUTOMAKE.
+cat <<EOF >configure.ac
+AC_INIT([silent-defaults], [1.0])
+AM_SILENT_RULES([yes])
+AM_INIT_AUTOMAKE
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+EOF
+
+$AUTOCONF
+
+./configure -C
+grep '^AM_DEFAULT_VERBOSITY = 0' Makefile
+
+./configure -C --enable-silent-rules
+grep '^AM_DEFAULT_VERBOSITY = 0' Makefile
+
+./configure -C --disable-silent-rules
+grep '^AM_DEFAULT_VERBOSITY = 1' Makefile
+
+# User doesn't pick a silent mode default after AM_INIT_AUTOMAKE.
+cat <<EOF >configure.ac
+AC_INIT([silent-defaults], [1.0])
+AM_INIT_AUTOMAKE
+AM_SILENT_RULES
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+EOF
+
+$AUTOCONF
+
+./configure -C
+grep '^AM_DEFAULT_VERBOSITY = 1' Makefile
+
+./configure -C --enable-silent-rules
+grep '^AM_DEFAULT_VERBOSITY = 0' Makefile
+
+./configure -C --disable-silent-rules
+grep '^AM_DEFAULT_VERBOSITY = 1' Makefile
+
+# User disables silent mode default after AM_INIT_AUTOMAKE.
+cat <<EOF >configure.ac
+AC_INIT([silent-defaults], [1.0])
+AM_INIT_AUTOMAKE
+AM_SILENT_RULES([no])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+EOF
+
+$AUTOCONF
+
+./configure -C
+grep '^AM_DEFAULT_VERBOSITY = 1' Makefile
+
+./configure -C --enable-silent-rules
+grep '^AM_DEFAULT_VERBOSITY = 0' Makefile
+
+./configure -C --disable-silent-rules
+grep '^AM_DEFAULT_VERBOSITY = 1' Makefile
+
+# User enables silent mode default after AM_INIT_AUTOMAKE.
+cat <<EOF >configure.ac
+AC_INIT([silent-defaults], [1.0])
+AM_INIT_AUTOMAKE
+AM_SILENT_RULES([yes])
+AC_CONFIG_FILES([Makefile])
+AC_OUTPUT
+EOF
+
+$AUTOCONF
+
+./configure -C
+grep '^AM_DEFAULT_VERBOSITY = 0' Makefile
+
+./configure -C --enable-silent-rules
+grep '^AM_DEFAULT_VERBOSITY = 0' Makefile
+
+./configure -C --disable-silent-rules
+grep '^AM_DEFAULT_VERBOSITY = 1' Makefile
+
+: