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