Append $(EXEEXT) to programs that may be listed in TESTS.
[automake.git] / tests / cond35.test
blobed6b6be28f09e5b3efab9682a9ce922a6c754c34
1 #!/bin/sh
2 # Copyright (C) 2004 Free Software Foundation, Inc.
4 # This file is part of GNU Automake.
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.
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.
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.
21 # Check rules output for parser defined conditionally.
22 # Report from Roman Fietze.
24 required='flex bison gcc'
25 . ./defs
27 set -e
29 cat >>configure.in <<'EOF'
30 AM_CONDITIONAL([CASE_A], test -z "$case_B")
31 AC_PROG_CC
32 AM_PROG_LEX
33 AC_PROG_YACC
34 AC_OUTPUT
35 EOF
37 cat >>Makefile.am <<'EOF'
38 AM_YFLAGS = -d
40 BUILT_SOURCES = tparse.h
42 if CASE_A
43 bin_PROGRAMS = ta
44 ta_SOURCES = ta.c tparse.h tscan.l tparse.y
45 ta_LDADD = $(LEXLIB)
46 else
47 bin_PROGRAMS = tb
48 tb_SOURCES = tb.c tparse.h tscan.l tparse.y
49 tb_LDADD = $(LEXLIB)
50 endif
53 test-ta:
54 test -f ta$(EXEEXT)
55 test-tb:
56 test -f tb$(EXEEXT)
57 EOF
59 $ACLOCAL
60 $AUTOCONF
61 $AUTOMAKE --add-missing
63 test `grep tparse.h: Makefile.in | wc -l` = 1
65 cat > tscan.l << 'END'
67 "END" return EOF;
68 END
70 cat > tparse.y << 'END'
72 void yyerror (char *s) {}
74 %token EOF
76 foobar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
77 END
79 cat >ta.c <<'END'
80 int main()
82 return 0;
84 END
86 cp ta.c tb.c
88 ./configure
89 $MAKE
90 $MAKE test-ta
92 ./configure case_B=yes
93 $MAKE
94 $MAKE test-tb