1 |
#! /bin/sh
|
2 |
# Output a system dependent set of variables, describing how to set the
|
3 |
# run time search path of shared libraries in an executable.
|
4 |
#
|
5 |
# Copyright 1996-2003 Free Software Foundation, Inc.
|
6 |
# Taken from GNU libtool, 2001
|
7 |
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
8 |
#
|
9 |
# This program is free software; you can redistribute it and/or modify
|
10 |
# it under the terms of the GNU General Public License as published by
|
11 |
# the Free Software Foundation; either version 2 of the License, or
|
12 |
# (at your option) any later version.
|
13 |
#
|
14 |
# This program is distributed in the hope that it will be useful, but
|
15 |
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
16 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
17 |
# General Public License for more details.
|
18 |
#
|
19 |
# You should have received a copy of the GNU General Public License
|
20 |
# along with this program; if not, write to the Free Software
|
21 |
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
22 |
#
|
23 |
# As a special exception to the GNU General Public License, if you
|
24 |
# distribute this file as part of a program that contains a
|
25 |
# configuration script generated by Autoconf, you may include it under
|
26 |
# the same distribution terms that you use for the rest of that program.
|
27 |
#
|
28 |
# The first argument passed to this file is the canonical host specification,
|
29 |
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
30 |
# or
|
31 |
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
32 |
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
|
33 |
# should be set by the caller.
|
34 |
#
|
35 |
# The set of defined variables is at the end of this script.
|
36 |
|
37 |
# Known limitations:
|
38 |
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
|
39 |
# than 256 bytes, otherwise the compiler driver will dump core. The only
|
40 |
# known workaround is to choose shorter directory names for the build
|
41 |
# directory and/or the installation directory.
|
42 |
|
43 |
# All known linkers require a `.a' archive for static linking (except M$VC,
|
44 |
# which needs '.lib').
|
45 |
libext=a
|
46 |
shrext=.so
|
47 |
|
48 |
host="$1"
|
49 |
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
|
50 |
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
|
51 |
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
52 |
|
53 |
# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
|
54 |
|
55 |
wl=
|
56 |
if test "$GCC" = yes; then
|
57 |
wl='-Wl,'
|
58 |
else
|
59 |
case "$host_os" in
|
60 |
aix*)
|
61 |
wl='-Wl,'
|
62 |
;;
|
63 |
mingw* | pw32* | os2*)
|
64 |
;;
|
65 |
hpux9* | hpux10* | hpux11*)
|
66 |
wl='-Wl,'
|
67 |
;;
|
68 |
irix5* | irix6* | nonstopux*)
|
69 |
wl='-Wl,'
|
70 |
;;
|
71 |
newsos6)
|
72 |
;;
|
73 |
linux*)
|
74 |
case $CC in
|
75 |
icc|ecc)
|
76 |
wl='-Wl,'
|
77 |
;;
|
78 |
ccc)
|
79 |
wl='-Wl,'
|
80 |
;;
|
81 |
esac
|
82 |
;;
|
83 |
osf3* | osf4* | osf5*)
|
84 |
wl='-Wl,'
|
85 |
;;
|
86 |
sco3.2v5*)
|
87 |
;;
|
88 |
solaris*)
|
89 |
wl='-Wl,'
|
90 |
;;
|
91 |
sunos4*)
|
92 |
wl='-Qoption ld '
|
93 |
;;
|
94 |
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
|
95 |
wl='-Wl,'
|
96 |
;;
|
97 |
sysv4*MP*)
|
98 |
;;
|
99 |
uts4*)
|
100 |
;;
|
101 |
esac
|
102 |
fi
|
103 |
|
104 |
# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
|
105 |
|
106 |
hardcode_libdir_flag_spec=
|
107 |
hardcode_libdir_separator=
|
108 |
hardcode_direct=no
|
109 |
hardcode_minus_L=no
|
110 |
|
111 |
case "$host_os" in
|
112 |
cygwin* | mingw* | pw32*)
|
113 |
# FIXME: the MSVC++ port hasn't been tested in a loooong time
|
114 |
# When not using gcc, we currently assume that we are using
|
115 |
# Microsoft Visual C++.
|
116 |
if test "$GCC" != yes; then
|
117 |
with_gnu_ld=no
|
118 |
fi
|
119 |
;;
|
120 |
openbsd*)
|
121 |
with_gnu_ld=no
|
122 |
;;
|
123 |
esac
|
124 |
|
125 |
ld_shlibs=yes
|
126 |
if test "$with_gnu_ld" = yes; then
|
127 |
case "$host_os" in
|
128 |
aix3* | aix4* | aix5*)
|
129 |
# On AIX/PPC, the GNU linker is very broken
|
130 |
if test "$host_cpu" != ia64; then
|
131 |
ld_shlibs=no
|
132 |
fi
|
133 |
;;
|
134 |
amigaos*)
|
135 |
hardcode_libdir_flag_spec='-L$libdir'
|
136 |
hardcode_minus_L=yes
|
137 |
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
|
138 |
# that the semantics of dynamic libraries on AmigaOS, at least up
|
139 |
# to version 4, is to share data among multiple programs linked
|
140 |
# with the same dynamic library. Since this doesn't match the
|
141 |
# behavior of shared libraries on other platforms, we can use
|
142 |
# them.
|
143 |
ld_shlibs=no
|
144 |
;;
|
145 |
beos*)
|
146 |
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
147 |
:
|
148 |
else
|
149 |
ld_shlibs=no
|
150 |
fi
|
151 |
;;
|
152 |
cygwin* | mingw* | pw32*)
|
153 |
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
154 |
# no search path for DLLs.
|
155 |
hardcode_libdir_flag_spec='-L$libdir'
|
156 |
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
|
157 |
:
|
158 |
else
|
159 |
ld_shlibs=no
|
160 |
fi
|
161 |
;;
|
162 |
netbsd*)
|
163 |
;;
|
164 |
solaris* | sysv5*)
|
165 |
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
|
166 |
ld_shlibs=no
|
167 |
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
168 |
:
|
169 |
else
|
170 |
ld_shlibs=no
|
171 |
fi
|
172 |
;;
|
173 |
sunos4*)
|
174 |
hardcode_direct=yes
|
175 |
;;
|
176 |
*)
|
177 |
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
178 |
:
|
179 |
else
|
180 |
ld_shlibs=no
|
181 |
fi
|
182 |
;;
|
183 |
esac
|
184 |
if test "$ld_shlibs" = yes; then
|
185 |
# Unlike libtool, we use -rpath here, not --rpath, since the documented
|
186 |
# option of GNU ld is called -rpath, not --rpath.
|
187 |
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
188 |
fi
|
189 |
else
|
190 |
case "$host_os" in
|
191 |
aix3*)
|
192 |
# Note: this linker hardcodes the directories in LIBPATH if there
|
193 |
# are no directories specified by -L.
|
194 |
hardcode_minus_L=yes
|
195 |
if test "$GCC" = yes; then
|
196 |
# Neither direct hardcoding nor static linking is supported with a
|
197 |
# broken collect2.
|
198 |
hardcode_direct=unsupported
|
199 |
fi
|
200 |
;;
|
201 |
aix4* | aix5*)
|
202 |
if test "$host_cpu" = ia64; then
|
203 |
# On IA64, the linker does run time linking by default, so we don't
|
204 |
# have to do anything special.
|
205 |
aix_use_runtimelinking=no
|
206 |
else
|
207 |
aix_use_runtimelinking=no
|
208 |
# Test if we are trying to use run time linking or normal
|
209 |
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
|
210 |
# need to do runtime linking.
|
211 |
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
|
212 |
for ld_flag in $LDFLAGS; do
|
213 |
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
|
214 |
aix_use_runtimelinking=yes
|
215 |
break
|
216 |
fi
|
217 |
done
|
218 |
esac
|
219 |
fi
|
220 |
hardcode_direct=yes
|
221 |
hardcode_libdir_separator=':'
|
222 |
if test "$GCC" = yes; then
|
223 |
case $host_os in aix4.[012]|aix4.[012].*)
|
224 |
collect2name=`${CC} -print-prog-name=collect2`
|
225 |
if test -f "$collect2name" && \
|
226 |
strings "$collect2name" | grep resolve_lib_name >/dev/null
|
227 |
then
|
228 |
# We have reworked collect2
|
229 |
hardcode_direct=yes
|
230 |
else
|
231 |
# We have old collect2
|
232 |
hardcode_direct=unsupported
|
233 |
hardcode_minus_L=yes
|
234 |
hardcode_libdir_flag_spec='-L$libdir'
|
235 |
hardcode_libdir_separator=
|
236 |
fi
|
237 |
esac
|
238 |
fi
|
239 |
# Begin _LT_AC_SYS_LIBPATH_AIX.
|
240 |
echo 'int main () { return 0; }' > conftest.c
|
241 |
${CC} ${LDFLAGS} conftest.c -o conftest
|
242 |
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
|
243 |
}'`
|
244 |
if test -z "$aix_libpath"; then
|
245 |
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
|
246 |
}'`
|
247 |
fi
|
248 |
if test -z "$aix_libpath"; then
|
249 |
aix_libpath="/usr/lib:/lib"
|
250 |
fi
|
251 |
rm -f conftest.c conftest
|
252 |
# End _LT_AC_SYS_LIBPATH_AIX.
|
253 |
if test "$aix_use_runtimelinking" = yes; then
|
254 |
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
|
255 |
else
|
256 |
if test "$host_cpu" = ia64; then
|
257 |
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
|
258 |
else
|
259 |
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
|
260 |
fi
|
261 |
fi
|
262 |
;;
|
263 |
amigaos*)
|
264 |
hardcode_libdir_flag_spec='-L$libdir'
|
265 |
hardcode_minus_L=yes
|
266 |
# see comment about different semantics on the GNU ld section
|
267 |
ld_shlibs=no
|
268 |
;;
|
269 |
bsdi4*)
|
270 |
;;
|
271 |
cygwin* | mingw* | pw32*)
|
272 |
# When not using gcc, we currently assume that we are using
|
273 |
# Microsoft Visual C++.
|
274 |
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
275 |
# no search path for DLLs.
|
276 |
hardcode_libdir_flag_spec=' '
|
277 |
libext=lib
|
278 |
;;
|
279 |
darwin* | rhapsody*)
|
280 |
if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then
|
281 |
hardcode_direct=no
|
282 |
fi
|
283 |
;;
|
284 |
dgux*)
|
285 |
hardcode_libdir_flag_spec='-L$libdir'
|
286 |
;;
|
287 |
freebsd1*)
|
288 |
ld_shlibs=no
|
289 |
;;
|
290 |
freebsd2.2*)
|
291 |
hardcode_libdir_flag_spec='-R$libdir'
|
292 |
hardcode_direct=yes
|
293 |
;;
|
294 |
freebsd2*)
|
295 |
hardcode_direct=yes
|
296 |
hardcode_minus_L=yes
|
297 |
;;
|
298 |
freebsd*)
|
299 |
hardcode_libdir_flag_spec='-R$libdir'
|
300 |
hardcode_direct=yes
|
301 |
;;
|
302 |
hpux9*)
|
303 |
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
304 |
hardcode_libdir_separator=:
|
305 |
hardcode_direct=yes
|
306 |
# hardcode_minus_L: Not really in the search PATH,
|
307 |
# but as the default location of the library.
|
308 |
hardcode_minus_L=yes
|
309 |
;;
|
310 |
hpux10* | hpux11*)
|
311 |
if test "$with_gnu_ld" = no; then
|
312 |
case "$host_cpu" in
|
313 |
hppa*64*)
|
314 |
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
315 |
hardcode_libdir_separator=:
|
316 |
hardcode_direct=no
|
317 |
;;
|
318 |
ia64*)
|
319 |
hardcode_libdir_flag_spec='-L$libdir'
|
320 |
hardcode_direct=no
|
321 |
# hardcode_minus_L: Not really in the search PATH,
|
322 |
# but as the default location of the library.
|
323 |
hardcode_minus_L=yes
|
324 |
;;
|
325 |
*)
|
326 |
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
|
327 |
hardcode_libdir_separator=:
|
328 |
hardcode_direct=yes
|
329 |
# hardcode_minus_L: Not really in the search PATH,
|
330 |
# but as the default location of the library.
|
331 |
hardcode_minus_L=yes
|
332 |
;;
|
333 |
esac
|
334 |
fi
|
335 |
;;
|
336 |
irix5* | irix6* | nonstopux*)
|
337 |
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
338 |
hardcode_libdir_separator=:
|
339 |
;;
|
340 |
netbsd*)
|
341 |
hardcode_libdir_flag_spec='-R$libdir'
|
342 |
hardcode_direct=yes
|
343 |
;;
|
344 |
newsos6)
|
345 |
hardcode_direct=yes
|
346 |
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
347 |
hardcode_libdir_separator=:
|
348 |
;;
|
349 |
openbsd*)
|
350 |
hardcode_direct=yes
|
351 |
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
|
352 |
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
353 |
else
|
354 |
case "$host_os" in
|
355 |
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
|
356 |
hardcode_libdir_flag_spec='-R$libdir'
|
357 |
;;
|
358 |
*)
|
359 |
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
360 |
;;
|
361 |
esac
|
362 |
fi
|
363 |
;;
|
364 |
os2*)
|
365 |
hardcode_libdir_flag_spec='-L$libdir'
|
366 |
hardcode_minus_L=yes
|
367 |
;;
|
368 |
osf3*)
|
369 |
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
370 |
hardcode_libdir_separator=:
|
371 |
;;
|
372 |
osf4* | osf5*)
|
373 |
if test "$GCC" = yes; then
|
374 |
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
375 |
else
|
376 |
# Both cc and cxx compiler support -rpath directly
|
377 |
hardcode_libdir_flag_spec='-rpath $libdir'
|
378 |
fi
|
379 |
hardcode_libdir_separator=:
|
380 |
;;
|
381 |
sco3.2v5*)
|
382 |
;;
|
383 |
solaris*)
|
384 |
hardcode_libdir_flag_spec='-R$libdir'
|
385 |
;;
|
386 |
sunos4*)
|
387 |
hardcode_libdir_flag_spec='-L$libdir'
|
388 |
hardcode_direct=yes
|
389 |
hardcode_minus_L=yes
|
390 |
;;
|
391 |
sysv4)
|
392 |
case $host_vendor in
|
393 |
sni)
|
394 |
hardcode_direct=yes # is this really true???
|
395 |
;;
|
396 |
siemens)
|
397 |
hardcode_direct=no
|
398 |
;;
|
399 |
motorola)
|
400 |
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
|
401 |
;;
|
402 |
esac
|
403 |
;;
|
404 |
sysv4.3*)
|
405 |
;;
|
406 |
sysv4*MP*)
|
407 |
if test -d /usr/nec; then
|
408 |
ld_shlibs=yes
|
409 |
fi
|
410 |
;;
|
411 |
sysv4.2uw2*)
|
412 |
hardcode_direct=yes
|
413 |
hardcode_minus_L=no
|
414 |
;;
|
415 |
sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*)
|
416 |
;;
|
417 |
sysv5*)
|
418 |
hardcode_libdir_flag_spec=
|
419 |
;;
|
420 |
uts4*)
|
421 |
hardcode_libdir_flag_spec='-L$libdir'
|
422 |
;;
|
423 |
*)
|
424 |
ld_shlibs=no
|
425 |
;;
|
426 |
esac
|
427 |
fi
|
428 |
|
429 |
# Check dynamic linker characteristics
|
430 |
# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
|
431 |
libname_spec='lib$name'
|
432 |
case "$host_os" in
|
433 |
aix3*)
|
434 |
;;
|
435 |
aix4* | aix5*)
|
436 |
;;
|
437 |
amigaos*)
|
438 |
;;
|
439 |
beos*)
|
440 |
;;
|
441 |
bsdi4*)
|
442 |
;;
|
443 |
cygwin* | mingw* | pw32*)
|
444 |
shrext=.dll
|
445 |
;;
|
446 |
darwin* | rhapsody*)
|
447 |
shrext=.dylib
|
448 |
;;
|
449 |
dgux*)
|
450 |
;;
|
451 |
freebsd1*)
|
452 |
;;
|
453 |
freebsd*)
|
454 |
;;
|
455 |
gnu*)
|
456 |
;;
|
457 |
hpux9* | hpux10* | hpux11*)
|
458 |
case "$host_cpu" in
|
459 |
ia64*)
|
460 |
shrext=.so
|
461 |
;;
|
462 |
hppa*64*)
|
463 |
shrext=.sl
|
464 |
;;
|
465 |
*)
|
466 |
shrext=.sl
|
467 |
;;
|
468 |
esac
|
469 |
;;
|
470 |
irix5* | irix6* | nonstopux*)
|
471 |
case "$host_os" in
|
472 |
irix5* | nonstopux*)
|
473 |
libsuff= shlibsuff=
|
474 |
;;
|
475 |
*)
|
476 |
case $LD in
|
477 |
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
|
478 |
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
|
479 |
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
|
480 |
*) libsuff= shlibsuff= ;;
|
481 |
esac
|
482 |
;;
|
483 |
esac
|
484 |
;;
|
485 |
linux*oldld* | linux*aout* | linux*coff*)
|
486 |
;;
|
487 |
linux*)
|
488 |
;;
|
489 |
netbsd*)
|
490 |
;;
|
491 |
newsos6)
|
492 |
;;
|
493 |
nto-qnx)
|
494 |
;;
|
495 |
openbsd*)
|
496 |
;;
|
497 |
os2*)
|
498 |
libname_spec='$name'
|
499 |
shrext=.dll
|
500 |
;;
|
501 |
osf3* | osf4* | osf5*)
|
502 |
;;
|
503 |
sco3.2v5*)
|
504 |
;;
|
505 |
solaris*)
|
506 |
;;
|
507 |
sunos4*)
|
508 |
;;
|
509 |
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
|
510 |
;;
|
511 |
sysv4*MP*)
|
512 |
;;
|
513 |
uts4*)
|
514 |
;;
|
515 |
esac
|
516 |
|
517 |
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
|
518 |
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
519 |
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
|
520 |
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
521 |
|
522 |
sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
|
523 |
|
524 |
# How to pass a linker flag through the compiler.
|
525 |
wl="$escaped_wl"
|
526 |
|
527 |
# Static library suffix (normally "a").
|
528 |
libext="$libext"
|
529 |
|
530 |
# Shared library suffix (normally "so").
|
531 |
shlibext="$shlibext"
|
532 |
|
533 |
# Flag to hardcode \$libdir into a binary during linking.
|
534 |
# This must work even if \$libdir does not exist.
|
535 |
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
|
536 |
|
537 |
# Whether we need a single -rpath flag with a separated argument.
|
538 |
hardcode_libdir_separator="$hardcode_libdir_separator"
|
539 |
|
540 |
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
|
541 |
# resulting binary.
|
542 |
hardcode_direct="$hardcode_direct"
|
543 |
|
544 |
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
|
545 |
# resulting binary.
|
546 |
hardcode_minus_L="$hardcode_minus_L"
|
547 |
|
548 |
EOF
|