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-2006 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*)
86 osf3* | osf4* | osf5*)
97 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
110 # Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
112 hardcode_libdir_flag_spec=
113 hardcode_libdir_separator=
118 cygwin* | mingw* | pw32*)
119 # FIXME: the MSVC++ port hasn't been tested in a loooong time
120 # When not using gcc, we currently assume that we are using
121 # Microsoft Visual C++.
122 if test "$GCC" != yes; then
132 if test "$with_gnu_ld" = yes; then
134 aix3* | aix4* | aix5*)
135 # On AIX/PPC, the GNU linker is very broken
136 if test "$host_cpu" != ia64; then
141 hardcode_libdir_flag_spec='-L$libdir'
143 # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
144 # that the semantics of dynamic libraries on AmigaOS, at least up
145 # to version 4, is to share data among multiple programs linked
146 # with the same dynamic library. Since this doesn't match the
147 # behavior of shared libraries on other platforms, we cannot use
152 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
158 cygwin* | mingw* | pw32*)
159 # hardcode_libdir_flag_spec is actually meaningless, as there is
160 # no search path for DLLs.
161 hardcode_libdir_flag_spec='-L$libdir'
162 if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
171 if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
173 elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
183 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
190 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
197 if test "$ld_shlibs" = yes; then
198 # Unlike libtool, we use -rpath here, not --rpath, since the documented
199 # option of GNU ld is called -rpath, not --rpath.
200 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
205 # Note: this linker hardcodes the directories in LIBPATH if there
206 # are no directories specified by -L.
208 if test "$GCC" = yes; then
209 # Neither direct hardcoding nor static linking is supported with a
211 hardcode_direct=unsupported
215 if test "$host_cpu" = ia64; then
216 # On IA64, the linker does run time linking by default, so we don't
217 # have to do anything special.
218 aix_use_runtimelinking=no
220 aix_use_runtimelinking=no
221 # Test if we are trying to use run time linking or normal
222 # AIX style linking. If -brtl is somewhere in LDFLAGS, we
223 # need to do runtime linking.
224 case $host_os in aix4.[23]|aix4.[23].*|aix5*)
225 for ld_flag in $LDFLAGS; do
226 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
227 aix_use_runtimelinking=yes
234 hardcode_libdir_separator=':'
235 if test "$GCC" = yes; then
236 case $host_os in aix4.[012]|aix4.[012].*)
237 collect2name=`${CC} -print-prog-name=collect2`
238 if test -f "$collect2name" && \
239 strings "$collect2name" | grep resolve_lib_name >/dev/null
241 # We have reworked collect2
244 # We have old collect2
245 hardcode_direct=unsupported
247 hardcode_libdir_flag_spec='-L$libdir'
248 hardcode_libdir_separator=
252 # Begin _LT_AC_SYS_LIBPATH_AIX.
253 echo 'int main () { return 0; }' > conftest.c
254 ${CC} ${LDFLAGS} conftest.c -o conftest
255 aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
257 if test -z "$aix_libpath"; then
258 aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
261 if test -z "$aix_libpath"; then
262 aix_libpath="/usr/lib:/lib"
264 rm -f conftest.c conftest
265 # End _LT_AC_SYS_LIBPATH_AIX.
266 if test "$aix_use_runtimelinking" = yes; then
267 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
269 if test "$host_cpu" = ia64; then
270 hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
272 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
277 hardcode_libdir_flag_spec='-L$libdir'
279 # see comment about different semantics on the GNU ld section
284 cygwin* | mingw* | pw32*)
285 # When not using gcc, we currently assume that we are using
286 # Microsoft Visual C++.
287 # hardcode_libdir_flag_spec is actually meaningless, as there is
288 # no search path for DLLs.
289 hardcode_libdir_flag_spec=' '
294 if test "$GCC" = yes ; then
297 case "$cc_basename" in
307 hardcode_libdir_flag_spec='-L$libdir'
313 hardcode_libdir_flag_spec='-R$libdir'
320 freebsd* | kfreebsd*-gnu | dragonfly*)
321 hardcode_libdir_flag_spec='-R$libdir'
325 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
326 hardcode_libdir_separator=:
328 # hardcode_minus_L: Not really in the search PATH,
329 # but as the default location of the library.
333 if test "$with_gnu_ld" = no; then
336 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
337 hardcode_libdir_separator=:
341 hardcode_libdir_flag_spec='-L$libdir'
343 # hardcode_minus_L: Not really in the search PATH,
344 # but as the default location of the library.
348 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
349 hardcode_libdir_separator=:
351 # hardcode_minus_L: Not really in the search PATH,
352 # but as the default location of the library.
358 irix5* | irix6* | nonstopux*)
359 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
360 hardcode_libdir_separator=:
363 hardcode_libdir_flag_spec='-R$libdir'
368 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
369 hardcode_libdir_separator=:
373 if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
374 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
377 openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
378 hardcode_libdir_flag_spec='-R$libdir'
381 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
387 hardcode_libdir_flag_spec='-L$libdir'
391 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
392 hardcode_libdir_separator=:
395 if test "$GCC" = yes; then
396 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
398 # Both cc and cxx compiler support -rpath directly
399 hardcode_libdir_flag_spec='-rpath $libdir'
401 hardcode_libdir_separator=:
406 hardcode_libdir_flag_spec='-R$libdir'
409 hardcode_libdir_flag_spec='-L$libdir'
416 hardcode_direct=yes # is this really true???
422 hardcode_direct=no #Motorola manual says yes, but my tests say they lie
429 if test -d /usr/nec; then
437 sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*)
440 hardcode_libdir_flag_spec=
443 hardcode_libdir_flag_spec='-L$libdir'
451 # Check dynamic linker characteristics
452 # Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
453 libname_spec='lib$name'
465 cygwin* | mingw* | pw32*)
481 hpux9* | hpux10* | hpux11*)
494 irix5* | irix6* | nonstopux*)
501 *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
502 *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
503 *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
504 *) libsuff= shlibsuff= ;;
509 linux*oldld* | linux*aout* | linux*coff*)
527 osf3* | osf4* | osf5*)
535 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
543 sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
544 escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
545 shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
546 escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
548 LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
550 # How to pass a linker flag through the compiler.
553 # Static library suffix (normally "a").
556 # Shared library suffix (normally "so").
559 # Flag to hardcode \$libdir into a binary during linking.
560 # This must work even if \$libdir does not exist.
561 hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
563 # Whether we need a single -rpath flag with a separated argument.
564 hardcode_libdir_separator="$hardcode_libdir_separator"
566 # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
568 hardcode_direct="$hardcode_direct"
570 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the
572 hardcode_minus_L="$hardcode_minus_L"