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

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

automake 1.9.6

File size: 2.6 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 conditional libtool libraries.
22# This combines two examples from the manual.
23
24required='libtoolize gcc'
25. ./defs || exit 1
26
27set -e
28
29cat >>configure.in <<'END'
30AM_CONDITIONAL([WANT_LIBFOO], [true])
31AM_CONDITIONAL([WANT_LIBBAR], [false])
32AC_SUBST([WANTEDLIBS], ['lib1foo.la lib1bar.la'])
33AC_PROG_CC
34AC_PROG_LIBTOOL
35AC_OUTPUT
36END
37
38cat >Makefile.am <<'END'
39EXTRA_LTLIBRARIES = lib1foo.la lib1bar.la lib3bar.la
40lib_LTLIBRARIES = $(WANTEDLIBS)
41lib1foo_la_SOURCES = foo.c
42lib1foo_la_LDFLAGS = -rpath '$(libdir)'
43lib1bar_la_SOURCES = bar.c
44lib1bar_la_LDFLAGS = -rpath '$(libdir)'
45lib3bar_la_SOURCES = bar.c
46
47if WANT_LIBFOO
48lib_LTLIBRARIES += lib2foo.la
49check_LTLIBRARIES = lib3foo.la
50endif
51if WANT_LIBBAR
52lib_LTLIBRARIES += lib2bar.la
53endif
54lib2foo_la_SOURCES = foo.c
55lib2bar_la_SOURCES = bar.c
56lib3foo_la_SOURCES = foo.c
57END
58
59echo 'int one () { return 1; }' >foo.c
60echo 'int two () { return 2; }' >bar.c
61
62mkdir empty
63
64libtoolize
65$ACLOCAL
66$AUTOCONF
67$AUTOMAKE --add-missing
68
69# Install libraries in lib/, and the rest in empty/.
70# (in fact there is no "rest", so as the name imply empty/ is
71# expected to remain empty).
72./configure --prefix=`pwd`/empty --libdir=`pwd`/lib
73
74$MAKE
75test -f lib1foo.la
76test -f lib1bar.la
77test -f lib2foo.la
78test ! -f lib2bar.la
79test ! -f lib3foo.la
80test ! -f lib3bar.la
81
82$MAKE check
83test ! -f lib2bar.la
84test -f lib3foo.la
85test ! -f lib3bar.la
86
87$MAKE install
88test -f lib/lib1foo.la
89test -f lib/lib1bar.la
90test -f lib/lib2foo.la
91test ! -f lib/lib3foo.la
92find empty -type f -print > empty.lst
93cat empty.lst
94test 0 = `wc -l < empty.lst`
95
96$MAKE uninstall
97find lib -type f -print > lib.lst
98test 0 = `wc -l < lib.lst`
99test -f lib1foo.la
100test -f lib1bar.la
101test -f lib2foo.la
102test -f lib3foo.la
103
104$MAKE clean
105test ! -f lib1foo.la
106test ! -f lib1bar.la
107test ! -f lib2foo.la
108test ! -f lib3foo.la
Note: See TracBrowser for help on using the repository browser.