silent-rules reorganization, --enable-silent-rules switch.
[automake.git] / tests / gnits3.test
blob5a826c23240a66185f7f66e5d6416e814d2dc343
1 #! /bin/sh
2 # Copyright (C) 2002, 2007 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 3, or (at your option)
7 # any later version.
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_INSTALLCHECK_STD_OPTIONS_EXEMPT works.
19 required=gcc
20 . ./defs || Exit 1
22 cat >> configure.in << 'END'
23 AC_PROG_CC
24 AC_OUTPUT
25 END
27 # We use the same basename for all targets on purpose. This way
28 # we make sure that `AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = nok'
29 # will not match anything containing `nok'.
30 cat > Makefile.am << 'END'
31 AUTOMAKE_OPTIONS = gnits
33 nobase_bin_PROGRAMS = nok sub/nok
34 nok_SOURCES = nok.c
35 sub_nok_SOURCES = nok.c
37 nobase_bin_SCRIPTS = nok.sh sub/nok.sh
39 AM_INSTALLCHECK_STD_OPTIONS_EXEMPT = nok$(EXEEXT) nok.sh
41 grep-stderr:
42 grep 'sub/pnok$(EXEEXT) does not support' stderr
43 grep 'sub/pnok.sh does not support' stderr
44 ## Only two failures please.
45 test `grep 'does not support --help' stderr | wc -l` = 2
46 test `grep 'does not support --version' stderr | wc -l` = 2
47 END
49 echo 'int main () { return 0; }' > nok.c
51 mkdir sub
53 cat >nok.sh <<EOF
54 #!/bin/sh
55 echo "Which version? Which usage?"
56 exit 1
57 EOF
59 cp nok.sh sub/nok.sh
61 chmod +x nok.sh
62 chmod +x sub/nok.sh
64 # Files required by Gnits.
65 : > INSTALL
66 : > NEWS
67 : > README
68 : > COPYING
69 : > AUTHORS
70 : > ChangeLog
71 : > THANKS
73 set -e
75 $ACLOCAL
76 $AUTOCONF
77 $AUTOMAKE -a
79 mkdir build
80 cd build
82 # Use --program-prefix to make sure the std-options check honors it.
83 ../configure "--prefix=`pwd`/../inst-dir" --program-prefix=p
84 $MAKE
85 $MAKE install
86 $MAKE -k installcheck 2>stderr || : # Never trust the exit status of make -k.
87 cat stderr
88 $MAKE grep-stderr
90 # Make sure there is no more error when all targets are exempted.
91 cd ..
92 echo 'AM_INSTALLCHECK_STD_OPTIONS_EXEMPT += sub/nok$(EXEEXT) sub/nok.sh' >> Makefile.am
93 $AUTOMAKE
94 cd build
95 ./config.status # Don't rely on the rebuild rules (they need GNU make).
96 $MAKE installcheck