1#! /bin/sh 2# Output a system dependent set of variables, describing how to set the 3# run time search path of shared libraries in an executable. 4# 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 8# 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 3 of the License, or 12# (at your option) any later version. 13# 14# This program is distributed in the hope that it will be useful, 15# but WITHOUT ANY WARRANTY; without even the implied warranty of 16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17# GNU General Public License for more details. 18# 19# You should have received a copy of the GNU General Public License 20# along with this program. If not, see <http://www.gnu.org/licenses/>. 21# 22# As a special exception to the GNU General Public License, if you 23# distribute this file as part of a program that contains a 24# configuration script generated by Autoconf, you may include it under 25# the same distribution terms that you use for the rest of that program. 26# 27# The first argument passed to this file is the canonical host specification, 28# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM 29# or 30# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM 31# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld 32# should be set by the caller. 33# 34# The set of defined variables is at the end of this script. 35 36# Known limitations: 37# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer 38# than 256 bytes, otherwise the compiler driver will dump core. The only 39# known workaround is to choose shorter directory names for the build 40# directory and/or the installation directory. 41 42# All known linkers require a `.a' archive for static linking (except M$VC, 43# which needs '.lib'). 44libext=a 45shrext=.so 46 47host="$1" 48host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` 49host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` 50host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` 51 52# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC. 53 54wl= 55if test "$GCC" = yes; then 56 wl='-Wl,' 57else 58 case "$host_os" in 59 aix*) 60 wl='-Wl,' 61 ;; 62 mingw* | pw32* | os2*) 63 ;; 64 hpux9* | hpux10* | hpux11*) 65 wl='-Wl,' 66 ;; 67 irix5* | irix6* | nonstopux*) 68 wl='-Wl,' 69 ;; 70 newsos6) 71 ;; 72 linux*) 73 case $CC in 74 icc|ecc) 75 wl='-Wl,' 76 ;; 77 ccc) 78 wl='-Wl,' 79 ;; 80 esac 81 ;; 82 osf3* | osf4* | osf5*) 83 wl='-Wl,' 84 ;; 85 sco3.2v5*) 86 ;; 87 solaris*) 88 wl='-Wl,' 89 ;; 90 sunos4*) 91 wl='-Qoption ld ' 92 ;; 93 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) 94 wl='-Wl,' 95 ;; 96 sysv4*MP*) 97 ;; 98 uts4*) 99 ;; 100 esac 101fi 102 103# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS. 104 105hardcode_libdir_flag_spec= 106hardcode_libdir_separator= 107hardcode_direct=no 108hardcode_minus_L=no 109 110case "$host_os" in 111 cygwin* | mingw* | pw32*) 112 # FIXME: the MSVC++ port hasn't been tested in a loooong time 113 # When not using gcc, we currently assume that we are using 114 # Microsoft Visual C++. 115 if test "$GCC" != yes; then 116 with_gnu_ld=no 117 fi 118 ;; 119 openbsd*) 120 with_gnu_ld=no 121 ;; 122esac 123 124ld_shlibs=yes 125if test "$with_gnu_ld" = yes; then 126 case "$host_os" in 127 aix3* | aix4* | aix5*) 128 # On AIX/PPC, the GNU linker is very broken 129 if test "$host_cpu" != ia64; then 130 ld_shlibs=no 131 fi 132 ;; 133 amigaos*) 134 hardcode_libdir_flag_spec='-L$libdir' 135 hardcode_minus_L=yes 136 # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports 137 # that the semantics of dynamic libraries on AmigaOS, at least up 138 # to version 4, is to share data among multiple programs linked 139 # with the same dynamic library. Since this doesn't match the 140 # behavior of shared libraries on other platforms, we can use 141 # them. 142 ld_shlibs=no 143 ;; 144 beos*) 145 if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then 146 : 147 else 148 ld_shlibs=no 149 fi 150 ;; 151 cygwin* | mingw* | pw32*) 152 # hardcode_libdir_flag_spec is actually meaningless, as there is 153 # no search path for DLLs. 154 hardcode_libdir_flag_spec='-L$libdir' 155 if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then 156 : 157 else 158 ld_shlibs=no 159 fi 160 ;; 161 netbsd*) 162 ;; 163 solaris* | sysv5*) 164 if $LD -v 2>&1 | egrep 'BFD 2\.8' > /dev/null; then 165 ld_shlibs=no 166 elif $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then 167 : 168 else 169 ld_shlibs=no 170 fi 171 ;; 172 sunos4*) 173 hardcode_direct=yes 174 ;; 175 *) 176 if $LD --help 2>&1 | egrep ': supported targets:.* elf' > /dev/null; then 177 : 178 else 179 ld_shlibs=no 180 fi 181 ;; 182 esac 183 if test "$ld_shlibs" = yes; then 184 # Unlike libtool, we use -rpath here, not --rpath, since the documented 185 # option of GNU ld is called -rpath, not --rpath. 186 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' 187 fi 188else 189 case "$host_os" in 190 aix3*) 191 # Note: this linker hardcodes the directories in LIBPATH if there 192 # are no directories specified by -L. 193 hardcode_minus_L=yes 194 if test "$GCC" = yes; then 195 # Neither direct hardcoding nor static linking is supported with a 196 # broken collect2. 197 hardcode_direct=unsupported 198 fi 199 ;; 200 aix4* | aix5*) 201 if test "$host_cpu" = ia64; then 202 # On IA64, the linker does run time linking by default, so we don't 203 # have to do anything special. 204 aix_use_runtimelinking=no 205 else 206 aix_use_runtimelinking=no 207 # Test if we are trying to use run time linking or normal 208 # AIX style linking. If -brtl is somewhere in LDFLAGS, we 209 # need to do runtime linking. 210 case $host_os in aix4.[23]|aix4.[23].*|aix5*) 211 for ld_flag in $LDFLAGS; do 212 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then 213 aix_use_runtimelinking=yes 214 break 215 fi 216 done 217 esac 218 fi 219 hardcode_direct=yes 220 hardcode_libdir_separator=':' 221 if test "$GCC" = yes; then 222 case $host_os in aix4.[012]|aix4.[012].*) 223 collect2name=`${CC} -print-prog-name=collect2` 224 if test -f "$collect2name" && \ 225 strings "$collect2name" | grep resolve_lib_name >/dev/null 226 then 227 # We have reworked collect2 228 hardcode_direct=yes 229 else 230 # We have old collect2 231 hardcode_direct=unsupported 232 hardcode_minus_L=yes 233 hardcode_libdir_flag_spec='-L$libdir' 234 hardcode_libdir_separator= 235 fi 236 esac 237 fi 238 # Begin _LT_AC_SYS_LIBPATH_AIX. 239 echo 'int main () { return 0; }' > conftest.c 240 ${CC} ${LDFLAGS} conftest.c -o conftest 241 aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } 242}'` 243 if test -z "$aix_libpath"; then 244 aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } 245}'` 246 fi 247 if test -z "$aix_libpath"; then 248 aix_libpath="/usr/lib:/lib" 249 fi 250 rm -f conftest.c conftest 251 # End _LT_AC_SYS_LIBPATH_AIX. 252 if test "$aix_use_runtimelinking" = yes; then 253 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" 254 else 255 if test "$host_cpu" = ia64; then 256 hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' 257 else 258 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" 259 fi 260 fi 261 ;; 262 amigaos*) 263 hardcode_libdir_flag_spec='-L$libdir' 264 hardcode_minus_L=yes 265 # see comment about different semantics on the GNU ld section 266 ld_shlibs=no 267 ;; 268 bsdi4*) 269 ;; 270 cygwin* | mingw* | pw32*) 271 # When not using gcc, we currently assume that we are using 272 # Microsoft Visual C++. 273 # hardcode_libdir_flag_spec is actually meaningless, as there is 274 # no search path for DLLs. 275 hardcode_libdir_flag_spec=' ' 276 libext=lib 277 ;; 278 darwin* | rhapsody*) 279 if $CC -v 2>&1 | grep 'Apple' >/dev/null ; then 280 hardcode_direct=no 281 fi 282 ;; 283 dgux*) 284 hardcode_libdir_flag_spec='-L$libdir' 285 ;; 286 freebsd1*) 287 ld_shlibs=no 288 ;; 289 freebsd2.2*) 290 hardcode_libdir_flag_spec='-R$libdir' 291 hardcode_direct=yes 292 ;; 293 freebsd2*) 294 hardcode_direct=yes 295 hardcode_minus_L=yes 296 ;; 297 freebsd*) 298 hardcode_libdir_flag_spec='-R$libdir' 299 hardcode_direct=yes 300 ;; 301 hpux9*) 302 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' 303 hardcode_libdir_separator=: 304 hardcode_direct=yes 305 # hardcode_minus_L: Not really in the search PATH, 306 # but as the default location of the library. 307 hardcode_minus_L=yes 308 ;; 309 hpux10* | hpux11*) 310 if test "$with_gnu_ld" = no; then 311 case "$host_cpu" in 312 hppa*64*) 313 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' 314 hardcode_libdir_separator=: 315 hardcode_direct=no 316 ;; 317 ia64*) 318 hardcode_libdir_flag_spec='-L$libdir' 319 hardcode_direct=no 320 # hardcode_minus_L: Not really in the search PATH, 321 # but as the default location of the library. 322 hardcode_minus_L=yes 323 ;; 324 *) 325 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' 326 hardcode_libdir_separator=: 327 hardcode_direct=yes 328 # hardcode_minus_L: Not really in the search PATH, 329 # but as the default location of the library. 330 hardcode_minus_L=yes 331 ;; 332 esac 333 fi 334 ;; 335 irix5* | irix6* | nonstopux*) 336 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' 337 hardcode_libdir_separator=: 338 ;; 339 netbsd*) 340 hardcode_libdir_flag_spec='-R$libdir' 341 hardcode_direct=yes 342 ;; 343 newsos6) 344 hardcode_direct=yes 345 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' 346 hardcode_libdir_separator=: 347 ;; 348 openbsd*) 349 hardcode_direct=yes 350 if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then 351 hardcode_libdir_flag_spec='${wl}-rpath,$libdir' 352 else 353 case "$host_os" in 354 openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) 355 hardcode_libdir_flag_spec='-R$libdir' 356 ;; 357 *) 358 hardcode_libdir_flag_spec='${wl}-rpath,$libdir' 359 ;; 360 esac 361 fi 362 ;; 363 os2*) 364 hardcode_libdir_flag_spec='-L$libdir' 365 hardcode_minus_L=yes 366 ;; 367 osf3*) 368 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' 369 hardcode_libdir_separator=: 370 ;; 371 osf4* | osf5*) 372 if test "$GCC" = yes; then 373 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' 374 else 375 # Both cc and cxx compiler support -rpath directly 376 hardcode_libdir_flag_spec='-rpath $libdir' 377 fi 378 hardcode_libdir_separator=: 379 ;; 380 sco3.2v5*) 381 ;; 382 solaris*) 383 hardcode_libdir_flag_spec='-R$libdir' 384 ;; 385 sunos4*) 386 hardcode_libdir_flag_spec='-L$libdir' 387 hardcode_direct=yes 388 hardcode_minus_L=yes 389 ;; 390 sysv4) 391 case $host_vendor in 392 sni) 393 hardcode_direct=yes # is this really true??? 394 ;; 395 siemens) 396 hardcode_direct=no 397 ;; 398 motorola) 399 hardcode_direct=no #Motorola manual says yes, but my tests say they lie 400 ;; 401 esac 402 ;; 403 sysv4.3*) 404 ;; 405 sysv4*MP*) 406 if test -d /usr/nec; then 407 ld_shlibs=yes 408 fi 409 ;; 410 sysv4.2uw2*) 411 hardcode_direct=yes 412 hardcode_minus_L=no 413 ;; 414 sysv5OpenUNIX8* | sysv5UnixWare7* | sysv5uw[78]* | unixware7*) 415 ;; 416 sysv5*) 417 hardcode_libdir_flag_spec= 418 ;; 419 uts4*) 420 hardcode_libdir_flag_spec='-L$libdir' 421 ;; 422 *) 423 ld_shlibs=no 424 ;; 425 esac 426fi 427 428# Check dynamic linker characteristics 429# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. 430libname_spec='lib$name' 431case "$host_os" in 432 aix3*) 433 ;; 434 aix4* | aix5*) 435 ;; 436 amigaos*) 437 ;; 438 beos*) 439 ;; 440 bsdi4*) 441 ;; 442 cygwin* | mingw* | pw32*) 443 shrext=.dll 444 ;; 445 darwin* | rhapsody*) 446 shrext=.dylib 447 ;; 448 dgux*) 449 ;; 450 freebsd1*) 451 ;; 452 freebsd*) 453 ;; 454 gnu*) 455 ;; 456 hpux9* | hpux10* | hpux11*) 457 case "$host_cpu" in 458 ia64*) 459 shrext=.so 460 ;; 461 hppa*64*) 462 shrext=.sl 463 ;; 464 *) 465 shrext=.sl 466 ;; 467 esac 468 ;; 469 irix5* | irix6* | nonstopux*) 470 case "$host_os" in 471 irix5* | nonstopux*) 472 libsuff= shlibsuff= 473 ;; 474 *) 475 case $LD in 476 *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; 477 *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; 478 *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; 479 *) libsuff= shlibsuff= ;; 480 esac 481 ;; 482 esac 483 ;; 484 linux*oldld* | linux*aout* | linux*coff*) 485 ;; 486 linux*) 487 ;; 488 netbsd*) 489 ;; 490 newsos6) 491 ;; 492 nto-qnx) 493 ;; 494 openbsd*) 495 ;; 496 os2*) 497 libname_spec='$name' 498 shrext=.dll 499 ;; 500 osf3* | osf4* | osf5*) 501 ;; 502 sco3.2v5*) 503 ;; 504 solaris*) 505 ;; 506 sunos4*) 507 ;; 508 sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) 509 ;; 510 sysv4*MP*) 511 ;; 512 uts4*) 513 ;; 514esac 515 516sed_quote_subst='s/\(["`$\\]\)/\\\1/g' 517escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` 518shlibext=`echo "$shrext" | sed -e 's,^\.,,'` 519escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` 520 521sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF 522 523# How to pass a linker flag through the compiler. 524wl="$escaped_wl" 525 526# Static library suffix (normally "a"). 527libext="$libext" 528 529# Shared library suffix (normally "so"). 530shlibext="$shlibext" 531 532# Flag to hardcode \$libdir into a binary during linking. 533# This must work even if \$libdir does not exist. 534hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec" 535 536# Whether we need a single -rpath flag with a separated argument. 537hardcode_libdir_separator="$hardcode_libdir_separator" 538 539# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the 540# resulting binary. 541hardcode_direct="$hardcode_direct" 542 543# Set to yes if using the -LDIR flag during linking hardcodes DIR into the 544# resulting binary. 545hardcode_minus_L="$hardcode_minus_L" 546 547EOF 548