Clarify overriding of `*_DEPENDENCIES' in LIBOBJS node.
[automake/ericb.git] / tests / ltconv.test
blob251c58b1d5a1f68e42040c98bea5a9ecc34e94bf
1 #!/bin/sh
2 # Copyright (C) 2003, 2004, 2007 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 # Test for libtool convenience libraries.
18 # This example is taken from the manual.
20 required='libtoolize gcc'
21 . ./defs || Exit 1
23 set -e
25 cat >>configure.in <<'END'
26 AC_PROG_CC
27 AC_PROG_LIBTOOL
28 AC_CONFIG_FILES(sub1/Makefile
29 sub2/Makefile
30 sub2/sub21/Makefile
31 sub2/sub22/Makefile)
32 AC_OUTPUT
33 END
35 mkdir sub1
36 mkdir sub2
37 mkdir sub2/sub21
38 mkdir sub2/sub22
39 mkdir empty
41 cat >Makefile.am <<'END'
42 SUBDIRS = sub1 sub2
43 lib_LTLIBRARIES = libtop.la
44 libtop_la_SOURCES =
45 libtop_la_LIBADD = \
46 sub1/libsub1.la \
47 sub2/libsub2.la
49 bin_PROGRAMS = ltconvtest
50 ltconvtest_SOURCES = test.c
51 ltconvtest_LDADD = libtop.la
53 check-local:
54 ./ltconvtest$(EXEEXT)
55 : > check-ok
56 installcheck-local:
57 $(bindir)/ltconvtest$(EXEEXT)
58 : > installcheck-ok
59 END
61 cat >sub1/Makefile.am <<'END'
62 noinst_LTLIBRARIES = libsub1.la
63 libsub1_la_SOURCES = sub1.c
64 END
66 echo 'int sub1 () { return 1; }' > sub1/sub1.c
68 cat >sub2/Makefile.am <<'END'
69 SUBDIRS = sub21 sub22
70 noinst_LTLIBRARIES = libsub2.la
71 libsub2_la_SOURCES = sub2.c
72 libsub2_la_LIBADD = \
73 sub21/libsub21.la \
74 sub22/libsub22.la
75 END
77 echo 'int sub2 () { return 2; }' > sub2/sub2.c
79 cat >sub2/sub21/Makefile.am <<'END'
80 noinst_LTLIBRARIES = libsub21.la
81 libsub21_la_SOURCES = sub21.c
82 END
84 echo 'int sub21 () { return 21; }' > sub2/sub21/sub21.c
86 cat >sub2/sub22/Makefile.am <<'END'
87 noinst_LTLIBRARIES = libsub22.la
88 libsub22_la_SOURCES = sub22.c
89 END
91 echo 'int sub22 () { return 22; }' > sub2/sub22/sub22.c
93 cat >test.c <<EOF
94 #include <stdio.h>
95 int main ()
97 if (1 != sub1 ())
98 return 1;
99 if (2 != sub2 ())
100 return 2;
101 if (21 != sub21 ())
102 return 3;
103 if (22 != sub22 ())
104 return 4;
105 return 0;
109 libtoolize
110 $ACLOCAL
111 $AUTOCONF
112 $AUTOMAKE --add-missing
114 # Install libraries in lib/, programs in bin/, and the rest in empty/.
115 # (in fact there is no "rest", so as the name imply empty/ is
116 # expected to remain empty).
117 ./configure "--prefix=`pwd`/empty" "--libdir=`pwd`/lib" "--bindir=`pwd`/bin"
119 $MAKE
120 test -f libtop.la
121 test -f sub1/libsub1.la
122 test -f sub2/libsub2.la
123 test -f sub2/sub21/libsub21.la
124 test -f sub2/sub22/libsub22.la
125 $MAKE check
126 test -f check-ok
127 rm -f check-ok
129 $MAKE install
130 test -f lib/libtop.la
131 $MAKE installcheck
132 test -f installcheck-ok
133 rm -f installcheck-ok
135 find empty -type f -print > empty.lst
136 cat empty.lst
137 test 0 = `wc -l < empty.lst`
139 $MAKE clean
140 test ! -f libtop.la
141 test ! -f sub1/libsub1.la
142 test ! -f sub2/libsub2.la
143 test ! -f sub2/sub21/libsub21.la
144 test ! -f sub2/sub22/libsub22.la
145 test ! -f ltconvtest
147 $MAKE installcheck
148 test -f installcheck-ok
149 rm -f installcheck-ok
151 $MAKE uninstall
152 find lib -type f -print > lib.lst
153 test 0 = `wc -l < lib.lst`
154 find bin -type f -print > bin.lst
155 test 0 = `wc -l < bin.lst`