source: trunk/essentials/sys-devel/automake-1.9/tests/cond35.test

Last change on this file was 3086, checked in by bird, 18 years ago

automake 1.9.6

File size: 1.9 KB
Line 
1#!/bin/sh
2# Copyright (C) 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# Check rules output for parser defined conditionally.
22# Report from Roman Fietze.
23
24required='flex bison gcc'
25. ./defs
26
27set -e
28
29cat >>configure.in <<'EOF'
30AM_CONDITIONAL([CASE_A], test -z "$case_B")
31AC_PROG_CC
32AM_PROG_LEX
33AC_PROG_YACC
34AC_OUTPUT
35EOF
36
37cat >>Makefile.am <<'EOF'
38AM_YFLAGS = -d
39
40BUILT_SOURCES = tparse.h
41
42if CASE_A
43bin_PROGRAMS = ta
44ta_SOURCES = ta.c tparse.h tscan.l tparse.y
45ta_LDADD = $(LEXLIB)
46else
47bin_PROGRAMS = tb
48tb_SOURCES = tb.c tparse.h tscan.l tparse.y
49tb_LDADD = $(LEXLIB)
50endif
51
52
53test-ta:
54 test -f ta$(EXEEXT)
55test-tb:
56 test -f tb$(EXEEXT)
57EOF
58
59$ACLOCAL
60$AUTOCONF
61$AUTOMAKE --add-missing
62
63test `grep tparse.h: Makefile.in | wc -l` = 1
64
65cat > tscan.l << 'END'
66%%
67"END" return EOF;
68END
69
70cat > tparse.y << 'END'
71%{
72void yyerror (char *s) {}
73%}
74%token EOF
75%%
76foobar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
77END
78
79cat >ta.c <<'END'
80int main()
81{
82 return 0;
83}
84END
85
86cp ta.c tb.c
87
88./configure
89$MAKE
90$MAKE test-ta
91
92./configure case_B=yes
93$MAKE
94$MAKE test-tb
Note: See TracBrowser for help on using the repository browser.