2 # depdemo-relink.test - check to see whether shlibpath overrides runpath
4 # Copyright (C) 2003, 2004 Free Software Foundation, Inc.
5 # Written by Gary V. Vaughan, 2003
7 # This file is part of GNU Libtool.
9 # GNU Libtool is free software; you can redistribute it and/or
10 # modify it under the terms of the GNU General Public License as
11 # published by the Free Software Foundation; either version 2 of
12 # the License, or (at your option) any later version.
14 # GNU Libtool is distributed in the hope that it will be useful,
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 # GNU General Public License for more details.
19 # You should have received a copy of the GNU General Public License
20 # along with GNU Libtool; see the file COPYING. If not, a copy
21 # can be downloaded from http://www.gnu.org/licenses/gpl.html,
22 # or obtained by writing to the Free Software Foundation, Inc.,
23 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
26 .
tests
/defs ||
exit 1
30 func_mkdir_p
"$objdir"
31 test "`echo _fnord/temp/libs/*`" = "_fnord/temp/libs/*" \
32 ||
mv -f _fnord
/temp
/libs
/* "l3/$objdir"
33 mv -f "_fnord/temp/libl3.la" "l3"
34 test -f "_fnord/temp/lt-depdemo$EXEXT" \
35 && mv -f "_fnord/temp/lt-depdemo$EXEXT" "$objdir"
36 test -f "_fnord/temp/depdemo$EXEXT" \
37 && mv -f "_fnord/temp/depdemo$EXEXT" "$objdir"
43 func_mkdir_p
"_fnord/temp/libs"
44 test -f "$objdir/lt-depdemo$EXEEXT" \
45 && cp -f "$objdir/lt-depdemo$EXEEXT" "_fnord/temp"
46 test -f "$objdir/depdemo$EXEEXT" \
47 && cp -f "$objdir/depdemo$EXEEXT" "_fnord/temp"
48 cp -f l
3/libl3.la
"_fnord/temp"
49 cp -f l
3/"$objdir"/* "_fnord/temp/libs"
50 trap "func_restore_files" 0 1 2 13 15
53 func_require
"depdemo-inst" "$prefix/lib/libl3.la" "tests/depdemo/l3/libl3.la"
56 func_cd
"tests/depdemo"
58 # Check to make sure we have a dynamic library.
59 func_get_config
"library_names" "cat l3/libl3.la"
60 test -z "$library_names" \
61 && func_skip
"Exiting: depdemo/l3/libl3.la is not a shared library"
65 func_get_config
'shlibpath_overrides_runpath
68 hardcode_into_libs' "./libtool --config" ": fatal"
70 .
/depdemo
$EXEEXT # so that it links on-demand if needed
72 func_msg
"removing libl3.la from depdemo/l3"
73 rm -rf l
3/libl3.la l
3/$objdir
75 func_msg
"running depdemo/depdemo"
76 if .
/depdemo
$EXEEXT ||
77 # On AIX 4.1, when the installed copy of libl3 is loaded, it brings
78 # with it the installed copies of libl1 and libl2, with disjoint
79 # counters var_l1 and var_l2. This is arguably acceptable behavior,
80 # but it's definitely not enough of a reason for the test to fail.
81 .
/depdemo
$EXEEXT -alt; then
83 elif test "x,$hardcode_action,$hardcode_direct" = x
,relink
,yes; then
84 func_msg
"Ok, uninstalled programs fail after uninstalled libraries are removed"
85 func_msg
"This works in other configurations, but not in this particular one"
86 elif test "$build" != "$host"; then
87 func_msg
"depdemo/depdemo does not run. Since you seem to be"
88 func_msg
"cross-compiling, this might be ok."
90 func_fail
"Exiting: depdemo/depdemo does not run, maybe libl3 was not installed"
93 func_msg
"linking a broken depdemo/l3/libl3.la"
94 (cd l3
&& $MAKE libl3.la libl3_la_OBJECTS
=..
/l
2/l2.lo
) \
95 || func_fail
"Exiting: cannot link broken libl3.la"
98 func_msg
"running depdemo/depdemo with broken libl3.la"
99 if (.
/depdemo
$EXEEXT) 2>&1; then
100 func_msg
"Exiting: depdemo/depdemo runs even though libl3.la is incomplete"
101 func_fail
"shlibpath_overrides_runpath should be set to no"
102 elif test "$build" != "$host"; then
103 func_msg
"Failed, as expected. But since you seem to be"
104 func_msg
"cross-compiling, this is not reliable."
107 func_msg
"Failed, as expected"
110 if test "x$hardcode_action" = xrelink
; then
111 func_msg
"Exiting: install-time relinking is required"
115 if test "$shlibpath_overrides_runpath" != yes; then
116 rm -f $objdir/lt-depdemo ||
exit $EXIT_FAILURE
117 cp $objdir/depdemo
$objdir/lt-depdemo ||
exit $EXIT_FAILURE
118 func_msg
"running depdemo/depdemo with installed libl3.la"
120 func_msg
"Worked, as expected"
122 func_msg
"shlibpath_overrides_runpath should be set to yes"