2 # Copyright (C) 2010-2024 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 <https://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 AM_LFLAGS
= --never-interactive
32 bin_PROGRAMS
= foo bar
33 foo_SOURCES
= parse.y foo.c
34 bar_SOURCES
= $
(foo_SOURCES
)
39 @
echo ' ' $
(DIST_COMMON
) ' '
42 cat > parse.y
<< 'END'
46 int yylex
() { return getchar
(); }
47 void yyerror
(const char
*s
) {}
54 extern int yyparse
(void
);
55 int main
() { yyparse
(); return 1; }
65 # The Yacc-derived C sources must be created, and not removed once
66 # compiled (i.e., not treated like "intermediate files" in the GNU
70 # Check that per-object flags are honored.
71 test -f bar-parse.output
73 if ! cross_compiling
; then
75 echo b | .
/foo
&& exit 1
77 echo b | .
/bar
&& exit 1
78 : For shells with busted
'set -e'.
81 # The Yacc-derived C sources must be shipped.
83 $MAKE -s echo-distcom |
grep '[ /]parse\.c '
84 $MAKE -s echo-distcom |
grep '[ /]bar-parse\.c '
87 test -f $distdir/parse.c
88 test -f $distdir/bar-parse.c
90 # Sanity check on distribution.
91 # Note that, for this to succeed, bar-parse.output must either not
92 # be distributed, or properly cleaned by automake-generated rules.
93 # We don't want to set the exact semantics yet, but want to ensure
94 # they are are consistent.
97 # Make sure that the Yacc-derived C sources are erased by
98 # maintainer-clean, and not by distclean.
105 .
/configure
# We must re-create 'Makefile'.
106 $MAKE maintainer-clean
109 test ! -e bar-parse.c