1#! /bin/sh 2# $MirOS: src/gnu/share/config.rpath,v 1.2 2008/05/03 22:26:25 tg Exp $ 3# $miros: contrib/gnu/gettext/autoconf-lib-link/config.rpath,v 1.3 2008/05/03 19:28:16 tg Exp $ 4#- 5# Output a system dependent set of variables, describing how to set the 6# run time search path of shared libraries in an executable. 7# 8# Copyright 1996-2007 Free Software Foundation, Inc. 9# Taken from GNU libtool, 2001 10# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 11# 12# This file is free software; the Free Software Foundation gives 13# unlimited permission to copy and/or distribute it, with or without 14# modifications, as long as this notice is preserved. 15# 16# The first argument passed to this file is the canonical host specification, 17# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM 18# or 19# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM 20# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld 21# should be set by the caller. 22# 23# The set of defined variables is at the end of this script. 24 25# Known limitations: 26# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer 27# than 256 bytes, otherwise the compiler driver will dump core. The only 28# known workaround is to choose shorter directory names for the build 29# directory and/or the installation directory. 30 31# All known linkers require a `.a' archive for static linking (except MSVC, 32# which needs '.lib'). 33libext=a 34shrext=.so 35 36host="$1" 37host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` 38host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` 39host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` 40 41# Code taken from libtool.m4's _LT_CC_BASENAME. 42 43for cc_temp in $CC""; do 44 case $cc_temp in 45 compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; 46 distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; 47 \-*) ;; 48 *) break;; 49 esac 50done 51cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'` 52 53# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC. 54 55wl= 56if test "$GCC" = yes; then 57 wl='-Wl,' 58else 59 case "$host_os" in 60 aix*) 61 wl='-Wl,' 62 ;; 63 darwin*) 64 case $cc_basename in 65 xlc*) 66 wl='-Wl,' 67 ;; 68 esac 69 ;; 70 mingw* | cygwin* | pw32* | os2*) 71 ;; 72 hpux9* | hpux10* | hpux11*) 73 wl='-Wl,' 74 ;; 75 irix5* | irix6* | nonstopux*) 76 wl='-Wl,' 77 ;; 78 newsos6) 79 ;; 80 linux* | k*bsd*-gnu) 81 case $cc_basename in 82 icc* | ecc*) 83 wl='-Wl,' 84 ;; 85 pgcc | pgf77 | pgf90) 86 wl='-Wl,' 87 ;; 88 ccc*) 89 wl='-Wl,' 90 ;; 91 como) 92 wl='-lopt=' 93 ;; 94 *) 95 case `$CC -V 2>&1 | sed 5q` in 96 *Sun\ C*) 97 wl='-Wl,' 98 ;; 99 esac 100 ;; 101 esac 102 ;; 103 osf3* | osf4* | osf5*) 104 wl='-Wl,' 105 ;; 106 rdos*) 107 ;; 108 solaris*) 109 wl='-Wl,' 110 ;; 111 sunos4*) 112 wl='-Qoption ld ' 113 ;; 114 sysv4 | sysv4.2uw2* | sysv4.3*) 115 wl='-Wl,' 116 ;; 117 sysv4*MP*) 118 ;; 119 sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) 120 wl='-Wl,' 121 ;; 122 unicos*) 123 wl='-Wl,' 124 ;; 125 uts4*) 126 ;; 127 esac 128fi 129 130# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS. 131 132hardcode_libdir_flag_spec= 133hardcode_libdir_separator= 134hardcode_direct=no 135hardcode_minus_L=no 136 137case "$host_os" in 138 cygwin* | mingw* | pw32*) 139 # FIXME: the MSVC++ port hasn't been tested in a loooong time 140 # When not using gcc, we currently assume that we are using 141 # Microsoft Visual C++. 142 if test "$GCC" != yes; then 143 with_gnu_ld=no 144 fi 145 ;; 146 interix*) 147 # we just hope/assume this is gcc and not c89 (= MSVC++) 148 with_gnu_ld=yes 149 ;; 150 mirbsd*) 151 with_gnu_ld=yes 152 ;; 153 openbsd*) 154 with_gnu_ld=no 155 ;; 156esac 157 158ld_shlibs=yes 159if test "$with_gnu_ld" = yes; then 160 # Set some defaults for GNU ld with shared library support. These 161 # are reset later if shared libraries are not supported. Putting them 162 # here allows them to be overridden if necessary. 163 # Unlike libtool, we use -rpath here, not --rpath, since the documented 164 # option of GNU ld is called -rpath, not --rpath. 165 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' 166 case "$host_os" in 167 aix3* | aix4* | aix5*) 168 # On AIX/PPC, the GNU linker is very broken 169 if test "$host_cpu" != ia64; then 170 ld_shlibs=no 171 fi 172 ;; 173 amigaos*) 174 hardcode_libdir_flag_spec='-L$libdir' 175 hardcode_minus_L=yes 176 # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports 177 # that the semantics of dynamic libraries on AmigaOS, at least up 178 # to version 4, is to share data among multiple programs linked 179 # with the same dynamic library. Since this doesn't match the 180 # behavior of shared libraries on other platforms, we cannot use 181 # them. 182 ld_shlibs=no 183 ;; 184 beos*) 185 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then 186 : 187 else 188 ld_shlibs=no 189 fi 190 ;; 191 cygwin* | mingw* | pw32*) 192 # hardcode_libdir_flag_spec is actually meaningless, as there is 193 # no search path for DLLs. 194 hardcode_libdir_flag_spec='-L$libdir' 195 if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then 196 : 197 else 198 ld_shlibs=no 199 fi 200 ;; 201 interix[3-9]*) 202 hardcode_direct=no 203 hardcode_libdir_flag_spec='${wl}-rpath,$libdir' 204 ;; 205 gnu* | linux* | k*bsd*-gnu) 206 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then 207 : 208 else 209 ld_shlibs=no 210 fi 211 ;; 212 mirbsd*) 213 if test -f /usr/libexec/ld.so; then 214 hardcode_direct=yes 215 hardcode_shlibpath_var=no 216 hardcode_libdir_flag_spec='${wl}-rpath,$libdir' 217 else 218 ld_shlibs=no 219 fi 220 ;; 221 netbsd*) 222 ;; 223 solaris*) 224 if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then 225 ld_shlibs=no 226 elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then 227 : 228 else 229 ld_shlibs=no 230 fi 231 ;; 232 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) 233 case `$LD -v 2>&1` in 234 *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) 235 ld_shlibs=no 236 ;; 237 *) 238 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then 239 hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`' 240 else 241 ld_shlibs=no 242 fi 243 ;; 244 esac 245 ;; 246 sunos4*) 247 hardcode_direct=yes 248 ;; 249 *) 250 if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then 251 : 252 else 253 ld_shlibs=no 254 fi 255 ;; 256 esac 257 if test "$ld_shlibs" = no; then 258 hardcode_libdir_flag_spec= 259 fi 260else 261 case "$host_os" in 262 aix3*) 263 # Note: this linker hardcodes the directories in LIBPATH if there 264 # are no directories specified by -L. 265 hardcode_minus_L=yes 266 if test "$GCC" = yes; then 267 # Neither direct hardcoding nor static linking is supported with a 268 # broken collect2. 269 hardcode_direct=unsupported 270 fi 271 ;; 272 aix4* | aix5*) 273 if test "$host_cpu" = ia64; then 274 # On IA64, the linker does run time linking by default, so we don't 275 # have to do anything special. 276 aix_use_runtimelinking=no 277 else 278 aix_use_runtimelinking=no 279 # Test if we are trying to use run time linking or normal 280 # AIX style linking. If -brtl is somewhere in LDFLAGS, we 281 # need to do runtime linking. 282 case $host_os in aix4.[23]|aix4.[23].*|aix5*) 283 for ld_flag in $LDFLAGS; do 284 if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then 285 aix_use_runtimelinking=yes 286 break 287 fi 288 done 289 ;; 290 esac 291 fi 292 hardcode_direct=yes 293 hardcode_libdir_separator=':' 294 if test "$GCC" = yes; then 295 case $host_os in aix4.[012]|aix4.[012].*) 296 collect2name=`${CC} -print-prog-name=collect2` 297 if test -f "$collect2name" && \ 298 strings "$collect2name" | grep resolve_lib_name >/dev/null 299 then 300 # We have reworked collect2 301 : 302 else 303 # We have old collect2 304 hardcode_direct=unsupported 305 hardcode_minus_L=yes 306 hardcode_libdir_flag_spec='-L$libdir' 307 hardcode_libdir_separator= 308 fi 309 ;; 310 esac 311 fi 312 # Begin _LT_AC_SYS_LIBPATH_AIX. 313 echo 'int main () { return 0; }' > conftest.c 314 ${CC} ${LDFLAGS} conftest.c -o conftest 315 aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } 316}'` 317 if test -z "$aix_libpath"; then 318 aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0 *\(.*\)$/\1/; p; } 319}'` 320 fi 321 if test -z "$aix_libpath"; then 322 aix_libpath="/usr/lib:/lib" 323 fi 324 rm -f conftest.c conftest 325 # End _LT_AC_SYS_LIBPATH_AIX. 326 if test "$aix_use_runtimelinking" = yes; then 327 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" 328 else 329 if test "$host_cpu" = ia64; then 330 hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' 331 else 332 hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" 333 fi 334 fi 335 ;; 336 amigaos*) 337 hardcode_libdir_flag_spec='-L$libdir' 338 hardcode_minus_L=yes 339 # see comment about different semantics on the GNU ld section 340 ld_shlibs=no 341 ;; 342 bsdi[45]*) 343 ;; 344 cygwin* | mingw* | pw32*) 345 # When not using gcc, we currently assume that we are using 346 # Microsoft Visual C++. 347 # hardcode_libdir_flag_spec is actually meaningless, as there is 348 # no search path for DLLs. 349 hardcode_libdir_flag_spec=' ' 350 libext=lib 351 ;; 352 darwin* | rhapsody*) 353 hardcode_direct=no 354 if test "$GCC" = yes ; then 355 : 356 else 357 case $cc_basename in 358 xlc*) 359 ;; 360 *) 361 ld_shlibs=no 362 ;; 363 esac 364 fi 365 ;; 366 dgux*) 367 hardcode_libdir_flag_spec='-L$libdir' 368 ;; 369 freebsd1*) 370 ld_shlibs=no 371 ;; 372 freebsd2.2*) 373 hardcode_libdir_flag_spec='-R$libdir' 374 hardcode_direct=yes 375 ;; 376 freebsd2*) 377 hardcode_direct=yes 378 hardcode_minus_L=yes 379 ;; 380 freebsd* | dragonfly* | midnightbsd*) 381 hardcode_libdir_flag_spec='-R$libdir' 382 hardcode_direct=yes 383 ;; 384 hpux9*) 385 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' 386 hardcode_libdir_separator=: 387 hardcode_direct=yes 388 # hardcode_minus_L: Not really in the search PATH, 389 # but as the default location of the library. 390 hardcode_minus_L=yes 391 ;; 392 hpux10*) 393 if test "$with_gnu_ld" = no; then 394 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' 395 hardcode_libdir_separator=: 396 hardcode_direct=yes 397 # hardcode_minus_L: Not really in the search PATH, 398 # but as the default location of the library. 399 hardcode_minus_L=yes 400 fi 401 ;; 402 hpux11*) 403 if test "$with_gnu_ld" = no; then 404 hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' 405 hardcode_libdir_separator=: 406 case $host_cpu in 407 hppa*64*|ia64*) 408 hardcode_direct=no 409 ;; 410 *) 411 hardcode_direct=yes 412 # hardcode_minus_L: Not really in the search PATH, 413 # but as the default location of the library. 414 hardcode_minus_L=yes 415 ;; 416 esac 417 fi 418 ;; 419 irix5* | irix6* | nonstopux*) 420 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' 421 hardcode_libdir_separator=: 422 ;; 423 netbsd*) 424 hardcode_libdir_flag_spec='-R$libdir' 425 hardcode_direct=yes 426 ;; 427 newsos6) 428 hardcode_direct=yes 429 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' 430 hardcode_libdir_separator=: 431 ;; 432 openbsd*) 433 if test -f /usr/libexec/ld.so; then 434 hardcode_direct=yes 435 if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then 436 hardcode_libdir_flag_spec='${wl}-rpath,$libdir' 437 else 438 case "$host_os" in 439 openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) 440 hardcode_libdir_flag_spec='-R$libdir' 441 ;; 442 *) 443 hardcode_libdir_flag_spec='${wl}-rpath,$libdir' 444 ;; 445 esac 446 fi 447 else 448 ld_shlibs=no 449 fi 450 ;; 451 os2*) 452 hardcode_libdir_flag_spec='-L$libdir' 453 hardcode_minus_L=yes 454 ;; 455 osf3*) 456 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' 457 hardcode_libdir_separator=: 458 ;; 459 osf4* | osf5*) 460 if test "$GCC" = yes; then 461 hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' 462 else 463 # Both cc and cxx compiler support -rpath directly 464 hardcode_libdir_flag_spec='-rpath $libdir' 465 fi 466 hardcode_libdir_separator=: 467 ;; 468 solaris*) 469 hardcode_libdir_flag_spec='-R$libdir' 470 ;; 471 sunos4*) 472 hardcode_libdir_flag_spec='-L$libdir' 473 hardcode_direct=yes 474 hardcode_minus_L=yes 475 ;; 476 sysv4) 477 case $host_vendor in 478 sni) 479 hardcode_direct=yes # is this really true??? 480 ;; 481 siemens) 482 hardcode_direct=no 483 ;; 484 motorola) 485 hardcode_direct=no #Motorola manual says yes, but my tests say they lie 486 ;; 487 esac 488 ;; 489 sysv4.3*) 490 ;; 491 sysv4*MP*) 492 if test -d /usr/nec; then 493 ld_shlibs=yes 494 fi 495 ;; 496 sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) 497 ;; 498 sysv5* | sco3.2v5* | sco5v6*) 499 hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`' 500 hardcode_libdir_separator=':' 501 ;; 502 uts4*) 503 hardcode_libdir_flag_spec='-L$libdir' 504 ;; 505 *) 506 ld_shlibs=no 507 ;; 508 esac 509fi 510 511# Check dynamic linker characteristics 512# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER. 513# Unlike libtool.m4, here we don't care about _all_ names of the library, but 514# only about the one the linker finds when passed -lNAME. This is the last 515# element of library_names_spec in libtool.m4, or possibly two of them if the 516# linker has special search rules. 517library_names_spec= # the last element of library_names_spec in libtool.m4 518libname_spec='lib$name' 519case "$host_os" in 520 aix3*) 521 library_names_spec='$libname.a' 522 ;; 523 aix4* | aix5*) 524 library_names_spec='$libname$shrext' 525 ;; 526 amigaos*) 527 library_names_spec='$libname.a' 528 ;; 529 beos*) 530 library_names_spec='$libname$shrext' 531 ;; 532 bsdi[45]*) 533 library_names_spec='$libname$shrext' 534 ;; 535 cygwin* | mingw* | pw32*) 536 shrext=.dll 537 library_names_spec='$libname.dll.a $libname.lib' 538 ;; 539 darwin* | rhapsody*) 540 shrext=.dylib 541 library_names_spec='$libname$shrext' 542 ;; 543 dgux*) 544 library_names_spec='$libname$shrext' 545 ;; 546 freebsd1*) 547 ;; 548 freebsd* | dragonfly*) 549 case "$host_os" in 550 freebsd[123]*) 551 library_names_spec='$libname$shrext$versuffix' ;; 552 *) 553 library_names_spec='$libname$shrext' ;; 554 esac 555 ;; 556 gnu*) 557 library_names_spec='$libname$shrext' 558 ;; 559 hpux9* | hpux10* | hpux11*) 560 case $host_cpu in 561 ia64*) 562 shrext=.so 563 ;; 564 hppa*64*) 565 shrext=.sl 566 ;; 567 *) 568 shrext=.sl 569 ;; 570 esac 571 library_names_spec='$libname$shrext' 572 ;; 573 interix[3-9]*) 574 library_names_spec='$libname$shrext' 575 ;; 576 irix5* | irix6* | nonstopux*) 577 library_names_spec='$libname$shrext' 578 case "$host_os" in 579 irix5* | nonstopux*) 580 libsuff= shlibsuff= 581 ;; 582 *) 583 case $LD in 584 *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;; 585 *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;; 586 *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;; 587 *) libsuff= shlibsuff= ;; 588 esac 589 ;; 590 esac 591 ;; 592 linux*oldld* | linux*aout* | linux*coff*) 593 ;; 594 linux* | k*bsd*-gnu) 595 library_names_spec='$libname$shrext' 596 ;; 597 knetbsd*-gnu) 598 library_names_spec='$libname$shrext' 599 ;; 600 mirbsd*) 601 library_names_spec='$libname$shrext$versuffix2' 602 ;; 603 midnightbsd*) 604 library_names_spec='$libname$shrext' 605 ;; 606 netbsd*) 607 library_names_spec='$libname$shrext' 608 ;; 609 newsos6) 610 library_names_spec='$libname$shrext' 611 ;; 612 nto-qnx*) 613 library_names_spec='$libname$shrext' 614 ;; 615 openbsd*) 616 library_names_spec='$libname$shrext$versuffix2' 617 ;; 618 os2*) 619 libname_spec='$name' 620 shrext=.dll 621 library_names_spec='$libname.a' 622 ;; 623 osf3* | osf4* | osf5*) 624 library_names_spec='$libname$shrext' 625 ;; 626 rdos*) 627 ;; 628 solaris*) 629 library_names_spec='$libname$shrext' 630 ;; 631 sunos4*) 632 library_names_spec='$libname$shrext$versuffix' 633 ;; 634 sysv4 | sysv4.3*) 635 library_names_spec='$libname$shrext' 636 ;; 637 sysv4*MP*) 638 library_names_spec='$libname$shrext' 639 ;; 640 sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) 641 library_names_spec='$libname$shrext' 642 ;; 643 uts4*) 644 library_names_spec='$libname$shrext' 645 ;; 646esac 647 648sed_quote_subst='s/\(["`$\\]\)/\\\1/g' 649escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"` 650shlibext=`echo "$shrext" | sed -e 's,^\.,,'` 651escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` 652escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` 653escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"` 654 655LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF 656 657# How to pass a linker flag through the compiler. 658wl="$escaped_wl" 659 660# Static library suffix (normally "a"). 661libext="$libext" 662 663# Shared library suffix (normally "so"). 664shlibext="$shlibext" 665 666# Format of library name prefix. 667libname_spec="$escaped_libname_spec" 668 669# Library names that the linker finds when passed -lNAME. 670library_names_spec="$escaped_library_names_spec" 671 672# Flag to hardcode \$libdir into a binary during linking. 673# This must work even if \$libdir does not exist. 674hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec" 675 676# Whether we need a single -rpath flag with a separated argument. 677hardcode_libdir_separator="$hardcode_libdir_separator" 678 679# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the 680# resulting binary. 681hardcode_direct="$hardcode_direct" 682 683# Set to yes if using the -LDIR flag during linking hardcodes DIR into the 684# resulting binary. 685hardcode_minus_L="$hardcode_minus_L" 686 687EOF 688