| 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-2006 Free Software Foundation, Inc.
|
|---|
| 6 | # Taken from GNU libtool, 2001
|
|---|
| 7 | # Originally by Gordon Matzigkeit <[email protected]>, 1996
|
|---|
| 8 | #
|
|---|
| 9 | # This file is free software; the Free Software Foundation gives
|
|---|
| 10 | # unlimited permission to copy and/or distribute it, with or without
|
|---|
| 11 | # modifications, as long as this notice is preserved.
|
|---|
| 12 | #
|
|---|
| 13 | # The first argument passed to this file is the canonical host specification,
|
|---|
| 14 | # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
|
|---|
| 15 | # or
|
|---|
| 16 | # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
|
|---|
| 17 | # The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
|
|---|
| 18 | # should be set by the caller.
|
|---|
| 19 | #
|
|---|
| 20 | # The set of defined variables is at the end of this script.
|
|---|
| 21 |
|
|---|
| 22 | # Known limitations:
|
|---|
| 23 | # - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
|
|---|
| 24 | # than 256 bytes, otherwise the compiler driver will dump core. The only
|
|---|
| 25 | # known workaround is to choose shorter directory names for the build
|
|---|
| 26 | # directory and/or the installation directory.
|
|---|
| 27 |
|
|---|
| 28 | # All known linkers require a `.a' archive for static linking (except MSVC,
|
|---|
| 29 | # which needs '.lib').
|
|---|
| 30 | libext=a
|
|---|
| 31 | shrext=.so
|
|---|
| 32 |
|
|---|
| 33 | host="$1"
|
|---|
| 34 | host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
|
|---|
| 35 | host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
|
|---|
| 36 | host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
|
|---|
| 37 |
|
|---|
| 38 | # Code taken from libtool.m4's _LT_CC_BASENAME.
|
|---|
| 39 |
|
|---|
| 40 | for cc_temp in $CC""; do
|
|---|
| 41 | case $cc_temp in
|
|---|
| 42 | compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
|
|---|
| 43 | distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
|
|---|
| 44 | \-*) ;;
|
|---|
| 45 | *) break;;
|
|---|
| 46 | esac
|
|---|
| 47 | done
|
|---|
| 48 | cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
|
|---|
| 49 |
|
|---|
| 50 | # Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
|
|---|
| 51 |
|
|---|
| 52 | wl=
|
|---|
| 53 | if test "$GCC" = yes; then
|
|---|
| 54 | wl='-Wl,'
|
|---|
| 55 | else
|
|---|
| 56 | case "$host_os" in
|
|---|
| 57 | aix*)
|
|---|
| 58 | wl='-Wl,'
|
|---|
| 59 | ;;
|
|---|
| 60 | darwin*)
|
|---|
| 61 | case $cc_basename in
|
|---|
| 62 | xlc*)
|
|---|
| 63 | wl='-Wl,'
|
|---|
| 64 | ;;
|
|---|
| 65 | esac
|
|---|
| 66 | ;;
|
|---|
| 67 | mingw* | pw32* | os2*)
|
|---|
| 68 | ;;
|
|---|
| 69 | hpux9* | hpux10* | hpux11*)
|
|---|
| 70 | wl='-Wl,'
|
|---|
| 71 | ;;
|
|---|
| 72 | irix5* | irix6* | nonstopux*)
|
|---|
| 73 | wl='-Wl,'
|
|---|
| 74 | ;;
|
|---|
| 75 | newsos6)
|
|---|
| 76 | ;;
|
|---|
| 77 | linux*)
|
|---|
| 78 | case $cc_basename in
|
|---|
| 79 | icc* | ecc*)
|
|---|
| 80 | wl='-Wl,'
|
|---|
| 81 | ;;
|
|---|
| 82 | pgcc | pgf77 | pgf90)
|
|---|
| 83 | wl='-Wl,'
|
|---|
| 84 | ;;
|
|---|
| 85 | ccc*)
|
|---|
| 86 | wl='-Wl,'
|
|---|
| 87 | ;;
|
|---|
| 88 | como)
|
|---|
| 89 | wl='-lopt='
|
|---|
| 90 | ;;
|
|---|
| 91 | *)
|
|---|
| 92 | case `$CC -V 2>&1 | sed 5q` in
|
|---|
| 93 | *Sun\ C*)
|
|---|
| 94 | wl='-Wl,'
|
|---|
| 95 | ;;
|
|---|
| 96 | esac
|
|---|
| 97 | ;;
|
|---|
| 98 | esac
|
|---|
| 99 | ;;
|
|---|
| 100 | osf3* | osf4* | osf5*)
|
|---|
| 101 | wl='-Wl,'
|
|---|
| 102 | ;;
|
|---|
| 103 | sco3.2v5*)
|
|---|
| 104 | ;;
|
|---|
| 105 | solaris*)
|
|---|
| 106 | wl='-Wl,'
|
|---|
| 107 | ;;
|
|---|
| 108 | sunos4*)
|
|---|
| 109 | wl='-Qoption ld '
|
|---|
| 110 | ;;
|
|---|
| 111 | sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
|
|---|
| 112 | wl='-Wl,'
|
|---|
| 113 | ;;
|
|---|
| 114 | sysv4*MP*)
|
|---|
| 115 | ;;
|
|---|
| 116 | unicos*)
|
|---|
| 117 | wl='-Wl,'
|
|---|
| 118 | ;;
|
|---|
| 119 | uts4*)
|
|---|
| 120 | ;;
|
|---|
| 121 | esac
|
|---|
| 122 | fi
|
|---|
| 123 |
|
|---|
| 124 | # Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
|
|---|
| 125 |
|
|---|
| 126 | hardcode_libdir_flag_spec=
|
|---|
| 127 | hardcode_libdir_separator=
|
|---|
| 128 | hardcode_direct=no
|
|---|
| 129 | hardcode_minus_L=no
|
|---|
| 130 |
|
|---|
| 131 | case "$host_os" in
|
|---|
| 132 | cygwin* | mingw* | pw32*)
|
|---|
| 133 | # FIXME: the MSVC++ port hasn't been tested in a loooong time
|
|---|
| 134 | # When not using gcc, we currently assume that we are using
|
|---|
| 135 | # Microsoft Visual C++.
|
|---|
| 136 | if test "$GCC" != yes; then
|
|---|
| 137 | with_gnu_ld=no
|
|---|
| 138 | fi
|
|---|
| 139 | ;;
|
|---|
| 140 | interix*)
|
|---|
| 141 | # we just hope/assume this is gcc and not c89 (= MSVC++)
|
|---|
| 142 | with_gnu_ld=yes
|
|---|
| 143 | ;;
|
|---|
| 144 | openbsd*)
|
|---|
| 145 | with_gnu_ld=no
|
|---|
| 146 | ;;
|
|---|
| 147 | esac
|
|---|
| 148 |
|
|---|
| 149 | ld_shlibs=yes
|
|---|
| 150 | if test "$with_gnu_ld" = yes; then
|
|---|
| 151 | # Set some defaults for GNU ld with shared library support. These
|
|---|
| 152 | # are reset later if shared libraries are not supported. Putting them
|
|---|
| 153 | # here allows them to be overridden if necessary.
|
|---|
| 154 | # Unlike libtool, we use -rpath here, not --rpath, since the documented
|
|---|
| 155 | # option of GNU ld is called -rpath, not --rpath.
|
|---|
| 156 | hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
|---|
| 157 | case "$host_os" in
|
|---|
| 158 | aix3* | aix4* | aix5*)
|
|---|
| 159 | # On AIX/PPC, the GNU linker is very broken
|
|---|
| 160 | if test "$host_cpu" != ia64; then
|
|---|
| 161 | ld_shlibs=no
|
|---|
| 162 | fi
|
|---|
| 163 | ;;
|
|---|
| 164 | amigaos*)
|
|---|
| 165 | hardcode_libdir_flag_spec='-L$libdir'
|
|---|
| 166 | hardcode_minus_L=yes
|
|---|
| 167 | # Samuel A. Falvo II <[email protected]> reports
|
|---|
| 168 | # that the semantics of dynamic libraries on AmigaOS, at least up
|
|---|
| 169 | # to version 4, is to share data among multiple programs linked
|
|---|
| 170 | # with the same dynamic library. Since this doesn't match the
|
|---|
| 171 | # behavior of shared libraries on other platforms, we cannot use
|
|---|
| 172 | # them.
|
|---|
| 173 | ld_shlibs=no
|
|---|
| 174 | ;;
|
|---|
| 175 | beos*)
|
|---|
| 176 | if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
|---|
| 177 | :
|
|---|
| 178 | else
|
|---|
| 179 | ld_shlibs=no
|
|---|
| 180 | fi
|
|---|
| 181 | ;;
|
|---|
| 182 | cygwin* | mingw* | pw32*)
|
|---|
| 183 | # hardcode_libdir_flag_spec is actually meaningless, as there is
|
|---|
| 184 | # no search path for DLLs.
|
|---|
| 185 | hardcode_libdir_flag_spec='-L$libdir'
|
|---|
| 186 | if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
|
|---|
| 187 | :
|
|---|
| 188 | else
|
|---|
| 189 | ld_shlibs=no
|
|---|
| 190 | fi
|
|---|
| 191 | ;;
|
|---|
| 192 | interix3*)
|
|---|
| 193 | hardcode_direct=no
|
|---|
| 194 | hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
|---|
| 195 | ;;
|
|---|
|
|---|