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