Clarify overriding of `*_DEPENDENCIES' in LIBOBJS node.
[automake/ericb.git] / tests / subpkg.test
blobaa682a9484de401e9dfcbc5ab3fb367de4b7e4af
1 #! /bin/sh
2 # Copyright (C) 2002, 2003, 2004, 2006 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 3, 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 # Check subpackage handling.
19 required='gcc bison'
20 . ./defs || Exit 1
22 set -e
24 mkdir m4
26 cat >m4/foo.m4 <<'EOF'
27 AC_DEFUN([FOO],[
28 AC_PROG_CC
29 AC_OUTPUT
31 EOF
33 cat >>configure.in <<'END'
34 AC_CONFIG_SUBDIRS([lib])
35 FOO
36 END
38 cat >Makefile.am <<'EOF'
39 SUBDIRS = lib
40 # Yes, This program is named LDADD. So what?
41 bin_PROGRAMS = LDADD
42 LDADD_LDADD = lib/liblib.a
44 # It's ok to override distdir.
45 distdir = subpack-1
47 # Make sure $(distdir) and $(top_distdir) work as expected.
48 dist-hook:
49 test -f $(distdir)/LDADD.c
50 test -f $(top_distdir)/LDADD.c
52 ACLOCAL_AMFLAGS = -I m4
53 EOF
55 cat >LDADD.c <<'EOF'
56 int lib ();
58 int
59 main ()
61 return lib ();
63 EOF
65 mkdir lib
66 mkdir lib/src
68 cat >lib/configure.ac <<'EOF'
69 AC_INIT([lib], [2.3])
70 AM_INIT_AUTOMAKE
71 AC_PROG_RANLIB
72 AC_PROG_YACC
73 AC_CONFIG_HEADERS([config.h:config.hin])
74 AC_CONFIG_FILES([Makefile])
75 FOO
76 EOF
78 cat >lib/Makefile.am <<'EOF'
79 noinst_LIBRARIES = liblib.a
80 liblib_a_SOURCES = src/x.c foo.y
81 EXTRA_liblib_a_SOURCES = bar.y
83 dist-hook:
84 test ! -f $(distdir)/LDADD.c
85 test -f $(top_distdir)/LDADD.c
86 test -f $(distdir)/src/x.c
87 test ! -f $(top_distdir)/src/x.c
88 test -f $(YLWRAP)
90 ACLOCAL_AMFLAGS = -I ../m4
91 EOF
93 cat > lib/foo.y << 'END'
95 int yylex () {return 0;}
96 void yyerror (char *s) {}
99 foobar : 'f' 'o' 'o' 'b' 'a' 'r' {};
102 cp lib/foo.y lib/bar.y
104 cat >lib/src/x.c <<'EOF'
105 #include <config.h>
106 int lib ()
108 return 0;
112 $ACLOCAL -I m4
113 $AUTOCONF
114 $AUTOMAKE -Wno-override
116 cd lib
117 $ACLOCAL -I ../m4
118 $FGREP 'm4_include([../m4/foo.m4])' aclocal.m4
119 $AUTOCONF
120 $AUTOHEADER
121 $AUTOMAKE -Wno-override --add-missing
122 cd ..
124 ./configure
125 $MAKE
126 $MAKE distcheck
127 test ! -d subpack-1 # make sure distcheck cleans up after itself
128 test -f subpack-1.tar.gz