Revert Automake license to GPLv2+.
[platform/upstream/automake.git] / tests / lex5.test
1 #! /bin/sh
2 # Copyright (C) 2002, 2003, 2004  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 # Test for subdir lexers.
18
19 required='gcc GNUmake gzip flex'
20 . ./defs || Exit 1
21
22 set -e
23
24 cat > configure.in << 'END'
25 AC_INIT([lex5], [1.0])
26 AC_CONFIG_AUX_DIR([.])
27 AM_INIT_AUTOMAKE
28 AC_CONFIG_FILES([Makefile])
29 AC_PROG_CC
30 AM_PROG_CC_C_O
31 AM_PROG_LEX
32 AC_OUTPUT
33 END
34
35 cat > Makefile.am << 'END'
36 AUTOMAKE_OPTIONS  = foreign subdir-objects
37 LDADD             = @LEXLIB@
38
39 bin_PROGRAMS    = foo/foo
40 foo_foo_SOURCES = foo/foo.l
41 END
42
43 mkdir foo
44
45 cat > foo/foo.l << 'END'
46 %%
47 "END"   return EOF;
48 .
49 %%
50 int
51 main ()
52 {
53   while (yylex () != EOF)
54     ;
55
56   return 0;
57 }
58 END
59
60 set -e
61
62 $ACLOCAL
63 $AUTOCONF
64 $AUTOMAKE -a
65
66 mkdir sub
67 cd sub
68 ../configure
69 $MAKE foo/foo.o
70
71 test -f foo/foo.c
72 test -f foo/foo.o
73 # ylwrap is not needed
74 test ! -f ./ylwrap
75
76 # Now, adds another lexer to test ylwrap.
77
78 cd ..
79 cp foo/foo.l foo/foo2.l
80 cat >> Makefile.am << 'END'
81 EXTRA_foo_foo_SOURCES = foo/foo2.l
82 END
83
84 # Make sure Makefile.in has a new time stamp: the rebuild rules are
85 # used below.  We do this after updating Makefile.am, that way we can
86 # ensure that automake, even with --no-force, is not confused if the
87 # new Makefile.am has the same time stamp as the older one (since the
88 # output will change, --no-force should have no effect).
89 $sleep
90
91 $AUTOMAKE -a --no-force
92 test -f ./ylwrap
93
94 cd sub
95 $MAKE foo/foo2.o
96 test -f foo/foo2.c
97 test -f foo/foo2.o
98
99 Exit 0