tests: fix a spurious typo-related failure
[automake.git] / t / yacc-pr204.sh
blobbabd2c9d757d5c1fe06c265271772893854b3c28
1 #! /bin/sh
2 # Copyright (C) 2002-2012 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)
7 # any later version.
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 # For PR 204.
18 # C sources derived from nodist_ yacc sources should not be distributed.
19 # See also related test 'yacc-nodist.sh'.
20 # The tests 'lex-nodist.sh' and 'lex-pr204.sh' does similar checks
21 # for lex-generated C files.
23 required='cc yacc'
24 . ./defs || exit 1
26 cat >> configure.ac <<'EOF'
27 AM_MAINTAINER_MODE
28 AC_PROG_CC
29 AC_PROG_YACC
30 AC_OUTPUT
31 EOF
33 # The PARSE2 intermediate variable is there to make
34 # sure Automake match 'nodist_' against the right
35 # variable name...
36 cat > Makefile.am << 'EOF'
37 AM_YFLAGS = -d
38 EXTRA_PROGRAMS = foo
39 PARSE2 = parse2.y
40 nodist_foo_SOURCES = parse.y $(PARSE2)
42 distdirtest: distdir
43 test ! -f $(distdir)/parse.c
44 test ! -f $(distdir)/parse.y
45 test ! -f $(distdir)/parse.h
46 test ! -f $(distdir)/parse2.c
47 test ! -f $(distdir)/parse2.y
48 test ! -f $(distdir)/parse2.h
49 EOF
51 cat > parse.y << 'END'
53 int yylex () {return 0;}
54 void yyerror (char *s) {}
57 maude : 'm' 'a' 'u' 'd' 'e' {};
58 END
60 cp parse.y parse2.y
62 $ACLOCAL
63 $AUTOCONF
64 $AUTOMAKE -a
66 ./configure
67 $MAKE distdirtest
69 # Make sure parse.c and parse2.c are still targets.
70 $MAKE parse.c parse2.c
71 test -f parse.c
72 test -f parse2.c
74 # Ensure the rebuild rule works despite AM_MAINTAINER_MODE, because
75 # it's a nodist_ parser.
76 $sleep
77 touch parse.y parse2.y
78 $sleep
79 $MAKE parse.c parse2.c
80 is_newest parse.c parse.y
81 is_newest parse2.c parse2.y