ltmain.in: Use func_warning for all warnings
[libtool.git] / tests / deplib-in-subdir.at
blobcc8ef4650d20f85d5bc440761045b27703ffb0a8
1 # deplib-in-subdir.at --                         -*- Autotest -*-
3 #   Copyright (C) 2010-2019, 2021-2024 Free Software Foundation, Inc.
5 #   This file is part of GNU Libtool.
7 # GNU Libtool is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU General Public License as
9 # published by the Free Software Foundation; either version 2 of
10 # the License, or (at your option) any later version.
12 # GNU Libtool is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
17 # You should have received a copy of the GNU General Public License
18 # along with GNU Libtool; see the file COPYING.  If not, a copy
19 # can be downloaded from  http://www.gnu.org/licenses/gpl.html,
20 # or obtained by writing to the Free Software Foundation, Inc.,
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 ####
24 # It should be possible to use a nontrivial relative path to the output
25 # file name when creating libraries and programs.  The deplibs of these
26 # might have relative paths as well.  When executing uninstalled programs,
27 # the paths relative to $PWD at build time needs to be translated to a
28 # path valid at execution time.
30 # Also test installing these libraries and programs; however,
31 # use consistent relative paths between 'libtool --mode=link' and
32 # 'libtool --mode=install' in this test.
34 AT_SETUP([deplib in subdir])
35 AT_KEYWORDS([libtool])
37 AT_DATA([a1.c],
38 [[int a1 () { return 0; }
39 ]])
40 AT_DATA([a2.c],
41 [[int a2 () { return 0; }
42 ]])
43 AT_DATA([a3.c],
44 [[int a3 () { return 0; }
45 ]])
46 AT_DATA([b1.c],
47 [[extern int a1 ();
48 int b1 () { return a1 (); }
49 ]])
50 AT_DATA([b2.c],
51 [[extern int a2 ();
52 int b2 () { return a2 (); }
53 ]])
54 AT_DATA([b3.c],
55 [[extern int a3 ();
56 int b3 () { return a3 (); }
57 ]])
58 AT_DATA([m.c],
59 [[extern int b1 ();
60 extern int b2 ();
61 extern int b3 ();
62 int main () { return b1 () + b2 () + b3 (); }
63 ]])
65 cwd=`pwd`
66 instdir=$cwd/inst
67 lib1dir=$instdir/lib1
68 lib2dir=$instdir/lib2
69 bindir=$instdir/bin
70 addrunpath=$cwd/foobar
71 LDFLAGS="$LDFLAGS -no-undefined"
73 flags='-export-symbols-regex ".*"'
75 mkdir -p sub1 sub2/subsub sub3/subsub $instdir $lib1dir $lib2dir $bindir
77 for file in a1.c a2.c a3.c b1.c b2.c b3.c; do
78   $LIBTOOL --mode=compile $CC $CPPFLAGS $CFLAGS -c $file
79 done
80 $CC $CPPFLAGS $CFLAGS -c m.c
81 AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o sub1/liba1.la a1.lo -rpath $lib1dir],
82          [], [ignore], [ignore])
83 AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o sub1/liba2.la a2.lo -rpath $lib1dir],
84          [], [ignore], [ignore])
85 AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o sub1/liba3.la a3.lo -rpath $lib1dir],
86          [], [ignore], [ignore])
88 AT_CHECK([eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o sub2/subsub/libb1.la b1.lo ]dnl
89          [-rpath $lib2dir sub1/liba1.la' "$flags"],
90          [], [ignore], [ignore])
91 cd sub2
92 AT_CHECK([eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o subsub/libb2.la ../b2.lo ]dnl
93          [-rpath $lib2dir ../sub1/liba2.la' "$flags"],
94          [], [ignore], [ignore])
95 cd subsub
96 AT_CHECK([eval '$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o libb3.la ../../b3.lo ]dnl
97          [-rpath $lib2dir ../../sub1/liba3.la' "$flags"],
98          [], [ignore], [ignore])
99 cd ../..
100 AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o sub3/subsub/m1$EXEEXT m.$OBJEXT ]dnl
101          [sub2/subsub/libb1.la sub2/subsub/libb2.la sub2/subsub/libb3.la],
102          [], [ignore], [ignore])
103 cd sub3
104 AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o subsub/m2$EXEEXT ../m.$OBJEXT ]dnl
105          [../sub2/subsub/libb1.la ../sub2/subsub/libb2.la ../sub2/subsub/libb3.la],
106          [], [ignore], [ignore])
107 cd subsub
108 AT_CHECK([$LIBTOOL --mode=link $CC $CFLAGS $LDFLAGS -o m3$EXEEXT ../../m.$OBJEXT ]dnl
109          [../../sub2/subsub/libb1.la ../../sub2/subsub/libb2.la ../../sub2/subsub/libb3.la],
110          [], [ignore], [ignore])
111 cd ../..
113 for i in 1 2 3; do
114   LT_AT_EXEC_CHECK([./sub3/subsub/m$i])
115   cd sub3
116   LT_AT_EXEC_CHECK([./subsub/m$i])
117   cd subsub
118   LT_AT_EXEC_CHECK([./m$i])
119   cd ../..
120 done
122 for i in 1 2 3; do
123   AT_CHECK([$LIBTOOL --mode=install cp sub1/liba$i.la $lib1dir/liba.la], [], [ignore], [ignore])
124 done
126 AT_CHECK([$LIBTOOL --mode=install cp sub2/subsub/libb1.la $lib2dir/libb1.la], [], [ignore], [ignore])
127 cd sub2
128 AT_CHECK([$LIBTOOL --mode=install cp subsub/libb2.la $lib2dir/libb2.la], [], [ignore], [ignore])
129 cd subsub
130 AT_CHECK([$LIBTOOL --mode=install cp libb3.la $lib2dir/libb3.la], [], [ignore], [ignore])
131 cd ../..
133 AT_CHECK([$LIBTOOL --mode=install cp sub3/subsub/m1$EXEEXT $bindir/m1$EXEEXT], [], [ignore], [ignore])
134 cd sub3
135 AT_CHECK([$LIBTOOL --mode=install cp subsub/m2$EXEEXT $bindir/m2$EXEEXT], [], [ignore], [ignore])
136 cd subsub
137 AT_CHECK([$LIBTOOL --mode=install cp m3$EXEEXT $bindir/m3$EXEEXT], [], [ignore], [ignore])
138 cd ../..
140 AT_CHECK([$LIBTOOL --mode=clean rm -f sub1/liba1.la sub1/liba2.la sub1/liba3.la ]dnl
141          [sub2/subsub/libb1.la sub2/subsub/libb2.la sub2/subsub/libb3.la ]dnl
142          [sub3/subsub/m1$EXEEXT sub3/subsub/m2$EXEEXT sub3/subsub/m3$EXEEXT],
143          [], [ignore], [ignore])
145 for i in 1 2 3; do
146   LT_AT_EXEC_CHECK([$bindir/m$i$EXEEXT])
147   cd $bindir
148   LT_AT_EXEC_CHECK([./m$i$EXEEXT])
149   cd $cwd
150 done
152 PATH=$bindir${PATH_SEPARATOR-:}$PATH
153 for i in 1 2 3; do
154   LT_AT_EXEC_CHECK([m$i$EXEEXT])
155 done
157 AT_CLEANUP