2 # Copyright (C) 2012-2013 Free Software Foundation, Inc.
4 # This program is free software; you can redistribute it and/or modify
5 # it under the terms of the GNU General Public License as published by
6 # the Free Software Foundation; either version 2, or (at your option)
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with this program. If not, see <http://www.gnu.org/licenses/>.
17 # Check that $(am__make_dryrun) works as expected.
23 if echo "all: ; +@printf %sbb%s aa cc" | $MAKE -n -f - | grep aabbcc; then
24 make_plus_silence () { return 0; }
26 make_plus_silence () { return 1; }
30 if echo nil: | $MAKE -I none -f -; then
31 make_supports_option_I () { return 0; }
33 make_supports_option_I () { return 1; }
36 echo AC_OUTPUT >> configure.ac
38 cat > Makefile.am <<'END'
40 : Dummy, nothing to do.
44 @echo ":: $$MAKEFLAGS ::"; : For debugging.
45 $(am__make_dryrun) && exit 1; echo ok > from-run
47 +@echo ":: $$MAKEFLAGS ::"; : For debugging.
48 +$(am__make_dryrun) || exit 1; echo ok > from-dry
53 r=ok msg= mode= condition=: directive= reason= skip_reason=
57 *) fatal_ "check_run: invalid usage";;
60 while test $# -gt 0; do
62 -C) condition=$2 skip_reason=$3; shift; shift;;
70 msg=${mode}${msg:+" [$msg]"}
72 $MAKE "$mode" ${1+"$@"} || r='not ok'
73 test -f from-$mode || r='not ok'
74 test ! -e bad || r='not ok'
75 rm -f bad from-* || fatal_ "cleaning up"
77 directive=SKIP reason=$skip_reason
79 result_ "$r" -D "$directive" -r "$reason" "$msg"
80 unset r msg mode condition directive reason skip_reason
83 # ----------------------------------------------------------------------
85 $ACLOCAL || fatal_ "aclocal failed"
86 $AUTOCONF || fatal_ "autoconf failed"
87 $AUTOMAKE || fatal_ "automake failed"
88 ./configure || fatal_ "configure failed"
90 # ----------------------------------------------------------------------
94 # Test against a known regression. This was especially heinous, since
95 # make running in normal mode was sometimes mistaken for make running
97 check_make --run TESTS="n1.test n2.test"
98 check_make --run TESTS="n1 n2" AM_MAKEFLAGS="TESTS='n1 n2'"
99 check_make --run TESTS="n1 n2" AM_MAKEFLAGS='TESTS="n1 n2"'
100 check_make --run FOOFLAGS="-n -n -knf2 n --none -n"
101 check_make --run MYFLAGS="-n --dryrun -n --dry-run -n"
103 # ----------------------------------------------------------------------
105 check_make --dry -C make_plus_silence 'recipe prefix "+" unsupported' -n
106 check_make --dry -C using_gmake "\$MAKE is not GNU make" --dry-run -k
108 # ----------------------------------------------------------------------
110 # Automake bug#13760: the "n" in "none" used to confound am__make_dryrun
111 # into thinking the '-n' option had been passed.
115 check_make --run -X -C make_supports_option_I "-I make option unsupported" \
118 check_make --run -X -C using_gmake "\$MAKE is not GNU make" \
119 -M "$pr" -I none --include dry-run
121 check_make --dry -C make_supports_option_I "-I make option unsupported" \
124 check_make --dry -C using_gmake "\$MAKE is not GNU make" \
125 -M "$pr" --dry-run -I none --include dry-run
127 # ----------------------------------------------------------------------
129 # Test for when shell metacharacters or backslashes are in $(MAKEFLAGS).
133 check_make --run -M "metachars" "$@"
136 check_metachars MYFLAGS="-n \"n\" '-n' --none -n"
137 check_metachars MYFLAGS='-knf2\ n\ \\n'
138 check_metachars MYFLAGS="(&) | ; \" \` '"
139 check_metachars MYFLAGS=" ' # ' "
140 check_metachars MYFLAGS='$(foo)'
141 check_metachars MYFLAGS='`touch bad`'
143 # ----------------------------------------------------------------------