1 | #! /bin/sh
|
---|
2 | # Copyright (C) 2001, 2002, 2003 Free Software Foundation, Inc.
|
---|
3 | #
|
---|
4 | # This file is part of GNU Automake.
|
---|
5 | #
|
---|
6 | # GNU Automake is free software; you can redistribute it and/or modify
|
---|
7 | # it under the terms of the GNU General Public License as published by
|
---|
8 | # the Free Software Foundation; either version 2, or (at your option)
|
---|
9 | # any later version.
|
---|
10 | #
|
---|
11 | # GNU Automake is distributed in the hope that it will be useful,
|
---|
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | # GNU General Public License for more details.
|
---|
15 | #
|
---|
16 | # You should have received a copy of the GNU General Public License
|
---|
17 | # along with Automake; see the file COPYING. If not, write to
|
---|
18 | # the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
---|
19 | # Boston, MA 02111-1307, USA.
|
---|
20 |
|
---|
21 | # This test checks that dependent files are updated before including
|
---|
22 | # in the distribution. `parse.c' depends on `parce.y'. The later is
|
---|
23 | # updated so that `parse.c' should be rebuild. Then we are running
|
---|
24 | # `make' and `make distdir' and check whether the version of `parse.c'
|
---|
25 | # to be distributed is up to date.
|
---|
26 |
|
---|
27 | required='gcc bison'
|
---|
28 | . ./defs || exit 1
|
---|
29 |
|
---|
30 | cat > configure.in << 'END'
|
---|
31 | AC_INIT
|
---|
32 | AC_CONFIG_AUX_DIR([.])
|
---|
33 | AM_INIT_AUTOMAKE(foo, 0.1)
|
---|
34 | PACKAGE=foo
|
---|
35 | VERSION=0.1
|
---|
36 | AC_PROG_CC
|
---|
37 | AC_PROG_YACC
|
---|
38 | AC_OUTPUT(Makefile)
|
---|
39 | END
|
---|
40 |
|
---|
41 | cat > Makefile.am << 'END'
|
---|
42 | bin_PROGRAMS = foo
|
---|
43 | foo_SOURCES = parse.y foo.c
|
---|
44 | END
|
---|
45 |
|
---|
46 | # Original parser, with `foobar'
|
---|
47 | cat > parse.y << 'END'
|
---|
48 | %{
|
---|
49 | int yylex () {return 0;}
|
---|
50 | void yyerror (char *s) {}
|
---|
51 | %}
|
---|
52 | %%
|
---|
53 | foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
|
---|
54 | END
|
---|
55 |
|
---|
56 | cat > foo.c << 'END'
|
---|
57 | int main () { return 0; }
|
---|
58 | END
|
---|
59 |
|
---|
60 | set -e
|
---|
61 |
|
---|
62 | $ACLOCAL
|
---|
63 | $AUTOCONF
|
---|
64 | $AUTOMAKE -a
|
---|
65 |
|
---|
66 | $YACC parse.y
|
---|
67 | mv y.tab.c parse.c
|
---|
68 |
|
---|
69 | mkdir sub
|
---|
70 | cd sub
|
---|
71 | ../configure
|
---|
72 |
|
---|
73 | # A delay is needed to make sure that the new parse.y is indeed newer
|
---|
74 | # than parse.c, i.e. the they don't have the same timestamp.
|
---|
75 | $sleep
|
---|
76 |
|
---|
77 | # New parser, with `fubar'
|
---|
78 | cat > ../parse.y << 'END'
|
---|
79 | %{
|
---|
80 | int yylex () {return 0;}
|
---|
81 | void yyerror (char *s) {}
|
---|
82 | %}
|
---|
83 | %%
|
---|
84 | fubar : 'f' 'o' 'o' 'b' 'a' 'r' {};
|
---|
85 | END
|
---|
86 |
|
---|
87 | $MAKE
|
---|
88 | $MAKE distdir
|
---|
89 | grep fubar foo-0.1/parse.c
|
---|
90 |
|
---|
91 | #
|
---|
92 | # Now check to make sure that `make dist' will rebuild the parser.
|
---|
93 | #
|
---|
94 |
|
---|
95 | # A delay is needed to make sure that the new parse.y is indeed newer
|
---|
96 | # than parse.c, i.e. the they don't have the same timestamp.
|
---|
97 | $sleep
|
---|
98 |
|
---|
99 | # New parser, with `maude'
|
---|
100 | cat > ../parse.y << 'END'
|
---|
101 | %{
|
---|
102 | int yylex () {return 0;}
|
---|
103 | void yyerror (char *s) {}
|
---|
104 | %}
|
---|
105 | %%
|
---|
106 | maude : 'm' 'a' 'u' 'd' 'e' {};
|
---|
107 | END
|
---|
108 |
|
---|
109 | $MAKE distdir
|
---|
110 | grep maude foo-0.1/parse.c
|
---|