maint: it seems APIVERSION only changes for minor/major releases.
[automake.git] / t / lex-pr204.sh
blobd014c43285b4529506c7e395baf812f1025ca269
1 #! /bin/sh
2 # Copyright (C) 2011-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 # Related to PR 204.
18 # C sources derived from nodist_ lex sources should not be distributed.
19 # See also related test 'lex-nodist.sh'.
20 # The tests 'yacc-nodist.sh' and 'yacc-pr204.sh' does similar checks
21 # for yacc-generated .c and .h files.
23 required='cc lex'
24 . test-init.sh
26 cat >> configure.ac <<'EOF'
27 AM_MAINTAINER_MODE
28 AC_PROG_CC
29 dnl We use AC_PROG_LEX deliberately.
30 dnl Sister 'lex-nodist.sh' should use 'AM_PROG_LEX' instead.
31 AC_PROG_LEX
32 AC_OUTPUT
33 EOF
35 # The LEXER2 intermediate variable is there to make sure Automake
36 # matches 'nodist_' against the right variable name...
37 cat > Makefile.am << 'EOF'
38 AM_LFLAGS = --never-interactive
40 EXTRA_PROGRAMS = foo
41 LEXER2 = lexer2.l
42 nodist_foo_SOURCES = lexer.l $(LEXER2)
44 distdirtest: distdir
45 test ! -f $(distdir)/lexer.c
46 test ! -f $(distdir)/lexer.l
47 test ! -f $(distdir)/lexer.h
48 test ! -f $(distdir)/lexer2.c
49 test ! -f $(distdir)/lexer2.l
50 test ! -f $(distdir)/lexer2.h
51 EOF
53 cat > lexer.l << 'END'
55 "GOOD" return EOF;
58 int main (void)
60 return yylex ();
62 END
64 cp lexer.l lexer2.l
66 $ACLOCAL
67 $AUTOCONF
68 $AUTOMAKE -a
70 ./configure
71 $MAKE distdirtest
73 # Make sure lexer.c and lexer2.c are still targets.
74 $MAKE lexer.c lexer2.c
75 test -f lexer.c
76 test -f lexer2.c
78 # Ensure the rebuild rule works despite AM_MAINTAINER_MODE, because
79 # it's a nodist_ lexer.
80 $sleep
81 touch lexer.l lexer2.l
82 $sleep
83 $MAKE lexer.c lexer2.c
84 is_newest lexer.c lexer.l
85 is_newest lexer2.c lexer2.l