summaryrefslogtreecommitdiff
path: root/m4/silent.m4
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2011-12-25 09:56:44 -0800
committerPaul Eggert <eggert@cs.ucla.edu>2011-12-25 09:57:45 -0800
commit8493499b54da3694f820fa7eab5e58ef44448b66 (patch)
tree28ab0b731d5cd57d03a5d2fae58ab1b6a3ef103a /m4/silent.m4
parentbfc83bdec2e6e39a3275ae0c51b29a86603b49ad (diff)
downloadautomake-8493499b54da3694f820fa7eab5e58ef44448b66.tar.gz
silent-rules: fallback for makes without nested vars
This fixes two problems reported for Automake (Bug#9928, Bug#10237) and is in response to a bug report for building coreutils on HP NonStop OS (Bug#10234). The problem is that HP NonStop 'make' treats a line like "AM_V_CC = $(am__v_CC_$(V))" as one that expands a macro with the funny name am__v_CC_$(V instead of the desired name am__v_CC_1 or am__v_CC_0, and since the funny macro is not defined the line is equivalent to "AM_V_CC = )"; this inserts a stray ")" when $(AM_V_CC) is used, which eventually causes 'make' to fail. The basic idea is that instead of generating Makefile.in lines like "AM_V_CC = $(am__v_CC_$(V))", we generate "AM_V_CC = $(am__v_CC_@AM_V@)". We then AC_SUBST $(V) for @AM_V@ in the usual case where `make' supports nested variables, and substitute 1 (or 0) otherwise. Similarly for usages like $(am__v_CC_$(AM_DEFAULT_VERBOSITY)). With this change, make implementations that doesn't grasp nested variable expansions will still be able to run Makefiles generated using the silent-rules option. They won't allow the user to override the make verbosity at runtime through redefinition of $(V) (as in "make V=0"); but this is still an improvement over not being able to work at all. * NEWS: Document this. * automake.in (define_verbose_var): When defining the variables, use @AM_V@ rather than $(V), and use @AM_DEFAULT_V@ rather than $(AM_DEFAULT_VERBOSITY). * doc/automake.texi (Automake silent-rules Option): Explain new system. * m4/silent.m4 (AM_SILENT_RULES): Check whether `make' supports nested variables, and substitute AM_V and AM_DEFAULT_V accordingly. * tests/silent-nested-vars.test: New test. * tests/Makefile.am (TESTS): Add it.
Diffstat (limited to 'm4/silent.m4')
-rw-r--r--m4/silent.m434
1 files changed, 32 insertions, 2 deletions
diff --git a/m4/silent.m4 b/m4/silent.m4
index 6d2a1a276..8bd931b49 100644
--- a/m4/silent.m4
+++ b/m4/silent.m4
@@ -1,11 +1,11 @@
## -*- Autoconf -*-
-# Copyright (C) 2009 Free Software Foundation, Inc.
+# Copyright (C) 2009, 2011 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
+# serial 2
# AM_SILENT_RULES([DEFAULT])
# --------------------------
@@ -20,6 +20,36 @@ 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.
+dnl See automake bug#9928 and bug#10237.
+am_make=${MAKE-make}
+AC_CACHE_CHECK([whether $am_make supports nested variables],
+ [am_cv_make_support_nested_variables],
+ [if AS_ECHO([['TRUE=$(BAR$(V))
+BAR0=false
+BAR1=true
+V=1
+am__doit:
+ @$(TRUE)
+.PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
+ am_cv_make_support_nested_variables=yes
+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_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
AM_BACKSLASH='\'
AC_SUBST([AM_BACKSLASH])dnl