Revert Automake license to GPLv2+.
[automake.git] / tests / subdir5.test
blob1bfee41f0b8739c29121b9692cb02bedb65de3f5
1 #! /bin/sh
2 # Copyright (C) 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
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.
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.
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/>.
17 # Test to make sure that adding a new directory works.
18 # This test runs `make' from the top-level directory, subdir8.test
19 # do it from a subdirectory.
20 # PR automake/46
22 # This test assumes that the `make' utility is able to start
23 # over and reload Makefiles which have been remade (a non-POSIX feature).
24 required='GNUmake gcc'
25 . ./defs || Exit 1
27 set -e
29 cat > configure.in << 'END'
30 AC_INIT(maude, 1.0)
31 AM_INIT_AUTOMAKE
32 AM_PROG_CC_C_O
33 AC_CONFIG_FILES(Makefile)
34 AC_OUTPUT
35 END
37 cat > Makefile.am << 'END'
38 bin_PROGRAMS = wish
39 wish_SOURCES = a.c
40 END
42 cat > a.c << 'END'
43 #include <stdio.h>
44 int main ()
46 printf ("hi liver!\n");
47 return 0;
49 END
51 $ACLOCAL
52 $AUTOCONF
53 $AUTOMAKE --include-deps --copy --add-missing
54 ./configure
55 $MAKE
57 # Now add a new directory.
58 cat > configure.in << 'END'
59 AC_INIT(maude, 1.0)
60 AM_INIT_AUTOMAKE
61 AC_PROG_CC
62 AM_PROG_CC_C_O
63 AC_CONFIG_FILES(Makefile maude/Makefile)
64 m4_include([confile.m4])
65 AC_OUTPUT
66 END
68 : > confile.m4
70 mkdir maude
71 cat > maude/Makefile.am << 'END'
72 include_HEADERS = foo.h
73 END
75 : > maude/foo.h
77 echo 'SUBDIRS = maude' >> Makefile.am
79 # We want a simple rebuild to create maude/Makefile automatically.
80 $MAKE
81 test -f maude/Makefile
83 # Add yet another directory
84 mkdir maude2
85 echo 'AC_CONFIG_FILES([maude2/Makefile])AC_SUBST([GREPME])' > confile.m4
86 : > maude2/Makefile.am
87 echo 'SUBDIRS += maude2' >> Makefile.am
89 # We want a simple rebuild to create maude2/Makefile and update
90 # all other Makefiles automatically.
91 $MAKE
92 grep GREPME Makefile
93 grep GREPME maude/Makefile
94 grep GREPME maude2/Makefile