Merge branch 'msvc' into maint
[platform/upstream/automake.git] / tests / subdirbuiltsources.test
1 #! /bin/sh
2 # Copyright (C) 2001, 2002, 2010 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 # Make sure when using SUBDIR that all BUILT_SOURCES are built.
18 # A bug occurred where subdirs do not have all-recursive or
19 # all-recursive-am which depended on BUILT_SOURCES.
20
21 . ./defs || Exit 1
22
23 set -e
24
25 mkdir lib
26
27 cat >> configure.in << 'END'
28 AC_CONFIG_FILES([lib/Makefile])
29 AC_PROG_RANLIB
30 AC_PROG_CC
31 AM_PROG_AR
32 AC_OUTPUT
33 END
34
35 # Files required because we are using `--gnu'.
36 : > INSTALL
37 : > NEWS
38 : > README
39 : > COPYING
40 : > AUTHORS
41 : > ChangeLog
42
43 cat > Makefile.am << 'END'
44 SUBDIRS = lib
45 END
46
47 cat > lib/Makefile.am << 'END'
48 pkgdata_DATA =
49 noinst_LIBRARIES = libfoo.a
50 libfoo_a_SOURCES = foo.c
51 BUILT_SOURCES=foo.h
52 foo.h:
53         echo \#define FOO_DEFINE 1 >$@
54 END
55
56 cat > lib/foo.c << 'END'
57 #include <foo.h>
58 int foo () { return !FOO_DEFINE;}
59 END
60
61
62 $ACLOCAL
63 $AUTOCONF
64 $AUTOMAKE --include-deps --copy --force-missing --add-missing --gnu
65
66 ./configure
67
68 # Remove the comment to get a successful test.
69 # $MAKE -C lib foo.h
70 $MAKE
71
72 :