2 # Copyright (C) 2003-2012 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 2, or (at your option)
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 conditional libtool libraries.
18 # This combines two examples from the manual.
20 required='cc libtoolize'
23 cat >>configure.ac <<'END'
24 AM_CONDITIONAL([WANT_LIBFOO], [true])
25 AM_CONDITIONAL([WANT_LIBBAR], [false])
26 AC_SUBST([WANTEDLIBS], ['lib1foo.la lib1bar.la'])
33 cat >Makefile.am <<'END'
34 EXTRA_LTLIBRARIES = lib1foo.la lib1bar.la lib3bar.la
35 lib_LTLIBRARIES = $(WANTEDLIBS)
36 lib1foo_la_SOURCES = foo.c
37 lib1foo_la_LDFLAGS = -rpath '$(libdir)'
38 lib1bar_la_SOURCES = bar.c
39 lib1bar_la_LDFLAGS = -rpath '$(libdir)'
40 lib3bar_la_SOURCES = bar.c
43 lib_LTLIBRARIES += lib2foo.la
44 check_LTLIBRARIES = lib3foo.la
47 lib_LTLIBRARIES += lib2bar.la
49 lib2foo_la_SOURCES = foo.c
50 lib2bar_la_SOURCES = bar.c
51 lib3foo_la_SOURCES = foo.c
54 echo 'int one () { return 1; }' >foo.c
55 echo 'int two () { return 2; }' >bar.c
62 $AUTOMAKE --add-missing
64 cwd=$(pwd) || fatal_ "getting current working directory"
66 # Install libraries in lib/, and the rest in empty/.
67 # (in fact there is no "rest", so as the name imply empty/ is
68 # expected to remain empty).
69 ./configure --prefix="$cwd/empty" --libdir="$cwd/lib"
85 test -f lib/lib1foo.la
86 test -f lib/lib1bar.la
87 test -f lib/lib2foo.la
88 test ! -e lib/lib3foo.la
89 find empty -type f -print > empty.lst
90 test -s empty.lst && { cat empty.lst; exit 1; }
93 find lib -type f -print > lib.lst
94 test -s lib.lst && { cat lib.lst; exit 1; }