Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / pr204.test
1 #! /bin/sh
2 # Copyright (C) 2002, 2004, 2010 Free Software Foundation, Inc.
3 #
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.
8 #
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.
13 #
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/>.
16
17 # For PR 204.
18 # Sources derived from nodist_ sources should not be distributed.
19
20 required='bison gcc'
21 . ./defs || Exit 1
22
23 set -e
24
25 cat >> configure.in <<'EOF'
26 AM_MAINTAINER_MODE
27 AC_PROG_CC
28 AC_PROG_YACC
29 AC_OUTPUT
30 EOF
31
32 # The PARSE2 intermediate variable is there to make
33 # sure Automake match 'nodist_' against the right
34 # variable name...
35 cat > Makefile.am << 'EOF'
36 AM_YFLAGS = -d
37 EXTRA_PROGRAMS = foo
38 PARSE2 = parse2.y
39 nodist_foo_SOURCES = parse.y $(PARSE2)
40
41 distdirtest: distdir
42         test ! -f $(distdir)/parse.c
43         test ! -f $(distdir)/parse.y
44         test ! -f $(distdir)/parse.h
45         test ! -f $(distdir)/parse2.c
46         test ! -f $(distdir)/parse2.y
47         test ! -f $(distdir)/parse2.h
48 EOF
49
50 cat > parse.y << 'END'
51 %{
52 int yylex () {return 0;}
53 void yyerror (char *s) {}
54 %}
55 %%
56 maude : 'm' 'a' 'u' 'd' 'e' {};
57 END
58
59 cp parse.y parse2.y
60
61 $ACLOCAL
62 $AUTOCONF
63 $AUTOMAKE -a
64
65 ./configure
66 $MAKE distdirtest
67
68 # Make sure parse.c and parse2.c are still targets.
69 $MAKE parse.c parse2.c
70 test -f parse.c
71 test -f parse2.c
72
73 # Ensure the rebuild rule works despite AM_MAINTAINER_MODE, because
74 # it's a nodist_ parser.
75 $sleep
76 touch parse.y
77 $sleep
78 $MAKE parse.c parse2.c
79 test `ls -1t parse.c parse.y | sed 1q` = parse.c
80
81 :