* doc/automake.texi (Future of aclocal): Make clearer that
[automake.git] / tests / ltcond.test
blob2f69838be440e65440e4f898e355286034f578af
1 #!/bin/sh
2 # Copyright (C) 2003, 2004 Free Software Foundation, Inc.
4 # This file is part of GNU Automake.
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.
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.
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., 59 Temple Place - Suite 330,
19 # Boston, MA 02111-1307, USA.
21 # Test for conditional libtool libraries.
22 # This combines two examples from the manual.
24 required='libtoolize gcc'
25 . ./defs || exit 1
27 set -e
29 cat >>configure.in <<'END'
30 AM_CONDITIONAL([WANT_LIBFOO], [true])
31 AM_CONDITIONAL([WANT_LIBBAR], [false])
32 AC_SUBST([WANTEDLIBS], ['lib1foo.la lib1bar.la'])
33 AC_PROG_CC
34 AC_PROG_LIBTOOL
35 AC_OUTPUT
36 END
38 cat >Makefile.am <<'END'
39 EXTRA_LTLIBRARIES = lib1foo.la lib1bar.la lib3bar.la
40 lib_LTLIBRARIES = $(WANTEDLIBS)
41 lib1foo_la_SOURCES = foo.c
42 lib1foo_la_LDFLAGS = -rpath '$(libdir)'
43 lib1bar_la_SOURCES = bar.c
44 lib1bar_la_LDFLAGS = -rpath '$(libdir)'
45 lib3bar_la_SOURCES = bar.c
47 if WANT_LIBFOO
48 lib_LTLIBRARIES += lib2foo.la
49 check_LTLIBRARIES = lib3foo.la
50 endif
51 if WANT_LIBBAR
52 lib_LTLIBRARIES += lib2bar.la
53 endif
54 lib2foo_la_SOURCES = foo.c
55 lib2bar_la_SOURCES = bar.c
56 lib3foo_la_SOURCES = foo.c
57 END
59 echo 'int one () { return 1; }' >foo.c
60 echo 'int two () { return 2; }' >bar.c
62 mkdir empty
64 libtoolize
65 $ACLOCAL
66 $AUTOCONF
67 $AUTOMAKE --add-missing
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
74 $MAKE
75 test -f lib1foo.la
76 test -f lib1bar.la
77 test -f lib2foo.la
78 test ! -f lib2bar.la
79 test ! -f lib3foo.la
80 test ! -f lib3bar.la
82 $MAKE check
83 test ! -f lib2bar.la
84 test -f lib3foo.la
85 test ! -f lib3bar.la
87 $MAKE install
88 test -f lib/lib1foo.la
89 test -f lib/lib1bar.la
90 test -f lib/lib2foo.la
91 test ! -f lib/lib3foo.la
92 find empty -type f -print > empty.lst
93 cat empty.lst
94 test 0 = `wc -l < empty.lst`
96 $MAKE uninstall
97 find lib -type f -print > lib.lst
98 test 0 = `wc -l < lib.lst`
99 test -f lib1foo.la
100 test -f lib1bar.la
101 test -f lib2foo.la
102 test -f lib3foo.la
104 $MAKE clean
105 test ! -f lib1foo.la
106 test ! -f lib1bar.la
107 test ! -f lib2foo.la
108 test ! -f lib3foo.la