ltmain.sh revision ab902922
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, 2005, 2006, 5# 2007, 2008 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, 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 27basename="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. 34progpath="$0" 35 36# define SED for historic ltconfig's generated by Libtool 1.3 37test -z "$SED" && SED=sed 38 39# The name of this program: 40progname=`echo "$progpath" | $SED $basename` 41modename="$progname" 42 43# Global variables: 44EXIT_SUCCESS=0 45EXIT_FAILURE=1 46 47PROGRAM=ltmain.sh 48PACKAGE=libtool 49VERSION=1.5.26 50TIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)" 51 52# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 53if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then 54 emulate sh 55 NULLCMD=: 56 # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which 57 # is contrary to our usage. Disable this feature. 58 alias -g '${1+"$@"}'='"$@"' 59 setopt NO_GLOB_SUBST 60else 61 case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac 62fi 63BIN_SH=xpg4; export BIN_SH # for Tru64 64DUALCASE=1; export DUALCASE # for MKS sh 65 66# Check that we have a working $echo. 67if test "X$1" = X--no-reexec; then 68 # Discard the --no-reexec flag, and continue. 69 shift 70elif test "X$1" = X--fallback-echo; then 71 # Avoid inline document here, it may be left over 72 : 73elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 74 # Yippee, $echo works! 75 : 76else 77 # Restart under the correct shell, and then maybe $echo will work. 78 exec $SHELL "$progpath" --no-reexec ${1+"$@"} 79fi 80 81if test "X$1" = X--fallback-echo; then 82 # used as fallback echo 83 shift 84 cat <<EOF 85$* 86EOF 87 exit $EXIT_SUCCESS 88fi 89 90default_mode= 91help="Try \`$progname --help' for more information." 92magic="%%%MAGIC variable%%%" 93mkdir="mkdir" 94mv="mv -f" 95rm="rm -f" 96 97# Sed substitution that helps us do robust quoting. It backslashifies 98# metacharacters that are still active within double-quoted strings. 99Xsed="${SED}"' -e 1s/^X//' 100sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 101# test EBCDIC or ASCII 102case `echo X|tr X '\101'` in 103 A) # ASCII based system 104 # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr 105 SP2NL='tr \040 \012' 106 NL2SP='tr \015\012 \040\040' 107 ;; 108 *) # EBCDIC based system 109 SP2NL='tr \100 \n' 110 NL2SP='tr \r\n \100\100' 111 ;; 112esac 113 114# NLS nuisances. 115# Only set LANG and LC_ALL to C if already set. 116# These must not be set unconditionally because not all systems understand 117# e.g. LANG=C (notably SCO). 118# We save the old values to restore during execute mode. 119lt_env= 120for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 121do 122 eval "if test \"\${$lt_var+set}\" = set; then 123 save_$lt_var=\$$lt_var 124 lt_env=\"$lt_var=\$$lt_var \$lt_env\" 125 $lt_var=C 126 export $lt_var 127 fi" 128done 129 130if test -n "$lt_env"; then 131 lt_env="env $lt_env" 132fi 133 134# Make sure IFS has a sensible default 135lt_nl=' 136' 137IFS=" $lt_nl" 138 139if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 140 $echo "$modename: not configured to build any kind of library" 1>&2 141 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 142 exit $EXIT_FAILURE 143fi 144 145# Global variables. 146mode=$default_mode 147nonopt= 148prev= 149prevopt= 150run= 151show="$echo" 152show_help= 153execute_dlfiles= 154duplicate_deps=no 155preserve_args= 156lo2o="s/\\.lo\$/.${objext}/" 157o2lo="s/\\.${objext}\$/.lo/" 158extracted_archives= 159extracted_serial=0 160 161##################################### 162# Shell function definitions: 163# This seems to be the best place for them 164 165# func_mktempdir [string] 166# Make a temporary directory that won't clash with other running 167# libtool processes, and avoids race conditions if possible. If 168# given, STRING is the basename for that directory. 169func_mktempdir () 170{ 171 my_template="${TMPDIR-/tmp}/${1-$progname}" 172 173 if test "$run" = ":"; then 174 # Return a directory name, but don't create it in dry-run mode 175 my_tmpdir="${my_template}-$$" 176 else 177 178 # If mktemp works, use that first and foremost 179 my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` 180 181 if test ! -d "$my_tmpdir"; then 182 # Failing that, at least try and use $RANDOM to avoid a race 183 my_tmpdir="${my_template}-${RANDOM-0}$$" 184 185 save_mktempdir_umask=`umask` 186 umask 0077 187 $mkdir "$my_tmpdir" 188 umask $save_mktempdir_umask 189 fi 190 191 # If we're not in dry-run mode, bomb out on failure 192 test -d "$my_tmpdir" || { 193 $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2 194 exit $EXIT_FAILURE 195 } 196 fi 197 198 $echo "X$my_tmpdir" | $Xsed 199} 200 201 202# func_win32_libid arg 203# return the library type of file 'arg' 204# 205# Need a lot of goo to handle *both* DLLs and import libs 206# Has to be a shell function in order to 'eat' the argument 207# that is supplied when $file_magic_command is called. 208func_win32_libid () 209{ 210 win32_libid_type="unknown" 211 win32_fileres=`file -L $1 2>/dev/null` 212 case $win32_fileres in 213 *ar\ archive\ import\ library*) # definitely import 214 win32_libid_type="x86 archive import" 215 ;; 216 *ar\ archive*) # could be an import, or static 217 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 218 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 219 win32_nmres=`eval $NM -f posix -A $1 | \ 220 $SED -n -e '1,100{ 221 / I /{ 222 s,.*,import, 223 p 224 q 225 } 226 }'` 227 case $win32_nmres in 228 import*) win32_libid_type="x86 archive import";; 229 *) win32_libid_type="x86 archive static";; 230 esac 231 fi 232 ;; 233 *DLL*) 234 win32_libid_type="x86 DLL" 235 ;; 236 *executable*) # but shell scripts are "executable" too... 237 case $win32_fileres in 238 *MS\ Windows\ PE\ Intel*) 239 win32_libid_type="x86 DLL" 240 ;; 241 esac 242 ;; 243 esac 244 $echo $win32_libid_type 245} 246 247 248# func_infer_tag arg 249# Infer tagged configuration to use if any are available and 250# if one wasn't chosen via the "--tag" command line option. 251# Only attempt this if the compiler in the base compile 252# command doesn't match the default compiler. 253# arg is usually of the form 'gcc ...' 254func_infer_tag () 255{ 256 if test -n "$available_tags" && test -z "$tagname"; then 257 CC_quoted= 258 for arg in $CC; do 259 case $arg in 260 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 261 arg="\"$arg\"" 262 ;; 263 esac 264 CC_quoted="$CC_quoted $arg" 265 done 266 case $@ in 267 # Blanks in the command may have been stripped by the calling shell, 268 # but not from the CC environment variable when configure was run. 269 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; 270 # Blanks at the start of $base_compile will cause this to fail 271 # if we don't check for them as well. 272 *) 273 for z in $available_tags; do 274 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 275 # Evaluate the configuration. 276 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 277 CC_quoted= 278 for arg in $CC; do 279 # Double-quote args containing other shell metacharacters. 280 case $arg in 281 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 282 arg="\"$arg\"" 283 ;; 284 esac 285 CC_quoted="$CC_quoted $arg" 286 done 287 case "$@ " in 288 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) 289 # The compiler in the base compile command matches 290 # the one in the tagged configuration. 291 # Assume this is the tagged configuration we want. 292 tagname=$z 293 break 294 ;; 295 esac 296 fi 297 done 298 # If $tagname still isn't set, then no tagged configuration 299 # was found and let the user know that the "--tag" command 300 # line option must be used. 301 if test -z "$tagname"; then 302 $echo "$modename: unable to infer tagged configuration" 303 $echo "$modename: specify a tag with \`--tag'" 1>&2 304 exit $EXIT_FAILURE 305# else 306# $echo "$modename: using $tagname tagged configuration" 307 fi 308 ;; 309 esac 310 fi 311} 312 313 314# func_extract_an_archive dir oldlib 315func_extract_an_archive () 316{ 317 f_ex_an_ar_dir="$1"; shift 318 f_ex_an_ar_oldlib="$1" 319 320 $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)" 321 $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $? 322 if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then 323 : 324 else 325 $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2 326 exit $EXIT_FAILURE 327 fi 328} 329 330# func_extract_archives gentop oldlib ... 331func_extract_archives () 332{ 333 my_gentop="$1"; shift 334 my_oldlibs=${1+"$@"} 335 my_oldobjs="" 336 my_xlib="" 337 my_xabs="" 338 my_xdir="" 339 my_status="" 340 341 $show "${rm}r $my_gentop" 342 $run ${rm}r "$my_gentop" 343 $show "$mkdir $my_gentop" 344 $run $mkdir "$my_gentop" 345 my_status=$? 346 if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then 347 exit $my_status 348 fi 349 350 for my_xlib in $my_oldlibs; do 351 # Extract the objects. 352 case $my_xlib in 353 [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; 354 *) my_xabs=`pwd`"/$my_xlib" ;; 355 esac 356 my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'` 357 my_xlib_u=$my_xlib 358 while :; do 359 case " $extracted_archives " in 360 *" $my_xlib_u "*) 361 extracted_serial=`expr $extracted_serial + 1` 362 my_xlib_u=lt$extracted_serial-$my_xlib ;; 363 *) break ;; 364 esac 365 done 366 extracted_archives="$extracted_archives $my_xlib_u" 367 my_xdir="$my_gentop/$my_xlib_u" 368 369 $show "${rm}r $my_xdir" 370 $run ${rm}r "$my_xdir" 371 $show "$mkdir $my_xdir" 372 $run $mkdir "$my_xdir" 373 exit_status=$? 374 if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then 375 exit $exit_status 376 fi 377 case $host in 378 *-darwin*) 379 $show "Extracting $my_xabs" 380 # Do not bother doing anything if just a dry run 381 if test -z "$run"; then 382 darwin_orig_dir=`pwd` 383 cd $my_xdir || exit $? 384 darwin_archive=$my_xabs 385 darwin_curdir=`pwd` 386 darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'` 387 darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null` 388 if test -n "$darwin_arches"; then 389 darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'` 390 darwin_arch= 391 $show "$darwin_base_archive has multiple architectures $darwin_arches" 392 for darwin_arch in $darwin_arches ; do 393 mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}" 394 lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" 395 cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" 396 func_extract_an_archive "`pwd`" "${darwin_base_archive}" 397 cd "$darwin_curdir" 398 $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" 399 done # $darwin_arches 400 ## Okay now we have a bunch of thin objects, gotta fatten them up :) 401 darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP` 402 darwin_file= 403 darwin_files= 404 for darwin_file in $darwin_filelist; do 405 darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP` 406 lipo -create -output "$darwin_file" $darwin_files 407 done # $darwin_filelist 408 ${rm}r unfat-$$ 409 cd "$darwin_orig_dir" 410 else 411 cd "$darwin_orig_dir" 412 func_extract_an_archive "$my_xdir" "$my_xabs" 413 fi # $darwin_arches 414 fi # $run 415 ;; 416 *) 417 func_extract_an_archive "$my_xdir" "$my_xabs" 418 ;; 419 esac 420 my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP` 421 done 422 func_extract_archives_result="$my_oldobjs" 423} 424# End of Shell function definitions 425##################################### 426 427# Darwin sucks 428eval std_shrext=\"$shrext_cmds\" 429 430disable_libs=no 431 432# Parse our command line options once, thoroughly. 433while test "$#" -gt 0 434do 435 arg="$1" 436 shift 437 438 case $arg in 439 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 440 *) optarg= ;; 441 esac 442 443 # If the previous option needs an argument, assign it. 444 if test -n "$prev"; then 445 case $prev in 446 execute_dlfiles) 447 execute_dlfiles="$execute_dlfiles $arg" 448 ;; 449 tag) 450 tagname="$arg" 451 preserve_args="${preserve_args}=$arg" 452 453 # Check whether tagname contains only valid characters 454 case $tagname in 455 *[!-_A-Za-z0-9,/]*) 456 $echo "$progname: invalid tag name: $tagname" 1>&2 457 exit $EXIT_FAILURE 458 ;; 459 esac 460 461 case $tagname in 462 CC) 463 # Don't test for the "default" C tag, as we know, it's there, but 464 # not specially marked. 465 ;; 466 *) 467 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 468 taglist="$taglist $tagname" 469 # Evaluate the configuration. 470 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 471 else 472 $echo "$progname: ignoring unknown tag $tagname" 1>&2 473 fi 474 ;; 475 esac 476 ;; 477 *) 478 eval "$prev=\$arg" 479 ;; 480 esac 481 482 prev= 483 prevopt= 484 continue 485 fi 486 487 # Have we seen a non-optional argument yet? 488 case $arg in 489 --help) 490 show_help=yes 491 ;; 492 493 --version) 494 echo "\ 495$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP 496 497Copyright (C) 2008 Free Software Foundation, Inc. 498This is free software; see the source for copying conditions. There is NO 499warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 500 exit $? 501 ;; 502 503 --config) 504 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 505 # Now print the configurations for the tags. 506 for tagname in $taglist; do 507 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 508 done 509 exit $? 510 ;; 511 512 --debug) 513 $echo "$progname: enabling shell trace mode" 514 set -x 515 preserve_args="$preserve_args $arg" 516 ;; 517 518 --dry-run | -n) 519 run=: 520 ;; 521 522 --features) 523 $echo "host: $host" 524 if test "$build_libtool_libs" = yes; then 525 $echo "enable shared libraries" 526 else 527 $echo "disable shared libraries" 528 fi 529 if test "$build_old_libs" = yes; then 530 $echo "enable static libraries" 531 else 532 $echo "disable static libraries" 533 fi 534 exit $? 535 ;; 536 537 --finish) mode="finish" ;; 538 539 --mode) prevopt="--mode" prev=mode ;; 540 --mode=*) mode="$optarg" ;; 541 542 --preserve-dup-deps) duplicate_deps="yes" ;; 543 544 --quiet | --silent) 545 show=: 546 preserve_args="$preserve_args $arg" 547 ;; 548 549 --tag) 550 prevopt="--tag" 551 prev=tag 552 preserve_args="$preserve_args --tag" 553 ;; 554 --tag=*) 555 set tag "$optarg" ${1+"$@"} 556 shift 557 prev=tag 558 preserve_args="$preserve_args --tag" 559 ;; 560 561 -dlopen) 562 prevopt="-dlopen" 563 prev=execute_dlfiles 564 ;; 565 566 -*) 567 $echo "$modename: unrecognized option \`$arg'" 1>&2 568 $echo "$help" 1>&2 569 exit $EXIT_FAILURE 570 ;; 571 572 *) 573 nonopt="$arg" 574 break 575 ;; 576 esac 577done 578 579if test -n "$prevopt"; then 580 $echo "$modename: option \`$prevopt' requires an argument" 1>&2 581 $echo "$help" 1>&2 582 exit $EXIT_FAILURE 583fi 584 585case $disable_libs in 586no) 587 ;; 588shared) 589 build_libtool_libs=no 590 build_old_libs=yes 591 ;; 592static) 593 build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` 594 ;; 595esac 596 597# If this variable is set in any of the actions, the command in it 598# will be execed at the end. This prevents here-documents from being 599# left over by shells. 600exec_cmd= 601 602if test -z "$show_help"; then 603 604 # Infer the operation mode. 605 if test -z "$mode"; then 606 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 607 $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2 608 case $nonopt in 609 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 610 mode=link 611 for arg 612 do 613 case $arg in 614 -c) 615 mode=compile 616 break 617 ;; 618 esac 619 done 620 ;; 621 *db | *dbx | *strace | *truss) 622 mode=execute 623 ;; 624 *install*|cp|mv) 625 mode=install 626 ;; 627 *rm) 628 mode=uninstall 629 ;; 630 *) 631 # If we have no mode, but dlfiles were specified, then do execute mode. 632 test -n "$execute_dlfiles" && mode=execute 633 634 # Just use the default operation mode. 635 if test -z "$mode"; then 636 if test -n "$nonopt"; then 637 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 638 else 639 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 640 fi 641 fi 642 ;; 643 esac 644 fi 645 646 # Only execute mode is allowed to have -dlopen flags. 647 if test -n "$execute_dlfiles" && test "$mode" != execute; then 648 $echo "$modename: unrecognized option \`-dlopen'" 1>&2 649 $echo "$help" 1>&2 650 exit $EXIT_FAILURE 651 fi 652 653 # Change the help message to a mode-specific one. 654 generic_help="$help" 655 help="Try \`$modename --help --mode=$mode' for more information." 656 657 # These modes are in order of execution frequency so that they run quickly. 658 case $mode in 659 # libtool compile mode 660 compile) 661 modename="$modename: compile" 662 # Get the compilation command and the source file. 663 base_compile= 664 srcfile="$nonopt" # always keep a non-empty value in "srcfile" 665 suppress_opt=yes 666 suppress_output= 667 arg_mode=normal 668 libobj= 669 later= 670 671 for arg 672 do 673 case $arg_mode in 674 arg ) 675 # do not "continue". Instead, add this to base_compile 676 lastarg="$arg" 677 arg_mode=normal 678 ;; 679 680 target ) 681 libobj="$arg" 682 arg_mode=normal 683 continue 684 ;; 685 686 normal ) 687 # Accept any command-line options. 688 case $arg in 689 -o) 690 if test -n "$libobj" ; then 691 $echo "$modename: you cannot specify \`-o' more than once" 1>&2 692 exit $EXIT_FAILURE 693 fi 694 arg_mode=target 695 continue 696 ;; 697 698 -static | -prefer-pic | -prefer-non-pic) 699 later="$later $arg" 700 continue 701 ;; 702 703 -no-suppress) 704 suppress_opt=no 705 continue 706 ;; 707 708 -Xcompiler) 709 arg_mode=arg # the next one goes into the "base_compile" arg list 710 continue # The current "srcfile" will either be retained or 711 ;; # replaced later. I would guess that would be a bug. 712 713 -Wc,*) 714 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 715 lastarg= 716 save_ifs="$IFS"; IFS=',' 717 for arg in $args; do 718 IFS="$save_ifs" 719 720 # Double-quote args containing other shell metacharacters. 721 # Many Bourne shells cannot handle close brackets correctly 722 # in scan sets, so we specify it separately. 723 case $arg in 724 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 725 arg="\"$arg\"" 726 ;; 727 esac 728 lastarg="$lastarg $arg" 729 done 730 IFS="$save_ifs" 731 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 732 733 # Add the arguments to base_compile. 734 base_compile="$base_compile $lastarg" 735 continue 736 ;; 737 738 * ) 739 # Accept the current argument as the source file. 740 # The previous "srcfile" becomes the current argument. 741 # 742 lastarg="$srcfile" 743 srcfile="$arg" 744 ;; 745 esac # case $arg 746 ;; 747 esac # case $arg_mode 748 749 # Aesthetically quote the previous argument. 750 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 751 752 case $lastarg in 753 # Double-quote args containing other shell metacharacters. 754 # Many Bourne shells cannot handle close brackets correctly 755 # in scan sets, and some SunOS ksh mistreat backslash-escaping 756 # in scan sets (worked around with variable expansion), 757 # and furthermore cannot handle '|' '&' '(' ')' in scan sets 758 # at all, so we specify them separately. 759 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 760 lastarg="\"$lastarg\"" 761 ;; 762 esac 763 764 base_compile="$base_compile $lastarg" 765 done # for arg 766 767 case $arg_mode in 768 arg) 769 $echo "$modename: you must specify an argument for -Xcompile" 770 exit $EXIT_FAILURE 771 ;; 772 target) 773 $echo "$modename: you must specify a target with \`-o'" 1>&2 774 exit $EXIT_FAILURE 775 ;; 776 *) 777 # Get the name of the library object. 778 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 779 ;; 780 esac 781 782 # Recognize several different file suffixes. 783 # If the user specifies -o file.o, it is replaced with file.lo 784 xform='[cCFSifmso]' 785 case $libobj in 786 *.ada) xform=ada ;; 787 *.adb) xform=adb ;; 788 *.ads) xform=ads ;; 789 *.asm) xform=asm ;; 790 *.c++) xform=c++ ;; 791 *.cc) xform=cc ;; 792 *.ii) xform=ii ;; 793 *.class) xform=class ;; 794 *.cpp) xform=cpp ;; 795 *.cxx) xform=cxx ;; 796 *.[fF][09]?) xform=[fF][09]. ;; 797 *.for) xform=for ;; 798 *.java) xform=java ;; 799 *.obj) xform=obj ;; 800 *.sx) xform=sx ;; 801 esac 802 803 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 804 805 case $libobj in 806 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 807 *) 808 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 809 exit $EXIT_FAILURE 810 ;; 811 esac 812 813 func_infer_tag $base_compile 814 815 for arg in $later; do 816 case $arg in 817 -static) 818 build_old_libs=yes 819 continue 820 ;; 821 822 -prefer-pic) 823 pic_mode=yes 824 continue 825 ;; 826 827 -prefer-non-pic) 828 pic_mode=no 829 continue 830 ;; 831 esac 832 done 833 834 qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"` 835 case $qlibobj in 836 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 837 qlibobj="\"$qlibobj\"" ;; 838 esac 839 test "X$libobj" != "X$qlibobj" \ 840 && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \ 841 && $echo "$modename: libobj name \`$libobj' may not contain shell special characters." 842 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 843 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 844 if test "X$xdir" = "X$obj"; then 845 xdir= 846 else 847 xdir=$xdir/ 848 fi 849 lobj=${xdir}$objdir/$objname 850 851 if test -z "$base_compile"; then 852 $echo "$modename: you must specify a compilation command" 1>&2 853 $echo "$help" 1>&2 854 exit $EXIT_FAILURE 855 fi 856 857 # Delete any leftover library objects. 858 if test "$build_old_libs" = yes; then 859 removelist="$obj $lobj $libobj ${libobj}T" 860 else 861 removelist="$lobj $libobj ${libobj}T" 862 fi 863 864 $run $rm $removelist 865 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 866 867 # On Cygwin there's no "real" PIC flag so we must build both object types 868 case $host_os in 869 cygwin* | mingw* | pw32* | os2*) 870 pic_mode=default 871 ;; 872 esac 873 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 874 # non-PIC code in shared libraries is not supported 875 pic_mode=default 876 fi 877 878 # Calculate the filename of the output object if compiler does 879 # not support -o with -c 880 if test "$compiler_c_o" = no; then 881 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 882 lockfile="$output_obj.lock" 883 removelist="$removelist $output_obj $lockfile" 884 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 885 else 886 output_obj= 887 need_locks=no 888 lockfile= 889 fi 890 891 # Lock this critical section if it is needed 892 # We use this script file to make the link, it avoids creating a new file 893 if test "$need_locks" = yes; then 894 until $run ln "$progpath" "$lockfile" 2>/dev/null; do 895 $show "Waiting for $lockfile to be removed" 896 sleep 2 897 done 898 elif test "$need_locks" = warn; then 899 if test -f "$lockfile"; then 900 $echo "\ 901*** ERROR, $lockfile exists and contains: 902`cat $lockfile 2>/dev/null` 903 904This indicates that another process is trying to use the same 905temporary object file, and libtool could not work around it because 906your compiler does not support \`-c' and \`-o' together. If you 907repeat this compilation, it may succeed, by chance, but you had better 908avoid parallel builds (make -j) in this platform, or get a better 909compiler." 910 911 $run $rm $removelist 912 exit $EXIT_FAILURE 913 fi 914 $echo "$srcfile" > "$lockfile" 915 fi 916 917 if test -n "$fix_srcfile_path"; then 918 eval srcfile=\"$fix_srcfile_path\" 919 fi 920 qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"` 921 case $qsrcfile in 922 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 923 qsrcfile="\"$qsrcfile\"" ;; 924 esac 925 926 $run $rm "$libobj" "${libobj}T" 927 928 # Create a libtool object file (analogous to a ".la" file), 929 # but don't create it if we're doing a dry run. 930 test -z "$run" && cat > ${libobj}T <<EOF 931# $libobj - a libtool object file 932# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 933# 934# Please DO NOT delete this file! 935# It is necessary for linking the library. 936 937# Name of the PIC object. 938EOF 939 940 # Only build a PIC object if we are building libtool libraries. 941 if test "$build_libtool_libs" = yes; then 942 # Without this assignment, base_compile gets emptied. 943 fbsd_hideous_sh_bug=$base_compile 944 945 if test "$pic_mode" != no; then 946 command="$base_compile $qsrcfile $pic_flag" 947 else 948 # Don't build PIC code 949 command="$base_compile $qsrcfile" 950 fi 951 952 if test ! -d "${xdir}$objdir"; then 953 $show "$mkdir ${xdir}$objdir" 954 $run $mkdir ${xdir}$objdir 955 exit_status=$? 956 if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then 957 exit $exit_status 958 fi 959 fi 960 961 if test -z "$output_obj"; then 962 # Place PIC objects in $objdir 963 command="$command -o $lobj" 964 fi 965 966 $run $rm "$lobj" "$output_obj" 967 968 $show "$command" 969 if $run eval $lt_env "$command"; then : 970 else 971 test -n "$output_obj" && $run $rm $removelist 972 exit $EXIT_FAILURE 973 fi 974 975 if test "$need_locks" = warn && 976 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 977 $echo "\ 978*** ERROR, $lockfile contains: 979`cat $lockfile 2>/dev/null` 980 981but it should contain: 982$srcfile 983 984This indicates that another process is trying to use the same 985temporary object file, and libtool could not work around it because 986your compiler does not support \`-c' and \`-o' together. If you 987repeat this compilation, it may succeed, by chance, but you had better 988avoid parallel builds (make -j) in this platform, or get a better 989compiler." 990 991 $run $rm $removelist 992 exit $EXIT_FAILURE 993 fi 994 995 # Just move the object if needed, then go on to compile the next one 996 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 997 $show "$mv $output_obj $lobj" 998 if $run $mv $output_obj $lobj; then : 999 else 1000 error=$? 1001 $run $rm $removelist 1002 exit $error 1003 fi 1004 fi 1005 1006 # Append the name of the PIC object to the libtool object file. 1007 test -z "$run" && cat >> ${libobj}T <<EOF 1008pic_object='$objdir/$objname' 1009 1010EOF 1011 1012 # Allow error messages only from the first compilation. 1013 if test "$suppress_opt" = yes; then 1014 suppress_output=' >/dev/null 2>&1' 1015 fi 1016 else 1017 # No PIC object so indicate it doesn't exist in the libtool 1018 # object file. 1019 test -z "$run" && cat >> ${libobj}T <<EOF 1020pic_object=none 1021 1022EOF 1023 fi 1024 1025 # Only build a position-dependent object if we build old libraries. 1026 if test "$build_old_libs" = yes; then 1027 if test "$pic_mode" != yes; then 1028 # Don't build PIC code 1029 command="$base_compile $qsrcfile" 1030 else 1031 command="$base_compile $qsrcfile $pic_flag" 1032 fi 1033 if test "$compiler_c_o" = yes; then 1034 command="$command -o $obj" 1035 fi 1036 1037 # Suppress compiler output if we already did a PIC compilation. 1038 command="$command$suppress_output" 1039 $run $rm "$obj" "$output_obj" 1040 $show "$command" 1041 if $run eval $lt_env "$command"; then : 1042 else 1043 $run $rm $removelist 1044 exit $EXIT_FAILURE 1045 fi 1046 1047 if test "$need_locks" = warn && 1048 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 1049 $echo "\ 1050*** ERROR, $lockfile contains: 1051`cat $lockfile 2>/dev/null` 1052 1053but it should contain: 1054$srcfile 1055 1056This indicates that another process is trying to use the same 1057temporary object file, and libtool could not work around it because 1058your compiler does not support \`-c' and \`-o' together. If you 1059repeat this compilation, it may succeed, by chance, but you had better 1060avoid parallel builds (make -j) in this platform, or get a better 1061compiler." 1062 1063 $run $rm $removelist 1064 exit $EXIT_FAILURE 1065 fi 1066 1067 # Just move the object if needed 1068 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 1069 $show "$mv $output_obj $obj" 1070 if $run $mv $output_obj $obj; then : 1071 else 1072 error=$? 1073 $run $rm $removelist 1074 exit $error 1075 fi 1076 fi 1077 1078 # Append the name of the non-PIC object the libtool object file. 1079 # Only append if the libtool object file exists. 1080 test -z "$run" && cat >> ${libobj}T <<EOF 1081# Name of the non-PIC object. 1082non_pic_object='$objname' 1083 1084EOF 1085 else 1086 # Append the name of the non-PIC object the libtool object file. 1087 # Only append if the libtool object file exists. 1088 test -z "$run" && cat >> ${libobj}T <<EOF 1089# Name of the non-PIC object. 1090non_pic_object=none 1091 1092EOF 1093 fi 1094 1095 $run $mv "${libobj}T" "${libobj}" 1096 1097 # Unlock the critical section if it was locked 1098 if test "$need_locks" != no; then 1099 $run $rm "$lockfile" 1100 fi 1101 1102 exit $EXIT_SUCCESS 1103 ;; 1104 1105 # libtool link mode 1106 link | relink) 1107 modename="$modename: link" 1108 case $host in 1109 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1110 # It is impossible to link a dll without this setting, and 1111 # we shouldn't force the makefile maintainer to figure out 1112 # which system we are compiling for in order to pass an extra 1113 # flag for every libtool invocation. 1114 # allow_undefined=no 1115 1116 # FIXME: Unfortunately, there are problems with the above when trying 1117 # to make a dll which has undefined symbols, in which case not 1118 # even a static library is built. For now, we need to specify 1119 # -no-undefined on the libtool link line when we can be certain 1120 # that all symbols are satisfied, otherwise we get a static library. 1121 allow_undefined=yes 1122 ;; 1123 *) 1124 allow_undefined=yes 1125 ;; 1126 esac 1127 libtool_args="$nonopt" 1128 base_compile="$nonopt $@" 1129 compile_command="$nonopt" 1130 finalize_command="$nonopt" 1131 1132 compile_rpath= 1133 finalize_rpath= 1134 compile_shlibpath= 1135 finalize_shlibpath= 1136 convenience= 1137 old_convenience= 1138 deplibs= 1139 old_deplibs= 1140 compiler_flags= 1141 linker_flags= 1142 dllsearchpath= 1143 lib_search_path=`pwd` 1144 inst_prefix_dir= 1145 1146 avoid_version=no 1147 dlfiles= 1148 dlprefiles= 1149 dlself=no 1150 export_dynamic=no 1151 export_symbols= 1152 export_symbols_regex= 1153 generated= 1154 libobjs= 1155 ltlibs= 1156 module=no 1157 no_install=no 1158 objs= 1159 non_pic_objects= 1160 notinst_path= # paths that contain not-installed libtool libraries 1161 precious_files_regex= 1162 prefer_static_libs=no 1163 preload=no 1164 prev= 1165 prevarg= 1166 release= 1167 rpath= 1168 xrpath= 1169 perm_rpath= 1170 temp_rpath= 1171 thread_safe=no 1172 vinfo= 1173 vinfo_number=no 1174 single_module="${wl}-single_module" 1175 1176 func_infer_tag $base_compile 1177 1178 # We need to know -static, to get the right output filenames. 1179 for arg 1180 do 1181 case $arg in 1182 -all-static | -static | -static-libtool-libs) 1183 case $arg in 1184 -all-static) 1185 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 1186 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 1187 fi 1188 if test -n "$link_static_flag"; then 1189 dlopen_self=$dlopen_self_static 1190 fi 1191 prefer_static_libs=yes 1192 ;; 1193 -static) 1194 if test -z "$pic_flag" && test -n "$link_static_flag"; then 1195 dlopen_self=$dlopen_self_static 1196 fi 1197 prefer_static_libs=built 1198 ;; 1199 -static-libtool-libs) 1200 if test -z "$pic_flag" && test -n "$link_static_flag"; then 1201 dlopen_self=$dlopen_self_static 1202 fi 1203 prefer_static_libs=yes 1204 ;; 1205 esac 1206 build_libtool_libs=no 1207 build_old_libs=yes 1208 break 1209 ;; 1210 esac 1211 done 1212 1213 # See if our shared archives depend on static archives. 1214 test -n "$old_archive_from_new_cmds" && build_old_libs=yes 1215 1216 # Go through the arguments, transforming them on the way. 1217 while test "$#" -gt 0; do 1218 arg="$1" 1219 shift 1220 case $arg in 1221 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1222 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 1223 ;; 1224 *) qarg=$arg ;; 1225 esac 1226 libtool_args="$libtool_args $qarg" 1227 1228 # If the previous option needs an argument, assign it. 1229 if test -n "$prev"; then 1230 case $prev in 1231 output) 1232 compile_command="$compile_command @OUTPUT@" 1233 finalize_command="$finalize_command @OUTPUT@" 1234 ;; 1235 esac 1236 1237 case $prev in 1238 dlfiles|dlprefiles) 1239 if test "$preload" = no; then 1240 # Add the symbol object into the linking commands. 1241 compile_command="$compile_command @SYMFILE@" 1242 finalize_command="$finalize_command @SYMFILE@" 1243 preload=yes 1244 fi 1245 case $arg in 1246 *.la | *.lo) ;; # We handle these cases below. 1247 force) 1248 if test "$dlself" = no; then 1249 dlself=needless 1250 export_dynamic=yes 1251 fi 1252 prev= 1253 continue 1254 ;; 1255 self) 1256 if test "$prev" = dlprefiles; then 1257 dlself=yes 1258 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 1259 dlself=yes 1260 else 1261 dlself=needless 1262 export_dynamic=yes 1263 fi 1264 prev= 1265 continue 1266 ;; 1267 *) 1268 if test "$prev" = dlfiles; then 1269 dlfiles="$dlfiles $arg" 1270 else 1271 dlprefiles="$dlprefiles $arg" 1272 fi 1273 prev= 1274 continue 1275 ;; 1276 esac 1277 ;; 1278 expsyms) 1279 export_symbols="$arg" 1280 if test ! -f "$arg"; then 1281 $echo "$modename: symbol file \`$arg' does not exist" 1282 exit $EXIT_FAILURE 1283 fi 1284 prev= 1285 continue 1286 ;; 1287 expsyms_regex) 1288 export_symbols_regex="$arg" 1289 prev= 1290 continue 1291 ;; 1292 inst_prefix) 1293 inst_prefix_dir="$arg" 1294 prev= 1295 continue 1296 ;; 1297 precious_regex) 1298 precious_files_regex="$arg" 1299 prev= 1300 continue 1301 ;; 1302 release) 1303 release="-$arg" 1304 prev= 1305 continue 1306 ;; 1307 objectlist) 1308 if test -f "$arg"; then 1309 save_arg=$arg 1310 moreargs= 1311 for fil in `cat $save_arg` 1312 do 1313# moreargs="$moreargs $fil" 1314 arg=$fil 1315 # A libtool-controlled object. 1316 1317 # Check to see that this really is a libtool object. 1318 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1319 pic_object= 1320 non_pic_object= 1321 1322 # Read the .lo file 1323 # If there is no directory component, then add one. 1324 case $arg in 1325 */* | *\\*) . $arg ;; 1326 *) . ./$arg ;; 1327 esac 1328 1329 if test -z "$pic_object" || \ 1330 test -z "$non_pic_object" || 1331 test "$pic_object" = none && \ 1332 test "$non_pic_object" = none; then 1333 $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1334 exit $EXIT_FAILURE 1335 fi 1336 1337 # Extract subdirectory from the argument. 1338 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1339 if test "X$xdir" = "X$arg"; then 1340 xdir= 1341 else 1342 xdir="$xdir/" 1343 fi 1344 1345 if test "$pic_object" != none; then 1346 # Prepend the subdirectory the object is found in. 1347 pic_object="$xdir$pic_object" 1348 1349 if test "$prev" = dlfiles; then 1350 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1351 dlfiles="$dlfiles $pic_object" 1352 prev= 1353 continue 1354 else 1355 # If libtool objects are unsupported, then we need to preload. 1356 prev=dlprefiles 1357 fi 1358 fi 1359 1360 # CHECK ME: I think I busted this. -Ossama 1361 if test "$prev" = dlprefiles; then 1362 # Preload the old-style object. 1363 dlprefiles="$dlprefiles $pic_object" 1364 prev= 1365 fi 1366 1367 # A PIC object. 1368 libobjs="$libobjs $pic_object" 1369 arg="$pic_object" 1370 fi 1371 1372 # Non-PIC object. 1373 if test "$non_pic_object" != none; then 1374 # Prepend the subdirectory the object is found in. 1375 non_pic_object="$xdir$non_pic_object" 1376 1377 # A standard non-PIC object 1378 non_pic_objects="$non_pic_objects $non_pic_object" 1379 if test -z "$pic_object" || test "$pic_object" = none ; then 1380 arg="$non_pic_object" 1381 fi 1382 else 1383 # If the PIC object exists, use it instead. 1384 # $xdir was prepended to $pic_object above. 1385 non_pic_object="$pic_object" 1386 non_pic_objects="$non_pic_objects $non_pic_object" 1387 fi 1388 else 1389 # Only an error if not doing a dry-run. 1390 if test -z "$run"; then 1391 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1392 exit $EXIT_FAILURE 1393 else 1394 # Dry-run case. 1395 1396 # Extract subdirectory from the argument. 1397 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1398 if test "X$xdir" = "X$arg"; then 1399 xdir= 1400 else 1401 xdir="$xdir/" 1402 fi 1403 1404 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1405 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1406 libobjs="$libobjs $pic_object" 1407 non_pic_objects="$non_pic_objects $non_pic_object" 1408 fi 1409 fi 1410 done 1411 else 1412 $echo "$modename: link input file \`$save_arg' does not exist" 1413 exit $EXIT_FAILURE 1414 fi 1415 arg=$save_arg 1416 prev= 1417 continue 1418 ;; 1419 rpath | xrpath) 1420 # We need an absolute path. 1421 case $arg in 1422 [\\/]* | [A-Za-z]:[\\/]*) ;; 1423 *) 1424 $echo "$modename: only absolute run-paths are allowed" 1>&2 1425 exit $EXIT_FAILURE 1426 ;; 1427 esac 1428 if test "$prev" = rpath; then 1429 case "$rpath " in 1430 *" $arg "*) ;; 1431 *) rpath="$rpath $arg" ;; 1432 esac 1433 else 1434 case "$xrpath " in 1435 *" $arg "*) ;; 1436 *) xrpath="$xrpath $arg" ;; 1437 esac 1438 fi 1439 prev= 1440 continue 1441 ;; 1442 xcompiler) 1443 compiler_flags="$compiler_flags $qarg" 1444 prev= 1445 compile_command="$compile_command $qarg" 1446 finalize_command="$finalize_command $qarg" 1447 continue 1448 ;; 1449 xlinker) 1450 linker_flags="$linker_flags $qarg" 1451 compiler_flags="$compiler_flags $wl$qarg" 1452 prev= 1453 compile_command="$compile_command $wl$qarg" 1454 finalize_command="$finalize_command $wl$qarg" 1455 continue 1456 ;; 1457 xcclinker) 1458 linker_flags="$linker_flags $qarg" 1459 compiler_flags="$compiler_flags $qarg" 1460 prev= 1461 compile_command="$compile_command $qarg" 1462 finalize_command="$finalize_command $qarg" 1463 continue 1464 ;; 1465 shrext) 1466 shrext_cmds="$arg" 1467 prev= 1468 continue 1469 ;; 1470 darwin_framework|darwin_framework_skip) 1471 test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg" 1472 compile_command="$compile_command $arg" 1473 finalize_command="$finalize_command $arg" 1474 prev= 1475 continue 1476 ;; 1477 *) 1478 eval "$prev=\"\$arg\"" 1479 prev= 1480 continue 1481 ;; 1482 esac 1483 fi # test -n "$prev" 1484 1485 prevarg="$arg" 1486 1487 case $arg in 1488 -all-static) 1489 if test -n "$link_static_flag"; then 1490 compile_command="$compile_command $link_static_flag" 1491 finalize_command="$finalize_command $link_static_flag" 1492 fi 1493 continue 1494 ;; 1495 1496 -allow-undefined) 1497 # FIXME: remove this flag sometime in the future. 1498 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 1499 continue 1500 ;; 1501 1502 -avoid-version) 1503 avoid_version=yes 1504 continue 1505 ;; 1506 1507 -dlopen) 1508 prev=dlfiles 1509 continue 1510 ;; 1511 1512 -dlpreopen) 1513 prev=dlprefiles 1514 continue 1515 ;; 1516 1517 -export-dynamic) 1518 export_dynamic=yes 1519 continue 1520 ;; 1521 1522 -export-symbols | -export-symbols-regex) 1523 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 1524 $echo "$modename: more than one -exported-symbols argument is not allowed" 1525 exit $EXIT_FAILURE 1526 fi 1527 if test "X$arg" = "X-export-symbols"; then 1528 prev=expsyms 1529 else 1530 prev=expsyms_regex 1531 fi 1532 continue 1533 ;; 1534 1535 -framework|-arch|-isysroot) 1536 case " $CC " in 1537 *" ${arg} ${1} "* | *" ${arg} ${1} "*) 1538 prev=darwin_framework_skip ;; 1539 *) compiler_flags="$compiler_flags $arg" 1540 prev=darwin_framework ;; 1541 esac 1542 compile_command="$compile_command $arg" 1543 finalize_command="$finalize_command $arg" 1544 continue 1545 ;; 1546 1547 -inst-prefix-dir) 1548 prev=inst_prefix 1549 continue 1550 ;; 1551 1552 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 1553 # so, if we see these flags be careful not to treat them like -L 1554 -L[A-Z][A-Z]*:*) 1555 case $with_gcc/$host in 1556 no/*-*-irix* | /*-*-irix*) 1557 compile_command="$compile_command $arg" 1558 finalize_command="$finalize_command $arg" 1559 ;; 1560 esac 1561 continue 1562 ;; 1563 1564 -L*) 1565 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 1566 # We need an absolute path. 1567 case $dir in 1568 [\\/]* | [A-Za-z]:[\\/]*) ;; 1569 *) 1570 absdir=`cd "$dir" && pwd` 1571 if test -z "$absdir"; then 1572 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 1573 absdir="$dir" 1574 notinst_path="$notinst_path $dir" 1575 fi 1576 dir="$absdir" 1577 ;; 1578 esac 1579 case "$deplibs " in 1580 *" -L$dir "*) ;; 1581 *) 1582 deplibs="$deplibs -L$dir" 1583 lib_search_path="$lib_search_path $dir" 1584 ;; 1585 esac 1586 case $host in 1587 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1588 testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'` 1589 case :$dllsearchpath: in 1590 *":$dir:"*) ;; 1591 *) dllsearchpath="$dllsearchpath:$dir";; 1592 esac 1593 case :$dllsearchpath: in 1594 *":$testbindir:"*) ;; 1595 *) dllsearchpath="$dllsearchpath:$testbindir";; 1596 esac 1597 ;; 1598 esac 1599 continue 1600 ;; 1601 1602 -l*) 1603 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 1604 case $host in 1605 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*) 1606 # These systems don't actually have a C or math library (as such) 1607 continue 1608 ;; 1609 *-*-os2*) 1610 # These systems don't actually have a C library (as such) 1611 test "X$arg" = "X-lc" && continue 1612 ;; 1613 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 1614 # Do not include libc due to us having libc/libc_r. 1615 test "X$arg" = "X-lc" && continue 1616 ;; 1617 *-*-rhapsody* | *-*-darwin1.[012]) 1618 # Rhapsody C and math libraries are in the System framework 1619 deplibs="$deplibs -framework System" 1620 continue 1621 ;; 1622 *-*-sco3.2v5* | *-*-sco5v6*) 1623 # Causes problems with __ctype 1624 test "X$arg" = "X-lc" && continue 1625 ;; 1626 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 1627 # Compiler inserts libc in the correct place for threads to work 1628 test "X$arg" = "X-lc" && continue 1629 ;; 1630 esac 1631 elif test "X$arg" = "X-lc_r"; then 1632 case $host in 1633 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 1634 # Do not include libc_r directly, use -pthread flag. 1635 continue 1636 ;; 1637 esac 1638 fi 1639 deplibs="$deplibs $arg" 1640 continue 1641 ;; 1642 1643 # Tru64 UNIX uses -model [arg] to determine the layout of C++ 1644 # classes, name mangling, and exception handling. 1645 -model) 1646 compile_command="$compile_command $arg" 1647 compiler_flags="$compiler_flags $arg" 1648 finalize_command="$finalize_command $arg" 1649 prev=xcompiler 1650 continue 1651 ;; 1652 1653 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 1654 compiler_flags="$compiler_flags $arg" 1655 compile_command="$compile_command $arg" 1656 finalize_command="$finalize_command $arg" 1657 continue 1658 ;; 1659 1660 -multi_module) 1661 single_module="${wl}-multi_module" 1662 continue 1663 ;; 1664 1665 -module) 1666 module=yes 1667 continue 1668 ;; 1669 1670 # -64, -mips[0-9] enable 64-bit mode on the SGI compiler 1671 # -r[0-9][0-9]* specifies the processor on the SGI compiler 1672 # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler 1673 # +DA*, +DD* enable 64-bit mode on the HP compiler 1674 # -q* pass through compiler args for the IBM compiler 1675 # -m* pass through architecture-specific compiler args for GCC 1676 # -m*, -t[45]*, -txscale* pass through architecture-specific 1677 # compiler args for GCC 1678 # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC 1679 # -F/path gives path to uninstalled frameworks, gcc on darwin 1680 # @file GCC response files 1681 -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ 1682 -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*) 1683 1684 # Unknown arguments in both finalize_command and compile_command need 1685 # to be aesthetically quoted because they are evaled later. 1686 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1687 case $arg in 1688 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1689 arg="\"$arg\"" 1690 ;; 1691 esac 1692 compile_command="$compile_command $arg" 1693 finalize_command="$finalize_command $arg" 1694 compiler_flags="$compiler_flags $arg" 1695 continue 1696 ;; 1697 1698 -shrext) 1699 prev=shrext 1700 continue 1701 ;; 1702 1703 -no-fast-install) 1704 fast_install=no 1705 continue 1706 ;; 1707 1708 -no-install) 1709 case $host in 1710 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*) 1711 # The PATH hackery in wrapper scripts is required on Windows 1712 # and Darwin in order for the loader to find any dlls it needs. 1713 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 1714 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 1715 fast_install=no 1716 ;; 1717 *) no_install=yes ;; 1718 esac 1719 continue 1720 ;; 1721 1722 -no-undefined) 1723 allow_undefined=no 1724 continue 1725 ;; 1726 1727 -objectlist) 1728 prev=objectlist 1729 continue 1730 ;; 1731 1732 -o) prev=output ;; 1733 1734 -precious-files-regex) 1735 prev=precious_regex 1736 continue 1737 ;; 1738 1739 -release) 1740 prev=release 1741 continue 1742 ;; 1743 1744 -rpath) 1745 prev=rpath 1746 continue 1747 ;; 1748 1749 -R) 1750 prev=xrpath 1751 continue 1752 ;; 1753 1754 -R*) 1755 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 1756 # We need an absolute path. 1757 case $dir in 1758 [\\/]* | [A-Za-z]:[\\/]*) ;; 1759 *) 1760 $echo "$modename: only absolute run-paths are allowed" 1>&2 1761 exit $EXIT_FAILURE 1762 ;; 1763 esac 1764 case "$xrpath " in 1765 *" $dir "*) ;; 1766 *) xrpath="$xrpath $dir" ;; 1767 esac 1768 continue 1769 ;; 1770 1771 -static | -static-libtool-libs) 1772 # The effects of -static are defined in a previous loop. 1773 # We used to do the same as -all-static on platforms that 1774 # didn't have a PIC flag, but the assumption that the effects 1775 # would be equivalent was wrong. It would break on at least 1776 # Digital Unix and AIX. 1777 continue 1778 ;; 1779 1780 -thread-safe) 1781 thread_safe=yes 1782 continue 1783 ;; 1784 1785 -version-info) 1786 prev=vinfo 1787 continue 1788 ;; 1789 -version-number) 1790 prev=vinfo 1791 vinfo_number=yes 1792 continue 1793 ;; 1794 1795 -Wc,*) 1796 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 1797 arg= 1798 save_ifs="$IFS"; IFS=',' 1799 for flag in $args; do 1800 IFS="$save_ifs" 1801 case $flag in 1802 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1803 flag="\"$flag\"" 1804 ;; 1805 esac 1806 arg="$arg $wl$flag" 1807 compiler_flags="$compiler_flags $flag" 1808 done 1809 IFS="$save_ifs" 1810 arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1811 ;; 1812 1813 -Wl,*) 1814 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 1815 arg= 1816 save_ifs="$IFS"; IFS=',' 1817 for flag in $args; do 1818 IFS="$save_ifs" 1819 case $flag in 1820 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1821 flag="\"$flag\"" 1822 ;; 1823 esac 1824 arg="$arg $wl$flag" 1825 compiler_flags="$compiler_flags $wl$flag" 1826 linker_flags="$linker_flags $flag" 1827 done 1828 IFS="$save_ifs" 1829 arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1830 ;; 1831 1832 -Xcompiler) 1833 prev=xcompiler 1834 continue 1835 ;; 1836 1837 -Xlinker) 1838 prev=xlinker 1839 continue 1840 ;; 1841 1842 -XCClinker) 1843 prev=xcclinker 1844 continue 1845 ;; 1846 1847 # Some other compiler flag. 1848 -* | +*) 1849 # Unknown arguments in both finalize_command and compile_command need 1850 # to be aesthetically quoted because they are evaled later. 1851 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1852 case $arg in 1853 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1854 arg="\"$arg\"" 1855 ;; 1856 esac 1857 ;; 1858 1859 *.$objext) 1860 # A standard object. 1861 objs="$objs $arg" 1862 ;; 1863 1864 *.lo) 1865 # A libtool-controlled object. 1866 1867 # Check to see that this really is a libtool object. 1868 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1869 pic_object= 1870 non_pic_object= 1871 1872 # Read the .lo file 1873 # If there is no directory component, then add one. 1874 case $arg in 1875 */* | *\\*) . $arg ;; 1876 *) . ./$arg ;; 1877 esac 1878 1879 if test -z "$pic_object" || \ 1880 test -z "$non_pic_object" || 1881 test "$pic_object" = none && \ 1882 test "$non_pic_object" = none; then 1883 $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1884 exit $EXIT_FAILURE 1885 fi 1886 1887 # Extract subdirectory from the argument. 1888 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1889 if test "X$xdir" = "X$arg"; then 1890 xdir= 1891 else 1892 xdir="$xdir/" 1893 fi 1894 1895 if test "$pic_object" != none; then 1896 # Prepend the subdirectory the object is found in. 1897 pic_object="$xdir$pic_object" 1898 1899 if test "$prev" = dlfiles; then 1900 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1901 dlfiles="$dlfiles $pic_object" 1902 prev= 1903 continue 1904 else 1905 # If libtool objects are unsupported, then we need to preload. 1906 prev=dlprefiles 1907 fi 1908 fi 1909 1910 # CHECK ME: I think I busted this. -Ossama 1911 if test "$prev" = dlprefiles; then 1912 # Preload the old-style object. 1913 dlprefiles="$dlprefiles $pic_object" 1914 prev= 1915 fi 1916 1917 # A PIC object. 1918 libobjs="$libobjs $pic_object" 1919 arg="$pic_object" 1920 fi 1921 1922 # Non-PIC object. 1923 if test "$non_pic_object" != none; then 1924 # Prepend the subdirectory the object is found in. 1925 non_pic_object="$xdir$non_pic_object" 1926 1927 # A standard non-PIC object 1928 non_pic_objects="$non_pic_objects $non_pic_object" 1929 if test -z "$pic_object" || test "$pic_object" = none ; then 1930 arg="$non_pic_object" 1931 fi 1932 else 1933 # If the PIC object exists, use it instead. 1934 # $xdir was prepended to $pic_object above. 1935 non_pic_object="$pic_object" 1936 non_pic_objects="$non_pic_objects $non_pic_object" 1937 fi 1938 else 1939 # Only an error if not doing a dry-run. 1940 if test -z "$run"; then 1941 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1942 exit $EXIT_FAILURE 1943 else 1944 # Dry-run case. 1945 1946 # Extract subdirectory from the argument. 1947 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1948 if test "X$xdir" = "X$arg"; then 1949 xdir= 1950 else 1951 xdir="$xdir/" 1952 fi 1953 1954 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1955 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1956 libobjs="$libobjs $pic_object" 1957 non_pic_objects="$non_pic_objects $non_pic_object" 1958 fi 1959 fi 1960 ;; 1961 1962 *.$libext) 1963 # An archive. 1964 deplibs="$deplibs $arg" 1965 old_deplibs="$old_deplibs $arg" 1966 continue 1967 ;; 1968 1969 *.la) 1970 # A libtool-controlled library. 1971 1972 if test "$prev" = dlfiles; then 1973 # This library was specified with -dlopen. 1974 dlfiles="$dlfiles $arg" 1975 prev= 1976 elif test "$prev" = dlprefiles; then 1977 # The library was specified with -dlpreopen. 1978 dlprefiles="$dlprefiles $arg" 1979 prev= 1980 else 1981 deplibs="$deplibs $arg" 1982 fi 1983 continue 1984 ;; 1985 1986 # Some other compiler argument. 1987 *) 1988 # Unknown arguments in both finalize_command and compile_command need 1989 # to be aesthetically quoted because they are evaled later. 1990 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1991 case $arg in 1992 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1993 arg="\"$arg\"" 1994 ;; 1995 esac 1996 ;; 1997 esac # arg 1998 1999 # Now actually substitute the argument into the commands. 2000 if test -n "$arg"; then 2001 compile_command="$compile_command $arg" 2002 finalize_command="$finalize_command $arg" 2003 fi 2004 done # argument parsing loop 2005 2006 if test "$module" = yes ; then 2007 # [Mandriva] dropping ld option "--no-undefined" which is wrong for plugins 2008 linker_flags=`$echo "X $linker_flags" | $Xsed -e 's/ --no-undefined//'` 2009 compiler_flags=`$echo "X $compiler_flags" | $Xsed -e 's/ -Wl,--no-undefined//'` 2010 fi 2011 2012 if test -n "$prev"; then 2013 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 2014 $echo "$help" 1>&2 2015 exit $EXIT_FAILURE 2016 fi 2017 2018 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 2019 eval arg=\"$export_dynamic_flag_spec\" 2020 compile_command="$compile_command $arg" 2021 finalize_command="$finalize_command $arg" 2022 fi 2023 2024 oldlibs= 2025 # calculate the name of the file, without its directory 2026 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 2027 libobjs_save="$libobjs" 2028 2029 if test -n "$shlibpath_var"; then 2030 # get the directories listed in $shlibpath_var 2031 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 2032 else 2033 shlib_search_path= 2034 fi 2035 eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 2036 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 2037 2038 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 2039 if test "X$output_objdir" = "X$output"; then 2040 output_objdir="$objdir" 2041 else 2042 output_objdir="$output_objdir/$objdir" 2043 fi 2044 # Create the object directory. 2045 if test ! -d "$output_objdir"; then 2046 $show "$mkdir $output_objdir" 2047 $run $mkdir $output_objdir 2048 exit_status=$? 2049 if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then 2050 exit $exit_status 2051 fi 2052 fi 2053 2054 # Determine the type of output 2055 case $output in 2056 "") 2057 $echo "$modename: you must specify an output file" 1>&2 2058 $echo "$help" 1>&2 2059 exit $EXIT_FAILURE 2060 ;; 2061 *.$libext) linkmode=oldlib ;; 2062 *.lo | *.$objext) linkmode=obj ;; 2063 *.la) linkmode=lib ;; 2064 *) linkmode=prog ;; # Anything else should be a program. 2065 esac 2066 2067 case $host in 2068 *cygwin* | *mingw* | *pw32*) 2069 # don't eliminate duplications in $postdeps and $predeps 2070 duplicate_compiler_generated_deps=yes 2071 ;; 2072 *) 2073 duplicate_compiler_generated_deps=$duplicate_deps 2074 ;; 2075 esac 2076 specialdeplibs= 2077 2078 libs= 2079 # Find all interdependent deplibs by searching for libraries 2080 # that are linked more than once (e.g. -la -lb -la) 2081 for deplib in $deplibs; do 2082 if test "X$duplicate_deps" = "Xyes" ; then 2083 case "$libs " in 2084 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2085 esac 2086 fi 2087 libs="$libs $deplib" 2088 done 2089 2090 if test "$linkmode" = lib; then 2091 libs="$predeps $libs $compiler_lib_search_path $postdeps" 2092 2093 # Compute libraries that are listed more than once in $predeps 2094 # $postdeps and mark them as special (i.e., whose duplicates are 2095 # not to be eliminated). 2096 pre_post_deps= 2097 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 2098 for pre_post_dep in $predeps $postdeps; do 2099 case "$pre_post_deps " in 2100 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 2101 esac 2102 pre_post_deps="$pre_post_deps $pre_post_dep" 2103 done 2104 fi 2105 pre_post_deps= 2106 fi 2107 2108 deplibs= 2109 newdependency_libs= 2110 newlib_search_path= 2111 need_relink=no # whether we're linking any uninstalled libtool libraries 2112 notinst_deplibs= # not-installed libtool libraries 2113 case $linkmode in 2114 lib) 2115 passes="conv link" 2116 for file in $dlfiles $dlprefiles; do 2117 case $file in 2118 *.la) ;; 2119 *) 2120 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 2121 exit $EXIT_FAILURE 2122 ;; 2123 esac 2124 done 2125 ;; 2126 prog) 2127 compile_deplibs= 2128 finalize_deplibs= 2129 alldeplibs=no 2130 newdlfiles= 2131 newdlprefiles= 2132 passes="conv scan dlopen dlpreopen link" 2133 ;; 2134 *) passes="conv" 2135 ;; 2136 esac 2137 for pass in $passes; do 2138 if test "$linkmode,$pass" = "lib,link" || 2139 test "$linkmode,$pass" = "prog,scan"; then 2140 libs="$deplibs" 2141 deplibs= 2142 fi 2143 if test "$linkmode" = prog; then 2144 case $pass in 2145 dlopen) libs="$dlfiles" ;; 2146 dlpreopen) libs="$dlprefiles" ;; 2147 link) 2148 libs="$deplibs %DEPLIBS%" 2149 test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs" 2150 ;; 2151 esac 2152 fi 2153 if test "$pass" = dlopen; then 2154 # Collect dlpreopened libraries 2155 save_deplibs="$deplibs" 2156 deplibs= 2157 fi 2158 for deplib in $libs; do 2159 lib= 2160 found=no 2161 case $deplib in 2162 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) 2163 if test "$linkmode,$pass" = "prog,link"; then 2164 compile_deplibs="$deplib $compile_deplibs" 2165 finalize_deplibs="$deplib $finalize_deplibs" 2166 else 2167 compiler_flags="$compiler_flags $deplib" 2168 fi 2169 continue 2170 ;; 2171 -l*) 2172 if test "$linkmode" != lib && test "$linkmode" != prog; then 2173 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 2174 continue 2175 fi 2176 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 2177 if test "$linkmode" = lib; then 2178 searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" 2179 else 2180 searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" 2181 fi 2182 for searchdir in $searchdirs; do 2183 for search_ext in .la $std_shrext .so .a; do 2184 # Search the libtool library 2185 lib="$searchdir/lib${name}${search_ext}" 2186 if test -f "$lib"; then 2187 if test "$search_ext" = ".la"; then 2188 found=yes 2189 else 2190 found=no 2191 fi 2192 break 2 2193 fi 2194 done 2195 done 2196 if test "$found" != yes; then 2197 # deplib doesn't seem to be a libtool library 2198 if test "$linkmode,$pass" = "prog,link"; then 2199 compile_deplibs="$deplib $compile_deplibs" 2200 finalize_deplibs="$deplib $finalize_deplibs" 2201 else 2202 deplibs="$deplib $deplibs" 2203 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 2204 fi 2205 continue 2206 else # deplib is a libtool library 2207 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 2208 # We need to do some special things here, and not later. 2209 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 2210 case " $predeps $postdeps " in 2211 *" $deplib "*) 2212 if (${SED} -e '2q' $lib | 2213 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 2214 library_names= 2215 old_library= 2216 case $lib in 2217 */* | *\\*) . $lib ;; 2218 *) . ./$lib ;; 2219 esac 2220 for l in $old_library $library_names; do 2221 ll="$l" 2222 done 2223 if test "X$ll" = "X$old_library" ; then # only static version available 2224 found=no 2225 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 2226 test "X$ladir" = "X$lib" && ladir="." 2227 lib=$ladir/$old_library 2228 if test "$linkmode,$pass" = "prog,link"; then 2229 compile_deplibs="$deplib $compile_deplibs" 2230 finalize_deplibs="$deplib $finalize_deplibs" 2231 else 2232 deplibs="$deplib $deplibs" 2233 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 2234 fi 2235 continue 2236 fi 2237 fi 2238 ;; 2239 *) ;; 2240 esac 2241 fi 2242 fi 2243 ;; # -l 2244 -L*) 2245 case $linkmode in 2246 lib) 2247 deplibs="$deplib $deplibs" 2248 test "$pass" = conv && continue 2249 newdependency_libs="$deplib $newdependency_libs" 2250 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 2251 ;; 2252 prog) 2253 if test "$pass" = conv; then 2254 deplibs="$deplib $deplibs" 2255 continue 2256 fi 2257 if test "$pass" = scan; then 2258 deplibs="$deplib $deplibs" 2259 else 2260 compile_deplibs="$deplib $compile_deplibs" 2261 finalize_deplibs="$deplib $finalize_deplibs" 2262 fi 2263 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 2264 ;; 2265 *) 2266 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 2267 ;; 2268 esac # linkmode 2269 continue 2270 ;; # -L 2271 -R*) 2272 if test "$pass" = link; then 2273 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 2274 # Make sure the xrpath contains only unique directories. 2275 case "$xrpath " in 2276 *" $dir "*) ;; 2277 *) xrpath="$xrpath $dir" ;; 2278 esac 2279 fi 2280 deplibs="$deplib $deplibs" 2281 continue 2282 ;; 2283 *.la) lib="$deplib" ;; 2284 *.$libext) 2285 if test "$pass" = conv; then 2286 deplibs="$deplib $deplibs" 2287 continue 2288 fi 2289 case $linkmode in 2290 lib) 2291 valid_a_lib=no 2292 case $deplibs_check_method in 2293 match_pattern*) 2294 set dummy $deplibs_check_method 2295 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 2296 if eval $echo \"$deplib\" 2>/dev/null \ 2297 | $SED 10q \ 2298 | $EGREP "$match_pattern_regex" > /dev/null; then 2299 valid_a_lib=yes 2300 fi 2301 ;; 2302 pass_all) 2303 valid_a_lib=yes 2304 ;; 2305 esac 2306 if test "$valid_a_lib" != yes; then 2307 $echo 2308 $echo "*** Warning: Trying to link with static lib archive $deplib." 2309 $echo "*** I have the capability to make that library automatically link in when" 2310 $echo "*** you link to this library. But I can only do this if you have a" 2311 $echo "*** shared version of the library, which you do not appear to have" 2312 $echo "*** because the file extensions .$libext of this argument makes me believe" 2313 $echo "*** that it is just a static archive that I should not used here." 2314 else 2315 $echo 2316 $echo "*** Warning: Linking the shared library $output against the" 2317 $echo "*** static library $deplib is not portable!" 2318 deplibs="$deplib $deplibs" 2319 fi 2320 continue 2321 ;; 2322 prog) 2323 if test "$pass" != link; then 2324 deplibs="$deplib $deplibs" 2325 else 2326 compile_deplibs="$deplib $compile_deplibs" 2327 finalize_deplibs="$deplib $finalize_deplibs" 2328 fi 2329 continue 2330 ;; 2331 esac # linkmode 2332 ;; # *.$libext 2333 *.lo | *.$objext) 2334 if test "$pass" = conv; then 2335 deplibs="$deplib $deplibs" 2336 elif test "$linkmode" = prog; then 2337 if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then 2338 # If there is no dlopen support or we're linking statically, 2339 # we need to preload. 2340 newdlprefiles="$newdlprefiles $deplib" 2341 compile_deplibs="$deplib $compile_deplibs" 2342 finalize_deplibs="$deplib $finalize_deplibs" 2343 else 2344 newdlfiles="$newdlfiles $deplib" 2345 fi 2346 fi 2347 continue 2348 ;; 2349 %DEPLIBS%) 2350 alldeplibs=yes 2351 continue 2352 ;; 2353 esac # case $deplib 2354 if test "$found" = yes || test -f "$lib"; then : 2355 else 2356 $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2 2357 exit $EXIT_FAILURE 2358 fi 2359 2360 # Check to see that this really is a libtool archive. 2361 if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 2362 else 2363 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 2364 exit $EXIT_FAILURE 2365 fi 2366 2367 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 2368 test "X$ladir" = "X$lib" && ladir="." 2369 2370 dlname= 2371 dlopen= 2372 dlpreopen= 2373 libdir= 2374 library_names= 2375 old_library= 2376 # If the library was installed with an old release of libtool, 2377 # it will not redefine variables installed, or shouldnotlink 2378 installed=yes 2379 shouldnotlink=no 2380 avoidtemprpath= 2381 2382 2383 # Read the .la file 2384 case $lib in 2385 */* | *\\*) . $lib ;; 2386 *) . ./$lib ;; 2387 esac 2388 2389 if test "$linkmode,$pass" = "lib,link" || 2390 test "$linkmode,$pass" = "prog,scan" || 2391 { test "$linkmode" != prog && test "$linkmode" != lib; }; then 2392 test -n "$dlopen" && dlfiles="$dlfiles $dlopen" 2393 test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen" 2394 fi 2395 2396 if test "$pass" = conv; then 2397 # Only check for convenience libraries 2398 deplibs="$lib $deplibs" 2399 if test -z "$libdir"; then 2400 if test -z "$old_library"; then 2401 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 2402 exit $EXIT_FAILURE 2403 fi 2404 # It is a libtool convenience library, so add in its objects. 2405 convenience="$convenience $ladir/$objdir/$old_library" 2406 old_convenience="$old_convenience $ladir/$objdir/$old_library" 2407 tmp_libs= 2408 for deplib in $dependency_libs; do 2409 deplibs="$deplib $deplibs" 2410 if test "X$duplicate_deps" = "Xyes" ; then 2411 case "$tmp_libs " in 2412 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2413 esac 2414 fi 2415 tmp_libs="$tmp_libs $deplib" 2416 done 2417 elif test "$linkmode" != prog && test "$linkmode" != lib; then 2418 $echo "$modename: \`$lib' is not a convenience library" 1>&2 2419 exit $EXIT_FAILURE 2420 fi 2421 continue 2422 fi # $pass = conv 2423 2424 2425 # Get the name of the library we link against. 2426 linklib= 2427 for l in $old_library $library_names; do 2428 linklib="$l" 2429 done 2430 if test -z "$linklib"; then 2431 $echo "$modename: cannot find name of link library for \`$lib'" 1>&2 2432 exit $EXIT_FAILURE 2433 fi 2434 2435 # This library was specified with -dlopen. 2436 if test "$pass" = dlopen; then 2437 if test -z "$libdir"; then 2438 $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2 2439 exit $EXIT_FAILURE 2440 fi 2441 if test -z "$dlname" || 2442 test "$dlopen_support" != yes || 2443 test "$build_libtool_libs" = no; then 2444 # If there is no dlname, no dlopen support or we're linking 2445 # statically, we need to preload. We also need to preload any 2446 # dependent libraries so libltdl's deplib preloader doesn't 2447 # bomb out in the load deplibs phase. 2448 dlprefiles="$dlprefiles $lib $dependency_libs" 2449 else 2450 newdlfiles="$newdlfiles $lib" 2451 fi 2452 continue 2453 fi # $pass = dlopen 2454 2455 # We need an absolute path. 2456 case $ladir in 2457 [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; 2458 *) 2459 abs_ladir=`cd "$ladir" && pwd` 2460 if test -z "$abs_ladir"; then 2461 $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2 2462 $echo "$modename: passing it literally to the linker, although it might fail" 1>&2 2463 abs_ladir="$ladir" 2464 fi 2465 ;; 2466 esac 2467 laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 2468 2469 # Find the relevant object directory and library name. 2470 if test "X$installed" = Xyes; then 2471 if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then 2472 $echo "$modename: warning: library \`$lib' was moved." 1>&2 2473 dir="$ladir" 2474 absdir="$abs_ladir" 2475 libdir="$abs_ladir" 2476 else 2477 dir="$libdir" 2478 absdir="$libdir" 2479 fi 2480 test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes 2481 else 2482 if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then 2483 dir="$ladir" 2484 absdir="$abs_ladir" 2485 # Remove this search path later 2486 notinst_path="$notinst_path $abs_ladir" 2487 else 2488 dir="$ladir/$objdir" 2489 absdir="$abs_ladir/$objdir" 2490 # Remove this search path later 2491 notinst_path="$notinst_path $abs_ladir" 2492 fi 2493 fi # $installed = yes 2494 name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 2495 2496 # This library was specified with -dlpreopen. 2497 if test "$pass" = dlpreopen; then 2498 if test -z "$libdir"; then 2499 $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2 2500 exit $EXIT_FAILURE 2501 fi 2502 # Prefer using a static library (so that no silly _DYNAMIC symbols 2503 # are required to link). 2504 if test -n "$old_library"; then 2505 newdlprefiles="$newdlprefiles $dir/$old_library" 2506 # Otherwise, use the dlname, so that lt_dlopen finds it. 2507 elif test -n "$dlname"; then 2508 newdlprefiles="$newdlprefiles $dir/$dlname" 2509 else 2510 newdlprefiles="$newdlprefiles $dir/$linklib" 2511 fi 2512 fi # $pass = dlpreopen 2513 2514 if test -z "$libdir"; then 2515 # Link the convenience library 2516 if test "$linkmode" = lib; then 2517 deplibs="$dir/$old_library $deplibs" 2518 elif test "$linkmode,$pass" = "prog,link"; then 2519 compile_deplibs="$dir/$old_library $compile_deplibs" 2520 finalize_deplibs="$dir/$old_library $finalize_deplibs" 2521 else 2522 deplibs="$lib $deplibs" # used for prog,scan pass 2523 fi 2524 continue 2525 fi 2526 2527 2528 if test "$linkmode" = prog && test "$pass" != link; then 2529 newlib_search_path="$newlib_search_path $ladir" 2530 deplibs="$lib $deplibs" 2531 2532 linkalldeplibs=no 2533 if test "$link_all_deplibs" != no || test -z "$library_names" || 2534 test "$build_libtool_libs" = no; then 2535 linkalldeplibs=yes 2536 fi 2537 2538 tmp_libs= 2539 for deplib in $dependency_libs; do 2540 case $deplib in 2541 -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test 2542 esac 2543 # Need to link against all dependency_libs? 2544 if test "$linkalldeplibs" = yes; then 2545 deplibs="$deplib $deplibs" 2546 else 2547 # Need to hardcode shared library paths 2548 # or/and link against static libraries 2549 newdependency_libs="$deplib $newdependency_libs" 2550 fi 2551 if test "X$duplicate_deps" = "Xyes" ; then 2552 case "$tmp_libs " in 2553 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2554 esac 2555 fi 2556 tmp_libs="$tmp_libs $deplib" 2557 done # for deplib 2558 continue 2559 fi # $linkmode = prog... 2560 2561 if test "$linkmode,$pass" = "prog,link"; then 2562 if test -n "$library_names" && 2563 { { test "$prefer_static_libs" = no || 2564 test "$prefer_static_libs,$installed" = "built,yes"; } || 2565 test -z "$old_library"; }; then 2566 # We need to hardcode the library path 2567 if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then 2568 # Make sure the rpath contains only unique directories. 2569 case "$temp_rpath " in 2570 *" $dir "*) ;; 2571 *" $absdir "*) ;; 2572 *) temp_rpath="$temp_rpath $absdir" ;; 2573 esac 2574 fi 2575 2576 # Hardcode the library path. 2577 # Skip directories that are in the system default run-time 2578 # search path. 2579 case " $sys_lib_dlsearch_path " in 2580 *" $absdir "*) ;; 2581 *) 2582 case "$compile_rpath " in 2583 *" $absdir "*) ;; 2584 *) compile_rpath="$compile_rpath $absdir" 2585 esac 2586 ;; 2587 esac 2588 case " $sys_lib_dlsearch_path " in 2589 *" $libdir "*) ;; 2590 *) 2591 case "$finalize_rpath " in 2592 *" $libdir "*) ;; 2593 *) finalize_rpath="$finalize_rpath $libdir" 2594 esac 2595 ;; 2596 esac 2597 fi # $linkmode,$pass = prog,link... 2598 2599 if test "$alldeplibs" = yes && 2600 { test "$deplibs_check_method" = pass_all || 2601 { test "$build_libtool_libs" = yes && 2602 test -n "$library_names"; }; }; then 2603 # We only need to search for static libraries 2604 continue 2605 fi 2606 fi 2607 2608 link_static=no # Whether the deplib will be linked statically 2609 use_static_libs=$prefer_static_libs 2610 if test "$use_static_libs" = built && test "$installed" = yes ; then 2611 use_static_libs=no 2612 fi 2613 if test -n "$library_names" && 2614 { test "$use_static_libs" = no || test -z "$old_library"; }; then 2615 if test "$installed" = no; then 2616 notinst_deplibs="$notinst_deplibs $lib" 2617 need_relink=yes 2618 fi 2619 # This is a shared library 2620 2621 # Warn about portability, can't link against -module's on 2622 # some systems (darwin) 2623 if test "$shouldnotlink" = yes && test "$pass" = link ; then 2624 $echo 2625 if test "$linkmode" = prog; then 2626 $echo "*** Warning: Linking the executable $output against the loadable module" 2627 else 2628 $echo "*** Warning: Linking the shared library $output against the loadable module" 2629 fi 2630 $echo "*** $linklib is not portable!" 2631 fi 2632 if test "$linkmode" = lib && 2633 test "$hardcode_into_libs" = yes; then 2634 # Hardcode the library path. 2635 # Skip directories that are in the system default run-time 2636 # search path. 2637 case " $sys_lib_dlsearch_path " in 2638 *" $absdir "*) ;; 2639 *) 2640 case "$compile_rpath " in 2641 *" $absdir "*) ;; 2642 *) compile_rpath="$compile_rpath $absdir" 2643 esac 2644 ;; 2645 esac 2646 case " $sys_lib_dlsearch_path " in 2647 *" $libdir "*) ;; 2648 *) 2649 case "$finalize_rpath " in 2650 *" $libdir "*) ;; 2651 *) finalize_rpath="$finalize_rpath $libdir" 2652 esac 2653 ;; 2654 esac 2655 fi 2656 2657 if test -n "$old_archive_from_expsyms_cmds"; then 2658 # figure out the soname 2659 set dummy $library_names 2660 realname="$2" 2661 shift; shift 2662 libname=`eval \\$echo \"$libname_spec\"` 2663 # use dlname if we got it. it's perfectly good, no? 2664 if test -n "$dlname"; then 2665 soname="$dlname" 2666 elif test -n "$soname_spec"; then 2667 # bleh windows 2668 case $host in 2669 *cygwin* | mingw*) 2670 major=`expr $current - $age` 2671 versuffix="-$major" 2672 ;; 2673 esac 2674 eval soname=\"$soname_spec\" 2675 else 2676 soname="$realname" 2677 fi 2678 2679 # Make a new name for the extract_expsyms_cmds to use 2680 soroot="$soname" 2681 soname=`$echo $soroot | ${SED} -e 's/^.*\///'` 2682 newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a" 2683 2684 # If the library has no export list, then create one now 2685 if test -f "$output_objdir/$soname-def"; then : 2686 else 2687 $show "extracting exported symbol list from \`$soname'" 2688 save_ifs="$IFS"; IFS='~' 2689 cmds=$extract_expsyms_cmds 2690 for cmd in $cmds; do 2691 IFS="$save_ifs" 2692 eval cmd=\"$cmd\" 2693 $show "$cmd" 2694 $run eval "$cmd" || exit $? 2695 done 2696 IFS="$save_ifs" 2697 fi 2698 2699 # Create $newlib 2700 if test -f "$output_objdir/$newlib"; then :; else 2701 $show "generating import library for \`$soname'" 2702 save_ifs="$IFS"; IFS='~' 2703 cmds=$old_archive_from_expsyms_cmds 2704 for cmd in $cmds; do 2705 IFS="$save_ifs" 2706 eval cmd=\"$cmd\" 2707 $show "$cmd" 2708 $run eval "$cmd" || exit $? 2709 done 2710 IFS="$save_ifs" 2711 fi 2712 # make sure the library variables are pointing to the new library 2713 dir=$output_objdir 2714 linklib=$newlib 2715 fi # test -n "$old_archive_from_expsyms_cmds" 2716 2717 if test "$linkmode" = prog || test "$mode" != relink; then 2718 add_shlibpath= 2719 add_dir= 2720 add= 2721 lib_linked=yes 2722 case $hardcode_action in 2723 immediate | unsupported) 2724 if test "$hardcode_direct" = no; then 2725 add="$dir/$linklib" 2726 case $host in 2727 *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; 2728 *-*-sysv4*uw2*) add_dir="-L$dir" ;; 2729 *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ 2730 *-*-unixware7*) add_dir="-L$dir" ;; 2731 *-*-darwin* ) 2732 # if the lib is a module then we can not link against 2733 # it, someone is ignoring the new warnings I added 2734 if /usr/bin/file -L $add 2> /dev/null | 2735 $EGREP ": [^:]* bundle" >/dev/null ; then 2736 $echo "** Warning, lib $linklib is a module, not a shared library" 2737 if test -z "$old_library" ; then 2738 $echo 2739 $echo "** And there doesn't seem to be a static archive available" 2740 $echo "** The link will probably fail, sorry" 2741 else 2742 add="$dir/$old_library" 2743 fi 2744 fi 2745 esac 2746 elif test "$hardcode_minus_L" = no; then 2747 case $host in 2748 *-*-sunos*) add_shlibpath="$dir" ;; 2749 esac 2750 add_dir="-L$dir" 2751 add="-l$name" 2752 elif test "$hardcode_shlibpath_var" = no; then 2753 add_shlibpath="$dir" 2754 add="-l$name" 2755 else 2756 lib_linked=no 2757 fi 2758 ;; 2759 relink) 2760 if test "$hardcode_direct" = yes; then 2761 add="$dir/$linklib" 2762 elif test "$hardcode_minus_L" = yes; then 2763 add_dir="-L$dir" 2764 # Try looking first in the location we're being installed to. 2765 if test -n "$inst_prefix_dir"; then 2766 case $libdir in 2767 [\\/]*) 2768 add_dir="$add_dir -L$inst_prefix_dir$libdir" 2769 ;; 2770 esac 2771 fi 2772 add="-l$name" 2773 elif test "$hardcode_shlibpath_var" = yes; then 2774 add_shlibpath="$dir" 2775 add="-l$name" 2776 else 2777 lib_linked=no 2778 fi 2779 ;; 2780 *) lib_linked=no ;; 2781 esac 2782 2783 if test "$lib_linked" != yes; then 2784 $echo "$modename: configuration error: unsupported hardcode properties" 2785 exit $EXIT_FAILURE 2786 fi 2787 2788 if test -n "$add_shlibpath"; then 2789 case :$compile_shlibpath: in 2790 *":$add_shlibpath:"*) ;; 2791 *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;; 2792 esac 2793 fi 2794 if test "$linkmode" = prog; then 2795 test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" 2796 test -n "$add" && compile_deplibs="$add $compile_deplibs" 2797 else 2798 test -n "$add_dir" && deplibs="$add_dir $deplibs" 2799 test -n "$add" && deplibs="$add $deplibs" 2800 if test "$hardcode_direct" != yes && \ 2801 test "$hardcode_minus_L" != yes && \ 2802 test "$hardcode_shlibpath_var" = yes; then 2803 case :$finalize_shlibpath: in 2804 *":$libdir:"*) ;; 2805 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2806 esac 2807 fi 2808 fi 2809 fi 2810 2811 if test "$linkmode" = prog || test "$mode" = relink; then 2812 add_shlibpath= 2813 add_dir= 2814 add= 2815 # Finalize command for both is simple: just hardcode it. 2816 if test "$hardcode_direct" = yes; then 2817 add="$libdir/$linklib" 2818 elif test "$hardcode_minus_L" = yes; then 2819 add_dir="-L$libdir" 2820 add="-l$name" 2821 elif test "$hardcode_shlibpath_var" = yes; then 2822 case :$finalize_shlibpath: in 2823 *":$libdir:"*) ;; 2824 *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;; 2825 esac 2826 add="-l$name" 2827 elif test "$hardcode_automatic" = yes; then 2828 if test -n "$inst_prefix_dir" && 2829 test -f "$inst_prefix_dir$libdir/$linklib" ; then 2830 add="$inst_prefix_dir$libdir/$linklib" 2831 else 2832 add="$libdir/$linklib" 2833 fi 2834 else 2835 # We cannot seem to hardcode it, guess we'll fake it. 2836 add_dir="-L$libdir" 2837 # Try looking first in the location we're being installed to. 2838 if test -n "$inst_prefix_dir"; then 2839 case $libdir in 2840 [\\/]*) 2841 add_dir="$add_dir -L$inst_prefix_dir$libdir" 2842 ;; 2843 esac 2844 fi 2845 add="-l$name" 2846 fi 2847 2848 if test "$linkmode" = prog; then 2849 test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" 2850 test -n "$add" && finalize_deplibs="$add $finalize_deplibs" 2851 else 2852 test -n "$add_dir" && deplibs="$add_dir $deplibs" 2853 test -n "$add" && deplibs="$add $deplibs" 2854 fi 2855 fi 2856 elif test "$linkmode" = prog; then 2857 # Here we assume that one of hardcode_direct or hardcode_minus_L 2858 # is not unsupported. This is valid on all known static and 2859 # shared platforms. 2860 if test "$hardcode_direct" != unsupported; then 2861 test -n "$old_library" && linklib="$old_library" 2862 compile_deplibs="$dir/$linklib $compile_deplibs" 2863 finalize_deplibs="$dir/$linklib $finalize_deplibs" 2864 else 2865 compile_deplibs="-l$name -L$dir $compile_deplibs" 2866 finalize_deplibs="-l$name -L$dir $finalize_deplibs" 2867 fi 2868 elif test "$build_libtool_libs" = yes; then 2869 # Not a shared library 2870 if test "$deplibs_check_method" != pass_all; then 2871 # We're trying link a shared library against a static one 2872 # but the system doesn't support it. 2873 2874 # Just print a warning and add the library to dependency_libs so 2875 # that the program can be linked against the static library. 2876 $echo 2877 $echo "*** Warning: This system can not link to static lib archive $lib." 2878 $echo "*** I have the capability to make that library automatically link in when" 2879 $echo "*** you link to this library. But I can only do this if you have a" 2880 $echo "*** shared version of the library, which you do not appear to have." 2881 if test "$module" = yes; then 2882 $echo "*** But as you try to build a module library, libtool will still create " 2883 $echo "*** a static module, that should work as long as the dlopening application" 2884 $echo "*** is linked with the -dlopen flag to resolve symbols at runtime." 2885 if test -z "$global_symbol_pipe"; then 2886 $echo 2887 $echo "*** However, this would only work if libtool was able to extract symbol" 2888 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 2889 $echo "*** not find such a program. So, this module is probably useless." 2890 $echo "*** \`nm' from GNU binutils and a full rebuild may help." 2891 fi 2892 if test "$build_old_libs" = no; then 2893 build_libtool_libs=module 2894 build_old_libs=yes 2895 else 2896 build_libtool_libs=no 2897 fi 2898 fi 2899 else 2900 deplibs="$dir/$old_library $deplibs" 2901 link_static=yes 2902 fi 2903 fi # link shared/static library? 2904 2905 if test "$linkmode" = lib; then 2906 if test -n "$dependency_libs" && 2907 { test "$hardcode_into_libs" != yes || 2908 test "$build_old_libs" = yes || 2909 test "$link_static" = yes; }; then 2910 # Extract -R from dependency_libs 2911 temp_deplibs= 2912 for libdir in $dependency_libs; do 2913 case $libdir in 2914 -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'` 2915 case " $xrpath " in 2916 *" $temp_xrpath "*) ;; 2917 *) xrpath="$xrpath $temp_xrpath";; 2918 esac;; 2919 *) temp_deplibs="$temp_deplibs $libdir";; 2920 esac 2921 done 2922 dependency_libs="$temp_deplibs" 2923 fi 2924 2925 newlib_search_path="$newlib_search_path $absdir" 2926 # Link against this library 2927 test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" 2928 # ... and its dependency_libs 2929 tmp_libs= 2930 for deplib in $dependency_libs; do 2931 newdependency_libs="$deplib $newdependency_libs" 2932 if test "X$duplicate_deps" = "Xyes" ; then 2933 case "$tmp_libs " in 2934 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 2935 esac 2936 fi 2937 tmp_libs="$tmp_libs $deplib" 2938 done 2939 2940 if test "$link_all_deplibs" != no; then 2941 # Add the search paths of all dependency libraries 2942 for deplib in $dependency_libs; do 2943 case $deplib in 2944 -L*) path="$deplib" ;; 2945 *.la) 2946 dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'` 2947 test "X$dir" = "X$deplib" && dir="." 2948 # We need an absolute path. 2949 case $dir in 2950 [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; 2951 *) 2952 absdir=`cd "$dir" && pwd` 2953 if test -z "$absdir"; then 2954 $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2 2955 absdir="$dir" 2956 fi 2957 ;; 2958 esac 2959 if grep "^installed=no" $deplib > /dev/null; then 2960 path="$absdir/$objdir" 2961 else 2962 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 2963 if test -z "$libdir"; then 2964 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 2965 exit $EXIT_FAILURE 2966 fi 2967 if test "$absdir" != "$libdir"; then 2968 $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2 2969 fi 2970 path="$absdir" 2971 fi 2972 depdepl= 2973 case $host in 2974 *-*-darwin*) 2975 # we do not want to link against static libs, 2976 # but need to link against shared 2977 eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` 2978 eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 2979 if test -n "$deplibrary_names" ; then 2980 for tmp in $deplibrary_names ; do 2981 depdepl=$tmp 2982 done 2983 if test -f "$deplibdir/$depdepl" ; then 2984 depdepl="$deplibdir/$depdepl" 2985 elif test -f "$path/$depdepl" ; then 2986 depdepl="$path/$depdepl" 2987 else 2988 # Can't find it, oh well... 2989 depdepl= 2990 fi 2991 # do not add paths which are already there 2992 case " $newlib_search_path " in 2993 *" $path "*) ;; 2994 *) newlib_search_path="$newlib_search_path $path";; 2995 esac 2996 fi 2997 path="" 2998 ;; 2999 *) 3000 path="-L$path" 3001 ;; 3002 esac 3003 ;; 3004 -l*) 3005 case $host in 3006 *-*-darwin*) 3007 # Again, we only want to link against shared libraries 3008 eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"` 3009 for tmp in $newlib_search_path ; do 3010 if test -f "$tmp/lib$tmp_libs.dylib" ; then 3011 eval depdepl="$tmp/lib$tmp_libs.dylib" 3012 break 3013 fi 3014 done 3015 path="" 3016 ;; 3017 *) continue ;; 3018 esac 3019 ;; 3020 *) continue ;; 3021 esac 3022 case " $deplibs " in 3023 *" $path "*) ;; 3024 *) deplibs="$path $deplibs" ;; 3025 esac 3026 case " $deplibs " in 3027 *" $depdepl "*) ;; 3028 *) deplibs="$depdepl $deplibs" ;; 3029 esac 3030 done 3031 fi # link_all_deplibs != no 3032 fi # linkmode = lib 3033 done # for deplib in $libs 3034 dependency_libs="$newdependency_libs" 3035 if test "$pass" = dlpreopen; then 3036 # Link the dlpreopened libraries before other libraries 3037 for deplib in $save_deplibs; do 3038 deplibs="$deplib $deplibs" 3039 done 3040 fi 3041 if test "$pass" != dlopen; then 3042 if test "$pass" != conv; then 3043 # Make sure lib_search_path contains only unique directories. 3044 lib_search_path= 3045 for dir in $newlib_search_path; do 3046 case "$lib_search_path " in 3047 *" $dir "*) ;; 3048 *) lib_search_path="$lib_search_path $dir" ;; 3049 esac 3050 done 3051 newlib_search_path= 3052 fi 3053 3054 if test "$linkmode,$pass" != "prog,link"; then 3055 vars="deplibs" 3056 else 3057 vars="compile_deplibs finalize_deplibs" 3058 fi 3059 for var in $vars dependency_libs; do 3060 # Add libraries to $var in reverse order 3061 eval tmp_libs=\"\$$var\" 3062 new_libs= 3063 for deplib in $tmp_libs; do 3064 # FIXME: Pedantically, this is the right thing to do, so 3065 # that some nasty dependency loop isn't accidentally 3066 # broken: 3067 #new_libs="$deplib $new_libs" 3068 # Pragmatically, this seems to cause very few problems in 3069 # practice: 3070 case $deplib in 3071 -L*) new_libs="$deplib $new_libs" ;; 3072 -R*) ;; 3073 *) 3074 # And here is the reason: when a library appears more 3075 # than once as an explicit dependence of a library, or 3076 # is implicitly linked in more than once by the 3077 # compiler, it is considered special, and multiple 3078 # occurrences thereof are not removed. Compare this 3079 # with having the same library being listed as a 3080 # dependency of multiple other libraries: in this case, 3081 # we know (pedantically, we assume) the library does not 3082 # need to be listed more than once, so we keep only the 3083 # last copy. This is not always right, but it is rare 3084 # enough that we require users that really mean to play 3085 # such unportable linking tricks to link the library 3086 # using -Wl,-lname, so that libtool does not consider it 3087 # for duplicate removal. 3088 case " $specialdeplibs " in 3089 *" $deplib "*) new_libs="$deplib $new_libs" ;; 3090 *) 3091 case " $new_libs " in 3092 *" $deplib "*) ;; 3093 *) new_libs="$deplib $new_libs" ;; 3094 esac 3095 ;; 3096 esac 3097 ;; 3098 esac 3099 done 3100 tmp_libs= 3101 for deplib in $new_libs; do 3102 case $deplib in 3103 -L*) 3104 case " $tmp_libs " in 3105 *" $deplib "*) ;; 3106 *) tmp_libs="$tmp_libs $deplib" ;; 3107 esac 3108 ;; 3109 *) tmp_libs="$tmp_libs $deplib" ;; 3110 esac 3111 done 3112 eval $var=\"$tmp_libs\" 3113 done # for var 3114 fi 3115 # Last step: remove runtime libs from dependency_libs 3116 # (they stay in deplibs) 3117 tmp_libs= 3118 for i in $dependency_libs ; do 3119 case " $predeps $postdeps $compiler_lib_search_path " in 3120 *" $i "*) 3121 i="" 3122 ;; 3123 esac 3124 if test -n "$i" ; then 3125 tmp_libs="$tmp_libs $i" 3126 fi 3127 done 3128 dependency_libs=$tmp_libs 3129 done # for pass 3130 if test "$linkmode" = prog; then 3131 dlfiles="$newdlfiles" 3132 dlprefiles="$newdlprefiles" 3133 fi 3134 3135 case $linkmode in 3136 oldlib) 3137 case " $deplibs" in 3138 *\ -l* | *\ -L*) 3139 $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;; 3140 esac 3141 3142 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 3143 $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2 3144 fi 3145 3146 if test -n "$rpath"; then 3147 $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2 3148 fi 3149 3150 if test -n "$xrpath"; then 3151 $echo "$modename: warning: \`-R' is ignored for archives" 1>&2 3152 fi 3153 3154 if test -n "$vinfo"; then 3155 $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2 3156 fi 3157 3158 if test -n "$release"; then 3159 $echo "$modename: warning: \`-release' is ignored for archives" 1>&2 3160 fi 3161 3162 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 3163 $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2 3164 fi 3165 3166 # Now set the variables for building old libraries. 3167 build_libtool_libs=no 3168 oldlibs="$output" 3169 objs="$objs$old_deplibs" 3170 ;; 3171 3172 lib) 3173 # Make sure we only generate libraries of the form `libNAME.la'. 3174 case $outputname in 3175 lib*) 3176 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'` 3177 eval shared_ext=\"$shrext_cmds\" 3178 eval libname=\"$libname_spec\" 3179 ;; 3180 *) 3181 if test "$module" = no; then 3182 $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2 3183 $echo "$help" 1>&2 3184 exit $EXIT_FAILURE 3185 fi 3186 if test "$need_lib_prefix" != no; then 3187 # Add the "lib" prefix for modules if required 3188 name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 3189 eval shared_ext=\"$shrext_cmds\" 3190 eval libname=\"$libname_spec\" 3191 else 3192 libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'` 3193 fi 3194 ;; 3195 esac 3196 3197 if test -n "$objs"; then 3198 if test "$deplibs_check_method" != pass_all; then 3199 $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1 3200 exit $EXIT_FAILURE 3201 else 3202 $echo 3203 $echo "*** Warning: Linking the shared library $output against the non-libtool" 3204 $echo "*** objects $objs is not portable!" 3205 libobjs="$libobjs $objs" 3206 fi 3207 fi 3208 3209 if test "$dlself" != no; then 3210 $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2 3211 fi 3212 3213 set dummy $rpath 3214 if test "$#" -gt 2; then 3215 $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2 3216 fi 3217 install_libdir="$2" 3218 3219 oldlibs= 3220 if test -z "$rpath"; then 3221 if test "$build_libtool_libs" = yes; then 3222 # Building a libtool convenience library. 3223 # Some compilers have problems with a `.al' extension so 3224 # convenience libraries should have the same extension an 3225 # archive normally would. 3226 oldlibs="$output_objdir/$libname.$libext $oldlibs" 3227 build_libtool_libs=convenience 3228 build_old_libs=yes 3229 fi 3230 3231 if test -n "$vinfo"; then 3232 $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2 3233 fi 3234 3235 if test -n "$release"; then 3236 $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2 3237 fi 3238 else 3239 3240 # Parse the version information argument. 3241 save_ifs="$IFS"; IFS=':' 3242 set dummy $vinfo 0 0 0 3243 IFS="$save_ifs" 3244 3245 if test -n "$8"; then 3246 $echo "$modename: too many parameters to \`-version-info'" 1>&2 3247 $echo "$help" 1>&2 3248 exit $EXIT_FAILURE 3249 fi 3250 3251 # convert absolute version numbers to libtool ages 3252 # this retains compatibility with .la files and attempts 3253 # to make the code below a bit more comprehensible 3254 3255 case $vinfo_number in 3256 yes) 3257 number_major="$2" 3258 number_minor="$3" 3259 number_revision="$4" 3260 # 3261 # There are really only two kinds -- those that 3262 # use the current revision as the major version 3263 # and those that subtract age and use age as 3264 # a minor version. But, then there is irix 3265 # which has an extra 1 added just for fun 3266 # 3267 case $version_type in 3268 darwin|linux|osf|windows|none) 3269 current=`expr $number_major + $number_minor` 3270 age="$number_minor" 3271 revision="$number_revision" 3272 ;; 3273 freebsd-aout|freebsd-elf|sunos) 3274 current="$number_major" 3275 revision="$number_minor" 3276 age="0" 3277 ;; 3278 irix|nonstopux) 3279 current=`expr $number_major + $number_minor` 3280 age="$number_minor" 3281 revision="$number_minor" 3282 lt_irix_increment=no 3283 ;; 3284 esac 3285 ;; 3286 no) 3287 current="$2" 3288 revision="$3" 3289 age="$4" 3290 ;; 3291 esac 3292 3293 # Check that each of the things are valid numbers. 3294 case $current in 3295 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; 3296 *) 3297 $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2 3298 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3299 exit $EXIT_FAILURE 3300 ;; 3301 esac 3302 3303 case $revision in 3304 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; 3305 *) 3306 $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2 3307 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3308 exit $EXIT_FAILURE 3309 ;; 3310 esac 3311 3312 case $age in 3313 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; 3314 *) 3315 $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2 3316 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3317 exit $EXIT_FAILURE 3318 ;; 3319 esac 3320 3321 if test "$age" -gt "$current"; then 3322 $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2 3323 $echo "$modename: \`$vinfo' is not valid version information" 1>&2 3324 exit $EXIT_FAILURE 3325 fi 3326 3327 # Calculate the version variables. 3328 major= 3329 versuffix= 3330 verstring= 3331 case $version_type in 3332 none) ;; 3333 3334 darwin) 3335 # Like Linux, but with the current version available in 3336 # verstring for coding it into the library header 3337 major=.`expr $current - $age` 3338 versuffix="$major.$age.$revision" 3339 # Darwin ld doesn't like 0 for these options... 3340 minor_current=`expr $current + 1` 3341 xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" 3342 verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" 3343 ;; 3344 3345 freebsd-aout) 3346 major=".$current" 3347 versuffix=".$current.$revision"; 3348 ;; 3349 3350 freebsd-elf) 3351 major=".$current" 3352 versuffix=".$current"; 3353 ;; 3354 3355 irix | nonstopux) 3356 if test "X$lt_irix_increment" = "Xno"; then 3357 major=`expr $current - $age` 3358 else 3359 major=`expr $current - $age + 1` 3360 fi 3361 case $version_type in 3362 nonstopux) verstring_prefix=nonstopux ;; 3363 *) verstring_prefix=sgi ;; 3364 esac 3365 verstring="$verstring_prefix$major.$revision" 3366 3367 # Add in all the interfaces that we are compatible with. 3368 loop=$revision 3369 while test "$loop" -ne 0; do 3370 iface=`expr $revision - $loop` 3371 loop=`expr $loop - 1` 3372 verstring="$verstring_prefix$major.$iface:$verstring" 3373 done 3374 3375 # Before this point, $major must not contain `.'. 3376 major=.$major 3377 versuffix="$major.$revision" 3378 ;; 3379 3380 linux) 3381 major=.`expr $current - $age` 3382 versuffix="$major.$age.$revision" 3383 ;; 3384 3385 osf) 3386 major=.`expr $current - $age` 3387 versuffix=".$current.$age.$revision" 3388 verstring="$current.$age.$revision" 3389 3390 # Add in all the interfaces that we are compatible with. 3391 loop=$age 3392 while test "$loop" -ne 0; do 3393 iface=`expr $current - $loop` 3394 loop=`expr $loop - 1` 3395 verstring="$verstring:${iface}.0" 3396 done 3397 3398 # Make executables depend on our current version. 3399 verstring="$verstring:${current}.0" 3400 ;; 3401 3402 sunos) 3403 major=".$current" 3404 versuffix=".$current.$revision" 3405 ;; 3406 3407 windows) 3408 # Use '-' rather than '.', since we only want one 3409 # extension on DOS 8.3 filesystems. 3410 major=`expr $current - $age` 3411 versuffix="-$major" 3412 ;; 3413 3414 *) 3415 $echo "$modename: unknown library version type \`$version_type'" 1>&2 3416 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 3417 exit $EXIT_FAILURE 3418 ;; 3419 esac 3420 3421 # Clear the version info if we defaulted, and they specified a release. 3422 if test -z "$vinfo" && test -n "$release"; then 3423 major= 3424 case $version_type in 3425 darwin) 3426 # we can't check for "0.0" in archive_cmds due to quoting 3427 # problems, so we reset it completely 3428 verstring= 3429 ;; 3430 *) 3431 verstring="0.0" 3432 ;; 3433 esac 3434 if test "$need_version" = no; then 3435 versuffix= 3436 else 3437 versuffix=".0.0" 3438 fi 3439 fi 3440 3441 # Remove version info from name if versioning should be avoided 3442 if test "$avoid_version" = yes && test "$need_version" = no; then 3443 major= 3444 versuffix= 3445 verstring="" 3446 fi 3447 3448 # Check to see if the archive will have undefined symbols. 3449 if test "$allow_undefined" = yes; then 3450 if test "$allow_undefined_flag" = unsupported; then 3451 $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2 3452 build_libtool_libs=no 3453 build_old_libs=yes 3454 fi 3455 else 3456 # Don't allow undefined symbols. 3457 allow_undefined_flag="$no_undefined_flag" 3458 fi 3459 fi 3460 3461 if test "$mode" != relink; then 3462 # Remove our outputs, but don't remove object files since they 3463 # may have been created when compiling PIC objects. 3464 removelist= 3465 tempremovelist=`$echo "$output_objdir/*"` 3466 for p in $tempremovelist; do 3467 case $p in 3468 *.$objext) 3469 ;; 3470 $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) 3471 if test "X$precious_files_regex" != "X"; then 3472 if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 3473 then 3474 continue 3475 fi 3476 fi 3477 removelist="$removelist $p" 3478 ;; 3479 *) ;; 3480 esac 3481 done 3482 if test -n "$removelist"; then 3483 $show "${rm}r $removelist" 3484 $run ${rm}r $removelist 3485 fi 3486 fi 3487 3488 # Now set the variables for building old libraries. 3489 if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then 3490 oldlibs="$oldlibs $output_objdir/$libname.$libext" 3491 3492 # Transform .lo files to .o files. 3493 oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP` 3494 fi 3495 3496 # Eliminate all temporary directories. 3497 #for path in $notinst_path; do 3498 # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"` 3499 # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"` 3500 # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"` 3501 #done 3502 3503 if test -n "$xrpath"; then 3504 # If the user specified any rpath flags, then add them. 3505 temp_xrpath= 3506 for libdir in $xrpath; do 3507 temp_xrpath="$temp_xrpath -R$libdir" 3508 case "$finalize_rpath " in 3509 *" $libdir "*) ;; 3510 *) finalize_rpath="$finalize_rpath $libdir" ;; 3511 esac 3512 done 3513 if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then 3514 dependency_libs="$temp_xrpath $dependency_libs" 3515 fi 3516 fi 3517 3518 # Make sure dlfiles contains only unique files that won't be dlpreopened 3519 old_dlfiles="$dlfiles" 3520 dlfiles= 3521 for lib in $old_dlfiles; do 3522 case " $dlprefiles $dlfiles " in 3523 *" $lib "*) ;; 3524 *) dlfiles="$dlfiles $lib" ;; 3525 esac 3526 done 3527 3528 # Make sure dlprefiles contains only unique files 3529 old_dlprefiles="$dlprefiles" 3530 dlprefiles= 3531 for lib in $old_dlprefiles; do 3532 case "$dlprefiles " in 3533 *" $lib "*) ;; 3534 *) dlprefiles="$dlprefiles $lib" ;; 3535 esac 3536 done 3537 3538 if test "$build_libtool_libs" = yes; then 3539 if test -n "$rpath"; then 3540 case $host in 3541 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*) 3542 # these systems don't actually have a c library (as such)! 3543 ;; 3544 *-*-rhapsody* | *-*-darwin1.[012]) 3545 # Rhapsody C library is in the System framework 3546 deplibs="$deplibs -framework System" 3547 ;; 3548 *-*-netbsd*) 3549 # Don't link with libc until the a.out ld.so is fixed. 3550 ;; 3551 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) 3552 # Do not include libc due to us having libc/libc_r. 3553 ;; 3554 *-*-sco3.2v5* | *-*-sco5v6*) 3555 # Causes problems with __ctype 3556 ;; 3557 *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) 3558 # Compiler inserts libc in the correct place for threads to work 3559 ;; 3560 *) 3561 # Add libc to deplibs on all other systems if necessary. 3562 if test "$build_libtool_need_lc" = "yes"; then 3563 deplibs="$deplibs -lc" 3564 fi 3565 ;; 3566 esac 3567 fi 3568 3569 # Transform deplibs into only deplibs that can be linked in shared. 3570 name_save=$name 3571 libname_save=$libname 3572 release_save=$release 3573 versuffix_save=$versuffix 3574 major_save=$major 3575 # I'm not sure if I'm treating the release correctly. I think 3576 # release should show up in the -l (ie -lgmp5) so we don't want to 3577 # add it in twice. Is that correct? 3578 release="" 3579 versuffix="" 3580 major="" 3581 newdeplibs= 3582 droppeddeps=no 3583 case $deplibs_check_method in 3584 pass_all) 3585 # Don't check for shared/static. Everything works. 3586 # This might be a little naive. We might want to check 3587 # whether the library exists or not. But this is on 3588 # osf3 & osf4 and I'm not really sure... Just 3589 # implementing what was already the behavior. 3590 newdeplibs=$deplibs 3591 ;; 3592 test_compile) 3593 # This code stresses the "libraries are programs" paradigm to its 3594 # limits. Maybe even breaks it. We compile a program, linking it 3595 # against the deplibs as a proxy for the library. Then we can check 3596 # whether they linked in statically or dynamically with ldd. 3597 $rm conftest.c 3598 cat > conftest.c <<EOF 3599 int main() { return 0; } 3600EOF 3601 $rm conftest 3602 if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then 3603 ldd_output=`ldd conftest` 3604 for i in $deplibs; do 3605 name=`expr $i : '-l\(.*\)'` 3606 # If $name is empty we are operating on a -L argument. 3607 if test "$name" != "" && test "$name" != "0"; then 3608 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3609 case " $predeps $postdeps " in 3610 *" $i "*) 3611 newdeplibs="$newdeplibs $i" 3612 i="" 3613 ;; 3614 esac 3615 fi 3616 if test -n "$i" ; then 3617 libname=`eval \\$echo \"$libname_spec\"` 3618 deplib_matches=`eval \\$echo \"$library_names_spec\"` 3619 set dummy $deplib_matches 3620 deplib_match=$2 3621 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 3622 newdeplibs="$newdeplibs $i" 3623 else 3624 droppeddeps=yes 3625 $echo 3626 $echo "*** Warning: dynamic linker does not accept needed library $i." 3627 $echo "*** I have the capability to make that library automatically link in when" 3628 $echo "*** you link to this library. But I can only do this if you have a" 3629 $echo "*** shared version of the library, which I believe you do not have" 3630 $echo "*** because a test_compile did reveal that the linker did not use it for" 3631 $echo "*** its dynamic dependency list that programs get resolved with at runtime." 3632 fi 3633 fi 3634 else 3635 newdeplibs="$newdeplibs $i" 3636 fi 3637 done 3638 else 3639 # Error occurred in the first compile. Let's try to salvage 3640 # the situation: Compile a separate program for each library. 3641 for i in $deplibs; do 3642 name=`expr $i : '-l\(.*\)'` 3643 # If $name is empty we are operating on a -L argument. 3644 if test "$name" != "" && test "$name" != "0"; then 3645 $rm conftest 3646 if $LTCC $LTCFLAGS -o conftest conftest.c $i; then 3647 ldd_output=`ldd conftest` 3648 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3649 case " $predeps $postdeps " in 3650 *" $i "*) 3651 newdeplibs="$newdeplibs $i" 3652 i="" 3653 ;; 3654 esac 3655 fi 3656 if test -n "$i" ; then 3657 libname=`eval \\$echo \"$libname_spec\"` 3658 deplib_matches=`eval \\$echo \"$library_names_spec\"` 3659 set dummy $deplib_matches 3660 deplib_match=$2 3661 if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then 3662 newdeplibs="$newdeplibs $i" 3663 else 3664 droppeddeps=yes 3665 $echo 3666 $echo "*** Warning: dynamic linker does not accept needed library $i." 3667 $echo "*** I have the capability to make that library automatically link in when" 3668 $echo "*** you link to this library. But I can only do this if you have a" 3669 $echo "*** shared version of the library, which you do not appear to have" 3670 $echo "*** because a test_compile did reveal that the linker did not use this one" 3671 $echo "*** as a dynamic dependency that programs can get resolved with at runtime." 3672 fi 3673 fi 3674 else 3675 droppeddeps=yes 3676 $echo 3677 $echo "*** Warning! Library $i is needed by this library but I was not able to" 3678 $echo "*** make it link in! You will probably need to install it or some" 3679 $echo "*** library that it depends on before this library will be fully" 3680 $echo "*** functional. Installing it before continuing would be even better." 3681 fi 3682 else 3683 newdeplibs="$newdeplibs $i" 3684 fi 3685 done 3686 fi 3687 ;; 3688 file_magic*) 3689 set dummy $deplibs_check_method 3690 file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3691 for a_deplib in $deplibs; do 3692 name=`expr $a_deplib : '-l\(.*\)'` 3693 # If $name is empty we are operating on a -L argument. 3694 if test "$name" != "" && test "$name" != "0"; then 3695 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3696 case " $predeps $postdeps " in 3697 *" $a_deplib "*) 3698 newdeplibs="$newdeplibs $a_deplib" 3699 a_deplib="" 3700 ;; 3701 esac 3702 fi 3703 if test -n "$a_deplib" ; then 3704 libname=`eval \\$echo \"$libname_spec\"` 3705 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 3706 potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 3707 for potent_lib in $potential_libs; do 3708 # Follow soft links. 3709 if ls -lLd "$potent_lib" 2>/dev/null \ 3710 | grep " -> " >/dev/null; then 3711 continue 3712 fi 3713 # The statement above tries to avoid entering an 3714 # endless loop below, in case of cyclic links. 3715 # We might still enter an endless loop, since a link 3716 # loop can be closed while we follow links, 3717 # but so what? 3718 potlib="$potent_lib" 3719 while test -h "$potlib" 2>/dev/null; do 3720 potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` 3721 case $potliblink in 3722 [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; 3723 *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";; 3724 esac 3725 done 3726 if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \ 3727 | ${SED} 10q \ 3728 | $EGREP "$file_magic_regex" > /dev/null; then 3729 newdeplibs="$newdeplibs $a_deplib" 3730 a_deplib="" 3731 break 2 3732 fi 3733 done 3734 done 3735 fi 3736 if test -n "$a_deplib" ; then 3737 droppeddeps=yes 3738 $echo 3739 $echo "*** Warning: linker path does not have real file for library $a_deplib." 3740 $echo "*** I have the capability to make that library automatically link in when" 3741 $echo "*** you link to this library. But I can only do this if you have a" 3742 $echo "*** shared version of the library, which you do not appear to have" 3743 $echo "*** because I did check the linker path looking for a file starting" 3744 if test -z "$potlib" ; then 3745 $echo "*** with $libname but no candidates were found. (...for file magic test)" 3746 else 3747 $echo "*** with $libname and none of the candidates passed a file format test" 3748 $echo "*** using a file magic. Last file checked: $potlib" 3749 fi 3750 fi 3751 else 3752 # Add a -L argument. 3753 newdeplibs="$newdeplibs $a_deplib" 3754 fi 3755 done # Gone through all deplibs. 3756 ;; 3757 match_pattern*) 3758 set dummy $deplibs_check_method 3759 match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"` 3760 for a_deplib in $deplibs; do 3761 name=`expr $a_deplib : '-l\(.*\)'` 3762 # If $name is empty we are operating on a -L argument. 3763 if test -n "$name" && test "$name" != "0"; then 3764 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3765 case " $predeps $postdeps " in 3766 *" $a_deplib "*) 3767 newdeplibs="$newdeplibs $a_deplib" 3768 a_deplib="" 3769 ;; 3770 esac 3771 fi 3772 if test -n "$a_deplib" ; then 3773 libname=`eval \\$echo \"$libname_spec\"` 3774 for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do 3775 potential_libs=`ls $i/$libname[.-]* 2>/dev/null` 3776 for potent_lib in $potential_libs; do 3777 potlib="$potent_lib" # see symlink-check above in file_magic test 3778 if eval $echo \"$potent_lib\" 2>/dev/null \ 3779 | ${SED} 10q \ 3780 | $EGREP "$match_pattern_regex" > /dev/null; then 3781 newdeplibs="$newdeplibs $a_deplib" 3782 a_deplib="" 3783 break 2 3784 fi 3785 done 3786 done 3787 fi 3788 if test -n "$a_deplib" ; then 3789 droppeddeps=yes 3790 $echo 3791 $echo "*** Warning: linker path does not have real file for library $a_deplib." 3792 $echo "*** I have the capability to make that library automatically link in when" 3793 $echo "*** you link to this library. But I can only do this if you have a" 3794 $echo "*** shared version of the library, which you do not appear to have" 3795 $echo "*** because I did check the linker path looking for a file starting" 3796 if test -z "$potlib" ; then 3797 $echo "*** with $libname but no candidates were found. (...for regex pattern test)" 3798 else 3799 $echo "*** with $libname and none of the candidates passed a file format test" 3800 $echo "*** using a regex pattern. Last file checked: $potlib" 3801 fi 3802 fi 3803 else 3804 # Add a -L argument. 3805 newdeplibs="$newdeplibs $a_deplib" 3806 fi 3807 done # Gone through all deplibs. 3808 ;; 3809 none | unknown | *) 3810 newdeplibs="" 3811 tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \ 3812 -e 's/ -[LR][^ ]*//g'` 3813 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 3814 for i in $predeps $postdeps ; do 3815 # can't use Xsed below, because $i might contain '/' 3816 tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"` 3817 done 3818 fi 3819 if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \ 3820 | grep . >/dev/null; then 3821 $echo 3822 if test "X$deplibs_check_method" = "Xnone"; then 3823 $echo "*** Warning: inter-library dependencies are not supported in this platform." 3824 else 3825 $echo "*** Warning: inter-library dependencies are not known to be supported." 3826 fi 3827 $echo "*** All declared inter-library dependencies are being dropped." 3828 droppeddeps=yes 3829 fi 3830 ;; 3831 esac 3832 versuffix=$versuffix_save 3833 major=$major_save 3834 release=$release_save 3835 libname=$libname_save 3836 name=$name_save 3837 3838 case $host in 3839 *-*-rhapsody* | *-*-darwin1.[012]) 3840 # On Rhapsody replace the C library is the System framework 3841 newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'` 3842 ;; 3843 esac 3844 3845 if test "$droppeddeps" = yes; then 3846 if test "$module" = yes; then 3847 $echo 3848 $echo "*** Warning: libtool could not satisfy all declared inter-library" 3849 $echo "*** dependencies of module $libname. Therefore, libtool will create" 3850 $echo "*** a static module, that should work as long as the dlopening" 3851 $echo "*** application is linked with the -dlopen flag." 3852 if test -z "$global_symbol_pipe"; then 3853 $echo 3854 $echo "*** However, this would only work if libtool was able to extract symbol" 3855 $echo "*** lists from a program, using \`nm' or equivalent, but libtool could" 3856 $echo "*** not find such a program. So, this module is probably useless." 3857 $echo "*** \`nm' from GNU binutils and a full rebuild may help." 3858 fi 3859 if test "$build_old_libs" = no; then 3860 oldlibs="$output_objdir/$libname.$libext" 3861 build_libtool_libs=module 3862 build_old_libs=yes 3863 else 3864 build_libtool_libs=no 3865 fi 3866 else 3867 $echo "*** The inter-library dependencies that have been dropped here will be" 3868 $echo "*** automatically added whenever a program is linked with this library" 3869 $echo "*** or is declared to -dlopen it." 3870 3871 if test "$allow_undefined" = no; then 3872 $echo 3873 $echo "*** Since this library must not contain undefined symbols," 3874 $echo "*** because either the platform does not support them or" 3875 $echo "*** it was explicitly requested with -no-undefined," 3876 $echo "*** libtool will only create a static version of it." 3877 if test "$build_old_libs" = no; then 3878 oldlibs="$output_objdir/$libname.$libext" 3879 build_libtool_libs=module 3880 build_old_libs=yes 3881 else 3882 build_libtool_libs=no 3883 fi 3884 fi 3885 fi 3886 fi 3887 # Done checking deplibs! 3888 deplibs=$newdeplibs 3889 fi 3890 3891 3892 # move library search paths that coincide with paths to not yet 3893 # installed libraries to the beginning of the library search list 3894 new_libs= 3895 for path in $notinst_path; do 3896 case " $new_libs " in 3897 *" -L$path/$objdir "*) ;; 3898 *) 3899 case " $deplibs " in 3900 *" -L$path/$objdir "*) 3901 new_libs="$new_libs -L$path/$objdir" ;; 3902 esac 3903 ;; 3904 esac 3905 done 3906 for deplib in $deplibs; do 3907 case $deplib in 3908 -L*) 3909 case " $new_libs " in 3910 *" $deplib "*) ;; 3911 *) new_libs="$new_libs $deplib" ;; 3912 esac 3913 ;; 3914 *) new_libs="$new_libs $deplib" ;; 3915 esac 3916 done 3917 deplibs="$new_libs" 3918 3919 3920 # All the library-specific variables (install_libdir is set above). 3921 library_names= 3922 old_library= 3923 dlname= 3924 3925 # Test again, we may have decided not to build it any more 3926 if test "$build_libtool_libs" = yes; then 3927 if test "$hardcode_into_libs" = yes; then 3928 # Hardcode the library paths 3929 hardcode_libdirs= 3930 dep_rpath= 3931 rpath="$finalize_rpath" 3932 test "$mode" != relink && rpath="$compile_rpath$rpath" 3933 for libdir in $rpath; do 3934 if test -n "$hardcode_libdir_flag_spec"; then 3935 if test -n "$hardcode_libdir_separator"; then 3936 if test -z "$hardcode_libdirs"; then 3937 hardcode_libdirs="$libdir" 3938 else 3939 # Just accumulate the unique libdirs. 3940 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 3941 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 3942 ;; 3943 *) 3944 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 3945 ;; 3946 esac 3947 fi 3948 else 3949 eval flag=\"$hardcode_libdir_flag_spec\" 3950 dep_rpath="$dep_rpath $flag" 3951 fi 3952 elif test -n "$runpath_var"; then 3953 case "$perm_rpath " in 3954 *" $libdir "*) ;; 3955 *) perm_rpath="$perm_rpath $libdir" ;; 3956 esac 3957 fi 3958 done 3959 # Substitute the hardcoded libdirs into the rpath. 3960 if test -n "$hardcode_libdir_separator" && 3961 test -n "$hardcode_libdirs"; then 3962 libdir="$hardcode_libdirs" 3963 if test -n "$hardcode_libdir_flag_spec_ld"; then 3964 case $archive_cmds in 3965 *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;; 3966 *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;; 3967 esac 3968 else 3969 eval dep_rpath=\"$hardcode_libdir_flag_spec\" 3970 fi 3971 fi 3972 if test -n "$runpath_var" && test -n "$perm_rpath"; then 3973 # We should set the runpath_var. 3974 rpath= 3975 for dir in $perm_rpath; do 3976 rpath="$rpath$dir:" 3977 done 3978 eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" 3979 fi 3980 test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" 3981 fi 3982 3983 shlibpath="$finalize_shlibpath" 3984 test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath" 3985 if test -n "$shlibpath"; then 3986 eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" 3987 fi 3988 3989 # Get the real and link names of the library. 3990 eval shared_ext=\"$shrext_cmds\" 3991 eval library_names=\"$library_names_spec\" 3992 set dummy $library_names 3993 realname="$2" 3994 shift; shift 3995 3996 if test -n "$soname_spec"; then 3997 eval soname=\"$soname_spec\" 3998 else 3999 soname="$realname" 4000 fi 4001 if test -z "$dlname"; then 4002 dlname=$soname 4003 fi 4004 4005 lib="$output_objdir/$realname" 4006 linknames= 4007 for link 4008 do 4009 linknames="$linknames $link" 4010 done 4011 4012 # Use standard objects if they are pic 4013 test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4014 4015 # Prepare the list of exported symbols 4016 if test -z "$export_symbols"; then 4017 if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then 4018 $show "generating symbol list for \`$libname.la'" 4019 export_symbols="$output_objdir/$libname.exp" 4020 $run $rm $export_symbols 4021 cmds=$export_symbols_cmds 4022 save_ifs="$IFS"; IFS='~' 4023 for cmd in $cmds; do 4024 IFS="$save_ifs" 4025 eval cmd=\"$cmd\" 4026 if len=`expr "X$cmd" : ".*"` && 4027 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 4028 $show "$cmd" 4029 $run eval "$cmd" || exit $? 4030 skipped_export=false 4031 else 4032 # The command line is too long to execute in one step. 4033 $show "using reloadable object file for export list..." 4034 skipped_export=: 4035 # Break out early, otherwise skipped_export may be 4036 # set to false by a later but shorter cmd. 4037 break 4038 fi 4039 done 4040 IFS="$save_ifs" 4041 if test -n "$export_symbols_regex"; then 4042 $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\"" 4043 $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' 4044 $show "$mv \"${export_symbols}T\" \"$export_symbols\"" 4045 $run eval '$mv "${export_symbols}T" "$export_symbols"' 4046 fi 4047 fi 4048 fi 4049 4050 if test -n "$export_symbols" && test -n "$include_expsyms"; then 4051 $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"' 4052 fi 4053 4054 tmp_deplibs= 4055 inst_prefix_arg= 4056 for test_deplib in $deplibs; do 4057 case " $convenience " in 4058 *" $test_deplib "*) ;; 4059 *) 4060 if test -n "$inst_prefix_dir" && (echo "$test_deplib" | grep -- "$inst_prefix_dir" >/dev/null); then 4061 inst_prefix_arg="$inst_prefix_arg $test_deplib" 4062 else 4063 tmp_deplibs="$tmp_deplibs $test_deplib" 4064 fi 4065 ;; 4066 esac 4067 done 4068 deplibs="$tmp_deplibs" 4069 if test -n "$inst_prefix_arg"; then 4070 deplibs="$inst_prefix_arg $deplibs" 4071 fi 4072 4073 if test -n "$convenience"; then 4074 if test -n "$whole_archive_flag_spec"; then 4075 save_libobjs=$libobjs 4076 eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 4077 else 4078 gentop="$output_objdir/${outputname}x" 4079 generated="$generated $gentop" 4080 4081 func_extract_archives $gentop $convenience 4082 libobjs="$libobjs $func_extract_archives_result" 4083 fi 4084 fi 4085 4086 if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then 4087 eval flag=\"$thread_safe_flag_spec\" 4088 linker_flags="$linker_flags $flag" 4089 fi 4090 4091 # Make a backup of the uninstalled library when relinking 4092 if test "$mode" = relink; then 4093 $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $? 4094 fi 4095 4096 # Do each of the archive commands. 4097 if test "$module" = yes && test -n "$module_cmds" ; then 4098 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 4099 eval test_cmds=\"$module_expsym_cmds\" 4100 cmds=$module_expsym_cmds 4101 else 4102 eval test_cmds=\"$module_cmds\" 4103 cmds=$module_cmds 4104 fi 4105 else 4106 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 4107 eval test_cmds=\"$archive_expsym_cmds\" 4108 cmds=$archive_expsym_cmds 4109 else 4110 eval test_cmds=\"$archive_cmds\" 4111 cmds=$archive_cmds 4112 fi 4113 fi 4114 4115 if test "X$skipped_export" != "X:" && 4116 len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 4117 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 4118 : 4119 else 4120 # The command line is too long to link in one step, link piecewise. 4121 $echo "creating reloadable object files..." 4122 4123 # Save the value of $output and $libobjs because we want to 4124 # use them later. If we have whole_archive_flag_spec, we 4125 # want to use save_libobjs as it was before 4126 # whole_archive_flag_spec was expanded, because we can't 4127 # assume the linker understands whole_archive_flag_spec. 4128 # This may have to be revisited, in case too many 4129 # convenience libraries get linked in and end up exceeding 4130 # the spec. 4131 if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then 4132 save_libobjs=$libobjs 4133 fi 4134 save_output=$output 4135 output_la=`$echo "X$output" | $Xsed -e "$basename"` 4136 4137 # Clear the reloadable object creation command queue and 4138 # initialize k to one. 4139 test_cmds= 4140 concat_cmds= 4141 objlist= 4142 delfiles= 4143 last_robj= 4144 k=1 4145 output=$output_objdir/$output_la-${k}.$objext 4146 # Loop over the list of objects to be linked. 4147 for obj in $save_libobjs 4148 do 4149 eval test_cmds=\"$reload_cmds $objlist $last_robj\" 4150 if test "X$objlist" = X || 4151 { len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 4152 test "$len" -le "$max_cmd_len"; }; then 4153 objlist="$objlist $obj" 4154 else 4155 # The command $test_cmds is almost too long, add a 4156 # command to the queue. 4157 if test "$k" -eq 1 ; then 4158 # The first file doesn't have a previous command to add. 4159 eval concat_cmds=\"$reload_cmds $objlist $last_robj\" 4160 else 4161 # All subsequent reloadable object files will link in 4162 # the last one created. 4163 eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\" 4164 fi 4165 last_robj=$output_objdir/$output_la-${k}.$objext 4166 k=`expr $k + 1` 4167 output=$output_objdir/$output_la-${k}.$objext 4168 objlist=$obj 4169 len=1 4170 fi 4171 done 4172 # Handle the remaining objects by creating one last 4173 # reloadable object file. All subsequent reloadable object 4174 # files will link in the last one created. 4175 test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 4176 eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\" 4177 4178 if ${skipped_export-false}; then 4179 $show "generating symbol list for \`$libname.la'" 4180 export_symbols="$output_objdir/$libname.exp" 4181 $run $rm $export_symbols 4182 libobjs=$output 4183 # Append the command to create the export file. 4184 eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\" 4185 fi 4186 4187 # Set up a command to remove the reloadable object files 4188 # after they are used. 4189 i=0 4190 while test "$i" -lt "$k" 4191 do 4192 i=`expr $i + 1` 4193 delfiles="$delfiles $output_objdir/$output_la-${i}.$objext" 4194 done 4195 4196 $echo "creating a temporary reloadable object file: $output" 4197 4198 # Loop through the commands generated above and execute them. 4199 save_ifs="$IFS"; IFS='~' 4200 for cmd in $concat_cmds; do 4201 IFS="$save_ifs" 4202 $show "$cmd" 4203 $run eval "$cmd" || exit $? 4204 done 4205 IFS="$save_ifs" 4206 4207 libobjs=$output 4208 # Restore the value of output. 4209 output=$save_output 4210 4211 if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then 4212 eval libobjs=\"\$libobjs $whole_archive_flag_spec\" 4213 fi 4214 # Expand the library linking commands again to reset the 4215 # value of $libobjs for piecewise linking. 4216 4217 # Do each of the archive commands. 4218 if test "$module" = yes && test -n "$module_cmds" ; then 4219 if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then 4220 cmds=$module_expsym_cmds 4221 else 4222 cmds=$module_cmds 4223 fi 4224 else 4225 if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then 4226 cmds=$archive_expsym_cmds 4227 else 4228 cmds=$archive_cmds 4229 fi 4230 fi 4231 4232 # Append the command to remove the reloadable object files 4233 # to the just-reset $cmds. 4234 eval cmds=\"\$cmds~\$rm $delfiles\" 4235 fi 4236 save_ifs="$IFS"; IFS='~' 4237 for cmd in $cmds; do 4238 IFS="$save_ifs" 4239 eval cmd=\"$cmd\" 4240 $show "$cmd" 4241 $run eval "$cmd" || { 4242 lt_exit=$? 4243 4244 # Restore the uninstalled library and exit 4245 if test "$mode" = relink; then 4246 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 4247 fi 4248 4249 exit $lt_exit 4250 } 4251 done 4252 IFS="$save_ifs" 4253 4254 # Restore the uninstalled library and exit 4255 if test "$mode" = relink; then 4256 $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $? 4257 4258 if test -n "$convenience"; then 4259 if test -z "$whole_archive_flag_spec"; then 4260 $show "${rm}r $gentop" 4261 $run ${rm}r "$gentop" 4262 fi 4263 fi 4264 4265 exit $EXIT_SUCCESS 4266 fi 4267 4268 # Create links to the real library. 4269 for linkname in $linknames; do 4270 if test "$realname" != "$linkname"; then 4271 $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)" 4272 $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $? 4273 fi 4274 done 4275 4276 # If -module or -export-dynamic was specified, set the dlname. 4277 if test "$module" = yes || test "$export_dynamic" = yes; then 4278 # On all known operating systems, these are identical. 4279 dlname="$soname" 4280 fi 4281 fi 4282 ;; 4283 4284 obj) 4285 case " $deplibs" in 4286 *\ -l* | *\ -L*) 4287 $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;; 4288 esac 4289 4290 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 4291 $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2 4292 fi 4293 4294 if test -n "$rpath"; then 4295 $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2 4296 fi 4297 4298 if test -n "$xrpath"; then 4299 $echo "$modename: warning: \`-R' is ignored for objects" 1>&2 4300 fi 4301 4302 if test -n "$vinfo"; then 4303 $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2 4304 fi 4305 4306 if test -n "$release"; then 4307 $echo "$modename: warning: \`-release' is ignored for objects" 1>&2 4308 fi 4309 4310 case $output in 4311 *.lo) 4312 if test -n "$objs$old_deplibs"; then 4313 $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2 4314 exit $EXIT_FAILURE 4315 fi 4316 libobj="$output" 4317 obj=`$echo "X$output" | $Xsed -e "$lo2o"` 4318 ;; 4319 *) 4320 libobj= 4321 obj="$output" 4322 ;; 4323 esac 4324 4325 # Delete the old objects. 4326 $run $rm $obj $libobj 4327 4328 # Objects from convenience libraries. This assumes 4329 # single-version convenience libraries. Whenever we create 4330 # different ones for PIC/non-PIC, this we'll have to duplicate 4331 # the extraction. 4332 reload_conv_objs= 4333 gentop= 4334 # reload_cmds runs $LD directly, so let us get rid of 4335 # -Wl from whole_archive_flag_spec and hope we can get by with 4336 # turning comma into space.. 4337 wl= 4338 4339 if test -n "$convenience"; then 4340 if test -n "$whole_archive_flag_spec"; then 4341 eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" 4342 reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'` 4343 else 4344 gentop="$output_objdir/${obj}x" 4345 generated="$generated $gentop" 4346 4347 func_extract_archives $gentop $convenience 4348 reload_conv_objs="$reload_objs $func_extract_archives_result" 4349 fi 4350 fi 4351 4352 # Create the old-style object. 4353 reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test 4354 4355 output="$obj" 4356 cmds=$reload_cmds 4357 save_ifs="$IFS"; IFS='~' 4358 for cmd in $cmds; do 4359 IFS="$save_ifs" 4360 eval cmd=\"$cmd\" 4361 $show "$cmd" 4362 $run eval "$cmd" || exit $? 4363 done 4364 IFS="$save_ifs" 4365 4366 # Exit if we aren't doing a library object file. 4367 if test -z "$libobj"; then 4368 if test -n "$gentop"; then 4369 $show "${rm}r $gentop" 4370 $run ${rm}r $gentop 4371 fi 4372 4373 exit $EXIT_SUCCESS 4374 fi 4375 4376 if test "$build_libtool_libs" != yes; then 4377 if test -n "$gentop"; then 4378 $show "${rm}r $gentop" 4379 $run ${rm}r $gentop 4380 fi 4381 4382 # Create an invalid libtool object if no PIC, so that we don't 4383 # accidentally link it into a program. 4384 # $show "echo timestamp > $libobj" 4385 # $run eval "echo timestamp > $libobj" || exit $? 4386 exit $EXIT_SUCCESS 4387 fi 4388 4389 if test -n "$pic_flag" || test "$pic_mode" != default; then 4390 # Only do commands if we really have different PIC objects. 4391 reload_objs="$libobjs $reload_conv_objs" 4392 output="$libobj" 4393 cmds=$reload_cmds 4394 save_ifs="$IFS"; IFS='~' 4395 for cmd in $cmds; do 4396 IFS="$save_ifs" 4397 eval cmd=\"$cmd\" 4398 $show "$cmd" 4399 $run eval "$cmd" || exit $? 4400 done 4401 IFS="$save_ifs" 4402 fi 4403 4404 if test -n "$gentop"; then 4405 $show "${rm}r $gentop" 4406 $run ${rm}r $gentop 4407 fi 4408 4409 exit $EXIT_SUCCESS 4410 ;; 4411 4412 prog) 4413 case $host in 4414 *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;; 4415 esac 4416 if test -n "$vinfo"; then 4417 $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2 4418 fi 4419 4420 if test -n "$release"; then 4421 $echo "$modename: warning: \`-release' is ignored for programs" 1>&2 4422 fi 4423 4424 if test "$preload" = yes; then 4425 if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown && 4426 test "$dlopen_self_static" = unknown; then 4427 $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support." 4428 fi 4429 fi 4430 4431 case $host in 4432 *-*-rhapsody* | *-*-darwin1.[012]) 4433 # On Rhapsody replace the C library is the System framework 4434 compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 4435 finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'` 4436 ;; 4437 esac 4438 4439 case $host in 4440 *darwin*) 4441 # Don't allow lazy linking, it breaks C++ global constructors 4442 if test "$tagname" = CXX ; then 4443 compile_command="$compile_command ${wl}-bind_at_load" 4444 finalize_command="$finalize_command ${wl}-bind_at_load" 4445 fi 4446 ;; 4447 esac 4448 4449 4450 # move library search paths that coincide with paths to not yet 4451 # installed libraries to the beginning of the library search list 4452 new_libs= 4453 for path in $notinst_path; do 4454 case " $new_libs " in 4455 *" -L$path/$objdir "*) ;; 4456 *) 4457 case " $compile_deplibs " in 4458 *" -L$path/$objdir "*) 4459 new_libs="$new_libs -L$path/$objdir" ;; 4460 esac 4461 ;; 4462 esac 4463 done 4464 for deplib in $compile_deplibs; do 4465 case $deplib in 4466 -L*) 4467 case " $new_libs " in 4468 *" $deplib "*) ;; 4469 *) new_libs="$new_libs $deplib" ;; 4470 esac 4471 ;; 4472 *) new_libs="$new_libs $deplib" ;; 4473 esac 4474 done 4475 compile_deplibs="$new_libs" 4476 4477 4478 compile_command="$compile_command $compile_deplibs" 4479 finalize_command="$finalize_command $finalize_deplibs" 4480 4481 if test -n "$rpath$xrpath"; then 4482 # If the user specified any rpath flags, then add them. 4483 for libdir in $rpath $xrpath; do 4484 # This is the magic to use -rpath. 4485 case "$finalize_rpath " in 4486 *" $libdir "*) ;; 4487 *) finalize_rpath="$finalize_rpath $libdir" ;; 4488 esac 4489 done 4490 fi 4491 4492 # Now hardcode the library paths 4493 rpath= 4494 hardcode_libdirs= 4495 for libdir in $compile_rpath $finalize_rpath; do 4496 if test -n "$hardcode_libdir_flag_spec"; then 4497 if test -n "$hardcode_libdir_separator"; then 4498 if test -z "$hardcode_libdirs"; then 4499 hardcode_libdirs="$libdir" 4500 else 4501 # Just accumulate the unique libdirs. 4502 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 4503 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 4504 ;; 4505 *) 4506 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 4507 ;; 4508 esac 4509 fi 4510 else 4511 eval flag=\"$hardcode_libdir_flag_spec\" 4512 rpath="$rpath $flag" 4513 fi 4514 elif test -n "$runpath_var"; then 4515 case "$perm_rpath " in 4516 *" $libdir "*) ;; 4517 *) perm_rpath="$perm_rpath $libdir" ;; 4518 esac 4519 fi 4520 case $host in 4521 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 4522 testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'` 4523 case :$dllsearchpath: in 4524 *":$libdir:"*) ;; 4525 *) dllsearchpath="$dllsearchpath:$libdir";; 4526 esac 4527 case :$dllsearchpath: in 4528 *":$testbindir:"*) ;; 4529 *) dllsearchpath="$dllsearchpath:$testbindir";; 4530 esac 4531 ;; 4532 esac 4533 done 4534 # Substitute the hardcoded libdirs into the rpath. 4535 if test -n "$hardcode_libdir_separator" && 4536 test -n "$hardcode_libdirs"; then 4537 libdir="$hardcode_libdirs" 4538 eval rpath=\" $hardcode_libdir_flag_spec\" 4539 fi 4540 compile_rpath="$rpath" 4541 4542 rpath= 4543 hardcode_libdirs= 4544 for libdir in $finalize_rpath; do 4545 if test -n "$hardcode_libdir_flag_spec"; then 4546 if test -n "$hardcode_libdir_separator"; then 4547 if test -z "$hardcode_libdirs"; then 4548 hardcode_libdirs="$libdir" 4549 else 4550 # Just accumulate the unique libdirs. 4551 case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in 4552 *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) 4553 ;; 4554 *) 4555 hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir" 4556 ;; 4557 esac 4558 fi 4559 else 4560 eval flag=\"$hardcode_libdir_flag_spec\" 4561 rpath="$rpath $flag" 4562 fi 4563 elif test -n "$runpath_var"; then 4564 case "$finalize_perm_rpath " in 4565 *" $libdir "*) ;; 4566 *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;; 4567 esac 4568 fi 4569 done 4570 # Substitute the hardcoded libdirs into the rpath. 4571 if test -n "$hardcode_libdir_separator" && 4572 test -n "$hardcode_libdirs"; then 4573 libdir="$hardcode_libdirs" 4574 eval rpath=\" $hardcode_libdir_flag_spec\" 4575 fi 4576 finalize_rpath="$rpath" 4577 4578 if test -n "$libobjs" && test "$build_old_libs" = yes; then 4579 # Transform all the library objects into standard objects. 4580 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4581 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4582 fi 4583 4584 dlsyms= 4585 if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then 4586 if test -n "$NM" && test -n "$global_symbol_pipe"; then 4587 dlsyms="${outputname}S.c" 4588 else 4589 $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2 4590 fi 4591 fi 4592 4593 if test -n "$dlsyms"; then 4594 case $dlsyms in 4595 "") ;; 4596 *.c) 4597 # Discover the nlist of each of the dlfiles. 4598 nlist="$output_objdir/${outputname}.nm" 4599 4600 $show "$rm $nlist ${nlist}S ${nlist}T" 4601 $run $rm "$nlist" "${nlist}S" "${nlist}T" 4602 4603 # Parse the name list into a source file. 4604 $show "creating $output_objdir/$dlsyms" 4605 4606 test -z "$run" && $echo > "$output_objdir/$dlsyms" "\ 4607/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */ 4608/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */ 4609 4610#ifdef __cplusplus 4611extern \"C\" { 4612#endif 4613 4614/* Prevent the only kind of declaration conflicts we can make. */ 4615#define lt_preloaded_symbols some_other_symbol 4616 4617/* External symbol declarations for the compiler. */\ 4618" 4619 4620 if test "$dlself" = yes; then 4621 $show "generating symbol list for \`$output'" 4622 4623 test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist" 4624 4625 # Add our own program objects to the symbol list. 4626 progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP` 4627 for arg in $progfiles; do 4628 $show "extracting global C symbols from \`$arg'" 4629 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 4630 done 4631 4632 if test -n "$exclude_expsyms"; then 4633 $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' 4634 $run eval '$mv "$nlist"T "$nlist"' 4635 fi 4636 4637 if test -n "$export_symbols_regex"; then 4638 $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' 4639 $run eval '$mv "$nlist"T "$nlist"' 4640 fi 4641 4642 # Prepare the list of exported symbols 4643 if test -z "$export_symbols"; then 4644 export_symbols="$output_objdir/$outputname.exp" 4645 $run $rm $export_symbols 4646 $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' 4647 case $host in 4648 *cygwin* | *mingw* ) 4649 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4650 $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' 4651 ;; 4652 esac 4653 else 4654 $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' 4655 $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' 4656 $run eval 'mv "$nlist"T "$nlist"' 4657 case $host in 4658 *cygwin* | *mingw* ) 4659 $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' 4660 $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' 4661 ;; 4662 esac 4663 fi 4664 fi 4665 4666 for arg in $dlprefiles; do 4667 $show "extracting global C symbols from \`$arg'" 4668 name=`$echo "$arg" | ${SED} -e 's%^.*/%%'` 4669 $run eval '$echo ": $name " >> "$nlist"' 4670 $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'" 4671 done 4672 4673 if test -z "$run"; then 4674 # Make sure we have at least an empty file. 4675 test -f "$nlist" || : > "$nlist" 4676 4677 if test -n "$exclude_expsyms"; then 4678 $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T 4679 $mv "$nlist"T "$nlist" 4680 fi 4681 4682 # Try sorting and uniquifying the output. 4683 if grep -v "^: " < "$nlist" | 4684 if sort -k 3 </dev/null >/dev/null 2>&1; then 4685 sort -k 3 4686 else 4687 sort +2 4688 fi | 4689 uniq > "$nlist"S; then 4690 : 4691 else 4692 grep -v "^: " < "$nlist" > "$nlist"S 4693 fi 4694 4695 if test -f "$nlist"S; then 4696 eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"' 4697 else 4698 $echo '/* NONE */' >> "$output_objdir/$dlsyms" 4699 fi 4700 4701 $echo >> "$output_objdir/$dlsyms" "\ 4702 4703#undef lt_preloaded_symbols 4704 4705#if defined (__STDC__) && __STDC__ 4706# define lt_ptr void * 4707#else 4708# define lt_ptr char * 4709# define const 4710#endif 4711 4712/* The mapping between symbol names and symbols. */ 4713" 4714 4715 case $host in 4716 *cygwin* | *mingw* ) 4717 $echo >> "$output_objdir/$dlsyms" "\ 4718/* DATA imports from DLLs on WIN32 can't be const, because 4719 runtime relocations are performed -- see ld's documentation 4720 on pseudo-relocs */ 4721struct { 4722" 4723 ;; 4724 * ) 4725 $echo >> "$output_objdir/$dlsyms" "\ 4726const struct { 4727" 4728 ;; 4729 esac 4730 4731 4732 $echo >> "$output_objdir/$dlsyms" "\ 4733 const char *name; 4734 lt_ptr address; 4735} 4736lt_preloaded_symbols[] = 4737{\ 4738" 4739 4740 eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms" 4741 4742 $echo >> "$output_objdir/$dlsyms" "\ 4743 {0, (lt_ptr) 0} 4744}; 4745 4746/* This works around a problem in FreeBSD linker */ 4747#ifdef FREEBSD_WORKAROUND 4748static const void *lt_preloaded_setup() { 4749 return lt_preloaded_symbols; 4750} 4751#endif 4752 4753#ifdef __cplusplus 4754} 4755#endif\ 4756" 4757 fi 4758 4759 pic_flag_for_symtable= 4760 case $host in 4761 # compiling the symbol table file with pic_flag works around 4762 # a FreeBSD bug that causes programs to crash when -lm is 4763 # linked before any other PIC object. But we must not use 4764 # pic_flag when linking with -static. The problem exists in 4765 # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. 4766 *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) 4767 case "$compile_command " in 4768 *" -static "*) ;; 4769 *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";; 4770 esac;; 4771 *-*-hpux*) 4772 case "$compile_command " in 4773 *" -static "*) ;; 4774 *) pic_flag_for_symtable=" $pic_flag";; 4775 esac 4776 esac 4777 4778 # Now compile the dynamic symbol file. 4779 $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")" 4780 $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $? 4781 4782 # Clean up the generated files. 4783 $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T" 4784 $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T" 4785 4786 # Transform the symbol file into the correct name. 4787 case $host in 4788 *cygwin* | *mingw* ) 4789 if test -f "$output_objdir/${outputname}.def" ; then 4790 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 4791 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP` 4792 else 4793 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4794 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4795 fi 4796 ;; 4797 * ) 4798 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4799 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP` 4800 ;; 4801 esac 4802 ;; 4803 *) 4804 $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2 4805 exit $EXIT_FAILURE 4806 ;; 4807 esac 4808 else 4809 # We keep going just in case the user didn't refer to 4810 # lt_preloaded_symbols. The linker will fail if global_symbol_pipe 4811 # really was required. 4812 4813 # Nullify the symbol file. 4814 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 4815 finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP` 4816 fi 4817 4818 if test "$need_relink" = no || test "$build_libtool_libs" != yes; then 4819 # Replace the output file specification. 4820 compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP` 4821 link_command="$compile_command$compile_rpath" 4822 4823 # We have no uninstalled library dependencies, so finalize right now. 4824 $show "$link_command" 4825 $run eval "$link_command" 4826 exit_status=$? 4827 4828 # Delete the generated files. 4829 if test -n "$dlsyms"; then 4830 $show "$rm $output_objdir/${outputname}S.${objext}" 4831 $run $rm "$output_objdir/${outputname}S.${objext}" 4832 fi 4833 4834 exit $exit_status 4835 fi 4836 4837 if test -n "$shlibpath_var"; then 4838 # We should set the shlibpath_var 4839 rpath= 4840 for dir in $temp_rpath; do 4841 case $dir in 4842 [\\/]* | [A-Za-z]:[\\/]*) 4843 # Absolute path. 4844 rpath="$rpath$dir:" 4845 ;; 4846 *) 4847 # Relative path: add a thisdir entry. 4848 rpath="$rpath\$thisdir/$dir:" 4849 ;; 4850 esac 4851 done 4852 temp_rpath="$rpath" 4853 fi 4854 4855 if test -n "$compile_shlibpath$finalize_shlibpath"; then 4856 compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" 4857 fi 4858 if test -n "$finalize_shlibpath"; then 4859 finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" 4860 fi 4861 4862 compile_var= 4863 finalize_var= 4864 if test -n "$runpath_var"; then 4865 if test -n "$perm_rpath"; then 4866 # We should set the runpath_var. 4867 rpath= 4868 for dir in $perm_rpath; do 4869 rpath="$rpath$dir:" 4870 done 4871 compile_var="$runpath_var=\"$rpath\$$runpath_var\" " 4872 fi 4873 if test -n "$finalize_perm_rpath"; then 4874 # We should set the runpath_var. 4875 rpath= 4876 for dir in $finalize_perm_rpath; do 4877 rpath="$rpath$dir:" 4878 done 4879 finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " 4880 fi 4881 fi 4882 4883 if test "$no_install" = yes; then 4884 # We don't need to create a wrapper script. 4885 link_command="$compile_var$compile_command$compile_rpath" 4886 # Replace the output file specification. 4887 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'` 4888 # Delete the old output file. 4889 $run $rm $output 4890 # Link the executable and exit 4891 $show "$link_command" 4892 $run eval "$link_command" || exit $? 4893 exit $EXIT_SUCCESS 4894 fi 4895 4896 if test "$hardcode_action" = relink; then 4897 # Fast installation is not supported 4898 link_command="$compile_var$compile_command$compile_rpath" 4899 relink_command="$finalize_var$finalize_command$finalize_rpath" 4900 4901 $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2 4902 $echo "$modename: \`$output' will be relinked during installation" 1>&2 4903 else 4904 if test "$fast_install" != no; then 4905 link_command="$finalize_var$compile_command$finalize_rpath" 4906 if test "$fast_install" = yes; then 4907 relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP` 4908 else 4909 # fast_install is set to needless 4910 relink_command= 4911 fi 4912 else 4913 link_command="$compile_var$compile_command$compile_rpath" 4914 relink_command="$finalize_var$finalize_command$finalize_rpath" 4915 fi 4916 fi 4917 4918 # Replace the output file specification. 4919 link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` 4920 4921 # Delete the old output files. 4922 $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname 4923 4924 $show "$link_command" 4925 $run eval "$link_command" || exit $? 4926 4927 # Now create the wrapper script. 4928 $show "creating $output" 4929 4930 # Quote the relink command for shipping. 4931 if test -n "$relink_command"; then 4932 # Preserve any variables that may affect compiler behavior 4933 for var in $variables_saved_for_relink; do 4934 if eval test -z \"\${$var+set}\"; then 4935 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 4936 elif eval var_value=\$$var; test -z "$var_value"; then 4937 relink_command="$var=; export $var; $relink_command" 4938 else 4939 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 4940 relink_command="$var=\"$var_value\"; export $var; $relink_command" 4941 fi 4942 done 4943 relink_command="(cd `pwd`; $relink_command)" 4944 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 4945 fi 4946 4947 # Quote $echo for shipping. 4948 if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then 4949 case $progpath in 4950 [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";; 4951 *) qecho="$SHELL `pwd`/$progpath --fallback-echo";; 4952 esac 4953 qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"` 4954 else 4955 qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"` 4956 fi 4957 4958 # Only actually do things if our run command is non-null. 4959 if test -z "$run"; then 4960 # win32 will think the script is a binary if it has 4961 # a .exe suffix, so we strip it off here. 4962 case $output in 4963 *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;; 4964 esac 4965 # test for cygwin because mv fails w/o .exe extensions 4966 case $host in 4967 *cygwin*) 4968 exeext=.exe 4969 outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;; 4970 *) exeext= ;; 4971 esac 4972 case $host in 4973 *cygwin* | *mingw* ) 4974 output_name=`basename $output` 4975 output_path=`dirname $output` 4976 cwrappersource="$output_path/$objdir/lt-$output_name.c" 4977 cwrapper="$output_path/$output_name.exe" 4978 $rm $cwrappersource $cwrapper 4979 trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 4980 4981 cat > $cwrappersource <<EOF 4982 4983/* $cwrappersource - temporary wrapper executable for $objdir/$outputname 4984 Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 4985 4986 The $output program cannot be directly executed until all the libtool 4987 libraries that it depends on are installed. 4988 4989 This wrapper executable should never be moved out of the build directory. 4990 If it is, it will not operate correctly. 4991 4992 Currently, it simply execs the wrapper *script* "/bin/sh $output", 4993 but could eventually absorb all of the scripts functionality and 4994 exec $objdir/$outputname directly. 4995*/ 4996EOF 4997 cat >> $cwrappersource<<"EOF" 4998#include <stdio.h> 4999#include <stdlib.h> 5000#include <unistd.h> 5001#include <malloc.h> 5002#include <stdarg.h> 5003#include <assert.h> 5004#include <string.h> 5005#include <ctype.h> 5006#include <sys/stat.h> 5007 5008#if defined(PATH_MAX) 5009# define LT_PATHMAX PATH_MAX 5010#elif defined(MAXPATHLEN) 5011# define LT_PATHMAX MAXPATHLEN 5012#else 5013# define LT_PATHMAX 1024 5014#endif 5015 5016#ifndef DIR_SEPARATOR 5017# define DIR_SEPARATOR '/' 5018# define PATH_SEPARATOR ':' 5019#endif 5020 5021#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ 5022 defined (__OS2__) 5023# define HAVE_DOS_BASED_FILE_SYSTEM 5024# ifndef DIR_SEPARATOR_2 5025# define DIR_SEPARATOR_2 '\\' 5026# endif 5027# ifndef PATH_SEPARATOR_2 5028# define PATH_SEPARATOR_2 ';' 5029# endif 5030#endif 5031 5032#ifndef DIR_SEPARATOR_2 5033# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) 5034#else /* DIR_SEPARATOR_2 */ 5035# define IS_DIR_SEPARATOR(ch) \ 5036 (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) 5037#endif /* DIR_SEPARATOR_2 */ 5038 5039#ifndef PATH_SEPARATOR_2 5040# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) 5041#else /* PATH_SEPARATOR_2 */ 5042# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) 5043#endif /* PATH_SEPARATOR_2 */ 5044 5045#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) 5046#define XFREE(stale) do { \ 5047 if (stale) { free ((void *) stale); stale = 0; } \ 5048} while (0) 5049 5050/* -DDEBUG is fairly common in CFLAGS. */ 5051#undef DEBUG 5052#if defined DEBUGWRAPPER 5053# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__) 5054#else 5055# define DEBUG(format, ...) 5056#endif 5057 5058const char *program_name = NULL; 5059 5060void * xmalloc (size_t num); 5061char * xstrdup (const char *string); 5062const char * base_name (const char *name); 5063char * find_executable(const char *wrapper); 5064int check_executable(const char *path); 5065char * strendzap(char *str, const char *pat); 5066void lt_fatal (const char *message, ...); 5067 5068int 5069main (int argc, char *argv[]) 5070{ 5071 char **newargz; 5072 int i; 5073 5074 program_name = (char *) xstrdup (base_name (argv[0])); 5075 DEBUG("(main) argv[0] : %s\n",argv[0]); 5076 DEBUG("(main) program_name : %s\n",program_name); 5077 newargz = XMALLOC(char *, argc+2); 5078EOF 5079 5080 cat >> $cwrappersource <<EOF 5081 newargz[0] = (char *) xstrdup("$SHELL"); 5082EOF 5083 5084 cat >> $cwrappersource <<"EOF" 5085 newargz[1] = find_executable(argv[0]); 5086 if (newargz[1] == NULL) 5087 lt_fatal("Couldn't find %s", argv[0]); 5088 DEBUG("(main) found exe at : %s\n",newargz[1]); 5089 /* we know the script has the same name, without the .exe */ 5090 /* so make sure newargz[1] doesn't end in .exe */ 5091 strendzap(newargz[1],".exe"); 5092 for (i = 1; i < argc; i++) 5093 newargz[i+1] = xstrdup(argv[i]); 5094 newargz[argc+1] = NULL; 5095 5096 for (i=0; i<argc+1; i++) 5097 { 5098 DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]); 5099 ; 5100 } 5101 5102EOF 5103 5104 case $host_os in 5105 mingw*) 5106 cat >> $cwrappersource <<EOF 5107 execv("$SHELL",(char const **)newargz); 5108EOF 5109 ;; 5110 *) 5111 cat >> $cwrappersource <<EOF 5112 execv("$SHELL",newargz); 5113EOF 5114 ;; 5115 esac 5116 5117 cat >> $cwrappersource <<"EOF" 5118 return 127; 5119} 5120 5121void * 5122xmalloc (size_t num) 5123{ 5124 void * p = (void *) malloc (num); 5125 if (!p) 5126 lt_fatal ("Memory exhausted"); 5127 5128 return p; 5129} 5130 5131char * 5132xstrdup (const char *string) 5133{ 5134 return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL 5135; 5136} 5137 5138const char * 5139base_name (const char *name) 5140{ 5141 const char *base; 5142 5143#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5144 /* Skip over the disk name in MSDOS pathnames. */ 5145 if (isalpha ((unsigned char)name[0]) && name[1] == ':') 5146 name += 2; 5147#endif 5148 5149 for (base = name; *name; name++) 5150 if (IS_DIR_SEPARATOR (*name)) 5151 base = name + 1; 5152 return base; 5153} 5154 5155int 5156check_executable(const char * path) 5157{ 5158 struct stat st; 5159 5160 DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!"); 5161 if ((!path) || (!*path)) 5162 return 0; 5163 5164 if ((stat (path, &st) >= 0) && 5165 ( 5166 /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */ 5167#if defined (S_IXOTH) 5168 ((st.st_mode & S_IXOTH) == S_IXOTH) || 5169#endif 5170#if defined (S_IXGRP) 5171 ((st.st_mode & S_IXGRP) == S_IXGRP) || 5172#endif 5173 ((st.st_mode & S_IXUSR) == S_IXUSR)) 5174 ) 5175 return 1; 5176 else 5177 return 0; 5178} 5179 5180/* Searches for the full path of the wrapper. Returns 5181 newly allocated full path name if found, NULL otherwise */ 5182char * 5183find_executable (const char* wrapper) 5184{ 5185 int has_slash = 0; 5186 const char* p; 5187 const char* p_next; 5188 /* static buffer for getcwd */ 5189 char tmp[LT_PATHMAX + 1]; 5190 int tmp_len; 5191 char* concat_name; 5192 5193 DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"); 5194 5195 if ((wrapper == NULL) || (*wrapper == '\0')) 5196 return NULL; 5197 5198 /* Absolute path? */ 5199#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5200 if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':') 5201 { 5202 concat_name = xstrdup (wrapper); 5203 if (check_executable(concat_name)) 5204 return concat_name; 5205 XFREE(concat_name); 5206 } 5207 else 5208 { 5209#endif 5210 if (IS_DIR_SEPARATOR (wrapper[0])) 5211 { 5212 concat_name = xstrdup (wrapper); 5213 if (check_executable(concat_name)) 5214 return concat_name; 5215 XFREE(concat_name); 5216 } 5217#if defined (HAVE_DOS_BASED_FILE_SYSTEM) 5218 } 5219#endif 5220 5221 for (p = wrapper; *p; p++) 5222 if (*p == '/') 5223 { 5224 has_slash = 1; 5225 break; 5226 } 5227 if (!has_slash) 5228 { 5229 /* no slashes; search PATH */ 5230 const char* path = getenv ("PATH"); 5231 if (path != NULL) 5232 { 5233 for (p = path; *p; p = p_next) 5234 { 5235 const char* q; 5236 size_t p_len; 5237 for (q = p; *q; q++) 5238 if (IS_PATH_SEPARATOR(*q)) 5239 break; 5240 p_len = q - p; 5241 p_next = (*q == '\0' ? q : q + 1); 5242 if (p_len == 0) 5243 { 5244 /* empty path: current directory */ 5245 if (getcwd (tmp, LT_PATHMAX) == NULL) 5246 lt_fatal ("getcwd failed"); 5247 tmp_len = strlen(tmp); 5248 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 5249 memcpy (concat_name, tmp, tmp_len); 5250 concat_name[tmp_len] = '/'; 5251 strcpy (concat_name + tmp_len + 1, wrapper); 5252 } 5253 else 5254 { 5255 concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1); 5256 memcpy (concat_name, p, p_len); 5257 concat_name[p_len] = '/'; 5258 strcpy (concat_name + p_len + 1, wrapper); 5259 } 5260 if (check_executable(concat_name)) 5261 return concat_name; 5262 XFREE(concat_name); 5263 } 5264 } 5265 /* not found in PATH; assume curdir */ 5266 } 5267 /* Relative path | not found in path: prepend cwd */ 5268 if (getcwd (tmp, LT_PATHMAX) == NULL) 5269 lt_fatal ("getcwd failed"); 5270 tmp_len = strlen(tmp); 5271 concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1); 5272 memcpy (concat_name, tmp, tmp_len); 5273 concat_name[tmp_len] = '/'; 5274 strcpy (concat_name + tmp_len + 1, wrapper); 5275 5276 if (check_executable(concat_name)) 5277 return concat_name; 5278 XFREE(concat_name); 5279 return NULL; 5280} 5281 5282char * 5283strendzap(char *str, const char *pat) 5284{ 5285 size_t len, patlen; 5286 5287 assert(str != NULL); 5288 assert(pat != NULL); 5289 5290 len = strlen(str); 5291 patlen = strlen(pat); 5292 5293 if (patlen <= len) 5294 { 5295 str += len - patlen; 5296 if (strcmp(str, pat) == 0) 5297 *str = '\0'; 5298 } 5299 return str; 5300} 5301 5302static void 5303lt_error_core (int exit_status, const char * mode, 5304 const char * message, va_list ap) 5305{ 5306 fprintf (stderr, "%s: %s: ", program_name, mode); 5307 vfprintf (stderr, message, ap); 5308 fprintf (stderr, ".\n"); 5309 5310 if (exit_status >= 0) 5311 exit (exit_status); 5312} 5313 5314void 5315lt_fatal (const char *message, ...) 5316{ 5317 va_list ap; 5318 va_start (ap, message); 5319 lt_error_core (EXIT_FAILURE, "FATAL", message, ap); 5320 va_end (ap); 5321} 5322EOF 5323 # we should really use a build-platform specific compiler 5324 # here, but OTOH, the wrappers (shell script and this C one) 5325 # are only useful if you want to execute the "real" binary. 5326 # Since the "real" binary is built for $host, then this 5327 # wrapper might as well be built for $host, too. 5328 $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource 5329 ;; 5330 esac 5331 $rm $output 5332 trap "$rm $output; exit $EXIT_FAILURE" 1 2 15 5333 5334 $echo > $output "\ 5335#! $SHELL 5336 5337# $output - temporary wrapper script for $objdir/$outputname 5338# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 5339# 5340# The $output program cannot be directly executed until all the libtool 5341# libraries that it depends on are installed. 5342# 5343# This wrapper script should never be moved out of the build directory. 5344# If it is, it will not operate correctly. 5345 5346# Sed substitution that helps us do robust quoting. It backslashifies 5347# metacharacters that are still active within double-quoted strings. 5348Xsed='${SED} -e 1s/^X//' 5349sed_quote_subst='$sed_quote_subst' 5350 5351# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE). 5352if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then 5353 emulate sh 5354 NULLCMD=: 5355 # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which 5356 # is contrary to our usage. Disable this feature. 5357 alias -g '\${1+\"\$@\"}'='\"\$@\"' 5358 setopt NO_GLOB_SUBST 5359else 5360 case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac 5361fi 5362BIN_SH=xpg4; export BIN_SH # for Tru64 5363DUALCASE=1; export DUALCASE # for MKS sh 5364 5365# The HP-UX ksh and POSIX shell print the target directory to stdout 5366# if CDPATH is set. 5367(unset CDPATH) >/dev/null 2>&1 && unset CDPATH 5368 5369relink_command=\"$relink_command\" 5370 5371# This environment variable determines our operation mode. 5372if test \"\$libtool_install_magic\" = \"$magic\"; then 5373 # install mode needs the following variable: 5374 notinst_deplibs='$notinst_deplibs' 5375else 5376 # When we are sourced in execute mode, \$file and \$echo are already set. 5377 if test \"\$libtool_execute_magic\" != \"$magic\"; then 5378 echo=\"$qecho\" 5379 file=\"\$0\" 5380 # Make sure echo works. 5381 if test \"X\$1\" = X--no-reexec; then 5382 # Discard the --no-reexec flag, and continue. 5383 shift 5384 elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then 5385 # Yippee, \$echo works! 5386 : 5387 else 5388 # Restart under the correct shell, and then maybe \$echo will work. 5389 exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"} 5390 fi 5391 fi\ 5392" 5393 $echo >> $output "\ 5394 5395 # Find the directory that this script lives in. 5396 thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\` 5397 test \"x\$thisdir\" = \"x\$file\" && thisdir=. 5398 5399 # Follow symbolic links until we get to the real thisdir. 5400 file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\` 5401 while test -n \"\$file\"; do 5402 destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\` 5403 5404 # If there was a directory component, then change thisdir. 5405 if test \"x\$destdir\" != \"x\$file\"; then 5406 case \"\$destdir\" in 5407 [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; 5408 *) thisdir=\"\$thisdir/\$destdir\" ;; 5409 esac 5410 fi 5411 5412 file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\` 5413 file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\` 5414 done 5415 5416 # Try to get the absolute directory name. 5417 absdir=\`cd \"\$thisdir\" && pwd\` 5418 test -n \"\$absdir\" && thisdir=\"\$absdir\" 5419" 5420 5421 if test "$fast_install" = yes; then 5422 $echo >> $output "\ 5423 program=lt-'$outputname'$exeext 5424 progdir=\"\$thisdir/$objdir\" 5425 5426 if test ! -f \"\$progdir/\$program\" || \\ 5427 { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ 5428 test \"X\$file\" != \"X\$progdir/\$program\"; }; then 5429 5430 file=\"\$\$-\$program\" 5431 5432 if test ! -d \"\$progdir\"; then 5433 $mkdir \"\$progdir\" 5434 else 5435 $rm \"\$progdir/\$file\" 5436 fi" 5437 5438 $echo >> $output "\ 5439 5440 # relink executable if necessary 5441 if test -n \"\$relink_command\"; then 5442 if relink_command_output=\`eval \$relink_command 2>&1\`; then : 5443 else 5444 $echo \"\$relink_command_output\" >&2 5445 $rm \"\$progdir/\$file\" 5446 exit $EXIT_FAILURE 5447 fi 5448 fi 5449 5450 $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || 5451 { $rm \"\$progdir/\$program\"; 5452 $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; } 5453 $rm \"\$progdir/\$file\" 5454 fi" 5455 else 5456 $echo >> $output "\ 5457 program='$outputname' 5458 progdir=\"\$thisdir/$objdir\" 5459" 5460 fi 5461 5462 $echo >> $output "\ 5463 5464 if test -f \"\$progdir/\$program\"; then" 5465 5466 # Export our shlibpath_var if we have one. 5467 if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then 5468 $echo >> $output "\ 5469 # Add our own library path to $shlibpath_var 5470 $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" 5471 5472 # Some systems cannot cope with colon-terminated $shlibpath_var 5473 # The second colon is a workaround for a bug in BeOS R4 sed 5474 $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\` 5475 5476 export $shlibpath_var 5477" 5478 fi 5479 5480 # fixup the dll searchpath if we need to. 5481 if test -n "$dllsearchpath"; then 5482 $echo >> $output "\ 5483 # Add the dll search path components to the executable PATH 5484 PATH=$dllsearchpath:\$PATH 5485" 5486 fi 5487 5488 $echo >> $output "\ 5489 if test \"\$libtool_execute_magic\" != \"$magic\"; then 5490 # Run the actual program with our arguments. 5491" 5492 case $host in 5493 # Backslashes separate directories on plain windows 5494 *-*-mingw | *-*-os2*) 5495 $echo >> $output "\ 5496 exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} 5497" 5498 ;; 5499 5500 *) 5501 $echo >> $output "\ 5502 exec \"\$progdir/\$program\" \${1+\"\$@\"} 5503" 5504 ;; 5505 esac 5506 $echo >> $output "\ 5507 \$echo \"\$0: cannot exec \$program \$*\" 5508 exit $EXIT_FAILURE 5509 fi 5510 else 5511 # The program doesn't exist. 5512 \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 5513 \$echo \"This script is just a wrapper for \$program.\" 1>&2 5514 $echo \"See the $PACKAGE documentation for more information.\" 1>&2 5515 exit $EXIT_FAILURE 5516 fi 5517fi\ 5518" 5519 chmod +x $output 5520 fi 5521 exit $EXIT_SUCCESS 5522 ;; 5523 esac 5524 5525 # See if we need to build an old-fashioned archive. 5526 for oldlib in $oldlibs; do 5527 5528 if test "$build_libtool_libs" = convenience; then 5529 oldobjs="$libobjs_save" 5530 addlibs="$convenience" 5531 build_libtool_libs=no 5532 else 5533 if test "$build_libtool_libs" = module; then 5534 oldobjs="$libobjs_save" 5535 build_libtool_libs=no 5536 else 5537 oldobjs="$old_deplibs $non_pic_objects" 5538 fi 5539 addlibs="$old_convenience" 5540 fi 5541 5542 if test -n "$addlibs"; then 5543 gentop="$output_objdir/${outputname}x" 5544 generated="$generated $gentop" 5545 5546 func_extract_archives $gentop $addlibs 5547 oldobjs="$oldobjs $func_extract_archives_result" 5548 fi 5549 5550 # Do each command in the archive commands. 5551 if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then 5552 cmds=$old_archive_from_new_cmds 5553 else 5554 # POSIX demands no paths to be encoded in archives. We have 5555 # to avoid creating archives with duplicate basenames if we 5556 # might have to extract them afterwards, e.g., when creating a 5557 # static archive out of a convenience library, or when linking 5558 # the entirety of a libtool archive into another (currently 5559 # not supported by libtool). 5560 if (for obj in $oldobjs 5561 do 5562 $echo "X$obj" | $Xsed -e 's%^.*/%%' 5563 done | sort | sort -uc >/dev/null 2>&1); then 5564 : 5565 else 5566 $echo "copying selected object files to avoid basename conflicts..." 5567 5568 if test -z "$gentop"; then 5569 gentop="$output_objdir/${outputname}x" 5570 generated="$generated $gentop" 5571 5572 $show "${rm}r $gentop" 5573 $run ${rm}r "$gentop" 5574 $show "$mkdir $gentop" 5575 $run $mkdir "$gentop" 5576 exit_status=$? 5577 if test "$exit_status" -ne 0 && test ! -d "$gentop"; then 5578 exit $exit_status 5579 fi 5580 fi 5581 5582 save_oldobjs=$oldobjs 5583 oldobjs= 5584 counter=1 5585 for obj in $save_oldobjs 5586 do 5587 objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 5588 case " $oldobjs " in 5589 " ") oldobjs=$obj ;; 5590 *[\ /]"$objbase "*) 5591 while :; do 5592 # Make sure we don't pick an alternate name that also 5593 # overlaps. 5594 newobj=lt$counter-$objbase 5595 counter=`expr $counter + 1` 5596 case " $oldobjs " in 5597 *[\ /]"$newobj "*) ;; 5598 *) if test ! -f "$gentop/$newobj"; then break; fi ;; 5599 esac 5600 done 5601 $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" 5602 $run ln "$obj" "$gentop/$newobj" || 5603 $run cp "$obj" "$gentop/$newobj" 5604 oldobjs="$oldobjs $gentop/$newobj" 5605 ;; 5606 *) oldobjs="$oldobjs $obj" ;; 5607 esac 5608 done 5609 fi 5610 5611 eval cmds=\"$old_archive_cmds\" 5612 5613 if len=`expr "X$cmds" : ".*"` && 5614 test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then 5615 cmds=$old_archive_cmds 5616 else 5617 # the command line is too long to link in one step, link in parts 5618 $echo "using piecewise archive linking..." 5619 save_RANLIB=$RANLIB 5620 RANLIB=: 5621 objlist= 5622 concat_cmds= 5623 save_oldobjs=$oldobjs 5624 5625 # Is there a better way of finding the last object in the list? 5626 for obj in $save_oldobjs 5627 do 5628 last_oldobj=$obj 5629 done 5630 for obj in $save_oldobjs 5631 do 5632 oldobjs="$objlist $obj" 5633 objlist="$objlist $obj" 5634 eval test_cmds=\"$old_archive_cmds\" 5635 if len=`expr "X$test_cmds" : ".*" 2>/dev/null` && 5636 test "$len" -le "$max_cmd_len"; then 5637 : 5638 else 5639 # the above command should be used before it gets too long 5640 oldobjs=$objlist 5641 if test "$obj" = "$last_oldobj" ; then 5642 RANLIB=$save_RANLIB 5643 fi 5644 test -z "$concat_cmds" || concat_cmds=$concat_cmds~ 5645 eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" 5646 objlist= 5647 fi 5648 done 5649 RANLIB=$save_RANLIB 5650 oldobjs=$objlist 5651 if test "X$oldobjs" = "X" ; then 5652 eval cmds=\"\$concat_cmds\" 5653 else 5654 eval cmds=\"\$concat_cmds~\$old_archive_cmds\" 5655 fi 5656 fi 5657 fi 5658 save_ifs="$IFS"; IFS='~' 5659 for cmd in $cmds; do 5660 eval cmd=\"$cmd\" 5661 IFS="$save_ifs" 5662 $show "$cmd" 5663 $run eval "$cmd" || exit $? 5664 done 5665 IFS="$save_ifs" 5666 done 5667 5668 if test -n "$generated"; then 5669 $show "${rm}r$generated" 5670 $run ${rm}r$generated 5671 fi 5672 5673 # Now create the libtool archive. 5674 case $output in 5675 *.la) 5676 old_library= 5677 test "$build_old_libs" = yes && old_library="$libname.$libext" 5678 $show "creating $output" 5679 5680 # Preserve any variables that may affect compiler behavior 5681 for var in $variables_saved_for_relink; do 5682 if eval test -z \"\${$var+set}\"; then 5683 relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command" 5684 elif eval var_value=\$$var; test -z "$var_value"; then 5685 relink_command="$var=; export $var; $relink_command" 5686 else 5687 var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"` 5688 relink_command="$var=\"$var_value\"; export $var; $relink_command" 5689 fi 5690 done 5691 # Quote the link command for shipping. 5692 relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" 5693 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP` 5694 if test "$hardcode_automatic" = yes ; then 5695 relink_command= 5696 fi 5697 5698 5699 # Only create the output if not a dry run. 5700 if test -z "$run"; then 5701 for installed in no yes; do 5702 if test "$installed" = yes; then 5703 if test -z "$install_libdir"; then 5704 break 5705 fi 5706 output="$output_objdir/$outputname"i 5707 # Replace all uninstalled libtool libraries with the installed ones 5708 newdependency_libs= 5709 for deplib in $dependency_libs; do 5710 case $deplib in 5711 *.la) 5712 name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'` 5713 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` 5714 if test -z "$libdir"; then 5715 $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2 5716 exit $EXIT_FAILURE 5717 fi 5718 newdependency_libs="$newdependency_libs $libdir/$name" 5719 ;; 5720 *) newdependency_libs="$newdependency_libs $deplib" ;; 5721 esac 5722 done 5723 dependency_libs="$newdependency_libs" 5724 newdlfiles= 5725 for lib in $dlfiles; do 5726 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 5727 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 5728 if test -z "$libdir"; then 5729 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 5730 exit $EXIT_FAILURE 5731 fi 5732 newdlfiles="$newdlfiles $libdir/$name" 5733 done 5734 dlfiles="$newdlfiles" 5735 newdlprefiles= 5736 for lib in $dlprefiles; do 5737 name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'` 5738 eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` 5739 if test -z "$libdir"; then 5740 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 5741 exit $EXIT_FAILURE 5742 fi 5743 newdlprefiles="$newdlprefiles $libdir/$name" 5744 done 5745 dlprefiles="$newdlprefiles" 5746 else 5747 newdlfiles= 5748 for lib in $dlfiles; do 5749 case $lib in 5750 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 5751 *) abs=`pwd`"/$lib" ;; 5752 esac 5753 newdlfiles="$newdlfiles $abs" 5754 done 5755 dlfiles="$newdlfiles" 5756 newdlprefiles= 5757 for lib in $dlprefiles; do 5758 case $lib in 5759 [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; 5760 *) abs=`pwd`"/$lib" ;; 5761 esac 5762 newdlprefiles="$newdlprefiles $abs" 5763 done 5764 dlprefiles="$newdlprefiles" 5765 fi 5766 $rm $output 5767 # place dlname in correct position for cygwin 5768 tdlname=$dlname 5769 case $host,$output,$installed,$module,$dlname in 5770 *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;; 5771 esac 5772 $echo > $output "\ 5773# $outputname - a libtool library file 5774# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 5775# 5776# Please DO NOT delete this file! 5777# It is necessary for linking the library. 5778 5779# The name that we can dlopen(3). 5780dlname='$tdlname' 5781 5782# Names of this library. 5783library_names='$library_names' 5784 5785# The name of the static archive. 5786old_library='$old_library' 5787 5788# Libraries that this one depends upon. 5789dependency_libs='$dependency_libs' 5790 5791# Version information for $libname. 5792current=$current 5793age=$age 5794revision=$revision 5795 5796# Is this an already installed library? 5797installed=$installed 5798 5799# Should we warn about portability when linking against -modules? 5800shouldnotlink=$module 5801 5802# Files to dlopen/dlpreopen 5803dlopen='$dlfiles' 5804dlpreopen='$dlprefiles' 5805 5806# Directory that this library needs to be installed in: 5807libdir='$install_libdir'" 5808 if test "$installed" = no && test "$need_relink" = yes; then 5809 $echo >> $output "\ 5810relink_command=\"$relink_command\"" 5811 fi 5812 done 5813 fi 5814 5815 # Do a symbolic link so that the libtool archive can be found in 5816 # LD_LIBRARY_PATH before the program is installed. 5817 $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)" 5818 $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $? 5819 ;; 5820 esac 5821 exit $EXIT_SUCCESS 5822 ;; 5823 5824 # libtool install mode 5825 install) 5826 modename="$modename: install" 5827 5828 # There may be an optional sh(1) argument at the beginning of 5829 # install_prog (especially on Windows NT). 5830 if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || 5831 # Allow the use of GNU shtool's install command. 5832 $echo "X$nonopt" | grep shtool > /dev/null; then 5833 # Aesthetically quote it. 5834 arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"` 5835 case $arg in 5836 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5837 arg="\"$arg\"" 5838 ;; 5839 esac 5840 install_prog="$arg " 5841 arg="$1" 5842 shift 5843 else 5844 install_prog= 5845 arg=$nonopt 5846 fi 5847 5848 # The real first argument should be the name of the installation program. 5849 # Aesthetically quote it. 5850 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5851 case $arg in 5852 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5853 arg="\"$arg\"" 5854 ;; 5855 esac 5856 install_prog="$install_prog$arg" 5857 5858 # We need to accept at least all the BSD install flags. 5859 dest= 5860 files= 5861 opts= 5862 prev= 5863 install_type= 5864 isdir=no 5865 stripme= 5866 for arg 5867 do 5868 if test -n "$dest"; then 5869 files="$files $dest" 5870 dest=$arg 5871 continue 5872 fi 5873 5874 case $arg in 5875 -d) isdir=yes ;; 5876 -f) 5877 case " $install_prog " in 5878 *[\\\ /]cp\ *) ;; 5879 *) prev=$arg ;; 5880 esac 5881 ;; 5882 -g | -m | -o) prev=$arg ;; 5883 -s) 5884 stripme=" -s" 5885 continue 5886 ;; 5887 -*) 5888 ;; 5889 *) 5890 # If the previous option needed an argument, then skip it. 5891 if test -n "$prev"; then 5892 prev= 5893 else 5894 dest=$arg 5895 continue 5896 fi 5897 ;; 5898 esac 5899 5900 # Aesthetically quote the argument. 5901 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 5902 case $arg in 5903 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 5904 arg="\"$arg\"" 5905 ;; 5906 esac 5907 install_prog="$install_prog $arg" 5908 done 5909 5910 if test -z "$install_prog"; then 5911 $echo "$modename: you must specify an install program" 1>&2 5912 $echo "$help" 1>&2 5913 exit $EXIT_FAILURE 5914 fi 5915 5916 if test -n "$prev"; then 5917 $echo "$modename: the \`$prev' option requires an argument" 1>&2 5918 $echo "$help" 1>&2 5919 exit $EXIT_FAILURE 5920 fi 5921 5922 if test -z "$files"; then 5923 if test -z "$dest"; then 5924 $echo "$modename: no file or destination specified" 1>&2 5925 else 5926 $echo "$modename: you must specify a destination" 1>&2 5927 fi 5928 $echo "$help" 1>&2 5929 exit $EXIT_FAILURE 5930 fi 5931 5932 # Strip any trailing slash from the destination. 5933 dest=`$echo "X$dest" | $Xsed -e 's%/$%%'` 5934 5935 # Check to see that the destination is a directory. 5936 test -d "$dest" && isdir=yes 5937 if test "$isdir" = yes; then 5938 destdir="$dest" 5939 destname= 5940 else 5941 destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'` 5942 test "X$destdir" = "X$dest" && destdir=. 5943 destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'` 5944 5945 # Not a directory, so check to see that there is only one file specified. 5946 set dummy $files 5947 if test "$#" -gt 2; then 5948 $echo "$modename: \`$dest' is not a directory" 1>&2 5949 $echo "$help" 1>&2 5950 exit $EXIT_FAILURE 5951 fi 5952 fi 5953 case $destdir in 5954 [\\/]* | [A-Za-z]:[\\/]*) ;; 5955 *) 5956 for file in $files; do 5957 case $file in 5958 *.lo) ;; 5959 *) 5960 $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2 5961 $echo "$help" 1>&2 5962 exit $EXIT_FAILURE 5963 ;; 5964 esac 5965 done 5966 ;; 5967 esac 5968 5969 # This variable tells wrapper scripts just to set variables rather 5970 # than running their programs. 5971 libtool_install_magic="$magic" 5972 5973 staticlibs= 5974 future_libdirs= 5975 current_libdirs= 5976 for file in $files; do 5977 5978 # Do each installation. 5979 case $file in 5980 *.$libext) 5981 # Do the static libraries later. 5982 staticlibs="$staticlibs $file" 5983 ;; 5984 5985 *.la) 5986 # Check to see that this really is a libtool archive. 5987 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 5988 else 5989 $echo "$modename: \`$file' is not a valid libtool archive" 1>&2 5990 $echo "$help" 1>&2 5991 exit $EXIT_FAILURE 5992 fi 5993 5994 library_names= 5995 old_library= 5996 relink_command= 5997 # If there is no directory component, then add one. 5998 case $file in 5999 */* | *\\*) . $file ;; 6000 *) . ./$file ;; 6001 esac 6002 6003 # Add the libdir to current_libdirs if it is the destination. 6004 if test "X$destdir" = "X$libdir"; then 6005 case "$current_libdirs " in 6006 *" $libdir "*) ;; 6007 *) current_libdirs="$current_libdirs $libdir" ;; 6008 esac 6009 else 6010 # Note the libdir as a future libdir. 6011 case "$future_libdirs " in 6012 *" $libdir "*) ;; 6013 *) future_libdirs="$future_libdirs $libdir" ;; 6014 esac 6015 fi 6016 6017 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/ 6018 test "X$dir" = "X$file/" && dir= 6019 dir="$dir$objdir" 6020 6021 if test -n "$relink_command"; then 6022 # Determine the prefix the user has applied to our future dir. 6023 inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"` 6024 6025 # Don't allow the user to place us outside of our expected 6026 # location b/c this prevents finding dependent libraries that 6027 # are installed to the same prefix. 6028 # At present, this check doesn't affect windows .dll's that 6029 # are installed into $libdir/../bin (currently, that works fine) 6030 # but it's something to keep an eye on. 6031 if test "$inst_prefix_dir" = "$destdir"; then 6032 $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2 6033 exit $EXIT_FAILURE 6034 fi 6035 6036 if test -n "$inst_prefix_dir"; then 6037 # Stick the inst_prefix_dir data into the link command. 6038 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP` 6039 else 6040 relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP` 6041 fi 6042 6043 $echo "$modename: warning: relinking \`$file'" 1>&2 6044 $show "$relink_command" 6045 if $run eval "$relink_command"; then : 6046 else 6047 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 6048 exit $EXIT_FAILURE 6049 fi 6050 fi 6051 6052 # See the names of the shared library. 6053 set dummy $library_names 6054 if test -n "$2"; then 6055 realname="$2" 6056 shift 6057 shift 6058 6059 srcname="$realname" 6060 test -n "$relink_command" && srcname="$realname"T 6061 6062 # Install the shared library and build the symlinks. 6063 $show "$install_prog $dir/$srcname $destdir/$realname" 6064 $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $? 6065 if test -n "$stripme" && test -n "$striplib"; then 6066 $show "$striplib $destdir/$realname" 6067 $run eval "$striplib $destdir/$realname" || exit $? 6068 fi 6069 6070 if test "$#" -gt 0; then 6071 # Delete the old symlinks, and create new ones. 6072 # Try `ln -sf' first, because the `ln' binary might depend on 6073 # the symlink we replace! Solaris /bin/ln does not understand -f, 6074 # so we also need to try rm && ln -s. 6075 for linkname 6076 do 6077 if test "$linkname" != "$realname"; then 6078 $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 6079 $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })" 6080 fi 6081 done 6082 fi 6083 6084 # Do each command in the postinstall commands. 6085 lib="$destdir/$realname" 6086 cmds=$postinstall_cmds 6087 save_ifs="$IFS"; IFS='~' 6088 for cmd in $cmds; do 6089 IFS="$save_ifs" 6090 eval cmd=\"$cmd\" 6091 $show "$cmd" 6092 $run eval "$cmd" || { 6093 lt_exit=$? 6094 6095 # Restore the uninstalled library and exit 6096 if test "$mode" = relink; then 6097 $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)' 6098 fi 6099 6100 exit $lt_exit 6101 } 6102 done 6103 IFS="$save_ifs" 6104 fi 6105 6106 # Install the pseudo-library for information purposes. 6107 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6108 instname="$dir/$name"i 6109 $show "$install_prog $instname $destdir/$name" 6110 $run eval "$install_prog $instname $destdir/$name" || exit $? 6111 6112 # Maybe install the static library, too. 6113 test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library" 6114 ;; 6115 6116 *.lo) 6117 # Install (i.e. copy) a libtool object. 6118 6119 # Figure out destination file name, if it wasn't already specified. 6120 if test -n "$destname"; then 6121 destfile="$destdir/$destname" 6122 else 6123 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6124 destfile="$destdir/$destfile" 6125 fi 6126 6127 # Deduce the name of the destination old-style object file. 6128 case $destfile in 6129 *.lo) 6130 staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"` 6131 ;; 6132 *.$objext) 6133 staticdest="$destfile" 6134 destfile= 6135 ;; 6136 *) 6137 $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2 6138 $echo "$help" 1>&2 6139 exit $EXIT_FAILURE 6140 ;; 6141 esac 6142 6143 # Install the libtool object if requested. 6144 if test -n "$destfile"; then 6145 $show "$install_prog $file $destfile" 6146 $run eval "$install_prog $file $destfile" || exit $? 6147 fi 6148 6149 # Install the old object if enabled. 6150 if test "$build_old_libs" = yes; then 6151 # Deduce the name of the old-style object file. 6152 staticobj=`$echo "X$file" | $Xsed -e "$lo2o"` 6153 6154 $show "$install_prog $staticobj $staticdest" 6155 $run eval "$install_prog \$staticobj \$staticdest" || exit $? 6156 fi 6157 exit $EXIT_SUCCESS 6158 ;; 6159 6160 *) 6161 # Figure out destination file name, if it wasn't already specified. 6162 if test -n "$destname"; then 6163 destfile="$destdir/$destname" 6164 else 6165 destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6166 destfile="$destdir/$destfile" 6167 fi 6168 6169 # If the file is missing, and there is a .exe on the end, strip it 6170 # because it is most likely a libtool script we actually want to 6171 # install 6172 stripped_ext="" 6173 case $file in 6174 *.exe) 6175 if test ! -f "$file"; then 6176 file=`$echo $file|${SED} 's,.exe$,,'` 6177 stripped_ext=".exe" 6178 fi 6179 ;; 6180 esac 6181 6182 # Do a test to see if this is really a libtool program. 6183 case $host in 6184 *cygwin*|*mingw*) 6185 wrapper=`$echo $file | ${SED} -e 's,.exe$,,'` 6186 ;; 6187 *) 6188 wrapper=$file 6189 ;; 6190 esac 6191 if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then 6192 notinst_deplibs= 6193 relink_command= 6194 6195 # Note that it is not necessary on cygwin/mingw to append a dot to 6196 # foo even if both foo and FILE.exe exist: automatic-append-.exe 6197 # behavior happens only for exec(3), not for open(2)! Also, sourcing 6198 # `FILE.' does not work on cygwin managed mounts. 6199 # 6200 # If there is no directory component, then add one. 6201 case $wrapper in 6202 */* | *\\*) . ${wrapper} ;; 6203 *) . ./${wrapper} ;; 6204 esac 6205 6206 # Check the variables that should have been set. 6207 if test -z "$notinst_deplibs"; then 6208 $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2 6209 exit $EXIT_FAILURE 6210 fi 6211 6212 finalize=yes 6213 for lib in $notinst_deplibs; do 6214 # Check to see that each library is installed. 6215 libdir= 6216 if test -f "$lib"; then 6217 # If there is no directory component, then add one. 6218 case $lib in 6219 */* | *\\*) . $lib ;; 6220 *) . ./$lib ;; 6221 esac 6222 fi 6223 libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test 6224 if test -n "$libdir" && test ! -f "$libfile"; then 6225 $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2 6226 finalize=no 6227 fi 6228 done 6229 6230 relink_command= 6231 # Note that it is not necessary on cygwin/mingw to append a dot to 6232 # foo even if both foo and FILE.exe exist: automatic-append-.exe 6233 # behavior happens only for exec(3), not for open(2)! Also, sourcing 6234 # `FILE.' does not work on cygwin managed mounts. 6235 # 6236 # If there is no directory component, then add one. 6237 case $wrapper in 6238 */* | *\\*) . ${wrapper} ;; 6239 *) . ./${wrapper} ;; 6240 esac 6241 6242 outputname= 6243 if test "$fast_install" = no && test -n "$relink_command"; then 6244 if test "$finalize" = yes && test -z "$run"; then 6245 tmpdir=`func_mktempdir` 6246 file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'` 6247 outputname="$tmpdir/$file" 6248 # Replace the output file specification. 6249 relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP` 6250 6251 $show "$relink_command" 6252 if $run eval "$relink_command"; then : 6253 else 6254 $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2 6255 ${rm}r "$tmpdir" 6256 continue 6257 fi 6258 file="$outputname" 6259 else 6260 $echo "$modename: warning: cannot relink \`$file'" 1>&2 6261 fi 6262 else 6263 # Install the binary that we compiled earlier. 6264 file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"` 6265 fi 6266 fi 6267 6268 # remove .exe since cygwin /usr/bin/install will append another 6269 # one anyway 6270 case $install_prog,$host in 6271 */usr/bin/install*,*cygwin*) 6272 case $file:$destfile in 6273 *.exe:*.exe) 6274 # this is ok 6275 ;; 6276 *.exe:*) 6277 destfile=$destfile.exe 6278 ;; 6279 *:*.exe) 6280 destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'` 6281 ;; 6282 esac 6283 ;; 6284 esac 6285 $show "$install_prog$stripme $file $destfile" 6286 $run eval "$install_prog\$stripme \$file \$destfile" || exit $? 6287 test -n "$outputname" && ${rm}r "$tmpdir" 6288 ;; 6289 esac 6290 done 6291 6292 for file in $staticlibs; do 6293 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6294 6295 # Set up the ranlib parameters. 6296 oldlib="$destdir/$name" 6297 6298 $show "$install_prog $file $oldlib" 6299 $run eval "$install_prog \$file \$oldlib" || exit $? 6300 6301 if test -n "$stripme" && test -n "$old_striplib"; then 6302 $show "$old_striplib $oldlib" 6303 $run eval "$old_striplib $oldlib" || exit $? 6304 fi 6305 6306 # Do each command in the postinstall commands. 6307 cmds=$old_postinstall_cmds 6308 save_ifs="$IFS"; IFS='~' 6309 for cmd in $cmds; do 6310 IFS="$save_ifs" 6311 eval cmd=\"$cmd\" 6312 $show "$cmd" 6313 $run eval "$cmd" || exit $? 6314 done 6315 IFS="$save_ifs" 6316 done 6317 6318 if test -n "$future_libdirs"; then 6319 $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2 6320 fi 6321 6322 if test -n "$current_libdirs"; then 6323 # Maybe just do a dry run. 6324 test -n "$run" && current_libdirs=" -n$current_libdirs" 6325 exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' 6326 else 6327 exit $EXIT_SUCCESS 6328 fi 6329 ;; 6330 6331 # libtool finish mode 6332 finish) 6333 modename="$modename: finish" 6334 libdirs="$nonopt" 6335 admincmds= 6336 6337 if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then 6338 for dir 6339 do 6340 libdirs="$libdirs $dir" 6341 done 6342 6343 for libdir in $libdirs; do 6344 if test -n "$finish_cmds"; then 6345 # Do each command in the finish commands. 6346 cmds=$finish_cmds 6347 save_ifs="$IFS"; IFS='~' 6348 for cmd in $cmds; do 6349 IFS="$save_ifs" 6350 eval cmd=\"$cmd\" 6351 $show "$cmd" 6352 $run eval "$cmd" || admincmds="$admincmds 6353 $cmd" 6354 done 6355 IFS="$save_ifs" 6356 fi 6357 if test -n "$finish_eval"; then 6358 # Do the single finish_eval. 6359 eval cmds=\"$finish_eval\" 6360 $run eval "$cmds" || admincmds="$admincmds 6361 $cmds" 6362 fi 6363 done 6364 fi 6365 6366 # Exit here if they wanted silent mode. 6367 test "$show" = : && exit $EXIT_SUCCESS 6368 6369 $echo "X----------------------------------------------------------------------" | $Xsed 6370 $echo "Libraries have been installed in:" 6371 for libdir in $libdirs; do 6372 $echo " $libdir" 6373 done 6374 $echo 6375 $echo "If you ever happen to want to link against installed libraries" 6376 $echo "in a given directory, LIBDIR, you must either use libtool, and" 6377 $echo "specify the full pathname of the library, or use the \`-LLIBDIR'" 6378 $echo "flag during linking and do at least one of the following:" 6379 if test -n "$shlibpath_var"; then 6380 $echo " - add LIBDIR to the \`$shlibpath_var' environment variable" 6381 $echo " during execution" 6382 fi 6383 if test -n "$runpath_var"; then 6384 $echo " - add LIBDIR to the \`$runpath_var' environment variable" 6385 $echo " during linking" 6386 fi 6387 if test -n "$hardcode_libdir_flag_spec"; then 6388 libdir=LIBDIR 6389 eval flag=\"$hardcode_libdir_flag_spec\" 6390 6391 $echo " - use the \`$flag' linker flag" 6392 fi 6393 if test -n "$admincmds"; then 6394 $echo " - have your system administrator run these commands:$admincmds" 6395 fi 6396 if test -f /etc/ld.so.conf; then 6397 $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" 6398 fi 6399 $echo 6400 $echo "See any operating system documentation about shared libraries for" 6401 $echo "more information, such as the ld(1) and ld.so(8) manual pages." 6402 $echo "X----------------------------------------------------------------------" | $Xsed 6403 exit $EXIT_SUCCESS 6404 ;; 6405 6406 # libtool execute mode 6407 execute) 6408 modename="$modename: execute" 6409 6410 # The first argument is the command name. 6411 cmd="$nonopt" 6412 if test -z "$cmd"; then 6413 $echo "$modename: you must specify a COMMAND" 1>&2 6414 $echo "$help" 6415 exit $EXIT_FAILURE 6416 fi 6417 6418 # Handle -dlopen flags immediately. 6419 for file in $execute_dlfiles; do 6420 if test ! -f "$file"; then 6421 $echo "$modename: \`$file' is not a file" 1>&2 6422 $echo "$help" 1>&2 6423 exit $EXIT_FAILURE 6424 fi 6425 6426 dir= 6427 case $file in 6428 *.la) 6429 # Check to see that this really is a libtool archive. 6430 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then : 6431 else 6432 $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2 6433 $echo "$help" 1>&2 6434 exit $EXIT_FAILURE 6435 fi 6436 6437 # Read the libtool library. 6438 dlname= 6439 library_names= 6440 6441 # If there is no directory component, then add one. 6442 case $file in 6443 */* | *\\*) . $file ;; 6444 *) . ./$file ;; 6445 esac 6446 6447 # Skip this library if it cannot be dlopened. 6448 if test -z "$dlname"; then 6449 # Warn if it was a shared library. 6450 test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'" 6451 continue 6452 fi 6453 6454 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6455 test "X$dir" = "X$file" && dir=. 6456 6457 if test -f "$dir/$objdir/$dlname"; then 6458 dir="$dir/$objdir" 6459 else 6460 if test ! -f "$dir/$dlname"; then 6461 $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2 6462 exit $EXIT_FAILURE 6463 fi 6464 fi 6465 ;; 6466 6467 *.lo) 6468 # Just add the directory containing the .lo file. 6469 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6470 test "X$dir" = "X$file" && dir=. 6471 ;; 6472 6473 *) 6474 $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2 6475 continue 6476 ;; 6477 esac 6478 6479 # Get the absolute pathname. 6480 absdir=`cd "$dir" && pwd` 6481 test -n "$absdir" && dir="$absdir" 6482 6483 # Now add the directory to shlibpath_var. 6484 if eval "test -z \"\$$shlibpath_var\""; then 6485 eval "$shlibpath_var=\"\$dir\"" 6486 else 6487 eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" 6488 fi 6489 done 6490 6491 # This variable tells wrapper scripts just to set shlibpath_var 6492 # rather than running their programs. 6493 libtool_execute_magic="$magic" 6494 6495 # Check if any of the arguments is a wrapper script. 6496 args= 6497 for file 6498 do 6499 case $file in 6500 -*) ;; 6501 *) 6502 # Do a test to see if this is really a libtool program. 6503 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6504 # If there is no directory component, then add one. 6505 case $file in 6506 */* | *\\*) . $file ;; 6507 *) . ./$file ;; 6508 esac 6509 6510 # Transform arg to wrapped name. 6511 file="$progdir/$program" 6512 fi 6513 ;; 6514 esac 6515 # Quote arguments (to preserve shell metacharacters). 6516 file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"` 6517 args="$args \"$file\"" 6518 done 6519 6520 if test -z "$run"; then 6521 if test -n "$shlibpath_var"; then 6522 # Export the shlibpath_var. 6523 eval "export $shlibpath_var" 6524 fi 6525 6526 # Restore saved environment variables 6527 for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES 6528 do 6529 eval "if test \"\${save_$lt_var+set}\" = set; then 6530 $lt_var=\$save_$lt_var; export $lt_var 6531 fi" 6532 done 6533 6534 # Now prepare to actually exec the command. 6535 exec_cmd="\$cmd$args" 6536 else 6537 # Display what would be done. 6538 if test -n "$shlibpath_var"; then 6539 eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\"" 6540 $echo "export $shlibpath_var" 6541 fi 6542 $echo "$cmd$args" 6543 exit $EXIT_SUCCESS 6544 fi 6545 ;; 6546 6547 # libtool clean and uninstall mode 6548 clean | uninstall) 6549 modename="$modename: $mode" 6550 rm="$nonopt" 6551 files= 6552 rmforce= 6553 exit_status=0 6554 6555 # This variable tells wrapper scripts just to set variables rather 6556 # than running their programs. 6557 libtool_install_magic="$magic" 6558 6559 for arg 6560 do 6561 case $arg in 6562 -f) rm="$rm $arg"; rmforce=yes ;; 6563 -*) rm="$rm $arg" ;; 6564 *) files="$files $arg" ;; 6565 esac 6566 done 6567 6568 if test -z "$rm"; then 6569 $echo "$modename: you must specify an RM program" 1>&2 6570 $echo "$help" 1>&2 6571 exit $EXIT_FAILURE 6572 fi 6573 6574 rmdirs= 6575 6576 origobjdir="$objdir" 6577 for file in $files; do 6578 dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'` 6579 if test "X$dir" = "X$file"; then 6580 dir=. 6581 objdir="$origobjdir" 6582 else 6583 objdir="$dir/$origobjdir" 6584 fi 6585 name=`$echo "X$file" | $Xsed -e 's%^.*/%%'` 6586 test "$mode" = uninstall && objdir="$dir" 6587 6588 # Remember objdir for removal later, being careful to avoid duplicates 6589 if test "$mode" = clean; then 6590 case " $rmdirs " in 6591 *" $objdir "*) ;; 6592 *) rmdirs="$rmdirs $objdir" ;; 6593 esac 6594 fi 6595 6596 # Don't error if the file doesn't exist and rm -f was used. 6597 if (test -L "$file") >/dev/null 2>&1 \ 6598 || (test -h "$file") >/dev/null 2>&1 \ 6599 || test -f "$file"; then 6600 : 6601 elif test -d "$file"; then 6602 exit_status=1 6603 continue 6604 elif test "$rmforce" = yes; then 6605 continue 6606 fi 6607 6608 rmfiles="$file" 6609 6610 case $name in 6611 *.la) 6612 # Possibly a libtool archive, so verify it. 6613 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6614 . $dir/$name 6615 6616 # Delete the libtool libraries and symlinks. 6617 for n in $library_names; do 6618 rmfiles="$rmfiles $objdir/$n" 6619 done 6620 test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library" 6621 6622 case "$mode" in 6623 clean) 6624 case " $library_names " in 6625 # " " in the beginning catches empty $dlname 6626 *" $dlname "*) ;; 6627 *) rmfiles="$rmfiles $objdir/$dlname" ;; 6628 esac 6629 test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i" 6630 ;; 6631 uninstall) 6632 if test -n "$library_names"; then 6633 # Do each command in the postuninstall commands. 6634 cmds=$postuninstall_cmds 6635 save_ifs="$IFS"; IFS='~' 6636 for cmd in $cmds; do 6637 IFS="$save_ifs" 6638 eval cmd=\"$cmd\" 6639 $show "$cmd" 6640 $run eval "$cmd" 6641 if test "$?" -ne 0 && test "$rmforce" != yes; then 6642 exit_status=1 6643 fi 6644 done 6645 IFS="$save_ifs" 6646 fi 6647 6648 if test -n "$old_library"; then 6649 # Do each command in the old_postuninstall commands. 6650 cmds=$old_postuninstall_cmds 6651 save_ifs="$IFS"; IFS='~' 6652 for cmd in $cmds; do 6653 IFS="$save_ifs" 6654 eval cmd=\"$cmd\" 6655 $show "$cmd" 6656 $run eval "$cmd" 6657 if test "$?" -ne 0 && test "$rmforce" != yes; then 6658 exit_status=1 6659 fi 6660 done 6661 IFS="$save_ifs" 6662 fi 6663 # FIXME: should reinstall the best remaining shared library. 6664 ;; 6665 esac 6666 fi 6667 ;; 6668 6669 *.lo) 6670 # Possibly a libtool object, so verify it. 6671 if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6672 6673 # Read the .lo file 6674 . $dir/$name 6675 6676 # Add PIC object to the list of files to remove. 6677 if test -n "$pic_object" \ 6678 && test "$pic_object" != none; then 6679 rmfiles="$rmfiles $dir/$pic_object" 6680 fi 6681 6682 # Add non-PIC object to the list of files to remove. 6683 if test -n "$non_pic_object" \ 6684 && test "$non_pic_object" != none; then 6685 rmfiles="$rmfiles $dir/$non_pic_object" 6686 fi 6687 fi 6688 ;; 6689 6690 *) 6691 if test "$mode" = clean ; then 6692 noexename=$name 6693 case $file in 6694 *.exe) 6695 file=`$echo $file|${SED} 's,.exe$,,'` 6696 noexename=`$echo $name|${SED} 's,.exe$,,'` 6697 # $file with .exe has already been added to rmfiles, 6698 # add $file without .exe 6699 rmfiles="$rmfiles $file" 6700 ;; 6701 esac 6702 # Do a test to see if this is a libtool program. 6703 if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 6704 relink_command= 6705 . $dir/$noexename 6706 6707 # note $name still contains .exe if it was in $file originally 6708 # as does the version of $file that was added into $rmfiles 6709 rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}" 6710 if test "$fast_install" = yes && test -n "$relink_command"; then 6711 rmfiles="$rmfiles $objdir/lt-$name" 6712 fi 6713 if test "X$noexename" != "X$name" ; then 6714 rmfiles="$rmfiles $objdir/lt-${noexename}.c" 6715 fi 6716 fi 6717 fi 6718 ;; 6719 esac 6720 $show "$rm $rmfiles" 6721 $run $rm $rmfiles || exit_status=1 6722 done 6723 objdir="$origobjdir" 6724 6725 # Try to remove the ${objdir}s in the directories where we deleted files 6726 for dir in $rmdirs; do 6727 if test -d "$dir"; then 6728 $show "rmdir $dir" 6729 $run rmdir $dir >/dev/null 2>&1 6730 fi 6731 done 6732 6733 exit $exit_status 6734 ;; 6735 6736 "") 6737 $echo "$modename: you must specify a MODE" 1>&2 6738 $echo "$generic_help" 1>&2 6739 exit $EXIT_FAILURE 6740 ;; 6741 esac 6742 6743 if test -z "$exec_cmd"; then 6744 $echo "$modename: invalid operation mode \`$mode'" 1>&2 6745 $echo "$generic_help" 1>&2 6746 exit $EXIT_FAILURE 6747 fi 6748fi # test -z "$show_help" 6749 6750if test -n "$exec_cmd"; then 6751 eval exec $exec_cmd 6752 exit $EXIT_FAILURE 6753fi 6754 6755# We need to display help for each of the modes. 6756case $mode in 6757"") $echo \ 6758"Usage: $modename [OPTION]... [MODE-ARG]... 6759 6760Provide generalized library-building support services. 6761 6762 --config show all configuration variables 6763 --debug enable verbose shell tracing 6764-n, --dry-run display commands without modifying any files 6765 --features display basic configuration information and exit 6766 --finish same as \`--mode=finish' 6767 --help display this help message and exit 6768 --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS] 6769 --quiet same as \`--silent' 6770 --silent don't print informational messages 6771 --tag=TAG use configuration variables from tag TAG 6772 --version print version information 6773 6774MODE must be one of the following: 6775 6776 clean remove files from the build directory 6777 compile compile a source file into a libtool object 6778 execute automatically set library path, then run a program 6779 finish complete the installation of libtool libraries 6780 install install libraries or executables 6781 link create a library or an executable 6782 uninstall remove libraries from an installed directory 6783 6784MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for 6785a more detailed description of MODE. 6786 6787Report bugs to <bug-libtool@gnu.org>." 6788 exit $EXIT_SUCCESS 6789 ;; 6790 6791clean) 6792 $echo \ 6793"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE... 6794 6795Remove files from the build directory. 6796 6797RM is the name of the program to use to delete files associated with each FILE 6798(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 6799to RM. 6800 6801If FILE is a libtool library, object or program, all the files associated 6802with it are deleted. Otherwise, only FILE itself is deleted using RM." 6803 ;; 6804 6805compile) 6806 $echo \ 6807"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE 6808 6809Compile a source file into a libtool library object. 6810 6811This mode accepts the following additional options: 6812 6813 -o OUTPUT-FILE set the output file name to OUTPUT-FILE 6814 -prefer-pic try to building PIC objects only 6815 -prefer-non-pic try to building non-PIC objects only 6816 -static always build a \`.o' file suitable for static linking 6817 6818COMPILE-COMMAND is a command to be used in creating a \`standard' object file 6819from the given SOURCEFILE. 6820 6821The output file name is determined by removing the directory component from 6822SOURCEFILE, then substituting the C source code suffix \`.c' with the 6823library object suffix, \`.lo'." 6824 ;; 6825 6826execute) 6827 $echo \ 6828"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]... 6829 6830Automatically set library path, then run a program. 6831 6832This mode accepts the following additional options: 6833 6834 -dlopen FILE add the directory containing FILE to the library path 6835 6836This mode sets the library path environment variable according to \`-dlopen' 6837flags. 6838 6839If any of the ARGS are libtool executable wrappers, then they are translated 6840into their corresponding uninstalled binary, and any of their required library 6841directories are added to the library path. 6842 6843Then, COMMAND is executed, with ARGS as arguments." 6844 ;; 6845 6846finish) 6847 $echo \ 6848"Usage: $modename [OPTION]... --mode=finish [LIBDIR]... 6849 6850Complete the installation of libtool libraries. 6851 6852Each LIBDIR is a directory that contains libtool libraries. 6853 6854The commands that this mode executes may require superuser privileges. Use 6855the \`--dry-run' option if you just want to see what would be executed." 6856 ;; 6857 6858install) 6859 $echo \ 6860"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND... 6861 6862Install executables or libraries. 6863 6864INSTALL-COMMAND is the installation command. The first component should be 6865either the \`install' or \`cp' program. 6866 6867The rest of the components are interpreted as arguments to that command (only 6868BSD-compatible install options are recognized)." 6869 ;; 6870 6871link) 6872 $echo \ 6873"Usage: $modename [OPTION]... --mode=link LINK-COMMAND... 6874 6875Link object files or libraries together to form another library, or to 6876create an executable program. 6877 6878LINK-COMMAND is a command using the C compiler that you would use to create 6879a program from several object files. 6880 6881The following components of LINK-COMMAND are treated specially: 6882 6883 -all-static do not do any dynamic linking at all 6884 -avoid-version do not add a version suffix if possible 6885 -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime 6886 -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols 6887 -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) 6888 -export-symbols SYMFILE 6889 try to export only the symbols listed in SYMFILE 6890 -export-symbols-regex REGEX 6891 try to export only the symbols matching REGEX 6892 -LLIBDIR search LIBDIR for required installed libraries 6893 -lNAME OUTPUT-FILE requires the installed library libNAME 6894 -module build a library that can dlopened 6895 -no-fast-install disable the fast-install mode 6896 -no-install link a not-installable executable 6897 -no-undefined declare that a library does not refer to external symbols 6898 -o OUTPUT-FILE create OUTPUT-FILE from the specified objects 6899 -objectlist FILE Use a list of object files found in FILE to specify objects 6900 -precious-files-regex REGEX 6901 don't remove output files matching REGEX 6902 -release RELEASE specify package release information 6903 -rpath LIBDIR the created library will eventually be installed in LIBDIR 6904 -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries 6905 -static do not do any dynamic linking of uninstalled libtool libraries 6906 -static-libtool-libs 6907 do not do any dynamic linking of libtool libraries 6908 -version-info CURRENT[:REVISION[:AGE]] 6909 specify library version info [each variable defaults to 0] 6910 6911All other options (arguments beginning with \`-') are ignored. 6912 6913Every other argument is treated as a filename. Files ending in \`.la' are 6914treated as uninstalled libtool libraries, other files are standard or library 6915object files. 6916 6917If the OUTPUT-FILE ends in \`.la', then a libtool library is created, 6918only library objects (\`.lo' files) may be specified, and \`-rpath' is 6919required, except when creating a convenience library. 6920 6921If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created 6922using \`ar' and \`ranlib', or on Windows using \`lib'. 6923 6924If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file 6925is created, otherwise an executable program is created." 6926 ;; 6927 6928uninstall) 6929 $echo \ 6930"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... 6931 6932Remove libraries from an installation directory. 6933 6934RM is the name of the program to use to delete files associated with each FILE 6935(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed 6936to RM. 6937 6938If FILE is a libtool library, all the files associated with it are deleted. 6939Otherwise, only FILE itself is deleted using RM." 6940 ;; 6941 6942*) 6943 $echo "$modename: invalid operation mode \`$mode'" 1>&2 6944 $echo "$help" 1>&2 6945 exit $EXIT_FAILURE 6946 ;; 6947esac 6948 6949$echo 6950$echo "Try \`$modename --help' for more information about other modes." 6951 6952exit $? 6953 6954# The TAGs below are defined such that we never get into a situation 6955# in which we disable both kinds of libraries. Given conflicting 6956# choices, we go for a static library, that is the most portable, 6957# since we can't tell whether shared libraries were disabled because 6958# the user asked for that or because the platform doesn't support 6959# them. This is particularly important on AIX, because we don't 6960# support having both static and shared libraries enabled at the same 6961# time on that platform, so we default to a shared-only configuration. 6962# If a disable-shared tag is given, we'll fallback to a static-only 6963# configuration. But we'll never go from static-only to shared-only. 6964 6965# ### BEGIN LIBTOOL TAG CONFIG: disable-shared 6966disable_libs=shared 6967# ### END LIBTOOL TAG CONFIG: disable-shared 6968 6969# ### BEGIN LIBTOOL TAG CONFIG: disable-static 6970disable_libs=static 6971# ### END LIBTOOL TAG CONFIG: disable-static 6972 6973# Local Variables: 6974# mode:shell-script 6975# sh-indentation:2 6976# End: 6977