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