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