Parent Directory
|
Revision Log
Load pcre-5.0 into code/trunk.
| 1 | nigel | 41 | # ltmain.sh - Provide generalized library-building support services. |
| 2 | nigel | 53 | # NOTE: Changing this file will not affect anything until you rerun configure. |
| 3 | nigel | 41 | # |
| 4 | nigel | 75 | # Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 |
| 5 | nigel | 53 | # Free Software Foundation, Inc. |
| 6 | nigel | 41 | # Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 |
| 7 | # | ||
| 8 | # This program is free software; you can redistribute it and/or modify | ||
| 9 | # it under the terms of the GNU General Public License as published by | ||
| 10 | # the Free Software Foundation; either version 2 of the License, or | ||
| 11 | # (at your option) any later version. | ||
| 12 | # | ||
| 13 | # This program is distributed in the hope that it will be useful, but | ||
| 14 | # WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| 15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
| 16 | # General Public License for more details. | ||
| 17 | # | ||
| 18 | # You should have received a copy of the GNU General Public License | ||
| 19 | # along with this program; if not, write to the Free Software | ||
| 20 | # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | ||
| 21 | # | ||
| 22 | # As a special exception to the GNU General Public License, if you | ||
| 23 | # distribute this file as part of a program that contains a | ||
| 24 | # configuration script generated by Autoconf, you may include it under | ||
| 25 | # the same distribution terms that you use for the rest of that program. | ||
| 26 | |||
| 27 | nigel | 75 | basename="s,^.*/,,g" |
| 28 | |||
| 29 | # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh | ||
| 30 | # is ksh but when the shell is invoked as "sh" and the current value of | ||
| 31 | # the _XPG environment variable is not equal to 1 (one), the special | ||
| 32 | # positional parameter $0, within a function call, is the name of the | ||
| 33 | # function. | ||
| 34 | progpath="$0" | ||
| 35 | |||
| 36 | # Modification by PH (26-Aug-2004, originally 18-Feb-2003) to ensure that | ||
| 37 | # ${SED} is always set (it is not set on my system). | ||
| 38 | |||
| 39 | case "X${SED}" in | ||
| 40 | X) SED=sed ;; | ||
| 41 | esac | ||
| 42 | |||
| 43 | # The name of this program: | ||
| 44 | progname=`echo "$progpath" | $SED $basename` | ||
| 45 | modename="$progname" | ||
| 46 | |||
| 47 | # Global variables: | ||
| 48 | EXIT_SUCCESS=0 | ||
| 49 | EXIT_FAILURE=1 | ||
| 50 | |||
| 51 | PROGRAM=ltmain.sh | ||
| 52 | PACKAGE=libtool | ||
| 53 | VERSION=1.5.8 | ||
| 54 | TIMESTAMP=" (1.1220.2.117 2004/08/04 14:12:05)" | ||
| 55 | |||
| 56 | # See if we are running on zsh, and set the options which allow our | ||
| 57 | # commands through without removal of \ escapes. | ||
| 58 | if test -n "${ZSH_VERSION+set}" ; then | ||
| 59 | setopt NO_GLOB_SUBST | ||
| 60 | fi | ||
| 61 | |||
| 62 | nigel | 41 | # Check that we have a working $echo. |
| 63 | if test "X$1" = X--no-reexec; then | ||
| 64 | # Discard the --no-reexec flag, and continue. | ||
| 65 | shift | ||
| 66 | elif test "X$1" = X--fallback-echo; then | ||
| 67 | # Avoid inline document here, it may be left over | ||
| 68 | : | ||
| 69 | elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then | ||
| 70 | # Yippee, $echo works! | ||
| 71 | : | ||
| 72 | else | ||
| 73 | # Restart under the correct shell, and then maybe $echo will work. | ||
| 74 | nigel | 75 | exec $SHELL "$progpath" --no-reexec ${1+"$@"} |
| 75 | nigel | 41 | fi |
| 76 | |||
| 77 | if test "X$1" = X--fallback-echo; then | ||
| 78 | # used as fallback echo | ||
| 79 | shift | ||
| 80 | cat <<EOF | ||
| 81 | $* | ||
| 82 | EOF | ||
| 83 | nigel | 75 | exit $EXIT_SUCCESS |
| 84 | nigel | 41 | fi |
| 85 | |||
| 86 | default_mode= | ||
| 87 | help="Try \`$progname --help' for more information." | ||
| 88 | magic="%%%MAGIC variable%%%" | ||
| 89 | mkdir="mkdir" | ||
| 90 | mv="mv -f" | ||
| 91 | rm="rm -f" | ||
| 92 | |||
| 93 | # Sed substitution that helps us do robust quoting. It backslashifies | ||
| 94 | # metacharacters that are still active within double-quoted strings. | ||
| 95 | nigel | 63 | Xsed="${SED}"' -e 1s/^X//' |
| 96 | nigel | 41 | sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' |
| 97 | nigel | 75 | # test EBCDIC or ASCII |
| 98 | case `echo A|tr A '\301'` in | ||
| 99 | A) # EBCDIC based system | ||
| 100 | SP2NL="tr '\100' '\n'" | ||
| 101 | NL2SP="tr '\r\n' '\100\100'" | ||
| 102 | ;; | ||
| 103 | *) # Assume ASCII based system | ||
| 104 | SP2NL="tr '\040' '\012'" | ||
| 105 | NL2SP="tr '\015\012' '\040\040'" | ||
| 106 | ;; | ||
| 107 | esac | ||
| 108 | nigel | 41 | |
| 109 | # NLS nuisances. | ||
| 110 | # Only set LANG and LC_ALL to C if already set. | ||
| 111 | # These must not be set unconditionally because not all systems understand | ||
| 112 | # e.g. LANG=C (notably SCO). | ||
| 113 | # We save the old values to restore during execute mode. | ||
| 114 | if test "${LC_ALL+set}" = set; then | ||
| 115 | save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL | ||
| 116 | fi | ||
| 117 | if test "${LANG+set}" = set; then | ||
| 118 | save_LANG="$LANG"; LANG=C; export LANG | ||
| 119 | fi | ||
| 120 | |||
| 121 | nigel | 63 | # Make sure IFS has a sensible default |
| 122 | nigel | 75 | : ${IFS=" |
| 123 | "} | ||
| 124 | nigel | 63 | |
| 125 | nigel | 41 | if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then |
| 126 | nigel | 75 | $echo "$modename: not configured to build any kind of library" 1>&2 |
| 127 | $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 | ||
| 128 | exit $EXIT_FAILURE | ||
| 129 | nigel | 41 | fi |
| 130 | |||
| 131 | # Global variables. | ||
| 132 | mode=$default_mode | ||
| 133 | nonopt= | ||
| 134 | prev= | ||
| 135 | prevopt= | ||
| 136 | run= | ||
| 137 | show="$echo" | ||
| 138 | show_help= | ||
| 139 | execute_dlfiles= | ||
| 140 | lo2o="s/\\.lo\$/.${objext}/" | ||
| 141 | o2lo="s/\\.${objext}\$/.lo/" | ||
| 142 | |||
| 143 | nigel | 75 | ##################################### |
| 144 | # Shell function definitions: | ||
| 145 | # This seems to be the best place for them | ||
| 146 | |||
| 147 | # func_win32_libid arg | ||
| 148 | # return the library type of file 'arg' | ||
| 149 | # | ||
| 150 | # Need a lot of goo to handle *both* DLLs and import libs | ||
| 151 | # Has to be a shell function in order to 'eat' the argument | ||
| 152 | # that is supplied when $file_magic_command is called. | ||
| 153 | func_win32_libid () { | ||
| 154 | win32_libid_type="unknown" | ||
| 155 | win32_fileres=`file -L $1 2>/dev/null` | ||
| 156 | case $win32_fileres in | ||
| 157 | *ar\ archive\ import\ library*) # definitely import | ||
| 158 | win32_libid_type="x86 archive import" | ||
| 159 | ;; | ||
| 160 | *ar\ archive*) # could be an import, or static | ||
| 161 | if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ | ||
| 162 | $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then | ||
| 163 | win32_nmres=`eval $NM -f posix -A $1 | \ | ||
| 164 | sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` | ||
| 165 | if test "X$win32_nmres" = "Ximport" ; then | ||
| 166 | win32_libid_type="x86 archive import" | ||
| 167 | else | ||
| 168 | win32_libid_type="x86 archive static" | ||
| 169 | fi | ||
| 170 | fi | ||
| 171 | ;; | ||
| 172 | *DLL*) | ||
| 173 | win32_libid_type="x86 DLL" | ||
| 174 | ;; | ||
| 175 | *executable*) # but shell scripts are "executable" too... | ||
| 176 | case $win32_fileres in | ||
| 177 | *MS\ Windows\ PE\ Intel*) | ||
| 178 | win32_libid_type="x86 DLL" | ||
| 179 | ;; | ||
| 180 | esac | ||
| 181 | ;; | ||
| 182 | esac | ||
| 183 | $echo $win32_libid_type | ||
| 184 | } | ||
| 185 | |||
| 186 | |||
| 187 | # func_infer_tag arg | ||
| 188 | # Infer tagged configuration to use if any are available and | ||
| 189 | # if one wasn't chosen via the "--tag" command line option. | ||
| 190 | # Only attempt this if the compiler in the base compile | ||
| 191 | # command doesn't match the default compiler. | ||
| 192 | # arg is usually of the form 'gcc ...' | ||
| 193 | func_infer_tag () { | ||
| 194 | if test -n "$available_tags" && test -z "$tagname"; then | ||
| 195 | CC_quoted= | ||
| 196 | for arg in $CC; do | ||
| 197 | case $arg in | ||
| 198 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | ||
| 199 | arg="\"$arg\"" | ||
| 200 | ;; | ||
| 201 | esac | ||
| 202 | CC_quoted="$CC_quoted $arg" | ||
| 203 | done | ||
| 204 | case $@ in | ||
| 205 | # Blanks in the command may have been stripped by the calling shell, | ||
| 206 | # but not from the CC environment variable when configure was run. | ||
| 207 | " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; | ||
| 208 | # Blanks at the start of $base_compile will cause this to fail | ||
| 209 | # if we don't check for them as well. | ||
| 210 | *) | ||
| 211 | for z in $available_tags; do | ||
| 212 | if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then | ||
| 213 | # Evaluate the configuration. | ||
| 214 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" | ||
| 215 | CC_quoted= | ||
| 216 | for arg in $CC; do | ||
| 217 | # Double-quote args containing other shell metacharacters. | ||
| 218 | case $arg in | ||
| 219 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | ||
| 220 | arg="\"$arg\"" | ||
| 221 | ;; | ||
| 222 | esac | ||
| 223 | CC_quoted="$CC_quoted $arg" | ||
| 224 | done | ||
| 225 | case "$@ " in | ||
| 226 | " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) | ||
| 227 | # The compiler in the base compile command matches | ||
| 228 | # the one in the tagged configuration. | ||
| 229 | # Assume this is the tagged configuration we want. | ||
| 230 | tagname=$z | ||
| 231 | break | ||
| 232 | ;; | ||
| 233 | esac | ||
| 234 | fi | ||
| 235 | done | ||
| 236 | # If $tagname still isn't set, then no tagged configuration | ||
| 237 | # was found and let the user know that the "--tag" command | ||
| 238 | # line option must be used. | ||
| 239 | if test -z "$tagname"; then | ||
| 240 | $echo "$modename: unable to infer tagged configuration" | ||
| 241 | $echo "$modename: specify a tag with \`--tag'" 1>&2 | ||
| 242 | exit $EXIT_FAILURE | ||
| 243 | # else | ||
| 244 | # $echo "$modename: using $tagname tagged configuration" | ||
| 245 | fi | ||
| 246 | ;; | ||
| 247 | esac | ||
| 248 | fi | ||
| 249 | } | ||
| 250 | |||
| 251 | |||
| 252 | # func_extract_archives gentop oldlib ... | ||
| 253 | func_extract_archives () { | ||
| 254 | my_gentop="$1"; shift | ||
| 255 | my_oldlibs=${1+"$@"} | ||
| 256 | my_oldobjs="" | ||
| 257 | my_xlib="" | ||
| 258 | my_xabs="" | ||
| 259 | my_xdir="" | ||
| 260 | my_status="" | ||
| 261 | |||
| 262 | $show "${rm}r $my_gentop" | ||
| 263 | $run ${rm}r "$my_gentop" | ||
| 264 | $show "$mkdir $my_gentop" | ||
| 265 | $run $mkdir "$my_gentop" | ||
| 266 | my_status=$? | ||
| 267 | if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then | ||
| 268 | exit $my_status | ||
| 269 | fi | ||
| 270 | |||
| 271 | for my_xlib in $my_oldlibs; do | ||
| 272 | # Extract the objects. | ||
| 273 | case $my_xlib in | ||
| 274 | [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; | ||
| 275 | *) my_xabs=`pwd`"/$my_xlib" ;; | ||
| 276 | esac | ||
| 277 | my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` | ||
| 278 | my_xdir="$my_gentop/$my_xlib" | ||
| 279 | |||
| 280 | $show "${rm}r $my_xdir" | ||
| 281 | $run ${rm}r "$my_xdir" | ||
| 282 | $show "$mkdir $my_xdir" | ||
| 283 | $run $mkdir "$my_xdir" | ||
| 284 | status=$? | ||
| 285 | if test "$status" -ne 0 && test ! -d "$my_xdir"; then | ||
| 286 | exit $status | ||
| 287 | fi | ||
| 288 | case $host in | ||
| 289 | *-darwin*) | ||
| 290 | $show "Extracting $my_xabs" | ||
| 291 | # Do not bother doing anything if just a dry run | ||
| 292 | if test -z "$run"; then | ||
| 293 | darwin_orig_dir=`pwd` | ||
| 294 | cd $my_xdir || exit $? | ||
| 295 | darwin_archive=$my_xabs | ||
| 296 | darwin_curdir=`pwd` | ||
| 297 | darwin_base_archive=`basename $darwin_archive` | ||
| 298 | darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` | ||
| 299 | if test -n "$darwin_arches"; then | ||
| 300 | darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` | ||
| 301 | darwin_arch= | ||
| 302 | $show "$darwin_base_archive has multiple architectures $darwin_arches" | ||
| 303 | for darwin_arch in $darwin_arches ; do | ||
| 304 | mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" | ||
| 305 | lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" | ||
| 306 | # Remove the table of contents from the thin files. | ||
| 307 | $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF 2>/dev/null || true | ||
| 308 | $AR -d "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" __.SYMDEF\ SORTED 2>/dev/null || true | ||
| 309 | cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" | ||
| 310 | $AR -xo "${darwin_base_archive}" | ||
| 311 | rm "${darwin_base_archive}" | ||
| 312 | cd "$darwin_curdir" | ||
| 313 | done # $darwin_arches | ||
| 314 | ## Okay now we have a bunch of thin objects, gotta fatten them up :) | ||
| 315 | darwin_filelist=`find unfat-$$ -type f | xargs basename | sort -u | $NL2SP` | ||
| 316 | darwin_file= | ||
| 317 | darwin_files= | ||
| 318 | for darwin_file in $darwin_filelist; do | ||
| 319 | darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` | ||
| 320 | lipo -create -output "$darwin_file" $darwin_files | ||
| 321 | done # $darwin_filelist | ||
| 322 | rm -rf unfat-$$ | ||
| 323 | cd "$darwin_orig_dir" | ||
| 324 | else | ||
| 325 | cd $darwin_orig_dir | ||
| 326 | (cd $my_xdir && $AR x $my_xabs) || exit $? | ||
| 327 | fi # $darwin_arches | ||
| 328 | fi # $run | ||
| 329 | ;; | ||
| 330 | *) | ||
| 331 | # We will extract separately just the conflicting names and we will | ||
| 332 | # no longer touch any unique names. It is faster to leave these | ||
| 333 | # extract automatically by $AR in one run. | ||
| 334 | $show "(cd $my_xdir && $AR x $my_xabs)" | ||
| 335 | $run eval "(cd \$my_xdir && $AR x \$my_xabs)" || exit $? | ||
| 336 | if ($AR t "$my_xabs" | sort | sort -uc >/dev/null 2>&1); then | ||
| 337 | : | ||
| 338 | else | ||
| 339 | $echo "$modename: warning: object name conflicts; renaming object files" 1>&2 | ||
| 340 | $echo "$modename: warning: to ensure that they will not overwrite" 1>&2 | ||
| 341 | $AR t "$my_xabs" | sort | uniq -cd | while read -r count name | ||
| 342 | do | ||
| 343 | i=1 | ||
| 344 | while test "$i" -le "$count" | ||
| 345 | do | ||
| 346 | # Put our $i before any first dot (extension) | ||
| 347 | # Never overwrite any file | ||
| 348 | name_to="$name" | ||
| 349 | while test "X$name_to" = "X$name" || test -f "$my_xdir/$name_to" | ||
| 350 | do | ||
| 351 | name_to=`$echo "X$name_to" | $Xsed -e "s/\([^.]*\)/\1-$i/"` | ||
| 352 | done | ||
| 353 | $show "(cd $my_xdir && $AR xN $i $my_xabs '$name' && $mv '$name' '$name_to')" | ||
| 354 | $run eval "(cd \$my_xdir && $AR xN $i \$my_xabs '$name' && $mv '$name' '$name_to')" || exit $? | ||
| 355 | i=`expr $i + 1` | ||
| 356 | done | ||
| 357 | done | ||
| 358 | fi | ||
| 359 | ;; | ||
| 360 | esac | ||
| 361 | my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` | ||
| 362 | done | ||
| 363 | |||
| 364 | func_extract_archives_result="$my_oldobjs" | ||
| 365 | } | ||
| 366 | # End of Shell function definitions | ||
| 367 | ##################################### | ||
| 368 | |||
| 369 | # Darwin sucks | ||
| 370 | eval std_shrext=\"$shrext_cmds\" | ||
| 371 | |||
| 372 | nigel | 41 | # Parse our command line options once, thoroughly. |
| 373 | nigel | 75 | while test "$#" -gt 0 |
| 374 | nigel | 41 | do |
| 375 | arg="$1" | ||
| 376 | shift | ||
| 377 | |||
| 378 | nigel | 53 | case $arg in |
| 379 | nigel | 41 | -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; |
| 380 | *) optarg= ;; | ||
| 381 | esac | ||
| 382 | |||
| 383 | # If the previous option needs an argument, assign it. | ||
| 384 | if test -n "$prev"; then | ||
| 385 | nigel | 53 | case $prev in |
| 386 | nigel | 41 | execute_dlfiles) |
| 387 | nigel | 53 | execute_dlfiles="$execute_dlfiles $arg" |
| 388 | nigel | 41 | ;; |
| 389 | nigel | 75 | tag) |
| 390 | tagname="$arg" | ||
| 391 | preserve_args="${preserve_args}=$arg" | ||
| 392 | |||
| 393 | # Check whether tagname contains only valid characters | ||
| 394 | case $tagname in | ||
| 395 | *[!-_A-Za-z0-9,/]*) | ||
| 396 | $echo "$progname: invalid tag name: $tagname" 1>&2 | ||
| 397 | exit $EXIT_FAILURE | ||
| 398 | ;; | ||
| 399 | esac | ||
| 400 | |||
| 401 | case $tagname in | ||
| 402 | CC) | ||
| 403 | # Don't test for the "default" C tag, as we know, it's there, but | ||
| 404 | # not specially marked. | ||
| 405 | ;; | ||
| 406 | *) | ||
| 407 | if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then | ||
| 408 | taglist="$taglist $tagname" | ||
| 409 | # Evaluate the configuration. | ||
| 410 | eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" | ||
| 411 | else | ||
| 412 | $echo "$progname: ignoring unknown tag $tagname" 1>&2 | ||
| 413 | fi | ||
| 414 | ;; | ||
| 415 | esac | ||
| 416 | ;; | ||
| 417 | nigel | 41 | *) |
| 418 | eval "$prev=\$arg" | ||
| 419 | ;; | ||
| 420 | esac | ||
| 421 | |||
| 422 | prev= | ||
| 423 | prevopt= | ||
| 424 | continue | ||
| 425 | fi | ||
| 426 | |||
| 427 | # Have we seen a non-optional argument yet? | ||
| 428 | nigel | 53 | case $arg in |
| 429 | nigel | 41 | --help) |
| 430 | show_help=yes | ||
| 431 | ;; | ||
| 432 | |||
| 433 | --version) | ||
| 434 | nigel | 75 | $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" |
| 435 | $echo | ||
| 436 | $echo "Copyright (C) 2003 Free Software Foundation, Inc." | ||
| 437 | $echo "This is free software; see the source for copying conditions. There is NO" | ||
| 438 | $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." | ||
| 439 | exit $EXIT_SUCCESS | ||
| 440 | nigel | 41 | ;; |
| 441 | |||
| 442 | --config) | ||
| 443 | nigel | 75 | ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath |
| 444 | # Now print the configurations for the tags. | ||
| 445 | for tagname in $taglist; do | ||
| 446 | ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" | ||
| 447 | done | ||
| 448 | exit $EXIT_SUCCESS | ||
| 449 | nigel | 41 | ;; |
| 450 | |||
| 451 | --debug) | ||
| 452 | nigel | 75 | $echo "$progname: enabling shell trace mode" |
| 453 | nigel | 41 | set -x |
| 454 | nigel | 75 | preserve_args="$preserve_args $arg" |
| 455 | nigel | 41 | ;; |
| 456 | |||
| 457 | --dry-run | -n) | ||
| 458 | run=: | ||
| 459 | ;; | ||
| 460 | |||
| 461 | --features) | ||
| 462 | nigel | 75 | $echo "host: $host" |
| 463 | nigel | 41 | if test "$build_libtool_libs" = yes; then |
| 464 | nigel | 75 | $echo "enable shared libraries" |
| 465 | nigel | 41 | else |
| 466 | nigel | 75 | $echo "disable shared libraries" |
| 467 | nigel | 41 | fi |
| 468 | if test "$build_old_libs" = yes; then | ||
| 469 | nigel | 75 | $echo "enable static libraries" |
| 470 | nigel | 41 | else |
| 471 | nigel | 75 | $echo "disable static libraries" |
| 472 | nigel | 41 | fi |
| 473 | nigel | 75 | exit $EXIT_SUCCESS |
| 474 | nigel | 41 | ;; |
| 475 | |||
| 476 | --finish) mode="finish" ;; | ||
| 477 | |||
| 478 | --mode) prevopt="--mode" prev=mode ;; | ||
| 479 | --mode=*) mode="$optarg" ;; | ||
| 480 | |||
| 481 | nigel | 63 | --preserve-dup-deps) duplicate_deps="yes" ;; |
| 482 | |||
| 483 | nigel | 41 | --quiet | --silent) |
| 484 | show=: | ||
| 485 | nigel | 75 | preserve_args="$preserve_args $arg" |
| 486 | nigel | 41 | ;; |
| 487 | |||
| 488 | nigel | 75 | --tag) prevopt="--tag" prev=tag ;; |
| 489 | --tag=*) | ||
| 490 | set tag "$optarg" ${1+"$@"} | ||
| 491 | shift | ||
| 492 | prev=tag | ||
| 493 | preserve_args="$preserve_args --tag" | ||
| 494 | ;; | ||
| 495 | |||
| 496 | nigel | 41 | -dlopen) |
| 497 | prevopt="-dlopen" | ||
| 498 | prev=execute_dlfiles | ||
| 499 | ;; | ||
| 500 | |||
| 501 | -*) | ||
| 502 | $echo "$modename: unrecognized option \`$arg'" 1>&2 | ||
| 503 | $echo "$help" 1>&2 | ||
| 504 | nigel | 75 | exit $EXIT_FAILURE |
| 505 | nigel | 41 | ;; |
| 506 | |||
| 507 | *) | ||
| 508 | nonopt="$arg" | ||
| 509 | break | ||
| 510 | ;; | ||
| 511 | esac | ||
| 512 | done | ||
| 513 | |||
| 514 | if test -n "$prevopt"; then | ||
| 515 | $echo "$modename: option \`$prevopt' requires an argument" 1>&2 | ||
| 516 | $echo "$help" 1>&2 | ||
| 517 | nigel | 75 | exit $EXIT_FAILURE |
| 518 | nigel | 41 | fi |
| 519 | |||
| 520 | nigel | 63 | # If this variable is set in any of the actions, the command in it |
| 521 | # will be execed at the end. This prevents here-documents from being | ||
| 522 | # left over by shells. | ||
| 523 | exec_cmd= | ||
| 524 | |||
| 525 | nigel | 41 | if test -z "$show_help"; then |
| 526 | |||
| 527 | # Infer the operation mode. | ||
| 528 | if test -z "$mode"; then | ||
| 529 | nigel | 75 | $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 |
| 530 | $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 | ||
| 531 | nigel | 53 | case $nonopt in |
| 532 | nigel | 75 | *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) |
| 533 | nigel | 41 | mode=link |
| 534 | for arg | ||
| 535 | do | ||
| 536 | nigel | 53 | case $arg in |
| 537 | nigel | 41 | -c) |
| 538 | mode=compile | ||
| 539 | break | ||
| 540 | ;; | ||
| 541 | esac | ||
| 542 | done | ||
| 543 | ;; | ||
| 544 | *db | *dbx | *strace | *truss) | ||
| 545 | mode=execute | ||
| 546 | ;; | ||
| 547 | *install*|cp|mv) | ||
| 548 | mode=install | ||
| 549 | ;; | ||
| 550 | *rm) | ||
| 551 | mode=uninstall | ||
| 552 | ;; | ||
| 553 | *) | ||
| 554 | # If we have no mode, but dlfiles were specified, then do execute mode. | ||
| 555 | test -n "$execute_dlfiles" && mode=execute | ||
| 556 | |||
| 557 | # Just use the default operation mode. | ||
| 558 | if test -z "$mode"; then | ||
| 559 | if test -n "$nonopt"; then | ||
| 560 | $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 | ||
| 561 | else | ||
| 562 | $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 | ||
| 563 | fi | ||
| 564 | fi | ||
| 565 | ;; | ||
| 566 | esac | ||
| 567 | fi | ||
| 568 | |||
| 569 | # Only execute mode is allowed to have -dlopen flags. | ||
| 570 | if test -n "$execute_dlfiles" && test "$mode" != execute; then | ||
| 571 | $echo "$modename: unrecognized option \`-dlopen'" 1>&2 | ||
| 572 | $echo "$help" 1>&2 | ||
| 573 | nigel | 75 | exit $EXIT_FAILURE |
| 574 | nigel | 41 | fi |
| 575 | |||
| 576 | # Change the help message to a mode-specific one. | ||
| 577 | generic_help="$help" | ||
| 578 | help="Try \`$modename --help --mode=$mode' for more information." | ||
| 579 | |||
| 580 | # These modes are in order of execution frequency so that they run quickly. | ||
| 581 | nigel | 53 | case $mode in |
| 582 | nigel | 41 | # libtool compile mode |
| 583 | compile) | ||
| 584 | modename="$modename: compile" | ||
| 585 | # Get the compilation command and the source file. | ||
| 586 | base_compile= | ||
| 587 | nigel | 75 | srcfile="$nonopt" # always keep a non-empty value in "srcfile" |
| 588 | suppress_opt=yes | ||
| 589 | nigel | 41 | suppress_output= |
| 590 | nigel | 75 | arg_mode=normal |
| 591 | libobj= | ||
| 592 | later= | ||
| 593 | nigel | 41 | |
| 594 | for arg | ||
| 595 | do | ||
| 596 | nigel | 75 | case "$arg_mode" in |
| 597 | arg ) | ||
| 598 | # do not "continue". Instead, add this to base_compile | ||
| 599 | lastarg="$arg" | ||
| 600 | arg_mode=normal | ||
| 601 | ;; | ||
| 602 | nigel | 53 | |
| 603 | nigel | 75 | target ) |
| 604 | libobj="$arg" | ||
| 605 | arg_mode=normal | ||
| 606 | nigel | 53 | continue |
| 607 | ;; | ||
| 608 | |||
| 609 | nigel | 75 | normal ) |
| 610 | # Accept any command-line options. | ||
| 611 | case $arg in | ||
| 612 | -o) | ||
| 613 | if test -n "$libobj" ; then | ||
| 614 | $echo "$modename: you cannot specify \`-o' more than once" 1>&2 | ||
| 615 | exit $EXIT_FAILURE | ||
| 616 | fi | ||
| 617 | arg_mode=target | ||
| 618 | continue | ||
| 619 | ;; | ||
| 620 | nigel | 41 | |
| 621 | nigel | 75 | -static | -prefer-pic | -prefer-non-pic) |
| 622 | later="$later $arg" | ||
| 623 | continue | ||
| 624 | ;; | ||
| 625 | nigel | 53 | |
| 626 | nigel | 75 | -no-suppress) |
| 627 | suppress_opt=no | ||
| 628 | continue | ||
| 629 | ;; | ||
| 630 | nigel | 53 | |
| 631 | nigel | 75 | -Xcompiler) |
| 632 | arg_mode=arg # the next one goes into the "base_compile" arg list | ||
| 633 | continue # The current "srcfile" will either be retained or | ||
| 634 | ;; # replaced later. I would guess that would be a bug. | ||
| 635 | nigel | 53 | |
| 636 | nigel | 75 | -Wc,*) |
| 637 | args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` | ||
| 638 | lastarg= | ||
| 639 | save_ifs="$IFS"; IFS=',' | ||
| 640 | for arg in $args; do | ||
| 641 | IFS="$save_ifs" | ||
| 642 | nigel | 53 | |
| 643 | nigel | 75 | # Double-quote args containing other shell metacharacters. |
| 644 | # Many Bourne shells cannot handle close brackets correctly | ||
| 645 | # in scan sets, so we specify it separately. | ||
| 646 | case $arg in | ||
| 647 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | ||
| 648 | arg="\"$arg\"" | ||
| 649 | ;; | ||
| 650 | esac | ||
| 651 | lastarg="$lastarg $arg" | ||
| 652 | done | ||
| 653 | nigel | 53 | IFS="$save_ifs" |
| 654 | nigel | 75 | lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` |
| 655 | nigel | 53 | |
| 656 | nigel | 75 | # Add the arguments to base_compile. |
| 657 | nigel | 53 | base_compile="$base_compile $lastarg" |
| 658 | nigel | 75 | continue |
| 659 | ;; | ||
| 660 | nigel | 41 | |
| 661 | nigel | 75 | * ) |
| 662 | # Accept the current argument as the source file. | ||
| 663 | # The previous "srcfile" becomes the current argument. | ||
| 664 | # | ||
| 665 | lastarg="$srcfile" | ||
| 666 | srcfile="$arg" | ||
| 667 | ;; | ||
| 668 | esac # case $arg | ||
| 669 | nigel | 41 | ;; |
| 670 | nigel | 75 | esac # case $arg_mode |
| 671 | nigel | 41 | |
| 672 | # Aesthetically quote the previous argument. | ||
| 673 | lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` | ||
| 674 | |||
| 675 | nigel | 75 | case $lastarg in |
| 676 | nigel | 41 | # Double-quote args containing other shell metacharacters. |
| 677 | nigel | 53 | # Many Bourne shells cannot handle close brackets correctly |
| 678 | # in scan sets, so we specify it separately. | ||
| 679 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | ||
| 680 | nigel | 41 | lastarg="\"$lastarg\"" |
| 681 | ;; | ||
| 682 | esac | ||
| 683 | |||
| 684 | nigel | 75 | base_compile="$base_compile $lastarg" |
| 685 | done # for arg | ||
| 686 | nigel | 41 | |
| 687 | nigel | 75 | case $arg_mode in |
| 688 | arg) | ||
| 689 | $echo "$modename: you must specify an argument for -Xcompile" | ||
| 690 | exit $EXIT_FAILURE | ||
| 691 | nigel | 41 | ;; |
| 692 | nigel | 75 | target) |
| 693 | $echo "$modename: you must specify a target with \`-o'" 1>&2 | ||
| 694 | exit $EXIT_FAILURE | ||
| 695 | nigel | 41 | ;; |
| 696 | *) | ||
| 697 | nigel | 75 | # Get the name of the library object. |
| 698 | [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` | ||
| 699 | nigel | 41 | ;; |
| 700 | esac | ||
| 701 | |||
| 702 | # Recognize several different file suffixes. | ||
| 703 | # If the user specifies -o file.o, it is replaced with file.lo | ||
| 704 | nigel | 75 | xform='[cCFSifmso]' |
| 705 | nigel | 53 | case $libobj in |
| 706 | nigel | 41 | *.ada) xform=ada ;; |
| 707 | *.adb) xform=adb ;; | ||
| 708 | *.ads) xform=ads ;; | ||
| 709 | *.asm) xform=asm ;; | ||
| 710 | *.c++) xform=c++ ;; | ||
| 711 | *.cc) xform=cc ;; | ||
| 712 | nigel | 75 | *.ii) xform=ii ;; |
| 713 | *.class) xform=class ;; | ||
| 714 | nigel | 41 | *.cpp) xform=cpp ;; |
| 715 | *.cxx) xform=cxx ;; | ||
| 716 | *.f90) xform=f90 ;; | ||
| 717 | *.for) xform=for ;; | ||
| 718 | nigel | 75 | *.java) xform=java ;; |
| 719 | nigel | 41 | esac |
| 720 | |||
| 721 | libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` | ||
| 722 | |||
| 723 | nigel | 53 | case $libobj in |
| 724 | nigel | 41 | *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; |
| 725 | *) | ||
| 726 | $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 | ||
| 727 | nigel | 75 | exit $EXIT_FAILURE |
| 728 | nigel | 41 | ;; |
| 729 | esac | ||
| 730 | |||
| 731 | nigel | 75 | func_infer_tag $base_compile |
| 732 | |||
| 733 | for arg in $later; do | ||
| 734 | case $arg in | ||
| 735 | -static) | ||
| 736 | build_old_libs=yes | ||
| 737 | continue | ||
| 738 | ;; | ||
| 739 | |||
| 740 | -prefer-pic) | ||
| 741 | pic_mode=yes | ||
| 742 | continue | ||
| 743 | ;; | ||
| 744 | |||
| 745 | -prefer-non-pic) | ||
| 746 | pic_mode=no | ||
| 747 | continue | ||
| 748 | ;; | ||
| 749 | esac | ||
| 750 | done | ||
| 751 | |||
| 752 | objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` | ||
| 753 | xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` | ||
| 754 | if test "X$xdir" = "X$obj"; then | ||
| 755 | xdir= | ||
| 756 | else | ||
| 757 | xdir=$xdir/ | ||
| 758 | fi | ||
| 759 | lobj=${xdir}$objdir/$objname | ||
| 760 | |||
| 761 | nigel | 41 | if test -z "$base_compile"; then |
| 762 | $echo "$modename: you must specify a compilation command" 1>&2 | ||
| 763 | $echo "$help" 1>&2 | ||
| 764 | nigel | 75 | exit $EXIT_FAILURE |
| 765 | nigel | 41 | fi |
| 766 | |||
| 767 | # Delete any leftover library objects. | ||
| 768 | if test "$build_old_libs" = yes; then | ||
| 769 | nigel | 75 | removelist="$obj $lobj $libobj ${libobj}T" |
| 770 | nigel | 41 | else |
| 771 | nigel | 75 | removelist="$lobj $libobj ${libobj}T" |
| 772 | nigel | 41 | fi |
| 773 | |||
| 774 | $run $rm $removelist | ||
| 775 | nigel | 75 | trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 |
| 776 | nigel | 41 | |
| 777 | nigel | 53 | # On Cygwin there's no "real" PIC flag so we must build both object types |
| 778 | case $host_os in | ||
| 779 | cygwin* | mingw* | pw32* | os2*) | ||
| 780 | pic_mode=default | ||
| 781 | ;; | ||
| 782 | esac | ||
| 783 | nigel | 63 | if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then |
| 784 | nigel | 53 | # non-PIC code in shared libraries is not supported |
| 785 | pic_mode=default | ||
| 786 | fi | ||
| 787 | |||
| 788 | nigel | 41 | # Calculate the filename of the output object if compiler does |
| 789 | # not support -o with -c | ||
| 790 | if test "$compiler_c_o" = no; then | ||
| 791 | nigel | 53 | output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} |
| 792 | nigel | 41 | lockfile="$output_obj.lock" |
| 793 | removelist="$removelist $output_obj $lockfile" | ||
| 794 | nigel | 75 | trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 |
| 795 | nigel | 41 | else |
| 796 | nigel | 75 | output_obj= |
| 797 | nigel | 41 | need_locks=no |
| 798 | lockfile= | ||
| 799 | fi | ||
| 800 | |||
| 801 | # Lock this critical section if it is needed | ||
| 802 | # We use this script file to make the link, it avoids creating a new file | ||
| 803 | if test "$need_locks" = yes; then | ||
| 804 | nigel | 75 | until $run ln "$progpath" "$lockfile" 2>/dev/null; do |
| 805 | nigel | 41 | $show "Waiting for $lockfile to be removed" |
| 806 | sleep 2 | ||
| 807 | done | ||
| 808 | elif test "$need_locks" = warn; then | ||
| 809 | if test -f "$lockfile"; then | ||
| 810 | nigel | 75 | $echo "\ |
| 811 | nigel | 41 | *** ERROR, $lockfile exists and contains: |
| 812 | `cat $lockfile 2>/dev/null` | ||
| 813 | |||
| 814 | This indicates that another process is trying to use the same | ||
| 815 | temporary object file, and libtool could not work around it because | ||
| 816 | your compiler does not support \`-c' and \`-o' together. If you | ||
| 817 | repeat this compilation, it may succeed, by chance, but you had better | ||
| 818 | avoid parallel builds (make -j) in this platform, or get a better | ||
| 819 | compiler." | ||
| 820 | |||
| 821 | $run $rm $removelist | ||
| 822 | nigel | 75 | exit $EXIT_FAILURE |
| 823 | nigel | 41 | fi |
| 824 | nigel | 75 | $echo $srcfile > "$lockfile" |
| 825 | nigel | 41 | fi |
| 826 | |||
| 827 | if test -n "$fix_srcfile_path"; then | ||
| 828 | eval srcfile=\"$fix_srcfile_path\" | ||
| 829 | fi | ||
| 830 | |||
| 831 | nigel | 75 | $run $rm "$libobj" "${libobj}T" |
| 832 | |||
| 833 | # Create a libtool object file (analogous to a ".la" file), | ||
| 834 | # but don't create it if we're doing a dry run. | ||
| 835 | test -z "$run" && cat > ${libobj}T <<EOF | ||
| 836 | # $libobj - a libtool object file | ||
| 837 | # Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP | ||
| 838 | # | ||
| 839 | # Please DO NOT delete this file! | ||
| 840 | # It is necessary for linking the library. | ||
| 841 | |||
| 842 | # Name of the PIC object. | ||
| 843 | EOF | ||
| 844 | |||
| 845 | nigel | 41 | # Only build a PIC object if we are building libtool libraries. |
| 846 | if test "$build_libtool_libs" = yes; then | ||
| 847 | # Without this assignment, base_compile gets emptied. | ||
| 848 | fbsd_hideous_sh_bug=$base_compile | ||
| 849 | |||
| 850 | nigel | 53 | if test "$pic_mode" != no; then |
| 851 | nigel | 75 | command="$base_compile $srcfile $pic_flag" |
| 852 | nigel | 53 | else |
| 853 | # Don't build PIC code | ||
| 854 | command="$base_compile $srcfile" | ||
| 855 | fi | ||
| 856 | nigel | 41 | |
| 857 | nigel | 75 | if test ! -d "${xdir}$objdir"; then |
| 858 | $show "$mkdir ${xdir}$objdir" | ||
| 859 | $run $mkdir ${xdir}$objdir | ||
| 860 | status=$? | ||
| 861 | if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then | ||
| 862 | exit $status | ||
| 863 | nigel | 41 | fi |
| 864 | fi | ||
| 865 | nigel | 75 | |
| 866 | if test -z "$output_obj"; then | ||
| 867 | # Place PIC objects in $objdir | ||
| 868 | command="$command -o $lobj" | ||
| 869 | nigel | 41 | fi |
| 870 | |||
| 871 | nigel | 75 | $run $rm "$lobj" "$output_obj" |
| 872 | |||
| 873 | nigel | 41 | $show "$command" |
| 874 | if $run eval "$command"; then : | ||
| 875 | else | ||
| 876 | test -n "$output_obj" && $run $rm $removelist | ||
| 877 | nigel | 75 | exit $EXIT_FAILURE |
| 878 | nigel | 41 | fi |
| 879 | |||
| 880 | if test "$need_locks" = warn && | ||
| 881 | nigel | 75 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
| 882 | $echo "\ | ||
| 883 | nigel | 41 | *** ERROR, $lockfile contains: |
| 884 | `cat $lockfile 2>/dev/null` | ||
| 885 | |||
| 886 | but it should contain: | ||
| 887 | $srcfile | ||
| 888 | |||
| 889 | This indicates that another process is trying to use the same | ||
| 890 | temporary object file, and libtool could not work around it because | ||
| 891 | your compiler does not support \`-c' and \`-o' together. If you | ||
| 892 | repeat this compilation, it may succeed, by chance, but you had better | ||
| 893 | avoid parallel builds (make -j) in this platform, or get a better | ||
| 894 | compiler." | ||
| 895 | |||
| 896 | $run $rm $removelist | ||
| 897 | nigel | 75 | exit $EXIT_FAILURE |
| 898 | nigel | 41 | fi |
| 899 | |||
| 900 | # Just move the object if needed, then go on to compile the next one | ||
| 901 | nigel | 75 | if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then |
| 902 | $show "$mv $output_obj $lobj" | ||
| 903 | if $run $mv $output_obj $lobj; then : | ||
| 904 | nigel | 41 | else |
| 905 | error=$? | ||
| 906 | $run $rm $removelist | ||
| 907 | exit $error | ||
| 908 | fi | ||
| 909 | fi | ||
| 910 | |||
| 911 | nigel | 75 | # Append the name of the PIC object to the libtool object file. |
| 912 | test -z "$run" && cat >> ${libobj}T <<EOF | ||
| 913 | pic_object='$objdir/$objname' | ||
| 914 | nigel | 41 | |
| 915 | nigel | 75 | EOF |
| 916 | nigel | 41 | |
| 917 | nigel | 75 | # Allow error messages only from the first compilation. |
| 918 | if test "$suppress_opt" = yes; then | ||
| 919 | suppress_output=' >/dev/null 2>&1' | ||
| 920 | nigel | 41 | fi |
| 921 | nigel | 75 | else |
| 922 | # No PIC object so indicate it doesn't exist in the libtool | ||
| 923 | # object file. | ||
| 924 | test -z "$run" && cat >> ${libobj}T <<EOF | ||
| 925 | pic_object=none | ||
| 926 | nigel | 41 | |
| 927 | nigel | 75 | EOF |
| 928 | nigel | 41 | fi |
| 929 | |||
| 930 | # Only build a position-dependent object if we build old libraries. | ||
| 931 | if test "$build_old_libs" = yes; then | ||
| 932 | nigel | 53 | if test "$pic_mode" != yes; then |
| 933 | # Don't build PIC code | ||
| 934 | command="$base_compile $srcfile" | ||
| 935 | else | ||
| 936 | nigel | 75 | command="$base_compile $srcfile $pic_flag" |
| 937 | nigel | 53 | fi |
| 938 | nigel | 41 | if test "$compiler_c_o" = yes; then |
| 939 | command="$command -o $obj" | ||
| 940 | fi | ||
| 941 | |||
| 942 | # Suppress compiler output if we already did a PIC compilation. | ||
| 943 | command="$command$suppress_output" | ||
| 944 | nigel | 75 | $run $rm "$obj" "$output_obj" |
| 945 | nigel | 41 | $show "$command" |
| 946 | if $run eval "$command"; then : | ||
| 947 | else | ||
| 948 | $run $rm $removelist | ||
| 949 | nigel | 75 | exit $EXIT_FAILURE |
| 950 | nigel | 41 | fi |
| 951 | |||
| 952 | if test "$need_locks" = warn && | ||
| 953 | nigel | 75 | test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then |
| 954 | $echo "\ | ||
| 955 | nigel | 41 | *** ERROR, $lockfile contains: |
| 956 | `cat $lockfile 2>/dev/null` | ||
| 957 | |||
| 958 | but it should contain: | ||
| 959 | $srcfile | ||
| 960 | |||
| 961 | This indicates that another process is trying to use the same | ||
| 962 | temporary object file, and libtool could not work around it because | ||
| 963 | your compiler does not support \`-c' and \`-o' together. If you | ||
| 964 | repeat this compilation, it may succeed, by chance, but you had better | ||
| 965 | avoid parallel builds (make -j) in this platform, or get a better | ||
| 966 | compiler." | ||
| 967 | |||
| 968 | $run $rm $removelist | ||
| 969 | nigel | 75 | exit $EXIT_FAILURE |
| 970 | nigel | 41 | fi |
| 971 | |||
| 972 | # Just move the object if needed | ||
| 973 | nigel | 75 | if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then |
| 974 | nigel | 41 | $show "$mv $output_obj $obj" |
| 975 | if $run $mv $output_obj $obj; then : | ||
| 976 | else | ||
| 977 | error=$? | ||
| 978 | $run $rm $removelist | ||
| 979 | exit $error | ||
| 980 | fi | ||
| 981 | fi | ||
| 982 | |||
| 983 | nigel | 75 | # Append the name of the non-PIC object the libtool object file. |
| 984 | # Only append if the libtool object file exists. | ||
| 985 | test -z "$run" && cat >> ${libobj}T <<EOF | ||
| 986 | # Name of the non-PIC object. | ||
| 987 | non_pic_object='$objname' | ||
| 988 | |||
| 989 | EOF | ||
| 990 | else | ||
| 991 | # Append the name of the non-PIC object the libtool object file. | ||
| 992 | # Only append if the libtool object file exists. | ||
| 993 | test -z "$run" && cat >> ${libobj}T <<EOF | ||
| 994 | # Name of the non-PIC object. | ||
| 995 | non_pic_object=none | ||
| 996 | |||
| 997 | EOF | ||
| 998 | nigel | 41 | fi |
| 999 | |||
| 1000 | nigel | 75 | $run $mv "${libobj}T" "${libobj}" |
| 1001 | |||
| 1002 | nigel | 41 | # Unlock the critical section if it was locked |
| 1003 | if test "$need_locks" != no; then | ||
| 1004 | nigel | 53 | $run $rm "$lockfile" |
| 1005 | nigel | 41 | fi |
| 1006 | |||
| 1007 | nigel | 75 | exit $EXIT_SUCCESS |
| 1008 | nigel | 41 | ;; |
| 1009 | |||
| 1010 | # libtool link mode | ||
| 1011 | nigel | 53 | link | relink) |
| 1012 | nigel | 41 | modename="$modename: link" |
| 1013 | nigel | 53 | case $host in |
| 1014 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) | ||
| 1015 | nigel | 41 | # It is impossible to link a dll without this setting, and |
| 1016 | # we shouldn't force the makefile maintainer to figure out | ||
| 1017 | # which system we are compiling for in order to pass an extra | ||
| 1018 | nigel | 75 | # flag for every libtool invocation. |
| 1019 | nigel | 41 | # allow_undefined=no |
| 1020 | |||
| 1021 | # FIXME: Unfortunately, there are problems with the above when trying | ||
| 1022 | # to make a dll which has undefined symbols, in which case not | ||
| 1023 | # even a static library is built. For now, we need to specify | ||
| 1024 | # -no-undefined on the libtool link line when we can be certain | ||
| 1025 | # that all symbols are satisfied, otherwise we get a static library. | ||
| 1026 | allow_undefined=yes | ||
| 1027 | ;; | ||
| 1028 | *) | ||
| 1029 | allow_undefined=yes | ||
| 1030 | ;; | ||
| 1031 | esac | ||
| 1032 | nigel | 53 | libtool_args="$nonopt" |
| 1033 | nigel | 75 | base_compile="$nonopt $@" |
| 1034 | nigel | 41 | compile_command="$nonopt" |
| 1035 | finalize_command="$nonopt" | ||
| 1036 | |||
| 1037 | compile_rpath= | ||
| 1038 | finalize_rpath= | ||
| 1039 | compile_shlibpath= | ||
| 1040 | finalize_shlibpath= | ||
| 1041 | convenience= | ||
| 1042 | old_convenience= | ||
| 1043 | deplibs= | ||
| 1044 | nigel | 53 | old_deplibs= |
| 1045 | compiler_flags= | ||
| 1046 | linker_flags= | ||
| 1047 | dllsearchpath= | ||
| 1048 | lib_search_path=`pwd` | ||
| 1049 | nigel | 75 | inst_prefix_dir= |
| 1050 | nigel | 41 | |
| 1051 | avoid_version=no | ||
| 1052 | dlfiles= | ||
| 1053 | dlprefiles= | ||
| 1054 | dlself=no | ||
| 1055 | export_dynamic=no | ||
| 1056 | export_symbols= | ||
| 1057 | export_symbols_regex= | ||
| 1058 | generated= | ||
| 1059 | libobjs= | ||
| 1060 | ltlibs= | ||
| 1061 | module=no | ||
| 1062 | nigel | 53 | no_install=no |
| 1063 | nigel | 41 | objs= |
| 1064 | nigel | 75 | non_pic_objects= |
| 1065 | precious_files_regex= | ||
| 1066 | nigel | 41 | prefer_static_libs=no |
| 1067 | preload=no | ||
| 1068 | prev= | ||
| 1069 | prevarg= | ||
| 1070 | release= | ||
| 1071 | rpath= | ||
| 1072 | xrpath= | ||
| 1073 | perm_rpath= | ||
| 1074 | temp_rpath= | ||
| 1075 | thread_safe=no | ||
| 1076 | vinfo= | ||
| 1077 | nigel | 75 | vinfo_number=no |
| 1078 | nigel | 41 | |
| 1079 | nigel | 75 | func_infer_tag $base_compile |
| 1080 | |||
| 1081 | nigel | 41 | # We need to know -static, to get the right output filenames. |
| 1082 | for arg | ||
| 1083 | do | ||
| 1084 | nigel | 53 | case $arg in |
| 1085 | nigel | 41 | -all-static | -static) |
| 1086 | if test "X$arg" = "X-all-static"; then | ||
| 1087 | if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then | ||
| 1088 | $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 | ||
| 1089 | fi | ||
| 1090 | if test -n "$link_static_flag"; then | ||
| 1091 | dlopen_self=$dlopen_self_static | ||
| 1092 | fi | ||
| 1093 | else | ||
| 1094 | if test -z "$pic_flag" && test -n "$link_static_flag"; then | ||
| 1095 | dlopen_self=$dlopen_self_static | ||
| 1096 | fi | ||
| 1097 | fi | ||
| 1098 | build_libtool_libs=no | ||
| 1099 | build_old_libs=yes | ||
| 1100 | prefer_static_libs=yes | ||
| 1101 | break | ||
| 1102 | ;; | ||
| 1103 | esac | ||
| 1104 | done | ||
| 1105 | |||
| 1106 | # See if our shared archives depend on static archives. | ||
| 1107 | test -n "$old_archive_from_new_cmds" && build_old_libs=yes | ||
| 1108 | |||
| 1109 | # Go through the arguments, transforming them on the way. | ||
| 1110 | nigel | 75 | while test "$#" -gt 0; do |
| 1111 | nigel | 41 | arg="$1" |
| 1112 | shift | ||
| 1113 | nigel | 53 | case $arg in |
| 1114 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | ||
| 1115 | qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test | ||
| 1116 | ;; | ||
| 1117 | *) qarg=$arg ;; | ||
| 1118 | esac | ||
| 1119 | libtool_args="$libtool_args $qarg" | ||
| 1120 | nigel | 41 | |
| 1121 | # If the previous option needs an argument, assign it. | ||
| 1122 | if test -n "$prev"; then | ||
| 1123 | nigel | 53 | case $prev in |
| 1124 | nigel | 41 | output) |
| 1125 | compile_command="$compile_command @OUTPUT@" | ||
| 1126 | finalize_command="$finalize_command @OUTPUT@" | ||
| 1127 | ;; | ||
| 1128 | esac | ||
| 1129 | |||
| 1130 | nigel | 53 | case $prev in |
| 1131 | nigel | 41 | dlfiles|dlprefiles) |
| 1132 | if test "$preload" = no; then | ||
| 1133 | # Add the symbol object into the linking commands. | ||
| 1134 | compile_command="$compile_command @SYMFILE@" | ||
| 1135 | finalize_command="$finalize_command @SYMFILE@" | ||
| 1136 | preload=yes | ||
| 1137 | fi | ||
| 1138 | nigel | 53 | case $arg in |
| 1139 | nigel | 41 | *.la | *.lo) ;; # We handle these cases below. |
| 1140 | force) | ||
| 1141 | if test "$dlself" = no; then | ||
| 1142 | dlself=needless | ||
| 1143 | export_dynamic=yes | ||
| 1144 | fi | ||
| 1145 | prev= | ||
| 1146 | continue | ||
| 1147 | ;; | ||
| 1148 | self) | ||
| 1149 | if test "$prev" = dlprefiles; then | ||
| 1150 | dlself=yes | ||
| 1151 | elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then | ||
| 1152 | dlself=yes | ||
| 1153 | else | ||
| 1154 | dlself=needless | ||
| 1155 | export_dynamic=yes | ||
| 1156 | fi | ||
| 1157 | prev= | ||
| 1158 | continue | ||
| 1159 | ;; | ||
| 1160 | *) | ||
| 1161 | if test "$prev" = dlfiles; then | ||
| 1162 | dlfiles="$dlfiles $arg" | ||
| 1163 | else | ||
| 1164 | dlprefiles="$dlprefiles $arg" | ||
| 1165 | fi | ||
| 1166 | prev= | ||
| 1167 | nigel | 53 | continue |
| 1168 | nigel | 41 | ;; |
| 1169 | esac | ||
| 1170 | ;; | ||
| 1171 | expsyms) | ||
| 1172 | export_symbols="$arg" | ||
| 1173 | if test ! -f "$arg"; then | ||
| 1174 | $echo "$modename: symbol file \`$arg' does not exist" | ||
| 1175 | nigel | 75 | exit $EXIT_FAILURE |
| 1176 | nigel | 41 | fi |
| 1177 | prev= | ||
| 1178 | continue | ||
| 1179 | ;; | ||
| 1180 | expsyms_regex) | ||
| 1181 | export_symbols_regex="$arg" | ||
| 1182 | prev= | ||
| 1183 | continue | ||
| 1184 | ;; | ||
| 1185 | nigel | 75 | inst_prefix) |
| 1186 | inst_prefix_dir="$arg" | ||
| 1187 | prev= | ||
| 1188 | continue | ||
| 1189 | ;; | ||
| 1190 | precious_regex) | ||
| 1191 | precious_files_regex="$arg" | ||
| 1192 | prev= | ||
| 1193 | continue | ||
| 1194 | ;; | ||
| 1195 | nigel | 41 | release) |
| 1196 | release="-$arg" | ||
| 1197 | prev= | ||
| 1198 | continue | ||
| 1199 | ;; | ||
| 1200 | nigel | 75 | objectlist) |
| 1201 | if test -f "$arg"; then | ||
| 1202 | save_arg=$arg | ||
| 1203 | moreargs= | ||
| 1204 | for fil in `cat $save_arg` | ||
| 1205 | do | ||
| 1206 | # moreargs="$moreargs $fil" | ||
| 1207 | arg=$fil | ||
| 1208 | # A libtool-controlled object. | ||
| 1209 | |||
| 1210 | # Check to see that this really is a libtool object. | ||
| 1211 | if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then | ||
| 1212 | pic_object= | ||
| 1213 | non_pic_object= | ||
| 1214 | |||
| 1215 | # Read the .lo file | ||
| 1216 | # If there is no directory component, then add one. | ||
| 1217 | case $arg in | ||
| 1218 | */* | *\\*) . $arg ;; | ||
| 1219 | *) . ./$arg ;; | ||
| 1220 | esac | ||
| 1221 | |||
| 1222 | if test -z "$pic_object" || \ | ||
| 1223 | test -z "$non_pic_object" || | ||
| 1224 | test "$pic_object" = none && \ | ||
| 1225 | test "$non_pic_object" = none; then | ||
| 1226 | $echo "$modename: cannot find name of object for \`$arg'" 1>&2 | ||
| 1227 | exit $EXIT_FAILURE | ||
| 1228 | fi | ||
| 1229 | |||
| 1230 | # Extract subdirectory from the argument. | ||
| 1231 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` | ||
| 1232 | if test "X$xdir" = "X$arg"; then | ||
| 1233 | xdir= | ||
| 1234 | else | ||
| 1235 | xdir="$xdir/" | ||
| 1236 | fi | ||
| 1237 | |||
| 1238 | if test "$pic_object" != none; then | ||
| 1239 | # Prepend the subdirectory the object is found in. | ||
| 1240 | pic_object="$xdir$pic_object" | ||
| 1241 | |||
| 1242 | if test "$prev" = dlfiles; then | ||
| 1243 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then | ||
| 1244 | dlfiles="$dlfiles $pic_object" | ||
| 1245 | prev= | ||
| 1246 | continue | ||
| 1247 | else | ||
| 1248 | # If libtool objects are unsupported, then we need to preload. | ||
| 1249 | prev=dlprefiles | ||
| 1250 | fi | ||
| 1251 | fi | ||
| 1252 | |||
| 1253 | # CHECK ME: I think I busted this. -Ossama | ||
| 1254 | if test "$prev" = dlprefiles; then | ||
| 1255 | # Preload the old-style object. | ||
| 1256 | dlprefiles="$dlprefiles $pic_object" | ||
| 1257 | prev= | ||
| 1258 | fi | ||
| 1259 | |||
| 1260 | # A PIC object. | ||
| 1261 | libobjs="$libobjs $pic_object" | ||
| 1262 | arg="$pic_object" | ||
| 1263 | fi | ||
| 1264 | |||
| 1265 | # Non-PIC object. | ||
| 1266 | if test "$non_pic_object" != none; then | ||
| 1267 | # Prepend the subdirectory the object is found in. | ||
| 1268 | non_pic_object="$xdir$non_pic_object" | ||
| 1269 | |||
| 1270 | # A standard non-PIC object | ||
| 1271 | non_pic_objects="$non_pic_objects $non_pic_object" | ||
| 1272 | if test -z "$pic_object" || test "$pic_object" = none ; then | ||
| 1273 | arg="$non_pic_object" | ||
| 1274 | fi | ||
| 1275 | fi | ||
| 1276 | else | ||
| 1277 | # Only an error if not doing a dry-run. | ||
| 1278 | if test -z "$run"; then | ||
| 1279 | $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 | ||
| 1280 | exit $EXIT_FAILURE | ||
| 1281 | else | ||
| 1282 | # Dry-run case. | ||
| 1283 | |||
| 1284 | # Extract subdirectory from the argument. | ||
| 1285 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` | ||
| 1286 | if test "X$xdir" = "X$arg"; then | ||
| 1287 | xdir= | ||
| 1288 | else | ||
| 1289 | xdir="$xdir/" | ||
| 1290 | fi | ||
| 1291 | |||
| 1292 | pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` | ||
| 1293 | non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` | ||
| 1294 | libobjs="$libobjs $pic_object" | ||
| 1295 | non_pic_objects="$non_pic_objects $non_pic_object" | ||
| 1296 | fi | ||
| 1297 | fi | ||
| 1298 | done | ||
| 1299 | else | ||
| 1300 | $echo "$modename: link input file \`$save_arg' does not exist" | ||
| 1301 | exit $EXIT_FAILURE | ||
| 1302 | fi | ||
| 1303 | arg=$save_arg | ||
| 1304 | prev= | ||
| 1305 | continue | ||
| 1306 | ;; | ||
| 1307 | nigel | 41 | rpath | xrpath) |
| 1308 | # We need an absolute path. | ||
| 1309 | nigel | 53 | case $arg in |
| 1310 | nigel | 41 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 1311 | *) | ||
| 1312 | $echo "$modename: only absolute run-paths are allowed" 1>&2 | ||
| 1313 | nigel | 75 | exit $EXIT_FAILURE |
| 1314 | nigel | 41 | ;; |
| 1315 | esac | ||
| 1316 | if test "$prev" = rpath; then | ||
| 1317 | case "$rpath " in | ||
| 1318 | *" $arg "*) ;; | ||
| 1319 | *) rpath="$rpath $arg" ;; | ||
| 1320 | esac | ||
| 1321 | else | ||
| 1322 | case "$xrpath " in | ||
| 1323 | *" $arg "*) ;; | ||
| 1324 | *) xrpath="$xrpath $arg" ;; | ||
| 1325 | esac | ||
| 1326 | fi | ||
| 1327 | prev= | ||
| 1328 | continue | ||
| 1329 | ;; | ||
| 1330 | nigel | 53 | xcompiler) |
| 1331 | compiler_flags="$compiler_flags $qarg" | ||
| 1332 | prev= | ||
| 1333 | compile_command="$compile_command $qarg" | ||
| 1334 | finalize_command="$finalize_command $qarg" | ||
| 1335 | continue | ||
| 1336 | ;; | ||
| 1337 | xlinker) | ||
| 1338 | linker_flags="$linker_flags $qarg" | ||
| 1339 | compiler_flags="$compiler_flags $wl$qarg" | ||
| 1340 | prev= | ||
| 1341 | compile_command="$compile_command $wl$qarg" | ||
| 1342 | finalize_command="$finalize_command $wl$qarg" | ||
| 1343 | continue | ||
| 1344 | ;; | ||
| 1345 | nigel | 75 | xcclinker) |
| 1346 | linker_flags="$linker_flags $qarg" | ||
| 1347 | compiler_flags="$compiler_flags $qarg" | ||
| 1348 | prev= | ||
| 1349 | compile_command="$compile_command $qarg" | ||
| 1350 | finalize_command="$finalize_command $qarg" | ||
| 1351 | continue | ||
| 1352 | ;; | ||
| 1353 | shrext) | ||
| 1354 | shrext_cmds="$arg" | ||
| 1355 | prev= | ||
| 1356 | continue | ||
| 1357 | ;; | ||
| 1358 | nigel | 41 | *) |
| 1359 | eval "$prev=\"\$arg\"" | ||
| 1360 | prev= | ||
| 1361 | continue | ||
| 1362 | ;; | ||
| 1363 | esac | ||
| 1364 | nigel | 75 | fi # test -n "$prev" |
| 1365 | nigel | 41 | |
| 1366 | prevarg="$arg" | ||
| 1367 | |||
| 1368 | nigel | 53 | case $arg in |
| 1369 | nigel | 41 | -all-static) |
| 1370 | if test -n "$link_static_flag"; then | ||
| 1371 | compile_command="$compile_command $link_static_flag" | ||
| 1372 | finalize_command="$finalize_command $link_static_flag" | ||
| 1373 | fi | ||
| 1374 | continue | ||
| 1375 | ;; | ||
| 1376 | |||
| 1377 | -allow-undefined) | ||
| 1378 | # FIXME: remove this flag sometime in the future. | ||
| 1379 | $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 | ||
| 1380 | continue | ||
| 1381 | ;; | ||
| 1382 | |||
| 1383 | -avoid-version) | ||
| 1384 | avoid_version=yes | ||
| 1385 | continue | ||
| 1386 | ;; | ||
| 1387 | |||
| 1388 | -dlopen) | ||
| 1389 | prev=dlfiles | ||
| 1390 | continue | ||
| 1391 | ;; | ||
| 1392 | |||
| 1393 | -dlpreopen) | ||
| 1394 | prev=dlprefiles | ||
| 1395 | continue | ||
| 1396 | ;; | ||
| 1397 | |||
| 1398 | -export-dynamic) | ||
| 1399 | export_dynamic=yes | ||
| 1400 | continue | ||
| 1401 | ;; | ||
| 1402 | |||
| 1403 | -export-symbols | -export-symbols-regex) | ||
| 1404 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then | ||
| 1405 | nigel | 53 | $echo "$modename: more than one -exported-symbols argument is not allowed" |
| 1406 | nigel | 75 | exit $EXIT_FAILURE |
| 1407 | nigel | 41 | fi |
| 1408 | if test "X$arg" = "X-export-symbols"; then | ||
| 1409 | prev=expsyms | ||
| 1410 | else | ||
| 1411 | prev=expsyms_regex | ||
| 1412 | fi | ||
| 1413 | continue | ||
| 1414 | ;; | ||
| 1415 | |||
| 1416 | nigel | 75 | -inst-prefix-dir) |
| 1417 | prev=inst_prefix | ||
| 1418 | continue | ||
| 1419 | ;; | ||
| 1420 | |||
| 1421 | nigel | 53 | # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* |
| 1422 | # so, if we see these flags be careful not to treat them like -L | ||
| 1423 | -L[A-Z][A-Z]*:*) | ||
| 1424 | case $with_gcc/$host in | ||
| 1425 | nigel | 75 | no/*-*-irix* | /*-*-irix*) |
| 1426 | nigel | 53 | compile_command="$compile_command $arg" |
| 1427 | finalize_command="$finalize_command $arg" | ||
| 1428 | ;; | ||
| 1429 | esac | ||
| 1430 | continue | ||
| 1431 | ;; | ||
| 1432 | |||
| 1433 | nigel | 41 | -L*) |
| 1434 | dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` | ||
| 1435 | # We need an absolute path. | ||
| 1436 | nigel | 53 | case $dir in |
| 1437 | nigel | 41 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 1438 | *) | ||
| 1439 | absdir=`cd "$dir" && pwd` | ||
| 1440 | if test -z "$absdir"; then | ||
| 1441 | nigel | 53 | $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 |
| 1442 | nigel | 75 | exit $EXIT_FAILURE |
| 1443 | nigel | 41 | fi |
| 1444 | dir="$absdir" | ||
| 1445 | ;; | ||
| 1446 | esac | ||
| 1447 | nigel | 53 | case "$deplibs " in |
| 1448 | *" -L$dir "*) ;; | ||
| 1449 | *) | ||
| 1450 | deplibs="$deplibs -L$dir" | ||
| 1451 | lib_search_path="$lib_search_path $dir" | ||
| 1452 | ;; | ||
| 1453 | nigel | 41 | esac |
| 1454 | nigel | 53 | case $host in |
| 1455 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) | ||
| 1456 | case :$dllsearchpath: in | ||
| 1457 | *":$dir:"*) ;; | ||
| 1458 | *) dllsearchpath="$dllsearchpath:$dir";; | ||
| 1459 | nigel | 41 | esac |
| 1460 | ;; | ||
| 1461 | esac | ||
| 1462 | nigel | 53 | continue |
| 1463 | nigel | 41 | ;; |
| 1464 | |||
| 1465 | -l*) | ||
| 1466 | nigel | 53 | if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then |
| 1467 | case $host in | ||
| 1468 | *-*-cygwin* | *-*-pw32* | *-*-beos*) | ||
| 1469 | # These systems don't actually have a C or math library (as such) | ||
| 1470 | nigel | 41 | continue |
| 1471 | ;; | ||
| 1472 | nigel | 53 | *-*-mingw* | *-*-os2*) |
| 1473 | # These systems don't actually have a C library (as such) | ||
| 1474 | test "X$arg" = "X-lc" && continue | ||
| 1475 | nigel | 41 | ;; |
| 1476 | nigel | 63 | *-*-openbsd* | *-*-freebsd*) |
| 1477 | # Do not include libc due to us having libc/libc_r. | ||
| 1478 | test "X$arg" = "X-lc" && continue | ||
| 1479 | ;; | ||
| 1480 | nigel | 75 | *-*-rhapsody* | *-*-darwin1.[012]) |
| 1481 | # Rhapsody C and math libraries are in the System framework | ||
| 1482 | deplibs="$deplibs -framework System" | ||
| 1483 | continue | ||
| 1484 | nigel | 41 | esac |
| 1485 | nigel | 75 | elif test "X$arg" = "X-lc_r"; then |
| 1486 | case $host in | ||
| 1487 | nigel | 63 | *-*-openbsd* | *-*-freebsd*) |
| 1488 | nigel | 75 | # Do not include libc_r directly, use -pthread flag. |
| 1489 | continue | ||
| 1490 | ;; | ||
| 1491 | esac | ||
| 1492 | nigel | 41 | fi |
| 1493 | deplibs="$deplibs $arg" | ||
| 1494 | nigel | 53 | continue |
| 1495 | nigel | 41 | ;; |
| 1496 | |||
| 1497 | nigel | 75 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) |
| 1498 | deplibs="$deplibs $arg" | ||
| 1499 | continue | ||
| 1500 | ;; | ||
| 1501 | |||
| 1502 | nigel | 41 | -module) |
| 1503 | module=yes | ||
| 1504 | continue | ||
| 1505 | ;; | ||
| 1506 | |||
| 1507 | nigel | 75 | # gcc -m* arguments should be passed to the linker via $compiler_flags |
| 1508 | # in order to pass architecture information to the linker | ||
| 1509 | # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo | ||
| 1510 | # but this is not reliable with gcc because gcc may use -mfoo to | ||
| 1511 | # select a different linker, different libraries, etc, while | ||
| 1512 | # -Wl,-mfoo simply passes -mfoo to the linker. | ||
| 1513 | -m*) | ||
| 1514 | # Unknown arguments in both finalize_command and compile_command need | ||
| 1515 | # to be aesthetically quoted because they are evaled later. | ||
| 1516 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` | ||
| 1517 | case $arg in | ||
| 1518 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | ||
| 1519 | arg="\"$arg\"" | ||
| 1520 | ;; | ||
| 1521 | esac | ||
| 1522 | compile_command="$compile_command $arg" | ||
| 1523 | finalize_command="$finalize_command $arg" | ||
| 1524 | if test "$with_gcc" = "yes" ; then | ||
| 1525 | compiler_flags="$compiler_flags $arg" | ||
| 1526 | fi | ||
| 1527 | continue | ||
| 1528 | ;; | ||
| 1529 | |||
| 1530 | -shrext) | ||
| 1531 | prev=shrext | ||
| 1532 | continue | ||
| 1533 | ;; | ||
| 1534 | |||
| 1535 | nigel | 53 | -no-fast-install) |
| 1536 | fast_install=no | ||
| 1537 | continue | ||
| 1538 | ;; | ||
| 1539 | |||
| 1540 | -no-install) | ||
| 1541 | case $host in | ||
| 1542 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) | ||
| 1543 | # The PATH hackery in wrapper scripts is required on Windows | ||
| 1544 | # in order for the loader to find any dlls it needs. | ||
| 1545 | $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 | ||
| 1546 | $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 | ||
| 1547 | fast_install=no | ||
| 1548 | ;; | ||
| 1549 | *) no_install=yes ;; | ||
| 1550 | esac | ||
| 1551 | continue | ||
| 1552 | ;; | ||
| 1553 | |||
| 1554 | nigel | 41 | -no-undefined) |
| 1555 | allow_undefined=no | ||
| 1556 | continue | ||
| 1557 | ;; | ||
| 1558 | |||
| 1559 | nigel | 75 | -objectlist) |
| 1560 | prev=objectlist | ||
| 1561 | continue | ||
| 1562 | ;; | ||
| 1563 | |||
| 1564 | nigel | 41 | -o) prev=output ;; |
| 1565 | |||
| 1566 | nigel | 75 | -precious-files-regex) |
| 1567 | prev=precious_regex | ||
| 1568 | continue | ||
| 1569 | ;; | ||
| 1570 | |||
| 1571 | nigel | 41 | -release) |
| 1572 | prev=release | ||
| 1573 | continue | ||
| 1574 | ;; | ||
| 1575 | |||
| 1576 | -rpath) | ||
| 1577 | prev=rpath | ||
| 1578 | continue | ||
| 1579 | ;; | ||
| 1580 | |||
| 1581 | -R) | ||
| 1582 | prev=xrpath | ||
| 1583 | continue | ||
| 1584 | ;; | ||
| 1585 | |||
| 1586 | -R*) | ||
| 1587 | dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` | ||
| 1588 | # We need an absolute path. | ||
| 1589 | nigel | 53 | case $dir in |
| 1590 | nigel | 41 | [\\/]* | [A-Za-z]:[\\/]*) ;; |
| 1591 | *) | ||
| 1592 | $echo "$modename: only absolute run-paths are allowed" 1>&2 | ||
| 1593 | nigel | 75 | exit $EXIT_FAILURE |
| 1594 | nigel | 41 | ;; |
| 1595 | esac | ||
| 1596 | case "$xrpath " in | ||
| 1597 | *" $dir "*) ;; | ||
| 1598 | *) xrpath="$xrpath $dir" ;; | ||
| 1599 | esac | ||
| 1600 | continue | ||
| 1601 | ;; | ||
| 1602 | |||
| 1603 | -static) | ||
| 1604 | nigel | 53 | # The effects of -static are defined in a previous loop. |
| 1605 | # We used to do the same as -all-static on platforms that | ||
| 1606 | # didn't have a PIC flag, but the assumption that the effects | ||
| 1607 | # would be equivalent was wrong. It would break on at least | ||
| 1608 | # Digital Unix and AIX. | ||
| 1609 | nigel | 41 | continue |
| 1610 | ;; | ||
| 1611 | |||
| 1612 | -thread-safe) | ||
| 1613 | thread_safe=yes | ||
| 1614 | continue | ||
| 1615 | ;; | ||
| 1616 | |||
| 1617 | -version-info) | ||
| 1618 | prev=vinfo | ||
| 1619 | continue | ||
| 1620 | ;; | ||
| 1621 | nigel | 75 | -version-number) |
| 1622 | prev=vinfo | ||
| 1623 | vinfo_number=yes | ||
| 1624 | continue | ||
| 1625 | ;; | ||
| 1626 | nigel | 41 | |
| 1627 | nigel | 53 | -Wc,*) |
| 1628 | args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` | ||
| 1629 | arg= | ||
| 1630 | nigel | 63 | save_ifs="$IFS"; IFS=',' |
| 1631 | nigel | 53 | for flag in $args; do |
| 1632 | IFS="$save_ifs" | ||
| 1633 | case $flag in | ||
| 1634 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | ||
| 1635 | flag="\"$flag\"" | ||
| 1636 | ;; | ||
| 1637 | esac | ||
| 1638 | arg="$arg $wl$flag" | ||
| 1639 | compiler_flags="$compiler_flags $flag" | ||
| 1640 | done | ||
| 1641 | IFS="$save_ifs" | ||
| 1642 | arg=`$echo "X$arg" | $Xsed -e "s/^ //"` | ||
| 1643 | ;; | ||
| 1644 | |||
| 1645 | -Wl,*) | ||
| 1646 | args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` | ||
| 1647 | arg= | ||
| 1648 | nigel | 63 | save_ifs="$IFS"; IFS=',' |
| 1649 | nigel | 53 | for flag in $args; do |
| 1650 | IFS="$save_ifs" | ||
| 1651 | case $flag in | ||
| 1652 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | ||
| 1653 | flag="\"$flag\"" | ||
| 1654 | ;; | ||
| 1655 | esac | ||
| 1656 | arg="$arg $wl$flag" | ||
| 1657 | compiler_flags="$compiler_flags $wl$flag" | ||
| 1658 | linker_flags="$linker_flags $flag" | ||
| 1659 | done | ||
| 1660 | IFS="$save_ifs" | ||
| 1661 | arg=`$echo "X$arg" | $Xsed -e "s/^ //"` | ||
| 1662 | ;; | ||
| 1663 | |||
| 1664 | -Xcompiler) | ||
| 1665 | prev=xcompiler | ||
| 1666 | continue | ||
| 1667 | ;; | ||
| 1668 | |||
| 1669 | -Xlinker) | ||
| 1670 | prev=xlinker | ||
| 1671 | continue | ||
| 1672 | ;; | ||
| 1673 | |||
| 1674 | nigel | 75 | -XCClinker) |
| 1675 | prev=xcclinker | ||
| 1676 | continue | ||
| 1677 | ;; | ||
| 1678 | |||
| 1679 | nigel | 41 | # Some other compiler flag. |
| 1680 | -* | +*) | ||
| 1681 | # Unknown arguments in both finalize_command and compile_command need | ||
| 1682 | # to be aesthetically quoted because they are evaled later. | ||
| 1683 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` | ||
| 1684 | nigel | 53 | case $arg in |
| 1685 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | ||
| 1686 | nigel | 41 | arg="\"$arg\"" |
| 1687 | ;; | ||
| 1688 | esac | ||
| 1689 | ;; | ||
| 1690 | |||
| 1691 | nigel | 75 | *.$objext) |
| 1692 | # A standard object. | ||
| 1693 | objs="$objs $arg" | ||
| 1694 | ;; | ||
| 1695 | |||
| 1696 | *.lo) | ||
| 1697 | # A libtool-controlled object. | ||
| 1698 | |||
| 1699 | # Check to see that this really is a libtool object. | ||
| 1700 | if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then | ||
| 1701 | pic_object= | ||
| 1702 | non_pic_object= | ||
| 1703 | |||
| 1704 | # Read the .lo file | ||
| 1705 | # If there is no directory component, then add one. | ||
| 1706 | case $arg in | ||
| 1707 | */* | *\\*) . $arg ;; | ||
| 1708 | *) . ./$arg ;; | ||
| 1709 | esac | ||
| 1710 | |||
| 1711 | if test -z "$pic_object" || \ | ||
| 1712 | test -z "$non_pic_object" || | ||
| 1713 | test "$pic_object" = none && \ | ||
| 1714 | test "$non_pic_object" = none; then | ||
| 1715 | $echo "$modename: cannot find name of object for \`$arg'" 1>&2 | ||
| 1716 | exit $EXIT_FAILURE | ||
| 1717 | fi | ||
| 1718 | |||
| 1719 | # Extract subdirectory from the argument. | ||
| 1720 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` | ||
| 1721 | if test "X$xdir" = "X$arg"; then | ||
| 1722 | xdir= | ||
| 1723 | nigel | 41 | else |
| 1724 | nigel | 75 | xdir="$xdir/" |
| 1725 | nigel | 41 | fi |
| 1726 | |||
| 1727 | nigel | 75 | if test "$pic_object" != none; then |
| 1728 | # Prepend the subdirectory the object is found in. | ||
| 1729 | pic_object="$xdir$pic_object" | ||
| 1730 | |||
| 1731 | if test "$prev" = dlfiles; then | ||
| 1732 | if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then | ||
| 1733 | dlfiles="$dlfiles $pic_object" | ||
| 1734 | prev= | ||
| 1735 | continue | ||
| 1736 | else | ||
| 1737 | # If libtool objects are unsupported, then we need to preload. | ||
| 1738 | prev=dlprefiles | ||
| 1739 | fi | ||
| 1740 | fi | ||
| 1741 | |||
| 1742 | # CHECK ME: I think I busted this. -Ossama | ||
| 1743 | if test "$prev" = dlprefiles; then | ||
| 1744 | # Preload the old-style object. | ||
| 1745 | dlprefiles="$dlprefiles $pic_object" | ||
| 1746 | prev= | ||
| 1747 | fi | ||
| 1748 | |||
| 1749 | # A PIC object. | ||
| 1750 | libobjs="$libobjs $pic_object" | ||
| 1751 | arg="$pic_object" | ||
| 1752 | fi | ||
| 1753 | |||
| 1754 | # Non-PIC object. | ||
| 1755 | if test "$non_pic_object" != none; then | ||
| 1756 | # Prepend the subdirectory the object is found in. | ||
| 1757 | non_pic_object="$xdir$non_pic_object" | ||
| 1758 | |||
| 1759 | # A standard non-PIC object | ||
| 1760 | non_pic_objects="$non_pic_objects $non_pic_object" | ||
| 1761 | if test -z "$pic_object" || test "$pic_object" = none ; then | ||
| 1762 | arg="$non_pic_object" | ||
| 1763 | fi | ||
| 1764 | fi | ||
| 1765 | nigel | 53 | else |
| 1766 | nigel | 75 | # Only an error if not doing a dry-run. |
| 1767 | if test -z "$run"; then | ||
| 1768 | $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 | ||
| 1769 | exit $EXIT_FAILURE | ||
| 1770 | else | ||
| 1771 | # Dry-run case. | ||
| 1772 | |||
| 1773 | # Extract subdirectory from the argument. | ||
| 1774 | xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` | ||
| 1775 | if test "X$xdir" = "X$arg"; then | ||
| 1776 | xdir= | ||
| 1777 | else | ||
| 1778 | xdir="$xdir/" | ||
| 1779 | fi | ||
| 1780 | |||
| 1781 | pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` | ||
| 1782 | non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` | ||
| 1783 | libobjs="$libobjs $pic_object" | ||
| 1784 | non_pic_objects="$non_pic_objects $non_pic_object" | ||
| 1785 | fi | ||
| 1786 | nigel | 41 | fi |
| 1787 | ;; | ||
| 1788 | |||
| 1789 | nigel | 53 | *.$libext) |
| 1790 | # An archive. | ||
| 1791 | deplibs="$deplibs $arg" | ||
| 1792 | old_deplibs="$old_deplibs $arg" | ||
| 1793 | continue | ||
| 1794 | ;; | ||
| 1795 | |||
| 1796 | nigel | 41 | *.la) |
| 1797 | # A libtool-controlled library. | ||
| 1798 | |||
| 1799 | nigel | 53 | if test "$prev" = dlfiles; then |
| 1800 | # This library was specified with -dlopen. | ||
| 1801 | dlfiles="$dlfiles $arg" | ||
| 1802 | prev= | ||
| 1803 | elif test "$prev" = dlprefiles; then | ||
| 1804 | # The library was specified with -dlpreopen. | ||
| 1805 | dlprefiles="$dlprefiles $arg" | ||
| 1806 | prev= | ||
| 1807 | else | ||
| 1808 | deplibs="$deplibs $arg" | ||
| 1809 | fi | ||
| 1810 | continue | ||
| 1811 | ;; | ||
| 1812 | nigel | 41 | |
| 1813 | nigel | 53 | # Some other compiler argument. |
| 1814 | *) | ||
| 1815 | # Unknown arguments in both finalize_command and compile_command need | ||
| 1816 | # to be aesthetically quoted because they are evaled later. | ||
| 1817 | arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` | ||
| 1818 | case $arg in | ||
| 1819 | *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") | ||
| 1820 | arg="\"$arg\"" | ||
| 1821 | ;; | ||
| 1822 | esac | ||
| 1823 | ;; | ||
| 1824 | esac # arg | ||
| 1825 | |||
| 1826 | # Now actually substitute the argument into the commands. | ||
| 1827 | if test -n "$arg"; then | ||
| 1828 | compile_command="$compile_command $arg" | ||
| 1829 | finalize_command="$finalize_command $arg" | ||
| 1830 | fi | ||
| 1831 | done # argument parsing loop | ||
| 1832 | |||
| 1833 | if test -n "$prev"; then | ||
| 1834 | $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 | ||
| 1835 | $echo "$help" 1>&2 | ||
| 1836 | nigel | 75 | exit $EXIT_FAILURE |
| 1837 | nigel | 53 | fi |
| 1838 | |||
| 1839 | if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then | ||
| 1840 | eval arg=\"$export_dynamic_flag_spec\" | ||
| 1841 | compile_command="$compile_command $arg" | ||
| 1842 | finalize_command="$finalize_command $arg" | ||
| 1843 | fi | ||
| 1844 | |||
| 1845 | nigel | 75 | oldlibs= |
| 1846 | nigel | 53 | # calculate the name of the file, without its directory |
| 1847 | outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` | ||
| 1848 | libobjs_save="$libobjs" | ||
| 1849 | |||
| 1850 | if test -n "$shlibpath_var"; then | ||
| 1851 | # get the directories listed in $shlibpath_var | ||
| 1852 | eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` | ||
| 1853 | else | ||
| 1854 | shlib_search_path= | ||
| 1855 | fi | ||
| 1856 | eval sys_lib_search_path=\"$sys_lib_search_path_spec\" | ||
| 1857 | eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" | ||
| 1858 | |||
| 1859 | output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` | ||
| 1860 | if test "X$output_objdir" = "X$output"; then | ||
| 1861 | output_objdir="$objdir" | ||
| 1862 | else | ||
| 1863 | output_objdir="$output_objdir/$objdir" | ||
| 1864 | fi | ||
| 1865 | # Create the object directory. | ||
| 1866 | nigel | 75 | if test ! -d "$output_objdir"; then |
| 1867 | nigel | 53 | $show "$mkdir $output_objdir" |
| 1868 | $run $mkdir $output_objdir | ||
| 1869 | status=$? | ||
| 1870 | nigel | 75 | if test "$status" -ne 0 && test ! -d "$output_objdir"; then |
| 1871 | nigel | 53 | exit $status |
| 1872 | fi | ||
| 1873 | fi | ||
| 1874 | |||
| 1875 | # Determine the type of output | ||
| 1876 | case $output in | ||
| 1877 | "") | ||
| 1878 | $echo "$modename: you must specify an output file" 1>&2 | ||
| 1879 | $echo "$help" 1>&2 | ||
| 1880 | nigel | 75 | exit $EXIT_FAILURE |
| 1881 | nigel | 53 | ;; |
| 1882 | *.$libext) linkmode=oldlib ;; | ||
| 1883 | *.lo | *.$objext) linkmode=obj ;; | ||
| 1884 | *.la) linkmode=lib ;; | ||
| 1885 | *) linkmode=prog ;; # Anything else should be a program. | ||
| 1886 | esac | ||
| 1887 | |||
| 1888 | nigel | 75 | case $host in |
| 1889 | *cygwin* | *mingw* | *pw32*) | ||
| 1890 | # don't eliminate duplications in $postdeps and $predeps | ||
| 1891 | duplicate_compiler_generated_deps=yes | ||
| 1892 | ;; | ||
| 1893 | *) | ||
| 1894 | duplicate_compiler_generated_deps=$duplicate_deps | ||
| 1895 | ;; | ||
| 1896 | esac | ||
| 1897 | nigel | 53 | specialdeplibs= |
| 1898 | nigel | 75 | |
| 1899 | nigel | 53 | libs= |
| 1900 | # Find all interdependent deplibs by searching for libraries | ||
| 1901 | # that are linked more than once (e.g. -la -lb -la) | ||
| 1902 | for deplib in $deplibs; do | ||
| 1903 | nigel | 63 | if test "X$duplicate_deps" = "Xyes" ; then |
| 1904 | case "$libs " in | ||
| 1905 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; | ||
| 1906 | esac | ||
| 1907 | fi | ||
| 1908 | nigel | 53 | libs="$libs $deplib" |
| 1909 | done | ||
| 1910 | nigel | 75 | |
| 1911 | if test "$linkmode" = lib; then | ||
| 1912 | libs="$predeps $libs $compiler_lib_search_path $postdeps" | ||
| 1913 | |||
| 1914 | # Compute libraries that are listed more than once in $predeps | ||
| 1915 | # $postdeps and mark them as special (i.e., whose duplicates are | ||
| 1916 | # not to be eliminated). | ||
| 1917 | pre_post_deps= | ||
| 1918 | if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then | ||
| 1919 | for pre_post_dep in $predeps $postdeps; do | ||
| 1920 | case "$pre_post_deps " in | ||
| 1921 | *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; | ||
| 1922 | esac | ||
| 1923 | pre_post_deps="$pre_post_deps $pre_post_dep" | ||
| 1924 | done | ||
| 1925 | fi | ||
| 1926 | pre_post_deps= | ||
| 1927 | fi | ||
| 1928 | |||
| 1929 | nigel | 53 | deplibs= |
| 1930 | newdependency_libs= | ||
| 1931 | newlib_search_path= | ||
| 1932 | need_relink=no # whether we're linking any uninstalled libtool libraries | ||
| 1933 | notinst_deplibs= # not-installed libtool libraries | ||
| 1934 | notinst_path= # paths that contain not-installed libtool libraries | ||
| 1935 | case $linkmode in | ||
| 1936 | lib) | ||
| 1937 | passes="conv link" | ||
| 1938 | for file in $dlfiles $dlprefiles; do | ||
| 1939 | case $file in | ||
| 1940 | *.la) ;; | ||
| 1941 | *) | ||
| 1942 | $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 | ||
| 1943 | nigel | 75 | exit $EXIT_FAILURE |
| 1944 | nigel | 53 | ;; |
| 1945 | esac | ||
| 1946 | done | ||
| 1947 | ;; | ||
| 1948 | prog) | ||
| 1949 | compile_deplibs= | ||
| 1950 | finalize_deplibs= | ||
| 1951 | alldeplibs=no | ||
| 1952 | newdlfiles= | ||
| 1953 | newdlprefiles= | ||
| 1954 | passes="conv scan dlopen dlpreopen link" | ||
| 1955 | ;; | ||
| 1956 | *) passes="conv" | ||
| 1957 | ;; | ||
| 1958 | esac | ||
| 1959 | for pass in $passes; do | ||
| 1960 | nigel | 75 | if test "$linkmode,$pass" = "lib,link" || |
| 1961 | test "$linkmode,$pass" = "prog,scan"; then | ||
| 1962 | libs="$deplibs" | ||
| 1963 | deplibs= | ||
| 1964 | fi | ||
| 1965 | if test "$linkmode" = prog; then | ||
| 1966 | nigel | 53 | case $pass in |
| 1967 | nigel | 75 | dlopen) libs="$dlfiles" ;; |
| 1968 | nigel | 53 | dlpreopen) libs="$dlprefiles" ;; |
| 1969 | link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; | ||
| 1970 | esac | ||
| 1971 | fi | ||
| 1972 | nigel | 75 | if test "$pass" = dlopen; then |
| 1973 | # Collect dlpreopened libraries | ||
| 1974 | save_deplibs="$deplibs" | ||
| 1975 | deplibs= | ||
| 1976 | fi | ||
| 1977 | nigel | 53 | for deplib in $libs; do |
| 1978 | lib= | ||
| 1979 | found=no | ||
| 1980 | case $deplib in | ||
| 1981 | nigel | 75 | -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) |
| 1982 | if test "$linkmode,$pass" = "prog,link"; then | ||
| 1983 | compile_deplibs="$deplib $compile_deplibs" | ||
| 1984 | finalize_deplibs="$deplib $finalize_deplibs" | ||
| 1985 | else | ||
| 1986 | deplibs="$deplib $deplibs" | ||
| 1987 | fi | ||
| 1988 | continue | ||
| 1989 | ;; | ||
| 1990 | nigel | 53 | -l*) |
| 1991 | nigel | 75 | if test "$linkmode" != lib && test "$linkmode" != prog; then |
| 1992 | $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 | ||
| 1993 | nigel | 53 | continue |
| 1994 | fi | ||
| 1995 | nigel | 75 | if test "$pass" = conv; then |
| 1996 | nigel | 53 | deplibs="$deplib $deplibs" |
| 1997 | continue | ||
| 1998 | fi | ||
| 1999 | name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` | ||
| 2000 | for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do | ||
| 2001 | nigel | 75 | for search_ext in .la $std_shrext .so .a; do |
| 2002 | # Search the libtool library | ||
| 2003 | lib="$searchdir/lib${name}${search_ext}" | ||
| 2004 | if test -f "$lib"; then | ||
| 2005 | if test "$search_ext" = ".la"; then | ||
| 2006 | found=yes | ||
| 2007 | else | ||
| 2008 | found=no | ||
| 2009 | fi | ||
| 2010 | break 2 | ||
| 2011 | fi | ||
| 2012 | done | ||
| 2013 | nigel | 53 | done |
| 2014 | if test "$found" != yes; then | ||
| 2015 | # deplib doesn't seem to be a libtool library | ||
| 2016 | if test "$linkmode,$pass" = "prog,link"; then | ||
| 2017 | compile_deplibs="$deplib $compile_deplibs" | ||
| 2018 | finalize_deplibs="$deplib $finalize_deplibs" | ||
| 2019 | else | ||
| 2020 | deplibs="$deplib $deplibs" | ||
| 2021 | nigel | 75 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" |
| 2022 | nigel | 53 | fi |
| 2023 | continue | ||
| 2024 | nigel | 75 | else # deplib is a libtool library |
| 2025 | # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, | ||
| 2026 | # We need to do some special things here, and not later. | ||
| 2027 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then | ||
| 2028 | case " $predeps $postdeps " in | ||
| 2029 | *" $deplib "*) | ||
| 2030 | if (${SED} -e '2q' $lib | | ||
| 2031 | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then | ||
| 2032 | library_names= | ||
| 2033 | old_library= | ||
| 2034 | case $lib in | ||
| 2035 | */* | *\\*) . $lib ;; | ||
| 2036 | *) . ./$lib ;; | ||
| 2037 | esac | ||
| 2038 | for l in $old_library $library_names; do | ||
| 2039 | ll="$l" | ||
| 2040 | done | ||
| 2041 | if test "X$ll" = "X$old_library" ; then # only static version available | ||
| 2042 | found=no | ||
| 2043 | ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` | ||
| 2044 | test "X$ladir" = "X$lib" && ladir="." | ||
| 2045 | lib=$ladir/$old_library | ||
| 2046 | if test "$linkmode,$pass" = "prog,link"; then | ||
| 2047 | compile_deplibs="$deplib $compile_deplibs" | ||
| 2048 | finalize_deplibs="$deplib $finalize_deplibs" | ||
| 2049 | else | ||
| 2050 | deplibs="$deplib $deplibs" | ||
| 2051 | test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" | ||
| 2052 | fi | ||
| 2053 | continue | ||
| 2054 | fi | ||
| 2055 | fi | ||
| 2056 | ;; | ||
| 2057 | *) ;; | ||
| 2058 | esac | ||
| 2059 | fi | ||
| 2060 | nigel | 53 | fi |
| 2061 | ;; # -l | ||
| 2062 | -L*) | ||
| 2063 | case $linkmode in | ||
| 2064 | lib) | ||
| 2065 | deplibs="$deplib $deplibs" | ||
| 2066 | nigel | 75 | test "$pass" = conv && continue |
| 2067 | nigel | 53 | newdependency_libs="$deplib $newdependency_libs" |
| 2068 | newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` | ||
| 2069 | ;; | ||
| 2070 | prog) | ||
| 2071 | nigel | 75 | if test "$pass" = conv; then |
| 2072 | nigel | 53 | deplibs="$deplib $deplibs" |
| 2073 | continue | ||
| 2074 | fi | ||
| 2075 | nigel | 75 | if test "$pass" = scan; then |
| 2076 | nigel | 53 | deplibs="$deplib $deplibs" |
| 2077 | else | ||
| 2078 | compile_deplibs="$deplib $compile_deplibs" | ||
| 2079 | finalize_deplibs="$deplib $finalize_deplibs" | ||
| 2080 | fi | ||
| 2081 | nigel | 75 | newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` |
| 2082 | nigel | 53 | ;; |
| 2083 | *) | ||
| 2084 | nigel | 75 | $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 |
| 2085 | nigel | 53 | ;; |
| 2086 | esac # linkmode | ||
| 2087 | continue | ||
| 2088 | ;; # -L | ||
| 2089 | -R*) | ||
| 2090 | nigel | 75 | if test "$pass" = link; then |
| 2091 | nigel | 53 | dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` |
| 2092 | # Make sure the xrpath contains only unique directories. | ||
| 2093 | case "$xrpath " in | ||
| 2094 | *" $dir "*) ;; | ||
| 2095 | *) xrpath="$xrpath $dir" ;; | ||
| 2096 | esac | ||
| 2097 | fi | ||
| 2098 | deplibs="$deplib $deplibs" | ||
| 2099 | continue | ||
| 2100 | ;; | ||
| 2101 | *.la) lib="$deplib" ;; | ||
| 2102 | *.$libext) | ||
| 2103 | nigel | 75 | if test "$pass" = conv; then |
| 2104 | nigel | 53 | deplibs="$deplib $deplibs" |
| 2105 | continue | ||
| 2106 | fi | ||
| 2107 | case $linkmode in | ||
| 2108 | lib) | ||
| 2109 | nigel | 75 | valid_a_lib=no |
| 2110 | case $deplibs_check_method in | ||
| 2111 | match_pattern*) | ||
| 2112 | set dummy $deplibs_check_method | ||
| 2113 | match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` | ||
| 2114 | if eval $echo \"$deplib\" 2>/dev/null \ | ||
| 2115 | | $SED 10q \ | ||
| 2116 | | $EGREP "$match_pattern_regex" > /dev/null; then | ||
| 2117 | valid_a_lib=yes | ||
| 2118 | fi | ||
| 2119 | ;; | ||
| 2120 | pass_all) | ||
| 2121 | valid_a_lib=yes | ||
| 2122 | ;; | ||
| 2123 | esac | ||
| 2124 | if test "$valid_a_lib" != yes; then | ||
| 2125 | $echo | ||
| 2126 | $echo "*** Warning: Trying to link with static lib archive $deplib." | ||
| 2127 | $echo "*** I have the capability to make that library automatically link in when" | ||
| 2128 | $echo "*** you link to this library. But I can only do this if you have a" | ||
| 2129 | $echo "*** shared version of the library, which you do not appear to have" | ||
| 2130 | $echo "*** because the file extensions .$libext of this argument makes me believe" | ||
| 2131 | $echo "*** that it is just a static archive that I should not used here." | ||
| 2132 | nigel | 53 | else |
| 2133 | nigel | 75 | $echo |
| 2134 | $echo "*** Warning: Linking the shared library $output against the" | ||
| 2135 | $echo "*** static library $deplib is not portable!" | ||
| 2136 | nigel | 53 | deplibs="$deplib $deplibs" |
| 2137 | fi | ||
| 2138 | continue | ||
| 2139 | ;; | ||
| 2140 | prog) | ||
| 2141 | nigel | 75 | if test "$pass" != link; then |
| 2142 | nigel | 53 | deplibs="$deplib $deplibs" |
| 2143 | else | ||
| 2144 | compile_deplibs="$deplib $compile_deplibs" | ||
| 2145 | finalize_deplibs="$deplib $finalize_deplibs" | ||
| 2146 | fi | ||
| 2147 | continue | ||
| 2148 | ;; | ||
| 2149 | esac # linkmode | ||
| 2150 | ;; # *.$libext | ||
| 2151 | *.lo | *.$objext) | ||
| 2152 | nigel | 75 | if test "$pass" = conv; then |
| 2153 | deplibs="$deplib $deplibs" | ||
| 2154 | elif test "$linkmode" = prog; then | ||
| 2155 | if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then | ||
| 2156 | # If there is no dlopen support or we're linking statically, | ||
| 2157 | # we need to preload. | ||
| 2158 | newdlprefiles="$newdlprefiles $deplib" | ||
| 2159 | compile_deplibs="$deplib $compile_deplibs" | ||
| 2160 | finalize_deplibs="$deplib $finalize_deplibs" | ||
| 2161 | else | ||
| 2162 | newdlfiles="$newdlfiles $deplib" | ||
| 2163 | fi | ||
| 2164 | nigel | 53 | fi |
| 2165 | continue | ||
| 2166 | ;; | ||
| 2167 | %DEPLIBS%) | ||
| 2168 | alldeplibs=yes | ||
| 2169 | continue | ||
| 2170 | ;; | ||
| 2171 | esac # case $deplib | ||
| 2172 | nigel | 75 | if test "$found" = yes || test -f "$lib"; then : |
| 2173 | nigel | 53 | else |
| 2174 | $echo "$modename: cannot find the library \`$lib'" 1>&2 | ||
| 2175 | nigel | 75 | exit $EXIT_FAILURE |
| 2176 | nigel | 53 | fi |
| 2177 | |||
| 2178 | nigel | 41 | # Check to see that this really is a libtool archive. |
| 2179 | nigel | 75 | if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : |
| 2180 | nigel | 41 | else |
| 2181 | nigel | 53 | $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 |
| 2182 | nigel | 75 | exit $EXIT_FAILURE |
| 2183 | nigel | 41 | fi |
| 2184 | |||
| 2185 | nigel | 53 | ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` |
| 2186 | test "X$ladir" = "X$lib" && ladir="." | ||
| 2187 | |||
| 2188 | dlname= | ||
| 2189 | dlopen= | ||
| 2190 | dlpreopen= | ||
| 2191 | libdir= | ||
| 2192 | library_names= | ||
| 2193 | old_library= | ||
| 2194 | nigel | 41 | # If the library was installed with an old release of libtool, |
| 2195 | nigel | 75 | # it will not redefine variables installed, or shouldnotlink |
| 2196 | nigel | 41 | installed=yes |
| 2197 | nigel | 75 | shouldnotlink=no |
| 2198 | nigel | 41 | |
| 2199 | # Read the .la file | ||
| 2200 | nigel | 53 | case $lib in |
| 2201 | */* | *\\*) . $lib ;; | ||
| 2202 | *) . ./$lib ;; | ||
| 2203 | nigel | 41 | esac |
| 2204 | |||
| 2205 | nigel | 53 | if test "$linkmode,$pass" = "lib,link" || |
| 2206 | test "$linkmode,$pass" = "prog,scan" || | ||
| 2207 | nigel | 75 | { test "$linkmode" != prog && test "$linkmode" != lib; }; then |
| 2208 | nigel | 53 | test -n "$dlopen" && dlfiles="$dlfiles $dlopen" |
| 2209 | test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" | ||
| 2210 | fi | ||
| 2211 | |||
| 2212 | nigel | 75 | if test "$pass" = conv; then |
| 2213 | nigel | 53 | # Only check for convenience libraries |
| 2214 | deplibs="$lib $deplibs" | ||
| 2215 | if test -z "$libdir"; then | ||
| 2216 | if test -z "$old_library"; then | ||
| 2217 | $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 | ||
| 2218 | nigel | 75 | exit $EXIT_FAILURE |
| 2219 | nigel | 53 | fi |
| 2220 | # It is a libtool convenience library, so add in its objects. | ||
| 2221 | convenience="$convenience $ladir/$objdir/$old_library" | ||
| 2222 | old_convenience="$old_convenience $ladir/$objdir/$old_library" | ||
| 2223 | tmp_libs= | ||
| 2224 | for deplib in $dependency_libs; do | ||
| 2225 | deplibs="$deplib $deplibs" | ||
| 2226 | nigel | 63 | if test "X$duplicate_deps" = "Xyes" ; then |
| 2227 | case "$tmp_libs " in | ||
| 2228 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; | ||
| 2229 | esac | ||
| 2230 | fi | ||
| 2231 | nigel | 53 | tmp_libs="$tmp_libs $deplib" |
| 2232 | done | ||
| 2233 | nigel | 75 | elif test "$linkmode" != prog && test "$linkmode" != lib; then |
| 2234 | nigel | 53 | $echo "$modename: \`$lib' is not a convenience library" 1>&2 |
| 2235 | nigel | 75 | exit $EXIT_FAILURE |
| 2236 | nigel | 53 | fi |
| 2237 | continue | ||
| 2238 | fi # $pass = conv | ||
| 2239 | |||
| 2240 | nigel | 75 | |
| 2241 | nigel | 41 | # Get the name of the library we link against. |
| 2242 | linklib= | ||
| 2243 | for l in $old_library $library_names; do | ||
| 2244 | linklib="$l" | ||
| 2245 | done | ||
| 2246 | if test -z "$linklib"; then | ||
| 2247 | nigel | 53 | $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 |
| 2248 | nigel | 75 | exit $EXIT_FAILURE |
| 2249 | nigel | 41 | fi |
| 2250 | |||
| 2251 | nigel | 53 | # This library was specified with -dlopen. |
| 2252 | nigel | 75 | if test "$pass" = dlopen; then |
| 2253 | nigel | 53 | if test -z "$libdir"; then |
| 2254 | $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 | ||
| 2255 | nigel | 75 | exit $EXIT_FAILURE |
| 2256 | nigel | 53 | fi |
| 2257 | nigel | 75 | if test -z "$dlname" || |
| 2258 | test "$dlopen_support" != yes || | ||
| 2259 | test "$build_libtool_libs" = no; then | ||
| 2260 | nigel | 53 | # If there is no dlname, no dlopen support or we're linking |
| 2261 | nigel | 75 | # statically, we need to preload. We also need to preload any |
| 2262 | # dependent libraries so libltdl's deplib preloader doesn't | ||
| 2263 | # bomb out in the load deplibs phase. | ||
| 2264 | dlprefiles="$dlprefiles $lib $dependency_libs" | ||
| 2265 | nigel | 41 | else |
| 2266 | nigel | 53 | newdlfiles="$newdlfiles $lib" |
| 2267 | nigel | 41 | fi |
| 2268 | nigel | 53 | continue |
| 2269 | fi # $pass = dlopen | ||
| 2270 | nigel | 41 | |
| 2271 | nigel | 53 | # We need an absolute path. |
| 2272 | case $ladir in | ||
| 2273 | [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; | ||
| 2274 | *) | ||
| 2275 | abs_ladir=`cd "$ladir" && pwd` | ||
| 2276 | if test -z "$abs_ladir"; then | ||
| 2277 | $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 | ||
| 2278 | $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 | ||
| 2279 | abs_ladir="$ladir" | ||
| 2280 | fi | ||
| 2281 | ;; | ||
| 2282 | esac | ||
| 2283 | laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` | ||
| 2284 | nigel | 41 | |
| 2285 | nigel | 53 | # Find the relevant object directory and library name. |
| 2286 | if test "X$installed" = Xyes; then | ||
| 2287 | if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then | ||
| 2288 | $echo "$modename: warning: library \`$lib' was moved." 1>&2 | ||
| 2289 | dir="$ladir" | ||
| 2290 | absdir="$abs_ladir" | ||
| 2291 | libdir="$abs_ladir" | ||
| 2292 | nigel | 41 | else |
| 2293 | nigel | 53 | dir="$libdir" |
| 2294 | absdir="$libdir" | ||
| 2295 | nigel | 41 | fi |
| 2296 | nigel | 53 | else |
| 2297 | nigel | 75 | if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then |
| 2298 | dir="$ladir" | ||
| 2299 | absdir="$abs_ladir" | ||
| 2300 | # Remove this search path later | ||
| 2301 | notinst_path="$notinst_path $abs_ladir" | ||
| 2302 | else | ||
| 2303 | dir="$ladir/$objdir" | ||
| 2304 | absdir="$abs_ladir/$objdir" | ||
| 2305 | # Remove this search path later | ||
| 2306 | notinst_path="$notinst_path $abs_ladir" | ||
| 2307 | fi | ||
| 2308 | nigel | 53 | fi # $installed = yes |
| 2309 | name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` | ||
| 2310 | nigel | 41 | |
| 2311 | nigel | 53 | # This library was specified with -dlpreopen. |
| 2312 | nigel | 75 | if test "$pass" = dlpreopen; then |
| 2313 | nigel | 53 | if test -z "$libdir"; then |
| 2314 | $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 | ||
| 2315 | nigel | 75 | exit $EXIT_FAILURE |
| 2316 | nigel | 53 | fi |
| 2317 | nigel | 41 | # Prefer using a static library (so that no silly _DYNAMIC symbols |
| 2318 | # are required to link). | ||
| 2319 | if test -n "$old_library"; then | ||
| 2320 | nigel | 53 | newdlprefiles="$newdlprefiles $dir/$old_library" |
| 2321 | # Otherwise, use the dlname, so that lt_dlopen finds it. | ||
| 2322 | elif test -n "$dlname"; then | ||
| 2323 | newdlprefiles="$newdlprefiles $dir/$dlname" | ||
| 2324 | nigel | 41 | else |
| 2325 | nigel | 53 | newdlprefiles="$newdlprefiles $dir/$linklib" |
| 2326 | nigel | 41 | fi |
| 2327 | nigel | 53 | fi # $pass = dlpreopen |
| 2328 | |||
| 2329 | if test -z "$libdir"; then | ||
| 2330 | # Link the convenience library | ||
| 2331 | nigel | 75 | if test "$linkmode" = lib; then |
| 2332 | nigel | 53 | deplibs="$dir/$old_library $deplibs" |
| 2333 | elif test "$linkmode,$pass" = "prog,link"; then | ||
| 2334 | compile_deplibs="$dir/$old_library $compile_deplibs" | ||
| 2335 | finalize_deplibs="$dir/$old_library $finalize_deplibs" | ||
| 2336 | else | ||
| 2337 | nigel | 75 | deplibs="$lib $deplibs" # used for prog,scan pass |
| 2338 | nigel | 53 | fi |
| 2339 | continue | ||
| 2340 | nigel | 41 | fi |
| 2341 | |||
| 2342 | nigel | 75 | |
| 2343 | if test "$linkmode" = prog && test "$pass" != link; then | ||
| 2344 | nigel | 53 | newlib_search_path="$newlib_search_path $ladir" |
| 2345 | deplibs="$lib $deplibs" | ||
| 2346 | |||
| 2347 | linkalldeplibs=no | ||
| 2348 | if test "$link_all_deplibs" != no || test -z "$library_names" || | ||
| 2349 | test "$build_libtool_libs" = no; then | ||
| 2350 | linkalldeplibs=yes | ||
| 2351 | fi | ||
| 2352 | |||
| 2353 | tmp_libs= | ||
| 2354 | for deplib in $dependency_libs; do | ||
| 2355 | case $deplib in | ||
| 2356 | -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test | ||
| 2357 | esac | ||
| 2358 | # Need to link against all dependency_libs? | ||
| 2359 | nigel | 75 | if test "$linkalldeplibs" = yes; then |
| 2360 | nigel | 53 | deplibs="$deplib $deplibs" |
| 2361 | else | ||
| 2362 | # Need to hardcode shared library paths | ||
| 2363 | # or/and link against static libraries | ||
| 2364 | newdependency_libs="$deplib $newdependency_libs" | ||
| 2365 | fi | ||
| 2366 | nigel | 63 | if test "X$duplicate_deps" = "Xyes" ; then |
| 2367 | case "$tmp_libs " in | ||
| 2368 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; | ||
| 2369 | esac | ||
| 2370 | fi | ||
| 2371 | nigel | 53 | tmp_libs="$tmp_libs $deplib" |
| 2372 | done # for deplib | ||
| 2373 | continue | ||
| 2374 | fi # $linkmode = prog... | ||
| 2375 | |||
| 2376 | nigel | 75 | if test "$linkmode,$pass" = "prog,link"; then |
| 2377 | if test -n "$library_names" && | ||
| 2378 | { test "$prefer_static_libs" = no || test -z "$old_library"; }; then | ||
| 2379 | # We need to hardcode the library path | ||
| 2380 | if test -n "$shlibpath_var"; then | ||
| 2381 | # Make sure the rpath contains only unique directories. | ||
| 2382 | case "$temp_rpath " in | ||
| 2383 | *" $dir "*) ;; | ||
| 2384 | *" $absdir "*) ;; | ||
| 2385 | *) temp_rpath="$temp_rpath $dir" ;; | ||
| 2386 | esac | ||
| 2387 | fi | ||
| 2388 | nigel | 41 | |
| 2389 | nigel | 53 | # Hardcode the library path. |
| 2390 | # Skip directories that are in the system default run-time | ||
| 2391 | # search path. | ||
| 2392 | case " $sys_lib_dlsearch_path " in | ||
| 2393 | nigel | 41 | *" $absdir "*) ;; |
| 2394 | nigel | 53 | *) |
| 2395 | case "$compile_rpath " in | ||
| 2396 | *" $absdir "*) ;; | ||
| 2397 | *) compile_rpath="$compile_rpath $absdir" | ||
| 2398 | esac | ||
| 2399 | ;; | ||
| 2400 | nigel | 41 | esac |
| 2401 | nigel | 53 | case " $sys_lib_dlsearch_path " in |
| 2402 | nigel | 41 | *" $libdir "*) ;; |
| 2403 | nigel | 53 | *) |
| 2404 | case "$finalize_rpath " in | ||
| 2405 | *" $libdir "*) ;; | ||
| 2406 | *) finalize_rpath="$finalize_rpath $libdir" | ||
| 2407 | esac | ||
| 2408 | ;; | ||
| 2409 | nigel | 41 | esac |
| 2410 | nigel | 53 | fi # $linkmode,$pass = prog,link... |
| 2411 | nigel | 41 | |
| 2412 | nigel | 53 | if test "$alldeplibs" = yes && |
| 2413 | { test "$deplibs_check_method" = pass_all || | ||
| 2414 | { test "$build_libtool_libs" = yes && | ||
| 2415 | test -n "$library_names"; }; }; then | ||
| 2416 | # We only need to search for static libraries | ||
| 2417 | continue | ||
| 2418 | fi | ||
| 2419 | nigel | 75 | fi |
| 2420 | nigel | 53 | |
| 2421 | nigel | 75 | link_static=no # Whether the deplib will be linked statically |
| 2422 | if test -n "$library_names" && | ||
| 2423 | { test "$prefer_static_libs" = no || test -z "$old_library"; }; then | ||
| 2424 | nigel | 53 | if test "$installed" = no; then |
| 2425 | notinst_deplibs="$notinst_deplibs $lib" | ||
| 2426 | need_relink=yes | ||
| 2427 | fi | ||
| 2428 | nigel | 75 | # This is a shared library |
| 2429 | nigel | 53 | |
| 2430 | nigel | 75 | # Warn about portability, can't link against -module's on |
| 2431 | # some systems (darwin) | ||
| 2432 | if test "$shouldnotlink" = yes && test "$pass" = link ; then | ||
| 2433 | $echo | ||
| 2434 | if test "$linkmode" = prog; then | ||
| 2435 | $echo "*** Warning: Linking the executable $output against the loadable module" | ||
| 2436 | else | ||
| 2437 | $echo "*** Warning: Linking the shared library $output against the loadable module" | ||
| 2438 | fi | ||
| 2439 | $echo "*** $linklib is not portable!" | ||
| 2440 | fi | ||
| 2441 | if test "$linkmode" = lib && | ||
| 2442 | test "$hardcode_into_libs" = yes; then | ||
| 2443 | # Hardcode the library path. | ||
| 2444 | # Skip directories that are in the system default run-time | ||
| 2445 | # search path. | ||
| 2446 | case " $sys_lib_dlsearch_path " in | ||
| 2447 | *" $absdir "*) ;; | ||
| 2448 | *) | ||
| 2449 | case "$compile_rpath " in | ||
| 2450 | *" $absdir "*) ;; | ||
| 2451 | *) compile_rpath="$compile_rpath $absdir" | ||
| 2452 | esac | ||
| 2453 | ;; | ||
| 2454 | esac | ||
| 2455 | case " $sys_lib_dlsearch_path " in | ||
| 2456 | *" $libdir "*) ;; | ||
| 2457 | *) | ||
| 2458 | case "$finalize_rpath " in | ||
| 2459 | *" $libdir "*) ;; | ||
| 2460 | *) finalize_rpath="$finalize_rpath $libdir" | ||
| 2461 | esac | ||
| 2462 | ;; | ||
| 2463 | esac | ||
| 2464 | fi | ||
| 2465 | |||
| 2466 | nigel | 53 | if test -n "$old_archive_from_expsyms_cmds"; then |
| 2467 | # figure out the soname | ||
| 2468 | set dummy $library_names | ||
| 2469 | realname="$2" | ||
| 2470 | shift; shift | ||
| 2471 | libname=`eval \\$echo \"$libname_spec\"` | ||
| 2472 | # use dlname if we got it. it's perfectly good, no? | ||
| 2473 | if test -n "$dlname"; then | ||
| 2474 | soname="$dlname" | ||
| 2475 | elif test -n "$soname_spec"; then | ||
| 2476 | # bleh windows | ||
| 2477 | case $host in | ||
| 2478 | nigel | 75 | *cygwin* | mingw*) |
| 2479 | nigel | 53 | major=`expr $current - $age` |
| 2480 | versuffix="-$major" | ||
| 2481 | nigel | 41 | ;; |
| 2482 | esac | ||
| 2483 | nigel | 53 | eval soname=\"$soname_spec\" |
| 2484 | else | ||
| 2485 | soname="$realname" | ||
| 2486 | fi | ||
| 2487 | |||
| 2488 | # Make a new name for the extract_expsyms_cmds to use | ||
| 2489 | soroot="$soname" | ||
| 2490 | nigel | 75 | soname=`$echo $soroot | ${SED} -e 's/^.*\///'` |
| 2491 | newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" | ||
| 2492 | nigel | 53 | |
| 2493 | # If the library has no export list, then create one now | ||
| 2494 | if test -f "$output_objdir/$soname-def"; then : | ||
| 2495 | else | ||
| 2496 | $show "extracting exported symbol list from \`$soname'" | ||
| 2497 | nigel | 63 | save_ifs="$IFS"; IFS='~' |
| 2498 | nigel | 75 | cmds=$extract_expsyms_cmds |
| 2499 | nigel | 53 | for cmd in $cmds; do |
| 2500 | IFS="$save_ifs" | ||
| 2501 | nigel | 75 | eval cmd=\"$cmd\" |
| 2502 | nigel | 53 | $show "$cmd" |
| 2503 | $run eval "$cmd" || exit $? | ||
| 2504 | done | ||
| 2505 | IFS="$save_ifs" | ||
| 2506 | fi | ||
| 2507 | |||
| 2508 | # Create $newlib | ||
| 2509 | if test -f "$output_objdir/$newlib"; then :; else | ||
| 2510 | $show "generating import library for \`$soname'" | ||
| 2511 | nigel | 63 | save_ifs="$IFS"; IFS='~' |
| 2512 | nigel | 75 | cmds=$old_archive_from_expsyms_cmds |
| 2513 | nigel | 53 | for cmd in $cmds; do |
| 2514 | IFS="$save_ifs" | ||
| 2515 | nigel | 75 | eval cmd=\"$cmd\" |
| 2516 | nigel | 53 | $show "$cmd" |
| 2517 | $run eval "$cmd" || exit $? | ||
| 2518 | done | ||
| 2519 | IFS="$save_ifs" | ||
| 2520 | fi | ||
| 2521 | # make sure the library variables are pointing to the new library | ||
| 2522 | dir=$output_objdir | ||
| 2523 | linklib=$newlib | ||
| 2524 | nigel | 75 | fi # test -n "$old_archive_from_expsyms_cmds" |
| 2525 | nigel | 53 | |
| 2526 | nigel | 75 | if test "$linkmode" = prog || test "$mode" != relink; then |
| 2527 | nigel | 53 | add_shlibpath= |
| 2528 | add_dir= | ||
| 2529 | add= | ||
| 2530 | lib_linked=yes | ||
| 2531 | case $hardcode_action in | ||
| 2532 | immediate | unsupported) | ||
| 2533 | if test "$hardcode_direct" = no; then | ||
| 2534 | add="$dir/$linklib" | ||
| 2535 | nigel | 75 | case $host in |
| 2536 | *-*-sco3.2v5* ) add_dir="-L$dir" ;; | ||
| 2537 | *-*-darwin* ) | ||
| 2538 | # if the lib is a module then we can not link against | ||
| 2539 | # it, someone is ignoring the new warnings I added | ||
| 2540 | if /usr/bin/file -L $add 2> /dev/null | $EGREP "bundle" >/dev/null ; then | ||
| 2541 | $echo "** Warning, lib $linklib is a module, not a shared library" | ||
| 2542 | if test -z "$old_library" ; then | ||
| 2543 | $echo | ||
| 2544 | $echo "** And there doesn't seem to be a static archive available" | ||
| 2545 | $echo "** The link will probably fail, sorry" | ||
| 2546 | else | ||
| 2547 | add="$dir/$old_library" | ||
| 2548 | fi | ||
| 2549 | fi | ||
| 2550 | esac | ||
| 2551 | nigel | 53 | elif test "$hardcode_minus_L" = no; then |
| 2552 | case $host in | ||
| 2553 | *-*-sunos*) add_shlibpath="$dir" ;; | ||
| 2554 | esac | ||
| 2555 | add_dir="-L$dir" | ||
| 2556 | add="-l$name" | ||
| 2557 | elif test "$hardcode_shlibpath_var" = no; then | ||
| 2558 | add_shlibpath="$dir" | ||
| 2559 | add="-l$name" | ||
| 2560 | else | ||
| 2561 | lib_linked=no | ||
| 2562 | fi | ||
| 2563 | ;; | ||
| 2564 | relink) | ||
| 2565 | if test "$hardcode_direct" = yes; then | ||
| 2566 | add="$dir/$linklib" | ||
| 2567 | elif test "$hardcode_minus_L" = yes; then | ||
| 2568 | add_dir="-L$dir" | ||
| 2569 | nigel | 75 | # Try looking first in the location we're being installed to. |
| 2570 | if test -n "$inst_prefix_dir"; then | ||
| 2571 | case "$libdir" in | ||
| 2572 | [\\/]*) | ||
| 2573 | add_dir="$add_dir -L$inst_prefix_dir$libdir" | ||
| 2574 | ;; | ||
| 2575 | esac | ||
| 2576 | fi | ||
| 2577 | nigel | 53 | add="-l$name" |
| 2578 | elif test "$hardcode_shlibpath_var" = yes; then | ||
| 2579 | add_shlibpath="$dir" | ||
| 2580 | add="-l$name" | ||
| 2581 | else | ||
| 2582 | lib_linked=no | ||
| 2583 | fi | ||
| 2584 | ;; | ||
| 2585 | *) lib_linked=no ;; | ||
| 2586 | esac | ||
| 2587 | |||
| 2588 | if test "$lib_linked" != yes; then | ||
| 2589 | $echo "$modename: configuration error: unsupported hardcode properties" | ||
| 2590 | nigel | 75 | exit $EXIT_FAILURE |
| 2591 | nigel | 53 | fi |
| 2592 | |||
| 2593 | if test -n "$add_shlibpath"; then | ||
| 2594 | case :$compile_shlibpath: in | ||
| 2595 | *":$add_shlibpath:"*) ;; | ||
| 2596 | *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; | ||
| 2597 | nigel | 41 | esac |
| 2598 | nigel | 53 | fi |
| 2599 | nigel | 75 | if test "$linkmode" = prog; then |
| 2600 | nigel | 53 | test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" |
| 2601 | test -n "$add" && compile_deplibs="$add $compile_deplibs" | ||
| 2602 | nigel | 41 | else |
| 2603 | nigel | 53 | test -n "$add_dir" && deplibs="$add_dir $deplibs" |
| 2604 | test -n "$add" && deplibs="$add $deplibs" | ||
| 2605 | if test "$hardcode_direct" != yes && \ | ||
| 2606 | test "$hardcode_minus_L" != yes && \ | ||
| 2607 | test "$hardcode_shlibpath_var" = yes; then | ||
| 2608 | case :$finalize_shlibpath: in | ||
| 2609 | *":$libdir:"*) ;; | ||
| 2610 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; | ||
| 2611 | esac | ||
| 2612 | fi | ||
| 2613 | nigel | 41 | fi |
| 2614 | nigel | 53 | fi |
| 2615 | nigel | 41 | |
| 2616 | nigel | 75 | if test "$linkmode" = prog || test "$mode" = relink; then |
| 2617 | nigel | 53 | add_shlibpath= |
| 2618 | add_dir= | ||
| 2619 | add= | ||
| 2620 | # Finalize command for both is simple: just hardcode it. | ||
| 2621 | nigel | 41 | if test "$hardcode_direct" = yes; then |
| 2622 | nigel | 53 | add="$libdir/$linklib" |
| 2623 | nigel | 41 | elif test "$hardcode_minus_L" = yes; then |
| 2624 | nigel | 53 | add_dir="-L$libdir" |
| 2625 | add="-l$name" | ||
| 2626 | nigel | 41 | elif test "$hardcode_shlibpath_var" = yes; then |
| 2627 | nigel | 53 | case :$finalize_shlibpath: in |
| 2628 | *":$libdir:"*) ;; | ||
| 2629 | *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; | ||
| 2630 | nigel | 41 | esac |
| 2631 | nigel | 53 | add="-l$name" |
| 2632 | nigel | 75 | elif test "$hardcode_automatic" = yes; then |
| 2633 | if test -n "$inst_prefix_dir" && | ||
| 2634 | test -f "$inst_prefix_dir$libdir/$linklib" ; then | ||
| 2635 | add="$inst_prefix_dir$libdir/$linklib" | ||
| 2636 | else | ||
| 2637 | add="$libdir/$linklib" | ||
| 2638 | fi | ||
| 2639 | nigel | 41 | else |
| 2640 | nigel | 53 | # We cannot seem to hardcode it, guess we'll fake it. |
| 2641 | add_dir="-L$libdir" | ||
| 2642 | nigel | 75 | # Try looking first in the location we're being installed to. |
| 2643 | if test -n "$inst_prefix_dir"; then | ||
| 2644 | case "$libdir" in | ||
| 2645 | [\\/]*) | ||
| 2646 | add_dir="$add_dir -L$inst_prefix_dir$libdir" | ||
| 2647 | ;; | ||
| 2648 | esac | ||
| 2649 | fi | ||
| 2650 | nigel | 53 | add="-l$name" |
| 2651 | nigel | 41 | fi |
| 2652 | |||
| 2653 | nigel | 75 | if test "$linkmode" = prog; then |
| 2654 | nigel | 53 | test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" |
| 2655 | test -n "$add" && finalize_deplibs="$add $finalize_deplibs" | ||
| 2656 | else | ||
| 2657 | test -n "$add_dir" && deplibs="$add_dir $deplibs" | ||
| 2658 | test -n "$add" && deplibs="$add $deplibs" | ||
| 2659 | fi | ||
| 2660 | nigel | 41 | fi |
| 2661 | nigel | 75 | elif test "$linkmode" = prog; then |
| 2662 | nigel | 41 | # Here we assume that one of hardcode_direct or hardcode_minus_L |
| 2663 | # is not unsupported. This is valid on all known static and | ||
| 2664 | # shared platforms. | ||
| 2665 | if test "$hardcode_direct" != unsupported; then | ||
| 2666 | test -n "$old_library" && linklib="$old_library" | ||
| 2667 | nigel | 53 | compile_deplibs="$dir/$linklib $compile_deplibs" |
| 2668 | finalize_deplibs="$dir/$linklib $finalize_deplibs" | ||
| 2669 | nigel | 41 | else |
| 2670 | nigel | 53 | compile_deplibs="-l$name -L$dir $compile_deplibs" |
| 2671 | finalize_deplibs="-l$name -L$dir $finalize_deplibs" | ||
| 2672 | nigel | 41 | fi |
| 2673 | nigel | 53 | elif test "$build_libtool_libs" = yes; then |
| 2674 | # Not a shared library | ||
| 2675 | if test "$deplibs_check_method" != pass_all; then | ||
| 2676 | # We're trying link a shared library against a static one | ||
| 2677 | # but the system doesn't support it. | ||
| 2678 | nigel | 41 | |
| 2679 | nigel | 53 | # Just print a warning and add the library to dependency_libs so |
| 2680 | # that the program can be linked against the static library. | ||
| 2681 | nigel | 75 | $echo |
| 2682 | $echo "*** Warning: This system can not link to static lib archive $lib." | ||
| 2683 | $echo "*** I have the capability to make that library automatically link in when" | ||
| 2684 | $echo "*** you link to this library. But I can only do this if you have a" | ||
| 2685 | $echo "*** shared version of the library, which you do not appear to have." | ||
| 2686 | nigel | 53 | if test "$module" = yes; then |
| 2687 | nigel | 75 | $echo "*** But as you try to build a module library, libtool will still create " |
| 2688 | $echo "*** a static module, that should work as long as the dlopening application" | ||
| 2689 | $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." | ||
| 2690 | nigel | 53 | if test -z "$global_symbol_pipe"; then |
| 2691 | nigel | 75 | $echo |
| 2692 | $echo "*** However, this would only work if libtool was able to extract symbol" | ||
| 2693 | $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" | ||
| 2694 | $echo "*** not find such a program. So, this module is probably useless." | ||
| 2695 | $echo "*** \`nm' from GNU binutils and a full rebuild may help." | ||
| 2696 | nigel | 53 | fi |
| 2697 | if test "$build_old_libs" = no; then | ||
| 2698 | nigel | 63 | build_libtool_libs=module |
| 2699 | build_old_libs=yes | ||
| 2700 | nigel | 53 | else |
| 2701 | nigel | 63 | build_libtool_libs=no |
| 2702 | nigel | 53 | fi |
| 2703 | fi | ||
| 2704 | else | ||
| 2705 | convenience="$convenience $dir/$old_library" | ||
| 2706 | old_convenience="$old_convenience $dir/$old_library" | ||
| 2707 | deplibs="$dir/$old_library $deplibs" | ||
| 2708 | link_static=yes | ||
| 2709 | fi | ||
| 2710 | fi # link shared/static library? | ||
| 2711 | nigel | 41 | |
| 2712 | nigel | 75 | if test "$linkmode" = lib; then |
| 2713 | nigel | 53 | if test -n "$dependency_libs" && |
| 2714 | nigel | 75 | { test "$hardcode_into_libs" != yes || |
| 2715 | test "$build_old_libs" = yes || | ||
| 2716 | test "$link_static" = yes; }; then | ||
| 2717 | nigel | 53 | # Extract -R from dependency_libs |
| 2718 | temp_deplibs= | ||
| 2719 | for libdir in $dependency_libs; do | ||
| 2720 | case $libdir in | ||
| 2721 | -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` | ||
| 2722 | case " $xrpath " in | ||
| 2723 | *" $temp_xrpath "*) ;; | ||
| 2724 | *) xrpath="$xrpath $temp_xrpath";; | ||
| 2725 | esac;; | ||
| 2726 | *) temp_deplibs="$temp_deplibs $libdir";; | ||
| 2727 | esac | ||
| 2728 | done | ||
| 2729 | dependency_libs="$temp_deplibs" | ||
| 2730 | fi | ||
| 2731 | nigel | 41 | |
| 2732 | nigel | 53 | newlib_search_path="$newlib_search_path $absdir" |
| 2733 | # Link against this library | ||
| 2734 | test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" | ||
| 2735 | # ... and its dependency_libs | ||
| 2736 | tmp_libs= | ||
| 2737 | for deplib in $dependency_libs; do | ||
| 2738 | newdependency_libs="$deplib $newdependency_libs" | ||
| 2739 | nigel | 63 | if test "X$duplicate_deps" = "Xyes" ; then |
| 2740 | case "$tmp_libs " in | ||
| 2741 | *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; | ||
| 2742 | esac | ||
| 2743 | fi | ||
| 2744 | nigel | 53 | tmp_libs="$tmp_libs $deplib" |
| 2745 | done | ||
| 2746 | nigel | 41 | |
| 2747 | nigel | 75 | if test "$link_all_deplibs" != no; then |
| 2748 | nigel | 53 | # Add the search paths of all dependency libraries |
| 2749 | for deplib in $dependency_libs; do | ||
| 2750 | case $deplib in | ||
| 2751 | -L*) path="$deplib" ;; | ||
| 2752 | *.la) | ||
| 2753 | dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` | ||
| 2754 | test "X$dir" = "X$deplib" && dir="." | ||
| 2755 | # We need an absolute path. | ||
| 2756 | case $dir in | ||
| 2757 | [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; | ||
| 2758 | *) | ||
| 2759 | absdir=`cd "$dir" && pwd` | ||
| 2760 | if test -z "$absdir"; then | ||
| 2761 | $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 | ||
| 2762 | absdir="$dir" | ||
| 2763 | fi | ||
| 2764 | ;; | ||
| 2765 | esac | ||
| 2766 | if grep "^installed=no" $deplib > /dev/null; then | ||
| 2767 | nigel | 75 | path="$absdir/$objdir" |
| 2768 | nigel | 53 | else |
| 2769 | nigel | 63 | eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` |
| 2770 | nigel | 53 | if test -z "$libdir"; then |
| 2771 | $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 | ||
| 2772 | nigel | 75 | exit $EXIT_FAILURE |
| 2773 | nigel | 53 | fi |
| 2774 | if test "$absdir" != "$libdir"; then | ||
| 2775 | $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 | ||
| 2776 | fi | ||
| 2777 | nigel | 75 | path="$absdir" |
| 2778 | nigel | 53 | fi |
| 2779 | nigel | 75 | depdepl= |
| 2780 | case $host in | ||
| 2781 | *-*-darwin*) | ||
| 2782 | # we do not want to link against static libs, | ||
| 2783 | # but need to link against shared | ||
| 2784 | eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` | ||
| 2785 | if test -n "$deplibrary_names" ; then | ||
| 2786 | for tmp in $deplibrary_names ; do | ||
| 2787 | depdepl=$tmp | ||
| 2788 | done | ||
| 2789 | if test -f "$path/$depdepl" ; then | ||
| 2790 | depdepl="$path/$depdepl" | ||
| 2791 | fi | ||
| 2792 | # do not add paths which are already there | ||
| 2793 | case " $newlib_search_path " in | ||
| 2794 | *" $path "*) ;; | ||
| 2795 | *) newlib_search_path="$newlib_search_path $path";; | ||
| 2796 | esac | ||
| 2797 | fi | ||
| 2798 | path="" | ||
| 2799 | ;; | ||
| 2800 | *) | ||
| 2801 | path="-L$path" | ||
| 2802 | ;; | ||
| 2803 | esac | ||
| 2804 | nigel | 53 | ;; |
| 2805 | nigel | 75 | -l*) |
| 2806 | case $host in | ||
| 2807 | *-*-darwin*) | ||
| 2808 | # Again, we only want to link against shared libraries | ||
| 2809 | eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` | ||
| 2810 | for tmp in $newlib_search_path ; do | ||
| 2811 | if test -f "$tmp/lib$tmp_libs.dylib" ; then | ||
| 2812 | eval depdepl="$tmp/lib$tmp_libs.dylib" | ||
| 2813 | break | ||
| 2814 | fi | ||
| 2815 | done | ||
| 2816 | path="" | ||
| 2817 | ;; | ||
| 2818 | *) continue ;; | ||
| 2819 | esac | ||
| 2820 | ;; | ||
| 2821 | nigel | 53 | *) continue ;; |
| 2822 | esac | ||
| 2823 | case " $deplibs " in | ||
| 2824 | nigel | 75 | *" $depdepl "*) ;; |
| 2825 | *) deplibs="$depdepl $deplibs" ;; | ||
| 2826 | esac | ||
| 2827 | case " $deplibs " in | ||
| 2828 | nigel | 53 | *" $path "*) ;; |
| 2829 | *) deplibs="$deplibs $path" ;; | ||
| 2830 | esac | ||
| 2831 | done | ||
| 2832 | fi # link_all_deplibs != no | ||
| 2833 | fi # linkmode = lib | ||
| 2834 | done # for deplib in $libs | ||
| 2835 | nigel | 75 | dependency_libs="$newdependency_libs" |
| 2836 | if test "$pass" = dlpreopen; then | ||
| 2837 | nigel | 53 | # Link the dlpreopened libraries before other libraries |
| 2838 | for deplib in $save_deplibs; do | ||
| 2839 | deplibs="$deplib $deplibs" | ||
| 2840 | done | ||
| 2841 | nigel | 41 | fi |
| 2842 | nigel | 75 | if test "$pass" != dlopen; then |
| 2843 | if test "$pass" != conv; then | ||
| 2844 | nigel | 53 | # Make sure lib_search_path contains only unique directories. |
| 2845 | lib_search_path= | ||
| 2846 | for dir in $newlib_search_path; do | ||
| 2847 | case "$lib_search_path " in | ||
| 2848 | *" $dir "*) ;; | ||
| 2849 | *) lib_search_path="$lib_search_path $dir" ;; | ||
| 2850 | esac | ||
| 2851 | done | ||
| 2852 | newlib_search_path= | ||
| 2853 | fi | ||
| 2854 | nigel | 41 | |
| 2855 | nigel | 53 | if test "$linkmode,$pass" != "prog,link"; then |
| 2856 | vars="deplibs" | ||
| 2857 | else | ||
| 2858 | vars="compile_deplibs finalize_deplibs" | ||
| 2859 | fi | ||
| 2860 | for var in $vars dependency_libs; do | ||
| 2861 | # Add libraries to $var in reverse order | ||
| 2862 | eval tmp_libs=\"\$$var\" | ||
| 2863 | new_libs= | ||
| 2864 | for deplib in $tmp_libs; do | ||
| 2865 | nigel | 75 | # FIXME: Pedantically, this is the right thing to do, so |
| 2866 | # that some nasty dependency loop isn't accidentally | ||
| 2867 | # broken: | ||
| 2868 | #new_libs="$deplib $new_libs" | ||
| 2869 | # Pragmatically, this seems to cause very few problems in | ||
| 2870 | # practice: | ||
| 2871 | nigel | 53 | case $deplib in |
| 2872 | -L*) new_libs="$deplib $new_libs" ;; | ||
| 2873 | nigel | 75 | -R*) ;; |
| 2874 | nigel | 53 | *) |
| 2875 | nigel | 75 | # And here is the reason: when a library appears more |
| 2876 | # than once as an explicit dependence of a library, or | ||
| 2877 | # is implicitly linked in more than once by the | ||
| 2878 | # compiler, it is considered special, and multiple | ||
| 2879 | # occurrences thereof are not removed. Compare this | ||
| 2880 | # with having the same library being listed as a | ||
| 2881 | # dependency of multiple other libraries: in this case, | ||
| 2882 | # we know (pedantically, we assume) the library does not | ||
| 2883 | # need to be listed more than once, so we keep only the | ||
| 2884 | # last copy. This is not always right, but it is rare | ||
| 2885 | # enough that we require users that really mean to play | ||
| 2886 | # such unportable linking tricks to link the library | ||
| 2887 | # using -Wl,-lname, so that libtool does not consider it | ||
| 2888 | # for duplicate removal. | ||
| 2889 | nigel | 53 | case " $specialdeplibs " in |
| 2890 | *" $deplib "*) new_libs="$deplib $new_libs" ;; | ||
| 2891 | *) | ||
| 2892 | case " $new_libs " in | ||
| 2893 | *" $deplib "*) ;; | ||
| 2894 | *) new_libs="$deplib $new_libs" ;; | ||
| 2895 | esac | ||
| 2896 | ;; | ||
| 2897 | esac | ||
| 2898 | ;; | ||
| 2899 | esac | ||
| 2900 | done | ||
| 2901 | tmp_libs= | ||
| 2902 | for deplib in $new_libs; do | ||
| 2903 | case $deplib in | ||
| 2904 | -L*) | ||
| 2905 | case " $tmp_libs " in | ||
| 2906 | *" $deplib "*) ;; | ||
| 2907 | *) tmp_libs="$tmp_libs $deplib" ;; | ||
| 2908 | esac | ||
| 2909 | ;; | ||
| 2910 | *) tmp_libs="$tmp_libs $deplib" ;; | ||
| 2911 | esac | ||
| 2912 | done | ||
| 2913 | eval $var=\"$tmp_libs\" | ||
| 2914 | done # for var | ||
| 2915 | nigel | 41 | fi |
| 2916 | nigel | 75 | # Last step: remove runtime libs from dependency_libs |
| 2917 | # (they stay in deplibs) | ||
| 2918 | tmp_libs= | ||
| 2919 | for i in $dependency_libs ; do | ||
| 2920 | case " $predeps $postdeps $compiler_lib_search_path " in | ||
| 2921 | *" $i "*) | ||
| 2922 | i="" | ||
| 2923 | ;; | ||
| 2924 | esac | ||
| 2925 | if test -n "$i" ; then | ||
| 2926 | tmp_libs="$tmp_libs $i" | ||
| 2927 | fi | ||
| 2928 | done | ||
| 2929 | dependency_libs=$tmp_libs | ||
| 2930 | nigel | 53 | done # for pass |
| 2931 | nigel | 75 | if test "$linkmode" = prog; then |
| 2932 | nigel | 53 | dlfiles="$newdlfiles" |
| 2933 | dlprefiles="$newdlprefiles" | ||
| 2934 | fi | ||
| 2935 | nigel | 41 | |
| 2936 | nigel | 53 | case $linkmode in |
| 2937 | oldlib) | ||
| 2938 | nigel | 75 | if test -n "$deplibs"; then |
| 2939 | $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 | ||
| 2940 | fi | ||
| 2941 | |||
| 2942 | nigel | 41 | if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then |
| 2943 | $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 | ||
| 2944 | fi | ||
| 2945 | |||
| 2946 | if test -n "$rpath"; then | ||
| 2947 | $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 | ||
| 2948 | fi | ||
| 2949 | |||
| 2950 | if test -n "$xrpath"; then | ||
| 2951 | $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 | ||
| 2952 | fi | ||
| 2953 | |||
| 2954 | if test -n "$vinfo"; then | ||
| 2955 | nigel | 75 | $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 |
| 2956 | nigel | 41 | fi |
| 2957 | |||
| 2958 | if test -n "$release"; then | ||
| 2959 | $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 | ||
| 2960 | fi | ||
| 2961 | |||
| 2962 | if test -n "$export_symbols" || test -n "$export_symbols_regex"; then | ||
| 2963 | $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 | ||
| 2964 | fi | ||
| 2965 | |||
| 2966 | # Now set the variables for building old libraries. | ||
| 2967 | build_libtool_libs=no | ||
| 2968 | oldlibs="$output" | ||
| 2969 | nigel | 53 | objs="$objs$old_deplibs" |
| 2970 | nigel | 41 | ;; |
| 2971 | |||
| 2972 | nigel | 53 | lib) |
| 2973 | nigel | 41 | # Make sure we only generate libraries of the form `libNAME.la'. |
| 2974 | nigel | 53 | case $outputname in |
| 2975 | nigel | 41 | lib*) |
| 2976 | name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` | ||
| 2977 | nigel | 75 | eval shared_ext=\"$shrext_cmds\" |
| 2978 | nigel | 41 | eval libname=\"$libname_spec\" |
| 2979 | ;; | ||
| 2980 | *) | ||
| 2981 | if test "$module" = no; then | ||
| 2982 | $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 | ||
| 2983 | $echo "$help" 1>&2 | ||
| 2984 | nigel | 75 | exit $EXIT_FAILURE |
| 2985 | nigel | 41 | fi |
| 2986 | if test "$need_lib_prefix" != no; then | ||
| 2987 | # Add the "lib" prefix for modules if required | ||
| 2988 | name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` | ||
| 2989 | nigel | 75 | eval shared_ext=\"$shrext_cmds\" |
| 2990 | nigel | 41 | eval libname=\"$libname_spec\" |
| 2991 | else | ||
| 2992 | libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` | ||
| 2993 | fi | ||
| 2994 | ;; | ||
| 2995 | esac | ||
| 2996 | |||
| 2997 | if test -n "$objs"; then | ||
| 2998 | nigel | 53 | if test "$deplibs_check_method" != pass_all; then |
| 2999 | $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 | ||
| 3000 | nigel | 75 | exit $EXIT_FAILURE |
| 3001 | nigel | 53 | else |
| 3002 | nigel | 75 | $echo |
| 3003 | $echo "*** Warning: Linking the shared library $output against the non-libtool" | ||
| 3004 | $echo "*** objects $objs is not portable!" | ||
| 3005 | nigel | 53 | libobjs="$libobjs $objs" |
| 3006 | fi | ||
| 3007 | nigel | 41 | fi |
| 3008 | |||
| 3009 | nigel | 53 | if test "$dlself" != no; then |
| 3010 | $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 | ||
| 3011 | nigel | 41 | fi |
| 3012 | |||
| 3013 | set dummy $rpath | ||
| 3014 | nigel | 75 | if test "$#" -gt 2; then |
| 3015 | nigel | 41 | $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 |
| 3016 | fi | ||
| 3017 | install_libdir="$2" | ||
| 3018 | |||
| 3019 | oldlibs= | ||
| 3020 | if test -z "$rpath"; then | ||
| 3021 | if test "$build_libtool_libs" = yes; then | ||
| 3022 | # Building a libtool convenience library. | ||
| 3023 | nigel | 75 | # Some compilers have problems with a `.al' extension so |
| 3024 | # convenience libraries should have the same extension an | ||
| 3025 | # archive normally would. | ||
| 3026 | nigel | 41 | oldlibs="$output_objdir/$libname.$libext $oldlibs" |
| 3027 | build_libtool_libs=convenience | ||
| 3028 | build_old_libs=yes | ||
| 3029 | fi | ||
| 3030 | |||
| 3031 | if test -n "$vinfo"; then | ||
| 3032 | nigel | 75 | $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 |
| 3033 | nigel | 41 | fi |
| 3034 | |||
| 3035 | if test -n "$release"; then | ||
| 3036 | $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 | ||
| 3037 | fi | ||
| 3038 | else | ||
| 3039 | |||
| 3040 | # Parse the version information argument. | ||
| 3041 | nigel | 63 | save_ifs="$IFS"; IFS=':' |
| 3042 | nigel | 41 | set dummy $vinfo 0 0 0 |
| 3043 | IFS="$save_ifs" | ||
| 3044 | |||
| 3045 | if test -n "$8"; then | ||
| 3046 | $echo "$modename: too many parameters to \`-version-info'" 1>&2 | ||
| 3047 | $echo "$help" 1>&2 | ||
| 3048 | nigel | 75 | exit $EXIT_FAILURE |
| 3049 | nigel | 41 | fi |
| 3050 | |||
| 3051 | nigel | 75 | # convert absolute version numbers to libtool ages |
| 3052 | # this retains compatibility with .la files and attempts | ||
| 3053 | # to make the code below a bit more comprehensible | ||
| 3054 | nigel | 41 | |
| 3055 | nigel | 75 | case $vinfo_number in |
| 3056 | yes) | ||
| 3057 | number_major="$2" | ||
| 3058 | number_minor="$3" | ||
| 3059 | number_revision="$4" | ||
| 3060 | # | ||
| 3061 | # There are really only two kinds -- those that | ||
| 3062 | # use the current revision as the major version | ||
| 3063 | # and those that subtract age and use age as | ||
| 3064 | # a minor version. But, then there is irix | ||
| 3065 | # which has an extra 1 added just for fun | ||
| 3066 | # | ||
| 3067 | case $version_type in | ||
| 3068 | darwin|linux|osf|windows) | ||
| 3069 | current=`expr $number_major + $number_minor` | ||
| 3070 | age="$number_minor" | ||
| 3071 | revision="$number_revision" | ||
| 3072 | ;; | ||
| 3073 | freebsd-aout|freebsd-elf|sunos) | ||
| 3074 | current="$number_major" | ||
| 3075 | revision="$number_minor" | ||
| 3076 | age="0" | ||
| 3077 | ;; | ||
| 3078 | irix|nonstopux) | ||
| 3079 | current=`expr $number_major + $number_minor - 1` | ||
| 3080 | age="$number_minor" | ||
| 3081 | revision="$number_minor" | ||
| 3082 | ;; | ||
| 3083 | esac | ||
| 3084 | ;; | ||
| 3085 | no) | ||
| 3086 | current="$2" | ||
| 3087 | revision="$3" | ||
| 3088 | age="$4" | ||
| 3089 | ;; | ||
| 3090 | esac | ||
| 3091 | |||
| 3092 | nigel | 41 | # Check that each of the things are valid numbers. |
| 3093 | nigel | 53 | case $current in |
| 3094 | 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; | ||
| 3095 | nigel | 41 | *) |
| 3096 | $echo "$modename: CURRENT \`$current' is not a nonnegative integer" 1>&2 | ||
| 3097 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 | ||
| 3098 | nigel | 75 | exit $EXIT_FAILURE |
| 3099 | nigel | 41 | ;; |
| 3100 | esac | ||
| 3101 | |||
| 3102 | nigel | 53 | case $revision in |
| 3103 | 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; | ||
| 3104 | nigel | 41 | *) |
| 3105 | $echo "$modename: REVISION \`$revision' is not a nonnegative integer" 1>&2 | ||
| 3106 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 | ||
| 3107 | nigel | 75 | exit $EXIT_FAILURE |
| 3108 | nigel | 41 | ;; |
| 3109 | esac | ||
| 3110 | |||
| 3111 | nigel | 53 | case $age in |
| 3112 | 0 | [1-9] | [1-9][0-9] | [1-9][0-9][0-9]) ;; | ||
| 3113 | nigel | 41 | *) |
| 3114 | $echo "$modename: AGE \`$age' is not a nonnegative integer" 1>&2 | ||
| 3115 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 | ||
| 3116 | nigel | 75 | exit $EXIT_FAILURE |
| 3117 | nigel | 41 | ;; |
| 3118 | esac | ||
| 3119 | |||
| 3120 | nigel | 75 | if test "$age" -gt "$current"; then |
| 3121 | nigel | 41 | $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 |
| 3122 | $echo "$modename: \`$vinfo' is not valid version information" 1>&2 | ||
| 3123 | nigel | 75 | exit $EXIT_FAILURE |
| 3124 | nigel | 41 | fi |
| 3125 | |||
| 3126 | # Calculate the version variables. | ||
| 3127 | major= | ||
| 3128 | versuffix= | ||
| 3129 | verstring= | ||
| 3130 | nigel | 53 | case $version_type in |
| 3131 | nigel | 41 | none) ;; |
| 3132 | |||
| 3133 | nigel | 53 | darwin) |
| 3134 | # Like Linux, but with the current version available in | ||
| 3135 | # verstring for coding it into the library header | ||
| 3136 | major=.`expr $current - $age` | ||
| 3137 | versuffix="$major.$age.$revision" | ||
| 3138 | # Darwin ld doesn't like 0 for these options... | ||
| 3139 | minor_current=`expr $current + 1` | ||
| 3140 | nigel | 75 | verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" |
| 3141 | nigel | 53 | ;; |
| 3142 | |||
| 3143 | freebsd-aout) | ||
| 3144 | major=".$current" | ||
| 3145 | versuffix=".$current.$revision"; | ||
| 3146 | ;; | ||
| 3147 | |||
| 3148 | freebsd-elf) | ||
| 3149 | major=".$current" | ||
| 3150 | versuffix=".$current"; | ||
| 3151 | ;; | ||
| 3152 | |||
| 3153 | nigel | 63 | irix | nonstopux) |
| 3154 | nigel | 41 | major=`expr $current - $age + 1` |
| 3155 | |||
| 3156 | nigel | 63 | case $version_type in |
| 3157 | nonstopux) verstring_prefix=nonstopux ;; | ||
| 3158 | *) verstring_prefix=sgi ;; | ||
| 3159 | esac | ||
| 3160 | verstring="$verstring_prefix$major.$revision" | ||
| 3161 | |||
| 3162 | nigel | 41 | # Add in all the interfaces that we are compatible with. |
| 3163 | loop=$revision | ||
| 3164 | nigel | 75 | while test "$loop" -ne 0; do |
| 3165 | nigel | 41 | iface=`expr $revision - $loop` |
| 3166 | loop=`expr $loop - 1` | ||
| 3167 | nigel | 63 | verstring="$verstring_prefix$major.$iface:$verstring" |
| 3168 | nigel | 41 | done |
| 3169 | nigel | 53 | |
| 3170 | # Before this point, $major must not contain `.'. | ||
| 3171 | major=.$major | ||
| 3172 | versuffix="$major.$revision" | ||
| 3173 | nigel | 41 | ;; |
| 3174 | |||
| 3175 | linux) | ||
| 3176 | major=.`expr $current - $age` | ||
| 3177 | versuffix="$major.$age.$revision" | ||
| 3178 | ;; | ||
| 3179 | |||
| 3180 | osf) | ||
| 3181 | nigel | 63 | major=.`expr $current - $age` |
| 3182 | nigel | 41 | versuffix=".$current.$age.$revision" |
| 3183 | verstring="$current.$age.$revision" | ||
| 3184 | |||
| 3185 | # Add in all the interfaces that we are compatible with. | ||
| 3186 | loop=$age | ||
| 3187 | nigel | 75 | while test "$loop" -ne 0; do |
| 3188 | nigel | 41 | iface=`expr $current - $loop` |
| 3189 | loop=`expr $loop - 1` | ||
| 3190 | verstring="$verstring:${iface}.0" | ||
| 3191 | done | ||
| 3192 | |||
| 3193 | # Make executables depend on our current version. | ||
| 3194 | verstring="$verstring:${current}.0" | ||
| 3195 | ;; | ||
| 3196 | |||
| 3197 | sunos) | ||
| 3198 | major=".$current" | ||
| 3199 | versuffix=".$current.$revision" | ||
| 3200 | ;; | ||
| 3201 | |||
| 3202 | windows) | ||
| 3203 | nigel | 53 | # Use '-' rather than '.', since we only want one |
| 3204 | # extension on DOS 8.3 filesystems. | ||
| 3205 | nigel | 41 | major=`expr $current - $age` |
| 3206 | nigel | 53 | versuffix="-$major" |
| 3207 | nigel | 41 | ;; |
| 3208 | |||
| 3209 | *) | ||
| 3210 | $echo "$modename: unknown library version type \`$version_type'" 1>&2 | ||
| 3211 | nigel | 75 | $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 |
| 3212 | exit $EXIT_FAILURE | ||
| 3213 | nigel | 41 | ;; |
| 3214 | esac | ||
| 3215 | |||
| 3216 | # Clear the version info if we defaulted, and they specified a release. | ||
| 3217 | if test -z "$vinfo" && test -n "$release"; then | ||
| 3218 | major= | ||
| 3219 | nigel | 63 | case $version_type in |
| 3220 | darwin) | ||
| 3221 | # we can't check for "0.0" in archive_cmds due to quoting | ||
| 3222 | # problems, so we reset it completely | ||
| 3223 | nigel | 75 | verstring= |
| 3224 | nigel | 63 | ;; |
| 3225 | *) | ||
| 3226 | verstring="0.0" | ||
| 3227 | ;; | ||
| 3228 | esac | ||
| 3229 | nigel | 41 | if test "$need_version" = no; then |
| 3230 | versuffix= | ||
| 3231 | else | ||
| 3232 | versuffix=".0.0" | ||
| 3233 | fi | ||
| 3234 | fi | ||
| 3235 | |||
| 3236 | # Remove version info from name if versioning should be avoided | ||
| 3237 | if test "$avoid_version" = yes && test "$need_version" = no; then | ||
| 3238 | major= | ||
| 3239 | versuffix= | ||
| 3240 | verstring="" | ||
| 3241 | fi | ||
| 3242 | nigel | 53 | |
| 3243 | nigel | 41 | # Check to see if the archive will have undefined symbols. |
| 3244 | if test "$allow_undefined" = yes; then | ||
| 3245 | if test "$allow_undefined_flag" = unsupported; then | ||
| 3246 | $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 | ||
| 3247 | build_libtool_libs=no | ||
| 3248 | build_old_libs=yes | ||
| 3249 | fi | ||
| 3250 | else | ||
| 3251 | # Don't allow undefined symbols. | ||
| 3252 | allow_undefined_flag="$no_undefined_flag" | ||
| 3253 | fi | ||
| 3254 | fi | ||
| 3255 | |||
| 3256 | nigel | 53 | if test "$mode" != relink; then |
| 3257 | nigel | 75 | # Remove our outputs, but don't remove object files since they |
| 3258 | # may have been created when compiling PIC objects. | ||
| 3259 | removelist= | ||
| 3260 | tempremovelist=`$echo "$output_objdir/*"` | ||
| 3261 | for p in $tempremovelist; do | ||
| 3262 | case $p in | ||
| 3263 | *.$objext) | ||
| 3264 | ;; | ||
| 3265 | $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) | ||
| 3266 | if test "X$precious_files_regex" != "X"; then | ||
| 3267 | if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 | ||
| 3268 | then | ||
| 3269 | continue | ||
| 3270 | fi | ||
| 3271 | fi | ||
| 3272 | removelist="$removelist $p" | ||
| 3273 | ;; | ||
| 3274 | *) ;; | ||
| 3275 | esac | ||
| 3276 | done | ||
| 3277 | if test -n "$removelist"; then | ||
| 3278 | $show "${rm}r $removelist" | ||
| 3279 | $run ${rm}r $removelist | ||
| 3280 | fi | ||
| 3281 | nigel | 41 | fi |
| 3282 | |||
| 3283 | # Now set the variables for building old libraries. | ||
| 3284 | if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then | ||
| 3285 | oldlibs="$oldlibs $output_objdir/$libname.$libext" | ||
| 3286 | |||
| 3287 | # Transform .lo files to .o files. | ||
| 3288 | oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` | ||
| 3289 | fi | ||
| 3290 | |||
| 3291 | nigel | 53 | # Eliminate all temporary directories. |
| 3292 | for path in $notinst_path; do | ||
| 3293 | nigel | 75 | lib_search_path=`$echo "$lib_search_path " | ${SED} -e 's% $path % %g'` |
| 3294 | deplibs=`$echo "$deplibs " | ${SED} -e 's% -L$path % %g'` | ||
| 3295 | dependency_libs=`$echo "$dependency_libs " | ${SED} -e 's% -L$path % %g'` | ||
| 3296 | nigel | 53 | done |
| 3297 | |||
| 3298 | if test -n "$xrpath"; then | ||
| 3299 | # If the user specified any rpath flags, then add them. | ||
| 3300 | temp_xrpath= | ||
| 3301 | for libdir in $xrpath; do | ||
| 3302 | temp_xrpath="$temp_xrpath -R$libdir" | ||
| 3303 | case "$finalize_rpath " in | ||
| 3304 | *" $libdir "*) ;; | ||
| 3305 | *) finalize_rpath="$finalize_rpath $libdir" ;; | ||
| 3306 | esac | ||
| 3307 | done | ||
| 3308 | nigel | 75 | if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then |
| 3309 | nigel | 53 | dependency_libs="$temp_xrpath $dependency_libs" |
| 3310 | fi | ||
| 3311 | fi | ||
| 3312 | |||
| 3313 | # Make sure dlfiles contains only unique files that won't be dlpreopened | ||
| 3314 | old_dlfiles="$dlfiles" | ||
| 3315 | dlfiles= | ||
| 3316 | for lib in $old_dlfiles; do | ||
| 3317 | case " $dlprefiles $dlfiles " in | ||
| 3318 | *" $lib "*) ;; | ||
| 3319 | *) dlfiles="$dlfiles $lib" ;; | ||
| 3320 | esac | ||
| 3321 | done | ||
| 3322 | |||
| 3323 | # Make sure dlprefiles contains only unique files | ||
| 3324 | old_dlprefiles="$dlprefiles" | ||
| 3325 | dlprefiles= | ||
| 3326 | for lib in $old_dlprefiles; do | ||
| 3327 | case "$dlprefiles " in | ||
| 3328 | *" $lib "*) ;; | ||
| 3329 | *) dlprefiles="$dlprefiles $lib" ;; | ||
| 3330 | esac | ||
| 3331 | done | ||
| 3332 | |||
| 3333 | nigel | 41 | if test "$build_libtool_libs" = yes; then |
| 3334 | nigel | 53 | if test -n "$rpath"; then |
| 3335 | case $host in | ||
| 3336 | *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) | ||
| 3337 | # these systems don't actually have a c library (as such)! | ||
| 3338 | ;; | ||
| 3339 | *-*-rhapsody* | *-*-darwin1.[012]) | ||
| 3340 | # Rhapsody C library is in the System framework | ||
| 3341 | deplibs="$deplibs -framework System" | ||
| 3342 | ;; | ||
| 3343 | *-*-netbsd*) | ||
| 3344 | # Don't link with libc until the a.out ld.so is fixed. | ||
| 3345 | ;; | ||
| 3346 | nigel | 63 | *-*-openbsd* | *-*-freebsd*) |
| 3347 | # Do not include libc due to us having libc/libc_r. | ||
| 3348 | nigel | 75 | test "X$arg" = "X-lc" && continue |
| 3349 | nigel | 63 | ;; |
| 3350 | nigel | 53 | *) |
| 3351 | # Add libc to deplibs on all other systems if necessary. | ||
| 3352 | nigel | 75 | if test "$build_libtool_need_lc" = "yes"; then |
| 3353 | nigel | 53 | deplibs="$deplibs -lc" |
| 3354 | fi | ||
| 3355 | ;; | ||
| 3356 | esac | ||
| 3357 | fi | ||
| 3358 | |||
| 3359 | nigel | 41 | # Transform deplibs into only deplibs that can be linked in shared. |
| 3360 | name_save=$name | ||
| 3361 | libname_save=$libname | ||
| 3362 | release_save=$release | ||
| 3363 | versuffix_save=$versuffix | ||
| 3364 | major_save=$major | ||
| 3365 | # I'm not sure if I'm treating the release correctly. I think | ||
| 3366 | # release should show up in the -l (ie -lgmp5) so we don't want to | ||
| 3367 | # add it in twice. Is that correct? | ||
| 3368 | release="" | ||
| 3369 | versuffix="" | ||
| 3370 | major="" | ||
| 3371 | newdeplibs= | ||
| 3372 | droppeddeps=no | ||
| 3373 | nigel | 53 | case $deplibs_check_method in |
| 3374 | nigel | 41 | pass_all) |
| 3375 | # Don't check for shared/static. Everything works. | ||
| 3376 | # This might be a little naive. We might want to check | ||
| 3377 | nigel | 63 | # whether the library exists or not. But this is on |
| 3378 | nigel | 41 | # osf3 & osf4 and I'm not really sure... Just |
| 3379 | nigel | 75 | # implementing what was already the behavior. |
| 3380 | nigel | 41 | newdeplibs=$deplibs |
| 3381 | ;; | ||
| 3382 | test_compile) | ||
| 3383 | # This code stresses the "libraries are programs" paradigm to its | ||
| 3384 | # limits. Maybe even breaks it. We compile a program, linking it | ||
| 3385 | # against the deplibs as a proxy for the library. Then we can check | ||
| 3386 | # whether they linked in statically or dynamically with ldd. | ||
| 3387 | $rm conftest.c | ||
| 3388 | cat > conftest.c <<EOF | ||
| 3389 | int main() { return 0; } | ||
| 3390 | EOF | ||
| 3391 | $rm conftest | ||
| 3392 | nigel | 75 | $LTCC -o conftest conftest.c $deplibs |
| 3393 | if test "$?" -eq 0 ; then | ||
| 3394 | nigel | 41 | ldd_output=`ldd conftest` |
| 3395 | for i in $deplibs; do | ||
| 3396 | name="`expr $i : '-l\(.*\)'`" | ||
| 3397 | # If $name is empty we are operating on a -L argument. | ||
| 3398 | nigel | 75 | if test "$name" != "" && test "$name" -ne "0"; then |
| 3399 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then | ||
| 3400 | case " $predeps $postdeps " in | ||
| 3401 | *" $i "*) | ||
| 3402 | newdeplibs="$newdeplibs $i" | ||
| 3403 | i="" | ||
| 3404 | ;; | ||
| 3405 | esac | ||
| 3406 | nigel | 41 | fi |
| 3407 | nigel | 75 | if test -n "$i" ; then |
| 3408 | libname=`eval \\$echo \"$libname_spec\"` | ||
| 3409 | deplib_matches=`eval \\$echo \"$library_names_spec\"` | ||
| 3410 | set dummy $deplib_matches | ||
| 3411 | deplib_match=$2 | ||
| 3412 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then | ||
| 3413 | newdeplibs="$newdeplibs $i" | ||
| 3414 | else | ||
| 3415 | droppeddeps=yes | ||
| 3416 | $echo | ||
| 3417 | $echo "*** Warning: dynamic linker does not accept needed library $i." | ||
| 3418 | $echo "*** I have the capability to make that library automatically link in when" | ||
| 3419 | $echo "*** you link to this library. But I can only do this if you have a" | ||
| 3420 | $echo "*** shared version of the library, which I believe you do not have" | ||
| 3421 | $echo "*** because a test_compile did reveal that the linker did not use it for" | ||
| 3422 | $echo "*** its dynamic dependency list that programs get resolved with at runtime." | ||
| 3423 | fi | ||
| 3424 | fi | ||
| 3425 | nigel | 41 | else |
| 3426 | newdeplibs="$newdeplibs $i" | ||
| 3427 | fi | ||
| 3428 | done | ||
| 3429 | else | ||
| 3430 | nigel | 75 | # Error occurred in the first compile. Let's try to salvage |
| 3431 | nigel | 63 | # the situation: Compile a separate program for each library. |
| 3432 | nigel | 41 | for i in $deplibs; do |
| 3433 | name="`expr $i : '-l\(.*\)'`" | ||
| 3434 | nigel | 75 | # If $name is empty we are operating on a -L argument. |
| 3435 | if test "$name" != "" && test "$name" != "0"; then | ||
| 3436 | nigel | 41 | $rm conftest |
| 3437 | nigel | 75 | $LTCC -o conftest conftest.c $i |
| 3438 | nigel | 41 | # Did it work? |
| 3439 | nigel | 75 | if test "$?" -eq 0 ; then |
| 3440 | nigel | 41 | ldd_output=`ldd conftest` |
| 3441 | nigel | 75 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 3442 | case " $predeps $postdeps " in | ||
| 3443 | *" $i "*) | ||
| 3444 | newdeplibs="$newdeplibs $i" | ||
| 3445 | i="" | ||
| 3446 | ;; | ||
| 3447 | esac | ||
| 3448 | nigel | 41 | fi |
| 3449 | nigel | 75 | if test -n "$i" ; then |
| 3450 | libname=`eval \\$echo \"$libname_spec\"` | ||
| 3451 | deplib_matches=`eval \\$echo \"$library_names_spec\"` | ||
| 3452 | set dummy $deplib_matches | ||
| 3453 | deplib_match=$2 | ||
| 3454 | if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then | ||
| 3455 | newdeplibs="$newdeplibs $i" | ||
| 3456 | else | ||
| 3457 | droppeddeps=yes | ||
| 3458 | $echo | ||
| 3459 | $echo "*** Warning: dynamic linker does not accept needed library $i." | ||
| 3460 | $echo "*** I have the capability to make that library automatically link in when" | ||
| 3461 | $echo "*** you link to this library. But I can only do this if you have a" | ||
| 3462 | $echo "*** shared version of the library, which you do not appear to have" | ||
| 3463 | $echo "*** because a test_compile did reveal that the linker did not use this one" | ||
| 3464 | $echo "*** as a dynamic dependency that programs can get resolved with at runtime." | ||
| 3465 | fi | ||
| 3466 | fi | ||
| 3467 | nigel | 41 | else |
| 3468 | droppeddeps=yes | ||
| 3469 | nigel | 75 | $echo |
| 3470 | $echo "*** Warning! Library $i is needed by this library but I was not able to" | ||
| 3471 | $echo "*** make it link in! You will probably need to install it or some" | ||
| 3472 | $echo "*** library that it depends on before this library will be fully" | ||
| 3473 | $echo "*** functional. Installing it before continuing would be even better." | ||
| 3474 | nigel | 41 | fi |
| 3475 | else | ||
| 3476 | newdeplibs="$newdeplibs $i" | ||
| 3477 | fi | ||
| 3478 | done | ||
| 3479 | fi | ||
| 3480 | ;; | ||
| 3481 | file_magic*) | ||
| 3482 | set dummy $deplibs_check_method | ||
| 3483 | nigel | 53 | file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` |
| 3484 | nigel | 41 | for a_deplib in $deplibs; do |
| 3485 | name="`expr $a_deplib : '-l\(.*\)'`" | ||
| 3486 | # If $name is empty we are operating on a -L argument. | ||
| 3487 | nigel | 75 | if test "$name" != "" && test "$name" != "0"; then |
| 3488 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then | ||
| 3489 | case " $predeps $postdeps " in | ||
| 3490 | *" $a_deplib "*) | ||
| 3491 | newdeplibs="$newdeplibs $a_deplib" | ||
| 3492 | a_deplib="" | ||
| 3493 | ;; | ||
| 3494 | esac | ||
| 3495 | fi | ||
| 3496 | if test -n "$a_deplib" ; then | ||
| 3497 | libname=`eval \\$echo \"$libname_spec\"` | ||
| 3498 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do | ||
| 3499 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` | ||
| 3500 | for potent_lib in $potential_libs; do | ||
| 3501 | nigel | 41 | # Follow soft links. |
| 3502 | if ls -lLd "$potent_lib" 2>/dev/null \ | ||
| 3503 | | grep " -> " >/dev/null; then | ||
| 3504 | nigel | 53 | continue |
| 3505 | nigel | 41 | fi |
| 3506 | # The statement above tries to avoid entering an | ||
| 3507 | # endless loop below, in case of cyclic links. | ||
| 3508 | # We might still enter an endless loop, since a link | ||
| 3509 | # loop can be closed while we follow links, | ||
| 3510 | # but so what? | ||
| 3511 | potlib="$potent_lib" | ||
| 3512 | while test -h "$potlib" 2>/dev/null; do | ||
| 3513 | nigel | 63 | potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` |
| 3514 | nigel | 53 | case $potliblink in |
| 3515 | nigel | 41 | [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; |
| 3516 | *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; | ||
| 3517 | esac | ||
| 3518 | done | ||
| 3519 | if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ | ||
| 3520 | nigel | 63 | | ${SED} 10q \ |
| 3521 | nigel | 75 | | $EGREP "$file_magic_regex" > /dev/null; then |
| 3522 | nigel | 41 | newdeplibs="$newdeplibs $a_deplib" |
| 3523 | a_deplib="" | ||
| 3524 | break 2 | ||
| 3525 | fi | ||
| 3526 | nigel | 75 | done |
| 3527 | done | ||
| 3528 | fi | ||
| 3529 | nigel | 41 | if test -n "$a_deplib" ; then |
| 3530 | droppeddeps=yes | ||
| 3531 | nigel | 75 | $echo |
| 3532 | $echo "*** Warning: linker path does not have real file for library $a_deplib." | ||
| 3533 | $echo "*** I have the capability to make that library automatically link in when" | ||
| 3534 | $echo "*** you link to this library. But I can only do this if you have a" | ||
| 3535 | $echo "*** shared version of the library, which you do not appear to have" | ||
| 3536 | $echo "*** because I did check the linker path looking for a file starting" | ||
| 3537 | nigel | 63 | if test -z "$potlib" ; then |
| 3538 | nigel | 75 | $echo "*** with $libname but no candidates were found. (...for file magic test)" |
| 3539 | nigel | 63 | else |
| 3540 | nigel | 75 | $echo "*** with $libname and none of the candidates passed a file format test" |
| 3541 | $echo "*** using a file magic. Last file checked: $potlib" | ||
| 3542 | nigel | 63 | fi |
| 3543 | nigel | 41 | fi |
| 3544 | else | ||
| 3545 | # Add a -L argument. | ||
| 3546 | newdeplibs="$newdeplibs $a_deplib" | ||
| 3547 | fi | ||
| 3548 | done # Gone through all deplibs. | ||
| 3549 | ;; | ||
| 3550 | nigel | 53 | match_pattern*) |
| 3551 | set dummy $deplibs_check_method | ||
| 3552 | match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` | ||
| 3553 | for a_deplib in $deplibs; do | ||
| 3554 | name="`expr $a_deplib : '-l\(.*\)'`" | ||
| 3555 | # If $name is empty we are operating on a -L argument. | ||
| 3556 | if test -n "$name" && test "$name" != "0"; then | ||
| 3557 | nigel | 75 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then |
| 3558 | case " $predeps $postdeps " in | ||
| 3559 | *" $a_deplib "*) | ||
| 3560 | newdeplibs="$newdeplibs $a_deplib" | ||
| 3561 | a_deplib="" | ||
| 3562 | ;; | ||
| 3563 | esac | ||
| 3564 | fi | ||
| 3565 | if test -n "$a_deplib" ; then | ||
| 3566 | libname=`eval \\$echo \"$libname_spec\"` | ||
| 3567 | for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do | ||
| 3568 | potential_libs=`ls $i/$libname[.-]* 2>/dev/null` | ||
| 3569 | for potent_lib in $potential_libs; do | ||
| 3570 | potlib="$potent_lib" # see symlink-check above in file_magic test | ||
| 3571 | if eval $echo \"$potent_lib\" 2>/dev/null \ | ||
| 3572 | | ${SED} 10q \ | ||
| 3573 | | $EGREP "$match_pattern_regex" > /dev/null; then | ||
| 3574 | newdeplibs="$newdeplibs $a_deplib" | ||
| 3575 | a_deplib="" | ||
| 3576 | break 2 | ||
| 3577 | fi | ||
| 3578 | done | ||
| 3579 | nigel | 53 | done |
| 3580 | nigel | 75 | fi |
| 3581 | nigel | 53 | if test -n "$a_deplib" ; then |
| 3582 | droppeddeps=yes | ||
| 3583 | nigel | 75 | $echo |
| 3584 | $echo "*** Warning: linker path does not have real file for library $a_deplib." | ||
| 3585 | $echo "*** I have the capability to make that library automatically link in when" | ||
| 3586 | $echo "*** you link to this library. But I can only do this if you have a" | ||
| 3587 | $echo "*** shared version of the library, which you do not appear to have" | ||
| 3588 | $echo "*** because I did check the linker path looking for a file starting" | ||
| 3589 | nigel | 63 | if test -z "$potlib" ; then |
| 3590 | nigel | 75 | $echo "*** with $libname but no candidates were found. (...for regex pattern test)" |
| 3591 | nigel | 63 | else |
| 3592 | nigel | 75 | $echo "*** with $libname and none of the candidates passed a file format test" |
| 3593 | $echo "*** using a regex pattern. Last file checked: $potlib" | ||
| 3594 | nigel | 63 | fi |
| 3595 | nigel | 53 | fi |
| 3596 | else | ||
| 3597 | # Add a -L argument. | ||
| 3598 | newdeplibs="$newdeplibs $a_deplib" | ||
| 3599 | fi | ||
| 3600 | done # Gone through all deplibs. | ||
| 3601 | ;; | ||
| 3602 | nigel | 41 | none | unknown | *) |
| 3603 | newdeplibs="" | ||
| 3604 | nigel | 75 | tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ |
| 3605 | -e 's/ -[LR][^ ]*//g'` | ||
| 3606 | if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then | ||
| 3607 | for i in $predeps $postdeps ; do | ||
| 3608 | # can't use Xsed below, because $i might contain '/' | ||
| 3609 | tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` | ||
| 3610 | done | ||
| 3611 | fi | ||
| 3612 | if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ | ||
| 3613 | | grep . >/dev/null; then | ||
| 3614 | $echo | ||
| 3615 | nigel | 41 | if test "X$deplibs_check_method" = "Xnone"; then |
| 3616 | nigel | 75 | $echo "*** Warning: inter-library dependencies are not supported in this platform." |
| 3617 | nigel | 41 | else |
| 3618 | nigel | 75 | $echo "*** Warning: inter-library dependencies are not known to be supported." |
| 3619 | nigel | 41 | fi |
| 3620 | nigel | 75 | $echo "*** All declared inter-library dependencies are being dropped." |
| 3621 | nigel | 41 | droppeddeps=yes |
| 3622 | fi | ||
| 3623 | ;; | ||
| 3624 | esac | ||
| 3625 | versuffix=$versuffix_save | ||
| 3626 | major=$major_save | ||
| 3627 | release=$release_save | ||
| 3628 | libname=$libname_save | ||
| 3629 | name=$name_save | ||
| 3630 | |||
| 3631 | nigel | 53 | case $host in |
| 3632 | *-*-rhapsody* | *-*-darwin1.[012]) | ||
| 3633 | # On Rhapsody replace the C library is the System framework | ||
| 3634 | newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` | ||
| 3635 | ;; | ||
| 3636 | esac | ||
| 3637 | |||
| 3638 | nigel | 41 | if test "$droppeddeps" = yes; then |
| 3639 | if test "$module" = yes; then | ||
| 3640 | nigel | 75 | $echo |
| 3641 | $echo "*** Warning: libtool could not satisfy all declared inter-library" | ||
| 3642 | $echo "*** dependencies of module $libname. Therefore, libtool will create" | ||
| 3643 | $echo "*** a static module, that should work as long as the dlopening" | ||
| 3644 | $echo "*** application is linked with the -dlopen flag." | ||
| 3645 | nigel | 41 | if test -z "$global_symbol_pipe"; then |
| 3646 | nigel | 75 | $echo |
| 3647 | $echo "*** However, this would only work if libtool was able to extract symbol" | ||
| 3648 | $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" | ||
| 3649 | $echo "*** not find such a program. So, this module is probably useless." | ||
| 3650 | $echo "*** \`nm' from GNU binutils and a full rebuild may help." | ||
| 3651 | nigel | 41 | fi |
| 3652 | if test "$build_old_libs" = no; then | ||
| 3653 | oldlibs="$output_objdir/$libname.$libext" | ||
| 3654 | build_libtool_libs=module | ||
| 3655 | build_old_libs=yes | ||
| 3656 | else | ||
| 3657 | build_libtool_libs=no | ||
| 3658 | fi | ||
| 3659 | else | ||
| 3660 | nigel | 75 | $echo "*** The inter-library dependencies that have been dropped here will be" |
| 3661 | $echo "*** automatically added whenever a program is linked with this library" | ||
| 3662 | $echo "*** or is declared to -dlopen it." | ||
| 3663 | nigel | 53 | |
| 3664 | nigel | 75 | if test "$allow_undefined" = no; then |
| 3665 | $echo | ||
| 3666 | $echo "*** Since this library must not contain undefined symbols," | ||
| 3667 | $echo "*** because either the platform does not support them or" | ||
| 3668 | $echo "*** it was explicitly requested with -no-undefined," | ||
| 3669 | $echo "*** libtool will only create a static version of it." | ||
| 3670 | nigel | 53 | if test "$build_old_libs" = no; then |
| 3671 | oldlibs="$output_objdir/$libname.$libext" | ||
| 3672 | build_libtool_libs=module | ||
| 3673 | build_old_libs=yes | ||
| 3674 | else | ||
| 3675 | build_libtool_libs=no | ||
| 3676 | fi | ||
| 3677 | fi | ||
| 3678 | nigel | 41 | fi |
| 3679 | fi | ||
| 3680 | # Done checking deplibs! | ||
| 3681 | deplibs=$newdeplibs | ||
| 3682 | fi | ||
| 3683 | |||
| 3684 | # All the library-specific variables (install_libdir is set above). | ||
| 3685 | library_names= | ||
| 3686 | old_library= | ||
| 3687 | dlname= | ||
| 3688 | nigel | 53 | |
| 3689 | nigel | 41 | # Test again, we may have decided not to build it any more |
| 3690 | if test "$build_libtool_libs" = yes; then | ||
| 3691 | nigel | 75 | if test "$hardcode_into_libs" = yes; then |
| 3692 | nigel | 53 | # Hardcode the library paths |
| 3693 | hardcode_libdirs= | ||
| 3694 | dep_rpath= | ||
| 3695 | rpath="$finalize_rpath" | ||
| 3696 | test "$mode" != relink && rpath="$compile_rpath$rpath" | ||
| 3697 | for libdir in $rpath; do | ||
| 3698 | if test -n "$hardcode_libdir_flag_spec"; then | ||
| 3699 | if test -n "$hardcode_libdir_separator"; then | ||
| 3700 | if test -z "$hardcode_libdirs"; then | ||
| 3701 | hardcode_libdirs="$libdir" | ||
| 3702 | else | ||
| 3703 | # Just accumulate the unique libdirs. | ||
| 3704 | case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in | ||
| 3705 | *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) | ||
| 3706 | ;; | ||
| 3707 | *) | ||
| 3708 | hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" | ||
| 3709 | ;; | ||
| 3710 | esac | ||
| 3711 | fi | ||
| 3712 | else | ||
| 3713 | eval flag=\"$hardcode_libdir_flag_spec\" | ||
| 3714 | dep_rpath="$dep_rpath $flag" | ||
| 3715 | fi | ||
| 3716 | elif test -n "$runpath_var"; then | ||
| 3717 | case "$perm_rpath " in | ||
| 3718 | *" $libdir "*) ;; | ||
| 3719 | *) perm_rpath="$perm_rpath $libdir" ;; | ||
| 3720 | esac | ||
| 3721 | fi | ||
| 3722 | done | ||
| 3723 | # Substitute the hardcoded libdirs into the rpath. | ||
| 3724 | if test -n "$hardcode_libdir_separator" && | ||
| 3725 | test -n "$hardcode_libdirs"; then | ||
| 3726 | libdir="$hardcode_libdirs" | ||
| 3727 | nigel | 75 | if test -n "$hardcode_libdir_flag_spec_ld"; then |
| 3728 | eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" | ||
| 3729 | else | ||
| 3730 | eval dep_rpath=\"$hardcode_libdir_flag_spec\" | ||
| 3731 | fi | ||
| 3732 | nigel | 53 | fi |
| 3733 | if test -n "$runpath_var" && test -n "$perm_rpath"; then | ||
| 3734 | # We should set the runpath_var. | ||
| 3735 | rpath= | ||
| 3736 | for dir in $perm_rpath; do | ||
| 3737 | rpath="$rpath$dir:" | ||
| 3738 | done | ||
| 3739 | eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" | ||
| 3740 | fi | ||
| 3741 | test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" | ||
| 3742 | fi | ||
| 3743 | |||
| 3744 | shlibpath="$finalize_shlibpath" | ||
| 3745 | test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" | ||
| 3746 | if test -n "$shlibpath"; then | ||
| 3747 | eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" | ||
| 3748 | fi | ||
| 3749 | |||
| 3750 | nigel | 41 | # Get the real and link names of the library. |
| 3751 | nigel | 75 | eval shared_ext=\"$shrext_cmds\" |
| 3752 | nigel | 41 | eval library_names=\"$library_names_spec\" |
| 3753 | set dummy $library_names | ||
| 3754 | realname="$2" | ||
| 3755 | shift; shift | ||
| 3756 | |||
| 3757 | if test -n "$soname_spec"; then | ||
| 3758 | eval soname=\"$soname_spec\" | ||
| 3759 | else | ||
| 3760 | soname="$realname" | ||
| 3761 | fi | ||
| 3762 | nigel | 75 | if test -z "$dlname"; then |
| 3763 | dlname=$soname | ||
| 3764 | fi | ||
| 3765 | nigel | 41 | |
| 3766 | lib="$output_objdir/$realname" | ||
| 3767 | for link | ||
| 3768 | do | ||
| 3769 | linknames="$linknames $link" | ||
| 3770 | done | ||
| 3771 | |||
| 3772 | # Use standard objects if they are pic | ||
| 3773 | test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` | ||
| 3774 | |||
| 3775 | # Prepare the list of exported symbols | ||
| 3776 | if test -z "$export_symbols"; then | ||
| 3777 | if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then | ||
| 3778 | $show "generating symbol list for \`$libname.la'" | ||
| 3779 | export_symbols="$output_objdir/$libname.exp" | ||
| 3780 | $run $rm $export_symbols | ||
| 3781 | nigel | 75 | cmds=$export_symbols_cmds |
| 3782 | nigel | 63 | save_ifs="$IFS"; IFS='~' |
| 3783 | nigel | 41 | for cmd in $cmds; do |
| 3784 | IFS="$save_ifs" | ||
| 3785 | nigel | 75 | eval cmd=\"$cmd\" |
| 3786 | if len=`expr "X$cmd" : ".*"` && | ||
| 3787 | test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then | ||
| 3788 | $show "$cmd" | ||
| 3789 | $run eval "$cmd" || exit $? | ||
| 3790 | skipped_export=false | ||
| 3791 | else | ||
| 3792 | # The command line is too long to execute in one step. | ||
| 3793 | $show "using reloadable object file for export list..." | ||
| 3794 | skipped_export=: | ||
| 3795 | fi | ||
| 3796 | nigel | 41 | done |
| 3797 | IFS="$save_ifs" | ||
| 3798 | if test -n "$export_symbols_regex"; then | ||
| 3799 | nigel | 75 | $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" |
| 3800 | $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' | ||
| 3801 | nigel | 41 | $show "$mv \"${export_symbols}T\" \"$export_symbols\"" |
| 3802 | $run eval '$mv "${export_symbols}T" "$export_symbols"' | ||
| 3803 | fi | ||
| 3804 | fi | ||
| 3805 | fi | ||
| 3806 | |||
| 3807 | if test -n "$export_symbols" && test -n "$include_expsyms"; then | ||
| 3808 | $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' | ||
| 3809 | fi | ||
| 3810 | |||
| 3811 | nigel | 75 | tmp_deplibs= |
| 3812 | for test_deplib in $deplibs; do | ||
| 3813 | case " $convenience " in | ||
| 3814 | *" $test_deplib "*) ;; | ||
| 3815 | *) | ||
| 3816 | tmp_deplibs="$tmp_deplibs $test_deplib" | ||
| 3817 | ;; | ||
| 3818 | esac | ||
| 3819 | done | ||
| 3820 | deplibs="$tmp_deplibs" | ||
| 3821 | |||
| 3822 | nigel | 41 | if test -n "$convenience"; then |
| 3823 | if test -n "$whole_archive_flag_spec"; then | ||
| 3824 | nigel | 75 | save_libobjs=$libobjs |
| 3825 | nigel | 41 | eval libobjs=\"\$libobjs $whole_archive_flag_spec\" |
| 3826 | else | ||
| 3827 | gentop="$output_objdir/${outputname}x" | ||
| 3828 | generated="$generated $gentop" | ||
| 3829 | |||
| 3830 | nigel | 75 | func_extract_archives $gentop $convenience |
| 3831 | libobjs="$libobjs $func_extract_archives_result" | ||
| 3832 | nigel | 41 | fi |
| 3833 | fi | ||
| 3834 | nigel | 75 | |
| 3835 | nigel | 41 | if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then |
| 3836 | eval flag=\"$thread_safe_flag_spec\" | ||
| 3837 | nigel | 53 | linker_flags="$linker_flags $flag" |
| 3838 | nigel | 41 | fi |
| 3839 | |||
| 3840 | nigel | 53 | # Make a backup of the uninstalled library when relinking |
| 3841 | if test "$mode" = relink; then | ||
| 3842 | $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? | ||
| 3843 | fi | ||
| 3844 | |||
| 3845 | nigel | 41 | # Do each of the archive commands. |
| 3846 | nigel | 75 | if test "$module" = yes && test -n "$module_cmds" ; then |
| 3847 | if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then | ||
| 3848 | eval test_cmds=\"$module_expsym_cmds\" | ||
| 3849 | cmds=$module_expsym_cmds | ||
| 3850 | else | ||
| 3851 | eval test_cmds=\"$module_cmds\" | ||
| 3852 | cmds=$module_cmds | ||
| 3853 | fi | ||
| 3854 | else | ||
| 3855 | nigel | 41 | if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then |
| 3856 | nigel | 75 | eval test_cmds=\"$archive_expsym_cmds\" |
| 3857 | cmds=$archive_expsym_cmds | ||
| 3858 | nigel | 41 | else |
| 3859 | nigel | 75 | eval test_cmds=\"$archive_cmds\" |
| 3860 | cmds=$archive_cmds | ||
| 3861 | fi | ||
| 3862 | fi | ||
| 3863 | |||
| 3864 | if test "X$skipped_export" != "X:" && len=`expr "X$test_cmds" : ".*"` && | ||
| 3865 | test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then | ||
| 3866 | : | ||
| 3867 | else | ||
| 3868 | # The command line is too long to link in one step, link piecewise. | ||
| 3869 | $echo "creating reloadable object files..." | ||
| 3870 | |||
| 3871 | # Save the value of $output and $libobjs because we want to | ||
| 3872 | # use them later. If we have whole_archive_flag_spec, we | ||
| 3873 | # want to use save_libobjs as it was before | ||
| 3874 | # whole_archive_flag_spec was expanded, because we can't | ||
| 3875 | # assume the linker understands whole_archive_flag_spec. | ||
| 3876 | # This may have to be revisited, in case too many | ||
| 3877 | # convenience libraries get linked in and end up exceeding | ||
| 3878 | # the spec. | ||
| 3879 | if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then | ||
| 3880 | save_libobjs=$libobjs | ||
| 3881 | fi | ||
| 3882 | save_output=$output | ||
| 3883 | |||
| 3884 | # Clear the reloadable object creation command queue and | ||
| 3885 | # initialize k to one. | ||
| 3886 | test_cmds= | ||
| 3887 | concat_cmds= | ||
| 3888 | objlist= | ||
| 3889 | delfiles= | ||
| 3890 | last_robj= | ||
| 3891 | k=1 | ||
| 3892 | output=$output_objdir/$save_output-${k}.$objext | ||
| 3893 | # Loop over the list of objects to be linked. | ||
| 3894 | for obj in $save_libobjs | ||
| 3895 | do | ||
| 3896 | eval test_cmds=\"$reload_cmds $objlist $last_robj\" | ||
| 3897 | if test "X$objlist" = X || | ||
| 3898 | { len=`expr "X$test_cmds" : ".*"` && | ||
| 3899 | test "$len" -le "$max_cmd_len"; }; then | ||
| 3900 | objlist="$objlist $obj" | ||
| 3901 | else | ||
| 3902 | # The command $test_cmds is almost too long, add a | ||
| 3903 | # command to the queue. | ||
| 3904 | if test "$k" -eq 1 ; then | ||
| 3905 | # The first file doesn't have a previous command to add. | ||
| 3906 | eval concat_cmds=\"$reload_cmds $objlist $last_robj\" | ||
| 3907 | else | ||
| 3908 | # All subsequent reloadable object files will link in | ||
| 3909 | # the last one created. | ||
| 3910 | eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" | ||
| 3911 | nigel | 63 | fi |
| 3912 | nigel | 75 | last_robj=$output_objdir/$save_output-${k}.$objext |
| 3913 | k=`expr $k + 1` | ||
| 3914 | output=$output_objdir/$save_output-${k}.$objext | ||
| 3915 | objlist=$obj | ||
| 3916 | len=1 | ||
| 3917 | fi | ||
| 3918 | nigel | 63 | done |
| 3919 | nigel | 75 | # Handle the remaining objects by creating one last |
| 3920 | # reloadable object file. All subsequent reloadable object | ||
| 3921 | # files will link in the last one created. | ||
| 3922 | test -z "$concat_cmds" || concat_cmds=$concat_cmds~ | ||
| 3923 | eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" | ||
| 3924 | |||
| 3925 | if ${skipped_export-false}; then | ||
| 3926 | $show "generating symbol list for \`$libname.la'" | ||
| 3927 | export_symbols="$output_objdir/$libname.exp" | ||
| 3928 | $run $rm $export_symbols | ||
| 3929 | libobjs=$output | ||
| 3930 | # Append the command to create the export file. | ||
| 3931 | eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" | ||
| 3932 | fi | ||
| 3933 | |||
| 3934 | # Set up a command to remove the reloadale object files | ||
| 3935 | # after they are used. | ||
| 3936 | i=0 | ||
| 3937 | while test "$i" -lt "$k" | ||
| 3938 | do | ||
| 3939 | i=`expr $i + 1` | ||
| 3940 | delfiles="$delfiles $output_objdir/$save_output-${i}.$objext" | ||
| 3941 | done | ||
| 3942 | |||
| 3943 | $echo "creating a temporary reloadable object file: $output" | ||
| 3944 | |||
| 3945 | # Loop through the commands generated above and execute them. | ||
| 3946 | save_ifs="$IFS"; IFS='~' | ||
| 3947 | for cmd in $concat_cmds; do | ||
| 3948 | IFS="$save_ifs" | ||
| 3949 | $show "$cmd" | ||
| 3950 | $run eval "$cmd" || exit $? | ||
| 3951 | done | ||
| 3952 | IFS="$save_ifs" | ||
| 3953 | |||
| 3954 | libobjs=$output | ||
| 3955 | # Restore the value of output. | ||
| 3956 | output=$save_output | ||
| 3957 | |||