2 # Copyright (C) 2003-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 # Test AM_MISSING_PROG.
21 cat >> configure.ac <<'END'
22 AM_MISSING_PROG([NO_SUCH_COMMAND], [am-none-none])
23 AM_MISSING_PROG([MISMATCHED_COMMAND], [am-exit-63])
24 AM_MISSING_PROG([OVERRIDDEN_COMMAND], [am-none-none])
25 AM_MISSING_PROG([COMMAND_FOUND], [my-command])
30 cat > bin/am-exit-63 <<'END'
32 echo "Oops, I'm too old"
35 cat > bin/am-overridden <<'END'
40 cat > bin/my-command <<'END'
46 PATH=$(pwd)/bin$PATH_SEPARATOR$PATH; export PATH
48 cat > Makefile.am <<'END'
49 # Different for different targets, for the sake of parallel make.
53 debug_info = grep . $@-stdout $@-stderr
54 status_is = $(debug_info); echo $@: st=$$st; test $$st -eq
56 w_mis = 'am-none-none' is needed, and is missing on your system
57 w_old = 'am-exit-63' is needed, and is probably too old
60 st=0; $(NO_SUCH_COMMAND) >$o 2>$e || st=$$?; $(status_is) 127
61 grep "^WARNING: $(w_mis)" $e
64 st=0; $(MISMATCHED_COMMAND) >$o 2>$e || st=$$?; $(status_is) 63
65 grep "^WARNING: $(w_old)" $e
66 test "`cat $o`" = "Oops, I'm too old"
68 st=0; $(OVERRIDDEN_COMMAND) >$o 2>$e || st=$$?; $(status_is) 0
69 st=0; $(OVERRIDDEN_COMMAND) >$o 2>$e || st=$$?; \
71 test "`cat $o`" = "Hey, I'm OK!"
73 st=0; $(COMMAND_FOUND) >$o 2>$e || st=$$?; $(status_is) 0
75 test "`cat $o`" = SNAFU
76 check-local: test1 test2 test2 test4
77 .PHONY: test1 test2 test2 test4
78 CLEANFILES = test[1234]-stdout test[1234]-stderr
85 ./configure OVERRIDDEN_COMMAND=am-overridden
87 $FGREP COMMAND Makefile.in Makefile # For debugging.
89 grep "^NO_SUCH_COMMAND = \${SHELL} .*/missing .*am-none-none" Makefile
90 grep "^MISMATCHED_COMMAND = \${SHELL} .*/missing .*am-exit-63" Makefile
91 grep "^COMMAND_FOUND = \${SHELL} .*/missing .*my-command" Makefile
92 grep '^OVERRIDDEN_COMMAND = am-overridden *$' Makefile
94 $MAKE test1 test2 test3 test4
95 $MAKE distcheck DISTCHECK_CONFIGURE_FLAGS='OVERRIDDEN_COMMAND=am-overridden'