root / ltmain.sh @ 2081
History | View | Annotate | Download (195.3 kB)
| 1 | 1 | hiro | # ltmain.sh - Provide generalized library-building support services. |
|---|---|---|---|
| 2 | 1 | hiro | # NOTE: Changing this file will not affect anything until you rerun configure. |
| 3 | 1 | hiro | # |
| 4 | 2022 | hiro | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, |
| 5 | 2022 | hiro | # 2007, 2008 Free Software Foundation, Inc. |
| 6 | 1 | hiro | # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
| 7 | 1 | hiro | # |
| 8 | 1 | hiro | # This program is free software; you can redistribute it and/or modify |
| 9 | 1 | hiro | # it under the terms of the GNU General Public License as published by |
| 10 | 1 | hiro | # the Free Software Foundation; either version 2 of the License, or |
| 11 | 1 | hiro | # (at your option) any later version. |
| 12 | 1 | hiro | # |
| 13 | 1 | hiro | # This program is distributed in the hope that it will be useful, but |
| 14 | 1 | hiro | # WITHOUT ANY WARRANTY; without even the implied warranty of |
| 15 | 1 | hiro | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 16 | 1 | hiro | # General Public License for more details. |
| 17 | 1 | hiro | # |
| 18 | 1 | hiro | # You should have received a copy of the GNU General Public License |
| 19 | 1 | hiro | # along with this program; if not, write to the Free Software |
| 20 | 597 | hiro | # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
| 21 | 1 | hiro | # |
| 22 | 1 | hiro | # As a special exception to the GNU General Public License, if you |
| 23 | 1 | hiro | # distribute this file as part of a program that contains a |
| 24 | 1 | hiro | # configuration script generated by Autoconf, you may include it under |
| 25 | 1 | hiro | # the same distribution terms that you use for the rest of that program. |
| 26 | 1 | hiro | |
| 27 | 1 | hiro | basename="s,^.*/,,g" |
| 28 | 1 | hiro | |
| 29 | 1 | hiro | # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh |
| 30 | 1 | hiro | # is ksh but when the shell is invoked as "sh" and the current value of |
| 31 | 1 | hiro | # the _XPG environment variable is not equal to 1 (one), the special |
| 32 | 1 | hiro | # positional parameter $0, within a function call, is the name of the |
| 33 | 1 | hiro | # function. |
| 34 | 1 | hiro | progpath="$0" |
| 35 | 1 | hiro | |
| 36 | 1 | hiro | # The name of this program: |
| 37 | 1 | hiro | progname=`echo "$progpath" | $SED $basename` |
| 38 | 1 | hiro | modename="$progname" |
| 39 | 1 | hiro | |
| 40 | 1 | hiro | # Global variables: |
| 41 | 1 | hiro | EXIT_SUCCESS=0 |
| 42 | 1 | hiro | EXIT_FAILURE=1 |
| 43 | 1 | hiro | |
| 44 | 1 | hiro | PROGRAM=ltmain.sh |
| 45 | 1 | hiro | PACKAGE=libtool |
| 46 | 2022 | hiro | VERSION="1.5.26 Debian 1.5.26-1ubuntu1" |
| 47 | 2022 | hiro | TIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)" |
| 48 | 1 | hiro | |
| 49 | 2022 | hiro | # Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). |
| 50 | 2022 | hiro | if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
|
| 51 | 2022 | hiro | emulate sh |
| 52 | 2022 | hiro | NULLCMD=: |
| 53 | 2022 | hiro | # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
|
| 54 | 2022 | hiro | # is contrary to our usage. Disable this feature. |
| 55 | 2022 | hiro | alias -g '${1+"$@"}'='"$@"'
|
| 56 | 597 | hiro | setopt NO_GLOB_SUBST |
| 57 | 2022 | hiro | else |
| 58 | 2022 | hiro | case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac |
| 59 | 597 | hiro | fi |
| 60 | 2022 | hiro | BIN_SH=xpg4; export BIN_SH # for Tru64 |
| 61 | 2022 | hiro | DUALCASE=1; export DUALCASE # for MKS sh |
| 62 | 1 | hiro | |
| 63 | 1 | hiro | # Check that we have a working $echo. |
| 64 | 1 | hiro | if test "X$1" = X--no-reexec; then |
| 65 | 1 | hiro | # Discard the --no-reexec flag, and continue. |
| 66 | 1 | hiro | shift |
| 67 | 1 | hiro | elif test "X$1" = X--fallback-echo; then |
| 68 | 1 | hiro | # Avoid inline document here, it may be left over |
| 69 | 1 | hiro | : |
| 70 | 1 | hiro | elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then |
| 71 | 1 | hiro | # Yippee, $echo works! |
| 72 | 1 | hiro | : |
| 73 | 1 | hiro | else |
| 74 | 1 | hiro | # Restart under the correct shell, and then maybe $echo will work. |
| 75 | 1 | hiro | exec $SHELL "$progpath" --no-reexec ${1+"$@"}
|
| 76 | 1 | hiro | fi |
| 77 | 1 | hiro | |
| 78 | 1 | hiro | if test "X$1" = X--fallback-echo; then |
| 79 | 1 | hiro | # used as fallback echo |
| 80 | 1 | hiro | shift |
| 81 | 1 | hiro | cat <<EOF |
| 82 | 1 | hiro | $* |
| 83 | 1 | hiro | EOF |
| 84 | 1 | hiro | exit $EXIT_SUCCESS |
| 85 | 1 | hiro | fi |
| 86 | 1 | hiro | |
| 87 | 1 | hiro | default_mode= |
| 88 | 1 | hiro | help="Try \`$progname --help' for more information." |
| 89 | 1 | hiro | magic="%%%MAGIC variable%%%" |
| 90 | 1 | hiro | mkdir="mkdir" |
| 91 | 1 | hiro | mv="mv -f" |
| 92 | 1 | hiro | rm="rm -f" |
| 93 | 1 | hiro | |
| 94 | 1 | hiro | # Sed substitution that helps us do robust quoting. It backslashifies |
| 95 | 1 | hiro | # metacharacters that are still active within double-quoted strings. |
| 96 | 1 | hiro | Xsed="${SED}"' -e 1s/^X//'
|
| 97 | 1 | hiro | sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' |
| 98 | 1 | hiro | # test EBCDIC or ASCII |
| 99 | 597 | hiro | case `echo X|tr X '\101'` in |
| 100 | 597 | hiro | A) # ASCII based system |
| 101 | 597 | hiro | # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr |
| 102 | 597 | hiro | SP2NL='tr \040 \012' |
| 103 | 597 | hiro | NL2SP='tr \015\012 \040\040' |
| 104 | 1 | hiro | ;; |
| 105 | 597 | hiro | *) # EBCDIC based system |
| 106 | 597 | hiro | SP2NL='tr \100 \n' |
| 107 | 597 | hiro | NL2SP='tr \r\n \100\100' |
| 108 | 1 | hiro | ;; |
| 109 | 1 | hiro | esac |
| 110 | 1 | hiro | |
| 111 | 1 | hiro | # NLS nuisances. |
| 112 | 1 | hiro | # Only set LANG and LC_ALL to C if already set. |
| 113 | 1 | hiro | # These must not be set unconditionally because not all systems understand |
| 114 | 1 | hiro | # e.g. LANG=C (notably SCO). |
| 115 | 1 | hiro | # We save the old values to restore during execute mode. |
| 116 | 2022 | hiro | lt_env= |
| 117 | 2022 | hiro | for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES |
| 118 | 2022 | hiro | do |
| 119 | 2022 | hiro | eval "if test \"\${$lt_var+set}\" = set; then
|
| 120 | 2022 | hiro | save_$lt_var=\$$lt_var |
| 121 | 2022 | hiro | lt_env=\"$lt_var=\$$lt_var \$lt_env\" |
| 122 | 2022 | hiro | $lt_var=C |
| 123 | 2022 | hiro | export $lt_var |
| 124 | 2022 | hiro | fi" |
| 125 | 2022 | hiro | done |
| 126 | 2022 | hiro | |
| 127 | 2022 | hiro | if test -n "$lt_env"; then |
| 128 | 2022 | hiro | lt_env="env $lt_env" |
| 129 | 1 | hiro | fi |
| 130 | 1 | hiro | |
| 131 | 1 | hiro | # Make sure IFS has a sensible default |
| 132 | 597 | hiro | lt_nl=' |
| 133 | 597 | hiro | ' |
| 134 | 597 | hiro | IFS=" $lt_nl" |
| 135 | 1 | hiro | |
| 136 | 1 | hiro | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then |
| 137 | 1 | hiro | $echo "$modename: not configured to build any kind of library" 1>&2 |
| 138 | 1 | hiro | $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 |
| 139 | 1 | hiro | exit $EXIT_FAILURE |
| 140 | 1 | hiro | fi |
| 141 | 1 | hiro | |
| 142 | 1 | hiro | # Global variables. |
| 143 | 1 | hiro | mode=$default_mode |
| 144 | 1 | hiro | nonopt= |
| 145 | 1 | hiro | prev= |
| 146 | 1 | hiro | prevopt= |
| 147 | 1 | hiro | run= |
| 148 | 1 | hiro | show="$echo" |
| 149 | 1 | hiro | show_help= |
| 150 | 1 | hiro | execute_dlfiles= |
| 151 | 879 | hiro | duplicate_deps=no |
| 152 | 879 | hiro | preserve_args= |
| 153 | 1 | hiro | lo2o="s/\\.lo\$/.${objext}/"
|
| 154 | 1 | hiro | o2lo="s/\\.${objext}\$/.lo/"
|
| 155 | 2022 | hiro | extracted_archives= |
| 156 | 2022 | hiro | extracted_serial=0 |
| 157 | 1 | hiro | |
| 158 | 1 | hiro | ##################################### |
| 159 | 1 | hiro | # Shell function definitions: |
| 160 | 1 | hiro | # This seems to be the best place for them |
| 161 | 1 | hiro | |
| 162 | 879 | hiro | # func_mktempdir [string] |
| 163 | 879 | hiro | # Make a temporary directory that won't clash with other running |
| 164 | 879 | hiro | # libtool processes, and avoids race conditions if possible. If |
| 165 | 879 | hiro | # given, STRING is the basename for that directory. |
| 166 | 879 | hiro | func_mktempdir () |
| 167 | 879 | hiro | {
|
| 168 | 879 | hiro | my_template="${TMPDIR-/tmp}/${1-$progname}"
|
| 169 | 879 | hiro | |
| 170 | 879 | hiro | if test "$run" = ":"; then |
| 171 | 879 | hiro | # Return a directory name, but don't create it in dry-run mode |
| 172 | 879 | hiro | my_tmpdir="${my_template}-$$"
|
| 173 | 879 | hiro | else |
| 174 | 879 | hiro | |
| 175 | 879 | hiro | # If mktemp works, use that first and foremost |
| 176 | 879 | hiro | my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
|
| 177 | 879 | hiro | |
| 178 | 879 | hiro | if test ! -d "$my_tmpdir"; then |
| 179 | 879 | hiro | # Failing that, at least try and use $RANDOM to avoid a race |
| 180 | 879 | hiro | my_tmpdir="${my_template}-${RANDOM-0}$$"
|
| 181 | 879 | hiro | |
| 182 | 879 | hiro | save_mktempdir_umask=`umask` |
| 183 | 879 | hiro | umask 0077 |
| 184 | 879 | hiro | $mkdir "$my_tmpdir" |
| 185 | 879 | hiro | umask $save_mktempdir_umask |
| 186 | 879 | hiro | fi |
| 187 | 879 | hiro | |
| 188 | 879 | hiro | # If we're not in dry-run mode, bomb out on failure |
| 189 | 879 | hiro | test -d "$my_tmpdir" || {
|
| 190 | 879 | hiro | $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 |
| 191 | 879 | hiro | exit $EXIT_FAILURE |
| 192 | 879 | hiro | } |
| 193 | 879 | hiro | fi |
| 194 | 879 | hiro | |
| 195 | 879 | hiro | $echo "X$my_tmpdir" | $Xsed |
| 196 | 879 | hiro | } |
| 197 | 879 | hiro | |
| 198 | 879 | hiro | |
| 199 | 1 | hiro | # func_win32_libid arg |
| 200 | 1 | hiro | # return the library type of file 'arg' |
| 201 | 1 | hiro | # |
| 202 | 1 | hiro | # Need a lot of goo to handle *both* DLLs and import libs |
| 203 | 1 | hiro | # Has to be a shell function in order to 'eat' the argument |
| 204 | 1 | hiro | # that is supplied when $file_magic_command is called. |
| 205 | 597 | hiro | func_win32_libid () |
| 206 | 597 | hiro | {
|
| 207 | 1 | hiro | win32_libid_type="unknown" |
| 208 | 1 | hiro | win32_fileres=`file -L $1 2>/dev/null` |
| 209 | 1 | hiro | case $win32_fileres in |
| 210 | 1 | hiro | *ar\ archive\ import\ library*) # definitely import |
| 211 | 1 | hiro | win32_libid_type="x86 archive import" |
| 212 | 1 | hiro | ;; |
| 213 | 1 | hiro | *ar\ archive*) # could be an import, or static |
| 214 | 1 | hiro | if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ |
| 215 | 1 | hiro | $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then |
| 216 | 1 | hiro | win32_nmres=`eval $NM -f posix -A $1 | \ |
| 217 | 2022 | hiro | $SED -n -e '1,100{
|
| 218 | 2022 | hiro | / I /{
|
| 219 | 2022 | hiro | s,.*,import, |
| 220 | 2022 | hiro | p |
| 221 | 2022 | hiro | q |
| 222 | 2022 | hiro | } |
| 223 | 2022 | hiro | }'` |
| 224 | 879 | hiro | case $win32_nmres in |
| 225 | 879 | hiro | import*) win32_libid_type="x86 archive import";; |
| 226 | 879 | hiro | *) win32_libid_type="x86 archive static";; |
| 227 | 879 | hiro | esac |
| 228 | 1 | hiro | fi |
| 229 | 1 | hiro | ;; |
| 230 | 1 | hiro | *DLL*) |
| 231 | 1 | hiro | win32_libid_type="x86 DLL" |
| 232 | 1 | hiro | ;; |
| 233 | 1 | hiro | *executable*) # but shell scripts are "executable" too... |
| 234 | 1 | hiro | case $win32_fileres in |
| 235 | 1 | hiro | *MS\ Windows\ PE\ Intel*) |
| 236 | 1 | hiro | win32_libid_type="x86 DLL" |
| 237 | 1 | hiro | ;; |
| 238 | 1 | hiro | esac |
| 239 | 1 | hiro | ;; |
| 240 | 1 | hiro | esac |
| 241 | 1 | hiro | $echo $win32_libid_type |
| 242 | 1 | hiro | } |
| 243 | 1 | hiro | |
| 244 | 1 | hiro | |
| 245 | 1 | hiro | # func_infer_tag arg |
| 246 | 1 | hiro | # Infer tagged configuration to use if any are available and |
| 247 | 1 | hiro | # if one wasn't chosen via the "--tag" command line option. |
| 248 | 1 | hiro | # Only attempt this if the compiler in the base compile |
| 249 | 1 | hiro | # command doesn't match the default compiler. |
| 250 | 1 | hiro | # arg is usually of the form 'gcc ...' |
| 251 | 597 | hiro | func_infer_tag () |
| 252 | 597 | hiro | {
|
| 253 | 1 | hiro | if test -n "$available_tags" && test -z "$tagname"; then |
| 254 | 1 | hiro | CC_quoted= |
| 255 | 1 | hiro | for arg in $CC; do |
| 256 | 1 | hiro | case $arg in |
| 257 | 1 | hiro | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
| 258 | 1 | hiro | arg="\"$arg\"" |
| 259 | 1 | hiro | ;; |
| 260 | 1 | hiro | esac |
| 261 | 1 | hiro | CC_quoted="$CC_quoted $arg" |
| 262 | 1 | hiro | done |
| 263 | 1 | hiro | case $@ in |
| 264 | 1 | hiro | # Blanks in the command may have been stripped by the calling shell, |
| 265 | 1 | hiro | # but not from the CC environment variable when configure was run. |
| 266 | 1 | hiro | " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; |
| 267 | 1 | hiro | # Blanks at the start of $base_compile will cause this to fail |
| 268 | 1 | hiro | # if we don't check for them as well. |
| 269 | 1 | hiro | *) |
| 270 | 1 | hiro | for z in $available_tags; do |
| 271 | 1 | hiro | if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then |
| 272 | 1 | hiro | # Evaluate the configuration. |
| 273 | 1 | hiro | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
|
| 274 | 1 | hiro | CC_quoted= |
| 275 | 1 | hiro | for arg in $CC; do |
| 276 | 1 | hiro | # Double-quote args containing other shell metacharacters. |
| 277 | 1 | hiro | case $arg in |
| 278 | 1 | hiro | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
| 279 | 1 | hiro | arg="\"$arg\"" |
| 280 | 1 | hiro | ;; |
| 281 | 1 | hiro | esac |
| 282 | 1 | hiro | CC_quoted="$CC_quoted $arg" |
| 283 | 1 | hiro | done |
| 284 | 1 | hiro | case "$@ " in |
| 285 | 1 | hiro | " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) |
| 286 | 1 | hiro | # The compiler in the base compile command matches |
| 287 | 1 | hiro | # the one in the tagged configuration. |
| 288 | 1 | hiro | # Assume this is the tagged configuration we want. |
| 289 | 1 | hiro | tagname=$z |
| 290 | 1 | hiro | break |
| 291 | 1 | hiro | ;; |
| 292 | 1 | hiro | esac |
| 293 | 1 | hiro | fi |
| 294 | 1 | hiro | done |
| 295 | 1 | hiro | # If $tagname still isn't set, then no tagged configuration |
| 296 | 1 | hiro | # was found and let the user know that the "--tag" command |
| 297 | 1 | hiro | # line option must be used. |
| 298 | 1 | hiro | if test -z "$tagname"; then |
| 299 | 1 | hiro | $echo "$modename: unable to infer tagged configuration" |
| 300 | 1 | hiro | $echo "$modename: specify a tag with \`--tag'" 1>&2 |
| 301 | 1 | hiro | exit $EXIT_FAILURE |
| 302 | 1 | hiro | # else |
| 303 | 1 | hiro | # $echo "$modename: using $tagname tagged configuration" |
| 304 | 1 | hiro | fi |
| 305 | 1 | hiro | ;; |
| 306 | 1 | hiro | esac |
| 307 | 1 | hiro | fi |
| 308 | 1 | hiro | } |
| 309 | 597 | hiro | |
| 310 | 597 | hiro | |
| 311 | 597 | hiro | # func_extract_an_archive dir oldlib |
| 312 | 597 | hiro | func_extract_an_archive () |
| 313 | 597 | hiro | {
|
| 314 | 597 | hiro | f_ex_an_ar_dir="$1"; shift |
| 315 | 597 | hiro | f_ex_an_ar_oldlib="$1" |
| 316 | 597 | hiro | |
| 317 | 597 | hiro | $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" |
| 318 | 597 | hiro | $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? |
| 319 | 597 | hiro | if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then |
| 320 | 597 | hiro | : |
| 321 | 597 | hiro | else |
| 322 | 597 | hiro | $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 |
| 323 | 597 | hiro | exit $EXIT_FAILURE |
| 324 | 597 | hiro | fi |
| 325 | 597 | hiro | } |
| 326 | 597 | hiro | |
| 327 | 597 | hiro | # func_extract_archives gentop oldlib ... |
| 328 | 597 | hiro | func_extract_archives () |
| 329 | 597 | hiro | {
|
| 330 | 597 | hiro | my_gentop="$1"; shift |
| 331 | 597 | hiro | my_oldlibs=${1+"$@"}
|
| 332 | 597 | hiro | my_oldobjs="" |
| 333 | 597 | hiro | my_xlib="" |
| 334 | 597 | hiro | my_xabs="" |
| 335 | 597 | hiro | my_xdir="" |
| 336 | 597 | hiro | my_status="" |
| 337 | 597 | hiro | |
| 338 | 597 | hiro | $show "${rm}r $my_gentop"
|
| 339 | 597 | hiro | $run ${rm}r "$my_gentop"
|
| 340 | 597 | hiro | $show "$mkdir $my_gentop" |
| 341 | 597 | hiro | $run $mkdir "$my_gentop" |
| 342 | 597 | hiro | my_status=$? |
| 343 | 597 | hiro | if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then |
| 344 | 597 | hiro | exit $my_status |
| 345 | 597 | hiro | fi |
| 346 | 597 | hiro | |
| 347 | 597 | hiro | for my_xlib in $my_oldlibs; do |
| 348 | 597 | hiro | # Extract the objects. |
| 349 | 597 | hiro | case $my_xlib in |
| 350 | 597 | hiro | [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; |
| 351 | 597 | hiro | *) my_xabs=`pwd`"/$my_xlib" ;; |
| 352 | 597 | hiro | esac |
| 353 | 597 | hiro | my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` |
| 354 | 2022 | hiro | my_xlib_u=$my_xlib |
| 355 | 2022 | hiro | while :; do |
| 356 | 2022 | hiro | case " $extracted_archives " in |
| 357 | 2022 | hiro | *" $my_xlib_u "*) |
| 358 | 2022 | hiro | extracted_serial=`expr $extracted_serial + 1` |
| 359 | 2022 | hiro | my_xlib_u=lt$extracted_serial-$my_xlib ;; |
| 360 | 2022 | hiro | *) break ;; |
| 361 | 2022 | hiro | esac |
| 362 | 2022 | hiro | done |
| 363 | 2022 | hiro | extracted_archives="$extracted_archives $my_xlib_u" |
| 364 | 2022 | hiro | my_xdir="$my_gentop/$my_xlib_u" |
| 365 | 597 | hiro | |
| 366 | 597 | hiro | $show "${rm}r $my_xdir"
|
| 367 | 597 | hiro | $run ${rm}r "$my_xdir"
|
| 368 | 597 | hiro | $show "$mkdir $my_xdir" |
| 369 | 597 | hiro | $run $mkdir "$my_xdir" |
| 370 | 879 | hiro | exit_status=$? |
| 371 | 879 | hiro | if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then |
| 372 | 879 | hiro | exit $exit_status |
| 373 | 597 | hiro | fi |
| 374 | 597 | hiro | case $host in |
| 375 | 597 | hiro | *-darwin*) |
| 376 | 597 | hiro | $show "Extracting $my_xabs" |
| 377 | 597 | hiro | # Do not bother doing anything if just a dry run |
| 378 | 597 | hiro | if test -z "$run"; then |
| 379 | 597 | hiro | darwin_orig_dir=`pwd` |
| 380 | 597 | hiro | cd $my_xdir || exit $? |
| 381 | 597 | hiro | darwin_archive=$my_xabs |
| 382 | 597 | hiro | darwin_curdir=`pwd` |
| 383 | 597 | hiro | darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` |
| 384 | 597 | hiro | darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` |
| 385 | 597 | hiro | if test -n "$darwin_arches"; then |
| 386 | 597 | hiro | darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` |
| 387 | 597 | hiro | darwin_arch= |
| 388 | 597 | hiro | $show "$darwin_base_archive has multiple architectures $darwin_arches" |
| 389 | 597 | hiro | for darwin_arch in $darwin_arches ; do |
| 390 | 597 | hiro | mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
|
| 391 | 597 | hiro | lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
|
| 392 | 597 | hiro | cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
|
| 393 | 597 | hiro | func_extract_an_archive "`pwd`" "${darwin_base_archive}"
|
| 394 | 597 | hiro | cd "$darwin_curdir" |
| 395 | 597 | hiro | $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
|
| 396 | 597 | hiro | done # $darwin_arches |
| 397 | 597 | hiro | ## Okay now we have a bunch of thin objects, gotta fatten them up :) |
| 398 | 597 | hiro | darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` |
| 399 | 597 | hiro | darwin_file= |
| 400 | 597 | hiro | darwin_files= |
| 401 | 597 | hiro | for darwin_file in $darwin_filelist; do |
| 402 | 597 | hiro | darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` |
| 403 | 597 | hiro | lipo -create -output "$darwin_file" $darwin_files |
| 404 | 597 | hiro | done # $darwin_filelist |
| 405 | 597 | hiro | ${rm}r unfat-$$
|
| 406 | 597 | hiro | cd "$darwin_orig_dir" |
| 407 | 597 | hiro | else |
| 408 | 597 | hiro | cd "$darwin_orig_dir" |
| 409 | 597 | hiro | func_extract_an_archive "$my_xdir" "$my_xabs" |
| 410 | 597 | hiro | fi # $darwin_arches |
| 411 | 597 | hiro | fi # $run |
| 412 | 597 | hiro | ;; |
| 413 | 597 | hiro | *) |
| 414 | 597 | hiro | func_extract_an_archive "$my_xdir" "$my_xabs" |
| 415 | 597 | hiro | ;; |
| 416 | 597 | hiro | esac |
| 417 | 597 | hiro | my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` |
| 418 | 597 | hiro | done |
| 419 | 597 | hiro | func_extract_archives_result="$my_oldobjs" |
| 420 | 597 | hiro | } |
| 421 | 1 | hiro | # End of Shell function definitions |
| 422 | 1 | hiro | ##################################### |
| 423 | 1 | hiro | |
| 424 | 1 | hiro | # Darwin sucks |
| 425 | 1 | hiro | eval std_shrext=\"$shrext_cmds\" |
| 426 | 1 | hiro | |
| 427 | 879 | hiro | disable_libs=no |
| 428 | 879 | hiro | |
| 429 | 1 | hiro | # Parse our command line options once, thoroughly. |
| 430 | 1 | hiro | while test "$#" -gt 0 |
| 431 | 1 | hiro | do |
| 432 | 1 | hiro | arg="$1" |
| 433 | 1 | hiro | shift |
| 434 | 1 | hiro | |
| 435 | 1 | hiro | case $arg in |
| 436 | 1 | hiro | -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; |
| 437 | 1 | hiro | *) optarg= ;; |
| 438 | 1 | hiro | esac |
| 439 | 1 | hiro | |
| 440 | 1 | hiro | # If the previous option needs an argument, assign it. |
| 441 | 1 | hiro | if test -n "$prev"; then |
| 442 | 1 | hiro | case $prev in |
| 443 | 1 | hiro | execute_dlfiles) |
| 444 | 1 | hiro | execute_dlfiles="$execute_dlfiles $arg" |
| 445 | 1 | hiro | ;; |
| 446 | 1 | hiro | tag) |
| 447 | 1 | hiro | tagname="$arg" |
| 448 | 1 | hiro | preserve_args="${preserve_args}=$arg"
|
| 449 | 1 | hiro | |
| 450 | 1 | hiro | # Check whether tagname contains only valid characters |
| 451 | 1 | hiro | case $tagname in |
| 452 | 1 | hiro | *[!-_A-Za-z0-9,/]*) |
| 453 | 1 | hiro | $echo "$progname: invalid tag name: $tagname" 1>&2 |
| 454 | 1 | hiro | exit $EXIT_FAILURE |
| 455 | 1 | hiro | ;; |
| 456 | 1 | hiro | esac |
| 457 | 1 | hiro | |
| 458 | 1 | hiro | case $tagname in |
| 459 | 1 | hiro | CC) |
| 460 | 1 | hiro | # Don't test for the "default" C tag, as we know, it's there, but |
| 461 | 1 | hiro | # not specially marked. |
| 462 | 1 | hiro | ;; |
| 463 | 1 | hiro | *) |
| 464 | 1 | hiro | if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then |
| 465 | 1 | hiro | taglist="$taglist $tagname" |
| 466 | 1 | hiro | # Evaluate the configuration. |
| 467 | 1 | hiro | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
|
| 468 | 1 | hiro | else |
| 469 | 1 | hiro | $echo "$progname: ignoring unknown tag $tagname" 1>&2 |
| 470 | 1 | hiro | fi |
| 471 | 1 | hiro | ;; |
| 472 | 1 | hiro | esac |
| 473 | 1 | hiro | ;; |
| 474 | 1 | hiro | *) |
| 475 | 1 | hiro | eval "$prev=\$arg" |
| 476 | 1 | hiro | ;; |
| 477 | 1 | hiro | esac |
| 478 | 1 | hiro | |
| 479 | 1 | hiro | prev= |
| 480 | 1 | hiro | prevopt= |
| 481 | 1 | hiro | continue |
| 482 | 1 | hiro | fi |
| 483 | 1 | hiro | |
| 484 | 1 | hiro | # Have we seen a non-optional argument yet? |
| 485 | 1 | hiro | case $arg in |
| 486 | 1 | hiro | --help) |
| 487 | 1 | hiro | show_help=yes |
| 488 | 1 | hiro | ;; |
| 489 | 1 | hiro | |
| 490 | 1 | hiro | --version) |
| 491 | 2022 | hiro | echo "\ |
| 492 | 2022 | hiro | $PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP |
| 493 | 2022 | hiro | |
| 494 | 2022 | hiro | Copyright (C) 2008 Free Software Foundation, Inc. |
| 495 | 2022 | hiro | This is free software; see the source for copying conditions. There is NO |
| 496 | 2022 | hiro | warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." |
| 497 | 597 | hiro | exit $? |
| 498 | 1 | hiro | ;; |
| 499 | 1 | hiro | |
| 500 | 1 | hiro | --config) |
| 501 | 1 | hiro | ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
|
| 502 | 1 | hiro | # Now print the configurations for the tags. |
| 503 | 1 | hiro | for tagname in $taglist; do |
| 504 | 1 | hiro | ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
|
| 505 | 1 | hiro | done |
| 506 | 597 | hiro | exit $? |
| 507 | 1 | hiro | ;; |
| 508 | 1 | hiro | |
| 509 | 1 | hiro | --debug) |
| 510 | 1 | hiro | $echo "$progname: enabling shell trace mode" |
| 511 | 1 | hiro | set -x |
| 512 | 1 | hiro | preserve_args="$preserve_args $arg" |
| 513 | 1 | hiro | ;; |
| 514 | 1 | hiro | |
| 515 | 1 | hiro | --dry-run | -n) |
| 516 | 1 | hiro | run=: |
| 517 | 1 | hiro | ;; |
| 518 | 1 | hiro | |
| 519 | 1 | hiro | --features) |
| 520 | 1 | hiro | $echo "host: $host" |
| 521 | 1 | hiro | if test "$build_libtool_libs" = yes; then |
| 522 | 1 | hiro | $echo "enable shared libraries" |
| 523 | 1 | hiro | else |
| 524 | 1 | hiro | $echo "disable shared libraries" |
| 525 | 1 | hiro | fi |
| 526 | 1 | hiro | if test "$build_old_libs" = yes; then |
| 527 | 1 | hiro | $echo "enable static libraries" |
| 528 | 1 | hiro | else |
| 529 | 1 | hiro | $echo "disable static libraries" |
| 530 | 1 | hiro | fi |
| 531 | 597 | hiro | exit $? |
| 532 | 1 | hiro | ;; |
| 533 | 1 | hiro | |
| 534 | 1 | hiro | --finish) mode="finish" ;; |
| 535 | 1 | hiro | |
| 536 | 1 | hiro | --mode) prevopt="--mode" prev=mode ;; |
| 537 | 1 | hiro | --mode=*) mode="$optarg" ;; |
| 538 | 1 | hiro | |
| 539 | 1 | hiro | --preserve-dup-deps) duplicate_deps="yes" ;; |
| 540 | 1 | hiro | |
| 541 | 1 | hiro | --quiet | --silent) |
| 542 | 1 | hiro | show=: |
| 543 | 1 | hiro | preserve_args="$preserve_args $arg" |
| 544 | 1 | hiro | ;; |
| 545 | 1 | hiro | |
| 546 | 879 | hiro | --tag) |
| 547 | 879 | hiro | prevopt="--tag" |
| 548 | 879 | hiro | prev=tag |
| 549 | 879 | hiro | preserve_args="$preserve_args --tag" |
| 550 | 879 | hiro | ;; |
| 551 | 1 | hiro | --tag=*) |
| 552 | 1 | hiro | set tag "$optarg" ${1+"$@"}
|
| 553 | 1 | hiro | shift |
| 554 | 1 | hiro | prev=tag |
| 555 | 1 | hiro | preserve_args="$preserve_args --tag" |
| 556 | 1 | hiro | ;; |
| 557 | 1 | hiro | |
| 558 | 1 | hiro | -dlopen) |
| 559 | 1 | hiro | prevopt="-dlopen" |
| 560 | 1 | hiro | prev=execute_dlfiles |
| 561 | 1 | hiro | ;; |
| 562 | 1 | hiro | |
| 563 | 1 | hiro | -*) |
| 564 | 1 | hiro | $echo "$modename: unrecognized option \`$arg'" 1>&2 |
| 565 | 1 | hiro | $echo "$help" 1>&2 |
| 566 | 1 | hiro | exit $EXIT_FAILURE |
| 567 | 1 | hiro | ;; |
| 568 | 1 | hiro | |
| 569 | 1 | hiro | *) |
| 570 | 1 | hiro | nonopt="$arg" |
| 571 | 1 | hiro | break |
| 572 | 1 | hiro | ;; |
| 573 | 1 | hiro | esac |
| 574 | 1 | hiro | done |
| 575 | 1 | hiro | |
| 576 | 1 | hiro | if test -n "$prevopt"; then |
| 577 | 1 | hiro | $echo "$modename: option \`$prevopt' requires an argument" 1>&2 |
| 578 | 1 | hiro | $echo "$help" 1>&2 |
| 579 | 1 | hiro | exit $EXIT_FAILURE |
| 580 | 1 | hiro | fi |
| 581 | 1 | hiro | |
| 582 | 879 | hiro | case $disable_libs in |
| 583 | 879 | hiro | no) |
| 584 | 879 | hiro | ;; |
| 585 | 879 | hiro | shared) |
| 586 | 879 | hiro | build_libtool_libs=no |
| 587 | 879 | hiro | build_old_libs=yes |
| 588 | 879 | hiro | ;; |
| 589 | 879 | hiro | static) |
| 590 | 879 | hiro | build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` |
| 591 | 879 | hiro | ;; |
| 592 | 879 | hiro | esac |
| 593 | 879 | hiro | |
| 594 | 1 | hiro | # If this variable is set in any of the actions, the command in it |
| 595 | 1 | hiro | # will be execed at the end. This prevents here-documents from being |
| 596 | 1 | hiro | # left over by shells. |
| 597 | 1 | hiro | exec_cmd= |
| 598 | 1 | hiro | |
| 599 | 1 | hiro | if test -z "$show_help"; then |
| 600 | 1 | hiro | |
| 601 | 1 | hiro | # Infer the operation mode. |
| 602 | 1 | hiro | if test -z "$mode"; then |
| 603 | 1 | hiro | $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 |
| 604 | 597 | hiro | $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 |
| 605 | 1 | hiro | case $nonopt in |
| 606 | 1 | hiro | *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) |
| 607 | 1 | hiro | mode=link |
| 608 | 1 | hiro | for arg |
| 609 | 1 | hiro | do |
| 610 | 1 | hiro | case $arg in |
| 611 | 1 | hiro | -c) |
| 612 | 1 | hiro | mode=compile |
| 613 | 1 | hiro | break |
| 614 | 1 | hiro | ;; |
| 615 | 1 | hiro | esac |
| 616 | 1 | hiro | done |
| 617 | 1 | hiro | ;; |
| 618 | 1 | hiro | *db | *dbx | *strace | *truss) |
| 619 | 1 | hiro | mode=execute |
| 620 | 1 | hiro | ;; |
| 621 | 1 | hiro | *install*|cp|mv) |
| 622 | 1 | hiro | mode=install |
| 623 | 1 | hiro | ;; |
| 624 | 1 | hiro | *rm) |
| 625 | 1 | hiro | mode=uninstall |
| 626 | 1 | hiro | ;; |
| 627 | 1 | hiro | *) |
| 628 | 1 | hiro | # If we have no mode, but dlfiles were specified, then do execute mode. |
| 629 | 1 | hiro | test -n "$execute_dlfiles" && mode=execute |
| 630 | 1 | hiro | |
| 631 | 1 | hiro | # Just use the default operation mode. |
| 632 | 1 | hiro | if test -z "$mode"; then |
| 633 | 1 | hiro | if test -n "$nonopt"; then |
| 634 | 1 | hiro | $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 |
| 635 | 1 | hiro | else |
| 636 | 1 | hiro | $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 |
| 637 | 1 | hiro | fi |
| 638 | 1 | hiro | fi |
| 639 | 1 | hiro | ;; |
| 640 | 1 | hiro | esac |
| 641 | 1 | hiro | fi |
| 642 | 1 | hiro | |
| 643 | 1 | hiro | # Only execute mode is allowed to have -dlopen flags. |
| 644 | 1 | hiro | if test -n "$execute_dlfiles" && test "$mode" != execute; then |
| 645 | 1 | hiro | $echo "$modename: unrecognized option \`-dlopen'" 1>&2 |
| 646 | 1 | hiro | $echo "$help" 1>&2 |
| 647 | 1 | hiro | exit $EXIT_FAILURE |
| 648 | 1 | hiro | fi |
| 649 | 1 | hiro | |
| 650 | 1 | hiro | # Change the help message to a mode-specific one. |
| 651 | 1 | hiro | generic_help="$help" |
| 652 | 1 | hiro | help="Try \`$modename --help --mode=$mode' for more information." |
| 653 | 1 | hiro | |
| 654 | 1 | hiro | # These modes are in order of execution frequency so that they run quickly. |
| 655 | 1 | hiro | case $mode in |
| 656 | 1 | hiro | # libtool compile mode |
| 657 | 1 | hiro | compile) |
| 658 | 1 | hiro | modename="$modename: compile" |
| 659 | 1 | hiro | # Get the compilation command and the source file. |
| 660 | 1 | hiro | base_compile= |
| 661 | 1 | hiro | srcfile="$nonopt" # always keep a non-empty value in "srcfile" |
| 662 | 1 | hiro | suppress_opt=yes |
| 663 | 1 | hiro | suppress_output= |
| 664 | 1 | hiro | arg_mode=normal |
| 665 | 1 | hiro | libobj= |
| 666 | 1 | hiro | later= |
| 667 | 1 | hiro | |
| 668 | 1 | hiro | for arg |
| 669 | 1 | hiro | do |
| 670 | 597 | hiro | case $arg_mode in |
| 671 | 1 | hiro | arg ) |
| 672 | 1 | hiro | # do not "continue". Instead, add this to base_compile |
| 673 | 1 | hiro | lastarg="$arg" |
| 674 | 1 | hiro | arg_mode=normal |
| 675 | 1 | hiro | ;; |
| 676 | 1 | hiro | |
| 677 | 1 | hiro | target ) |
| 678 | 1 | hiro | libobj="$arg" |
| 679 | 1 | hiro | arg_mode=normal |
| 680 | 1 | hiro | continue |
| 681 | 1 | hiro | ;; |
| 682 | 1 | hiro | |
| 683 | 1 | hiro | normal ) |
| 684 | 1 | hiro | # Accept any command-line options. |
| 685 | 1 | hiro | case $arg in |
| 686 | 1 | hiro | -o) |
| 687 | 1 | hiro | if test -n "$libobj" ; then |
| 688 | 1 | hiro | $echo "$modename: you cannot specify \`-o' more than once" 1>&2 |
| 689 | 1 | hiro | exit $EXIT_FAILURE |
| 690 | 1 | hiro | fi |
| 691 | 1 | hiro | arg_mode=target |
| 692 | 1 | hiro | continue |
| 693 | 1 | hiro | ;; |
| 694 | 1 | hiro | |
| 695 | 1 | hiro | -static | -prefer-pic | -prefer-non-pic) |
| 696 | 1 | hiro | later="$later $arg" |
| 697 | 1 | hiro | continue |
| 698 | 1 | hiro | ;; |
| 699 | 1 | hiro | |
| 700 | 1 | hiro | -no-suppress) |
| 701 | 1 | hiro | suppress_opt=no |
| 702 | 1 | hiro | continue |
| 703 | 1 | hiro | ;; |
| 704 | 1 | hiro | |
| 705 | 1 | hiro | -Xcompiler) |
| 706 | 1 | hiro | arg_mode=arg # the next one goes into the "base_compile" arg list |
| 707 | 1 | hiro | continue # The current "srcfile" will either be retained or |
| 708 | 1 | hiro | ;; # replaced later. I would guess that would be a bug. |
| 709 | 1 | hiro | |
| 710 | 1 | hiro | -Wc,*) |
| 711 | 1 | hiro | args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` |
| 712 | 1 | hiro | lastarg= |
| 713 | 1 | hiro | save_ifs="$IFS"; IFS=',' |
| 714 | 1 | hiro | for arg in $args; do |
| 715 | 1 | hiro | IFS="$save_ifs" |
| 716 | 1 | hiro | |
| 717 | 1 | hiro | # Double-quote args containing other shell metacharacters. |
| 718 | 1 | hiro | # Many Bourne shells cannot handle close brackets correctly |
| 719 | 1 | hiro | # in scan sets, so we specify it separately. |
| 720 | 1 | hiro | case $arg in |
| 721 | 1 | hiro | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
| 722 | 1 | hiro | arg="\"$arg\"" |
| 723 | 1 | hiro | ;; |
| 724 | 1 | hiro | esac |
| 725 | 1 | hiro | lastarg="$lastarg $arg" |
| 726 | 1 | hiro | done |
| 727 | 1 | hiro | IFS="$save_ifs" |
| 728 | 1 | hiro | lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` |
| 729 | 1 | hiro | |
| 730 | 1 | hiro | # Add the arguments to base_compile. |
| 731 | 1 | hiro | base_compile="$base_compile $lastarg" |
| 732 | 1 | hiro | continue |
| 733 | 1 | hiro | ;; |
| 734 | 1 | hiro | |
| 735 | 1 | hiro | * ) |
| 736 | 1 | hiro | # Accept the current argument as the source file. |
| 737 | 1 | hiro | # The previous "srcfile" becomes the current argument. |
| 738 | 1 | hiro | # |
| 739 | 1 | hiro | lastarg="$srcfile" |
| 740 | 1 | hiro | srcfile="$arg" |
| 741 | 1 | hiro | ;; |
| 742 | 1 | hiro | esac # case $arg |
| 743 | 1 | hiro | ;; |
| 744 | 1 | hiro | esac # case $arg_mode |
| 745 | 1 | hiro | |
| 746 | 1 | hiro | # Aesthetically quote the previous argument. |
| 747 | 1 | hiro | lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` |
| 748 | 1 | hiro | |
| 749 | 1 | hiro | case $lastarg in |
| 750 | 1 | hiro | # Double-quote args containing other shell metacharacters. |
| 751 | 1 | hiro | # Many Bourne shells cannot handle close brackets correctly |
| 752 | 597 | hiro | # in scan sets, and some SunOS ksh mistreat backslash-escaping |
| 753 | 597 | hiro | # in scan sets (worked around with variable expansion), |
| 754 | 597 | hiro | # and furthermore cannot handle '|' '&' '(' ')' in scan sets
|
| 755 | 597 | hiro | # at all, so we specify them separately. |
| 756 | 1 | hiro | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
| 757 | 1 | hiro | lastarg="\"$lastarg\"" |
| 758 | 1 | hiro | ;; |
| 759 | 1 | hiro | esac |
| 760 | 1 | hiro | |
| 761 | 1 | hiro | base_compile="$base_compile $lastarg" |
| 762 | 1 | hiro | done # for arg |
| 763 | 1 | hiro | |
| 764 | 1 | hiro | case $arg_mode in |
| 765 | 1 | hiro | arg) |
| 766 | 1 | hiro | $echo "$modename: you must specify an argument for -Xcompile" |
| 767 | 1 | hiro | exit $EXIT_FAILURE |
| 768 | 1 | hiro | ;; |
| 769 | 1 | hiro | target) |
| 770 | 1 | hiro | $echo "$modename: you must specify a target with \`-o'" 1>&2 |
| 771 | 1 | hiro | exit $EXIT_FAILURE |
| 772 | 1 | hiro | ;; |
| 773 | 1 | hiro | *) |
| 774 | 1 | hiro | # Get the name of the library object. |
| 775 | 1 | hiro | [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` |
| 776 | 1 | hiro | ;; |
| 777 | 1 | hiro | esac |
| 778 | 1 | hiro | |
| 779 | 1 | hiro | # Recognize several different file suffixes. |
| 780 | 1 | hiro | # If the user specifies -o file.o, it is replaced with file.lo |
| 781 | 1 | hiro | xform='[cCFSifmso]' |
| 782 | 1 | hiro | case $libobj in |
| 783 | 1 | hiro | *.ada) xform=ada ;; |
| 784 | 1 | hiro | *.adb) xform=adb ;; |
| 785 | 1 | hiro | *.ads) xform=ads ;; |
| 786 | 1 | hiro | *.asm) xform=asm ;; |
| 787 | 1 | hiro | *.c++) xform=c++ ;; |
| 788 | 1 | hiro | *.cc) xform=cc ;; |
| 789 | 1 | hiro | *.ii) xform=ii ;; |
| 790 | 1 | hiro | *.class) xform=class ;; |
| 791 | 1 | hiro | *.cpp) xform=cpp ;; |
| 792 | 1 | hiro | *.cxx) xform=cxx ;; |
| 793 | 2022 | hiro | *.[fF][09]?) xform=[fF][09]. ;; |
| 794 | 1 | hiro | *.for) xform=for ;; |
| 795 | 1 | hiro | *.java) xform=java ;; |
| 796 | 2022 | hiro | *.obj) xform=obj ;; |
| 797 | 2022 | hiro | *.sx) xform=sx ;; |
| 798 | 1 | hiro | esac |
| 799 | 1 | hiro | |
| 800 | 1 | hiro | libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` |
| 801 | 1 | hiro | |
| 802 | 1 | hiro | case $libobj in |
| 803 | 1 | hiro | *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; |
| 804 | 1 | hiro | *) |
| 805 | 1 | hiro | $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 |
| 806 | 1 | hiro | exit $EXIT_FAILURE |
| 807 | 1 | hiro | ;; |
| 808 | 1 | hiro | esac |
| 809 | 1 | hiro | |
| 810 | 1 | hiro | func_infer_tag $base_compile |
| 811 | 1 | hiro | |
| 812 | 1 | hiro | for arg in $later; do |
| 813 | 1 | hiro | case $arg in |
| 814 | 1 | hiro | -static) |
| 815 | 1 | hiro | build_old_libs=yes |
| 816 | 1 | hiro | continue |
| 817 | 1 | hiro | ;; |
| 818 | 1 | hiro | |
| 819 | 1 | hiro | -prefer-pic) |
| 820 | 1 | hiro | pic_mode=yes |
| 821 | 1 | hiro | continue |
| 822 | 1 | hiro | ;; |
| 823 | 1 | hiro | |
| 824 | 1 | hiro | -prefer-non-pic) |
| 825 | 1 | hiro | pic_mode=no |
| 826 | 1 | hiro | continue |
| 827 | 1 | hiro | ;; |
| 828 | 1 | hiro | esac |
| 829 | 1 | hiro | done |
| 830 | 1 | hiro | |
| 831 | 597 | hiro | qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` |
| 832 | 597 | hiro | case $qlibobj in |
| 833 | 597 | hiro | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
| 834 | 597 | hiro | qlibobj="\"$qlibobj\"" ;; |
| 835 | 597 | hiro | esac |
| 836 | 597 | hiro | test "X$libobj" != "X$qlibobj" \ |
| 837 | 597 | hiro | && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
|
| 838 | 597 | hiro | && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." |
| 839 | 1 | hiro | objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` |
| 840 | 1 | hiro | xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` |
| 841 | 1 | hiro | if test "X$xdir" = "X$obj"; then |
| 842 | 1 | hiro | xdir= |
| 843 | 1 | hiro | else |
| 844 | 1 | hiro | xdir=$xdir/ |
| 845 | 1 | hiro | fi |
| 846 | 1 | hiro | lobj=${xdir}$objdir/$objname
|
| 847 | 1 | hiro | |
| 848 | 1 | hiro | if test -z "$base_compile"; then |
| 849 | 1 | hiro | $echo "$modename: you must specify a compilation command" 1>&2 |
| 850 | 1 | hiro | $echo "$help" 1>&2 |
| 851 | 1 | hiro | exit $EXIT_FAILURE |
| 852 | 1 | hiro | fi |
| 853 | 1 | hiro | |
| 854 | 1 | hiro | # Delete any leftover library objects. |
| 855 | 1 | hiro | if test "$build_old_libs" = yes; then |
| 856 | 1 | hiro | removelist="$obj $lobj $libobj ${libobj}T"
|
| 857 | 1 | hiro | else |
| 858 | 1 | hiro | removelist="$lobj $libobj ${libobj}T"
|
| 859 | 1 | hiro | fi |
| 860 | 1 | hiro | |
| 861 | 1 | hiro | $run $rm $removelist |
| 862 | 1 | hiro | trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 |
| 863 | 1 | hiro | |
| 864 | 1 | hiro | # On Cygwin there's no "real" PIC flag so we must build both object types |
| 865 | 1 | hiro | case $host_os in |
| 866 | 1 | hiro | cygwin* | mingw* | pw32* | os2*) |
| 867 | 1 | hiro | pic_mode=default |
| 868 | 1 | hiro | ;; |
| 869 | 1 | hiro | esac |
| 870 | 1 | hiro | if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then |
| 871 | 1 | hiro | # non-PIC code in shared libraries is not supported |
| 872 | 1 | hiro | pic_mode=default |
| 873 | 1 | hiro | fi |
| 874 | 1 | hiro | |
| 875 | 1 | hiro | # Calculate the filename of the output object if compiler does |
| 876 | 1 | hiro | # not support -o with -c |
| 877 | 1 | hiro | if test "$compiler_c_o" = no; then |
| 878 | 1 | hiro | output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
|
| 879 | 1 | hiro | lockfile="$output_obj.lock" |
| 880 | 1 | hiro | removelist="$removelist $output_obj $lockfile" |
| 881 | 1 | hiro | trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 |
| 882 | 1 | hiro | else |
| 883 | 1 | hiro | output_obj= |
| 884 | 1 | hiro | need_locks=no |
| 885 | 1 | hiro | lockfile= |
| 886 | 1 | hiro | fi |
| 887 | 1 | hiro | |
| 888 | 1 | hiro | # Lock this critical section if it is needed |
| 889 | 1 | hiro | # We use this script file to make the link, it avoids creating a new file |
| 890 | 1 | hiro | if test "$need_locks" = yes; then |
| 891 | 1 | hiro | until $run ln "$progpath" "$lockfile" 2>/dev/null; do |
| 892 | 1 | hiro | $show "Waiting for $lockfile to be removed" |
| 893 | 1 | hiro | sleep 2 |
| 894 | 1 | hiro | done |
| 895 | 1 | hiro | elif test "$need_locks" = warn; then |
| 896 | 1 | hiro | if test -f "$lockfile"; then |
| 897 | 1 | hiro | $echo "\ |
| 898 | 1 | hiro | *** ERROR, $lockfile exists and contains: |
| 899 | 1 | hiro | `cat $lockfile 2>/dev/null` |
| 900 | 1 | hiro | |
| 901 | 1 | hiro | This indicates that another process is trying to use the same |
| 902 | 1 | hiro | temporary object file, and libtool could not work around it because |
| 903 | 1 | hiro | your compiler does not support \`-c' and \`-o' together. If you |
| 904 | 1 | hiro | repeat this compilation, it may succeed, by chance, but you had better |
| 905 | 1 | hiro | avoid parallel builds (make -j) in this platform, or get a better |
| 906 | 1 | hiro | compiler." |
| 907 | 1 | hiro | |
| 908 | 1 | hiro | $run $rm $removelist |
| 909 | 1 | hiro | exit $EXIT_FAILURE |
| 910 | 1 | hiro | fi |
| 911 | 597 | hiro | $echo "$srcfile" > "$lockfile" |
| 912 | 1 | hiro | fi |
| 913 | 1 | hiro | |
| 914 | 1 | hiro | if test -n "$fix_srcfile_path"; then |
| 915 | 1 | hiro | eval srcfile=\"$fix_srcfile_path\" |
| 916 | 1 | hiro | fi |
| 917 | 597 | hiro | qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` |
| 918 | 597 | hiro | case $qsrcfile in |
| 919 | 597 | hiro | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
| 920 | 597 | hiro | qsrcfile="\"$qsrcfile\"" ;; |
| 921 | 597 | hiro | esac |
| 922 | 1 | hiro | |
| 923 | 1 | hiro | $run $rm "$libobj" "${libobj}T"
|
| 924 | 1 | hiro | |
| 925 | 1 | hiro | # Create a libtool object file (analogous to a ".la" file), |
| 926 | 1 | hiro | # but don't create it if we're doing a dry run. |
| 927 | 1 | hiro | test -z "$run" && cat > ${libobj}T <<EOF
|
| 928 | 1 | hiro | # $libobj - a libtool object file |
| 929 | 1 | hiro | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP |
| 930 | 1 | hiro | # |
| 931 | 1 | hiro | # Please DO NOT delete this file! |
| 932 | 1 | hiro | # It is necessary for linking the library. |
| 933 | 1 | hiro | |
| 934 | 1 | hiro | # Name of the PIC object. |
| 935 | 1 | hiro | EOF |
| 936 | 1 | hiro | |
| 937 | 1 | hiro | # Only build a PIC object if we are building libtool libraries. |
| 938 | 1 | hiro | if test "$build_libtool_libs" = yes; then |
| 939 | 1 | hiro | # Without this assignment, base_compile gets emptied. |
| 940 | 1 | hiro | fbsd_hideous_sh_bug=$base_compile |
| 941 | 1 | hiro | |
| 942 | 1 | hiro | if test "$pic_mode" != no; then |
| 943 | 597 | hiro | command="$base_compile $qsrcfile $pic_flag" |
| 944 | 1 | hiro | else |
| 945 | 1 | hiro | # Don't build PIC code |
| 946 | 597 | hiro | command="$base_compile $qsrcfile" |
| 947 | 1 | hiro | fi |
| 948 | 1 | hiro | |
| 949 | 1 | hiro | if test ! -d "${xdir}$objdir"; then
|
| 950 | 1 | hiro | $show "$mkdir ${xdir}$objdir"
|
| 951 | 1 | hiro | $run $mkdir ${xdir}$objdir
|
| 952 | 879 | hiro | exit_status=$? |
| 953 | 879 | hiro | if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
|
| 954 | 879 | hiro | exit $exit_status |
| 955 | 1 | hiro | fi |
| 956 | 1 | hiro | fi |
| 957 | 1 | hiro | |
| 958 | 1 | hiro | if test -z "$output_obj"; then |
| 959 | 1 | hiro | # Place PIC objects in $objdir |
| 960 | 1 | hiro | command="$command -o $lobj" |
| 961 | 1 | hiro | fi |
| 962 | 1 | hiro | |
| 963 | 1 | hiro | $run $rm "$lobj" "$output_obj" |
| 964 | 1 | hiro | |
| 965 | 1 | hiro | $show "$command" |
| 966 | 2022 | hiro | if $run eval $lt_env "$command"; then : |
| 967 | 1 | hiro | else |
| 968 | 1 | hiro | test -n "$output_obj" && $run $rm $removelist |
| 969 | 1 | hiro | exit $EXIT_FAILURE |
| 970 | 1 | hiro | fi |
| 971 | 1 | hiro | |
| 972 | 1 | hiro | if test "$need_locks" = warn && |
| 973 | 1 | hiro | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
| 974 | 1 | hiro | $echo "\ |
| 975 | 1 | hiro | *** ERROR, $lockfile contains: |
| 976 | 1 | hiro | `cat $lockfile 2>/dev/null` |
| 977 | 1 | hiro | |
| 978 | 1 | hiro | but it should contain: |
| 979 | 1 | hiro | $srcfile |
| 980 | 1 | hiro | |
| 981 | 1 | hiro | This indicates that another process is trying to use the same |
| 982 | 1 | hiro | temporary object file, and libtool could not work around it because |
| 983 | 1 | hiro | your compiler does not support \`-c' and \`-o' together. If you |
| 984 | 1 | hiro | repeat this compilation, it may succeed, by chance, but you had better |
| 985 | 1 | hiro | avoid parallel builds (make -j) in this platform, or get a better |
| 986 | 1 | hiro | compiler." |
| 987 | 1 | hiro | |
| 988 | 1 | hiro | $run $rm $removelist |
| 989 | 1 | hiro | exit $EXIT_FAILURE |
| 990 | 1 | hiro | fi |
| 991 | 1 | hiro | |
| 992 | 1 | hiro | # Just move the object if needed, then go on to compile the next one |
| 993 | 1 | hiro | if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then |
| 994 | 1 | hiro | $show "$mv $output_obj $lobj" |
| 995 | 1 | hiro | if $run $mv $output_obj $lobj; then : |
| 996 | 1 | hiro | else |
| 997 | 1 | hiro | error=$? |
| 998 | 1 | hiro | $run $rm $removelist |
| 999 | 1 | hiro | exit $error |
| 1000 | 1 | hiro | fi |
| 1001 | 1 | hiro | fi |
| 1002 | 1 | hiro | |
| 1003 | 1 | hiro | # Append the name of the PIC object to the libtool object file. |
| 1004 | 1 | hiro | test -z "$run" && cat >> ${libobj}T <<EOF
|
| 1005 | 1 | hiro | pic_object='$objdir/$objname' |
| 1006 | 1 | hiro | |
| 1007 | 1 | hiro | EOF |
| 1008 | 1 | hiro | |
| 1009 | 1 | hiro | # Allow error messages only from the first compilation. |
| 1010 | 1 | hiro | if test "$suppress_opt" = yes; then |
| 1011 | 1 | hiro | suppress_output=' >/dev/null 2>&1' |
| 1012 | 1 | hiro | fi |
| 1013 | 1 | hiro | else |
| 1014 | 1 | hiro | # No PIC object so indicate it doesn't exist in the libtool |
| 1015 | 1 | hiro | # object file. |
| 1016 | 1 | hiro | test -z "$run" && cat >> ${libobj}T <<EOF
|
| 1017 | 1 | hiro | pic_object=none |
| 1018 | 1 | hiro | |
| 1019 | 1 | hiro | EOF |
| 1020 | 1 | hiro | fi |
| 1021 | 1 | hiro | |
| 1022 | 1 | hiro | # Only build a position-dependent object if we build old libraries. |
| 1023 | 1 | hiro | if test "$build_old_libs" = yes; then |
| 1024 | 1 | hiro | if test "$pic_mode" != yes; then |
| 1025 | 1 | hiro | # Don't build PIC code |
| 1026 | 597 | hiro | command="$base_compile $qsrcfile" |
| 1027 | 1 | hiro | else |
| 1028 | 597 | hiro | command="$base_compile $qsrcfile $pic_flag" |
| 1029 | 1 | hiro | fi |
| 1030 | 1 | hiro | if test "$compiler_c_o" = yes; then |
| 1031 | 1 | hiro | command="$command -o $obj" |
| 1032 | 1 | hiro | fi |
| 1033 | 1 | hiro | |
| 1034 | 1 | hiro | # Suppress compiler output if we already did a PIC compilation. |
| 1035 | 1 | hiro | command="$command$suppress_output" |
| 1036 | 1 | hiro | $run $rm "$obj" "$output_obj" |
| 1037 | 1 | hiro | $show "$command" |
| 1038 | 2022 | hiro | if $run eval $lt_env "$command"; then : |
| 1039 | 1 | hiro | else |
| 1040 | 1 | hiro | $run $rm $removelist |
| 1041 | 1 | hiro | exit $EXIT_FAILURE |
| 1042 | 1 | hiro | fi |
| 1043 | 1 | hiro | |
| 1044 | 1 | hiro | if test "$need_locks" = warn && |
| 1045 | 1 | hiro | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
| 1046 | 1 | hiro | $echo "\ |
| 1047 | 1 | hiro | *** ERROR, $lockfile contains: |
| 1048 | 1 | hiro | `cat $lockfile 2>/dev/null` |
| 1049 | 1 | hiro | |
| 1050 | 1 | hiro | but it should contain: |
| 1051 | 1 | hiro | $srcfile |
| 1052 | 1 | hiro | |
| 1053 | 1 | hiro | This indicates that another process is trying to use the same |
| 1054 | 1 | hiro | temporary object file, and libtool could not work around it because |
| 1055 | 1 | hiro | your compiler does not support \`-c' and \`-o' together. If you |
| 1056 | 1 | hiro | repeat this compilation, it may succeed, by chance, but you had better |
| 1057 | 1 | hiro | avoid parallel builds (make -j) in this platform, or get a better |
| 1058 | 1 | hiro | compiler." |
| 1059 | 1 | hiro | |
| 1060 | 1 | hiro | $run $rm $removelist |
| 1061 | 1 | hiro | exit $EXIT_FAILURE |
| 1062 | 1 | hiro | fi |
| 1063 | 1 | hiro | |
| 1064 | 1 | hiro | # Just move the object if needed |
| 1065 | 1 | hiro | if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then |
| 1066 | 1 | hiro | $show "$mv $output_obj $obj" |
| 1067 | 1 | hiro | if $run $mv $output_obj $obj; then : |
| 1068 | 1 | hiro | else |
| 1069 | 1 | hiro | error=$? |
| 1070 | 1 | hiro | $run $rm $removelist |
| 1071 | 1 | hiro | exit $error |
| 1072 | 1 | hiro | fi |
| 1073 | 1 | hiro | fi |
| 1074 | 1 | hiro | |
| 1075 | 1 | hiro | # Append the name of the non-PIC object the libtool object file. |
| 1076 | 1 | hiro | # Only append if the libtool object file exists. |
| 1077 | 1 | hiro | test -z "$run" && cat >> ${libobj}T <<EOF
|
| 1078 | 1 | hiro | # Name of the non-PIC object. |
| 1079 | 1 | hiro | non_pic_object='$objname' |
| 1080 | 1 | hiro | |
| 1081 | 1 | hiro | EOF |
| 1082 | 1 | hiro | else |
| 1083 | 1 | hiro | # Append the name of the non-PIC object the libtool object file. |
| 1084 | 1 | hiro | # Only append if the libtool object file exists. |
| 1085 | 1 | hiro | test -z "$run" && cat >> ${libobj}T <<EOF
|
| 1086 | 1 | hiro | # Name of the non-PIC object. |
| 1087 | 1 | hiro | non_pic_object=none |
| 1088 | 1 | hiro | |
| 1089 | 1 | hiro | EOF |
| 1090 | 1 | hiro | fi |
| 1091 | 1 | hiro | |
| 1092 | 1 | hiro | $run $mv "${libobj}T" "${libobj}"
|
| 1093 | 1 | hiro | |
| 1094 | 1 | hiro | # Unlock the critical section if it was locked |
| 1095 | 1 | hiro | if test "$need_locks" != no; then |
| 1096 | 1 | hiro | $run $rm "$lockfile" |
| 1097 | 1 | hiro | fi |
| 1098 | 1 | hiro | |
| 1099 | 1 | hiro | exit $EXIT_SUCCESS |
| 1100 | 1 | hiro | ;; |
| 1101 | 1 | hiro | |
| 1102 | 1 | hiro | # libtool link mode |
| 1103 | 1 | hiro | link | relink) |
| 1104 | 1 | hiro | modename="$modename: link" |
| 1105 | 1 | hiro | case $host in |
| 1106 | 1 | hiro | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) |
| 1107 | 1 | hiro | # It is impossible to link a dll without this setting, and |
| 1108 | 1 | hiro | # we shouldn't force the makefile maintainer to figure out |
| 1109 | 1 | hiro | # which system we are compiling for in order to pass an extra |
| 1110 | 1 | hiro | # flag for every libtool invocation. |
| 1111 | 1 | hiro | # allow_undefined=no |
| 1112 | 1 | hiro | |
| 1113 | 1 | hiro | # FIXME: Unfortunately, there are problems with the above when trying |
| 1114 | 1 | hiro | # to make a dll which has undefined symbols, in which case not |
| 1115 | 1 | hiro | # even a static library is built. For now, we need to specify |
| 1116 | 1 | hiro | # -no-undefined on the libtool link line when we can be certain |
| 1117 | 1 | hiro | # that all symbols are satisfied, otherwise we get a static library. |
| 1118 | 1 | hiro | allow_undefined=yes |
| 1119 | 1 | hiro | ;; |
| 1120 | 1 | hiro | *) |
| 1121 | 1 | hiro | allow_undefined=yes |
| 1122 | 1 | hiro | ;; |
| 1123 | 1 | hiro | esac |
| 1124 | 1 | hiro | libtool_args="$nonopt" |
| 1125 | 1 | hiro | base_compile="$nonopt $@" |
| 1126 | 1 | hiro | compile_command="$nonopt" |
| 1127 | 1 | hiro | finalize_command="$nonopt" |
| 1128 | 1 | hiro | |
| 1129 | 1 | hiro | compile_rpath= |
| 1130 | 1 | hiro | finalize_rpath= |
| 1131 | 1 | hiro | compile_shlibpath= |
| 1132 | 1 | hiro | finalize_shlibpath= |
| 1133 | 1 | hiro | convenience= |
| 1134 | 1 | hiro | old_convenience= |
| 1135 | 1 | hiro | deplibs= |
| 1136 | 1 | hiro | old_deplibs= |
| 1137 | 1 | hiro | compiler_flags= |
| 1138 | 1 | hiro | linker_flags= |
| 1139 | 1 | hiro | dllsearchpath= |
| 1140 | 1 | hiro | lib_search_path=`pwd` |
| 1141 | 1 | hiro | inst_prefix_dir= |
| 1142 | 1 | hiro | |
| 1143 | 1 | hiro | avoid_version=no |
| 1144 | 1 | hiro | dlfiles= |
| 1145 | 1 | hiro | dlprefiles= |
| 1146 | 1 | hiro | dlself=no |
| 1147 | 1 | hiro | export_dynamic=no |
| 1148 | 1 | hiro | export_symbols= |
| 1149 | 1 | hiro | export_symbols_regex= |
| 1150 | 1 | hiro | generated= |
| 1151 | 1 | hiro | libobjs= |
| 1152 | 1 | hiro | ltlibs= |
| 1153 | 1 | hiro | module=no |
| 1154 | 1 | hiro | no_install=no |
| 1155 | 1 | hiro | objs= |
| 1156 | 1 | hiro | non_pic_objects= |
| 1157 | 879 | hiro | notinst_path= # paths that contain not-installed libtool libraries |
| 1158 | 1 | hiro | precious_files_regex= |
| 1159 | 1 | hiro | prefer_static_libs=no |
| 1160 | 1 | hiro | preload=no |
| 1161 | 1 | hiro | prev= |
| 1162 | 1 | hiro | prevarg= |
| 1163 | 1 | hiro | release= |
| 1164 | 1 | hiro | rpath= |
| 1165 | 1 | hiro | xrpath= |
| 1166 | 1 | hiro | perm_rpath= |
| 1167 | 1 | hiro | temp_rpath= |
| 1168 | 1 | hiro | thread_safe=no |
| 1169 | 1 | hiro | vinfo= |
| 1170 | 1 | hiro | vinfo_number=no |
| 1171 | 2022 | hiro | single_module="${wl}-single_module"
|
| 1172 | 1 | hiro | |
| 1173 | 1 | hiro | func_infer_tag $base_compile |
| 1174 | 1 | hiro | |
| 1175 | 1 | hiro | # We need to know -static, to get the right output filenames. |
| 1176 | 1 | hiro | for arg |
| 1177 | 1 | hiro | do |
| 1178 | 1 | hiro | case $arg in |
| 1179 | 2022 | hiro | -all-static | -static | -static-libtool-libs) |
| 1180 | 2022 | hiro | case $arg in |
| 1181 | 2022 | hiro | -all-static) |
| 1182 | 1 | hiro | if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then |
| 1183 | 1 | hiro | $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 |
| 1184 | 1 | hiro | fi |
| 1185 | 1 | hiro | if test -n "$link_static_flag"; then |
| 1186 | 1 | hiro | dlopen_self=$dlopen_self_static |
| 1187 | 1 | hiro | fi |
| 1188 | 879 | hiro | prefer_static_libs=yes |
| 1189 | 2022 | hiro | ;; |
| 1190 | 2022 | hiro | -static) |
| 1191 | 1 | hiro | if test -z "$pic_flag" && test -n "$link_static_flag"; then |
| 1192 | 1 | hiro | dlopen_self=$dlopen_self_static |
| 1193 | 1 | hiro | fi |
| 1194 | 879 | hiro | prefer_static_libs=built |
| 1195 | 2022 | hiro | ;; |
| 1196 | 2022 | hiro | -static-libtool-libs) |
| 1197 | 2022 | hiro | if test -z "$pic_flag" && test -n "$link_static_flag"; then |
| 1198 | 2022 | hiro | dlopen_self=$dlopen_self_static |
| 1199 | 2022 | hiro | fi |
| 1200 | 2022 | hiro | prefer_static_libs=yes |
| 1201 | 2022 | hiro | ;; |
| 1202 | 2022 | hiro | esac |
| 1203 | 1 | hiro | build_libtool_libs=no |
| 1204 | 1 | hiro | build_old_libs=yes |
| 1205 | 1 | hiro | break |
| 1206 | 1 | hiro | ;; |
| 1207 | 1 | hiro | esac |
| 1208 | 1 | hiro | done |
| 1209 | 1 | hiro | |
| 1210 | 1 | hiro | # See if our shared archives depend on static archives. |
| 1211 | 1 | hiro | test -n "$old_archive_from_new_cmds" && build_old_libs=yes |
| 1212 | 1 | hiro | |
| 1213 | 1 | hiro | # Go through the arguments, transforming them on the way. |
| 1214 | 1 | hiro | while test "$#" -gt 0; do |
| 1215 | 1 | hiro | arg="$1" |
| 1216 | 1 | hiro | shift |
| 1217 | 1 | hiro | case $arg in |
| 1218 | 1 | hiro | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
| 1219 | 1 | hiro | qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test |
| 1220 | 1 | hiro | ;; |
| 1221 | 1 | hiro | *) qarg=$arg ;; |
| 1222 | 1 | hiro | esac |
| 1223 | 1 | hiro | libtool_args="$libtool_args $qarg" |
| 1224 | 1 | hiro | |
| 1225 | 1 | hiro | # If the previous option needs an argument, assign it. |
| 1226 | 1 | hiro | if test -n "$prev"; then |
| 1227 | 1 | hiro | case $prev in |
| 1228 | 1 | hiro | output) |
| 1229 | 1 | hiro | compile_command="$compile_command @OUTPUT@" |
| 1230 | 1 | hiro | finalize_command="$finalize_command @OUTPUT@" |
| 1231 | 1 | hiro | ;; |
| 1232 | 1 | hiro | esac |
| 1233 | 1 | hiro | |
| 1234 | 1 | hiro | case $prev in |
| 1235 | 1 | hiro | dlfiles|dlprefiles) |
| 1236 | 1 | hiro | if test "$preload" = no; then |
| 1237 | 1 | hiro | # Add the symbol object into the linking commands. |
| 1238 | 1 | hiro | compile_command="$compile_command @SYMFILE@" |
| 1239 | 1 | hiro | finalize_command="$finalize_command @SYMFILE@" |
| 1240 | 1 | hiro | preload=yes |
| 1241 | 1 | hiro | fi |
| 1242 | 1 | hiro | case $arg in |
| 1243 | 1 | hiro | *.la | *.lo) ;; # We handle these cases below. |
| 1244 | 1 | hiro | force) |
| 1245 | 1 | hiro | if test "$dlself" = no; then |
| 1246 | 1 | hiro | dlself=needless |
| 1247 | 1 | hiro | export_dynamic=yes |
| 1248 | 1 | hiro | fi |
| 1249 | 1 | hiro | prev= |
| 1250 | 1 | hiro | continue |
| 1251 | 1 | hiro | ;; |
| 1252 | 1 | hiro | self) |
| 1253 | 1 | hiro | if test "$prev" = dlprefiles; then |
| 1254 | 1 | hiro | dlself=yes |
| 1255 | 1 | hiro | elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then |
| 1256 | 1 | hiro | dlself=yes |
| 1257 | 1 | hiro | else |
| 1258 | 1 | hiro | dlself=needless |
| 1259 | 1 | hiro | export_dynamic=yes |
| 1260 | 1 | hiro | fi |
| 1261 | 1 | hiro | prev= |
| 1262 | 1 | hiro | continue |
| 1263 | 1 | hiro | ;; |
| 1264 | 1 | hiro | *) |
| 1265 | 1 | hiro | if test "$prev" = dlfiles; then |
| 1266 | 1 | hiro | dlfiles="$dlfiles $arg" |
| 1267 | 1 | hiro | else |
| 1268 | 1 | hiro | dlprefiles="$dlprefiles $arg" |
| 1269 | 1 | hiro | fi |
| 1270 | 1 | hiro | prev= |
| 1271 | 1 | hiro | continue |
| 1272 | 1 | hiro | ;; |
| 1273 | 1 | hiro | esac |
| 1274 | 1 | hiro | ;; |
| 1275 | 1 | hiro | expsyms) |
| 1276 | 1 | hiro | export_symbols="$arg" |
| 1277 | 1 | hiro | if test ! -f "$arg"; then |
| 1278 | 1 | hiro | $echo "$modename: symbol file \`$arg' does not exist" |
| 1279 | 1 | hiro | exit $EXIT_FAILURE |
| 1280 | 1 | hiro | fi |
| 1281 | 1 | hiro | prev= |
| 1282 | 1 | hiro | continue |
| 1283 | 1 | hiro | ;; |
| 1284 | 1 | hiro | expsyms_regex) |
| 1285 | 1 | hiro | export_symbols_regex="$arg" |
| 1286 | 1 | hiro | prev= |
| 1287 | 1 | hiro | continue |
| 1288 | 1 | hiro | ;; |
| 1289 | 1 | hiro | inst_prefix) |
| 1290 | 1 | hiro | inst_prefix_dir="$arg" |
| 1291 | 1 | hiro | prev= |
| 1292 | 1 | hiro | continue |
| 1293 | 1 | hiro | ;; |
| 1294 | 1 | hiro | precious_regex) |
| 1295 | 1 | hiro | precious_files_regex="$arg" |
| 1296 | 1 | hiro | prev= |
| 1297 | 1 | hiro | continue |
| 1298 | 1 | hiro | ;; |
| 1299 | 1 | hiro | release) |
| 1300 | 1 | hiro | release="-$arg" |
| 1301 | 1 | hiro | prev= |
| 1302 | 1 | hiro | continue |
| 1303 | 1 | hiro | ;; |
| 1304 | 1 | hiro | objectlist) |
| 1305 | 1 | hiro | if test -f "$arg"; then |
| 1306 | 1 | hiro | save_arg=$arg |
| 1307 | 1 | hiro | moreargs= |
| 1308 | 1 | hiro | for fil in `cat $save_arg` |
| 1309 | 1 | hiro | do |
| 1310 | 1 | hiro | # moreargs="$moreargs $fil" |
| 1311 | 1 | hiro | arg=$fil |
| 1312 | 1 | hiro | # A libtool-controlled object. |
| 1313 | 1 | hiro | |
| 1314 | 1 | hiro | # Check to see that this really is a libtool object. |
| 1315 | 1 | hiro | if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
|
| 1316 | 1 | hiro | pic_object= |
| 1317 | 1 | hiro | non_pic_object= |
| 1318 | 1 | hiro | |
| 1319 | 1 | hiro | # Read the .lo file |
| 1320 | 1 | hiro | # If there is no directory component, then add one. |
| 1321 | 1 | hiro | case $arg in |
| 1322 | 1 | hiro | */* | *\\*) . $arg ;; |
| 1323 | 1 | hiro | *) . ./$arg ;; |
| 1324 | 1 | hiro | esac |
| 1325 | 1 | hiro | |
| 1326 | 1 | hiro | if test -z "$pic_object" || \ |
| 1327 | 1 | hiro | test -z "$non_pic_object" || |
| 1328 | 1 | hiro | test "$pic_object" = none && \ |
| 1329 | 1 | hiro | test "$non_pic_object" = none; then |
| 1330 | 1 | hiro | $echo "$modename: cannot find name of object for \`$arg'" 1>&2 |
| 1331 | 1 | hiro | exit $EXIT_FAILURE |
| 1332 | 1 | hiro | fi |
| 1333 | 1 | hiro | |
| 1334 | 1 | hiro | # Extract subdirectory from the argument. |
| 1335 | 1 | hiro | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
| 1336 | 1 | hiro | if test "X$xdir" = "X$arg"; then |
| 1337 | 1 | hiro | xdir= |
| 1338 | 1 | hiro | else |
| 1339 | 1 | hiro | xdir="$xdir/" |
| 1340 | 1 | hiro | fi |
| 1341 | 1 | hiro | |
| 1342 | 1 | hiro | if test "$pic_object" != none; then |
| 1343 | 1 | hiro | # Prepend the subdirectory the object is found in. |
| 1344 | 1 | hiro | pic_object="$xdir$pic_object" |
| 1345 | 1 | hiro | |
| 1346 | 1 | hiro | if test "$prev" = dlfiles; then |
| 1347 | 1 | hiro | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
| 1348 | 1 | hiro | dlfiles="$dlfiles $pic_object" |
| 1349 | 1 | hiro | prev= |
| 1350 | 1 | hiro | continue |
| 1351 | 1 | hiro | else |
| 1352 | 1 | hiro | # If libtool objects are unsupported, then we need to preload. |
| 1353 | 1 | hiro | prev=dlprefiles |
| 1354 | 1 | hiro | fi |
| 1355 | 1 | hiro | fi |
| 1356 | 1 | hiro | |
| 1357 | 1 | hiro | # CHECK ME: I think I busted this. -Ossama |
| 1358 | 1 | hiro | if test "$prev" = dlprefiles; then |
| 1359 | 1 | hiro | # Preload the old-style object. |
| 1360 | 1 | hiro | dlprefiles="$dlprefiles $pic_object" |
| 1361 | 1 | hiro | prev= |
| 1362 | 1 | hiro | fi |
| 1363 | 1 | hiro | |
| 1364 | 1 | hiro | # A PIC object. |
| 1365 | 1 | hiro | libobjs="$libobjs $pic_object" |
| 1366 | 1 | hiro | arg="$pic_object" |
| 1367 | 1 | hiro | fi |
| 1368 | 1 | hiro | |
| 1369 | 1 | hiro | # Non-PIC object. |
| 1370 | 1 | hiro | if test "$non_pic_object" != none; then |
| 1371 | 1 | hiro | # Prepend the subdirectory the object is found in. |
| 1372 | 1 | hiro | non_pic_object="$xdir$non_pic_object" |
| 1373 | 1 | hiro | |
| 1374 | 1 | hiro | # A standard non-PIC object |
| 1375 | 1 | hiro | non_pic_objects="$non_pic_objects $non_pic_object" |
| 1376 | 1 | hiro | if test -z "$pic_object" || test "$pic_object" = none ; then |
| 1377 | 1 | hiro | arg="$non_pic_object" |
| 1378 | 1 | hiro | fi |
| 1379 | 879 | hiro | else |
| 1380 | 879 | hiro | # If the PIC object exists, use it instead. |
| 1381 | 879 | hiro | # $xdir was prepended to $pic_object above. |
| 1382 | 879 | hiro | non_pic_object="$pic_object" |
| 1383 | 879 | hiro | non_pic_objects="$non_pic_objects $non_pic_object" |
| 1384 | 1 | hiro | fi |
| 1385 | 1 | hiro | else |
| 1386 | 1 | hiro | # Only an error if not doing a dry-run. |
| 1387 | 1 | hiro | if test -z "$run"; then |
| 1388 | 1 | hiro | $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 |
| 1389 | 1 | hiro | exit $EXIT_FAILURE |
| 1390 | 1 | hiro | else |
| 1391 | 1 | hiro | # Dry-run case. |
| 1392 | 1 | hiro | |
| 1393 | 1 | hiro | # Extract subdirectory from the argument. |
| 1394 | 1 | hiro | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
| 1395 | 1 | hiro | if test "X$xdir" = "X$arg"; then |
| 1396 | 1 | hiro | xdir= |
| 1397 | 1 | hiro | else |
| 1398 | 1 | hiro | xdir="$xdir/" |
| 1399 | 1 | hiro | fi |
| 1400 | 1 | hiro | |
| 1401 | 1 | hiro | pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
|
| 1402 | 1 | hiro | non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
|
| 1403 | 1 | hiro | libobjs="$libobjs $pic_object" |
| 1404 | 1 | hiro | non_pic_objects="$non_pic_objects $non_pic_object" |
| 1405 | 1 | hiro | fi |
| 1406 | 1 | hiro | fi |
| 1407 | 1 | hiro | done |
| 1408 | 1 | hiro | else |
| 1409 | 1 | hiro | $echo "$modename: link input file \`$save_arg' does not exist" |
| 1410 | 1 | hiro | exit $EXIT_FAILURE |
| 1411 | 1 | hiro | fi |
| 1412 | 1 | hiro | arg=$save_arg |
| 1413 | 1 | hiro | prev= |
| 1414 | 1 | hiro | continue |
| 1415 | 1 | hiro | ;; |
| 1416 | 1 | hiro | rpath | xrpath) |
| 1417 | 1 | hiro | # We need an absolute path. |
| 1418 | 1 | hiro | case $arg in |
| 1419 | 1 | hiro | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 1420 | 1 | hiro | *) |
| 1421 | 1 | hiro | $echo "$modename: only absolute run-paths are allowed" 1>&2 |
| 1422 | 1 | hiro | exit $EXIT_FAILURE |
| 1423 | 1 | hiro | ;; |
| 1424 | 1 | hiro | esac |
| 1425 | 1 | hiro | if test "$prev" = rpath; then |
| 1426 | 1 | hiro | case "$rpath " in |
| 1427 | 1 | hiro | *" $arg "*) ;; |
| 1428 | 1 | hiro | *) rpath="$rpath $arg" ;; |
| 1429 | 1 | hiro | esac |
| 1430 | 1 | hiro | else |
| 1431 | 1 | hiro | case "$xrpath " in |
| 1432 | 1 | hiro | *" $arg "*) ;; |
| 1433 | 1 | hiro | *) xrpath="$xrpath $arg" ;; |
| 1434 | 1 | hiro | esac |
| 1435 | 1 | hiro | fi |
| 1436 | 1 | hiro | prev= |
| 1437 | 1 | hiro | continue |
| 1438 | 1 | hiro | ;; |
| 1439 | 1 | hiro | xcompiler) |
| 1440 | 1 | hiro | compiler_flags="$compiler_flags $qarg" |
| 1441 | 1 | hiro | prev= |
| 1442 | 1 | hiro | compile_command="$compile_command $qarg" |
| 1443 | 1 | hiro | finalize_command="$finalize_command $qarg" |
| 1444 | 1 | hiro | continue |
| 1445 | 1 | hiro | ;; |
| 1446 | 1 | hiro | xlinker) |
| 1447 | 1 | hiro | linker_flags="$linker_flags $qarg" |
| 1448 | 1 | hiro | compiler_flags="$compiler_flags $wl$qarg" |
| 1449 | 1 | hiro | prev= |
| 1450 | 1 | hiro | compile_command="$compile_command $wl$qarg" |
| 1451 | 1 | hiro | finalize_command="$finalize_command $wl$qarg" |
| 1452 | 1 | hiro | continue |
| 1453 | 1 | hiro | ;; |
| 1454 | 1 | hiro | xcclinker) |
| 1455 | 1 | hiro | linker_flags="$linker_flags $qarg" |
| 1456 | 1 | hiro | compiler_flags="$compiler_flags $qarg" |
| 1457 | 1 | hiro | prev= |
| 1458 | 1 | hiro | compile_command="$compile_command $qarg" |
| 1459 | 1 | hiro | finalize_command="$finalize_command $qarg" |
| 1460 | 1 | hiro | continue |
| 1461 | 1 | hiro | ;; |
| 1462 | 1 | hiro | shrext) |
| 1463 | 1 | hiro | shrext_cmds="$arg" |
| 1464 | 1 | hiro | prev= |
| 1465 | 1 | hiro | continue |
| 1466 | 1 | hiro | ;; |
| 1467 | 879 | hiro | darwin_framework|darwin_framework_skip) |
| 1468 | 879 | hiro | test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" |
| 1469 | 597 | hiro | compile_command="$compile_command $arg" |
| 1470 | 597 | hiro | finalize_command="$finalize_command $arg" |
| 1471 | 597 | hiro | prev= |
| 1472 | 597 | hiro | continue |
| 1473 | 597 | hiro | ;; |
| 1474 | 1 | hiro | *) |
| 1475 | 1 | hiro | eval "$prev=\"\$arg\"" |
| 1476 | 1 | hiro | prev= |
| 1477 | 1 | hiro | continue |
| 1478 | 1 | hiro | ;; |
| 1479 | 1 | hiro | esac |
| 1480 | 1 | hiro | fi # test -n "$prev" |
| 1481 | 1 | hiro | |
| 1482 | 1 | hiro | prevarg="$arg" |
| 1483 | 1 | hiro | |
| 1484 | 1 | hiro | case $arg in |
| 1485 | 1 | hiro | -all-static) |
| 1486 | 1 | hiro | if test -n "$link_static_flag"; then |
| 1487 | 1 | hiro | compile_command="$compile_command $link_static_flag" |
| 1488 | 1 | hiro | finalize_command="$finalize_command $link_static_flag" |
| 1489 | 1 | hiro | fi |
| 1490 | 1 | hiro | continue |
| 1491 | 1 | hiro | ;; |
| 1492 | 1 | hiro | |
| 1493 | 1 | hiro | -allow-undefined) |
| 1494 | 1 | hiro | # FIXME: remove this flag sometime in the future. |
| 1495 | 1 | hiro | $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 |
| 1496 | 1 | hiro | continue |
| 1497 | 1 | hiro | ;; |
| 1498 | 1 | hiro | |
| 1499 | 1 | hiro | -avoid-version) |
| 1500 | 1 | hiro | avoid_version=yes |
| 1501 | 1 | hiro | continue |
| 1502 | 1 | hiro | ;; |
| 1503 | 1 | hiro | |
| 1504 | 1 | hiro | -dlopen) |
| 1505 | 1 | hiro | prev=dlfiles |
| 1506 | 1 | hiro | continue |
| 1507 | 1 | hiro | ;; |
| 1508 | 1 | hiro | |
| 1509 | 1 | hiro | -dlpreopen) |
| 1510 | 1 | hiro | prev=dlprefiles |
| 1511 | 1 | hiro | continue |
| 1512 | 1 | hiro | ;; |
| 1513 | 1 | hiro | |
| 1514 | 1 | hiro | -export-dynamic) |
| 1515 | 1 | hiro | export_dynamic=yes |
| 1516 | 1 | hiro | continue |
| 1517 | 1 | hiro | ;; |
| 1518 | 1 | hiro | |
| 1519 | 1 | hiro | -export-symbols | -export-symbols-regex) |
| 1520 | 1 | hiro | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then |
| 1521 | 1 | hiro | $echo "$modename: more than one -exported-symbols argument is not allowed" |
| 1522 | 1 | hiro | exit $EXIT_FAILURE |
| 1523 | 1 | hiro | fi |
| 1524 | 1 | hiro | if test "X$arg" = "X-export-symbols"; then |
| 1525 | 1 | hiro | prev=expsyms |
| 1526 | 1 | hiro | else |
| 1527 | 1 | hiro | prev=expsyms_regex |
| 1528 | 1 | hiro | fi |
| 1529 | 1 | hiro | continue |
| 1530 | 1 | hiro | ;; |
| 1531 | 1 | hiro | |
| 1532 | 879 | hiro | -framework|-arch|-isysroot) |
| 1533 | 879 | hiro | case " $CC " in |
| 1534 | 879 | hiro | *" ${arg} ${1} "* | *" ${arg} ${1} "*)
|
| 1535 | 879 | hiro | prev=darwin_framework_skip ;; |
| 1536 | 879 | hiro | *) compiler_flags="$compiler_flags $arg" |
| 1537 | 879 | hiro | prev=darwin_framework ;; |
| 1538 | 879 | hiro | esac |
| 1539 | 597 | hiro | compile_command="$compile_command $arg" |
| 1540 | 597 | hiro | finalize_command="$finalize_command $arg" |
| 1541 | 879 | hiro | continue |
| 1542 | 879 | hiro | ;; |
| 1543 | 597 | hiro | |
| 1544 | 1 | hiro | -inst-prefix-dir) |
| 1545 | 1 | hiro | prev=inst_prefix |
| 1546 | 1 | hiro | continue |
| 1547 | 1 | hiro | ;; |
| 1548 | 1 | hiro | |
| 1549 | 1 | hiro | # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* |
| 1550 | 1 | hiro | # so, if we see these flags be careful not to treat them like -L |
| 1551 | 1 | hiro | -L[A-Z][A-Z]*:*) |
| 1552 | 1 | hiro | case $with_gcc/$host in |
| 1553 | 1 | hiro | no/*-*-irix* | /*-*-irix*) |
| 1554 | 1 | hiro | compile_command="$compile_command $arg" |
| 1555 | 1 | hiro | finalize_command="$finalize_command $arg" |
| 1556 | 1 | hiro | ;; |
| 1557 | 1 | hiro | esac |
| 1558 | 1 | hiro | continue |
| 1559 | 1 | hiro | ;; |
| 1560 | 1 | hiro | |
| 1561 | 1 | hiro | -L*) |
| 1562 | 1 | hiro | dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` |
| 1563 | 1 | hiro | # We need an absolute path. |
| 1564 | 1 | hiro | case $dir in |
| 1565 | 1 | hiro | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 1566 | 1 | hiro | *) |
| 1567 | 1 | hiro | absdir=`cd "$dir" && pwd` |
| 1568 | 1 | hiro | if test -z "$absdir"; then |
| 1569 | 1 | hiro | $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 |
| 1570 | 879 | hiro | absdir="$dir" |
| 1571 | 879 | hiro | notinst_path="$notinst_path $dir" |
| 1572 | 1 | hiro | fi |
| 1573 | 1 | hiro | dir="$absdir" |
| 1574 | 1 | hiro | ;; |
| 1575 | 1 | hiro | esac |
| 1576 | 1 | hiro | case "$deplibs " in |
| 1577 | 1 | hiro | *" -L$dir "*) ;; |
| 1578 | 1 | hiro | *) |
| 1579 | 1 | hiro | deplibs="$deplibs -L$dir" |
| 1580 | 1 | hiro | lib_search_path="$lib_search_path $dir" |
| 1581 | 1 | hiro | ;; |
| 1582 | 1 | hiro | esac |
| 1583 | 1 | hiro | case $host in |
| 1584 | 1 | hiro | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) |
| 1585 | 879 | hiro | testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` |
| 1586 | 1 | hiro | case :$dllsearchpath: in |
| 1587 | 1 | hiro | *":$dir:"*) ;; |
| 1588 | 1 | hiro | *) dllsearchpath="$dllsearchpath:$dir";; |
| 1589 | 1 | hiro | esac |
| 1590 | 879 | hiro | case :$dllsearchpath: in |
| 1591 | 879 | hiro | *":$testbindir:"*) ;; |
| 1592 | 879 | hiro | *) dllsearchpath="$dllsearchpath:$testbindir";; |
| 1593 | 879 | hiro | esac |
| 1594 | 1 | hiro | ;; |
| 1595 | 1 | hiro | esac |
| 1596 | 1 | hiro | continue |
| 1597 | 1 | hiro | ;; |
| 1598 | 1 | hiro | |
| 1599 | 1 | hiro | -l*) |
| 1600 | 1 | hiro | if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then |
| 1601 | 1 | hiro | case $host in |
| 1602 | 879 | hiro | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) |
| 1603 | 1 | hiro | # These systems don't actually have a C or math library (as such) |
| 1604 | 1 | hiro | continue |
| 1605 | 1 | hiro | ;; |
| 1606 | 879 | hiro | *-*-os2*) |
| 1607 | 1 | hiro | # These systems don't actually have a C library (as such) |
| 1608 | 1 | hiro | test "X$arg" = "X-lc" && continue |
| 1609 | 1 | hiro | ;; |
| 1610 | 597 | hiro | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
| 1611 | 1 | hiro | # Do not include libc due to us having libc/libc_r. |
| 1612 | 1 | hiro | test "X$arg" = "X-lc" && continue |
| 1613 | 1 | hiro | ;; |
| 1614 | 1 | hiro | *-*-rhapsody* | *-*-darwin1.[012]) |
| 1615 | 1 | hiro | # Rhapsody C and math libraries are in the System framework |
| 1616 | 1 | hiro | deplibs="$deplibs -framework System" |
| 1617 | 1 | hiro | continue |
| 1618 | 879 | hiro | ;; |
| 1619 | 879 | hiro | *-*-sco3.2v5* | *-*-sco5v6*) |
| 1620 | 879 | hiro | # Causes problems with __ctype |
| 1621 | 879 | hiro | test "X$arg" = "X-lc" && continue |
| 1622 | 879 | hiro | ;; |
| 1623 | 879 | hiro | *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) |
| 1624 | 879 | hiro | # Compiler inserts libc in the correct place for threads to work |
| 1625 | 879 | hiro | test "X$arg" = "X-lc" && continue |
| 1626 | 879 | hiro | ;; |
| 1627 | 1 | hiro | esac |
| 1628 | 1 | hiro | elif test "X$arg" = "X-lc_r"; then |
| 1629 | 1 | hiro | case $host in |
| 1630 | 597 | hiro | *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) |
| 1631 | 1 | hiro | # Do not include libc_r directly, use -pthread flag. |
| 1632 | 1 | hiro | continue |
| 1633 | 1 | hiro | ;; |
| 1634 | 1 | hiro | esac |
| 1635 | 1 | hiro | fi |
| 1636 | 1 | hiro | deplibs="$deplibs $arg" |
| 1637 | 1 | hiro | continue |
| 1638 | 1 | hiro | ;; |
| 1639 | 1 | hiro | |
| 1640 | 597 | hiro | # Tru64 UNIX uses -model [arg] to determine the layout of C++ |
| 1641 | 597 | hiro | # classes, name mangling, and exception handling. |
| 1642 | 597 | hiro | -model) |
| 1643 | 597 | hiro | compile_command="$compile_command $arg" |
| 1644 | 597 | hiro | compiler_flags="$compiler_flags $arg" |
| 1645 | 597 | hiro | finalize_command="$finalize_command $arg" |
| 1646 | 597 | hiro | prev=xcompiler |
| 1647 | 597 | hiro | continue |
| 1648 | 597 | hiro | ;; |
| 1649 | 597 | hiro | |
| 1650 | 2022 | hiro | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) |
| 1651 | 597 | hiro | compiler_flags="$compiler_flags $arg" |
| 1652 | 597 | hiro | compile_command="$compile_command $arg" |
| 1653 | 597 | hiro | finalize_command="$finalize_command $arg" |
| 1654 | 1 | hiro | continue |
| 1655 | 1 | hiro | ;; |
| 1656 | 1 | hiro | |
| 1657 | 2022 | hiro | -multi_module) |
| 1658 | 2022 | hiro | single_module="${wl}-multi_module"
|
| 1659 | 2022 | hiro | continue |
| 1660 | 2022 | hiro | ;; |
| 1661 | 2022 | hiro | |
| 1662 | 1 | hiro | -module) |
| 1663 | 1 | hiro | module=yes |
| 1664 | 1 | hiro | continue |
| 1665 | 1 | hiro | ;; |
| 1666 | 1 | hiro | |
| 1667 | 597 | hiro | # -64, -mips[0-9] enable 64-bit mode on the SGI compiler |
| 1668 | 597 | hiro | # -r[0-9][0-9]* specifies the processor on the SGI compiler |
| 1669 | 597 | hiro | # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler |
| 1670 | 597 | hiro | # +DA*, +DD* enable 64-bit mode on the HP compiler |
| 1671 | 597 | hiro | # -q* pass through compiler args for the IBM compiler |
| 1672 | 597 | hiro | # -m* pass through architecture-specific compiler args for GCC |
| 1673 | 879 | hiro | # -m*, -t[45]*, -txscale* pass through architecture-specific |
| 1674 | 879 | hiro | # compiler args for GCC |
| 1675 | 2022 | hiro | # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC |
| 1676 | 2022 | hiro | # -F/path gives path to uninstalled frameworks, gcc on darwin |
| 1677 | 879 | hiro | # @file GCC response files |
| 1678 | 2022 | hiro | -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ |
| 1679 | 2022 | hiro | -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) |
| 1680 | 597 | hiro | |
| 1681 | 1 | hiro | # Unknown arguments in both finalize_command and compile_command need |
| 1682 | 1 | hiro | # to be aesthetically quoted because they are evaled later. |
| 1683 | 1 | hiro | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
| 1684 | 1 | hiro | case $arg in |
| 1685 | 1 | hiro | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
| 1686 | 1 | hiro | arg="\"$arg\"" |
| 1687 | 1 | hiro | ;; |
| 1688 | 1 | hiro | esac |
| 1689 | 1 | hiro | compile_command="$compile_command $arg" |
| 1690 | 1 | hiro | finalize_command="$finalize_command $arg" |
| 1691 | 879 | hiro | compiler_flags="$compiler_flags $arg" |
| 1692 | 1 | hiro | continue |
| 1693 | 1 | hiro | ;; |
| 1694 | 1 | hiro | |
| 1695 | 1 | hiro | -shrext) |
| 1696 | 1 | hiro | prev=shrext |
| 1697 | 1 | hiro | continue |
| 1698 | 1 | hiro | ;; |
| 1699 | 1 | hiro | |
| 1700 | 1 | hiro | -no-fast-install) |
| 1701 | 1 | hiro | fast_install=no |
| 1702 | 1 | hiro | continue |
| 1703 | 1 | hiro | ;; |
| 1704 | 1 | hiro | |
| 1705 | 1 | hiro | -no-install) |
| 1706 | 1 | hiro | case $host in |
| 1707 | 2022 | hiro | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) |
| 1708 | 1 | hiro | # The PATH hackery in wrapper scripts is required on Windows |
| 1709 | 2022 | hiro | # and Darwin in order for the loader to find any dlls it needs. |
| 1710 | 1 | hiro | $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 |
| 1711 | 1 | hiro | $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 |
| 1712 | 1 | hiro | fast_install=no |
| 1713 | 1 | hiro | ;; |
| 1714 | 1 | hiro | *) no_install=yes ;; |
| 1715 | 1 | hiro | esac |
| 1716 | 1 | hiro | continue |
| 1717 | 1 | hiro | ;; |
| 1718 | 1 | hiro | |
| 1719 | 1 | hiro | -no-undefined) |
| 1720 | 1 | hiro | allow_undefined=no |
| 1721 | 1 | hiro | continue |
| 1722 | 1 | hiro | ;; |
| 1723 | 1 | hiro | |
| 1724 | 1 | hiro | -objectlist) |
| 1725 | 1 | hiro | prev=objectlist |
| 1726 | 1 | hiro | continue |
| 1727 | 1 | hiro | ;; |
| 1728 | 1 | hiro | |
| 1729 | 1 | hiro | -o) prev=output ;; |
| 1730 | 1 | hiro | |
| 1731 | 1 | hiro | -precious-files-regex) |
| 1732 | 1 | hiro | prev=precious_regex |
| 1733 | 1 | hiro | continue |
| 1734 | 1 | hiro | ;; |
| 1735 | 1 | hiro | |
| 1736 | 1 | hiro | -release) |
| 1737 | 1 | hiro | prev=release |
| 1738 | 1 | hiro | continue |
| 1739 | 1 | hiro | ;; |
| 1740 | 1 | hiro | |
| 1741 | 1 | hiro | -rpath) |
| 1742 | 1 | hiro | prev=rpath |
| 1743 | 1 | hiro | continue |
| 1744 | 1 | hiro | ;; |
| 1745 | 1 | hiro | |
| 1746 | 1 | hiro | -R) |
| 1747 | 1 | hiro | prev=xrpath |
| 1748 | 1 | hiro | continue |
| 1749 | 1 | hiro | ;; |
| 1750 | 1 | hiro | |
| 1751 | 1 | hiro | -R*) |
| 1752 | 1 | hiro | dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` |
| 1753 | 1 | hiro | # We need an absolute path. |
| 1754 | 1 | hiro | case $dir in |
| 1755 | 1 | hiro | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 1756 | 1 | hiro | *) |
| 1757 | 1 | hiro | $echo "$modename: only absolute run-paths are allowed" 1>&2 |
| 1758 | 1 | hiro | exit $EXIT_FAILURE |
| 1759 | 1 | hiro | ;; |
| 1760 | 1 | hiro | esac |
| 1761 | 1 | hiro | case "$xrpath " in |
| 1762 | 1 | hiro | *" $dir "*) ;; |
| 1763 | 1 | hiro | *) xrpath="$xrpath $dir" ;; |
| 1764 | 1 | hiro | esac |
| 1765 | 1 | hiro | continue |
| 1766 | 1 | hiro | ;; |
| 1767 | 1 | hiro | |
| 1768 | 2022 | hiro | -static | -static-libtool-libs) |
| 1769 | 1 | hiro | # The effects of -static are defined in a previous loop. |
| 1770 | 1 | hiro | # We used to do the same as -all-static on platforms that |
| 1771 | 1 | hiro | # didn't have a PIC flag, but the assumption that the effects |
| 1772 | 1 | hiro | # would be equivalent was wrong. It would break on at least |
| 1773 | 1 | hiro | # Digital Unix and AIX. |
| 1774 | 1 | hiro | continue |
| 1775 | 1 | hiro | ;; |
| 1776 | 1 | hiro | |
| 1777 | 1 | hiro | -thread-safe) |
| 1778 | 1 | hiro | thread_safe=yes |
| 1779 | 1 | hiro | continue |
| 1780 | 1 | hiro | ;; |
| 1781 | 1 | hiro | |
| 1782 | 1 | hiro | -version-info) |
| 1783 | 1 | hiro | prev=vinfo |
| 1784 | 1 | hiro | continue |
| 1785 | 1 | hiro | ;; |
| 1786 | 1 | hiro | -version-number) |
| 1787 | 1 | hiro | prev=vinfo |
| 1788 | 1 | hiro | vinfo_number=yes |
| 1789 | 1 | hiro | continue |
| 1790 | 1 | hiro | ;; |
| 1791 | 1 | hiro | |
| 1792 | 1 | hiro | -Wc,*) |
| 1793 | 1 | hiro | args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` |
| 1794 | 1 | hiro | arg= |
| 1795 | 1 | hiro | save_ifs="$IFS"; IFS=',' |
| 1796 | 1 | hiro | for flag in $args; do |
| 1797 | 1 | hiro | IFS="$save_ifs" |
| 1798 | 1 | hiro | case $flag in |
| 1799 | 1 | hiro | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
| 1800 | 1 | hiro | flag="\"$flag\"" |
| 1801 | 1 | hiro | ;; |
| 1802 | 1 | hiro | esac |
| 1803 | 1 | hiro | arg="$arg $wl$flag" |
| 1804 | 1 | hiro | compiler_flags="$compiler_flags $flag" |
| 1805 | 1 | hiro | done |
| 1806 | 1 | hiro | IFS="$save_ifs" |
| 1807 | 1 | hiro | arg=`$echo "X$arg" | $Xsed -e "s/^ //"` |
| 1808 | 1 | hiro | ;; |
| 1809 | 1 | hiro | |
| 1810 | 1 | hiro | -Wl,*) |
| 1811 | 1 | hiro | args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` |
| 1812 | 1 | hiro | arg= |
| 1813 | 1 | hiro | save_ifs="$IFS"; IFS=',' |
| 1814 | 1 | hiro | for flag in $args; do |
| 1815 | 1 | hiro | IFS="$save_ifs" |
| 1816 | 1 | hiro | case $flag in |
| 1817 | 1 | hiro | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
| 1818 | 1 | hiro | flag="\"$flag\"" |
| 1819 | 1 | hiro | ;; |
| 1820 | 1 | hiro | esac |
| 1821 | 1 | hiro | arg="$arg $wl$flag" |
| 1822 | 1 | hiro | compiler_flags="$compiler_flags $wl$flag" |
| 1823 | 1 | hiro | linker_flags="$linker_flags $flag" |
| 1824 | 1 | hiro | done |
| 1825 | 1 | hiro | IFS="$save_ifs" |
| 1826 | 1 | hiro | arg=`$echo "X$arg" | $Xsed -e "s/^ //"` |
| 1827 | 1 | hiro | ;; |
| 1828 | 1 | hiro | |
| 1829 | 1 | hiro | -Xcompiler) |
| 1830 | 1 | hiro | prev=xcompiler |
| 1831 | 1 | hiro | continue |
| 1832 | 1 | hiro | ;; |
| 1833 | 1 | hiro | |
| 1834 | 1 | hiro | -Xlinker) |
| 1835 | 1 | hiro | prev=xlinker |
| 1836 | 1 | hiro | continue |
| 1837 | 1 | hiro | ;; |
| 1838 | 1 | hiro | |
| 1839 | 1 | hiro | -XCClinker) |
| 1840 | 1 | hiro | prev=xcclinker |
| 1841 | 1 | hiro | continue |
| 1842 | 1 | hiro | ;; |
| 1843 | 1 | hiro | |
| 1844 | 1 | hiro | # Some other compiler flag. |
| 1845 | 1 | hiro | -* | +*) |
| 1846 | 1 | hiro | # Unknown arguments in both finalize_command and compile_command need |
| 1847 | 1 | hiro | # to be aesthetically quoted because they are evaled later. |
| 1848 | 1 | hiro | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
| 1849 | 1 | hiro | case $arg in |
| 1850 | 1 | hiro | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
| 1851 | 1 | hiro | arg="\"$arg\"" |
| 1852 | 1 | hiro | ;; |
| 1853 | 1 | hiro | esac |
| 1854 | 1 | hiro | ;; |
| 1855 | 1 | hiro | |
| 1856 | 1 | hiro | *.$objext) |
| 1857 | 1 | hiro | # A standard object. |
| 1858 | 1 | hiro | objs="$objs $arg" |
| 1859 | 1 | hiro | ;; |
| 1860 | 1 | hiro | |
| 1861 | 1 | hiro | *.lo) |
| 1862 | 1 | hiro | # A libtool-controlled object. |
| 1863 | 1 | hiro | |
| 1864 | 1 | hiro | # Check to see that this really is a libtool object. |
| 1865 | 1 | hiro | if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
|
| 1866 | 1 | hiro | pic_object= |
| 1867 | 1 | hiro | non_pic_object= |
| 1868 | 1 | hiro | |
| 1869 | 1 | hiro | # Read the .lo file |
| 1870 | 1 | hiro | # If there is no directory component, then add one. |
| 1871 | 1 | hiro | case $arg in |
| 1872 | 1 | hiro | */* | *\\*) . $arg ;; |
| 1873 | 1 | hiro | *) . ./$arg ;; |
| 1874 | 1 | hiro | esac |
| 1875 | 1 | hiro | |
| 1876 | 1 | hiro | if test -z "$pic_object" || \ |
| 1877 | 1 | hiro | test -z "$non_pic_object" || |
| 1878 | 1 | hiro | test "$pic_object" = none && \ |
| 1879 | 1 | hiro | test "$non_pic_object" = none; then |
| 1880 | 1 | hiro | $echo "$modename: cannot find name of object for \`$arg'" 1>&2 |
| 1881 | 1 | hiro | exit $EXIT_FAILURE |
| 1882 | 1 | hiro | fi |
| 1883 | 1 | hiro | |
| 1884 | 1 | hiro | # Extract subdirectory from the argument. |
| 1885 | 1 | hiro | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
| 1886 | 1 | hiro | if test "X$xdir" = "X$arg"; then |
| 1887 | 1 | hiro | xdir= |
| 1888 | 1 | hiro | else |
| 1889 | 1 | hiro | xdir="$xdir/" |
| 1890 | 1 | hiro | fi |
| 1891 | 1 | hiro | |
| 1892 | 1 | hiro | if test "$pic_object" != none; then |
| 1893 | 1 | hiro | # Prepend the subdirectory the object is found in. |
| 1894 | 1 | hiro | pic_object="$xdir$pic_object" |
| 1895 | 1 | hiro | |
| 1896 | 1 | hiro | if test "$prev" = dlfiles; then |
| 1897 | 1 | hiro | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then |
| 1898 | 1 | hiro | dlfiles="$dlfiles $pic_object" |
| 1899 | 1 | hiro | prev= |
| 1900 | 1 | hiro | continue |
| 1901 | 1 | hiro | else |
| 1902 | 1 | hiro | # If libtool objects are unsupported, then we need to preload. |
| 1903 | 1 | hiro | prev=dlprefiles |
| 1904 | 1 | hiro | fi |
| 1905 | 1 | hiro | fi |
| 1906 | 1 | hiro | |
| 1907 | 1 | hiro | # CHECK ME: I think I busted this. -Ossama |
| 1908 | 1 | hiro | if test "$prev" = dlprefiles; then |
| 1909 | 1 | hiro | # Preload the old-style object. |
| 1910 | 1 | hiro | dlprefiles="$dlprefiles $pic_object" |
| 1911 | 1 | hiro | prev= |
| 1912 | 1 | hiro | fi |
| 1913 | 1 | hiro | |
| 1914 | 1 | hiro | # A PIC object. |
| 1915 | 1 | hiro | libobjs="$libobjs $pic_object" |
| 1916 | 1 | hiro | arg="$pic_object" |
| 1917 | 1 | hiro | fi |
| 1918 | 1 | hiro | |
| 1919 | 1 | hiro | # Non-PIC object. |
| 1920 | 1 | hiro | if test "$non_pic_object" != none; then |
| 1921 | 1 | hiro | # Prepend the subdirectory the object is found in. |
| 1922 | 1 | hiro | non_pic_object="$xdir$non_pic_object" |
| 1923 | 1 | hiro | |
| 1924 | 1 | hiro | # A standard non-PIC object |
| 1925 | 1 | hiro | non_pic_objects="$non_pic_objects $non_pic_object" |
| 1926 | 1 | hiro | if test -z "$pic_object" || test "$pic_object" = none ; then |
| 1927 | 1 | hiro | arg="$non_pic_object" |
| 1928 | 1 | hiro | fi |
| 1929 | 879 | hiro | else |
| 1930 | 879 | hiro | # If the PIC object exists, use it instead. |
| 1931 | 879 | hiro | # $xdir was prepended to $pic_object above. |
| 1932 | 879 | hiro | non_pic_object="$pic_object" |
| 1933 | 879 | hiro | non_pic_objects="$non_pic_objects $non_pic_object" |
| 1934 | 1 | hiro | fi |
| 1935 | 1 | hiro | else |
| 1936 | 1 | hiro | # Only an error if not doing a dry-run. |
| 1937 | 1 | hiro | if test -z "$run"; then |
| 1938 | 1 | hiro | $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 |
| 1939 | 1 | hiro | exit $EXIT_FAILURE |
| 1940 | 1 | hiro | else |
| 1941 | 1 | hiro | # Dry-run case. |
| 1942 | 1 | hiro | |
| 1943 | 1 | hiro | # Extract subdirectory from the argument. |
| 1944 | 1 | hiro | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` |
| 1945 | 1 | hiro | if test "X$xdir" = "X$arg"; then |
| 1946 | 1 | hiro | xdir= |
| 1947 | 1 | hiro | else |
| 1948 | 1 | hiro | xdir="$xdir/" |
| 1949 | 1 | hiro | fi |
| 1950 | 1 | hiro | |
| 1951 | 1 | hiro | pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
|
| 1952 | 1 | hiro | non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
|
| 1953 | 1 | hiro | libobjs="$libobjs $pic_object" |
| 1954 | 1 | hiro | non_pic_objects="$non_pic_objects $non_pic_object" |
| 1955 | 1 | hiro | fi |
| 1956 | 1 | hiro | fi |
| 1957 | 1 | hiro | ;; |
| 1958 | 1 | hiro | |
| 1959 | 1 | hiro | *.$libext) |
| 1960 | 1 | hiro | # An archive. |
| 1961 | 1 | hiro | deplibs="$deplibs $arg" |
| 1962 | 1 | hiro | old_deplibs="$old_deplibs $arg" |
| 1963 | 1 | hiro | continue |
| 1964 | 1 | hiro | ;; |
| 1965 | 1 | hiro | |
| 1966 | 1 | hiro | *.la) |
| 1967 | 1 | hiro | # A libtool-controlled library. |
| 1968 | 1 | hiro | |
| 1969 | 1 | hiro | if test "$prev" = dlfiles; then |
| 1970 | 1 | hiro | # This library was specified with -dlopen. |
| 1971 | 1 | hiro | dlfiles="$dlfiles $arg" |
| 1972 | 1 | hiro | prev= |
| 1973 | 1 | hiro | elif test "$prev" = dlprefiles; then |
| 1974 | 1 | hiro | # The library was specified with -dlpreopen. |
| 1975 | 1 | hiro | dlprefiles="$dlprefiles $arg" |
| 1976 | 1 | hiro | prev= |
| 1977 | 1 | hiro | else |
| 1978 | 1 | hiro | deplibs="$deplibs $arg" |
| 1979 | 1 | hiro | fi |
| 1980 | 1 | hiro | continue |
| 1981 | 1 | hiro | ;; |
| 1982 | 1 | hiro | |
| 1983 | 1 | hiro | # Some other compiler argument. |
| 1984 | 1 | hiro | *) |
| 1985 | 1 | hiro | # Unknown arguments in both finalize_command and compile_command need |
| 1986 | 1 | hiro | # to be aesthetically quoted because they are evaled later. |
| 1987 | 1 | hiro | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` |
| 1988 | 1 | hiro | case $arg in |
| 1989 | 1 | hiro | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
|
| 1990 | 1 | hiro | arg="\"$arg\"" |
| 1991 | 1 | hiro | ;; |
| 1992 | 1 | hiro | esac |
| 1993 | 1 | hiro | ;; |
| 1994 | 1 | hiro | esac # arg |
| 1995 | 1 | hiro | |
| 1996 | 1 | hiro | # Now actually substitute the argument into the commands. |
| 1997 | 1 | hiro | if test -n "$arg"; then |
| 1998 | 1 | hiro | compile_command="$compile_command $arg" |
| 1999 | 1 | hiro | finalize_command="$finalize_command $arg" |
| 2000 | 1 | hiro | fi |
| 2001 | 1 | hiro | done # argument parsing loop |
| 2002 | 1 | hiro | |
| 2003 | 1 | hiro | if test -n "$prev"; then |
| 2004 | 1 | hiro | $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 |
| 2005 | 1 | hiro | $echo "$help" 1>&2 |
| 2006 | 1 | hiro | exit $EXIT_FAILURE |
| 2007 | 1 | hiro | fi |
| 2008 | 1 | hiro | |
| 2009 | 1 | hiro | if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then |
| 2010 | 1 | hiro | eval arg=\"$export_dynamic_flag_spec\" |
| 2011 | 1 | hiro | compile_command="$compile_command $arg" |
| 2012 | 1 | hiro | finalize_command="$finalize_command $arg" |
| 2013 | 1 | hiro | fi |
| 2014 | 1 | hiro | |
| 2015 | 1 | hiro | oldlibs= |
| 2016 | 1 | hiro | # calculate the name of the file, without its directory |
| 2017 | 1 | hiro | outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` |
| 2018 | 1 | hiro | libobjs_save="$libobjs" |
| 2019 | 1 | hiro | |
| 2020 | 1 | hiro | if test -n "$shlibpath_var"; then |
| 2021 | 1 | hiro | # get the directories listed in $shlibpath_var |
| 2022 | 1 | hiro | eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
|
| 2023 | 1 | hiro | else |
| 2024 | 1 | hiro | shlib_search_path= |
| 2025 | 1 | hiro | fi |
| 2026 | 1 | hiro | eval sys_lib_search_path=\"$sys_lib_search_path_spec\" |
| 2027 | 1 | hiro | eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" |
| 2028 | 1 | hiro | |
| 2029 | 1 | hiro | output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` |
| 2030 | 1 | hiro | if test "X$output_objdir" = "X$output"; then |
| 2031 | 1 | hiro | output_objdir="$objdir" |
| 2032 | 1 | hiro | else |
| 2033 | 1 | hiro | output_objdir="$output_objdir/$objdir" |
| 2034 | 1 | hiro | fi |
| 2035 | 1 | hiro | # Create the object directory. |
| 2036 | 1 | hiro | if test ! -d "$output_objdir"; then |
| 2037 | 1 | hiro | $show "$mkdir $output_objdir" |
| 2038 | 1 | hiro | $run $mkdir $output_objdir |
| 2039 | 879 | hiro | exit_status=$? |
| 2040 | 879 | hiro | if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then |
| 2041 | 879 | hiro | exit $exit_status |
| 2042 | 1 | hiro | fi |
| 2043 | 1 | hiro | fi |
| 2044 | 1 | hiro | |
| 2045 | 1 | hiro | # Determine the type of output |
| 2046 | 1 | hiro | case $output in |
| 2047 | 1 | hiro | "") |
| 2048 | 1 | hiro | $echo "$modename: you must specify an output file" 1>&2 |
| 2049 | 1 | hiro | $echo "$help" 1>&2 |
| 2050 | 1 | hiro | exit $EXIT_FAILURE |
| 2051 | 1 | hiro | ;; |
| 2052 | 1 | hiro | *.$libext) linkmode=oldlib ;; |
| 2053 | 1 | hiro | *.lo | *.$objext) linkmode=obj ;; |
| 2054 | 1 | hiro | *.la) linkmode=lib ;; |
| 2055 | 1 | hiro | *) linkmode=prog ;; # Anything else should be a program. |
| 2056 | 1 | hiro | esac |
| 2057 | 1 | hiro | |
| 2058 | 1 | hiro | case $host in |
| 2059 | 1 | hiro | *cygwin* | *mingw* | *pw32*) |
| 2060 | 1 | hiro | # don't eliminate duplications in $postdeps and $predeps |
| 2061 | 1 | hiro | duplicate_compiler_generated_deps=yes |
| 2062 | 1 | hiro | ;; |
| 2063 | 1 | hiro | *) |
| 2064 | 1 | hiro | duplicate_compiler_generated_deps=$duplicate_deps |
| 2065 | 1 | hiro | ;; |
| 2066 | 1 | hiro | esac |
| 2067 | 1 | hiro | specialdeplibs= |
| 2068 | 1 | hiro | |
| 2069 | 1 | hiro | libs= |
| 2070 | 1 | hiro | # Find all interdependent deplibs by searching for libraries |
| 2071 | 1 | hiro | # that are linked more than once (e.g. -la -lb -la) |
| 2072 | 1 | hiro | for deplib in $deplibs; do |
| 2073 | 1 | hiro | if test "X$duplicate_deps" = "Xyes" ; then |
| 2074 | 1 | hiro | case "$libs " in |
| 2075 | 1 | hiro | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
| 2076 | 1 | hiro | esac |
| 2077 | 1 | hiro | fi |
| 2078 | 1 | hiro | libs="$libs $deplib" |
| 2079 | 1 | hiro | done |
| 2080 | 1 | hiro | |
| 2081 | 1 | hiro | if test "$linkmode" = lib; then |
| 2082 | 1 | hiro | libs="$predeps $libs $compiler_lib_search_path $postdeps" |
| 2083 | 1 | hiro | |
| 2084 | 1 | hiro | # Compute libraries that are listed more than once in $predeps |
| 2085 | 1 | hiro | # $postdeps and mark them as special (i.e., whose duplicates are |
| 2086 | 1 | hiro | # not to be eliminated). |
| 2087 | 1 | hiro | pre_post_deps= |
| 2088 | 1 | hiro | if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then |
| 2089 | 1 | hiro | for pre_post_dep in $predeps $postdeps; do |
| 2090 | 1 | hiro | case "$pre_post_deps " in |
| 2091 | 1 | hiro | *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; |
| 2092 | 1 | hiro | esac |
| 2093 | 1 | hiro | pre_post_deps="$pre_post_deps $pre_post_dep" |
| 2094 | 1 | hiro | done |
| 2095 | 1 | hiro | fi |
| 2096 | 1 | hiro | pre_post_deps= |
| 2097 | 1 | hiro | fi |
| 2098 | 1 | hiro | |
| 2099 | 1 | hiro | deplibs= |
| 2100 | 1 | hiro | newdependency_libs= |
| 2101 | 1 | hiro | newlib_search_path= |
| 2102 | 1 | hiro | need_relink=no # whether we're linking any uninstalled libtool libraries |
| 2103 | 1 | hiro | notinst_deplibs= # not-installed libtool libraries |
| 2104 | 1 | hiro | case $linkmode in |
| 2105 | 1 | hiro | lib) |
| 2106 | 1 | hiro | passes="conv link" |
| 2107 | 1 | hiro | for file in $dlfiles $dlprefiles; do |
| 2108 | 1 | hiro | case $file in |
| 2109 | 1 | hiro | *.la) ;; |
| 2110 | 1 | hiro | *) |
| 2111 | 1 | hiro | $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 |
| 2112 | 1 | hiro | exit $EXIT_FAILURE |
| 2113 | 1 | hiro | ;; |
| 2114 | 1 | hiro | esac |
| 2115 | 1 | hiro | done |
| 2116 | 1 | hiro | ;; |
| 2117 | 1 | hiro | prog) |
| 2118 | 1 | hiro | compile_deplibs= |
| 2119 | 1 | hiro | finalize_deplibs= |
| 2120 | 1 | hiro | alldeplibs=no |
| 2121 | 1 | hiro | newdlfiles= |
| 2122 | 1 | hiro | newdlprefiles= |
| 2123 | 1 | hiro | passes="conv scan dlopen dlpreopen link" |
| 2124 | 1 | hiro | ;; |
| 2125 | 1 | hiro | *) passes="conv" |
| 2126 | 1 | hiro | ;; |
| 2127 | 1 | hiro | esac |
| 2128 | 1 | hiro | for pass in $passes; do |
| 2129 | 1 | hiro | if test "$linkmode,$pass" = "lib,link" || |
| 2130 | 1 | hiro | test "$linkmode,$pass" = "prog,scan"; then |
| 2131 | 1 | hiro | libs="$deplibs" |
| 2132 | 1 | hiro | deplibs= |
| 2133 | 1 | hiro | fi |
| 2134 | 1 | hiro | if test "$linkmode" = prog; then |
| 2135 | 1 | hiro | case $pass in |
| 2136 | 1 | hiro | dlopen) libs="$dlfiles" ;; |
| 2137 | 1 | hiro | dlpreopen) libs="$dlprefiles" ;; |
| 2138 | 1 | hiro | link) |
| 2139 | 1 | hiro | libs="$deplibs %DEPLIBS%" |
| 2140 | 1 | hiro | test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" |
| 2141 | 1 | hiro | ;; |
| 2142 | 1 | hiro | esac |
| 2143 | 1 | hiro | fi |
| 2144 | 1 | hiro | if test "$pass" = dlopen; then |
| 2145 | 1 | hiro | # Collect dlpreopened libraries |
| 2146 | 1 | hiro | save_deplibs="$deplibs" |
| 2147 | 1 | hiro | deplibs= |
| 2148 | 1 | hiro | fi |
| 2149 | 1 | hiro | for deplib in $libs; do |
| 2150 | 1 | hiro | lib= |
| 2151 | 1 | hiro | found=no |
| 2152 | 1 | hiro | case $deplib in |
| 2153 | 2022 | hiro | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) |
| 2154 | 1 | hiro | if test "$linkmode,$pass" = "prog,link"; then |
| 2155 | 1 | hiro | compile_deplibs="$deplib $compile_deplibs" |
| 2156 | 1 | hiro | finalize_deplibs="$deplib $finalize_deplibs" |
| 2157 | 1 | hiro | else |
| 2158 | 597 | hiro | compiler_flags="$compiler_flags $deplib" |
| 2159 | 1 | hiro | fi |
| 2160 | 1 | hiro | continue |
| 2161 | 1 | hiro | ;; |
| 2162 | 1 | hiro | -l*) |
| 2163 | 1 | hiro | if test "$linkmode" != lib && test "$linkmode" != prog; then |
| 2164 | 1 | hiro | $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 |
| 2165 | 1 | hiro | continue |
| 2166 | 1 | hiro | fi |
| 2167 | 1 | hiro | name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` |
| 2168 | 2022 | hiro | if test "$linkmode" = lib; then |
| 2169 | 2022 | hiro | searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" |
| 2170 | 2022 | hiro | else |
| 2171 | 2022 | hiro | searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" |
| 2172 | 2022 | hiro | fi |
| 2173 | 2022 | hiro | for searchdir in $searchdirs; do |
| 2174 | 1 | hiro | for search_ext in .la $std_shrext .so .a; do |
| 2175 | 1 | hiro | # Search the libtool library |
| 2176 | 1 | hiro | lib="$searchdir/lib${name}${search_ext}"
|
| 2177 | 1 | hiro | if test -f "$lib"; then |
| 2178 | 1 | hiro | if test "$search_ext" = ".la"; then |
| 2179 | 1 | hiro | found=yes |
| 2180 | 1 | hiro | else |
| 2181 | 1 | hiro | found=no |
| 2182 | 1 | hiro | fi |
| 2183 | 1 | hiro | break 2 |
| 2184 | 1 | hiro | fi |
| 2185 | 1 | hiro | done |
| 2186 | 1 | hiro | done |
| 2187 | 1 | hiro | if test "$found" != yes; then |
| 2188 | 1 | hiro | # deplib doesn't seem to be a libtool library |
| 2189 | 1 | hiro | if test "$linkmode,$pass" = "prog,link"; then |
| 2190 | 1 | hiro | compile_deplibs="$deplib $compile_deplibs" |
| 2191 | 1 | hiro | finalize_deplibs="$deplib $finalize_deplibs" |
| 2192 | 1 | hiro | else |
| 2193 | 1 | hiro | deplibs="$deplib $deplibs" |
| 2194 | 1 | hiro | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" |
| 2195 | 1 | hiro | fi |
| 2196 | 1 | hiro | continue |
| 2197 | 1 | hiro | else # deplib is a libtool library |
| 2198 | 1 | hiro | # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, |
| 2199 | 1 | hiro | # We need to do some special things here, and not later. |
| 2200 | 1 | hiro | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 2201 | 1 | hiro | case " $predeps $postdeps " in |
| 2202 | 1 | hiro | *" $deplib "*) |
| 2203 | 1 | hiro | if (${SED} -e '2q' $lib |
|
| 2204 | 1 | hiro | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then |
| 2205 | 1 | hiro | library_names= |
| 2206 | 1 | hiro | old_library= |
| 2207 | 1 | hiro | case $lib in |
| 2208 | 1 | hiro | */* | *\\*) . $lib ;; |
| 2209 | 1 | hiro | *) . ./$lib ;; |
| 2210 | 1 | hiro | esac |
| 2211 | 1 | hiro | for l in $old_library $library_names; do |
| 2212 | 1 | hiro | ll="$l" |
| 2213 | 1 | hiro | done |
| 2214 | 1 | hiro | if test "X$ll" = "X$old_library" ; then # only static version available |
| 2215 | 1 | hiro | found=no |
| 2216 | 1 | hiro | ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` |
| 2217 | 1 | hiro | test "X$ladir" = "X$lib" && ladir="." |
| 2218 | 1 | hiro | lib=$ladir/$old_library |
| 2219 | 1 | hiro | if test "$linkmode,$pass" = "prog,link"; then |
| 2220 | 1 | hiro | compile_deplibs="$deplib $compile_deplibs" |
| 2221 | 1 | hiro | finalize_deplibs="$deplib $finalize_deplibs" |
| 2222 | 1 | hiro | else |
| 2223 | 1 | hiro | deplibs="$deplib $deplibs" |
| 2224 | 1 | hiro | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" |
| 2225 | 1 | hiro | fi |
| 2226 | 1 | hiro | continue |
| 2227 | 1 | hiro | fi |
| 2228 | 1 | hiro | fi |
| 2229 | 1 | hiro | ;; |
| 2230 | 1 | hiro | *) ;; |
| 2231 | 1 | hiro | esac |
| 2232 | 1 | hiro | fi |
| 2233 | 1 | hiro | fi |
| 2234 | 1 | hiro | ;; # -l |
| 2235 | 1 | hiro | -L*) |
| 2236 | 1 | hiro | case $linkmode in |
| 2237 | 1 | hiro | lib) |
| 2238 | 1 | hiro | deplibs="$deplib $deplibs" |
| 2239 | 1 | hiro | test "$pass" = conv && continue |
| 2240 | 1 | hiro | newdependency_libs="$deplib $newdependency_libs" |
| 2241 | 1 | hiro | newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` |
| 2242 | 1 | hiro | ;; |
| 2243 | 1 | hiro | prog) |
| 2244 | 1 | hiro | if test "$pass" = conv; then |
| 2245 | 1 | hiro | deplibs="$deplib $deplibs" |
| 2246 | 1 | hiro | continue |
| 2247 | 1 | hiro | fi |
| 2248 | 1 | hiro | if test "$pass" = scan; then |
| 2249 | 1 | hiro | deplibs="$deplib $deplibs" |
| 2250 | 1 | hiro | else |
| 2251 | 1 | hiro | compile_deplibs="$deplib $compile_deplibs" |
| 2252 | 1 | hiro | finalize_deplibs="$deplib $finalize_deplibs" |
| 2253 | 1 | hiro | fi |
| 2254 | 1 | hiro | newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` |
| 2255 | 1 | hiro | ;; |
| 2256 | 1 | hiro | *) |
| 2257 | 1 | hiro | $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 |
| 2258 | 1 | hiro | ;; |
| 2259 | 1 | hiro | esac # linkmode |
| 2260 | 1 | hiro | continue |
| 2261 | 1 | hiro | ;; # -L |
| 2262 | 1 | hiro | -R*) |
| 2263 | 1 | hiro | if test "$pass" = link; then |
| 2264 | 1 | hiro | dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` |
| 2265 | 1 | hiro | # Make sure the xrpath contains only unique directories. |
| 2266 | 1 | hiro | case "$xrpath " in |
| 2267 | 1 | hiro | *" $dir "*) ;; |
| 2268 | 1 | hiro | *) xrpath="$xrpath $dir" ;; |
| 2269 | 1 | hiro | esac |
| 2270 | 1 | hiro | fi |
| 2271 | 1 | hiro | deplibs="$deplib $deplibs" |
| 2272 | 1 | hiro | continue |
| 2273 | 1 | hiro | ;; |
| 2274 | 1 | hiro | *.la) lib="$deplib" ;; |
| 2275 | 1 | hiro | *.$libext) |
| 2276 | 1 | hiro | if test "$pass" = conv; then |
| 2277 | 1 | hiro | deplibs="$deplib $deplibs" |
| 2278 | 1 | hiro | continue |
| 2279 | 1 | hiro | fi |
| 2280 | 1 | hiro | case $linkmode in |
| 2281 | 1 | hiro | lib) |
| 2282 | 597 | hiro | valid_a_lib=no |
| 2283 | 597 | hiro | case $deplibs_check_method in |
| 2284 | 597 | hiro | match_pattern*) |
| 2285 | 597 | hiro | set dummy $deplibs_check_method |
| 2286 | 597 | hiro | match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` |
| 2287 | 597 | hiro | if eval $echo \"$deplib\" 2>/dev/null \ |
| 2288 | 597 | hiro | | $SED 10q \ |
| 2289 | 597 | hiro | | $EGREP "$match_pattern_regex" > /dev/null; then |
| 2290 | 597 | hiro | valid_a_lib=yes |
| 2291 | 597 | hiro | fi |
| 2292 | 597 | hiro | ;; |
| 2293 | 597 | hiro | pass_all) |
| 2294 | 597 | hiro | valid_a_lib=yes |
| 2295 | 597 | hiro | ;; |
| 2296 | 597 | hiro | esac |
| 2297 | 597 | hiro | if test "$valid_a_lib" != yes; then |
| 2298 | 1 | hiro | $echo |
| 2299 | 1 | hiro | $echo "*** Warning: Trying to link with static lib archive $deplib." |
| 2300 | 1 | hiro | $echo "*** I have the capability to make that library automatically link in when" |
| 2301 | 1 | hiro | $echo "*** you link to this library. But I can only do this if you have a" |
| 2302 | 1 | hiro | $echo "*** shared version of the library, which you do not appear to have" |
| 2303 | 1 | hiro | $echo "*** because the file extensions .$libext of this argument makes me believe" |
| 2304 | 1 | hiro | $echo "*** that it is just a static archive that I should not used here." |
| 2305 | 1 | hiro | else |
| 2306 | 1 | hiro | $echo |
| 2307 | 1 | hiro | $echo "*** Warning: Linking the shared library $output against the" |
| 2308 | 1 | hiro | $echo "*** static library $deplib is not portable!" |
| 2309 | 1 | hiro | deplibs="$deplib $deplibs" |
| 2310 | 1 | hiro | fi |
| 2311 | 1 | hiro | continue |
| 2312 | 1 | hiro | ;; |
| 2313 | 1 | hiro | prog) |
| 2314 | 1 | hiro | if test "$pass" != link; then |
| 2315 | 1 | hiro | deplibs="$deplib $deplibs" |
| 2316 | 1 | hiro | else |
| 2317 | 1 | hiro | compile_deplibs="$deplib $compile_deplibs" |
| 2318 | 1 | hiro | finalize_deplibs="$deplib $finalize_deplibs" |
| 2319 | 1 | hiro | fi |
| 2320 | 1 | hiro | continue |
| 2321 | 1 | hiro | ;; |
| 2322 | 1 | hiro | esac # linkmode |
| 2323 | 1 | hiro | ;; # *.$libext |
| 2324 | 1 | hiro | *.lo | *.$objext) |
| 2325 | 1 | hiro | if test "$pass" = conv; then |
| 2326 | 1 | hiro | deplibs="$deplib $deplibs" |
| 2327 | 1 | hiro | elif test "$linkmode" = prog; then |
| 2328 | 1 | hiro | if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then |
| 2329 | 1 | hiro | # If there is no dlopen support or we're linking statically, |
| 2330 | 1 | hiro | # we need to preload. |
| 2331 | 1 | hiro | newdlprefiles="$newdlprefiles $deplib" |
| 2332 | 1 | hiro | compile_deplibs="$deplib $compile_deplibs" |
| 2333 | 1 | hiro | finalize_deplibs="$deplib $finalize_deplibs" |
| 2334 | 1 | hiro | else |
| 2335 | 1 | hiro | newdlfiles="$newdlfiles $deplib" |
| 2336 | 1 | hiro | fi |
| 2337 | 1 | hiro | fi |
| 2338 | 1 | hiro | continue |
| 2339 | 1 | hiro | ;; |
| 2340 | 1 | hiro | %DEPLIBS%) |
| 2341 | 1 | hiro | alldeplibs=yes |
| 2342 | 1 | hiro | continue |
| 2343 | 1 | hiro | ;; |
| 2344 | 1 | hiro | esac # case $deplib |
| 2345 | 1 | hiro | if test "$found" = yes || test -f "$lib"; then : |
| 2346 | 1 | hiro | else |
| 2347 | 879 | hiro | $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 |
| 2348 | 1 | hiro | exit $EXIT_FAILURE |
| 2349 | 1 | hiro | fi |
| 2350 | 1 | hiro | |
| 2351 | 1 | hiro | # Check to see that this really is a libtool archive. |
| 2352 | 1 | hiro | if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
|
| 2353 | 1 | hiro | else |
| 2354 | 1 | hiro | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 |
| 2355 | 1 | hiro | exit $EXIT_FAILURE |
| 2356 | 1 | hiro | fi |
| 2357 | 1 | hiro | |
| 2358 | 1 | hiro | ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` |
| 2359 | 1 | hiro | test "X$ladir" = "X$lib" && ladir="." |
| 2360 | 1 | hiro | |
| 2361 | 1 | hiro | dlname= |
| 2362 | 1 | hiro | dlopen= |
| 2363 | 1 | hiro | dlpreopen= |
| 2364 | 1 | hiro | libdir= |
| 2365 | 1 | hiro | library_names= |
| 2366 | 1 | hiro | old_library= |
| 2367 | 1 | hiro | # If the library was installed with an old release of libtool, |
| 2368 | 1 | hiro | # it will not redefine variables installed, or shouldnotlink |
| 2369 | 1 | hiro | installed=yes |
| 2370 | 1 | hiro | shouldnotlink=no |
| 2371 | 597 | hiro | avoidtemprpath= |
| 2372 | 1 | hiro | |
| 2373 | 597 | hiro | |
| 2374 | 1 | hiro | # Read the .la file |
| 2375 | 1 | hiro | case $lib in |
| 2376 | 1 | hiro | */* | *\\*) . $lib ;; |
| 2377 | 1 | hiro | *) . ./$lib ;; |
| 2378 | 1 | hiro | esac |
| 2379 | 1 | hiro | |
| 2380 | 1 | hiro | if test "$linkmode,$pass" = "lib,link" || |
| 2381 | 1 | hiro | test "$linkmode,$pass" = "prog,scan" || |
| 2382 | 1 | hiro | { test "$linkmode" != prog && test "$linkmode" != lib; }; then
|
| 2383 | 1 | hiro | test -n "$dlopen" && dlfiles="$dlfiles $dlopen" |
| 2384 | 1 | hiro | test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" |
| 2385 | 1 | hiro | fi |
| 2386 | 1 | hiro | |
| 2387 | 1 | hiro | if test "$pass" = conv; then |
| 2388 | 1 | hiro | # Only check for convenience libraries |
| 2389 | 1 | hiro | deplibs="$lib $deplibs" |
| 2390 | 1 | hiro | if test -z "$libdir"; then |
| 2391 | 1 | hiro | if test -z "$old_library"; then |
| 2392 | 1 | hiro | $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 |
| 2393 | 1 | hiro | exit $EXIT_FAILURE |
| 2394 | 1 | hiro | fi |
| 2395 | 1 | hiro | # It is a libtool convenience library, so add in its objects. |
| 2396 | 1 | hiro | convenience="$convenience $ladir/$objdir/$old_library" |
| 2397 | 1 | hiro | old_convenience="$old_convenience $ladir/$objdir/$old_library" |
| 2398 | 1 | hiro | tmp_libs= |
| 2399 | 1 | hiro | for deplib in $dependency_libs; do |
| 2400 | 1 | hiro | deplibs="$deplib $deplibs" |
| 2401 | 1 | hiro | if test "X$duplicate_deps" = "Xyes" ; then |
| 2402 | 1 | hiro | case "$tmp_libs " in |
| 2403 | 1 | hiro | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
| 2404 | 1 | hiro | esac |
| 2405 | 1 | hiro | fi |
| 2406 | 1 | hiro | tmp_libs="$tmp_libs $deplib" |
| 2407 | 1 | hiro | done |
| 2408 | 1 | hiro | elif test "$linkmode" != prog && test "$linkmode" != lib; then |
| 2409 | 1 | hiro | $echo "$modename: \`$lib' is not a convenience library" 1>&2 |
| 2410 | 1 | hiro | exit $EXIT_FAILURE |
| 2411 | 1 | hiro | fi |
| 2412 | 1 | hiro | continue |
| 2413 | 1 | hiro | fi # $pass = conv |
| 2414 | 1 | hiro | |
| 2415 | 1 | hiro | |
| 2416 | 1 | hiro | # Get the name of the library we link against. |
| 2417 | 1 | hiro | linklib= |
| 2418 | 1 | hiro | for l in $old_library $library_names; do |
| 2419 | 1 | hiro | linklib="$l" |
| 2420 | 1 | hiro | done |
| 2421 | 1 | hiro | if test -z "$linklib"; then |
| 2422 | 1 | hiro | $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 |
| 2423 | 1 | hiro | exit $EXIT_FAILURE |
| 2424 | 1 | hiro | fi |
| 2425 | 1 | hiro | |
| 2426 | 1 | hiro | # This library was specified with -dlopen. |
| 2427 | 1 | hiro | if test "$pass" = dlopen; then |
| 2428 | 1 | hiro | if test -z "$libdir"; then |
| 2429 | 1 | hiro | $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 |
| 2430 | 1 | hiro | exit $EXIT_FAILURE |
| 2431 | 1 | hiro | fi |
| 2432 | 1 | hiro | if test -z "$dlname" || |
| 2433 | 1 | hiro | test "$dlopen_support" != yes || |
| 2434 | 1 | hiro | test "$build_libtool_libs" = no; then |
| 2435 | 1 | hiro | # If there is no dlname, no dlopen support or we're linking |
| 2436 | 1 | hiro | # statically, we need to preload. We also need to preload any |
| 2437 | 1 | hiro | # dependent libraries so libltdl's deplib preloader doesn't |
| 2438 | 1 | hiro | # bomb out in the load deplibs phase. |
| 2439 | 1 | hiro | dlprefiles="$dlprefiles $lib $dependency_libs" |
| 2440 | 1 | hiro | else |
| 2441 | 1 | hiro | newdlfiles="$newdlfiles $lib" |
| 2442 | 1 | hiro | fi |
| 2443 | 1 | hiro | continue |
| 2444 | 1 | hiro | fi # $pass = dlopen |
| 2445 | 1 | hiro | |
| 2446 | 1 | hiro | # We need an absolute path. |
| 2447 | 1 | hiro | case $ladir in |
| 2448 | 1 | hiro | [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; |
| 2449 | 1 | hiro | *) |
| 2450 | 1 | hiro | abs_ladir=`cd "$ladir" && pwd` |
| 2451 | 1 | hiro | if test -z "$abs_ladir"; then |
| 2452 | 1 | hiro | $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 |
| 2453 | 1 | hiro | $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 |
| 2454 | 1 | hiro | abs_ladir="$ladir" |
| 2455 | 1 | hiro | fi |
| 2456 | 1 | hiro | ;; |
| 2457 | 1 | hiro | esac |
| 2458 | 1 | hiro | laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` |
| 2459 | 1 | hiro | |
| 2460 | 1 | hiro | # Find the relevant object directory and library name. |
| 2461 | 1 | hiro | if test "X$installed" = Xyes; then |
| 2462 | 1 | hiro | if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
| 2463 | 1 | hiro | $echo "$modename: warning: library \`$lib' was moved." 1>&2 |
| 2464 | 1 | hiro | dir="$ladir" |
| 2465 | 1 | hiro | absdir="$abs_ladir" |
| 2466 | 1 | hiro | libdir="$abs_ladir" |
| 2467 | 1 | hiro | else |
| 2468 | 1 | hiro | dir="$libdir" |
| 2469 | 1 | hiro | absdir="$libdir" |
| 2470 | 1 | hiro | fi |
| 2471 | 597 | hiro | test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes |
| 2472 | 1 | hiro | else |
| 2473 | 597 | hiro | if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
| 2474 | 597 | hiro | dir="$ladir" |
| 2475 | 597 | hiro | absdir="$abs_ladir" |
| 2476 | 597 | hiro | # Remove this search path later |
| 2477 | 597 | hiro | notinst_path="$notinst_path $abs_ladir" |
| 2478 | 597 | hiro | else |
| 2479 | 597 | hiro | dir="$ladir/$objdir" |
| 2480 | 597 | hiro | absdir="$abs_ladir/$objdir" |
| 2481 | 597 | hiro | # Remove this search path later |
| 2482 | 597 | hiro | notinst_path="$notinst_path $abs_ladir" |
| 2483 | 597 | hiro | fi |
| 2484 | 1 | hiro | fi # $installed = yes |
| 2485 | 1 | hiro | name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` |
| 2486 | 1 | hiro | |
| 2487 | 1 | hiro | # This library was specified with -dlpreopen. |
| 2488 | 1 | hiro | if test "$pass" = dlpreopen; then |
| 2489 | 1 | hiro | if test -z "$libdir"; then |
| 2490 | 1 | hiro | $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 |
| 2491 | 1 | hiro | exit $EXIT_FAILURE |
| 2492 | 1 | hiro | fi |
| 2493 | 1 | hiro | # Prefer using a static library (so that no silly _DYNAMIC symbols |
| 2494 | 1 | hiro | # are required to link). |
| 2495 | 1 | hiro | if test -n "$old_library"; then |
| 2496 | 1 | hiro | newdlprefiles="$newdlprefiles $dir/$old_library" |
| 2497 | 1 | hiro | # Otherwise, use the dlname, so that lt_dlopen finds it. |
| 2498 | 1 | hiro | elif test -n "$dlname"; then |
| 2499 | 1 | hiro | newdlprefiles="$newdlprefiles $dir/$dlname" |
| 2500 | 1 | hiro | else |
| 2501 | 1 | hiro | newdlprefiles="$newdlprefiles $dir/$linklib" |
| 2502 | 1 | hiro | fi |
| 2503 | 1 | hiro | fi # $pass = dlpreopen |
| 2504 | 1 | hiro | |
| 2505 | 1 | hiro | if test -z "$libdir"; then |
| 2506 | 1 | hiro | # Link the convenience library |
| 2507 | 1 | hiro | if test "$linkmode" = lib; then |
| 2508 | 1 | hiro | deplibs="$dir/$old_library $deplibs" |
| 2509 | 1 | hiro | elif test "$linkmode,$pass" = "prog,link"; then |
| 2510 | 1 | hiro | compile_deplibs="$dir/$old_library $compile_deplibs" |
| 2511 | 1 | hiro | finalize_deplibs="$dir/$old_library $finalize_deplibs" |
| 2512 | 1 | hiro | else |
| 2513 | 1 | hiro | deplibs="$lib $deplibs" # used for prog,scan pass |
| 2514 | 1 | hiro | fi |
| 2515 | 1 | hiro | continue |
| 2516 | 1 | hiro | fi |
| 2517 | 1 | hiro | |
| 2518 | 1 | hiro | |
| 2519 | 1 | hiro | if test "$linkmode" = prog && test "$pass" != link; then |
| 2520 | 1 | hiro | newlib_search_path="$newlib_search_path $ladir" |
| 2521 | 1 | hiro | deplibs="$lib $deplibs" |
| 2522 | 1 | hiro | |
| 2523 | 1 | hiro | linkalldeplibs=no |
| 2524 | 1 | hiro | if test "$link_all_deplibs" != no || test -z "$library_names" || |
| 2525 | 1 | hiro | test "$build_libtool_libs" = no; then |
| 2526 | 1 | hiro | linkalldeplibs=yes |
| 2527 | 1 | hiro | fi |
| 2528 | 1 | hiro | |
| 2529 | 1 | hiro | tmp_libs= |
| 2530 | 1 | hiro | for deplib in $dependency_libs; do |
| 2531 | 1 | hiro | case $deplib in |
| 2532 | 1 | hiro | -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test |
| 2533 | 1 | hiro | esac |
| 2534 | 1 | hiro | # Need to link against all dependency_libs? |
| 2535 | 1 | hiro | if test "$linkalldeplibs" = yes; then |
| 2536 | 1 | hiro | deplibs="$deplib $deplibs" |
| 2537 | 1 | hiro | else |
| 2538 | 1 | hiro | # Need to hardcode shared library paths |
| 2539 | 1 | hiro | # or/and link against static libraries |
| 2540 | 1 | hiro | newdependency_libs="$deplib $newdependency_libs" |
| 2541 | 1 | hiro | fi |
| 2542 | 1 | hiro | if test "X$duplicate_deps" = "Xyes" ; then |
| 2543 | 1 | hiro | case "$tmp_libs " in |
| 2544 | 1 | hiro | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
| 2545 | 1 | hiro | esac |
| 2546 | 1 | hiro | fi |
| 2547 | 1 | hiro | tmp_libs="$tmp_libs $deplib" |
| 2548 | 1 | hiro | done # for deplib |
| 2549 | 1 | hiro | continue |
| 2550 | 1 | hiro | fi # $linkmode = prog... |
| 2551 | 1 | hiro | |
| 2552 | 1 | hiro | if test "$linkmode,$pass" = "prog,link"; then |
| 2553 | 1 | hiro | if test -n "$library_names" && |
| 2554 | 2022 | hiro | { { test "$prefer_static_libs" = no ||
|
| 2555 | 2022 | hiro | test "$prefer_static_libs,$installed" = "built,yes"; } || |
| 2556 | 2022 | hiro | test -z "$old_library"; }; then |
| 2557 | 1 | hiro | # We need to hardcode the library path |
| 2558 | 597 | hiro | if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then |
| 2559 | 1 | hiro | # Make sure the rpath contains only unique directories. |
| 2560 | 1 | hiro | case "$temp_rpath " in |
| 2561 | 1 | hiro | *" $dir "*) ;; |
| 2562 | 1 | hiro | *" $absdir "*) ;; |
| 2563 | 597 | hiro | *) temp_rpath="$temp_rpath $absdir" ;; |
| 2564 | 1 | hiro | esac |
| 2565 | 1 | hiro | fi |
| 2566 | 1 | hiro | |
| 2567 | 1 | hiro | # Hardcode the library path. |
| 2568 | 1 | hiro | # Skip directories that are in the system default run-time |
| 2569 | 1 | hiro | # search path. |
| 2570 | 1 | hiro | case " $sys_lib_dlsearch_path " in |
| 2571 | 1 | hiro | *" $absdir "*) ;; |
| 2572 | 1 | hiro | *) |
| 2573 | 1 | hiro | case "$compile_rpath " in |
| 2574 | 1 | hiro | *" $absdir "*) ;; |
| 2575 | 1 | hiro | *) compile_rpath="$compile_rpath $absdir" |
| 2576 | 1 | hiro | esac |
| 2577 | 1 | hiro | ;; |
| 2578 | 1 | hiro | esac |
| 2579 | 1 | hiro | case " $sys_lib_dlsearch_path " in |
| 2580 | 1 | hiro | *" $libdir "*) ;; |
| 2581 | 1 | hiro | *) |
| 2582 | 1 | hiro | case "$finalize_rpath " in |
| 2583 | 1 | hiro | *" $libdir "*) ;; |
| 2584 | 1 | hiro | *) finalize_rpath="$finalize_rpath $libdir" |
| 2585 | 1 | hiro | esac |
| 2586 | 1 | hiro | ;; |
| 2587 | 1 | hiro | esac |
| 2588 | 1 | hiro | fi # $linkmode,$pass = prog,link... |
| 2589 | 1 | hiro | |
| 2590 | 1 | hiro | if test "$alldeplibs" = yes && |
| 2591 | 1 | hiro | { test "$deplibs_check_method" = pass_all ||
|
| 2592 | 1 | hiro | { test "$build_libtool_libs" = yes &&
|
| 2593 | 1 | hiro | test -n "$library_names"; }; }; then |
| 2594 | 1 | hiro | # We only need to search for static libraries |
| 2595 | 1 | hiro | continue |
| 2596 | 1 | hiro | fi |
| 2597 | 1 | hiro | fi |
| 2598 | 1 | hiro | |
| 2599 | 1 | hiro | link_static=no # Whether the deplib will be linked statically |
| 2600 | 879 | hiro | use_static_libs=$prefer_static_libs |
| 2601 | 879 | hiro | if test "$use_static_libs" = built && test "$installed" = yes ; then |
| 2602 | 879 | hiro | use_static_libs=no |
| 2603 | 879 | hiro | fi |
| 2604 | 1 | hiro | if test -n "$library_names" && |
| 2605 | 879 | hiro | { test "$use_static_libs" = no || test -z "$old_library"; }; then
|
| 2606 | 1 | hiro | if test "$installed" = no; then |
| 2607 | 1 | hiro | notinst_deplibs="$notinst_deplibs $lib" |
| 2608 | 1 | hiro | need_relink=yes |
| 2609 | 1 | hiro | fi |
| 2610 | 1 | hiro | # This is a shared library |
| 2611 | 1 | hiro | |
| 2612 | 1 | hiro | # Warn about portability, can't link against -module's on |
| 2613 | 1 | hiro | # some systems (darwin) |
| 2614 | 1 | hiro | if test "$shouldnotlink" = yes && test "$pass" = link ; then |
| 2615 | 1 | hiro | $echo |
| 2616 | 1 | hiro | if test "$linkmode" = prog; then |
| 2617 | 1 | hiro | $echo "*** Warning: Linking the executable $output against the loadable module" |
| 2618 | 1 | hiro | else |
| 2619 | 1 | hiro | $echo "*** Warning: Linking the shared library $output against the loadable module" |
| 2620 | 1 | hiro | fi |
| 2621 | 1 | hiro | $echo "*** $linklib is not portable!" |
| 2622 | 1 | hiro | fi |
| 2623 | 1 | hiro | if test "$linkmode" = lib && |
| 2624 | 1 | hiro | test "$hardcode_into_libs" = yes; then |
| 2625 | 1 | hiro | # Hardcode the library path. |
| 2626 | 1 | hiro | # Skip directories that are in the system default run-time |
| 2627 | 1 | hiro | # search path. |
| 2628 | 1 | hiro | case " $sys_lib_dlsearch_path " in |
| 2629 | 1 | hiro | *" $absdir "*) ;; |
| 2630 | 1 | hiro | *) |
| 2631 | 1 | hiro | case "$compile_rpath " in |
| 2632 | 1 | hiro | *" $absdir "*) ;; |
| 2633 | 1 | hiro | *) compile_rpath="$compile_rpath $absdir" |
| 2634 | 1 | hiro | esac |
| 2635 | 1 | hiro | ;; |
| 2636 | 1 | hiro | esac |
| 2637 | 1 | hiro | case " $sys_lib_dlsearch_path " in |
| 2638 | 1 | hiro | *" $libdir "*) ;; |
| 2639 | 1 | hiro | *) |
| 2640 | 1 | hiro | case "$finalize_rpath " in |
| 2641 | 1 | hiro | *" $libdir "*) ;; |
| 2642 | 1 | hiro | *) finalize_rpath="$finalize_rpath $libdir" |
| 2643 | 1 | hiro | esac |
| 2644 | 1 | hiro | ;; |
| 2645 | 1 | hiro | esac |
| 2646 | 1 | hiro | fi |
| 2647 | 1 | hiro | |
| 2648 | 1 | hiro | if test -n "$old_archive_from_expsyms_cmds"; then |
| 2649 | 1 | hiro | # figure out the soname |
| 2650 | 1 | hiro | set dummy $library_names |
| 2651 | 1 | hiro | realname="$2" |
| 2652 | 1 | hiro | shift; shift |
| 2653 | 1 | hiro | libname=`eval \\$echo \"$libname_spec\"` |
| 2654 | 1 | hiro | # use dlname if we got it. it's perfectly good, no? |
| 2655 | 1 | hiro | if test -n "$dlname"; then |
| 2656 | 1 | hiro | soname="$dlname" |
| 2657 | 1 | hiro | elif test -n "$soname_spec"; then |
| 2658 | 1 | hiro | # bleh windows |
| 2659 | 1 | hiro | case $host in |
| 2660 | 1 | hiro | *cygwin* | mingw*) |
| 2661 | 1 | hiro | major=`expr $current - $age` |
| 2662 | 1 | hiro | versuffix="-$major" |
| 2663 | 1 | hiro | ;; |
| 2664 | 1 | hiro | esac |
| 2665 | 1 | hiro | eval soname=\"$soname_spec\" |
| 2666 | 1 | hiro | else |
| 2667 | 1 | hiro | soname="$realname" |
| 2668 | 1 | hiro | fi |
| 2669 | 1 | hiro | |
| 2670 | 1 | hiro | # Make a new name for the extract_expsyms_cmds to use |
| 2671 | 1 | hiro | soroot="$soname" |
| 2672 | 1 | hiro | soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
|
| 2673 | 1 | hiro | newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
|
| 2674 | 1 | hiro | |
| 2675 | 1 | hiro | # If the library has no export list, then create one now |
| 2676 | 1 | hiro | if test -f "$output_objdir/$soname-def"; then : |
| 2677 | 1 | hiro | else |
| 2678 | 1 | hiro | $show "extracting exported symbol list from \`$soname'" |
| 2679 | 1 | hiro | save_ifs="$IFS"; IFS='~' |
| 2680 | 1 | hiro | cmds=$extract_expsyms_cmds |
| 2681 | 1 | hiro | for cmd in $cmds; do |
| 2682 | 1 | hiro | IFS="$save_ifs" |
| 2683 | 1 | hiro | eval cmd=\"$cmd\" |
| 2684 | 1 | hiro | $show "$cmd" |
| 2685 | 1 | hiro | $run eval "$cmd" || exit $? |
| 2686 | 1 | hiro | done |
| 2687 | 1 | hiro | IFS="$save_ifs" |
| 2688 | 1 | hiro | fi |
| 2689 | 1 | hiro | |
| 2690 | 1 | hiro | # Create $newlib |
| 2691 | 1 | hiro | if test -f "$output_objdir/$newlib"; then :; else |
| 2692 | 1 | hiro | $show "generating import library for \`$soname'" |
| 2693 | 1 | hiro | save_ifs="$IFS"; IFS='~' |
| 2694 | 1 | hiro | cmds=$old_archive_from_expsyms_cmds |
| 2695 | 1 | hiro | for cmd in $cmds; do |
| 2696 | 1 | hiro | IFS="$save_ifs" |
| 2697 | 1 | hiro | eval cmd=\"$cmd\" |
| 2698 | 1 | hiro | $show "$cmd" |
| 2699 | 1 | hiro | $run eval "$cmd" || exit $? |
| 2700 | 1 | hiro | done |
| 2701 | 1 | hiro | IFS="$save_ifs" |
| 2702 | 1 | hiro | fi |
| 2703 | 1 | hiro | # make sure the library variables are pointing to the new library |
| 2704 | 1 | hiro | dir=$output_objdir |
| 2705 | 1 | hiro | linklib=$newlib |
| 2706 | 1 | hiro | fi # test -n "$old_archive_from_expsyms_cmds" |
| 2707 | 1 | hiro | |
| 2708 | 1 | hiro | if test "$linkmode" = prog || test "$mode" != relink; then |
| 2709 | 1 | hiro | add_shlibpath= |
| 2710 | 1 | hiro | add_dir= |
| 2711 | 1 | hiro | add= |
| 2712 | 1 | hiro | lib_linked=yes |
| 2713 | 1 | hiro | case $hardcode_action in |
| 2714 | 1 | hiro | immediate | unsupported) |
| 2715 | 1 | hiro | if test "$hardcode_direct" = no; then |
| 2716 | 1 | hiro | add="$dir/$linklib" |
| 2717 | 1 | hiro | case $host in |
| 2718 | 879 | hiro | *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; |
| 2719 | 879 | hiro | *-*-sysv4*uw2*) add_dir="-L$dir" ;; |
| 2720 | 879 | hiro | *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ |
| 2721 | 879 | hiro | *-*-unixware7*) add_dir="-L$dir" ;; |
| 2722 | 1 | hiro | *-*-darwin* ) |
| 2723 | 1 | hiro | # if the lib is a module then we can not link against |
| 2724 | 1 | hiro | # it, someone is ignoring the new warnings I added |
| 2725 | 879 | hiro | if /usr/bin/file -L $add 2> /dev/null | |
| 2726 | 879 | hiro | $EGREP ": [^:]* bundle" >/dev/null ; then |
| 2727 | 1 | hiro | $echo "** Warning, lib $linklib is a module, not a shared library" |
| 2728 | 1 | hiro | if test -z "$old_library" ; then |
| 2729 | 1 | hiro | $echo |
| 2730 | 1 | hiro | $echo "** And there doesn't seem to be a static archive available" |
| 2731 | 1 | hiro | $echo "** The link will probably fail, sorry" |
| 2732 | 1 | hiro | else |
| 2733 | 1 | hiro | add="$dir/$old_library" |
| 2734 | 1 | hiro | fi |
| 2735 | 1 | hiro | fi |
| 2736 | 1 | hiro | esac |
| 2737 | 1 | hiro | elif test "$hardcode_minus_L" = no; then |
| 2738 | 1 | hiro | case $host in |
| 2739 | 1 | hiro | *-*-sunos*) add_shlibpath="$dir" ;; |
| 2740 | 1 | hiro | esac |
| 2741 | 1 | hiro | add_dir="-L$dir" |
| 2742 | 1 | hiro | add="-l$name" |
| 2743 | 1 | hiro | elif test "$hardcode_shlibpath_var" = no; then |
| 2744 | 1 | hiro | add_shlibpath="$dir" |
| 2745 | 1 | hiro | add="-l$name" |
| 2746 | 1 | hiro | else |
| 2747 | 1 | hiro | lib_linked=no |
| 2748 | 1 | hiro | fi |
| 2749 | 1 | hiro | ;; |
| 2750 | 1 | hiro | relink) |
| 2751 | 1 | hiro | if test "$hardcode_direct" = yes; then |
| 2752 | 1 | hiro | add="$dir/$linklib" |
| 2753 | 1 | hiro | elif test "$hardcode_minus_L" = yes; then |
| 2754 | 1 | hiro | add_dir="-L$dir" |
| 2755 | 1 | hiro | # Try looking first in the location we're being installed to. |
| 2756 | 1 | hiro | if test -n "$inst_prefix_dir"; then |
| 2757 | 597 | hiro | case $libdir in |
| 2758 | 1 | hiro | [\\/]*) |
| 2759 | 1 | hiro | add_dir="$add_dir -L$inst_prefix_dir$libdir" |
| 2760 | 1 | hiro | ;; |
| 2761 | 1 | hiro | esac |
| 2762 | 1 | hiro | fi |
| 2763 | 1 | hiro | add="-l$name" |
| 2764 | 1 | hiro | elif test "$hardcode_shlibpath_var" = yes; then |
| 2765 | 1 | hiro | add_shlibpath="$dir" |
| 2766 | 1 | hiro | add="-l$name" |
| 2767 | 1 | hiro | else |
| 2768 | 1 | hiro | lib_linked=no |
| 2769 | 1 | hiro | fi |
| 2770 | 1 | hiro | ;; |
| 2771 | 1 | hiro | *) lib_linked=no ;; |
| 2772 | 1 | hiro | esac |
| 2773 | 1 | hiro | |
| 2774 | 1 | hiro | if test "$lib_linked" != yes; then |
| 2775 | 1 | hiro | $echo "$modename: configuration error: unsupported hardcode properties" |
| 2776 | 1 | hiro | exit $EXIT_FAILURE |
| 2777 | 1 | hiro | fi |
| 2778 | 1 | hiro | |
| 2779 | 1 | hiro | if test -n "$add_shlibpath"; then |
| 2780 | 1 | hiro | case :$compile_shlibpath: in |
| 2781 | 1 | hiro | *":$add_shlibpath:"*) ;; |
| 2782 | 1 | hiro | *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; |
| 2783 | 1 | hiro | esac |
| 2784 | 1 | hiro | fi |
| 2785 | 1 | hiro | if test "$linkmode" = prog; then |
| 2786 | 1 | hiro | test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" |
| 2787 | 1 | hiro | test -n "$add" && compile_deplibs="$add $compile_deplibs" |
| 2788 | 1 | hiro | else |
| 2789 | 1 | hiro | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
| 2790 | 1 | hiro | test -n "$add" && deplibs="$add $deplibs" |
| 2791 | 1 | hiro | if test "$hardcode_direct" != yes && \ |
| 2792 | 1 | hiro | test "$hardcode_minus_L" != yes && \ |
| 2793 | 1 | hiro | test "$hardcode_shlibpath_var" = yes; then |
| 2794 | 1 | hiro | case :$finalize_shlibpath: in |
| 2795 | 1 | hiro | *":$libdir:"*) ;; |
| 2796 | 1 | hiro | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; |
| 2797 | 1 | hiro | esac |
| 2798 | 1 | hiro | fi |
| 2799 | 1 | hiro | fi |
| 2800 | 1 | hiro | fi |
| 2801 | 1 | hiro | |
| 2802 | 1 | hiro | if test "$linkmode" = prog || test "$mode" = relink; then |
| 2803 | 1 | hiro | add_shlibpath= |
| 2804 | 1 | hiro | add_dir= |
| 2805 | 1 | hiro | add= |
| 2806 | 1 | hiro | # Finalize command for both is simple: just hardcode it. |
| 2807 | 1 | hiro | if test "$hardcode_direct" = yes; then |
| 2808 | 1 | hiro | add="$libdir/$linklib" |
| 2809 | 1 | hiro | elif test "$hardcode_minus_L" = yes; then |
| 2810 | 1 | hiro | add_dir="-L$libdir" |
| 2811 | 1 | hiro | add="-l$name" |
| 2812 | 1 | hiro | elif test "$hardcode_shlibpath_var" = yes; then |
| 2813 | 1 | hiro | case :$finalize_shlibpath: in |
| 2814 | 1 | hiro | *":$libdir:"*) ;; |
| 2815 | 1 | hiro | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; |
| 2816 | 1 | hiro | esac |
| 2817 | 1 | hiro | add="-l$name" |
| 2818 | 1 | hiro | elif test "$hardcode_automatic" = yes; then |
| 2819 | 1 | hiro | if test -n "$inst_prefix_dir" && |
| 2820 | 1 | hiro | test -f "$inst_prefix_dir$libdir/$linklib" ; then |
| 2821 | 1 | hiro | add="$inst_prefix_dir$libdir/$linklib" |
| 2822 | 1 | hiro | else |
| 2823 | 1 | hiro | add="$libdir/$linklib" |
| 2824 | 1 | hiro | fi |
| 2825 | 1 | hiro | else |
| 2826 | 1 | hiro | # We cannot seem to hardcode it, guess we'll fake it. |
| 2827 | 1 | hiro | add_dir="-L$libdir" |
| 2828 | 1 | hiro | # Try looking first in the location we're being installed to. |
| 2829 | 1 | hiro | if test -n "$inst_prefix_dir"; then |
| 2830 | 597 | hiro | case $libdir in |
| 2831 | 1 | hiro | [\\/]*) |
| 2832 | 1 | hiro | add_dir="$add_dir -L$inst_prefix_dir$libdir" |
| 2833 | 1 | hiro | ;; |
| 2834 | 1 | hiro | esac |
| 2835 | 1 | hiro | fi |
| 2836 | 1 | hiro | add="-l$name" |
| 2837 | 1 | hiro | fi |
| 2838 | 1 | hiro | |
| 2839 | 1 | hiro | if test "$linkmode" = prog; then |
| 2840 | 1 | hiro | test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" |
| 2841 | 1 | hiro | test -n "$add" && finalize_deplibs="$add $finalize_deplibs" |
| 2842 | 1 | hiro | else |
| 2843 | 1 | hiro | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
| 2844 | 1 | hiro | test -n "$add" && deplibs="$add $deplibs" |
| 2845 | 1 | hiro | fi |
| 2846 | 1 | hiro | fi |
| 2847 | 1 | hiro | elif test "$linkmode" = prog; then |
| 2848 | 1 | hiro | # Here we assume that one of hardcode_direct or hardcode_minus_L |
| 2849 | 1 | hiro | # is not unsupported. This is valid on all known static and |
| 2850 | 1 | hiro | # shared platforms. |
| 2851 | 1 | hiro | if test "$hardcode_direct" != unsupported; then |
| 2852 | 1 | hiro | test -n "$old_library" && linklib="$old_library" |
| 2853 | 1 | hiro | compile_deplibs="$dir/$linklib $compile_deplibs" |
| 2854 | 1 | hiro | finalize_deplibs="$dir/$linklib $finalize_deplibs" |
| 2855 | 1 | hiro | else |
| 2856 | 1 | hiro | compile_deplibs="-l$name -L$dir $compile_deplibs" |
| 2857 | 1 | hiro | finalize_deplibs="-l$name -L$dir $finalize_deplibs" |
| 2858 | 1 | hiro | fi |
| 2859 | 1 | hiro | elif test "$build_libtool_libs" = yes; then |
| 2860 | 1 | hiro | # Not a shared library |
| 2861 | 1 | hiro | if test "$deplibs_check_method" != pass_all; then |
| 2862 | 1 | hiro | # We're trying link a shared library against a static one |
| 2863 | 1 | hiro | # but the system doesn't support it. |
| 2864 | 1 | hiro | |
| 2865 | 1 | hiro | # Just print a warning and add the library to dependency_libs so |
| 2866 | 1 | hiro | # that the program can be linked against the static library. |
| 2867 | 1 | hiro | $echo |
| 2868 | 1 | hiro | $echo "*** Warning: This system can not link to static lib archive $lib." |
| 2869 | 1 | hiro | $echo "*** I have the capability to make that library automatically link in when" |
| 2870 | 1 | hiro | $echo "*** you link to this library. But I can only do this if you have a" |
| 2871 | 1 | hiro | $echo "*** shared version of the library, which you do not appear to have." |
| 2872 | 1 | hiro | if test "$module" = yes; then |
| 2873 | 1 | hiro | $echo "*** But as you try to build a module library, libtool will still create " |
| 2874 | 1 | hiro | $echo "*** a static module, that should work as long as the dlopening application" |
| 2875 | 1 | hiro | $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." |
| 2876 | 1 | hiro | if test -z "$global_symbol_pipe"; then |
| 2877 | 1 | hiro | $echo |
| 2878 | 1 | hiro | $echo "*** However, this would only work if libtool was able to extract symbol" |
| 2879 | 1 | hiro | $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" |
| 2880 | 1 | hiro | $echo "*** not find such a program. So, this module is probably useless." |
| 2881 | 1 | hiro | $echo "*** \`nm' from GNU binutils and a full rebuild may help." |
| 2882 | 1 | hiro | fi |
| 2883 | 1 | hiro | if test "$build_old_libs" = no; then |
| 2884 | 1 | hiro | build_libtool_libs=module |
| 2885 | 1 | hiro | build_old_libs=yes |
| 2886 | 1 | hiro | else |
| 2887 | 1 | hiro | build_libtool_libs=no |
| 2888 | 1 | hiro | fi |
| 2889 | 1 | hiro | fi |
| 2890 | 1 | hiro | else |
| 2891 | 1 | hiro | deplibs="$dir/$old_library $deplibs" |
| 2892 | 1 | hiro | link_static=yes |
| 2893 | 1 | hiro | fi |
| 2894 | 1 | hiro | fi # link shared/static library? |
| 2895 | 1 | hiro | |
| 2896 | 1 | hiro | if test "$linkmode" = lib; then |
| 2897 | 1 | hiro | if test -n "$dependency_libs" && |
| 2898 | 1 | hiro | { test "$hardcode_into_libs" != yes ||
|
| 2899 | 1 | hiro | test "$build_old_libs" = yes || |
| 2900 | 1 | hiro | test "$link_static" = yes; }; then |
| 2901 | 1 | hiro | # Extract -R from dependency_libs |
| 2902 | 1 | hiro | temp_deplibs= |
| 2903 | 1 | hiro | for libdir in $dependency_libs; do |
| 2904 | 1 | hiro | case $libdir in |
| 2905 | 1 | hiro | -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` |
| 2906 | 1 | hiro | case " $xrpath " in |
| 2907 | 1 | hiro | *" $temp_xrpath "*) ;; |
| 2908 | 1 | hiro | *) xrpath="$xrpath $temp_xrpath";; |
| 2909 | 1 | hiro | esac;; |
| 2910 | 1 | hiro | *) temp_deplibs="$temp_deplibs $libdir";; |
| 2911 | 1 | hiro | esac |
| 2912 | 1 | hiro | done |
| 2913 | 1 | hiro | dependency_libs="$temp_deplibs" |
| 2914 | 1 | hiro | fi |
| 2915 | 1 | hiro | |
| 2916 | 1 | hiro | newlib_search_path="$newlib_search_path $absdir" |
| 2917 | 1 | hiro | # Link against this library |
| 2918 | 1 | hiro | test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" |
| 2919 | 1 | hiro | # ... and its dependency_libs |
| 2920 | 1 | hiro | tmp_libs= |
| 2921 | 1 | hiro | for deplib in $dependency_libs; do |
| 2922 | 1 | hiro | newdependency_libs="$deplib $newdependency_libs" |
| 2923 | 1 | hiro | if test "X$duplicate_deps" = "Xyes" ; then |
| 2924 | 1 | hiro | case "$tmp_libs " in |
| 2925 | 1 | hiro | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; |
| 2926 | 1 | hiro | esac |
| 2927 | 1 | hiro | fi |
| 2928 | 1 | hiro | tmp_libs="$tmp_libs $deplib" |
| 2929 | 1 | hiro | done |
| 2930 | 1 | hiro | |
| 2931 | 1 | hiro | if test "$link_all_deplibs" != no; then |
| 2932 | 1 | hiro | # Add the search paths of all dependency libraries |
| 2933 | 1 | hiro | for deplib in $dependency_libs; do |
| 2934 | 1 | hiro | case $deplib in |
| 2935 | 1 | hiro | -L*) path="$deplib" ;; |
| 2936 | 1 | hiro | *.la) |
| 2937 | 1 | hiro | dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` |