test harness: improve catching of usage errors in script 'test-driver'
[platform/upstream/automake.git] / m4 / silent.m4
1 ##                                                          -*- Autoconf -*-
2 # Copyright (C) 2009-2013 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 # AM_SILENT_RULES([DEFAULT])
9 # --------------------------
10 # Enable less verbose build rules; with the default set to DEFAULT
11 # ("yes" being less verbose, "no" or empty being verbose).
12 AC_DEFUN([AM_SILENT_RULES],
13 [AC_ARG_ENABLE([silent-rules], [dnl
14 AS_HELP_STRING(
15   [--enable-silent-rules],
16   [less verbose build output (undo: "make V=1")])
17 AS_HELP_STRING(
18   [--disable-silent-rules],
19   [verbose build output (undo: "make V=0")])dnl
20 ])
21 case $enable_silent_rules in @%:@ (((
22   yes) AM_DEFAULT_VERBOSITY=0;;
23    no) AM_DEFAULT_VERBOSITY=1;;
24     *) AM_DEFAULT_VERBOSITY=m4_if([$1], [yes], [0], [1]);;
25 esac
26 dnl
27 dnl A few 'make' implementations (e.g., NonStop OS and NextStep)
28 dnl do not support nested variable expansions.
29 dnl See automake bug#9928 and bug#10237.
30 am_make=${MAKE-make}
31 AC_CACHE_CHECK([whether $am_make supports nested variables],
32    [am_cv_make_support_nested_variables],
33    [if AS_ECHO([['TRUE=$(BAR$(V))
34 BAR0=false
35 BAR1=true
36 V=1
37 am__doit:
38         @$(TRUE)
39 .PHONY: am__doit']]) | $am_make -f - >/dev/null 2>&1; then
40   am_cv_make_support_nested_variables=yes
41 else
42   am_cv_make_support_nested_variables=no
43 fi])
44 if test $am_cv_make_support_nested_variables = yes; then
45   dnl Using '$V' instead of '$(V)' breaks IRIX make.
46   AM_V='$(V)'
47   AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
48 else
49   AM_V=$AM_DEFAULT_VERBOSITY
50   AM_DEFAULT_V=$AM_DEFAULT_VERBOSITY
51 fi
52 AC_SUBST([AM_V])dnl
53 AM_SUBST_NOTMAKE([AM_V])dnl
54 AC_SUBST([AM_DEFAULT_V])dnl
55 AM_SUBST_NOTMAKE([AM_DEFAULT_V])dnl
56 AC_SUBST([AM_DEFAULT_VERBOSITY])dnl
57 AM_BACKSLASH='\'
58 AC_SUBST([AM_BACKSLASH])dnl
59 _AM_SUBST_NOTMAKE([AM_BACKSLASH])dnl
60 ])