2 # Copyright (C) 2011-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)
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/>.
18 # C sources derived from nodist_ lex sources should not be distributed.
19 # See also related test 'lex-nodist.test'.
20 # The tests 'yacc-nodist.test' and 'yacc-pr204.test' does similar checks
21 # for yacc-generated .c and .h files.
26 cat >> configure.ac <<'EOF'
29 dnl We use AC_PROG_LEX deliberately.
30 dnl Sister 'lex-nodist.test' should use 'AM_PROG_LEX' instead.
35 # The LEXER2 intermediate variable is there to make sure Automake
36 # matches 'nodist_' against the right variable name...
37 cat > Makefile.am << 'EOF'
40 nodist_foo_SOURCES = lexer.l $(LEXER2)
43 test ! -f $(distdir)/lexer.c
44 test ! -f $(distdir)/lexer.l
45 test ! -f $(distdir)/lexer.h
46 test ! -f $(distdir)/lexer2.c
47 test ! -f $(distdir)/lexer2.l
48 test ! -f $(distdir)/lexer2.h
51 cat > lexer.l << 'END'
53 #define YY_NO_UNISTD_H 1
74 # Make sure lexer.c and lexer2.c are still targets.
75 $MAKE lexer.c lexer2.c
79 # Ensure the rebuild rule works despite AM_MAINTAINER_MODE, because
80 # it's a nodist_ lexer.
82 touch lexer.l lexer2.l
84 $MAKE lexer.c lexer2.c
85 stat lexer.c lexer.l lexer2.c lexer2.l || : # For debugging.
86 test `ls -t lexer.c lexer.l | sed 1q` = lexer.c
87 test `ls -t lexer2.c lexer2.l | sed 1q` = lexer2.c