summaryrefslogtreecommitdiff
path: root/m4/silent.m4
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2022-02-20 19:06:55 -0500
committerMike Frysinger <vapier@gentoo.org>2022-02-27 20:57:44 -0500
commitd747a66a0defe0bf25989cda4f6d9dd89674d8a0 (patch)
tree5940499155b1f9d868e9604b5e2f2060576a59dd /m4/silent.m4
parenta61eaf68cf868e1874de168b1de5f2efcbb3cfb4 (diff)
downloadautomake-d747a66a0defe0bf25989cda4f6d9dd89674d8a0.tar.gz
m4: rework silent-rules macros to avoid double expansion
Fixes automake bug https://bugs.gnu.org/32868. The AM_SILENT_RULES macro defines all the silent-rules related setup. It's also called by users to change the default verbosity level. This leads to a quirk where automake calls it, expands the full context, and then users call it, and it's fully expanded again. Instead, let's rename AM_SILENT_RULES to _AM_SILENT_RULES and move the initialization logic to late in the configure stage. This allows the user-centric AM_SILENT_RULES call to expand into a single line to set the default verbosity. * m4/init.m4: Switch to _AM_SILENT_RULES. * m4/silent.m4: Rename AM_SILENT_RULES to _AM_SILENT_RULES. Delay evaluation of AM_SILENT_RULES to the end. Define new AM_SILENT_RULES to set default rules verbosity. * t/silent-defaults.sh: New tests. * t/list-of-tests.mk: Add t/silent-defaults.sh.
Diffstat (limited to 'm4/silent.m4')
-rw-r--r--m4/silent.m449
1 files changed, 30 insertions, 19 deletions
diff --git a/m4/silent.m4 b/m4/silent.m4
index b1502ed38..d19c56e8a 100644
--- a/m4/silent.m4
+++ b/m4/silent.m4
@@ -5,12 +5,12 @@
# 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")])
@@ -18,11 +18,6 @@ AS_HELP_STRING(
[--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.
@@ -41,14 +36,6 @@ am__doit:
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
@@ -57,4 +44,28 @@ AC_SUBST([AM_DEFAULT_VERBOSITY])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])])