PageRenderTime 872ms CodeModel.GetById 269ms app.highlight 342ms RepoModel.GetById 161ms app.codeStats 3ms

/Unittests/googletest/build-aux/ltmain.sh

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

Large files files are truncated, but you can click here to view the full file