[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#32868: [PATCH] m4: rework silent-rules macros to avoid double expans
From: |
Mike Frysinger |
Subject: |
bug#32868: [PATCH] m4: rework silent-rules macros to avoid double expansion |
Date: |
Sun, 20 Feb 2022 19:14:00 -0500 |
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. Change AM_SILENT_RULES to
only define AM_SILENT_RULES.
---
m4/init.m4 | 2 +-
m4/silent.m4 | 48 +++++++++++++++++++++++++++++-------------------
2 files changed, 30 insertions(+), 20 deletions(-)
diff --git a/m4/init.m4 b/m4/init.m4
index f3abf66c6e96..f3c7845bca70 100644
--- a/m4/init.m4
+++ b/m4/init.m4
@@ -134,7 +134,7 @@ if test -z "$CSCOPE"; then
fi
AC_SUBST([CSCOPE])
-AC_REQUIRE([AM_SILENT_RULES])dnl
+AC_REQUIRE([_AM_SILENT_RULES])dnl
dnl The testsuite driver may need to know about EXEEXT, so add the
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This
dnl macro is hooked onto _AC_COMPILER_EXEEXT early, see below.
diff --git a/m4/silent.m4 b/m4/silent.m4
index b1502ed389b6..9b3c7a6a017b 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=0
+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,27 @@ 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],
+[AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1])])
--
2.34.1
- bug#32868: [PATCH] m4: rework silent-rules macros to avoid double expansion,
Mike Frysinger <=