2 # Copyright (C) 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_keepgoing) works as expected.
23 mkdir kool # Also used later.
24 if echo nil: | $MAKE -I kool -f -; then
25 make_supports_option_I () { return 0; }
27 make_supports_option_I () { return 1; }
30 echo AC_OUTPUT >> configure.ac
32 cat > Makefile.am <<'END'
34 @echo 'Default target $@ should not be called'>&2; exit 1;
36 @echo ":: $$MAKEFLAGS :: $$MFLAGS ::" ;: For debugging.
39 @echo ":: $$MAKEFLAGS :: $$MFLAGS ::" ;: For debugging.
40 $(am__make_keepgoing) && exit 1; exit 0
45 msg= mode= condition=: directive= reason= skip_reason=
48 *) fatal_ "check_run: invalid usage";;
51 while test $# -gt 0; do
53 -C) condition=$2 skip_reason=$3; shift; shift;;
61 for opts in '' '-s' '-s -r'; do
63 pmsg=${mode}${msg:+" [$msg]"}${opts:+" ($opts)"}
65 $MAKE $opts "$mode" ${1+"$@"} || r='not ok'
67 directive=SKIP reason=$skip_reason
69 result_ "$r" -D "$directive" -r "$reason" "$pmsg"
71 unset r msg pmsg opts mode condition directive reason skip_reason
74 # ----------------------------------------------------------------------
76 $ACLOCAL || fatal_ "aclocal failed"
77 $AUTOCONF || fatal_ "autoconf failed"
78 $AUTOMAKE || fatal_ "automake failed"
79 ./configure || fatal_ "configure failed"
81 # ----------------------------------------------------------------------
85 # Test against a possible regressions similar to those that affected
86 # detection of dry mode ("make -n").
87 check_make k-n TESTS="k.test k2.test"
88 check_make k-n TESTS="k1 k k2" AM_MAKEFLAGS="TESTS='k1 k2'"
89 check_make k-n TESTS="k1 k k2" AM_MAKEFLAGS='TESTS="k1 k k2"'
90 check_make k-n FOOFLAGS="-k -k -nkf2 k -ks --keep -k"
91 check_make k-n MYFLAGS="-k --keepgoing -k --keep-run -k"
93 # ----------------------------------------------------------------------
96 check_make k-y -C using_gmake "\$MAKE is not GNU make" --keep-going
98 # ----------------------------------------------------------------------
100 # Related to automake bug#12554: the "k" in "kool" used to confound
101 # am__make_keepgoing into thinking the '-k' option had been passed.
105 check_make k-n -C make_supports_option_I "-I make option unsupported" \
108 check_make k-n -C using_gmake "\$MAKE is not GNU make" \
109 -M "$pr" -I kool --include keep-going
111 check_make k-y -C make_supports_option_I "-I make option unsupported" \
114 check_make k-y -C using_gmake "\$MAKE is not GNU make" \
115 -M "$pr" --keep-going -I kool --include keep-going
117 # ----------------------------------------------------------------------
119 # Test for when shell metacharacters or backslashes are in $(MAKEFLAGS).
123 check_make k-n -M "metachars" "$@"
126 check_metachars MYFLAGS="-k \"k\" '-k' --keep-going -k"
127 check_metachars MYFLAGS='-knf2\ k\ \\k'
128 check_metachars MYFLAGS="(&) | ; \" \` '"
129 check_metachars MYFLAGS=" ' # ' "
130 check_metachars MYFLAGS='$(foo)'
131 check_metachars MYFLAGS='$(foo -k)'
132 check_metachars MYFLAGS='`touch bad`'
133 check_metachars MYFLAGS='`touch --keep-going bad`'
135 # ----------------------------------------------------------------------