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 MSVC,
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 # Code taken from libtool.m4's _LT_CC_BASENAME.
40 for cc_temp in $CC""; do
42 compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
43 distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
48 cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
50 # Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
53 if test "$GCC" = yes; then
67 mingw* | pw32* | os2*)
69 hpux9* | hpux10* | hpux11*)
72 irix5* | irix6* | nonstopux*)
93 osf3* | osf4* | osf5*)
104 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
117 # Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
119 hardcode_libdir_flag_spec=
120 hardcode_libdir_separator=
125 cygwin* | mingw* | pw32*)
126 # FIXME: the MSVC++ port hasn't been tested in a loooong time
127 # When not using gcc, we currently assume that we are using
128 # Microsoft Visual C++.
129 if test "$GCC" != yes; then
134 # we just hope/assume this is gcc and not c89 (= MSVC++)
143 if test "$with_gnu_ld" = yes; then
144 # Set some defaults for GNU ld with shared library support. These
145 # are reset later if shared libraries are not supported. Putting them
146 # here allows them to be overridden if necessary.
147 # Unlike libtool, we use -rpath here, not --rpath, since the documented
148 # option of GNU ld is called -rpath, not --rpath.
149 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
151 aix3* | aix4* | aix5*)
152 # On AIX/PPC, the GNU linker is very broken
153 if test "$host_cpu" != ia64; then
158 hardcode_libdir_flag_spec='-L$libdir'
160 # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
161 # that the semantics of dynamic libraries on AmigaOS, at least up
162 # to version 4, is to share data among multiple programs linked
163 # with the same dynamic library. Since this doesn't match the
164 # behavior of shared libraries on other platforms, we cannot use
169 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
175 cygwin* | mingw* | pw32*)
176 # hardcode_libdir_flag_spec is actually meaningless, as there is
177 # no search path for DLLs.
178 hardcode_libdir_flag_spec='-L$libdir'
179 if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
187 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
190 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
199 if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
201 elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
207 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
208 case `$LD -v 2>&1` in
209 *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
213 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
214 hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
225 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
232 if test "$ld_shlibs" = no; then
233 hardcode_libdir_flag_spec=
238 # Note: this linker hardcodes the directories in LIBPATH if there
239 # are no directories specified by -L.
241 if test "$GCC" = yes; then
242 # Neither direct hardcoding nor static linking is supported with a
244 hardcode_direct=unsupported
248 if test "$host_cpu" = ia64; then
249 # On IA64, the linker does run time linking by default, so we don't
250 # have to do anything special.
251 aix_use_runtimelinking=no
253 aix_use_runtimelinking=no
254 # Test if we are trying to use run time linking or normal
255 # AIX style linking. If -brtl is somewhere in LDFLAGS, we
256 # need to do runtime linking.
257 case $host_os in aix4.[23]|aix4.[23].*|aix5*)
258 for ld_flag in $LDFLAGS; do
259 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
260 aix_use_runtimelinking=yes
268 hardcode_libdir_separator=':'
269 if test "$GCC" = yes; then
270 case $host_os in aix4.[012]|aix4.[012].*)
271 collect2name=`${CC} -print-prog-name=collect2`
272 if test -f "$collect2name" && \
273 strings "$collect2name" | grep resolve_lib_name >/dev/null
275 # We have reworked collect2
278 # We have old collect2
279 hardcode_direct=unsupported
281 hardcode_libdir_flag_spec='-L$libdir'
282 hardcode_libdir_separator=
287 # Begin _LT_AC_SYS_LIBPATH_AIX.
288 echo 'int main () { return 0; }' > conftest.c
289 ${CC} ${LDFLAGS} conftest.c -o conftest
290 aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
292 if test -z "$aix_libpath"; then
293 aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; }
296 if test -z "$aix_libpath"; then
297 aix_libpath="/usr/lib:/lib"
299 rm -f conftest.c conftest
300 # End _LT_AC_SYS_LIBPATH_AIX.
301 if test "$aix_use_runtimelinking" = yes; then
302 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
304 if test "$host_cpu" = ia64; then
305 hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
307 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
312 hardcode_libdir_flag_spec='-L$libdir'
314 # see comment about different semantics on the GNU ld section
319 cygwin* | mingw* | pw32*)
320 # When not using gcc, we currently assume that we are using
321 # Microsoft Visual C++.
322 # hardcode_libdir_flag_spec is actually meaningless, as there is
323 # no search path for DLLs.
324 hardcode_libdir_flag_spec=' '
329 if test "$GCC" = yes ; then
342 hardcode_libdir_flag_spec='-L$libdir'
348 hardcode_libdir_flag_spec='-R$libdir'
355 freebsd* | kfreebsd*-gnu | dragonfly*)
356 hardcode_libdir_flag_spec='-R$libdir'
360 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
361 hardcode_libdir_separator=:
363 # hardcode_minus_L: Not really in the search PATH,
364 # but as the default location of the library.
368 if test "$with_gnu_ld" = no; then
369 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
370 hardcode_libdir_separator=:
372 # hardcode_minus_L: Not really in the search PATH,
373 # but as the default location of the library.
378 if test "$with_gnu_ld" = no; then
379 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
380 hardcode_libdir_separator=:
387 # hardcode_minus_L: Not really in the search PATH,
388 # but as the default location of the library.
394 irix5* | irix6* | nonstopux*)
395 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
396 hardcode_libdir_separator=:
399 hardcode_libdir_flag_spec='-R$libdir'
404 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
405 hardcode_libdir_separator=:
409 if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
410 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
413 openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
414 hardcode_libdir_flag_spec='-R$libdir'
417 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
423 hardcode_libdir_flag_spec='-L$libdir'
427 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
428 hardcode_libdir_separator=:
431 if test "$GCC" = yes; then
432 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
434 # Both cc and cxx compiler support -rpath directly
435 hardcode_libdir_flag_spec='-rpath $libdir'
437 hardcode_libdir_separator=:
440 hardcode_libdir_flag_spec='-R$libdir'
443 hardcode_libdir_flag_spec='-L$libdir'
450 hardcode_direct=yes # is this really true???
456 hardcode_direct=no #Motorola manual says yes, but my tests say they lie
463 if test -d /usr/nec; then
467 sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
469 sysv5* | sco3.2v5* | sco5v6*)
470 hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
471 hardcode_libdir_separator=':'
474 hardcode_libdir_flag_spec='-L$libdir'
482 # Check dynamic linker characteristics
483 # Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
484 libname_spec='lib$name'
496 cygwin* | mingw* | pw32*)
508 freebsd* | dragonfly*)
512 hpux9* | hpux10* | hpux11*)
527 irix5* | irix6* | nonstopux*)
534 *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
535 *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
536 *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
537 *) libsuff= shlibsuff= ;;
542 linux*oldld* | linux*aout* | linux*coff*)
560 osf3* | osf4* | osf5*)
570 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
576 sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
577 escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
578 shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
579 escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
581 LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
583 # How to pass a linker flag through the compiler.
586 # Static library suffix (normally "a").
589 # Shared library suffix (normally "so").
592 # Flag to hardcode \$libdir into a binary during linking.
593 # This must work even if \$libdir does not exist.
594 hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
596 # Whether we need a single -rpath flag with a separated argument.
597 hardcode_libdir_separator="$hardcode_libdir_separator"
599 # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
601 hardcode_direct="$hardcode_direct"
603 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the
605 hardcode_minus_L="$hardcode_minus_L"