1 | #!/bin/sh
|
---|
2 | # Copyright (C) 2003, 2004 Free Software Foundation, Inc.
|
---|
3 | #
|
---|
4 | # This file is part of GNU Automake.
|
---|
5 | #
|
---|
6 | # GNU Automake is free software; you can redistribute it and/or modify
|
---|
7 | # it under the terms of the GNU General Public License as published by
|
---|
8 | # the Free Software Foundation; either version 2, or (at your option)
|
---|
9 | # any later version.
|
---|
10 | #
|
---|
11 | # GNU Automake is distributed in the hope that it will be useful,
|
---|
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
14 | # GNU General Public License for more details.
|
---|
15 | #
|
---|
16 | # You should have received a copy of the GNU General Public License
|
---|
17 | # along with Automake; see the file COPYING. If not, write to
|
---|
18 | # the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
---|
19 | # Boston, MA 02110-1301, USA.
|
---|
20 |
|
---|
21 | # Test for libtool convenience libraries.
|
---|
22 | # This example is taken from the manual.
|
---|
23 |
|
---|
24 | required='libtoolize gcc'
|
---|
25 | . ./defs || exit 1
|
---|
26 |
|
---|
27 | set -e
|
---|
28 |
|
---|
29 | cat >>configure.in <<'END'
|
---|
30 | AC_PROG_CC
|
---|
31 | AC_PROG_LIBTOOL
|
---|
32 | AC_CONFIG_FILES(sub1/Makefile
|
---|
33 | sub2/Makefile
|
---|
34 | sub2/sub21/Makefile
|
---|
35 | sub2/sub22/Makefile)
|
---|
36 | AC_OUTPUT
|
---|
37 | END
|
---|
38 |
|
---|
39 | mkdir sub1
|
---|
40 | mkdir sub2
|
---|
41 | mkdir sub2/sub21
|
---|
42 | mkdir sub2/sub22
|
---|
43 | mkdir empty
|
---|
44 |
|
---|
45 | cat >Makefile.am <<'END'
|
---|
46 | SUBDIRS = sub1 sub2
|
---|
47 | lib_LTLIBRARIES = libtop.la
|
---|
48 | libtop_la_SOURCES =
|
---|
49 | libtop_la_LIBADD = \
|
---|
50 | sub1/libsub1.la \
|
---|
51 | sub2/libsub2.la
|
---|
52 |
|
---|
53 | bin_PROGRAMS = ltconvtest
|
---|
54 | ltconvtest_SOURCES = test.c
|
---|
55 | ltconvtest_LDADD = libtop.la
|
---|
56 |
|
---|
57 | check-local:
|
---|
58 | ./ltconvtest$(EXEEXT)
|
---|
59 | : > check-ok
|
---|
60 | installcheck-local:
|
---|
61 | $(bindir)/ltconvtest$(EXEEXT)
|
---|
62 | : > installcheck-ok
|
---|
63 | END
|
---|
64 |
|
---|
65 | cat >sub1/Makefile.am <<'END'
|
---|
66 | noinst_LTLIBRARIES = libsub1.la
|
---|
67 | libsub1_la_SOURCES = sub1.c
|
---|
68 | END
|
---|
69 |
|
---|
70 | echo 'int sub1 () { return 1; }' > sub1/sub1.c
|
---|
71 |
|
---|
72 | cat >sub2/Makefile.am <<'END'
|
---|
73 | SUBDIRS = sub21 sub22
|
---|
74 | noinst_LTLIBRARIES = libsub2.la
|
---|
75 | libsub2_la_SOURCES = sub2.c
|
---|
76 | libsub2_la_LIBADD = \
|
---|
77 | sub21/libsub21.la \
|
---|
78 | sub22/libsub22.la
|
---|
79 | END
|
---|
80 |
|
---|
81 | echo 'int sub2 () { return 2; }' > sub2/sub2.c
|
---|
82 |
|
---|
83 | cat >sub2/sub21/Makefile.am <<'END'
|
---|
84 | noinst_LTLIBRARIES = libsub21.la
|
---|
85 | libsub21_la_SOURCES = sub21.c
|
---|
86 | END
|
---|
87 |
|
---|
88 | echo 'int sub21 () { return 21; }' > sub2/sub21/sub21.c
|
---|
89 |
|
---|
90 | cat >sub2/sub22/Makefile.am <<'END'
|
---|
91 | noinst_LTLIBRARIES = libsub22.la
|
---|
92 | libsub22_la_SOURCES = sub22.c
|
---|
93 | END
|
---|
94 |
|
---|
95 | echo 'int sub22 () { return 22; }' > sub2/sub22/sub22.c
|
---|
96 |
|
---|
97 | cat >test.c <<EOF
|
---|
98 | #include <stdio.h>
|
---|
99 | int main ()
|
---|
100 | {
|
---|
101 | if (1 != sub1 ())
|
---|
102 | return 1;
|
---|
103 | if (2 != sub2 ())
|
---|
104 | return 2;
|
---|
105 | if (21 != sub21 ())
|
---|
106 | return 3;
|
---|
107 | if (22 != sub22 ())
|
---|
108 | return 4;
|
---|
109 | return 0;
|
---|
110 | }
|
---|
111 | EOF
|
---|
112 |
|
---|
113 | libtoolize
|
---|
114 | $ACLOCAL
|
---|
115 | $AUTOCONF
|
---|
116 | $AUTOMAKE --add-missing
|
---|
117 |
|
---|
118 | # Install libraries in lib/, programs in bin/, and the rest in empty/.
|
---|
119 | # (in fact there is no "rest", so as the name imply empty/ is
|
---|
120 | # expected to remain empty).
|
---|
121 | ./configure --prefix=`pwd`/empty --libdir=`pwd`/lib --bindir=`pwd`/bin
|
---|
122 |
|
---|
123 | $MAKE
|
---|
124 | test -f libtop.la
|
---|
125 | test -f sub1/libsub1.la
|
---|
126 | test -f sub2/libsub2.la
|
---|
127 | test -f sub2/sub21/libsub21.la
|
---|
128 | test -f sub2/sub22/libsub22.la
|
---|
129 | $MAKE check
|
---|
130 | test -f check-ok
|
---|
131 | rm -f check-ok
|
---|
132 |
|
---|
133 | $MAKE install
|
---|
134 | test -f lib/libtop.la
|
---|
135 | $MAKE installcheck
|
---|
136 | test -f installcheck-ok
|
---|
137 | rm -f installcheck-ok
|
---|
138 |
|
---|
139 | find empty -type f -print > empty.lst
|
---|
140 | cat empty.lst
|
---|
141 | test 0 = `wc -l < empty.lst`
|
---|
142 |
|
---|
143 | $MAKE clean
|
---|
144 | test ! -f libtop.la
|
---|
145 | test ! -f sub1/libsub1.la
|
---|
146 | test ! -f sub2/libsub2.la
|
---|
147 | test ! -f sub2/sub21/libsub21.la
|
---|
148 | test ! -f sub2/sub22/libsub22.la
|
---|
149 | test ! -f ltconvtest
|
---|
150 |
|
---|
151 | $MAKE installcheck
|
---|
152 | test -f installcheck-ok
|
---|
153 | rm -f installcheck-ok
|
---|
154 |
|
---|
155 | $MAKE uninstall
|
---|
156 | find lib -type f -print > lib.lst
|
---|
157 | test 0 = `wc -l < lib.lst`
|
---|
158 | find bin -type f -print > bin.lst
|
---|
159 | test 0 = `wc -l < bin.lst`
|
---|