source: trunk/essentials/sys-devel/automake-1.9/tests/ltconv.test

Last change on this file was 3086, checked in by bird, 18 years ago

automake 1.9.6

File size: 3.4 KB
Line 
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
24required='libtoolize gcc'
25. ./defs || exit 1
26
27set -e
28
29cat >>configure.in <<'END'
30AC_PROG_CC
31AC_PROG_LIBTOOL
32AC_CONFIG_FILES(sub1/Makefile
33 sub2/Makefile
34 sub2/sub21/Makefile
35 sub2/sub22/Makefile)
36AC_OUTPUT
37END
38
39mkdir sub1
40mkdir sub2
41mkdir sub2/sub21
42mkdir sub2/sub22
43mkdir empty
44
45cat >Makefile.am <<'END'
46SUBDIRS = sub1 sub2
47lib_LTLIBRARIES = libtop.la
48libtop_la_SOURCES =
49libtop_la_LIBADD = \
50 sub1/libsub1.la \
51 sub2/libsub2.la
52
53bin_PROGRAMS = ltconvtest
54ltconvtest_SOURCES = test.c
55ltconvtest_LDADD = libtop.la
56
57check-local:
58 ./ltconvtest$(EXEEXT)
59 : > check-ok
60installcheck-local:
61 $(bindir)/ltconvtest$(EXEEXT)
62 : > installcheck-ok
63END
64
65cat >sub1/Makefile.am <<'END'
66noinst_LTLIBRARIES = libsub1.la
67libsub1_la_SOURCES = sub1.c
68END
69
70echo 'int sub1 () { return 1; }' > sub1/sub1.c
71
72cat >sub2/Makefile.am <<'END'
73SUBDIRS = sub21 sub22
74noinst_LTLIBRARIES = libsub2.la
75libsub2_la_SOURCES = sub2.c
76libsub2_la_LIBADD = \
77 sub21/libsub21.la \
78 sub22/libsub22.la
79END
80
81echo 'int sub2 () { return 2; }' > sub2/sub2.c
82
83cat >sub2/sub21/Makefile.am <<'END'
84noinst_LTLIBRARIES = libsub21.la
85libsub21_la_SOURCES = sub21.c
86END
87
88echo 'int sub21 () { return 21; }' > sub2/sub21/sub21.c
89
90cat >sub2/sub22/Makefile.am <<'END'
91noinst_LTLIBRARIES = libsub22.la
92libsub22_la_SOURCES = sub22.c
93END
94
95echo 'int sub22 () { return 22; }' > sub2/sub22/sub22.c
96
97cat >test.c <<EOF
98#include <stdio.h>
99int 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}
111EOF
112
113libtoolize
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
124test -f libtop.la
125test -f sub1/libsub1.la
126test -f sub2/libsub2.la
127test -f sub2/sub21/libsub21.la
128test -f sub2/sub22/libsub22.la
129$MAKE check
130test -f check-ok
131rm -f check-ok
132
133$MAKE install
134test -f lib/libtop.la
135$MAKE installcheck
136test -f installcheck-ok
137rm -f installcheck-ok
138
139find empty -type f -print > empty.lst
140cat empty.lst
141test 0 = `wc -l < empty.lst`
142
143$MAKE clean
144test ! -f libtop.la
145test ! -f sub1/libsub1.la
146test ! -f sub2/libsub2.la
147test ! -f sub2/sub21/libsub21.la
148test ! -f sub2/sub22/libsub22.la
149test ! -f ltconvtest
150
151$MAKE installcheck
152test -f installcheck-ok
153rm -f installcheck-ok
154
155$MAKE uninstall
156find lib -type f -print > lib.lst
157test 0 = `wc -l < lib.lst`
158find bin -type f -print > bin.lst
159test 0 = `wc -l < bin.lst`
Note: See TracBrowser for help on using the repository browser.