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., 59 Temple Place - Suite 330,
|
---|
19 | # Boston, MA 02111-1307, USA.
|
---|
20 |
|
---|
21 | # Check rules output for parser defined conditionally.
|
---|
22 | # Report from Roman Fietze.
|
---|
23 |
|
---|
24 | required='flex bison gcc'
|
---|
25 | . ./defs
|
---|
26 |
|
---|
27 | set -e
|
---|
28 |
|
---|
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
|
---|
36 |
|
---|
37 | cat >>Makefile.am <<'EOF'
|
---|
38 | AM_YFLAGS = -d
|
---|
39 |
|
---|
40 | BUILT_SOURCES = tparse.h
|
---|
41 |
|
---|
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
|
---|
51 |
|
---|
52 |
|
---|
53 | test-ta:
|
---|
54 | test -f ta$(EXEEXT)
|
---|
55 | test-tb:
|
---|
56 | test -f tb$(EXEEXT)
|
---|
57 | EOF
|
---|
58 |
|
---|
59 | $ACLOCAL
|
---|
60 | $AUTOCONF
|
---|
61 | $AUTOMAKE --add-missing
|
---|
62 |
|
---|
63 | test `grep tparse.h: Makefile.in | wc -l` = 1
|
---|
64 |
|
---|
65 | cat > tscan.l << 'END'
|
---|
66 | %%
|
---|
67 | "END" return EOF;
|
---|
68 | END
|
---|
69 |
|
---|
70 | cat > tparse.y << 'END'
|
---|
71 | %{
|
---|
72 | void yyerror (char *s) {}
|
---|
73 | %}
|
---|
74 | %token EOF
|
---|
75 | %%
|
---|
76 | foobar : 'f' 'o' 'o' 'b' 'a' 'r' EOF {};
|
---|
77 | END
|
---|
78 |
|
---|
79 | cat >ta.c <<'END'
|
---|
80 | int main()
|
---|
81 | {
|
---|
82 | return 0;
|
---|
83 | }
|
---|
84 | END
|
---|
85 |
|
---|
86 | cp 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
|
---|