Fix for PR automake/322:
[platform/upstream/automake.git] / tests / subdirbuiltsources.test
1 #! /bin/sh
2
3 # Make sure when using SUBDIR that all BUILT_SOURCES are built.
4 # A bug occurred where subdirs do not have all-recursive or
5 # all-recursive-am which depended on BUILT_SOURCES.
6
7 . $srcdir/defs || exit 1
8
9 set -e
10
11 mkdir lib
12
13 cat > configure.in << 'END'
14 AC_INIT
15 AM_INIT_AUTOMAKE(nonesuch, nonesuch)
16 AC_PROG_RANLIB
17 AC_PROG_CC
18 AC_OUTPUT(Makefile lib/Makefile)
19 END
20
21 # Files required because we are using `--gnu'.
22 : > INSTALL
23 : > NEWS
24 : > README
25 : > COPYING
26 : > AUTHORS
27 : > ChangeLog
28
29 cat > Makefile.am << 'END'
30 SUBDIRS = lib
31 END
32
33 cat > lib/Makefile.am << 'END'
34 pkgdata_DATA =
35 noinst_LIBRARIES = libfoo.a
36 libfoo_a_SOURCES = foo.c
37 BUILT_SOURCES=foo.h
38 foo.h:
39         echo \#define FOO_DEFINE 1 >$@
40 END
41
42 cat > lib/foo.c << 'END'
43 #include <foo.h>
44 int foo () { return !FOO_DEFINE;}
45 END
46
47
48 $ACLOCAL
49
50 $AUTOCONF
51
52 $AUTOMAKE --include-deps --copy --force-missing --add-missing --gnu
53
54 ./configure
55
56 # Remove the comment to get a successful test.
57 # $MAKE -C lib foo.h
58 $MAKE
59
60 exit 0