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-2003 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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.
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.
43 # All known linkers require a `.a' archive for static linking (except M$VC,
44 # which needs '.lib').
49 host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
50 host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
51 host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
53 # Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
56 if test "$GCC" = yes; then
63 mingw* | pw32* | os2*)
65 hpux9* | hpux10* | hpux11*)
68 irix5* | irix6* | nonstopux*)
83 osf3* | osf4* | osf5*)
94 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
104 # Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
106 hardcode_libdir_flag_spec=
107 hardcode_libdir_separator=
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
126 if test "$with_gnu_ld" = yes; then
129 # On AIX/PPC, the GNU linker is very broken
130 if test "$host_cpu" != ia64; then
135 hardcode_libdir_flag_spec='-L$libdir'
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
146 if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
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
165 if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
167 elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
177 if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
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'
192 # Note: this linker hardcodes the directories in LIBPATH if there
193 # are no directories specified by -L.
195 if test "$GCC" = yes; then
196 # Neither direct hardcoding nor static linking is supported with a
198 hardcode_direct=unsupported
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
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].*|aix[5-9]*)
212 for ld_flag in $LDFLAGS; do
213 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
214 aix_use_runtimelinking=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
228 # We have reworked collect2
231 # We have old collect2
232 hardcode_direct=unsupported
234 hardcode_libdir_flag_spec='-L$libdir'
235 hardcode_libdir_separator=
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; }
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; }
248 if test -z "$aix_libpath"; then
249 aix_libpath="/usr/lib:/lib"
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"
256 if test "$host_cpu" = ia64; then
257 hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
259 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
264 hardcode_libdir_flag_spec='-L$libdir'
266 # see comment about different semantics on the GNU ld section
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=' '
280 if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then
285 hardcode_libdir_flag_spec='-L$libdir'
288 hardcode_libdir_flag_spec='-R$libdir'
296 hardcode_libdir_flag_spec='-R$libdir'
300 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
301 hardcode_libdir_separator=:
303 # hardcode_minus_L: Not really in the search PATH,
304 # but as the default location of the library.
308 if test "$with_gnu_ld" = no; then
311 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
312 hardcode_libdir_separator=:
316 hardcode_libdir_flag_spec='-L$libdir'
318 # hardcode_minus_L: Not really in the search PATH,
319 # but as the default location of the library.
323 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
324 hardcode_libdir_separator=:
326 # hardcode_minus_L: Not really in the search PATH,
327 # but as the default location of the library.
333 irix5* | irix6* | nonstopux*)
334 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
335 hardcode_libdir_separator=:
338 hardcode_libdir_flag_spec='-R$libdir'
343 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
344 hardcode_libdir_separator=:
348 if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
349 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
352 openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
353 hardcode_libdir_flag_spec='-R$libdir'
356 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
362 hardcode_libdir_flag_spec='-L$libdir'
366 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
367 hardcode_libdir_separator=:
370 if test "$GCC" = yes; then
371 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
373 # Both cc and cxx compiler support -rpath directly
374 hardcode_libdir_flag_spec='-rpath $libdir'
376 hardcode_libdir_separator=:
381 hardcode_libdir_flag_spec='-R$libdir'
384 hardcode_libdir_flag_spec='-L$libdir'
391 hardcode_direct=yes # is this really true???
397 hardcode_direct=no #Motorola manual says yes, but my tests say they lie
404 if test -d /usr/nec; then
412 sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*)
415 hardcode_libdir_flag_spec=
418 hardcode_libdir_flag_spec='-L$libdir'
426 # Check dynamic linker characteristics
427 # Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
428 libname_spec='lib$name'
440 cygwin* | mingw* | pw32*)
452 hpux9* | hpux10* | hpux11*)
465 irix5* | irix6* | nonstopux*)
472 *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
473 *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
474 *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
475 *) libsuff= shlibsuff= ;;
480 linux*oldld* | linux*aout* | linux*coff*)
496 osf3* | osf4* | osf5*)
504 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
512 sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
513 escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
514 shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
515 escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
517 sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
519 # How to pass a linker flag through the compiler.
522 # Static library suffix (normally "a").
525 # Shared library suffix (normally "so").
528 # Flag to hardcode \$libdir into a binary during linking.
529 # This must work even if \$libdir does not exist.
530 hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
532 # Whether we need a single -rpath flag with a separated argument.
533 hardcode_libdir_separator="$hardcode_libdir_separator"
535 # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
537 hardcode_direct="$hardcode_direct"
539 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the
541 hardcode_minus_L="$hardcode_minus_L"