Revert Automake license to GPLv2+.
[platform/upstream/automake.git] / tests / yacc4.test
1 #! /bin/sh
2 # Copyright (C) 2001, 2002  Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # Some simple tests of ylwrap functionality.
18
19 required='bison gcc'
20 . ./defs || Exit 1
21
22 cat > configure.in << 'END'
23 AC_INIT
24 AC_CONFIG_AUX_DIR([.])
25 AM_INIT_AUTOMAKE(foo, 0.1)
26 PACKAGE=foo
27 VERSION=0.1
28 AC_PROG_CC
29 AC_PROG_YACC
30 AC_OUTPUT(Makefile)
31 END
32
33 cat > Makefile.am << 'END'
34 bin_PROGRAMS = foo bar
35 foo_SOURCES = parse.y foo.c
36 bar_SOURCES = bar.y foo.c
37 END
38
39 # First parser.
40 cat > parse.y << 'END'
41 %{
42 int yylex () {return 0;}
43 void yyerror (char *s) {}
44 %}
45 %%
46 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
47 END
48
49 # Second parser.
50 cat > bar.y << 'END'
51 %{
52 int yylex () {return 0;}
53 void yyerror (char *s) {}
54 %}
55 %%
56 fubar : 'f' 'o' 'o' 'b' 'a' 'r' {};
57 END
58
59 cat > foo.c << 'END'
60 int main () { return 0; }
61 END
62
63 set -e
64
65 $ACLOCAL
66 $AUTOCONF
67 $AUTOMAKE -a
68
69 test -f ylwrap
70
71 mkdir sub
72 cd sub
73
74 ../configure
75 $MAKE
76
77 grep '^#.*/sub/\.\./' bar.c && Exit 1
78 grep '^#.*/sub/\.\./' parse.c && Exit 1
79
80 # Make distclean must not erase bar.c nor parse.c (by GNU standards) ...
81 $MAKE distclean
82 test -f bar.c
83 test -f parse.c
84 # ... but maintainer-clean should.
85 ../configure
86 $MAKE maintainer-clean
87 test ! -f bar.c
88 test ! -f parse.c
89 :
90
91 Exit 0