1#! /bin/sh 2# Copyright (C) 2013-2021 Free Software Foundation, Inc. 3# 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) 7# any later version. 8# 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. 13# 14# You should have received a copy of the GNU General Public License 15# along with this program. If not, see <https://www.gnu.org/licenses/>. 16 17# Check that $(am__make_keepgoing) works as expected. 18 19. test-init.sh 20 21plan_ 60 22 23mkdir kool # Also used later. 24if echo nil: | $MAKE -I kool -f -; then 25 make_supports_option_I () { return 0; } 26else 27 make_supports_option_I () { return 1; } 28fi 29 30echo AC_OUTPUT >> configure.ac 31 32cat > Makefile.am <<'END' 33all: 34 @echo 'Default target $@ should not be called'>&2; exit 1; 35k-y: 36 @echo ":: $$MAKEFLAGS :: $$MFLAGS ::" ;: For debugging. 37 $(am__make_keepgoing) 38k-n: 39 @echo ":: $$MAKEFLAGS :: $$MFLAGS ::" ;: For debugging. 40 $(am__make_keepgoing) && exit 1; exit 0 41END 42 43check_make () 44{ 45 msg= mode= condition=: directive= reason= skip_reason= 46 case $1 in 47 k-[yn]) mode=$1;; 48 *) fatal_ "check_run: invalid usage";; 49 esac 50 shift 51 while test $# -gt 0; do 52 case $1 in 53 -C) condition=$2 skip_reason=$3; shift; shift;; 54 -M) msg=$2; shift;; 55 -X) directive=TODO;; 56 --) shift; break;; 57 *) break;; 58 esac 59 shift 60 done 61 for opts in '' '-s' '-s -r'; do 62 r=ok 63 pmsg=${mode}${msg:+" [$msg]"}${opts:+" ($opts)"} 64 if $condition; then 65 $MAKE $opts "$mode" ${1+"$@"} || r='not ok' 66 else 67 directive=SKIP reason=$skip_reason 68 fi 69 result_ "$r" -D "$directive" -r "$reason" "$pmsg" 70 done 71 unset r msg pmsg opts mode condition directive reason skip_reason 72} 73 74# ---------------------------------------------------------------------- 75 76$ACLOCAL || fatal_ "aclocal failed" 77$AUTOCONF || fatal_ "autoconf failed" 78$AUTOMAKE || fatal_ "automake failed" 79./configure || fatal_ "configure failed" 80 81# ---------------------------------------------------------------------- 82 83check_make k-n 84 85# Test against a possible regressions similar to those that affected 86# detection of dry mode ("make -n"). 87check_make k-n TESTS="k.test k2.test" 88check_make k-n TESTS="k1 k2" AM_MAKEFLAGS="TESTS='k1 k2'" 89check_make k-n TESTS="k1 k k2" AM_MAKEFLAGS='TESTS="k1 k k2"' 90check_make k-n FOOFLAGS="-k -k -nkf2 k -ks --keep -k" 91check_make k-n MYFLAGS="-k --keepgoing -k --keep-run -k" 92 93# ---------------------------------------------------------------------- 94 95check_make k-y -k 96check_make k-y -C using_gmake "\$MAKE is not GNU make" --keep-going 97 98# ---------------------------------------------------------------------- 99 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. 102 103pr='bug#12554' 104 105check_make k-n -C make_supports_option_I "-I make option unsupported" \ 106 -M "$pr" -I kool 107 108check_make k-n -C using_gmake "\$MAKE is not GNU make" \ 109 -M "$pr" -I kool --include keep-going 110 111check_make k-y -C make_supports_option_I "-I make option unsupported" \ 112 -M "$pr" -I kool -k 113 114check_make k-y -C using_gmake "\$MAKE is not GNU make" \ 115 -M "$pr" --keep-going -I kool --include keep-going 116 117# ---------------------------------------------------------------------- 118 119# Test for when shell metacharacters or backslashes are in $(MAKEFLAGS). 120 121check_metachars () 122{ 123 check_make k-n -M "metachars" "$@" 124} 125 126check_metachars MYFLAGS="-k \"k\" '-k' --keep-going -k" 127check_metachars MYFLAGS='-knf2\ k\ \\k' 128check_metachars MYFLAGS="(&) | ; \" \` '" 129check_metachars MYFLAGS=" ' # ' " 130check_metachars MYFLAGS='$(foo)' 131check_metachars MYFLAGS='$(foo -k)' 132check_metachars MYFLAGS='`touch bad`' 133check_metachars MYFLAGS='`touch --keep-going bad`' 134 135# ---------------------------------------------------------------------- 136 137: 138