Fix outdated reference to sh-utils in the manual.
[automake.git] / tests / cond35.test
blob6b3a4d4268a6a54f7e1a2f45ebd7731726b8bd17
1 #!/bin/sh
2 # Copyright (C) 2004 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)
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 rules output for parser defined conditionally.
18 # Report from Roman Fietze.
20 required='flex bison gcc'
21 . ./defs
23 set -e
25 cat >>configure.in <<'EOF'
26 AM_CONDITIONAL([CASE_A], test -z "$case_B")
27 AC_PROG_CC
28 AM_PROG_LEX
29 AC_PROG_YACC
30 AC_OUTPUT
31 EOF
33 cat >>Makefile.am <<'EOF'
34 AM_YFLAGS = -d
36 BUILT_SOURCES = tparse.h
38 if CASE_A
39 bin_PROGRAMS = ta
40 ta_SOURCES = ta.c tparse.h tscan.l tparse.y
41 ta_LDADD = $(LEXLIB)
42 else
43 bin_PROGRAMS = tb
44 tb_SOURCES = tb.c tparse.h tscan.l tparse.y
45 tb_LDADD = $(LEXLIB)
46 endif
49 test-ta:
50 test -f ta$(EXEEXT)
51 test-tb:
52 test -f tb$(EXEEXT)
53 EOF
55 $ACLOCAL
56 $AUTOCONF
57 $AUTOMAKE --add-missing
59 test `grep tparse.h: Makefile.in | wc -l` = 1
61 cat > tscan.l << 'END'
63 "END" return EOF;
64 END
66 cat > tparse.y << 'END'
68 void yyerror (char *s) {}
70 %token EOF
72 foobar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
73 END
75 cat >ta.c <<'END'
76 int main()
78 return 0;
80 END
82 cp ta.c tb.c
84 ./configure
85 $MAKE
86 $MAKE test-ta
88 ./configure case_B=yes
89 $MAKE
90 $MAKE test-tb