3 # $NetBSD: config.rpath,v 1.3 2009/12/13 08:13:07 obache Exp $
5 # Output a system dependent set of variables, describing how to set the
6 # run time search path of shared libraries in an executable.
8 # Copyright 1996-2002 Free Software Foundation, Inc.
9 # Taken from GNU libtool, 2001
10 # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
12 # This program is free software; you can redistribute it and/or modify
13 # it under the terms of the GNU General Public License as published by
14 # the Free Software Foundation; either version 2 of the License, or
15 # (at your option) any later version.
17 # This program is distributed in the hope that it will be useful, but
18 # WITHOUT ANY WARRANTY; without even the implied warranty of
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
20 # General Public License for more details.
22 # You should have received a copy of the GNU General Public License
23 # along with this program; if not, write to the Free Software
24 # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
26 # As a special exception to the GNU General Public License, if you
27 # distribute this file as part of a program that contains a
28 # configuration script generated by Autoconf, you may include it under
29 # the same distribution terms that you use for the rest of that program.
31 # The first argument passed to this file is the canonical host specification,
32 # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
34 # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
35 # The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
36 # should be set by the caller.
38 # The set of defined variables is at the end of this script.
40 # All known linkers require a `.a' archive for static linking (except M$VC,
41 # which needs '.lib').
46 host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
47 host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
48 host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
51 if test "$GCC" = yes; then
55 aix3* | aix4* | aix5*)
58 hpux9* | hpux10* | hpux11*)
65 echo '__INTEL_COMPILER' > conftest.$ac_ext
66 if $CC -E conftest.$ac_ext >/dev/null | grep __INTEL_COMPILER >/dev/null
74 osf3* | osf4* | osf5*)
83 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
84 if test "x$host_vendor" = xsni; then
93 hardcode_libdir_flag_spec=
94 hardcode_libdir_separator=
99 cygwin* | mingw* | pw32*)
100 # FIXME: the MSVC++ port hasn't been tested in a loooong time
101 # When not using gcc, we currently assume that we are using
102 # Microsoft Visual C++.
103 if test "$GCC" != yes; then
113 if test "$with_gnu_ld" = yes; then
115 aix3* | aix4* | aix5*)
116 # On AIX, the GNU linker is very broken
120 hardcode_libdir_flag_spec='-L$libdir'
122 # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
123 # that the semantics of dynamic libraries on AmigaOS, at least up
124 # to version 4, is to share data among multiple programs linked
125 # with the same dynamic library. Since this doesn't match the
126 # behavior of shared libraries on other platforms, we can use
131 if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
137 cygwin* | mingw* | pw32*)
138 # hardcode_libdir_flag_spec is actually meaningless, as there is
139 # no search path for DLLs.
140 hardcode_libdir_flag_spec='-L$libdir'
143 if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then
145 elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
155 if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then
162 if test "$ld_shlibs" = yes; then
163 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
168 # Note: this linker hardcodes the directories in LIBPATH if there
169 # are no directories specified by -L.
171 if test "$GCC" = yes; then
172 # Neither direct hardcoding nor static linking is supported with a
174 hardcode_direct=unsupported
178 if test "$host_cpu" = ia64; then
179 # On IA64, the linker does run time linking by default, so we don't
180 # have to do anything special.
181 aix_use_runtimelinking=no
183 aix_use_runtimelinking=no
184 # Test if we are trying to use run time linking or normal
185 # AIX style linking. If -brtl is somewhere in LDFLAGS, we
186 # need to do runtime linking.
187 case $host_os in aix4.[23]|aix4.[23].*|aix5*)
188 for ld_flag in $LDFLAGS; do
189 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
190 aix_use_runtimelinking=yes
197 hardcode_libdir_separator=':'
198 if test "$GCC" = yes; then
199 case $host_os in aix4.[012]|aix4.[012].*)
200 collect2name=`${CC} -print-prog-name=collect2`
201 if test -f "$collect2name" && \
202 strings "$collect2name" | grep resolve_lib_name >/dev/null
204 # We have reworked collect2
207 # We have old collect2
208 hardcode_direct=unsupported
210 hardcode_libdir_flag_spec='-L$libdir'
211 hardcode_libdir_separator=
215 if test "$aix_use_runtimelinking" = yes; then
216 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:/usr/lib:/lib'
218 if test "$host_cpu" = ia64; then
219 hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
221 hardcode_libdir_flag_spec='${wl}-bnolibpath ${wl}-blibpath:$libdir:/usr/lib:/lib'
226 hardcode_libdir_flag_spec='-L$libdir'
228 # see comment about different semantics on the GNU ld section
231 cygwin* | mingw* | pw32*)
232 # When not using gcc, we currently assume that we are using
233 # Microsoft Visual C++.
234 # hardcode_libdir_flag_spec is actually meaningless, as there is
235 # no search path for DLLs.
236 hardcode_libdir_flag_spec=' '
246 hardcode_libdir_flag_spec='-R$libdir'
254 hardcode_libdir_flag_spec='-R$libdir'
257 hpux9* | hpux10* | hpux11*)
258 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
259 hardcode_libdir_separator=:
261 hardcode_minus_L=yes # Not in the search PATH, but as the default
262 # location of the library.
265 hardcode_libdir_flag_spec='-R$libdir'
269 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
270 hardcode_libdir_separator=:
273 hardcode_libdir_flag_spec='-R$libdir'
278 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
279 hardcode_libdir_separator=:
283 if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
284 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
287 openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
288 hardcode_libdir_flag_spec='-R$libdir'
291 hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
297 hardcode_libdir_flag_spec='-L$libdir'
301 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
302 hardcode_libdir_separator=:
305 if test "$GCC" = yes; then
306 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
308 # Both cc and cxx compiler support -rpath directly
309 hardcode_libdir_flag_spec='-rpath $libdir'
311 hardcode_libdir_separator=:
316 hardcode_libdir_flag_spec='-R$libdir'
319 hardcode_libdir_flag_spec='-L$libdir'
324 if test "x$host_vendor" = xsno; then
325 hardcode_direct=yes # is this really true???
327 hardcode_direct=no # Motorola manual says yes, but my tests say they lie
333 hardcode_libdir_flag_spec=
336 hardcode_libdir_flag_spec='-L$libdir'
339 hardcode_libdir_flag_spec='-L$libdir'
342 if test -d /usr/nec; then
350 sysv5uw7* | unixware7*)
358 # Check dynamic linker characteristics
359 libname_spec='lib$name'
360 sys_lib_dlsearch_path_spec="/lib /usr/lib"
361 sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
377 sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
378 sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
380 cygwin* | mingw* | pw32*)
381 case $GCC,$host_os in
387 sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s/;/ /g"`
408 hpux9* | hpux10* | hpux11*)
422 *-32|*"-32 ") libsuff= shlibsuff= ;;
423 *-n32|*"-n32 ") libsuff=32 shlibsuff=N32 ;;
424 *-64|*"-64 ") libsuff=64 shlibsuff=64 ;;
425 *) libsuff= shlibsuff= ;;
429 sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
430 sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
432 linux-gnuoldld* | linux-gnuaout* | linux-gnucoff*)
450 osf3* | osf4* | osf5*)
452 sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
453 sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
464 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
466 case "$host_vendor" in
468 sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
479 if test -d /usr/nec; then
485 sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
486 escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
487 escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
488 escaped_sys_lib_search_path_spec=`echo "X$sys_lib_search_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
489 escaped_sys_lib_dlsearch_path_spec=`echo "X$sys_lib_dlsearch_path_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
491 sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
493 # How to pass a linker flag through the compiler.
496 # Static library suffix (normally "a").
499 # Shared library suffix (normally "so").
502 # Flag to hardcode \$libdir into a binary during linking.
503 # This must work even if \$libdir does not exist.
504 hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
506 # Whether we need a single -rpath flag with a separated argument.
507 hardcode_libdir_separator="$hardcode_libdir_separator"
509 # Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
511 hardcode_direct="$hardcode_direct"
513 # Set to yes if using the -LDIR flag during linking hardcodes DIR into the
515 hardcode_minus_L="$hardcode_minus_L"
517 # Compile-time system search path for libraries
518 sys_lib_search_path_spec="$escaped_sys_lib_search_path_spec"
520 # Run-time system search path for libraries
521 sys_lib_dlsearch_path_spec="$escaped_sys_lib_dlsearch_path_spec"