2 # Copyright (C) 2010-2013 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)
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 # Basic semantic checks on Yacc support (without yacc-generated headers).
18 # Keep in sync with sister test 'yacc-cxx.sh'.
23 cat >> configure.ac << 'END'
29 cat > Makefile.am << 'END'
30 bin_PROGRAMS = foo bar
31 foo_SOURCES = parse.y foo.c
32 bar_SOURCES = $(foo_SOURCES)
37 @echo ' ' $(DIST_COMMON) ' '
40 cat > parse.y << 'END'
44 int yylex () { return getchar (); }
45 void yyerror (char *s) {}
52 int main () { yyparse (); return 1; }
62 # The Yacc-derived C sources must be created, and not removed once
63 # compiled (i.e., not treated like "intermediate files" in the GNU
67 # Check that per-object flags are honored.
68 test -f bar-parse.output
70 if ! cross_compiling; then
72 echo b | ./foo && exit 1
74 echo b | ./bar && exit 1
75 : For shells with busted 'set -e'.
78 # The Yacc-derived C sources must be shipped.
80 $MAKE -s echo-distcom | grep '[ /]parse\.c '
81 $MAKE -s echo-distcom | grep '[ /]bar-parse\.c '
84 test -f $distdir/parse.c
85 test -f $distdir/bar-parse.c
87 # Sanity check on distribution.
88 # Note that, for this to succeed, bar-parse.output must either not
89 # be distributed, or properly cleaned by automake-generated rules.
90 # We don't want to set the exact semantics yet, but want to ensure
91 # they are are consistent.
94 # Make sure that the Yacc-derived C sources are erased by
95 # maintainer-clean, and not by distclean.
102 ./configure # We must re-create 'Makefile'.
103 $MAKE maintainer-clean
106 test ! -e bar-parse.c