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-2002 Free Software Foundation, Inc.
6 # Taken from GNU libtool, 2001
7 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
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.
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.
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.
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.
28 # The first argument passed to this file is the canonical host specification,
29 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
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.
35 # The set of defined variables is at the end of this script.
37 # All known linkers require a `.a' archive for static linking (except M$VC,
38 # which needs '.lib').
43 host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
44 host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
45 host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
48 if test "$GCC" = yes; then
52 aix3* | aix4* | aix5*)
53 if test "$host_cpu" = ia64; then
57 hpux9* | hpux10* | hpux11*)
64 echo '__INTEL_COMPILER' > conftest.$ac_ext
65 if $CC -E conftest.$ac_ext >/dev/null | grep __INTEL_COMPILER >/dev/null
73 osf3* | osf4* | osf5*)
82 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
83 if test "x$host_vendor" = xsni; then
92 hardcode_libdir_flag_spec=
93 hardcode_libdir_separator=
98 cygwin* | mingw* | pw32* )
99 # FIXME: the MSVC++ port hasn't been tested in a loooong time
100 # When not using gcc, we currently assume that we are using
101 # Microsoft Visual C++.
102 if test "$GCC" != yes; then
109 if test "$with_gnu_ld" = yes; then
111 aix3* | aix4* | aix5*)
112 # On AIX, the GNU linker is very broken
116 hardcode_libdir_flag_spec='-L$libdir'
118 # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
119 # that the semantics of dynamic libraries on AmigaOS, at least up
120 # to version 4, is to share data among multiple programs linked
121 # with the same dynamic library. Since this doesn't match the
122 # behavior of shared libraries on other platforms, we can use
127 if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
133 cygwin* | mingw* | pw32*)
134 # hardcode_libdir_flag_spec is actually meaningless, as there is
135 # no search path for DLLs.
136 hardcode_libdir_flag_spec='-L$libdir'
139 if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
141 elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
151 if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
158 if test "$ld_shlibs" = yes; then
159 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
164 # Note: this linker hardcodes the directories in LIBPATH if there
165 # are no directories specified by -L.
167 if test "$GCC" = yes; then
168 # Neither direct hardcoding nor static linking is supported with a
170 hardcode_direct=unsupported
174 hardcode_libdir_separator=':'
175 if test "$GCC" = yes; then
176 collect2name=`${CC} -print-prog-name=collect2`
177 if test -f "$collect2name" && \
178 strings "$collect2name" | grep resolve_lib_name >/dev/null
180 # We have reworked collect2
183 # We have old collect2
184 hardcode_direct=unsupported
186 hardcode_libdir_flag_spec='-L$libdir'
187 hardcode_libdir_separator=
192 if test "$host_cpu" = ia64; then
193 # On IA64, the linker does run time linking by default, so we don't
194 # have to do anything special.
195 aix_use_runtimelinking=no
197 # Test if we are trying to use run time linking, or normal AIX style linking.
198 # If -brtl is somewhere in LDFLAGS, we need to do run time linking.
199 aix_use_runtimelinking=no
200 for ld_flag in $LDFLAGS; do
201 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl" ); then
202 aix_use_runtimelinking=yes
207 if test "$aix_use_runtimelinking" = yes; then
208 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
210 if test "$host_cpu" = ia64; then
211 hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
213 hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
218 hardcode_libdir_flag_spec='-L$libdir'
220 # see comment about different semantics on the GNU ld section
223 cygwin* | mingw* | pw32*)
224 # When not using gcc, we currently assume that we are using
225 # Microsoft Visual C++.
226 # hardcode_libdir_flag_spec is actually meaningless, as there is
227 # no search path for DLLs.
228 hardcode_libdir_flag_spec=' '
238 hardcode_libdir_flag_spec='-R$libdir'
246 hardcode_libdir_flag_spec='-R$libdir'
249 hpux9* | hpux10* | hpux11*)
250 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
251 hardcode_libdir_separator=:
253 hardcode_minus_L=yes # Not in the search PATH, but as the default
254 # location of the library.
257 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
258 hardcode_libdir_separator=:
261 hardcode_libdir_flag_spec='-R$libdir'
266 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
267 hardcode_libdir_separator=:
270 hardcode_libdir_flag_spec='-R$libdir'
274 hardcode_libdir_flag_spec='-L$libdir'
278 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
279 hardcode_libdir_separator=:
282 if test "$GCC" = yes; then
283 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
285 # Both cc and cxx compiler support -rpath directly
286 hardcode_libdir_flag_spec='-rpath $libdir'
288 hardcode_libdir_separator=:
293 hardcode_libdir_flag_spec='-R$libdir'
296 hardcode_libdir_flag_spec='-L$libdir'
301 if test "x$host_vendor" = xsno; then
302 hardcode_direct=yes # is this really true???
304 hardcode_direct=no # Motorola manual says yes, but my tests say they lie
310 hardcode_libdir_flag_spec=
313 hardcode_libdir_flag_spec='-L$libdir'
316 hardcode_libdir_flag_spec='-L$libdir'
319 if test -d /usr/nec; then
327 sysv5uw7* | unixware7*)
335 # Check dynamic linker characteristics
336 libname_spec='lib$name'
337 sys_lib_dlsearch_path_spec="/lib /usr/lib"
338 sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
354 sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
355 sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
357 cygwin* | mingw* | pw32*)
358 case $GCC,$host_os in
364 sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"`
385 hpux9* | hpux10* | hpux11*)
396 *-32|*"-32 ") libsuff= shlibsuff= ;;
397 *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 ;;
398 *-64|*"-64 ") libsuff=64 shlibsuff=64 ;;
399 *) libsuff= shlibsuff= ;;
403 sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
404 sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
406 linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
424 osf3* | osf4* | osf5*)
426 sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
427 sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
438 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
440 case "$host_vendor" in
442 sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
453 if test -d /usr/nec; then
459 sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
460 escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
461 escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
462 escaped_sys_lib_search_path_spec=`echo "X$sys_lib_search_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
463 escaped_sys_lib_dlsearch_path_spec=`echo "X$sys_lib_dlsearch_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
465 sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
467 # How to pass a linker flag through the compiler.
470 # Static library suffix (normally "a").
473 # Shared library suffix (normally "so").
476 # Flag to hardcode \$libdir into a binary during linking.
477 # This must work even if \$libdir does not exist.
478 hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
480 # Whether we need a single -rpath flag with a separated argument.
481 hardcode_libdir_separator="$hardcode_libdir_separator"
483 # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
485 hardcode_direct="$hardcode_direct"
487 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the
489 hardcode_minus_L="$hardcode_minus_L"
491 # Compile-time system search path for libraries
492 sys_lib_search_path_spec="$escaped_sys_lib_search_path_spec"
494 # Run-time system search path for libraries
495 sys_lib_dlsearch_path_spec="$escaped_sys_lib_dlsearch_path_spec"