/ghmm-0.7.0/ltmain.sh
Shell | 6422 lines | 5468 code | 407 blank | 547 comment | 656 complexity | e112867921e7d6f38281b55b50fa5133 MD5 | raw file
Possible License(s): GPL-2.0
Large files files are truncated, but you can click here to view the full file
1# ltmain.sh - Provide generalized library-building support services. 2# NOTE: Changing this file will not affect anything until you rerun configure. 3# 4# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004 5# Free Software Foundation, Inc. 6# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 7# 8# This program is free software; you can redistribute it and/or modify 9# it under the terms of the GNU General Public License as published by 10# the Free Software Foundation; either version 2 of the License, or 11# (at your option) any later version. 12# 13# This program is distributed in the hope that it will be useful, but 14# WITHOUT ANY WARRANTY; without even the implied warranty of 15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16# General Public License for more details. 17# 18# You should have received a copy of the GNU General Public License 19# along with this program; if not, write to the Free Software 20# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 21# 22# As a special exception to the GNU General Public License, if you 23# distribute this file as part of a program that contains a 24# configuration script generated by Autoconf, you may include it under 25# the same distribution terms that you use for the rest of that program. 26 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.6 47TIMESTAMP=" (1.1220.2.94 2004/04/10 16:27:27)" 48 49 50# Check that we have a working $echo. 51if test "X$1" = X--no-reexec; then 52 # Discard the --no-reexec flag, and continue. 53 shift 54elif test "X$1" = X--fallback-echo; then 55 # Avoid inline document here, it may be left over 56 : 57elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then 58 # Yippee, $echo works! 59 : 60else 61 # Restart under the correct shell, and then maybe $echo will work. 62 exec $SHELL "$progpath" --no-reexec ${1+"$@"} 63fi 64 65if test "X$1" = X--fallback-echo; then 66 # used as fallback echo 67 shift 68 cat <<EOF 69$* 70EOF 71 exit $EXIT_SUCCESS 72fi 73 74default_mode= 75help="Try \`$progname --help' for more information." 76magic="%%%MAGIC variable%%%" 77mkdir="mkdir" 78mv="mv -f" 79rm="rm -f" 80 81# Sed substitution that helps us do robust quoting. It backslashifies 82# metacharacters that are still active within double-quoted strings. 83Xsed="${SED}"' -e 1s/^X//' 84sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g' 85# test EBCDIC or ASCII 86case `echo A|tr A '\301'` in 87 A) # EBCDIC based system 88 SP2NL="tr '\100' '\n'" 89 NL2SP="tr '\r\n' '\100\100'" 90 ;; 91 *) # Assume ASCII based system 92 SP2NL="tr '\040' '\012'" 93 NL2SP="tr '\015\012' '\040\040'" 94 ;; 95esac 96 97# NLS nuisances. 98# Only set LANG and LC_ALL to C if already set. 99# These must not be set unconditionally because not all systems understand 100# e.g. LANG=C (notably SCO). 101# We save the old values to restore during execute mode. 102if test "${LC_ALL+set}" = set; then 103 save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL 104fi 105if test "${LANG+set}" = set; then 106 save_LANG="$LANG"; LANG=C; export LANG 107fi 108 109# Make sure IFS has a sensible default 110: ${IFS=" 111"} 112 113if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then 114 $echo "$modename: not configured to build any kind of library" 1>&2 115 $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2 116 exit $EXIT_FAILURE 117fi 118 119# Global variables. 120mode=$default_mode 121nonopt= 122prev= 123prevopt= 124run= 125show="$echo" 126show_help= 127execute_dlfiles= 128lo2o="s/\\.lo\$/.${objext}/" 129o2lo="s/\\.${objext}\$/.lo/" 130 131##################################### 132# Shell function definitions: 133# This seems to be the best place for them 134 135# func_win32_libid arg 136# return the library type of file 'arg' 137# 138# Need a lot of goo to handle *both* DLLs and import libs 139# Has to be a shell function in order to 'eat' the argument 140# that is supplied when $file_magic_command is called. 141func_win32_libid () { 142 win32_libid_type="unknown" 143 win32_fileres=`file -L $1 2>/dev/null` 144 case $win32_fileres in 145 *ar\ archive\ import\ library*) # definitely import 146 win32_libid_type="x86 archive import" 147 ;; 148 *ar\ archive*) # could be an import, or static 149 if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \ 150 $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then 151 win32_nmres=`eval $NM -f posix -A $1 | \ 152 sed -n -e '1,100{/ I /{x;/import/!{s/^/import/;h;p;};x;};}'` 153 if test "X$win32_nmres" = "Ximport" ; then 154 win32_libid_type="x86 archive import" 155 else 156 win32_libid_type="x86 archive static" 157 fi 158 fi 159 ;; 160 *DLL*) 161 win32_libid_type="x86 DLL" 162 ;; 163 *executable*) # but shell scripts are "executable" too... 164 case $win32_fileres in 165 *MS\ Windows\ PE\ Intel*) 166 win32_libid_type="x86 DLL" 167 ;; 168 esac 169 ;; 170 esac 171 $echo $win32_libid_type 172} 173 174 175# func_infer_tag arg 176# Infer tagged configuration to use if any are available and 177# if one wasn't chosen via the "--tag" command line option. 178# Only attempt this if the compiler in the base compile 179# command doesn't match the default compiler. 180# arg is usually of the form 'gcc ...' 181func_infer_tag () { 182 if test -n "$available_tags" && test -z "$tagname"; then 183 CC_quoted= 184 for arg in $CC; do 185 case $arg in 186 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 187 arg="\"$arg\"" 188 ;; 189 esac 190 CC_quoted="$CC_quoted $arg" 191 done 192 case $@ in 193 # Blanks in the command may have been stripped by the calling shell, 194 # but not from the CC environment variable when configure was run. 195 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;; 196 # Blanks at the start of $base_compile will cause this to fail 197 # if we don't check for them as well. 198 *) 199 for z in $available_tags; do 200 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then 201 # Evaluate the configuration. 202 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" 203 CC_quoted= 204 for arg in $CC; do 205 # Double-quote args containing other shell metacharacters. 206 case $arg in 207 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 208 arg="\"$arg\"" 209 ;; 210 esac 211 CC_quoted="$CC_quoted $arg" 212 done 213 case "$@ " in 214 " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) 215 # The compiler in the base compile command matches 216 # the one in the tagged configuration. 217 # Assume this is the tagged configuration we want. 218 tagname=$z 219 break 220 ;; 221 esac 222 fi 223 done 224 # If $tagname still isn't set, then no tagged configuration 225 # was found and let the user know that the "--tag" command 226 # line option must be used. 227 if test -z "$tagname"; then 228 $echo "$modename: unable to infer tagged configuration" 229 $echo "$modename: specify a tag with \`--tag'" 1>&2 230 exit $EXIT_FAILURE 231# else 232# $echo "$modename: using $tagname tagged configuration" 233 fi 234 ;; 235 esac 236 fi 237} 238# End of Shell function definitions 239##################################### 240 241# Darwin sucks 242eval std_shrext=\"$shrext_cmds\" 243 244# Parse our command line options once, thoroughly. 245while test "$#" -gt 0 246do 247 arg="$1" 248 shift 249 250 case $arg in 251 -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;; 252 *) optarg= ;; 253 esac 254 255 # If the previous option needs an argument, assign it. 256 if test -n "$prev"; then 257 case $prev in 258 execute_dlfiles) 259 execute_dlfiles="$execute_dlfiles $arg" 260 ;; 261 tag) 262 tagname="$arg" 263 preserve_args="${preserve_args}=$arg" 264 265 # Check whether tagname contains only valid characters 266 case $tagname in 267 *[!-_A-Za-z0-9,/]*) 268 $echo "$progname: invalid tag name: $tagname" 1>&2 269 exit $EXIT_FAILURE 270 ;; 271 esac 272 273 case $tagname in 274 CC) 275 # Don't test for the "default" C tag, as we know, it's there, but 276 # not specially marked. 277 ;; 278 *) 279 if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then 280 taglist="$taglist $tagname" 281 # Evaluate the configuration. 282 eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`" 283 else 284 $echo "$progname: ignoring unknown tag $tagname" 1>&2 285 fi 286 ;; 287 esac 288 ;; 289 *) 290 eval "$prev=\$arg" 291 ;; 292 esac 293 294 prev= 295 prevopt= 296 continue 297 fi 298 299 # Have we seen a non-optional argument yet? 300 case $arg in 301 --help) 302 show_help=yes 303 ;; 304 305 --version) 306 $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP" 307 $echo 308 $echo "Copyright (C) 2003 Free Software Foundation, Inc." 309 $echo "This is free software; see the source for copying conditions. There is NO" 310 $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." 311 exit $EXIT_SUCCESS 312 ;; 313 314 --config) 315 ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath 316 # Now print the configurations for the tags. 317 for tagname in $taglist; do 318 ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath" 319 done 320 exit $EXIT_SUCCESS 321 ;; 322 323 --debug) 324 $echo "$progname: enabling shell trace mode" 325 set -x 326 preserve_args="$preserve_args $arg" 327 ;; 328 329 --dry-run | -n) 330 run=: 331 ;; 332 333 --features) 334 $echo "host: $host" 335 if test "$build_libtool_libs" = yes; then 336 $echo "enable shared libraries" 337 else 338 $echo "disable shared libraries" 339 fi 340 if test "$build_old_libs" = yes; then 341 $echo "enable static libraries" 342 else 343 $echo "disable static libraries" 344 fi 345 exit $EXIT_SUCCESS 346 ;; 347 348 --finish) mode="finish" ;; 349 350 --mode) prevopt="--mode" prev=mode ;; 351 --mode=*) mode="$optarg" ;; 352 353 --preserve-dup-deps) duplicate_deps="yes" ;; 354 355 --quiet | --silent) 356 show=: 357 preserve_args="$preserve_args $arg" 358 ;; 359 360 --tag) prevopt="--tag" prev=tag ;; 361 --tag=*) 362 set tag "$optarg" ${1+"$@"} 363 shift 364 prev=tag 365 preserve_args="$preserve_args --tag" 366 ;; 367 368 -dlopen) 369 prevopt="-dlopen" 370 prev=execute_dlfiles 371 ;; 372 373 -*) 374 $echo "$modename: unrecognized option \`$arg'" 1>&2 375 $echo "$help" 1>&2 376 exit $EXIT_FAILURE 377 ;; 378 379 *) 380 nonopt="$arg" 381 break 382 ;; 383 esac 384done 385 386if test -n "$prevopt"; then 387 $echo "$modename: option \`$prevopt' requires an argument" 1>&2 388 $echo "$help" 1>&2 389 exit $EXIT_FAILURE 390fi 391 392# If this variable is set in any of the actions, the command in it 393# will be execed at the end. This prevents here-documents from being 394# left over by shells. 395exec_cmd= 396 397if test -z "$show_help"; then 398 399 # Infer the operation mode. 400 if test -z "$mode"; then 401 $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2 402 $echo "*** Future versions of Libtool will require -mode=MODE be specified." 1>&2 403 case $nonopt in 404 *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*) 405 mode=link 406 for arg 407 do 408 case $arg in 409 -c) 410 mode=compile 411 break 412 ;; 413 esac 414 done 415 ;; 416 *db | *dbx | *strace | *truss) 417 mode=execute 418 ;; 419 *install*|cp|mv) 420 mode=install 421 ;; 422 *rm) 423 mode=uninstall 424 ;; 425 *) 426 # If we have no mode, but dlfiles were specified, then do execute mode. 427 test -n "$execute_dlfiles" && mode=execute 428 429 # Just use the default operation mode. 430 if test -z "$mode"; then 431 if test -n "$nonopt"; then 432 $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2 433 else 434 $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2 435 fi 436 fi 437 ;; 438 esac 439 fi 440 441 # Only execute mode is allowed to have -dlopen flags. 442 if test -n "$execute_dlfiles" && test "$mode" != execute; then 443 $echo "$modename: unrecognized option \`-dlopen'" 1>&2 444 $echo "$help" 1>&2 445 exit $EXIT_FAILURE 446 fi 447 448 # Change the help message to a mode-specific one. 449 generic_help="$help" 450 help="Try \`$modename --help --mode=$mode' for more information." 451 452 # These modes are in order of execution frequency so that they run quickly. 453 case $mode in 454 # libtool compile mode 455 compile) 456 modename="$modename: compile" 457 # Get the compilation command and the source file. 458 base_compile= 459 srcfile="$nonopt" # always keep a non-empty value in "srcfile" 460 suppress_opt=yes 461 suppress_output= 462 arg_mode=normal 463 libobj= 464 later= 465 466 for arg 467 do 468 case "$arg_mode" in 469 arg ) 470 # do not "continue". Instead, add this to base_compile 471 lastarg="$arg" 472 arg_mode=normal 473 ;; 474 475 target ) 476 libobj="$arg" 477 arg_mode=normal 478 continue 479 ;; 480 481 normal ) 482 # Accept any command-line options. 483 case $arg in 484 -o) 485 if test -n "$libobj" ; then 486 $echo "$modename: you cannot specify \`-o' more than once" 1>&2 487 exit $EXIT_FAILURE 488 fi 489 arg_mode=target 490 continue 491 ;; 492 493 -static | -prefer-pic | -prefer-non-pic) 494 later="$later $arg" 495 continue 496 ;; 497 498 -no-suppress) 499 suppress_opt=no 500 continue 501 ;; 502 503 -Xcompiler) 504 arg_mode=arg # the next one goes into the "base_compile" arg list 505 continue # The current "srcfile" will either be retained or 506 ;; # replaced later. I would guess that would be a bug. 507 508 -Wc,*) 509 args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"` 510 lastarg= 511 save_ifs="$IFS"; IFS=',' 512 for arg in $args; do 513 IFS="$save_ifs" 514 515 # Double-quote args containing other shell metacharacters. 516 # Many Bourne shells cannot handle close brackets correctly 517 # in scan sets, so we specify it separately. 518 case $arg in 519 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 520 arg="\"$arg\"" 521 ;; 522 esac 523 lastarg="$lastarg $arg" 524 done 525 IFS="$save_ifs" 526 lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"` 527 528 # Add the arguments to base_compile. 529 base_compile="$base_compile $lastarg" 530 continue 531 ;; 532 533 * ) 534 # Accept the current argument as the source file. 535 # The previous "srcfile" becomes the current argument. 536 # 537 lastarg="$srcfile" 538 srcfile="$arg" 539 ;; 540 esac # case $arg 541 ;; 542 esac # case $arg_mode 543 544 # Aesthetically quote the previous argument. 545 lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"` 546 547 case $lastarg in 548 # Double-quote args containing other shell metacharacters. 549 # Many Bourne shells cannot handle close brackets correctly 550 # in scan sets, so we specify it separately. 551 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 552 lastarg="\"$lastarg\"" 553 ;; 554 esac 555 556 base_compile="$base_compile $lastarg" 557 done # for arg 558 559 case $arg_mode in 560 arg) 561 $echo "$modename: you must specify an argument for -Xcompile" 562 exit $EXIT_FAILURE 563 ;; 564 target) 565 $echo "$modename: you must specify a target with \`-o'" 1>&2 566 exit $EXIT_FAILURE 567 ;; 568 *) 569 # Get the name of the library object. 570 [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'` 571 ;; 572 esac 573 574 # Recognize several different file suffixes. 575 # If the user specifies -o file.o, it is replaced with file.lo 576 xform='[cCFSifmso]' 577 case $libobj in 578 *.ada) xform=ada ;; 579 *.adb) xform=adb ;; 580 *.ads) xform=ads ;; 581 *.asm) xform=asm ;; 582 *.c++) xform=c++ ;; 583 *.cc) xform=cc ;; 584 *.ii) xform=ii ;; 585 *.class) xform=class ;; 586 *.cpp) xform=cpp ;; 587 *.cxx) xform=cxx ;; 588 *.f90) xform=f90 ;; 589 *.for) xform=for ;; 590 *.java) xform=java ;; 591 esac 592 593 libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"` 594 595 case $libobj in 596 *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;; 597 *) 598 $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2 599 exit $EXIT_FAILURE 600 ;; 601 esac 602 603 func_infer_tag $base_compile 604 605 for arg in $later; do 606 case $arg in 607 -static) 608 build_old_libs=yes 609 continue 610 ;; 611 612 -prefer-pic) 613 pic_mode=yes 614 continue 615 ;; 616 617 -prefer-non-pic) 618 pic_mode=no 619 continue 620 ;; 621 esac 622 done 623 624 objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'` 625 xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'` 626 if test "X$xdir" = "X$obj"; then 627 xdir= 628 else 629 xdir=$xdir/ 630 fi 631 lobj=${xdir}$objdir/$objname 632 633 if test -z "$base_compile"; then 634 $echo "$modename: you must specify a compilation command" 1>&2 635 $echo "$help" 1>&2 636 exit $EXIT_FAILURE 637 fi 638 639 # Delete any leftover library objects. 640 if test "$build_old_libs" = yes; then 641 removelist="$obj $lobj $libobj ${libobj}T" 642 else 643 removelist="$lobj $libobj ${libobj}T" 644 fi 645 646 $run $rm $removelist 647 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 648 649 # On Cygwin there's no "real" PIC flag so we must build both object types 650 case $host_os in 651 cygwin* | mingw* | pw32* | os2*) 652 pic_mode=default 653 ;; 654 esac 655 if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then 656 # non-PIC code in shared libraries is not supported 657 pic_mode=default 658 fi 659 660 # Calculate the filename of the output object if compiler does 661 # not support -o with -c 662 if test "$compiler_c_o" = no; then 663 output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext} 664 lockfile="$output_obj.lock" 665 removelist="$removelist $output_obj $lockfile" 666 trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15 667 else 668 output_obj= 669 need_locks=no 670 lockfile= 671 fi 672 673 # Lock this critical section if it is needed 674 # We use this script file to make the link, it avoids creating a new file 675 if test "$need_locks" = yes; then 676 until $run ln "$progpath" "$lockfile" 2>/dev/null; do 677 $show "Waiting for $lockfile to be removed" 678 sleep 2 679 done 680 elif test "$need_locks" = warn; then 681 if test -f "$lockfile"; then 682 $echo "\ 683*** ERROR, $lockfile exists and contains: 684`cat $lockfile 2>/dev/null` 685 686This indicates that another process is trying to use the same 687temporary object file, and libtool could not work around it because 688your compiler does not support \`-c' and \`-o' together. If you 689repeat this compilation, it may succeed, by chance, but you had better 690avoid parallel builds (make -j) in this platform, or get a better 691compiler." 692 693 $run $rm $removelist 694 exit $EXIT_FAILURE 695 fi 696 $echo $srcfile > "$lockfile" 697 fi 698 699 if test -n "$fix_srcfile_path"; then 700 eval srcfile=\"$fix_srcfile_path\" 701 fi 702 703 $run $rm "$libobj" "${libobj}T" 704 705 # Create a libtool object file (analogous to a ".la" file), 706 # but don't create it if we're doing a dry run. 707 test -z "$run" && cat > ${libobj}T <<EOF 708# $libobj - a libtool object file 709# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP 710# 711# Please DO NOT delete this file! 712# It is necessary for linking the library. 713 714# Name of the PIC object. 715EOF 716 717 # Only build a PIC object if we are building libtool libraries. 718 if test "$build_libtool_libs" = yes; then 719 # Without this assignment, base_compile gets emptied. 720 fbsd_hideous_sh_bug=$base_compile 721 722 if test "$pic_mode" != no; then 723 command="$base_compile $srcfile $pic_flag" 724 else 725 # Don't build PIC code 726 command="$base_compile $srcfile" 727 fi 728 729 if test ! -d "${xdir}$objdir"; then 730 $show "$mkdir ${xdir}$objdir" 731 $run $mkdir ${xdir}$objdir 732 status=$? 733 if test "$status" -ne 0 && test ! -d "${xdir}$objdir"; then 734 exit $status 735 fi 736 fi 737 738 if test -z "$output_obj"; then 739 # Place PIC objects in $objdir 740 command="$command -o $lobj" 741 fi 742 743 $run $rm "$lobj" "$output_obj" 744 745 $show "$command" 746 if $run eval "$command"; then : 747 else 748 test -n "$output_obj" && $run $rm $removelist 749 exit $EXIT_FAILURE 750 fi 751 752 if test "$need_locks" = warn && 753 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 754 $echo "\ 755*** ERROR, $lockfile contains: 756`cat $lockfile 2>/dev/null` 757 758but it should contain: 759$srcfile 760 761This indicates that another process is trying to use the same 762temporary object file, and libtool could not work around it because 763your compiler does not support \`-c' and \`-o' together. If you 764repeat this compilation, it may succeed, by chance, but you had better 765avoid parallel builds (make -j) in this platform, or get a better 766compiler." 767 768 $run $rm $removelist 769 exit $EXIT_FAILURE 770 fi 771 772 # Just move the object if needed, then go on to compile the next one 773 if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then 774 $show "$mv $output_obj $lobj" 775 if $run $mv $output_obj $lobj; then : 776 else 777 error=$? 778 $run $rm $removelist 779 exit $error 780 fi 781 fi 782 783 # Append the name of the PIC object to the libtool object file. 784 test -z "$run" && cat >> ${libobj}T <<EOF 785pic_object='$objdir/$objname' 786 787EOF 788 789 # Allow error messages only from the first compilation. 790 if test "$suppress_opt" = yes; then 791 suppress_output=' >/dev/null 2>&1' 792 fi 793 else 794 # No PIC object so indicate it doesn't exist in the libtool 795 # object file. 796 test -z "$run" && cat >> ${libobj}T <<EOF 797pic_object=none 798 799EOF 800 fi 801 802 # Only build a position-dependent object if we build old libraries. 803 if test "$build_old_libs" = yes; then 804 if test "$pic_mode" != yes; then 805 # Don't build PIC code 806 command="$base_compile $srcfile" 807 else 808 command="$base_compile $srcfile $pic_flag" 809 fi 810 if test "$compiler_c_o" = yes; then 811 command="$command -o $obj" 812 fi 813 814 # Suppress compiler output if we already did a PIC compilation. 815 command="$command$suppress_output" 816 $run $rm "$obj" "$output_obj" 817 $show "$command" 818 if $run eval "$command"; then : 819 else 820 $run $rm $removelist 821 exit $EXIT_FAILURE 822 fi 823 824 if test "$need_locks" = warn && 825 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then 826 $echo "\ 827*** ERROR, $lockfile contains: 828`cat $lockfile 2>/dev/null` 829 830but it should contain: 831$srcfile 832 833This indicates that another process is trying to use the same 834temporary object file, and libtool could not work around it because 835your compiler does not support \`-c' and \`-o' together. If you 836repeat this compilation, it may succeed, by chance, but you had better 837avoid parallel builds (make -j) in this platform, or get a better 838compiler." 839 840 $run $rm $removelist 841 exit $EXIT_FAILURE 842 fi 843 844 # Just move the object if needed 845 if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then 846 $show "$mv $output_obj $obj" 847 if $run $mv $output_obj $obj; then : 848 else 849 error=$? 850 $run $rm $removelist 851 exit $error 852 fi 853 fi 854 855 # Append the name of the non-PIC object the libtool object file. 856 # Only append if the libtool object file exists. 857 test -z "$run" && cat >> ${libobj}T <<EOF 858# Name of the non-PIC object. 859non_pic_object='$objname' 860 861EOF 862 else 863 # Append the name of the non-PIC object the libtool object file. 864 # Only append if the libtool object file exists. 865 test -z "$run" && cat >> ${libobj}T <<EOF 866# Name of the non-PIC object. 867non_pic_object=none 868 869EOF 870 fi 871 872 $run $mv "${libobj}T" "${libobj}" 873 874 # Unlock the critical section if it was locked 875 if test "$need_locks" != no; then 876 $run $rm "$lockfile" 877 fi 878 879 exit $EXIT_SUCCESS 880 ;; 881 882 # libtool link mode 883 link | relink) 884 modename="$modename: link" 885 case $host in 886 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 887 # It is impossible to link a dll without this setting, and 888 # we shouldn't force the makefile maintainer to figure out 889 # which system we are compiling for in order to pass an extra 890 # flag for every libtool invocation. 891 # allow_undefined=no 892 893 # FIXME: Unfortunately, there are problems with the above when trying 894 # to make a dll which has undefined symbols, in which case not 895 # even a static library is built. For now, we need to specify 896 # -no-undefined on the libtool link line when we can be certain 897 # that all symbols are satisfied, otherwise we get a static library. 898 allow_undefined=yes 899 ;; 900 *) 901 allow_undefined=yes 902 ;; 903 esac 904 libtool_args="$nonopt" 905 base_compile="$nonopt $@" 906 compile_command="$nonopt" 907 finalize_command="$nonopt" 908 909 compile_rpath= 910 finalize_rpath= 911 compile_shlibpath= 912 finalize_shlibpath= 913 convenience= 914 old_convenience= 915 deplibs= 916 old_deplibs= 917 compiler_flags= 918 linker_flags= 919 dllsearchpath= 920 lib_search_path=`pwd` 921 inst_prefix_dir= 922 923 avoid_version=no 924 dlfiles= 925 dlprefiles= 926 dlself=no 927 export_dynamic=no 928 export_symbols= 929 export_symbols_regex= 930 generated= 931 libobjs= 932 ltlibs= 933 module=no 934 no_install=no 935 objs= 936 non_pic_objects= 937 precious_files_regex= 938 prefer_static_libs=no 939 preload=no 940 prev= 941 prevarg= 942 release= 943 rpath= 944 xrpath= 945 perm_rpath= 946 temp_rpath= 947 thread_safe=no 948 vinfo= 949 vinfo_number=no 950 951 func_infer_tag $base_compile 952 953 # We need to know -static, to get the right output filenames. 954 for arg 955 do 956 case $arg in 957 -all-static | -static) 958 if test "X$arg" = "X-all-static"; then 959 if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then 960 $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2 961 fi 962 if test -n "$link_static_flag"; then 963 dlopen_self=$dlopen_self_static 964 fi 965 else 966 if test -z "$pic_flag" && test -n "$link_static_flag"; then 967 dlopen_self=$dlopen_self_static 968 fi 969 fi 970 build_libtool_libs=no 971 build_old_libs=yes 972 prefer_static_libs=yes 973 break 974 ;; 975 esac 976 done 977 978 # See if our shared archives depend on static archives. 979 test -n "$old_archive_from_new_cmds" && build_old_libs=yes 980 981 # Go through the arguments, transforming them on the way. 982 while test "$#" -gt 0; do 983 arg="$1" 984 shift 985 case $arg in 986 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 987 qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test 988 ;; 989 *) qarg=$arg ;; 990 esac 991 libtool_args="$libtool_args $qarg" 992 993 # If the previous option needs an argument, assign it. 994 if test -n "$prev"; then 995 case $prev in 996 output) 997 compile_command="$compile_command @OUTPUT@" 998 finalize_command="$finalize_command @OUTPUT@" 999 ;; 1000 esac 1001 1002 case $prev in 1003 dlfiles|dlprefiles) 1004 if test "$preload" = no; then 1005 # Add the symbol object into the linking commands. 1006 compile_command="$compile_command @SYMFILE@" 1007 finalize_command="$finalize_command @SYMFILE@" 1008 preload=yes 1009 fi 1010 case $arg in 1011 *.la | *.lo) ;; # We handle these cases below. 1012 force) 1013 if test "$dlself" = no; then 1014 dlself=needless 1015 export_dynamic=yes 1016 fi 1017 prev= 1018 continue 1019 ;; 1020 self) 1021 if test "$prev" = dlprefiles; then 1022 dlself=yes 1023 elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then 1024 dlself=yes 1025 else 1026 dlself=needless 1027 export_dynamic=yes 1028 fi 1029 prev= 1030 continue 1031 ;; 1032 *) 1033 if test "$prev" = dlfiles; then 1034 dlfiles="$dlfiles $arg" 1035 else 1036 dlprefiles="$dlprefiles $arg" 1037 fi 1038 prev= 1039 continue 1040 ;; 1041 esac 1042 ;; 1043 expsyms) 1044 export_symbols="$arg" 1045 if test ! -f "$arg"; then 1046 $echo "$modename: symbol file \`$arg' does not exist" 1047 exit $EXIT_FAILURE 1048 fi 1049 prev= 1050 continue 1051 ;; 1052 expsyms_regex) 1053 export_symbols_regex="$arg" 1054 prev= 1055 continue 1056 ;; 1057 inst_prefix) 1058 inst_prefix_dir="$arg" 1059 prev= 1060 continue 1061 ;; 1062 precious_regex) 1063 precious_files_regex="$arg" 1064 prev= 1065 continue 1066 ;; 1067 release) 1068 release="-$arg" 1069 prev= 1070 continue 1071 ;; 1072 objectlist) 1073 if test -f "$arg"; then 1074 save_arg=$arg 1075 moreargs= 1076 for fil in `cat $save_arg` 1077 do 1078# moreargs="$moreargs $fil" 1079 arg=$fil 1080 # A libtool-controlled object. 1081 1082 # Check to see that this really is a libtool object. 1083 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1084 pic_object= 1085 non_pic_object= 1086 1087 # Read the .lo file 1088 # If there is no directory component, then add one. 1089 case $arg in 1090 */* | *\\*) . $arg ;; 1091 *) . ./$arg ;; 1092 esac 1093 1094 if test -z "$pic_object" || \ 1095 test -z "$non_pic_object" || 1096 test "$pic_object" = none && \ 1097 test "$non_pic_object" = none; then 1098 $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1099 exit $EXIT_FAILURE 1100 fi 1101 1102 # Extract subdirectory from the argument. 1103 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1104 if test "X$xdir" = "X$arg"; then 1105 xdir= 1106 else 1107 xdir="$xdir/" 1108 fi 1109 1110 if test "$pic_object" != none; then 1111 # Prepend the subdirectory the object is found in. 1112 pic_object="$xdir$pic_object" 1113 1114 if test "$prev" = dlfiles; then 1115 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1116 dlfiles="$dlfiles $pic_object" 1117 prev= 1118 continue 1119 else 1120 # If libtool objects are unsupported, then we need to preload. 1121 prev=dlprefiles 1122 fi 1123 fi 1124 1125 # CHECK ME: I think I busted this. -Ossama 1126 if test "$prev" = dlprefiles; then 1127 # Preload the old-style object. 1128 dlprefiles="$dlprefiles $pic_object" 1129 prev= 1130 fi 1131 1132 # A PIC object. 1133 libobjs="$libobjs $pic_object" 1134 arg="$pic_object" 1135 fi 1136 1137 # Non-PIC object. 1138 if test "$non_pic_object" != none; then 1139 # Prepend the subdirectory the object is found in. 1140 non_pic_object="$xdir$non_pic_object" 1141 1142 # A standard non-PIC object 1143 non_pic_objects="$non_pic_objects $non_pic_object" 1144 if test -z "$pic_object" || test "$pic_object" = none ; then 1145 arg="$non_pic_object" 1146 fi 1147 fi 1148 else 1149 # Only an error if not doing a dry-run. 1150 if test -z "$run"; then 1151 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1152 exit $EXIT_FAILURE 1153 else 1154 # Dry-run case. 1155 1156 # Extract subdirectory from the argument. 1157 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1158 if test "X$xdir" = "X$arg"; then 1159 xdir= 1160 else 1161 xdir="$xdir/" 1162 fi 1163 1164 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1165 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1166 libobjs="$libobjs $pic_object" 1167 non_pic_objects="$non_pic_objects $non_pic_object" 1168 fi 1169 fi 1170 done 1171 else 1172 $echo "$modename: link input file \`$save_arg' does not exist" 1173 exit $EXIT_FAILURE 1174 fi 1175 arg=$save_arg 1176 prev= 1177 continue 1178 ;; 1179 rpath | xrpath) 1180 # We need an absolute path. 1181 case $arg in 1182 [\\/]* | [A-Za-z]:[\\/]*) ;; 1183 *) 1184 $echo "$modename: only absolute run-paths are allowed" 1>&2 1185 exit $EXIT_FAILURE 1186 ;; 1187 esac 1188 if test "$prev" = rpath; then 1189 case "$rpath " in 1190 *" $arg "*) ;; 1191 *) rpath="$rpath $arg" ;; 1192 esac 1193 else 1194 case "$xrpath " in 1195 *" $arg "*) ;; 1196 *) xrpath="$xrpath $arg" ;; 1197 esac 1198 fi 1199 prev= 1200 continue 1201 ;; 1202 xcompiler) 1203 compiler_flags="$compiler_flags $qarg" 1204 prev= 1205 compile_command="$compile_command $qarg" 1206 finalize_command="$finalize_command $qarg" 1207 continue 1208 ;; 1209 xlinker) 1210 linker_flags="$linker_flags $qarg" 1211 compiler_flags="$compiler_flags $wl$qarg" 1212 prev= 1213 compile_command="$compile_command $wl$qarg" 1214 finalize_command="$finalize_command $wl$qarg" 1215 continue 1216 ;; 1217 xcclinker) 1218 linker_flags="$linker_flags $qarg" 1219 compiler_flags="$compiler_flags $qarg" 1220 prev= 1221 compile_command="$compile_command $qarg" 1222 finalize_command="$finalize_command $qarg" 1223 continue 1224 ;; 1225 shrext) 1226 shrext_cmds="$arg" 1227 prev= 1228 continue 1229 ;; 1230 *) 1231 eval "$prev=\"\$arg\"" 1232 prev= 1233 continue 1234 ;; 1235 esac 1236 fi # test -n "$prev" 1237 1238 prevarg="$arg" 1239 1240 case $arg in 1241 -all-static) 1242 if test -n "$link_static_flag"; then 1243 compile_command="$compile_command $link_static_flag" 1244 finalize_command="$finalize_command $link_static_flag" 1245 fi 1246 continue 1247 ;; 1248 1249 -allow-undefined) 1250 # FIXME: remove this flag sometime in the future. 1251 $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2 1252 continue 1253 ;; 1254 1255 -avoid-version) 1256 avoid_version=yes 1257 continue 1258 ;; 1259 1260 -dlopen) 1261 prev=dlfiles 1262 continue 1263 ;; 1264 1265 -dlpreopen) 1266 prev=dlprefiles 1267 continue 1268 ;; 1269 1270 -export-dynamic) 1271 export_dynamic=yes 1272 continue 1273 ;; 1274 1275 -export-symbols | -export-symbols-regex) 1276 if test -n "$export_symbols" || test -n "$export_symbols_regex"; then 1277 $echo "$modename: more than one -exported-symbols argument is not allowed" 1278 exit $EXIT_FAILURE 1279 fi 1280 if test "X$arg" = "X-export-symbols"; then 1281 prev=expsyms 1282 else 1283 prev=expsyms_regex 1284 fi 1285 continue 1286 ;; 1287 1288 -inst-prefix-dir) 1289 prev=inst_prefix 1290 continue 1291 ;; 1292 1293 # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* 1294 # so, if we see these flags be careful not to treat them like -L 1295 -L[A-Z][A-Z]*:*) 1296 case $with_gcc/$host in 1297 no/*-*-irix* | /*-*-irix*) 1298 compile_command="$compile_command $arg" 1299 finalize_command="$finalize_command $arg" 1300 ;; 1301 esac 1302 continue 1303 ;; 1304 1305 -L*) 1306 dir=`$echo "X$arg" | $Xsed -e 's/^-L//'` 1307 # We need an absolute path. 1308 case $dir in 1309 [\\/]* | [A-Za-z]:[\\/]*) ;; 1310 *) 1311 absdir=`cd "$dir" && pwd` 1312 if test -z "$absdir"; then 1313 $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2 1314 exit $EXIT_FAILURE 1315 fi 1316 dir="$absdir" 1317 ;; 1318 esac 1319 case "$deplibs " in 1320 *" -L$dir "*) ;; 1321 *) 1322 deplibs="$deplibs -L$dir" 1323 lib_search_path="$lib_search_path $dir" 1324 ;; 1325 esac 1326 case $host in 1327 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1328 case :$dllsearchpath: in 1329 *":$dir:"*) ;; 1330 *) dllsearchpath="$dllsearchpath:$dir";; 1331 esac 1332 ;; 1333 esac 1334 continue 1335 ;; 1336 1337 -l*) 1338 if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then 1339 case $host in 1340 *-*-cygwin* | *-*-pw32* | *-*-beos*) 1341 # These systems don't actually have a C or math library (as such) 1342 continue 1343 ;; 1344 *-*-mingw* | *-*-os2*) 1345 # These systems don't actually have a C library (as such) 1346 test "X$arg" = "X-lc" && continue 1347 ;; 1348 *-*-openbsd* | *-*-freebsd*) 1349 # Do not include libc due to us having libc/libc_r. 1350 test "X$arg" = "X-lc" && continue 1351 ;; 1352 *-*-rhapsody* | *-*-darwin1.[012]) 1353 # Rhapsody C and math libraries are in the System framework 1354 deplibs="$deplibs -framework System" 1355 continue 1356 esac 1357 elif test "X$arg" = "X-lc_r"; then 1358 case $host in 1359 *-*-openbsd* | *-*-freebsd*) 1360 # Do not include libc_r directly, use -pthread flag. 1361 continue 1362 ;; 1363 esac 1364 fi 1365 deplibs="$deplibs $arg" 1366 continue 1367 ;; 1368 1369 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) 1370 deplibs="$deplibs $arg" 1371 continue 1372 ;; 1373 1374 -module) 1375 module=yes 1376 continue 1377 ;; 1378 1379 # gcc -m* arguments should be passed to the linker via $compiler_flags 1380 # in order to pass architecture information to the linker 1381 # (e.g. 32 vs 64-bit). This may also be accomplished via -Wl,-mfoo 1382 # but this is not reliable with gcc because gcc may use -mfoo to 1383 # select a different linker, different libraries, etc, while 1384 # -Wl,-mfoo simply passes -mfoo to the linker. 1385 -m*) 1386 # Unknown arguments in both finalize_command and compile_command need 1387 # to be aesthetically quoted because they are evaled later. 1388 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1389 case $arg in 1390 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1391 arg="\"$arg\"" 1392 ;; 1393 esac 1394 compile_command="$compile_command $arg" 1395 finalize_command="$finalize_command $arg" 1396 if test "$with_gcc" = "yes" ; then 1397 compiler_flags="$compiler_flags $arg" 1398 fi 1399 continue 1400 ;; 1401 1402 -shrext) 1403 prev=shrext 1404 continue 1405 ;; 1406 1407 -no-fast-install) 1408 fast_install=no 1409 continue 1410 ;; 1411 1412 -no-install) 1413 case $host in 1414 *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*) 1415 # The PATH hackery in wrapper scripts is required on Windows 1416 # in order for the loader to find any dlls it needs. 1417 $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2 1418 $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2 1419 fast_install=no 1420 ;; 1421 *) no_install=yes ;; 1422 esac 1423 continue 1424 ;; 1425 1426 -no-undefined) 1427 allow_undefined=no 1428 continue 1429 ;; 1430 1431 -objectlist) 1432 prev=objectlist 1433 continue 1434 ;; 1435 1436 -o) prev=output ;; 1437 1438 -precious-files-regex) 1439 prev=precious_regex 1440 continue 1441 ;; 1442 1443 -release) 1444 prev=release 1445 continue 1446 ;; 1447 1448 -rpath) 1449 prev=rpath 1450 continue 1451 ;; 1452 1453 -R) 1454 prev=xrpath 1455 continue 1456 ;; 1457 1458 -R*) 1459 dir=`$echo "X$arg" | $Xsed -e 's/^-R//'` 1460 # We need an absolute path. 1461 case $dir in 1462 [\\/]* | [A-Za-z]:[\\/]*) ;; 1463 *) 1464 $echo "$modename: only absolute run-paths are allowed" 1>&2 1465 exit $EXIT_FAILURE 1466 ;; 1467 esac 1468 case "$xrpath " in 1469 *" $dir "*) ;; 1470 *) xrpath="$xrpath $dir" ;; 1471 esac 1472 continue 1473 ;; 1474 1475 -static) 1476 # The effects of -static are defined in a previous loop. 1477 # We used to do the same as -all-static on platforms that 1478 # didn't have a PIC flag, but the assumption that the effects 1479 # would be equivalent was wrong. It would break on at least 1480 # Digital Unix and AIX. 1481 continue 1482 ;; 1483 1484 -thread-safe) 1485 thread_safe=yes 1486 continue 1487 ;; 1488 1489 -version-info) 1490 prev=vinfo 1491 continue 1492 ;; 1493 -version-number) 1494 prev=vinfo 1495 vinfo_number=yes 1496 continue 1497 ;; 1498 1499 -Wc,*) 1500 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'` 1501 arg= 1502 save_ifs="$IFS"; IFS=',' 1503 for flag in $args; do 1504 IFS="$save_ifs" 1505 case $flag in 1506 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1507 flag="\"$flag\"" 1508 ;; 1509 esac 1510 arg="$arg $wl$flag" 1511 compiler_flags="$compiler_flags $flag" 1512 done 1513 IFS="$save_ifs" 1514 arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1515 ;; 1516 1517 -Wl,*) 1518 args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'` 1519 arg= 1520 save_ifs="$IFS"; IFS=',' 1521 for flag in $args; do 1522 IFS="$save_ifs" 1523 case $flag in 1524 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1525 flag="\"$flag\"" 1526 ;; 1527 esac 1528 arg="$arg $wl$flag" 1529 compiler_flags="$compiler_flags $wl$flag" 1530 linker_flags="$linker_flags $flag" 1531 done 1532 IFS="$save_ifs" 1533 arg=`$echo "X$arg" | $Xsed -e "s/^ //"` 1534 ;; 1535 1536 -Xcompiler) 1537 prev=xcompiler 1538 continue 1539 ;; 1540 1541 -Xlinker) 1542 prev=xlinker 1543 continue 1544 ;; 1545 1546 -XCClinker) 1547 prev=xcclinker 1548 continue 1549 ;; 1550 1551 # Some other compiler flag. 1552 -* | +*) 1553 # Unknown arguments in both finalize_command and compile_command need 1554 # to be aesthetically quoted because they are evaled later. 1555 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1556 case $arg in 1557 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1558 arg="\"$arg\"" 1559 ;; 1560 esac 1561 ;; 1562 1563 *.$objext) 1564 # A standard object. 1565 objs="$objs $arg" 1566 ;; 1567 1568 *.lo) 1569 # A libtool-controlled object. 1570 1571 # Check to see that this really is a libtool object. 1572 if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1573 pic_object= 1574 non_pic_object= 1575 1576 # Read the .lo file 1577 # If there is no directory component, then add one. 1578 case $arg in 1579 */* | *\\*) . $arg ;; 1580 *) . ./$arg ;; 1581 esac 1582 1583 if test -z "$pic_object" || \ 1584 test -z "$non_pic_object" || 1585 test "$pic_object" = none && \ 1586 test "$non_pic_object" = none; then 1587 $echo "$modename: cannot find name of object for \`$arg'" 1>&2 1588 exit $EXIT_FAILURE 1589 fi 1590 1591 # Extract subdirectory from the argument. 1592 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1593 if test "X$xdir" = "X$arg"; then 1594 xdir= 1595 else 1596 xdir="$xdir/" 1597 fi 1598 1599 if test "$pic_object" != none; then 1600 # Prepend the subdirectory the object is found in. 1601 pic_object="$xdir$pic_object" 1602 1603 if test "$prev" = dlfiles; then 1604 if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then 1605 dlfiles="$dlfiles $pic_object" 1606 prev= 1607 continue 1608 else 1609 # If libtool objects are unsupported, then we need to preload. 1610 prev=dlprefiles 1611 fi 1612 fi 1613 1614 # CHECK ME: I think I busted this. -Ossama 1615 if test "$prev" = dlprefiles; then 1616 # Preload the old-style object. 1617 dlprefiles="$dlprefiles $pic_object" 1618 prev= 1619 fi 1620 1621 # A PIC object. 1622 libobjs="$libobjs $pic_object" 1623 arg="$pic_object" 1624 fi 1625 1626 # Non-PIC object. 1627 if test "$non_pic_object" != none; then 1628 # Prepend the subdirectory the object is found in. 1629 non_pic_object="$xdir$non_pic_object" 1630 1631 # A standard non-PIC object 1632 non_pic_objects="$non_pic_objects $non_pic_object" 1633 if test -z "$pic_object" || test "$pic_object" = none ; then 1634 arg="$non_pic_object" 1635 fi 1636 fi 1637 else 1638 # Only an error if not doing a dry-run. 1639 if test -z "$run"; then 1640 $echo "$modename: \`$arg' is not a valid libtool object" 1>&2 1641 exit $EXIT_FAILURE 1642 else 1643 # Dry-run case. 1644 1645 # Extract subdirectory from the argument. 1646 xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'` 1647 if test "X$xdir" = "X$arg"; then 1648 xdir= 1649 else 1650 xdir="$xdir/" 1651 fi 1652 1653 pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"` 1654 non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"` 1655 libobjs="$libobjs $pic_object" 1656 non_pic_objects="$non_pic_objects $non_pic_object" 1657 fi 1658 fi 1659 ;; 1660 1661 *.$libext) 1662 # An archive. 1663 deplibs="$deplibs $arg" 1664 old_deplibs="$old_deplibs $arg" 1665 continue 1666 ;; 1667 1668 *.la) 1669 # A libtool-controlled library. 1670 1671 if test "$prev" = dlfiles; then 1672 # This library was specified with -dlopen. 1673 dlfiles="$dlfiles $arg" 1674 prev= 1675 elif test "$prev" = dlprefiles; then 1676 # The library was specified with -dlpreopen. 1677 dlprefiles="$dlprefiles $arg" 1678 prev= 1679 else 1680 deplibs="$deplibs $arg" 1681 fi 1682 continue 1683 ;; 1684 1685 # Some other compiler argument. 1686 *) 1687 # Unknown arguments in both finalize_command and compile_command need 1688 # to be aesthetically quoted because they are evaled later. 1689 arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"` 1690 case $arg in 1691 *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") 1692 arg="\"$arg\"" 1693 ;; 1694 esac 1695 ;; 1696 esac # arg 1697 1698 # Now actually substitute the argument into the commands. 1699 if test -n "$arg"; then 1700 compile_command="$compile_command $arg" 1701 finalize_command="$finalize_command $arg" 1702 fi 1703 done # argument parsing loop 1704 1705 if test -n "$prev"; then 1706 $echo "$modename: the \`$prevarg' option requires an argument" 1>&2 1707 $echo "$help" 1>&2 1708 exit $EXIT_FAILURE 1709 fi 1710 1711 if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then 1712 eval arg=\"$export_dynamic_flag_spec\" 1713 compile_command="$compile_command $arg" 1714 finalize_command="$finalize_command $arg" 1715 fi 1716 1717 oldlibs= 1718 # calculate the name of the file, without its directory 1719 outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'` 1720 libobjs_save="$libobjs" 1721 1722 if test -n "$shlibpath_var"; then 1723 # get the directories listed in $shlibpath_var 1724 eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\` 1725 else 1726 shlib_search_path= 1727 fi 1728 eval sys_lib_search_path=\"$sys_lib_search_path_spec\" 1729 eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" 1730 1731 output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'` 1732 if test "X$output_objdir" = "X$output"; then 1733 output_objdir="$objdir" 1734 else 1735 output_objdir="$output_objdir/$objdir" 1736 fi 1737 # Create the object directory. 1738 if test ! -d "$output_objdir"; then 1739 $show "$mkdir $output_objdir" 1740 $run $mkdir $output_objdir 1741 status=$? 1742 if test "$status" -ne 0 && test ! -d "$output_objdir"; then 1743 exit $status 1744 fi 1745 fi 1746 1747 # Determine the type of output 1748 case $output in 1749 "") 1750 $echo "$modename: you must specify an output file" 1>&2 1751 $echo "$help" 1>&2 1752 exit $EXIT_FAILURE 1753 ;; 1754 *.$libext) linkmode=oldlib ;; 1755 *.lo | *.$objext) linkmode=obj ;; 1756 *.la) linkmode=lib ;; 1757 *) linkmode=prog ;; # Anything else should be a program. 1758 esac 1759 1760 case $host in 1761 *cygwin* | *mingw* | *pw32*) 1762 # don't eliminate duplications in $postdeps and $predeps 1763 duplicate_compiler_generated_deps=yes 1764 ;; 1765 *) 1766 duplicate_compiler_generated_deps=$duplicate_deps 1767 ;; 1768 esac 1769 specialdeplibs= 1770 1771 libs= 1772 # Find all interdependent deplibs by searching for libraries 1773 # that are linked more than once (e.g. -la -lb -la) 1774 for deplib in $deplibs; do 1775 if test "X$duplicate_deps" = "Xyes" ; then 1776 case "$libs " in 1777 *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;; 1778 esac 1779 fi 1780 libs="$libs $deplib" 1781 done 1782 1783 if test "$linkmode" = lib; then 1784 libs="$predeps $libs $compiler_lib_search_path $postdeps" 1785 1786 # Compute libraries that are listed more than once in $predeps 1787 # $postdeps and mark them as special (i.e., whose duplicates are 1788 # not to be eliminated). 1789 pre_post_deps= 1790 if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then 1791 for pre_post_dep in $predeps $postdeps; do 1792 case "$pre_post_deps " in 1793 *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;; 1794 esac 1795 pre_post_deps="$pre_post_deps $pre_post_dep" 1796 done 1797 fi 1798 pre_post_deps= 1799 fi 1800 1801 deplibs= 1802 newdependency_libs= 1803 newlib_search_path= 1804 need_relink=no # whether we're linking any uninstalled libtool libraries 1805 notinst_deplibs= # not-installed libtool libraries 1806 notinst_path= # paths that contain not-installed libtool libraries 1807 case $linkmode in 1808 lib) 1809 passes="conv link" 1810 for file in $dlfiles $dlprefiles; do 1811 case $file in 1812 *.la) ;; 1813 *) 1814 $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2 1815 exit $EXIT_FAILURE 1816 ;; 1817 esac 1818 done 1819 ;; 1820 prog) 1821 compile_deplibs= 1822 finalize_deplibs= 1823 alldeplibs=no 1824 newdlfiles= 1825 newdlprefiles= 1826 passes="conv scan dlopen dlpreopen link" 1827 ;; 1828 *) passes="conv" 1829 ;; 1830 esac 1831 for pass in $passes; do 1832 if test "$linkmode,$pass" = "lib,link" || 1833 test "$linkmode,$pass" = "prog,scan"; then 1834 libs="$deplibs" 1835 deplibs= 1836 fi 1837 if test "$linkmode" = prog; then 1838 case $pass in 1839 dlopen) libs="$dlfiles" ;; 1840 dlpreopen) libs="$dlprefiles" ;; 1841 link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; 1842 esac 1843 fi 1844 if test "$pass" = dlopen; then 1845 # Collect dlpreopened libraries 1846 save_deplibs="$deplibs" 1847 deplibs= 1848 fi 1849 for deplib in $libs; do 1850 lib= 1851 found=no 1852 case $deplib in 1853 -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe) 1854 if test "$linkmode,$pass" = "prog,link"; then 1855 compile_deplibs="$deplib $compile_deplibs" 1856 finalize_deplibs="$deplib $finalize_deplibs" 1857 else 1858 deplibs="$deplib $deplibs" 1859 fi 1860 continue 1861 ;; 1862 -l*) 1863 if test "$linkmode" != lib && test "$linkmode" != prog; then 1864 $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2 1865 continue 1866 fi 1867 if test "$pass" = conv; then 1868 deplibs="$deplib $deplibs" 1869 continue 1870 fi 1871 name=`$echo "X$deplib" | $Xsed -e 's/^-l//'` 1872 for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do 1873 for search_ext in .la $std_shrext .so .a; do 1874 # Search the libtool library 1875 lib="$searchdir/lib${name}${search_ext}" 1876 if test -f "$lib"; then 1877 if test "$search_ext" = ".la"; then 1878 found=yes 1879 else 1880 found=no 1881 fi 1882 break 2 1883 fi 1884 done 1885 done 1886 if test "$found" != yes; then 1887 # deplib doesn't seem to be a libtool library 1888 if test "$linkmode,$pass" = "prog,link"; then 1889 compile_deplibs="$deplib $compile_deplibs" 1890 finalize_deplibs="$deplib $finalize_deplibs" 1891 else 1892 deplibs="$deplib $deplibs" 1893 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 1894 fi 1895 continue 1896 else # deplib is a libtool library 1897 # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, 1898 # We need to do some special things here, and not later. 1899 if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then 1900 case " $predeps $postdeps " in 1901 *" $deplib "*) 1902 if (${SED} -e '2q' $lib | 1903 grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then 1904 library_names= 1905 old_library= 1906 case $lib in 1907 */* | *\\*) . $lib ;; 1908 *) . ./$lib ;; 1909 esac 1910 for l in $old_library $library_names; do 1911 ll="$l" 1912 done 1913 if test "X$ll" = "X$old_library" ; then # only static version available 1914 found=no 1915 ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'` 1916 test "X$ladir" = "X$lib" && ladir="." 1917 lib=$ladir/$old_library 1918 if test "$linkmode,$pass" = "prog,link"; then 1919 compile_deplibs="$deplib $compile_deplibs" 1920 finalize_deplibs="$deplib $finalize_deplibs" 1921 else 1922 deplibs="$deplib $deplibs" 1923 test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" 1924 fi 1925 continue 1926 fi 1927 fi 1928 ;; 1929 *) ;; 1930 esac 1931 fi 1932 fi 1933 ;; # -l 1934 -L*) 1935 case $linkmode in 1936 lib) 1937 deplibs="$deplib $deplibs" 1938 test "$pass" = conv && continue 1939 newdependency_libs="$deplib $newdependency_libs" 1940 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 1941 ;; 1942 prog) 1943 if test "$pass" = conv; then 1944 deplibs="$deplib $deplibs" 1945 continue 1946 fi 1947 if test "$pass" = scan; then 1948 deplibs="$deplib $deplibs" 1949 else 1950 compile_deplibs="$deplib $compile_deplibs" 1951 finalize_deplibs="$deplib $finalize_deplibs" 1952 fi 1953 newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'` 1954 ;; 1955 *) 1956 $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2 1957 ;; 1958 esac # linkmode 1959 continue 1960 ;; # -L 1961 -R*) 1962 if test "$pass" = link; then 1963 dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'` 1964 # Make sure the xrpath…
Large files files are truncated, but you can click here to view the full file