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