1 # shlibpath.m4 - Define LTDL_SHLIBPATH_VAR. -*-Autoconf-*-
2 ## Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2005
3 ## Free Software Foundation, Inc.
4 ## Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
6 ## This program is free software; you can redistribute it and/or modify
7 ## it under the terms of the GNU General Public License as published by
8 ## the Free Software Foundation; either version 2 of the License, or
9 ## (at your option) any later version.
11 ## This program is distributed in the hope that it will be useful, but
12 ## WITHOUT ANY WARRANTY; without even the implied warranty of
13 ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 ## General Public License for more details.
16 ## You should have received a copy of the GNU General Public License
17 ## along with this program; if not, write to the Free Software
18 ## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 ## As a special exception to the GNU General Public License, if you
21 ## distribute this file as part of a program that contains a
22 ## configuration script generated by Autoconf, you may include it under
23 ## the same distribution terms that you use for the rest of that program.
25 # AC_LIBTOOL_SYS_DYNAMIC_LINKER
26 # -----------------------------
27 # PORTME Fill in your ld.so characteristics
28 AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
29 [AC_MSG_CHECKING([dynamic linker characteristics])
31 libname_spec='lib$name'
39 shlibpath_overrides_runpath=unknown
41 dynamic_linker="$host_os ld.so"
42 sys_lib_dlsearch_path_spec="/lib /usr/lib"
43 if test "$GCC" = yes; then
44 sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g"`
45 if echo "$sys_lib_search_path_spec" | grep ';' >/dev/null ; then
46 # if the path contains ";" then we assume it to be the separator
47 # otherwise default to the standard path separator (i.e. ":") - it is
48 # assumed that no part of a normal pathname contains ";" but that should
49 # okay in the real world where ";" in dirpaths is itself problematic.
50 sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | sed -e 's/;/ /g'`
52 sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | sed -e "s/$PATH_SEPARATOR/ /g"`
55 sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
57 need_lib_prefix=unknown
60 # when you set need_version to no, make sure it does not cause -set_version
61 # flags to be left without arguments
67 library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
70 # AIX 3 has no versioning support, so we append a major version to the name.
71 soname_spec='${libname}${release}${shared_ext}$major'
78 hardcode_into_libs=yes
79 if test "$host_cpu" = ia64; then
81 library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}'
82 shlibpath_var=LD_LIBRARY_PATH
84 # With GCC up to 2.95.x, collect2 would create an import file
85 # for dependence libraries. The import file would start with
86 # the line `#! .'. This would cause the generated library to
87 # depend on `.', always an invalid library. This was fixed in
88 # development snapshots of GCC prior to 3.0.
90 aix4 | aix4.[[01]] | aix4.[[01]].*)
91 if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)'
93 echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
100 # AIX (on Power*) has no versioning support, so currently we can not hardcode correct
101 # soname into executable. Probably we can add versioning support to
102 # collect2, so additional links can be useful in future.
103 if test "$aix_use_runtimelinking" = yes; then
104 # If using run time linking (on AIX 4.2 or later) use lib<name>.so
105 # instead of lib<name>.a to let people know that these are not
106 # typical AIX shared libraries.
107 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
109 # We preserve .a as extension for shared libraries through AIX4.2
110 # and later when we are not doing run time linking.
111 library_names_spec='${libname}${release}.a $libname.a'
112 soname_spec='${libname}${release}${shared_ext}$major'
114 shlibpath_var=LIBPATH
119 library_names_spec='$libname.ixlibrary $libname.a'
120 # Create ${libname}_ixlibrary.a entries in /sys/libs.
121 finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`$echo "X$lib" | $Xsed -e '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $rm /sys/libs/${libname}_ixlibrary.a; $show "(cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a)"; (cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a) || exit 1; done'
125 library_names_spec='${libname}${shared_ext}'
126 dynamic_linker="$host_os ld.so"
127 shlibpath_var=LIBRARY_PATH
133 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
134 soname_spec='${libname}${release}${shared_ext}$major'
135 finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir'
136 shlibpath_var=LD_LIBRARY_PATH
137 sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib"
138 sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib"
139 # the default ld.so.conf also contains /usr/contrib/lib and
140 # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow
141 # libtool to hard-code these into programs
144 cygwin* | mingw* | pw32*)
150 case $GCC,$host_os in
151 yes,cygwin* | yes,mingw* | yes,pw32*)
152 library_names_spec='$libname.dll.a'
153 # DLL is installed to $(libdir)/../bin by postinstall_cmds
154 postinstall_cmds='base_file=`basename \${file}`~
155 dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i;echo \$dlname'\''`~
156 dldir=$destdir/`dirname \$dlpath`~
157 test -d \$dldir || mkdir -p \$dldir~
158 $install_prog $dir/$dlname \$dldir/$dlname'
159 postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
162 shlibpath_overrides_runpath=yes
166 # Cygwin DLLs use 'cyg' prefix rather than 'lib'
167 soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
168 sys_lib_search_path_spec="/lib /lib/w32api /usr/lib /usr/local/lib"
171 # MinGW DLLs use traditional 'lib' prefix
172 soname_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
173 sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g"`
174 if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then
175 # It is most probably a Windows format PATH printed by
176 # mingw gcc, but we are running on Cygwin. Gcc prints its search
177 # path with ; separators, and with drive letters. We can handle the
178 # drive letters (cygwin fileutils understands them), so leave them,
179 # especially as we might pass files found there to a mingw objdump,
180 # which wouldn't understand a cygwinified path. Ahh.
181 sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | sed -e 's/;/ /g'`
183 sys_lib_search_path_spec=`echo "$sys_lib_search_path_spec" | sed -e "s/$PATH_SEPARATOR/ /g"`
187 # pw32 DLLs use 'pw' prefix rather than 'lib'
188 library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | sed -e 's/[.]/-/g'`${versuffix}${shared_ext}'
194 library_names_spec='${libname}`echo ${release} | sed -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib'
197 dynamic_linker='Win32 ld.exe'
198 # FIXME: first we should search . and the directory the executable is in
203 dynamic_linker="$host_os dyld"
207 # FIXME: Relying on posixy $() will cause problems for
208 # cross-compilation, but unfortunately the echo tests do not
209 # yet detect zsh echo's removal of \ escapes.
210 library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
211 soname_spec='${libname}${release}${major}$shared_ext'
212 shlibpath_overrides_runpath=yes
213 shlibpath_var=DYLD_LIBRARY_PATH
214 shrext='$(test .$module = .yes && echo .so || echo .dylib)'
215 # Apple's gcc prints 'gcc -print-search-dirs' doesn't operate the same.
216 if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then
217 sys_lib_search_path_spec=`$CC -print-search-dirs | tr "\n" "$PATH_SEPARATOR" | sed -e 's/libraries:/@libraries:/' | tr "@" "\n" | grep "^libraries:" | sed -e "s/^libraries://" -e "s,=/,/,g" -e "s,$PATH_SEPARATOR, ,g" -e "s,.*,& /lib /usr/lib /usr/local/lib,g"`
219 sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
226 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
227 soname_spec='${libname}${release}${shared_ext}$major'
228 shlibpath_var=LD_LIBRARY_PATH
236 objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
237 version_type=freebsd-$objformat
238 case $version_type in
240 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
245 library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
249 shlibpath_var=LD_LIBRARY_PATH
252 shlibpath_overrides_runpath=yes
254 freebsd3.[01]* | freebsdelf3.[01]*)
255 shlibpath_overrides_runpath=yes
256 hardcode_into_libs=yes
259 shlibpath_overrides_runpath=no
260 hardcode_into_libs=yes
269 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
270 soname_spec='${libname}${release}${shared_ext}$major'
271 shlibpath_var=LD_LIBRARY_PATH
272 hardcode_into_libs=yes
275 hpux9* | hpux10* | hpux11*)
276 # Give a soname corresponding to the major version so that dld.sl refuses to
277 # link against other versions.
284 hardcode_into_libs=yes
285 dynamic_linker="$host_os dld.so"
286 shlibpath_var=LD_LIBRARY_PATH
287 shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
288 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
289 soname_spec='${libname}${release}${shared_ext}$major'
290 if test "X$HPUX_IA64_MODE" = X32; then
291 sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
293 sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
295 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
299 hardcode_into_libs=yes
300 dynamic_linker="$host_os dld.sl"
301 shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
302 shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
303 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
304 soname_spec='${libname}${release}${shared_ext}$major'
305 sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
306 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
310 dynamic_linker="$host_os dld.sl"
311 shlibpath_var=SHLIB_PATH
312 shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
313 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
314 soname_spec='${libname}${release}${shared_ext}$major'
317 # HP-UX runs *really* slowly unless shared libraries are mode 555.
318 postinstall_cmds='chmod 555 $lib'
321 irix5* | irix6* | nonstopux*)
323 nonstopux*) version_type=nonstopux ;;
325 if test "$lt_cv_prog_gnu_ld" = yes; then
333 soname_spec='${libname}${release}${shared_ext}$major'
334 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
340 case $LD in # libtool.m4 will add one of these switches to LD
341 *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
342 libsuff= shlibsuff= libmagic=32-bit;;
343 *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
344 libsuff=32 shlibsuff=N32 libmagic=N32;;
345 *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
346 libsuff=64 shlibsuff=64 libmagic=64-bit;;
347 *) libsuff= shlibsuff= libmagic=never-match;;
351 shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
352 shlibpath_overrides_runpath=no
353 sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
354 sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
355 hardcode_into_libs=yes
358 # No shared lib support for Linux oldld, aout, or coff.
359 linux*oldld* | linux*aout* | linux*coff*)
363 # This must be Linux ELF.
368 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
369 soname_spec='${libname}${release}${shared_ext}$major'
370 finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
371 shlibpath_var=LD_LIBRARY_PATH
372 shlibpath_overrides_runpath=no
373 # This implies no fast_install, which is unacceptable.
374 # Some rework will be needed to allow for fast_install
375 # before this can be enabled.
376 hardcode_into_libs=yes
378 # We used to test for /lib/ld.so.1 and disable shared libraries on
379 # powerpc, because MkLinux only supported shared libraries with the
380 # GNU dynamic linker. Since this was broken with cross compilers,
381 # most powerpc-linux boxes support dynamic linking these days and
382 # people can always --disable-shared, the test was removed, and we
383 # assume the GNU/Linux dynamic linker is in use.
384 dynamic_linker='GNU/Linux ld.so'
391 if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
392 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
393 finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
394 dynamic_linker='NetBSD (a.out) ld.so'
396 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}'
397 soname_spec='${libname}${release}${shared_ext}$major'
398 dynamic_linker='NetBSD ld.elf_so'
400 shlibpath_var=LD_LIBRARY_PATH
401 shlibpath_overrides_runpath=yes
402 hardcode_into_libs=yes
407 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
408 shlibpath_var=LD_LIBRARY_PATH
409 shlibpath_overrides_runpath=yes
416 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
417 soname_spec='${libname}${release}${shared_ext}$major'
418 shlibpath_var=LD_LIBRARY_PATH
419 shlibpath_overrides_runpath=yes
426 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
427 finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
428 shlibpath_var=LD_LIBRARY_PATH
429 if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
431 openbsd2.[[89]] | openbsd2.[[89]].*)
432 shlibpath_overrides_runpath=no
435 shlibpath_overrides_runpath=yes
439 shlibpath_overrides_runpath=yes
447 library_names_spec='$libname${shared_ext} $libname.a'
448 dynamic_linker='OS/2 ld.exe'
449 shlibpath_var=LIBPATH
452 osf3* | osf4* | osf5*)
456 soname_spec='${libname}${release}${shared_ext}$major'
457 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
458 shlibpath_var=LD_LIBRARY_PATH
459 sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
460 sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
465 soname_spec='${libname}${release}${shared_ext}$major'
466 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
467 shlibpath_var=LD_LIBRARY_PATH
474 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
475 soname_spec='${libname}${release}${shared_ext}$major'
476 shlibpath_var=LD_LIBRARY_PATH
477 shlibpath_overrides_runpath=yes
478 hardcode_into_libs=yes
479 # ldd complains unless libraries are executable
480 postinstall_cmds='chmod +x $lib'
485 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
486 finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
487 shlibpath_var=LD_LIBRARY_PATH
488 shlibpath_overrides_runpath=yes
489 if test "$with_gnu_ld" = yes; then
495 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
497 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
498 soname_spec='${libname}${release}${shared_ext}$major'
499 shlibpath_var=LD_LIBRARY_PATH
502 shlibpath_overrides_runpath=no
504 export_dynamic_flag_spec='${wl}-Blargedynsym'
505 runpath_var=LD_RUN_PATH
513 shlibpath_overrides_runpath=no
514 sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
520 if test -d /usr/nec ;then
522 library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
523 soname_spec='$libname${shared_ext}.$major'
524 shlibpath_var=LD_LIBRARY_PATH
530 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
531 soname_spec='${libname}${release}${shared_ext}$major'
532 shlibpath_var=LD_LIBRARY_PATH
539 AC_MSG_RESULT([$dynamic_linker])
540 test "$dynamic_linker" = no && can_build_shared=no
541 ])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
545 AC_DEFUN([AC_LTDL_SHLIBPATH],
546 [AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER])
547 AC_CACHE_CHECK([which variable specifies run-time library path],
548 [libltdl_cv_shlibpath_var], [libltdl_cv_shlibpath_var="$shlibpath_var"])
549 if test -n "$libltdl_cv_shlibpath_var"; then
550 AC_DEFINE_UNQUOTED(LTDL_SHLIBPATH_VAR, "$libltdl_cv_shlibpath_var",
551 [Define to the name of the environment variable that determines the dynamic library search path.])
553 ])# AC_LTDL_SHLIBPATH