1 | #! /bin/sh
|
---|
2 | # Copyright (C) 2002 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 autoconf; 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 | # Test for subdir parsers.
|
---|
22 |
|
---|
23 | required="gcc bison"
|
---|
24 |
|
---|
25 | . ./defs || exit 1
|
---|
26 |
|
---|
27 | set -e
|
---|
28 |
|
---|
29 | cat >> configure.in << 'END'
|
---|
30 | AC_CONFIG_AUX_DIR([.])
|
---|
31 | AC_PROG_CC
|
---|
32 | AM_PROG_CC_C_O
|
---|
33 | AC_PROG_YACC
|
---|
34 | AC_OUTPUT
|
---|
35 | END
|
---|
36 |
|
---|
37 | cat > Makefile.am << 'END'
|
---|
38 | AUTOMAKE_OPTIONS = subdir-objects
|
---|
39 | bin_PROGRAMS = foo/foo
|
---|
40 | foo_foo_SOURCES = foo/parse.y
|
---|
41 | AM_YFLAGS = -d
|
---|
42 | END
|
---|
43 |
|
---|
44 | mkdir foo
|
---|
45 |
|
---|
46 | cat > foo/parse.y << 'END'
|
---|
47 | %{
|
---|
48 | int yylex () {return 0;}
|
---|
49 | void yyerror (char *s) {}
|
---|
50 | %}
|
---|
51 | %%
|
---|
52 | foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
|
---|
53 | END
|
---|
54 |
|
---|
55 | $ACLOCAL
|
---|
56 | $AUTOCONF
|
---|
57 | $AUTOMAKE -a
|
---|
58 |
|
---|
59 | mkdir sub
|
---|
60 | cd sub
|
---|
61 |
|
---|
62 | ../configure
|
---|
63 | $MAKE foo/parse.o
|
---|
64 | test -f foo/parse.c
|
---|
65 | test -f foo/parse.o
|
---|
66 |
|
---|
67 | # Aside of the rest of this test, let's see if we can recover from
|
---|
68 | # parse.h removal
|
---|
69 | test -f foo/parse.h
|
---|
70 | rm -f foo/parse.h
|
---|
71 | $MAKE foo/parse.h
|
---|
72 | test -f foo/parse.h
|
---|
73 |
|
---|
74 | # Now, adds another parser to test ylwrap.
|
---|
75 |
|
---|
76 | cd ..
|
---|
77 |
|
---|
78 | # Sleep some to make sure timestamp of Makefile.am will change.
|
---|
79 | $sleep
|
---|
80 |
|
---|
81 | cp foo/parse.y foo/parse2.y
|
---|
82 | cat >> Makefile.am << 'END'
|
---|
83 | EXTRA_foo_foo_SOURCES = foo/parse2.y
|
---|
84 | END
|
---|
85 |
|
---|
86 | $AUTOMAKE -a
|
---|
87 | test -f ./ylwrap || exit 1
|
---|
88 |
|
---|
89 | cd sub
|
---|
90 | # Regenerate Makefile (automatic in GNU Make, but not in other Makes)
|
---|
91 | ./config.status
|
---|
92 | $MAKE foo/parse2.o
|
---|
93 | test -f foo/parse2.c
|
---|
94 | test -f foo/parse2.o
|
---|
95 |
|
---|
96 | exit 0
|
---|