* automake.texi (Macros): Document AM_PROG_AS.
[automake.git] / tests / yaccvpath.test
blob04041fec155bf6712dee50262a24946746ff22c8
1 #! /bin/sh
3 # This test checks that dependent files are updated before including
4 # in the distribution. `parse.c' depends on `parce.y'. The later is
5 # updated so that `parse.c' should be rebuild. Then we are running
6 # `make' and `make distdir' and check whether the version of `parse.c'
7 # to be distributed is up to date.
9 . $srcdir/defs || exit 1
11 # Fail gracefully if no autoconf.
12 $needs_autoconf
13 # Likewise for some other tools.
14 (gcc -v) > /dev/null 2>&1 || exit 77
15 (bison -V) > /dev/null 2>&1 || exit 77
17 cat > configure.in << 'END'
18 AC_INIT
19 AC_CONFIG_AUX_DIR([.])
20 AM_INIT_AUTOMAKE(foo, 0.1)
21 PACKAGE=foo
22 VERSION=0.1
23 AC_PROG_CC
24 AC_PROG_YACC
25 AC_OUTPUT(Makefile)
26 END
28 cat > Makefile.am << 'END'
29 bin_PROGRAMS = foo
30 foo_SOURCES = parse.y foo.c
31 END
33 # Original parser, with `foobar'
34 cat > parse.y << 'END'
36 int yylex () {return 0;}
37 void yyerror (char *s) {}
40 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
41 END
43 cat > foo.c << 'END'
44 int main () { return 0; }
45 END
47 # We are not checking Autoconf, so we pick $YACC for it.
48 YACC="bison -y"
49 export YACC
51 set -e
53 $ACLOCAL
54 $AUTOCONF
55 $AUTOMAKE -a
57 $YACC parse.y
58 mv y.tab.c parse.c
60 mkdir sub
61 cd sub
62 ../configure
64 # A delay is needed to make sure that the new parse.y is indeed newer
65 # than parse.c, i.e. the they don't have the same timestamp.
66 sleep 2
68 # New parser, with `fubar'
69 cat > ../parse.y << 'END'
71 int yylex () {return 0;}
72 void yyerror (char *s) {}
75 fubar : 'f' 'o' 'o' 'b' 'a' 'r' {};
76 END
78 $MAKE
79 $MAKE distdir
80 grep fubar foo-0.1/parse.c
83 # Now check to make sure that `make dist' will rebuild the parser.
86 # A delay is needed to make sure that the new parse.y is indeed newer
87 # than parse.c, i.e. the they don't have the same timestamp.
88 sleep 2
90 # New parser, with `maude'
91 cat > ../parse.y << 'END'
93 int yylex () {return 0;}
94 void yyerror (char *s) {}
97 maude : 'm' 'a' 'u' 'd' 'e' {};
98 END
100 $MAKE distdir
101 grep maude foo-0.1/parse.c