automake: recognize all-numeric MAJ.MIN.MICROa.ALPHA versions better.
[automake.git] / t / yacc-misc.sh
blob02e54af8eb68a4fe1a27de4b1e556bdf10607641
1 #! /bin/sh
2 # Copyright (C) 2001-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)
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 <https://www.gnu.org/licenses/>.
17 # Some simple tests of ylwrap functionality.
19 required='cc yacc'
20 . test-init.sh
22 cat >> configure.ac << 'END'
23 AC_PROG_CC
24 AC_PROG_YACC
25 AC_OUTPUT
26 END
28 cat > Makefile.am << 'END'
29 AM_LFLAGS = --never-interactive
31 bin_PROGRAMS = foo bar
32 foo_SOURCES = parse.y foo.c
33 bar_SOURCES = bar.y foo.c
34 END
36 # First parser.
37 cat > parse.y << 'END'
39 int yylex () { return 0; }
40 void yyerror (const char *s) {}
43 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
44 END
46 # Second parser.
47 cat > bar.y << 'END'
49 int yylex () { return 0; }
50 void yyerror (const char *s) {}
53 fubar : 'f' 'o' 'o' 'b' 'a' 'r' {};
54 END
56 cat > foo.c << 'END'
57 int main (void)
59 return 0;
61 END
63 $ACLOCAL
64 $AUTOCONF
65 $AUTOMAKE -a
67 test -f ylwrap
69 mkdir sub
70 cd sub
72 ../configure
73 $MAKE
75 grep '^#.*/sub/\.\./' bar.c && exit 1
76 grep '^#.*/sub/\.\./' parse.c && exit 1
78 # Make distclean must not erase bar.c nor parse.c (by GNU standards) ...
79 $MAKE distclean
80 test -f bar.c
81 test -f parse.c
82 # ... but maintainer-clean should.
83 ../configure
84 $MAKE maintainer-clean
85 test ! -e bar.c
86 test ! -e parse.c