742fd0fd22f9b7ccefa3d9628587ad78ffd53c9b
[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 # Fail gracefully if no autoconf.
10 $needs_autoconf
11
12 set -e
13
14 mkdir lib
15
16 cat > configure.in << 'END'
17 AC_INIT
18 AM_INIT_AUTOMAKE(nonesuch, nonesuch)
19 AC_PROG_RANLIB
20 AC_PROG_CC
21 AC_OUTPUT(Makefile lib/Makefile)
22 END
23
24 # Files required because we are using `--gnu'.
25 : > INSTALL
26 : > NEWS
27 : > README
28 : > COPYING
29 : > AUTHORS
30 : > ChangeLog
31
32 cat > Makefile.am << 'END'
33 SUBDIRS = lib
34 END
35
36 cat > lib/Makefile.am << 'END'
37 pkgdata_DATA =
38 noinst_LIBRARIES = libfoo.a
39 libfoo_a_SOURCES = foo.c
40 BUILT_SOURCES=foo.h
41 foo.h:
42         echo \#define FOO_DEFINE 1 >$@
43 END
44
45 cat > lib/foo.c << 'END'
46 #include <foo.h>
47 int foo () { return !FOO_DEFINE;}
48 END
49
50
51 $ACLOCAL
52
53 $AUTOCONF
54
55 $AUTOMAKE --include-deps --copy --force-missing --add-missing --gnu
56
57 ./configure
58
59 # Remove the comment to get a successful test.
60 # $MAKE -C lib foo.h
61 $MAKE
62
63 exit 0