| 1 | #! /bin/sh
|
|---|
| 2 | # Copyright (C) 2002, 2003, 2004 Free Software Foundation, Inc.
|
|---|
| 3 | #
|
|---|
| 4 | # This file is part of GNU Automake.
|
|---|
| 5 | #
|
|---|
| 6 | # GNU Automake is free software; you can redistribute it and/or modify
|
|---|
| 7 | # it under the terms of the GNU General Public License as published by
|
|---|
| 8 | # the Free Software Foundation; either version 2, or (at your option)
|
|---|
| 9 | # any later version.
|
|---|
| 10 | #
|
|---|
| 11 | # GNU Automake is distributed in the hope that it will be useful,
|
|---|
| 12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 14 | # GNU General Public License for more details.
|
|---|
| 15 | #
|
|---|
| 16 | # You should have received a copy of the GNU General Public License
|
|---|
| 17 | # along with Automake; see the file COPYING. If not, write to
|
|---|
| 18 | # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|---|
| 19 | # Boston, MA 02110-1301, USA.
|
|---|
| 20 |
|
|---|
| 21 | # Test to ensure std-options checking is correct.
|
|---|
| 22 |
|
|---|
| 23 | required=gcc
|
|---|
| 24 | . ./defs || exit 1
|
|---|
| 25 |
|
|---|
| 26 | cat >> configure.in << 'END'
|
|---|
| 27 | AC_PROG_CC
|
|---|
| 28 | AC_OUTPUT
|
|---|
| 29 | END
|
|---|
| 30 |
|
|---|
| 31 | cat > Makefile.am << 'END'
|
|---|
| 32 | AUTOMAKE_OPTIONS = gnits
|
|---|
| 33 | noinst_PROGRAMS = fubar2
|
|---|
| 34 | bin_PROGRAMS = fubar sub/fine
|
|---|
| 35 | nobase_bin_PROGRAMS = sub/fubar3
|
|---|
| 36 | fubar_SOURCES = fubar.c
|
|---|
| 37 | fubar2_SOURCES = fubar.c
|
|---|
| 38 | sub_fubar3_SOURCES = fubar.c
|
|---|
| 39 | sub_fine_SOURCES = fine.c
|
|---|
| 40 | bin_SCRIPTS = sub/scriptok.sh sub/scriptnok.sh
|
|---|
| 41 |
|
|---|
| 42 | grep-stderr:
|
|---|
| 43 | grep 'pfubar$(EXEEXT) does not support' stderr
|
|---|
| 44 | grep 'pfubar3$(EXEEXT) does not support' stderr
|
|---|
| 45 | grep 'pscriptnok.sh does not support' stderr
|
|---|
| 46 | ## Only three failures please.
|
|---|
| 47 | test `grep 'does not support --help' stderr | wc -l` = 3
|
|---|
| 48 | test `grep 'does not support --version' stderr | wc -l` = 3
|
|---|
| 49 |
|
|---|
| 50 | test-install: install
|
|---|
| 51 | test -f ../inst-dir/bin/pfine$(EXEEXT)
|
|---|
| 52 | test ! -f ../inst-dir/bin/fine$(EXEEXT)
|
|---|
| 53 | END
|
|---|
| 54 |
|
|---|
| 55 | echo 'int main () { return 0; }' > fubar.c
|
|---|
| 56 |
|
|---|
| 57 | cat > fine.c << 'END'
|
|---|
| 58 | #include <stdio.h>
|
|---|
| 59 | int
|
|---|
| 60 | main ()
|
|---|
| 61 | {
|
|---|
| 62 | puts ("Which version? Which usage?");
|
|---|
| 63 | return 0;
|
|---|
| 64 | }
|
|---|
| 65 | END
|
|---|
| 66 |
|
|---|
| 67 | mkdir sub
|
|---|
| 68 |
|
|---|
| 69 | cat >sub/scriptok.sh <<EOF
|
|---|
| 70 | #!/bin/sh
|
|---|
| 71 | echo "Which version? Which usage?"
|
|---|
| 72 | EOF
|
|---|
| 73 |
|
|---|
| 74 | # Not only does this script not support --help/--version, but
|
|---|
| 75 | # it will also hang when run without input.
|
|---|
| 76 | cat >sub/scriptnok.sh <<EOF
|
|---|
| 77 | #!/bin/sh
|
|---|
| 78 | cat
|
|---|
| 79 | EOF
|
|---|
| 80 |
|
|---|
| 81 | chmod +x sub/scriptok.sh
|
|---|
| 82 | chmod +x sub/scriptnok.sh
|
|---|
| 83 |
|
|---|
| 84 | # Files required by Gnits.
|
|---|
| 85 | : > INSTALL
|
|---|
| 86 | : > NEWS
|
|---|
| 87 | : > README
|
|---|
| 88 | : > COPYING
|
|---|
| 89 | : > AUTHORS
|
|---|
| 90 | : > ChangeLog
|
|---|
| 91 | : > THANKS
|
|---|
| 92 |
|
|---|
| 93 | # The following file should not be distributed.
|
|---|
| 94 | # (alpha.test checks the case where it must be distributed.)
|
|---|
| 95 | : > README-alpha
|
|---|
| 96 |
|
|---|
| 97 | set -e
|
|---|
| 98 |
|
|---|
| 99 | $ACLOCAL
|
|---|
| 100 | $AUTOCONF
|
|---|
| 101 | $AUTOMAKE -a
|
|---|
| 102 |
|
|---|
| 103 | grep README-alpha Makefile.in && exit 1
|
|---|
| 104 |
|
|---|
| 105 | mkdir build
|
|---|
| 106 | cd build
|
|---|
| 107 |
|
|---|
| 108 | # Use --program-prefix to make sure the std-options check honors it.
|
|---|
| 109 | ../configure --prefix=`pwd`/../inst-dir --program-prefix=p
|
|---|
| 110 | $MAKE all
|
|---|
| 111 | $MAKE test-install
|
|---|
| 112 | $MAKE -k installcheck 2>stderr || : # Never trust the exit status of make -k.
|
|---|
| 113 | cat stderr
|
|---|
| 114 | $MAKE grep-stderr
|
|---|