silent-rules: fallback for makes without nested vars
[platform/upstream/automake.git] / m4 / silent.m4
1 ##                                                          -*- Autoconf -*-
2 # Copyright (C) 2009, 2011  Free Software Foundation, Inc.
3 #
4 # This file is free software; the Free Software Foundation
5 # gives unlimited permission to copy and/or distribute it,
6 # with or without modifications, as long as this notice is preserved.
7
8 # serial 2
9
10 # AM_SILENT_RULES([DEFAULT])
11 # --------------------------
12 # Enable less verbose build rules; with the default set to DEFAULT
13 # (`yes' being less verbose, `no' or empty being verbose).
14 AC_DEFUN([AM_SILENT_RULES],
15 [AC_ARG_ENABLE([silent-rules],
16 [  --enable-silent-rules          less verbose build output (undo: `make V=1')
17   --disable-silent-rules         verbose build output (undo: `make V=0')])
18 case $enable_silent_rules in
19 yes) AM_DEFAULT_VERBOSITY=0;;
20 no)  AM_DEFAULT_VERBOSITY=1;;
21 *)   AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
22 esac
23 dnl
24 dnl A few `make' implementations (e.g., NonStop OS and NextStep)
25 dnl do not support nested variable expansions.
26 dnl See automake bug#9928 and bug#10237.
27 am_make=${MAKE-make}
28 AC_CACHE_CHECK([whether $am_make supports nested variables],
29    [am_cv_make_support_nested_variables],
30    [if AS_ECHO([['TRUE=$(BAR$(V))
31 BAR0=false
32 BAR1=true
33 V=1
34 am__doit:
35         @$(TRUE)
36 .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
37   am_cv_make_support_nested_variables=yes
38 else
39   am_cv_make_support_nested_variables=no
40 fi])
41 if test $am_cv_make_support_nested_variables = yes; then
42   dnl Using `$V' instead of `$(V)' breaks IRIX make.
43   AM_V='$(V)'
44   AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
45 else
46   AM_V=$AM_DEFAULT_VERBOSITY
47   AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
48 fi
49 AC_SUBST([AM_V])dnl
50 AM_SUBST_NOTMAKE([AM_V])dnl
51 AC_SUBST([AM_DEFAULT_V])dnl
52 AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
53 AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
54 AM_BACKSLASH='\'
55 AC_SUBST([AM_BACKSLASH])dnl
56 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
57 ])