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
232 objformat=`test -x /usr/bin/objformat && /usr/bin/objformat || echo aout`
233 version_type=freebsd-$objformat
234 case $version_type in
236 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}'
241 library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix'
245 shlibpath_var=LD_LIBRARY_PATH
248 shlibpath_overrides_runpath=yes
250 freebsd3.[01]* | freebsdelf3.[01]*)
251 shlibpath_overrides_runpath=yes
252 hardcode_into_libs=yes
255 shlibpath_overrides_runpath=no
256 hardcode_into_libs=yes
265 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}'
266 soname_spec='${libname}${release}${shared_ext}$major'
267 shlibpath_var=LD_LIBRARY_PATH
268 hardcode_into_libs=yes
271 hpux9* | hpux10* | hpux11*)
272 # Give a soname corresponding to the major version so that dld.sl refuses to
273 # link against other versions.
280 hardcode_into_libs=yes
281 dynamic_linker="$host_os dld.so"
282 shlibpath_var=LD_LIBRARY_PATH
283 shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
284 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
285 soname_spec='${libname}${release}${shared_ext}$major'
286 if test "X$HPUX_IA64_MODE" = X32; then
287 sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib"
289 sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64"
291 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
295 hardcode_into_libs=yes
296 dynamic_linker="$host_os dld.sl"
297 shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH
298 shlibpath_overrides_runpath=yes # Unless +noenvvar is specified.
299 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
300 soname_spec='${libname}${release}${shared_ext}$major'
301 sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64"
302 sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec
306 dynamic_linker="$host_os dld.sl"
307 shlibpath_var=SHLIB_PATH
308 shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH
309 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
310 soname_spec='${libname}${release}${shared_ext}$major'
313 # HP-UX runs *really* slowly unless shared libraries are mode 555.
314 postinstall_cmds='chmod 555 $lib'
317 irix5* | irix6* | nonstopux*)
319 nonstopux*) version_type=nonstopux ;;
321 if test "$lt_cv_prog_gnu_ld" = yes; then
329 soname_spec='${libname}${release}${shared_ext}$major'
330 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}'
336 case $LD in # libtool.m4 will add one of these switches to LD
337 *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ")
338 libsuff= shlibsuff= libmagic=32-bit;;
339 *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ")
340 libsuff=32 shlibsuff=N32 libmagic=N32;;
341 *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ")
342 libsuff=64 shlibsuff=64 libmagic=64-bit;;
343 *) libsuff= shlibsuff= libmagic=never-match;;
347 shlibpath_var=LD_LIBRARY${shlibsuff}_PATH
348 shlibpath_overrides_runpath=no
349 sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}"
350 sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}"
351 hardcode_into_libs=yes
354 # No shared lib support for Linux oldld, aout, or coff.
355 linux*oldld* | linux*aout* | linux*coff*)
359 # This must be Linux ELF.
364 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
365 soname_spec='${libname}${release}${shared_ext}$major'
366 finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir'
367 shlibpath_var=LD_LIBRARY_PATH
368 shlibpath_overrides_runpath=no
369 # This implies no fast_install, which is unacceptable.
370 # Some rework will be needed to allow for fast_install
371 # before this can be enabled.
372 hardcode_into_libs=yes
374 # We used to test for /lib/ld.so.1 and disable shared libraries on
375 # powerpc, because MkLinux only supported shared libraries with the
376 # GNU dynamic linker. Since this was broken with cross compilers,
377 # most powerpc-linux boxes support dynamic linking these days and
378 # people can always --disable-shared, the test was removed, and we
379 # assume the GNU/Linux dynamic linker is in use.
380 dynamic_linker='GNU/Linux ld.so'
387 if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
388 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
389 finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
390 dynamic_linker='NetBSD (a.out) ld.so'
392 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} ${libname}${shared_ext}'
393 soname_spec='${libname}${release}${shared_ext}$major'
394 dynamic_linker='NetBSD ld.elf_so'
396 shlibpath_var=LD_LIBRARY_PATH
397 shlibpath_overrides_runpath=yes
398 hardcode_into_libs=yes
403 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
404 shlibpath_var=LD_LIBRARY_PATH
405 shlibpath_overrides_runpath=yes
412 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
413 soname_spec='${libname}${release}${shared_ext}$major'
414 shlibpath_var=LD_LIBRARY_PATH
415 shlibpath_overrides_runpath=yes
422 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
423 finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir'
424 shlibpath_var=LD_LIBRARY_PATH
425 if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
427 openbsd2.[[89]] | openbsd2.[[89]].*)
428 shlibpath_overrides_runpath=no
431 shlibpath_overrides_runpath=yes
435 shlibpath_overrides_runpath=yes
443 library_names_spec='$libname${shared_ext} $libname.a'
444 dynamic_linker='OS/2 ld.exe'
445 shlibpath_var=LIBPATH
448 osf3* | osf4* | osf5*)
452 soname_spec='${libname}${release}${shared_ext}$major'
453 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
454 shlibpath_var=LD_LIBRARY_PATH
455 sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib"
456 sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec"
461 soname_spec='${libname}${release}${shared_ext}$major'
462 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
463 shlibpath_var=LD_LIBRARY_PATH
470 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
471 soname_spec='${libname}${release}${shared_ext}$major'
472 shlibpath_var=LD_LIBRARY_PATH
473 shlibpath_overrides_runpath=yes
474 hardcode_into_libs=yes
475 # ldd complains unless libraries are executable
476 postinstall_cmds='chmod +x $lib'
481 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix'
482 finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir'
483 shlibpath_var=LD_LIBRARY_PATH
484 shlibpath_overrides_runpath=yes
485 if test "$with_gnu_ld" = yes; then
491 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
493 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
494 soname_spec='${libname}${release}${shared_ext}$major'
495 shlibpath_var=LD_LIBRARY_PATH
498 shlibpath_overrides_runpath=no
500 export_dynamic_flag_spec='${wl}-Blargedynsym'
501 runpath_var=LD_RUN_PATH
509 shlibpath_overrides_runpath=no
510 sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib'
516 if test -d /usr/nec ;then
518 library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}'
519 soname_spec='$libname${shared_ext}.$major'
520 shlibpath_var=LD_LIBRARY_PATH
526 library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
527 soname_spec='${libname}${release}${shared_ext}$major'
528 shlibpath_var=LD_LIBRARY_PATH
535 AC_MSG_RESULT([$dynamic_linker])
536 test "$dynamic_linker" = no && can_build_shared=no
537 ])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
541 AC_DEFUN([AC_LTDL_SHLIBPATH],
542 [AC_REQUIRE([AC_LIBTOOL_SYS_DYNAMIC_LINKER])
543 AC_CACHE_CHECK([which variable specifies run-time library path],
544 [libltdl_cv_shlibpath_var], [libltdl_cv_shlibpath_var="$shlibpath_var"])
545 if test -n "$libltdl_cv_shlibpath_var"; then
546 AC_DEFINE_UNQUOTED(LTDL_SHLIBPATH_VAR, "$libltdl_cv_shlibpath_var",
547 [Define to the name of the environment variable that determines the dynamic library search path.])
549 ])# AC_LTDL_SHLIBPATH