1 # indirect_deps.at -- support for link_all_deplibs=no -*- Autotest -*-
3 # Copyright (C) 2007, 2008 Free Software Foundation, Inc.
4 # Written by Ralf Wildenhues, 2007.
6 # This file is part of GNU Libtool.
8 # GNU Libtool is free software; you can redistribute it and/or
9 # modify it under the terms of the GNU General Public License as
10 # published by the Free Software Foundation; either version 2 of
11 # the License, or (at your option) any later version.
13 # GNU Libtool is distributed in the hope that it will be useful,
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
18 # You should have received a copy of the GNU General Public License
19 # along with GNU Libtool; see the file COPYING. If not, a copy
20 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
21 # or obtained by writing to the Free Software Foundation, Inc.,
22 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
25 AT_SETUP([indirect convenience])
26 AT_KEYWORDS([libtool])
30 int a () { return 0; }
31 double ad (double x) { return sin (x); }
35 extern double ad (double);
36 int b () { return a () + (int) ad (0.0); }
40 int c () { return b (); }
44 int main () { return c (); }
47 LDFLAGS="$LDFLAGS -no-undefined"
48 for file in a.c b.c c.c; do
49 $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c $file
51 $CC $CPPFLAGS $CFLAGS -c m.c
53 # liba is an indirect dependency of libd and of libconv.
54 $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o liba.la a.lo -rpath /nowhere -lm
55 $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libb.la b.lo liba.la -rpath /nowhere
56 $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libconv.la c.lo libb.la
57 $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o libd.la libconv.la -rpath /nowhere
59 for st in '' -static; do
60 AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS $st -o m1$EXEEXT m.$OBJEXT libd.la],
61 [], [ignore], [ignore])
62 AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS $st -o m2$EXEEXT m.$OBJEXT libconv.la],
63 [], [ignore], [ignore])
64 LT_AT_EXEC_CHECK([./m1])
65 LT_AT_EXEC_CHECK([./m2])
71 AT_SETUP([indirect uninstalled])
72 AT_KEYWORDS([libtool])
75 int a () { return 0; }
79 int b () { return a (); }
83 int c () { return b (); }
88 int main () { return b (); }
92 int main () { return c (); }
96 LDFLAGS="$LDFLAGS -no-undefined"
97 for file in a.c b.c c.c; do
98 $LIBTOOL --mode=compile --tag=CC $CC $CPPFLAGS $CFLAGS -c $file
100 for file in m1.c m2.c; do
101 $CC $CPPFLAGS $CFLAGS -c $file
104 for st in '' -static; do
105 $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o a/liba.la a.lo -rpath /nowherea
106 $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o b/libb.la b.lo a/liba.la -rpath /nowhereb
107 $LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS -o c/libcee.la c.lo b/libb.la -rpath /nowherec
109 AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS $st -o m1$EXEEXT m1.$OBJEXT b/libb.la],
110 [], [ignore], [ignore])
111 AT_CHECK([$LIBTOOL --mode=link --tag=CC $CC $CFLAGS $LDFLAGS $st -o m2$EXEEXT m2.$OBJEXT c/libcee.la],
112 [], [ignore], [ignore])
113 LT_AT_EXEC_CHECK([./m1])
114 LT_AT_EXEC_CHECK([./m2])