2
# Output a system dependent set of variables, describing how to set the
3
# run time search path of shared libraries in an executable.
5
# Copyright 1996-2005 Free Software Foundation, Inc.
6
# Taken from GNU libtool, 2001
7
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
9
# This file is free software; the Free Software Foundation gives
10
# unlimited permission to copy and/or distribute it, with or without
11
# modifications, as long as this notice is preserved.
13
# The first argument passed to this file is the canonical host specification,
14
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
16
# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
17
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
18
# should be set by the caller.
20
# The set of defined variables is at the end of this script.
23
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
24
# than 256 bytes, otherwise the compiler driver will dump core. The only
25
# known workaround is to choose shorter directory names for the build
26
# directory and/or the installation directory.
28
# All known linkers require a `.a' archive for static linking (except M$VC,
29
# which needs '.lib').
34
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
35
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
36
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
38
cc_basename=`echo "$CC" | sed -e 's%^.*/%%'`
40
# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
43
if test "$GCC" = yes; then
51
case "$cc_basename" in
57
mingw* | pw32* | os2*)
59
hpux9* | hpux10* | hpux11*)
62
irix5* | irix6* | nonstopux*)
83
osf3* | osf4* | osf5*)
94
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
107
# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
109
hardcode_libdir_flag_spec=
110
hardcode_libdir_separator=
115
cygwin* | mingw* | pw32*)
116
# FIXME: the MSVC++ port hasn't been tested in a loooong time
117
# When not using gcc, we currently assume that we are using
118
# Microsoft Visual C++.
119
if test "$GCC" != yes; then
129
if test "$with_gnu_ld" = yes; then
131
aix3* | aix4* | aix5*)
132
# On AIX/PPC, the GNU linker is very broken
133
if test "$host_cpu" != ia64; then
138
hardcode_libdir_flag_spec='-L$libdir'
140
# Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
141
# that the semantics of dynamic libraries on AmigaOS, at least up
142
# to version 4, is to share data among multiple programs linked
143
# with the same dynamic library. Since this doesn't match the
144
# behavior of shared libraries on other platforms, we cannot use
149
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
155
cygwin* | mingw* | pw32*)
156
# hardcode_libdir_flag_spec is actually meaningless, as there is
157
# no search path for DLLs.
158
hardcode_libdir_flag_spec='-L$libdir'
159
if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
168
if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
170
elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
180
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
187
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
194
if test "$ld_shlibs" = yes; then
195
# Unlike libtool, we use -rpath here, not --rpath, since the documented
196
# option of GNU ld is called -rpath, not --rpath.
197
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
202
# Note: this linker hardcodes the directories in LIBPATH if there
203
# are no directories specified by -L.
205
if test "$GCC" = yes; then
206
# Neither direct hardcoding nor static linking is supported with a
208
hardcode_direct=unsupported
212
if test "$host_cpu" = ia64; then
213
# On IA64, the linker does run time linking by default, so we don't
214
# have to do anything special.
215
aix_use_runtimelinking=no
217
aix_use_runtimelinking=no
218
# Test if we are trying to use run time linking or normal
219
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
220
# need to do runtime linking.
221
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
222
for ld_flag in $LDFLAGS; do
223
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
224
aix_use_runtimelinking=yes
231
hardcode_libdir_separator=':'
232
if test "$GCC" = yes; then
233
case $host_os in aix4.[012]|aix4.[012].*)
234
collect2name=`${CC} -print-prog-name=collect2`
235
if test -f "$collect2name" && \
236
strings "$collect2name" | grep resolve_lib_name >/dev/null
238
# We have reworked collect2
241
# We have old collect2
242
hardcode_direct=unsupported
244
hardcode_libdir_flag_spec='-L$libdir'
245
hardcode_libdir_separator=
249
# Begin _LT_AC_SYS_LIBPATH_AIX.
250
echo 'int main () { return 0; }' > conftest.c
251
${CC} ${LDFLAGS} conftest.c -o conftest
252
aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
254
if test -z "$aix_libpath"; then
255
aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
258
if test -z "$aix_libpath"; then
259
aix_libpath="/usr/lib:/lib"
261
rm -f conftest.c conftest
262
# End _LT_AC_SYS_LIBPATH_AIX.
263
if test "$aix_use_runtimelinking" = yes; then
264
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
266
if test "$host_cpu" = ia64; then
267
hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
269
hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
274
hardcode_libdir_flag_spec='-L$libdir'
276
# see comment about different semantics on the GNU ld section
281
cygwin* | mingw* | pw32*)
282
# When not using gcc, we currently assume that we are using
283
# Microsoft Visual C++.
284
# hardcode_libdir_flag_spec is actually meaningless, as there is
285
# no search path for DLLs.
286
hardcode_libdir_flag_spec=' '
291
if test "$GCC" = yes ; then
294
case "$cc_basename" in
304
hardcode_libdir_flag_spec='-L$libdir'
310
hardcode_libdir_flag_spec='-R$libdir'
317
freebsd* | kfreebsd*-gnu | dragonfly*)
318
hardcode_libdir_flag_spec='-R$libdir'
322
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
323
hardcode_libdir_separator=:
325
# hardcode_minus_L: Not really in the search PATH,
326
# but as the default location of the library.
330
if test "$with_gnu_ld" = no; then
333
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
334
hardcode_libdir_separator=:
338
hardcode_libdir_flag_spec='-L$libdir'
340
# hardcode_minus_L: Not really in the search PATH,
341
# but as the default location of the library.
345
hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
346
hardcode_libdir_separator=:
348
# hardcode_minus_L: Not really in the search PATH,
349
# but as the default location of the library.
355
irix5* | irix6* | nonstopux*)
356
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
357
hardcode_libdir_separator=:
360
hardcode_libdir_flag_spec='-R$libdir'
365
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
366
hardcode_libdir_separator=:
370
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
371
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
374
openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
375
hardcode_libdir_flag_spec='-R$libdir'
378
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
384
hardcode_libdir_flag_spec='-L$libdir'
388
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
389
hardcode_libdir_separator=:
392
if test "$GCC" = yes; then
393
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
395
# Both cc and cxx compiler support -rpath directly
396
hardcode_libdir_flag_spec='-rpath $libdir'
398
hardcode_libdir_separator=:
403
hardcode_libdir_flag_spec='-R$libdir'
406
hardcode_libdir_flag_spec='-L$libdir'
413
hardcode_direct=yes # is this really true???
419
hardcode_direct=no #Motorola manual says yes, but my tests say they lie
426
if test -d /usr/nec; then
434
sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*)
437
hardcode_libdir_flag_spec=
440
hardcode_libdir_flag_spec='-L$libdir'
448
# Check dynamic linker characteristics
449
# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
450
libname_spec='lib$name'
462
cygwin* | mingw* | pw32*)
478
hpux9* | hpux10* | hpux11*)
491
irix5* | irix6* | nonstopux*)
498
*-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
499
*-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
500
*-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
501
*) libsuff= shlibsuff= ;;
506
linux*oldld* | linux*aout* | linux*coff*)
524
osf3* | osf4* | osf5*)
532
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
540
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
541
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
542
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
543
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
545
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
547
# How to pass a linker flag through the compiler.
550
# Static library suffix (normally "a").
553
# Shared library suffix (normally "so").
556
# Flag to hardcode \$libdir into a binary during linking.
557
# This must work even if \$libdir does not exist.
558
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
560
# Whether we need a single -rpath flag with a separated argument.
561
hardcode_libdir_separator="$hardcode_libdir_separator"
563
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
565
hardcode_direct="$hardcode_direct"
567
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
569
hardcode_minus_L="$hardcode_minus_L"