145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# ltmain.sh - Provide generalized library-building support services.
245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# NOTE: Changing this file will not affect anything until you rerun configure.
345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#
445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Free Software Foundation, Inc.
645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#
845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# This program is free software; you can redistribute it and/or modify
945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# it under the terms of the GNU General Public License as published by
1045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# the Free Software Foundation; either version 2 of the License, or
1145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# (at your option) any later version.
1245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#
1345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# This program is distributed in the hope that it will be useful, but
1445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# WITHOUT ANY WARRANTY; without even the implied warranty of
1545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# General Public License for more details.
1745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#
1845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# You should have received a copy of the GNU General Public License
1945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# along with this program; if not, write to the Free Software
2045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#
2245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# As a special exception to the GNU General Public License, if you
2345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# distribute this file as part of a program that contains a
2445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# configuration script generated by Autoconf, you may include it under
2545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# the same distribution terms that you use for the rest of that program.
2645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
2745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgbasename="s,^.*/,,g"
2845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
2945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
3045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# is ksh but when the shell is invoked as "sh" and the current value of
3145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# the _XPG environment variable is not equal to 1 (one), the special
3245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# positional parameter $0, within a function call, is the name of the
3345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# function.
3445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgprogpath="$0"
3545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
3645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# The name of this program:
3745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgprogname=`echo "$progpath" | $SED $basename`
3845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgmodename="$progname"
3945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
4045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Global variables:
4145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgEXIT_SUCCESS=0
4245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgEXIT_FAILURE=1
4345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
4445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgPROGRAM=ltmain.sh
4545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgPACKAGE=libtool
4645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgVERSION=1.5.22
4745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgTIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
4845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
4945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# See if we are running on zsh, and set the options which allow our
5045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# commands through without removal of \ escapes.
5145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgif test -n "${ZSH_VERSION+set}" ; then
5245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  setopt NO_GLOB_SUBST
5345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgfi
5445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
5545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Check that we have a working $echo.
5645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgif test "X$1" = X--no-reexec; then
5745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # Discard the --no-reexec flag, and continue.
5845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  shift
5945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgelif test "X$1" = X--fallback-echo; then
6045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # Avoid inline document here, it may be left over
6145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  :
6245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
6345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # Yippee, $echo works!
6445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  :
6545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgelse
6645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # Restart under the correct shell, and then maybe $echo will work.
6745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
6845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgfi
6945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
7045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgif test "X$1" = X--fallback-echo; then
7145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # used as fallback echo
7245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  shift
7345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  cat <<EOF
7445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org$*
7545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgEOF
7645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  exit $EXIT_SUCCESS
7745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgfi
7845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
7945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgdefault_mode=
8045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orghelp="Try \`$progname --help' for more information."
8145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgmagic="%%%MAGIC variable%%%"
8245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgmkdir="mkdir"
8345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgmv="mv -f"
8445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgrm="rm -f"
8545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
8645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Sed substitution that helps us do robust quoting.  It backslashifies
8745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# metacharacters that are still active within double-quoted strings.
8845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgXsed="${SED}"' -e 1s/^X//'
8945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
9045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# test EBCDIC or ASCII
9145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgcase `echo X|tr X '\101'` in
9245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org A) # ASCII based system
9345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
9445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  SP2NL='tr \040 \012'
9545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  NL2SP='tr \015\012 \040\040'
9645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  ;;
9745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org *) # EBCDIC based system
9845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  SP2NL='tr \100 \n'
9945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  NL2SP='tr \r\n \100\100'
10045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  ;;
10145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgesac
10245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
10345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# NLS nuisances.
10445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Only set LANG and LC_ALL to C if already set.
10545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# These must not be set unconditionally because not all systems understand
10645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# e.g. LANG=C (notably SCO).
10745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# We save the old values to restore during execute mode.
10845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgif test "${LC_ALL+set}" = set; then
10945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
11045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgfi
11145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgif test "${LANG+set}" = set; then
11245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  save_LANG="$LANG"; LANG=C; export LANG
11345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgfi
11445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
11545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Make sure IFS has a sensible default
11645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orglt_nl='
11745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org'
11845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgIFS=" 	$lt_nl"
11945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
12045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
12145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  $echo "$modename: not configured to build any kind of library" 1>&2
12245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
12345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  exit $EXIT_FAILURE
12445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgfi
12545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
12645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Global variables.
12745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgmode=$default_mode
12845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgnonopt=
12945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgprev=
13045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgprevopt=
13145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgrun=
13245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgshow="$echo"
13345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgshow_help=
13445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgexecute_dlfiles=
13545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgduplicate_deps=no
13645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgpreserve_args=
13745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orglo2o="s/\\.lo\$/.${objext}/"
13845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgo2lo="s/\\.${objext}\$/.lo/"
13945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
14045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#####################################
14145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Shell function definitions:
14245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# This seems to be the best place for them
14345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
14445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# func_mktempdir [string]
14545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Make a temporary directory that won't clash with other running
14645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# libtool processes, and avoids race conditions if possible.  If
14745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# given, STRING is the basename for that directory.
14845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgfunc_mktempdir ()
14945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
15045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    my_template="${TMPDIR-/tmp}/${1-$progname}"
15145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
15245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test "$run" = ":"; then
15345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Return a directory name, but don't create it in dry-run mode
15445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      my_tmpdir="${my_template}-$$"
15545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    else
15645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
15745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # If mktemp works, use that first and foremost
15845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
15945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
16045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test ! -d "$my_tmpdir"; then
16145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Failing that, at least try and use $RANDOM to avoid a race
16245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	my_tmpdir="${my_template}-${RANDOM-0}$$"
16345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
16445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	save_mktempdir_umask=`umask`
16545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	umask 0077
16645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$mkdir "$my_tmpdir"
16745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	umask $save_mktempdir_umask
16845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
16945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
17045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # If we're not in dry-run mode, bomb out on failure
17145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      test -d "$my_tmpdir" || {
17245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
17345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit $EXIT_FAILURE
17445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      }
17545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
17645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
17745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "X$my_tmpdir" | $Xsed
17845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
17945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
18045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
18145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# func_win32_libid arg
18245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# return the library type of file 'arg'
18345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#
18445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Need a lot of goo to handle *both* DLLs and import libs
18545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Has to be a shell function in order to 'eat' the argument
18645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# that is supplied when $file_magic_command is called.
18745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgfunc_win32_libid ()
18845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
18945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  win32_libid_type="unknown"
19045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  win32_fileres=`file -L $1 2>/dev/null`
19145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  case $win32_fileres in
19245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  *ar\ archive\ import\ library*) # definitely import
19345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    win32_libid_type="x86 archive import"
19445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
19545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  *ar\ archive*) # could be an import, or static
19645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
19745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
19845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      win32_nmres=`eval $NM -f posix -A $1 | \
19945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
20045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $win32_nmres in
20145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      import*)  win32_libid_type="x86 archive import";;
20245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *)        win32_libid_type="x86 archive static";;
20345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
20445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
20545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
20645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  *DLL*)
20745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    win32_libid_type="x86 DLL"
20845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
20945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  *executable*) # but shell scripts are "executable" too...
21045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    case $win32_fileres in
21145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *MS\ Windows\ PE\ Intel*)
21245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      win32_libid_type="x86 DLL"
21345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
21445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    esac
21545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
21645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  esac
21745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  $echo $win32_libid_type
21845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
21945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
22045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
22145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# func_infer_tag arg
22245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Infer tagged configuration to use if any are available and
22345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# if one wasn't chosen via the "--tag" command line option.
22445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Only attempt this if the compiler in the base compile
22545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# command doesn't match the default compiler.
22645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# arg is usually of the form 'gcc ...'
22745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgfunc_infer_tag ()
22845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
22945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # FreeBSD-specific: where we install compilers with non-standard names
23045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    tag_compilers_CC="*cc cc* *gcc gcc*"
23145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    tag_compilers_CXX="*c++ c++* *g++ g++*"
23245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    base_compiler=`set -- "$@"; echo $1`
23345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
23445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # If $tagname isn't set, then try to infer if the default "CC" tag applies
23545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -z "$tagname"; then
23645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for zp in $tag_compilers_CC; do
23745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        case $base_compiler in
23845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	 $zp) tagname="CC"; break;;
23945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
24045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
24145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
24245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
24345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -n "$available_tags" && test -z "$tagname"; then
24445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      CC_quoted=
24545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for arg in $CC; do
24645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $arg in
24745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
24845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  arg="\"$arg\""
24945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
25045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
25145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	CC_quoted="$CC_quoted $arg"
25245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
25345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $@ in
25445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Blanks in the command may have been stripped by the calling shell,
25545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # but not from the CC environment variable when configure was run.
25645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
25745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Blanks at the start of $base_compile will cause this to fail
25845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # if we don't check for them as well.
25945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *)
26045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	for z in $available_tags; do
26145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
26245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Evaluate the configuration.
26345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
26445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    CC_quoted=
26545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for arg in $CC; do
26645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Double-quote args containing other shell metacharacters.
26745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case $arg in
26845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
26945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      arg="\"$arg\""
27045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      ;;
27145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac
27245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    CC_quoted="$CC_quoted $arg"
27345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
27445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case "$@ " in
27545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
27645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # The compiler in the base compile command matches
27745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # the one in the tagged configuration.
27845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # Assume this is the tagged configuration we want.
27945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      tagname=$z
28045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      break
28145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      ;;
28245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac
28345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
28445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # FreeBSD-specific: try compilers based on inferred tag
28545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -z "$tagname"; then
28645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      eval "tag_compilers=\$tag_compilers_${z}"
28745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test -n "$tag_compilers"; then
28845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		for zp in $tag_compilers; do
28945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  case $base_compiler in   
29045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    $zp) tagname=$z; break;;
29145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  esac
29245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		done
29345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if test -n "$tagname"; then
29445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  break
29545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi
29645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
29745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            fi
29845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          fi
29945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	done
30045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# If $tagname still isn't set, then no tagged configuration
30145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# was found and let the user know that the "--tag" command
30245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# line option must be used.
30345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -z "$tagname"; then
30445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: unable to infer tagged configuration"
30545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: specify a tag with \`--tag'" 1>&2
30645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
30745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#        else
30845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#          $echo "$modename: using $tagname tagged configuration"
30945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
31045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
31145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
31245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
31345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
31445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
31545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
31645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# func_extract_an_archive dir oldlib
31745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgfunc_extract_an_archive ()
31845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
31945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    f_ex_an_ar_dir="$1"; shift
32045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    f_ex_an_ar_oldlib="$1"
32145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
32245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
32345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
32445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
32545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org     :
32645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    else
32745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
32845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit $EXIT_FAILURE
32945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
33045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
33145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
33245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# func_extract_archives gentop oldlib ...
33345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgfunc_extract_archives ()
33445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
33545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    my_gentop="$1"; shift
33645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    my_oldlibs=${1+"$@"}
33745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    my_oldobjs=""
33845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    my_xlib=""
33945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    my_xabs=""
34045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    my_xdir=""
34145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    my_status=""
34245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
34345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $show "${rm}r $my_gentop"
34445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $run ${rm}r "$my_gentop"
34545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $show "$mkdir $my_gentop"
34645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $run $mkdir "$my_gentop"
34745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    my_status=$?
34845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
34945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit $my_status
35045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
35145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
35245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    for my_xlib in $my_oldlibs; do
35345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Extract the objects.
35445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $my_xlib in
35545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
35645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*) my_xabs=`pwd`"/$my_xlib" ;;
35745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
35845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
35945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      my_xdir="$my_gentop/$my_xlib"
36045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
36145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $show "${rm}r $my_xdir"
36245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $run ${rm}r "$my_xdir"
36345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $show "$mkdir $my_xdir"
36445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $run $mkdir "$my_xdir"
36545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit_status=$?
36645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
36745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit $exit_status
36845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
36945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $host in
37045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *-darwin*)
37145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$show "Extracting $my_xabs"
37245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Do not bother doing anything if just a dry run
37345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -z "$run"; then
37445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  darwin_orig_dir=`pwd`
37545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  cd $my_xdir || exit $?
37645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  darwin_archive=$my_xabs
37745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  darwin_curdir=`pwd`
37845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
37945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
38045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$darwin_arches"; then 
38145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
38245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    darwin_arch=
38345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
38445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for darwin_arch in  $darwin_arches ; do
38545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
38645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
38745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
38845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
38945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      cd "$darwin_curdir"
39045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
39145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done # $darwin_arches
39245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
39345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
39445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    darwin_file=
39545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    darwin_files=
39645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for darwin_file in $darwin_filelist; do
39745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
39845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      lipo -create -output "$darwin_file" $darwin_files
39945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done # $darwin_filelist
40045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ${rm}r unfat-$$
40145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    cd "$darwin_orig_dir"
40245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
40345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    cd "$darwin_orig_dir"
40445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 	    func_extract_an_archive "$my_xdir" "$my_xabs"
40545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi # $darwin_arches
40645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi # $run
40745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
40845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *)
40945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        func_extract_an_archive "$my_xdir" "$my_xabs"
41045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        ;;
41145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
41245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
41345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    done
41445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    func_extract_archives_result="$my_oldobjs"
41545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
41645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# End of Shell function definitions
41745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#####################################
41845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
41945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Darwin sucks
42045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgeval std_shrext=\"$shrext_cmds\"
42145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
42245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgdisable_libs=no
42345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
42445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Parse our command line options once, thoroughly.
42545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgwhile test "$#" -gt 0
42645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgdo
42745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  arg="$1"
42845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  shift
42945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
43045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  case $arg in
43145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
43245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  *) optarg= ;;
43345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  esac
43445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
43545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # If the previous option needs an argument, assign it.
43645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if test -n "$prev"; then
43745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    case $prev in
43845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    execute_dlfiles)
43945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      execute_dlfiles="$execute_dlfiles $arg"
44045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
44145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    tag)
44245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      tagname="$arg"
44345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      preserve_args="${preserve_args}=$arg"
44445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
44545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Check whether tagname contains only valid characters
44645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $tagname in
44745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *[!-_A-Za-z0-9,/]*)
44845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$progname: invalid tag name: $tagname" 1>&2
44945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit $EXIT_FAILURE
45045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
45145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
45245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
45345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $tagname in
45445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      CC)
45545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Don't test for the "default" C tag, as we know, it's there, but
45645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# not specially marked.
45745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
45845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *)
45945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
46045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  taglist="$taglist $tagname"
46145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Evaluate the configuration.
46245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
46345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
46445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
46545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
46645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
46745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
46845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
46945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *)
47045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      eval "$prev=\$arg"
47145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
47245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    esac
47345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
47445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    prev=
47545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    prevopt=
47645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    continue
47745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  fi
47845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
47945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # Have we seen a non-optional argument yet?
48045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  case $arg in
48145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  --help)
48245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    show_help=yes
48345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
48445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
48545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  --version)
48645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
48745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo
48845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
48945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "This is free software; see the source for copying conditions.  There is NO"
49045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
49145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    exit $?
49245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
49345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
49445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  --config)
49545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
49645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Now print the configurations for the tags.
49745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    for tagname in $taglist; do
49845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
49945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    done
50045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    exit $?
50145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
50245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
50345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  --debug)
50445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "$progname: enabling shell trace mode"
50545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    set -x
50645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    preserve_args="$preserve_args $arg"
50745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
50845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
50945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  --dry-run | -n)
51045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    run=:
51145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
51245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
51345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  --features)
51445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "host: $host"
51545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test "$build_libtool_libs" = yes; then
51645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "enable shared libraries"
51745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    else
51845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "disable shared libraries"
51945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
52045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test "$build_old_libs" = yes; then
52145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "enable static libraries"
52245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    else
52345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "disable static libraries"
52445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
52545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    exit $?
52645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
52745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
52845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  --finish) mode="finish" ;;
52945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
53045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  --mode) prevopt="--mode" prev=mode ;;
53145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  --mode=*) mode="$optarg" ;;
53245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
53345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  --preserve-dup-deps) duplicate_deps="yes" ;;
53445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
53545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  --quiet | --silent)
53645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    show=:
53745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    preserve_args="$preserve_args $arg"
53845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
53945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
54045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  --tag)
54145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    prevopt="--tag"
54245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    prev=tag
54345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    preserve_args="$preserve_args --tag"
54445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
54545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  --tag=*)
54645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    set tag "$optarg" ${1+"$@"}
54745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    shift
54845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    prev=tag
54945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    preserve_args="$preserve_args --tag"
55045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
55145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
55245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -dlopen)
55345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    prevopt="-dlopen"
55445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    prev=execute_dlfiles
55545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
55645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
55745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -*)
55845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "$modename: unrecognized option \`$arg'" 1>&2
55945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "$help" 1>&2
56045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    exit $EXIT_FAILURE
56145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
56245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
56345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  *)
56445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    nonopt="$arg"
56545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    break
56645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
56745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  esac
56845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgdone
56945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
57045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgif test -n "$prevopt"; then
57145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
57245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  $echo "$help" 1>&2
57345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  exit $EXIT_FAILURE
57445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgfi
57545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
57645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgcase $disable_libs in
57745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgno) 
57845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  ;;
57945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgshared)
58045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  build_libtool_libs=no
58145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  build_old_libs=yes
58245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  ;;
58345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic)
58445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
58545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  ;;
58645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgesac
58745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
58845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# If this variable is set in any of the actions, the command in it
58945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# will be execed at the end.  This prevents here-documents from being
59045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# left over by shells.
59145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgexec_cmd=
59245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
59345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgif test -z "$show_help"; then
59445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
59545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # Infer the operation mode.
59645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if test -z "$mode"; then
59745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
59845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
59945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    case $nonopt in
60045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
60145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      mode=link
60245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for arg
60345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      do
60445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $arg in
60545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	-c)
60645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	   mode=compile
60745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	   break
60845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	   ;;
60945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
61045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
61145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
61245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *db | *dbx | *strace | *truss)
61345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      mode=execute
61445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
61545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *install*|cp|mv)
61645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      mode=install
61745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
61845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *rm)
61945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      mode=uninstall
62045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
62145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *)
62245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # If we have no mode, but dlfiles were specified, then do execute mode.
62345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      test -n "$execute_dlfiles" && mode=execute
62445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
62545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Just use the default operation mode.
62645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -z "$mode"; then
62745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$nonopt"; then
62845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
62945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
63045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
63145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
63245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
63345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
63445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    esac
63545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  fi
63645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
63745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # Only execute mode is allowed to have -dlopen flags.
63845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if test -n "$execute_dlfiles" && test "$mode" != execute; then
63945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
64045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "$help" 1>&2
64145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    exit $EXIT_FAILURE
64245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  fi
64345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
64445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # Change the help message to a mode-specific one.
64545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  generic_help="$help"
64645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  help="Try \`$modename --help --mode=$mode' for more information."
64745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
64845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # These modes are in order of execution frequency so that they run quickly.
64945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  case $mode in
65045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # libtool compile mode
65145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  compile)
65245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    modename="$modename: compile"
65345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Get the compilation command and the source file.
65445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    base_compile=
65545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
65645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    suppress_opt=yes
65745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    suppress_output=
65845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    arg_mode=normal
65945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    libobj=
66045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    later=
66145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
66245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    for arg
66345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    do
66445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $arg_mode in
66545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      arg  )
66645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# do not "continue".  Instead, add this to base_compile
66745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	lastarg="$arg"
66845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	arg_mode=normal
66945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
67045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
67145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      target )
67245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	libobj="$arg"
67345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	arg_mode=normal
67445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
67545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
67645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
67745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      normal )
67845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Accept any command-line options.
67945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $arg in
68045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	-o)
68145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$libobj" ; then
68245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
68345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    exit $EXIT_FAILURE
68445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
68545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  arg_mode=target
68645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
68745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
68845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
68945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	-static | -prefer-pic | -prefer-non-pic)
69045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  later="$later $arg"
69145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
69245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
69345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
69445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	-no-suppress)
69545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  suppress_opt=no
69645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
69745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
69845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
69945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	-Xcompiler)
70045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
70145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue      #  The current "srcfile" will either be retained or
70245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;            #  replaced later.  I would guess that would be a bug.
70345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
70445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	-Wc,*)
70545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
70645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  lastarg=
70745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  save_ifs="$IFS"; IFS=','
70845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 	  for arg in $args; do
70945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    IFS="$save_ifs"
71045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
71145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Double-quote args containing other shell metacharacters.
71245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Many Bourne shells cannot handle close brackets correctly
71345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # in scan sets, so we specify it separately.
71445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case $arg in
71545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
71645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      arg="\"$arg\""
71745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      ;;
71845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac
71945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    lastarg="$lastarg $arg"
72045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
72145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  IFS="$save_ifs"
72245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
72345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
72445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Add the arguments to base_compile.
72545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  base_compile="$base_compile $lastarg"
72645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
72745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
72845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
72945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	* )
73045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Accept the current argument as the source file.
73145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # The previous "srcfile" becomes the current argument.
73245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  #
73345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  lastarg="$srcfile"
73445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  srcfile="$arg"
73545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
73645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac  #  case $arg
73745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
73845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac    #  case $arg_mode
73945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
74045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Aesthetically quote the previous argument.
74145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
74245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
74345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $lastarg in
74445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Double-quote args containing other shell metacharacters.
74545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Many Bourne shells cannot handle close brackets correctly
74645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # in scan sets, and some SunOS ksh mistreat backslash-escaping
74745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # in scan sets (worked around with variable expansion),
74845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
74945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # at all, so we specify them separately.
75045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
75145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	lastarg="\"$lastarg\""
75245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
75345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
75445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
75545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      base_compile="$base_compile $lastarg"
75645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    done # for arg
75745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
75845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    case $arg_mode in
75945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    arg)
76045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$modename: you must specify an argument for -Xcompile"
76145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit $EXIT_FAILURE
76245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
76345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    target)
76445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$modename: you must specify a target with \`-o'" 1>&2
76545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit $EXIT_FAILURE
76645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
76745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *)
76845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Get the name of the library object.
76945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
77045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
77145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    esac
77245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
77345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Recognize several different file suffixes.
77445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # If the user specifies -o file.o, it is replaced with file.lo
77545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    xform='[cCFSifmso]'
77645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    case $libobj in
77745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *.ada) xform=ada ;;
77845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *.adb) xform=adb ;;
77945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *.ads) xform=ads ;;
78045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *.asm) xform=asm ;;
78145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *.c++) xform=c++ ;;
78245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *.cc) xform=cc ;;
78345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *.ii) xform=ii ;;
78445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *.class) xform=class ;;
78545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *.cpp) xform=cpp ;;
78645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *.cxx) xform=cxx ;;
78745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *.f90) xform=f90 ;;
78845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *.for) xform=for ;;
78945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *.java) xform=java ;;
79045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    esac
79145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
79245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
79345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
79445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    case $libobj in
79545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
79645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *)
79745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
79845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit $EXIT_FAILURE
79945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
80045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    esac
80145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
80245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    func_infer_tag $base_compile
80345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
80445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    for arg in $later; do
80545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $arg in
80645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -static)
80745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	build_old_libs=yes
80845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
80945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
81045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
81145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -prefer-pic)
81245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	pic_mode=yes
81345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
81445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
81545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
81645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -prefer-non-pic)
81745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	pic_mode=no
81845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
81945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
82045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
82145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    done
82245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
82345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
82445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    case $qlibobj in
82545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
82645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	qlibobj="\"$qlibobj\"" ;;
82745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    esac
82845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    test "X$libobj" != "X$qlibobj" \
82945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
83045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
83145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
83245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
83345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test "X$xdir" = "X$obj"; then
83445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      xdir=
83545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    else
83645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      xdir=$xdir/
83745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
83845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    lobj=${xdir}$objdir/$objname
83945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
84045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -z "$base_compile"; then
84145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$modename: you must specify a compilation command" 1>&2
84245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$help" 1>&2
84345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit $EXIT_FAILURE
84445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
84545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
84645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Delete any leftover library objects.
84745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test "$build_old_libs" = yes; then
84845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      removelist="$obj $lobj $libobj ${libobj}T"
84945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    else
85045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      removelist="$lobj $libobj ${libobj}T"
85145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
85245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
85345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $run $rm $removelist
85445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
85545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
85645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # On Cygwin there's no "real" PIC flag so we must build both object types
85745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    case $host_os in
85845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    cygwin* | mingw* | pw32* | os2*)
85945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      pic_mode=default
86045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
86145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    esac
86245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
86345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # non-PIC code in shared libraries is not supported
86445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      pic_mode=default
86545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
86645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
86745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Calculate the filename of the output object if compiler does
86845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # not support -o with -c
86945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test "$compiler_c_o" = no; then
87045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
87145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      lockfile="$output_obj.lock"
87245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      removelist="$removelist $output_obj $lockfile"
87345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
87445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    else
87545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      output_obj=
87645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      need_locks=no
87745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      lockfile=
87845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
87945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
88045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Lock this critical section if it is needed
88145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # We use this script file to make the link, it avoids creating a new file
88245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test "$need_locks" = yes; then
88345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
88445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$show "Waiting for $lockfile to be removed"
88545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	sleep 2
88645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
88745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    elif test "$need_locks" = warn; then
88845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -f "$lockfile"; then
88945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "\
89045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org*** ERROR, $lockfile exists and contains:
89145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org`cat $lockfile 2>/dev/null`
89245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
89345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgThis indicates that another process is trying to use the same
89445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgtemporary object file, and libtool could not work around it because
89545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgyour compiler does not support \`-c' and \`-o' together.  If you
89645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgrepeat this compilation, it may succeed, by chance, but you had better
89745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgavoid parallel builds (make -j) in this platform, or get a better
89845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgcompiler."
89945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
90045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$run $rm $removelist
90145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit $EXIT_FAILURE
90245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
90345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$srcfile" > "$lockfile"
90445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
90545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
90645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -n "$fix_srcfile_path"; then
90745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      eval srcfile=\"$fix_srcfile_path\"
90845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
90945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
91045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    case $qsrcfile in
91145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
91245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      qsrcfile="\"$qsrcfile\"" ;;
91345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    esac
91445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
91545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $run $rm "$libobj" "${libobj}T"
91645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
91745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Create a libtool object file (analogous to a ".la" file),
91845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # but don't create it if we're doing a dry run.
91945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    test -z "$run" && cat > ${libobj}T <<EOF
92045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# $libobj - a libtool object file
92145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
92245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#
92345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Please DO NOT delete this file!
92445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# It is necessary for linking the library.
92545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
92645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Name of the PIC object.
92745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgEOF
92845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
92945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Only build a PIC object if we are building libtool libraries.
93045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test "$build_libtool_libs" = yes; then
93145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Without this assignment, base_compile gets emptied.
93245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fbsd_hideous_sh_bug=$base_compile
93345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
93445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$pic_mode" != no; then
93545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	command="$base_compile $qsrcfile $pic_flag"
93645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      else
93745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Don't build PIC code
93845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	command="$base_compile $qsrcfile"
93945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
94045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
94145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test ! -d "${xdir}$objdir"; then
94245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$show "$mkdir ${xdir}$objdir"
94345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$run $mkdir ${xdir}$objdir
94445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit_status=$?
94545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
94645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $exit_status
94745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
94845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
94945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
95045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -z "$output_obj"; then
95145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Place PIC objects in $objdir
95245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	command="$command -o $lobj"
95345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
95445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
95545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $run $rm "$lobj" "$output_obj"
95645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
95745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $show "$command"
95845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if $run eval "$command"; then :
95945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      else
96045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	test -n "$output_obj" && $run $rm $removelist
96145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit $EXIT_FAILURE
96245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
96345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
96445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$need_locks" = warn &&
96545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
96645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "\
96745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org*** ERROR, $lockfile contains:
96845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org`cat $lockfile 2>/dev/null`
96945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
97045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgbut it should contain:
97145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org$srcfile
97245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
97345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgThis indicates that another process is trying to use the same
97445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgtemporary object file, and libtool could not work around it because
97545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgyour compiler does not support \`-c' and \`-o' together.  If you
97645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgrepeat this compilation, it may succeed, by chance, but you had better
97745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgavoid parallel builds (make -j) in this platform, or get a better
97845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgcompiler."
97945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
98045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$run $rm $removelist
98145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit $EXIT_FAILURE
98245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
98345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
98445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Just move the object if needed, then go on to compile the next one
98545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
98645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$show "$mv $output_obj $lobj"
98745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if $run $mv $output_obj $lobj; then :
98845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
98945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  error=$?
99045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $run $rm $removelist
99145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $error
99245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
99345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
99445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
99545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Append the name of the PIC object to the libtool object file.
99645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      test -z "$run" && cat >> ${libobj}T <<EOF
99745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgpic_object='$objdir/$objname'
99845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
99945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgEOF
100045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
100145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Allow error messages only from the first compilation.
100245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$suppress_opt" = yes; then
100345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        suppress_output=' >/dev/null 2>&1'
100445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
100545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    else
100645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # No PIC object so indicate it doesn't exist in the libtool
100745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # object file.
100845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      test -z "$run" && cat >> ${libobj}T <<EOF
100945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgpic_object=none
101045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
101145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgEOF
101245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
101345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
101445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Only build a position-dependent object if we build old libraries.
101545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test "$build_old_libs" = yes; then
101645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$pic_mode" != yes; then
101745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Don't build PIC code
101845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	command="$base_compile $qsrcfile"
101945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      else
102045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	command="$base_compile $qsrcfile $pic_flag"
102145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
102245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$compiler_c_o" = yes; then
102345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	command="$command -o $obj"
102445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
102545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
102645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Suppress compiler output if we already did a PIC compilation.
102745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      command="$command$suppress_output"
102845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $run $rm "$obj" "$output_obj"
102945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $show "$command"
103045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if $run eval "$command"; then :
103145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      else
103245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$run $rm $removelist
103345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit $EXIT_FAILURE
103445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
103545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
103645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$need_locks" = warn &&
103745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
103845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "\
103945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org*** ERROR, $lockfile contains:
104045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org`cat $lockfile 2>/dev/null`
104145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
104245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgbut it should contain:
104345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org$srcfile
104445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
104545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgThis indicates that another process is trying to use the same
104645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgtemporary object file, and libtool could not work around it because
104745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgyour compiler does not support \`-c' and \`-o' together.  If you
104845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgrepeat this compilation, it may succeed, by chance, but you had better
104945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgavoid parallel builds (make -j) in this platform, or get a better
105045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgcompiler."
105145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
105245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$run $rm $removelist
105345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit $EXIT_FAILURE
105445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
105545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
105645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Just move the object if needed
105745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
105845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$show "$mv $output_obj $obj"
105945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if $run $mv $output_obj $obj; then :
106045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
106145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  error=$?
106245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $run $rm $removelist
106345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $error
106445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
106545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
106645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
106745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Append the name of the non-PIC object the libtool object file.
106845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Only append if the libtool object file exists.
106945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      test -z "$run" && cat >> ${libobj}T <<EOF
107045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Name of the non-PIC object.
107145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgnon_pic_object='$objname'
107245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
107345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgEOF
107445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    else
107545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Append the name of the non-PIC object the libtool object file.
107645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Only append if the libtool object file exists.
107745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      test -z "$run" && cat >> ${libobj}T <<EOF
107845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Name of the non-PIC object.
107945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgnon_pic_object=none
108045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
108145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgEOF
108245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
108345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
108445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $run $mv "${libobj}T" "${libobj}"
108545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
108645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Unlock the critical section if it was locked
108745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test "$need_locks" != no; then
108845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $run $rm "$lockfile"
108945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
109045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
109145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    exit $EXIT_SUCCESS
109245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
109345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
109445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # libtool link mode
109545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  link | relink)
109645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    modename="$modename: link"
109745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    case $host in
109845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
109945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # It is impossible to link a dll without this setting, and
110045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # we shouldn't force the makefile maintainer to figure out
110145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # which system we are compiling for in order to pass an extra
110245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # flag for every libtool invocation.
110345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # allow_undefined=no
110445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
110545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # FIXME: Unfortunately, there are problems with the above when trying
110645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # to make a dll which has undefined symbols, in which case not
110745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # even a static library is built.  For now, we need to specify
110845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # -no-undefined on the libtool link line when we can be certain
110945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # that all symbols are satisfied, otherwise we get a static library.
111045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      allow_undefined=yes
111145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
111245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *)
111345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      allow_undefined=yes
111445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
111545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    esac
111645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    libtool_args="$nonopt"
111745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    base_compile="$nonopt $@"
111845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    compile_command="$nonopt"
111945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    finalize_command="$nonopt"
112045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
112145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    compile_rpath=
112245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    finalize_rpath=
112345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    compile_shlibpath=
112445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    finalize_shlibpath=
112545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    convenience=
112645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    old_convenience=
112745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    deplibs=
112845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    old_deplibs=
112945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    compiler_flags=
113045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    linker_flags=
113145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    dllsearchpath=
113245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    lib_search_path=`pwd`
113345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    inst_prefix_dir=
113445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
113545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    avoid_version=no
113645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    dlfiles=
113745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    dlprefiles=
113845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    dlself=no
113945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    export_dynamic=no
114045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    export_symbols=
114145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    export_symbols_regex=
114245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    generated=
114345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    libobjs=
114445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ltlibs=
114545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    module=no
114645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    no_install=no
114745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    objs=
114845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    non_pic_objects=
114945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    notinst_path= # paths that contain not-installed libtool libraries
115045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    precious_files_regex=
115145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    prefer_static_libs=no
115245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    preload=no
115345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    prev=
115445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    prevarg=
115545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    release=
115645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    rpath=
115745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    xrpath=
115845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    perm_rpath=
115945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    temp_rpath=
116045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    thread_safe=no
116145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    vinfo=
116245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    vinfo_number=no
116345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
116445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    func_infer_tag $base_compile
116545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
116645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # We need to know -static, to get the right output filenames.
116745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    for arg
116845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    do
116945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $arg in
117045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -all-static | -static)
117145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "X$arg" = "X-all-static"; then
117245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
117345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
117445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
117545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$link_static_flag"; then
117645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    dlopen_self=$dlopen_self_static
117745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
117845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prefer_static_libs=yes
117945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
118045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
118145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    dlopen_self=$dlopen_self_static
118245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
118345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prefer_static_libs=built
118445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
118545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	build_libtool_libs=no
118645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	build_old_libs=yes
118745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	break
118845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
118945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
119045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    done
119145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
119245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # See if our shared archives depend on static archives.
119345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
119445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
119545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Go through the arguments, transforming them on the way.
119645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    while test "$#" -gt 0; do
119745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      arg="$1"
119845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      shift
119945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $arg in
120045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
120145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
120245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
120345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *) qarg=$arg ;;
120445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
120545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      libtool_args="$libtool_args $qarg"
120645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
120745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # If the previous option needs an argument, assign it.
120845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$prev"; then
120945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $prev in
121045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	output)
121145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  compile_command="$compile_command @OUTPUT@"
121245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  finalize_command="$finalize_command @OUTPUT@"
121345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
121445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
121545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
121645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $prev in
121745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	dlfiles|dlprefiles)
121845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$preload" = no; then
121945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Add the symbol object into the linking commands.
122045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    compile_command="$compile_command @SYMFILE@"
122145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    finalize_command="$finalize_command @SYMFILE@"
122245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    preload=yes
122345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
122445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $arg in
122545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *.la | *.lo) ;;  # We handle these cases below.
122645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  force)
122745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$dlself" = no; then
122845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      dlself=needless
122945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      export_dynamic=yes
123045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
123145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    prev=
123245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    continue
123345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
123445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  self)
123545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$prev" = dlprefiles; then
123645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      dlself=yes
123745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
123845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      dlself=yes
123945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
124045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      dlself=needless
124145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      export_dynamic=yes
124245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
124345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    prev=
124445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    continue
124545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
124645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *)
124745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$prev" = dlfiles; then
124845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      dlfiles="$dlfiles $arg"
124945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
125045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      dlprefiles="$dlprefiles $arg"
125145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
125245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    prev=
125345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    continue
125445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
125545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
125645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
125745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	expsyms)
125845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  export_symbols="$arg"
125945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test ! -f "$arg"; then
126045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: symbol file \`$arg' does not exist"
126145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    exit $EXIT_FAILURE
126245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
126345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prev=
126445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
126545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
126645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	expsyms_regex)
126745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  export_symbols_regex="$arg"
126845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prev=
126945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
127045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
127145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	inst_prefix)
127245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  inst_prefix_dir="$arg"
127345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prev=
127445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
127545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
127645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	precious_regex)
127745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  precious_files_regex="$arg"
127845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prev=
127945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
128045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
128145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	release)
128245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  release="-$arg"
128345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prev=
128445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
128545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
128645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	objectlist)
128745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -f "$arg"; then
128845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    save_arg=$arg
128945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    moreargs=
129045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for fil in `cat $save_arg`
129145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    do
129245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#	      moreargs="$moreargs $fil"
129345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      arg=$fil
129445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # A libtool-controlled object.
129545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
129645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # Check to see that this really is a libtool object.
129745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
129845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		pic_object=
129945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		non_pic_object=
130045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
130145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		# Read the .lo file
130245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		# If there is no directory component, then add one.
130345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		case $arg in
130445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*/* | *\\*) . $arg ;;
130545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*) . ./$arg ;;
130645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		esac
130745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
130845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if test -z "$pic_object" || \
130945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		   test -z "$non_pic_object" ||
131045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		   test "$pic_object" = none && \
131145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		   test "$non_pic_object" = none; then
131245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
131345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  exit $EXIT_FAILURE
131445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi
131545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
131645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		# Extract subdirectory from the argument.
131745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
131845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if test "X$xdir" = "X$arg"; then
131945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  xdir=
132045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		else
132145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  xdir="$xdir/"
132245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi
132345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
132445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if test "$pic_object" != none; then
132545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  # Prepend the subdirectory the object is found in.
132645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  pic_object="$xdir$pic_object"
132745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
132845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  if test "$prev" = dlfiles; then
132945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
133045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      dlfiles="$dlfiles $pic_object"
133145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      prev=
133245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      continue
133345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    else
133445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      # If libtool objects are unsupported, then we need to preload.
133545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      prev=dlprefiles
133645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    fi
133745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  fi
133845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
133945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  # CHECK ME:  I think I busted this.  -Ossama
134045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  if test "$prev" = dlprefiles; then
134145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    # Preload the old-style object.
134245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    dlprefiles="$dlprefiles $pic_object"
134345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    prev=
134445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  fi
134545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
134645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  # A PIC object.
134745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  libobjs="$libobjs $pic_object"
134845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  arg="$pic_object"
134945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi
135045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
135145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		# Non-PIC object.
135245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if test "$non_pic_object" != none; then
135345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  # Prepend the subdirectory the object is found in.
135445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  non_pic_object="$xdir$non_pic_object"
135545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
135645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  # A standard non-PIC object
135745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  non_pic_objects="$non_pic_objects $non_pic_object"
135845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  if test -z "$pic_object" || test "$pic_object" = none ; then
135945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    arg="$non_pic_object"
136045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  fi
136145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		else
136245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  # If the PIC object exists, use it instead.
136345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  # $xdir was prepended to $pic_object above.
136445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  non_pic_object="$pic_object"
136545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  non_pic_objects="$non_pic_objects $non_pic_object"
136645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi
136745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      else
136845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		# Only an error if not doing a dry-run.
136945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if test -z "$run"; then
137045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
137145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  exit $EXIT_FAILURE
137245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		else
137345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  # Dry-run case.
137445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
137545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  # Extract subdirectory from the argument.
137645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
137745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  if test "X$xdir" = "X$arg"; then
137845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    xdir=
137945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  else
138045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    xdir="$xdir/"
138145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  fi
138245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
138345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
138445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
138545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  libobjs="$libobjs $pic_object"
138645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  non_pic_objects="$non_pic_objects $non_pic_object"
138745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi
138845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
138945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done
139045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
139145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: link input file \`$save_arg' does not exist"
139245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    exit $EXIT_FAILURE
139345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
139445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  arg=$save_arg
139545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prev=
139645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
139745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
139845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	rpath | xrpath)
139945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # We need an absolute path.
140045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $arg in
140145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  [\\/]* | [A-Za-z]:[\\/]*) ;;
140245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *)
140345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: only absolute run-paths are allowed" 1>&2
140445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    exit $EXIT_FAILURE
140545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
140645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
140745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$prev" = rpath; then
140845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case "$rpath " in
140945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *" $arg "*) ;;
141045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *) rpath="$rpath $arg" ;;
141145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac
141245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
141345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case "$xrpath " in
141445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *" $arg "*) ;;
141545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *) xrpath="$xrpath $arg" ;;
141645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac
141745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
141845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prev=
141945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
142045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
142145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	xcompiler)
142245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  compiler_flags="$compiler_flags $qarg"
142345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prev=
142445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  compile_command="$compile_command $qarg"
142545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  finalize_command="$finalize_command $qarg"
142645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
142745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
142845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	xlinker)
142945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  linker_flags="$linker_flags $qarg"
143045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  compiler_flags="$compiler_flags $wl$qarg"
143145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prev=
143245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  compile_command="$compile_command $wl$qarg"
143345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  finalize_command="$finalize_command $wl$qarg"
143445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
143545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
143645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	xcclinker)
143745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  linker_flags="$linker_flags $qarg"
143845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  compiler_flags="$compiler_flags $qarg"
143945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prev=
144045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  compile_command="$compile_command $qarg"
144145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  finalize_command="$finalize_command $qarg"
144245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
144345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
144445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	shrext)
144545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  	  shrext_cmds="$arg"
144645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prev=
144745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
144845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
144945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	darwin_framework|darwin_framework_skip)
145045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
145145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  compile_command="$compile_command $arg"
145245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  finalize_command="$finalize_command $arg"
145345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prev=
145445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
145545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
145645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*)
145745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  eval "$prev=\"\$arg\""
145845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prev=
145945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
146045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
146145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
146245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi # test -n "$prev"
146345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
146445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      prevarg="$arg"
146545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
146645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $arg in
146745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -all-static)
146845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$link_static_flag"; then
146945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  compile_command="$compile_command $link_static_flag"
147045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  finalize_command="$finalize_command $link_static_flag"
147145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
147245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
147345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
147445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
147545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -allow-undefined)
147645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# FIXME: remove this flag sometime in the future.
147745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
147845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
147945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
148045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
148145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -avoid-version)
148245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	avoid_version=yes
148345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
148445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
148545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
148645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -dlopen)
148745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	prev=dlfiles
148845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
148945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
149045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
149145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -dlpreopen)
149245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	prev=dlprefiles
149345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
149445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
149545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
149645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -export-dynamic)
149745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	export_dynamic=yes
149845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
149945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
150045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
150145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -export-symbols | -export-symbols-regex)
150245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
150345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: more than one -exported-symbols argument is not allowed"
150445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
150545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
150645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "X$arg" = "X-export-symbols"; then
150745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prev=expsyms
150845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
150945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prev=expsyms_regex
151045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
151145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
151245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
151345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
151445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -framework|-arch|-isysroot)
151545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case " $CC " in
151645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
151745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		prev=darwin_framework_skip ;;
151845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *) compiler_flags="$compiler_flags $arg"
151945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	     prev=darwin_framework ;;
152045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
152145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	compile_command="$compile_command $arg"
152245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	finalize_command="$finalize_command $arg"
152345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
152445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
152545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
152645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -inst-prefix-dir)
152745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	prev=inst_prefix
152845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
152945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
153045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
153145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
153245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # so, if we see these flags be careful not to treat them like -L
153345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -L[A-Z][A-Z]*:*)
153445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $with_gcc/$host in
153545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	no/*-*-irix* | /*-*-irix*)
153645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  compile_command="$compile_command $arg"
153745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  finalize_command="$finalize_command $arg"
153845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
153945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
154045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
154145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
154245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
154345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -L*)
154445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
154545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# We need an absolute path.
154645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $dir in
154745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	[\\/]* | [A-Za-z]:[\\/]*) ;;
154845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*)
154945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  absdir=`cd "$dir" && pwd`
155045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -z "$absdir"; then
155145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
155245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    absdir="$dir"
155345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    notinst_path="$notinst_path $dir"
155445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
155545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  dir="$absdir"
155645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
155745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
155845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case "$deplibs " in
155945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*" -L$dir "*) ;;
156045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*)
156145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  deplibs="$deplibs -L$dir"
156245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  lib_search_path="$lib_search_path $dir"
156345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
156445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
156545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $host in
156645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
156745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
156845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case :$dllsearchpath: in
156945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *":$dir:"*) ;;
157045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *) dllsearchpath="$dllsearchpath:$dir";;
157145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
157245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case :$dllsearchpath: in
157345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *":$testbindir:"*) ;;
157445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *) dllsearchpath="$dllsearchpath:$testbindir";;
157545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
157645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
157745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
157845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
157945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
158045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
158145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -l*)
158245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
158345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $host in
158445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
158545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # These systems don't actually have a C or math library (as such)
158645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    continue
158745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
158845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *-*-os2*)
158945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # These systems don't actually have a C library (as such)
159045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    test "X$arg" = "X-lc" && continue
159145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
159245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
159345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Do not include libc due to us having libc/libc_r.
159445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    test "X$arg" = "X-lc" && continue
159545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
159645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *-*-rhapsody* | *-*-darwin1.[012])
159745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Rhapsody C and math libraries are in the System framework
159845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    deplibs="$deplibs -framework System"
159945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    continue
160045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
160145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *-*-sco3.2v5* | *-*-sco5v6*)
160245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Causes problems with __ctype
160345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    test "X$arg" = "X-lc" && continue
160445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
160545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
160645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Compiler inserts libc in the correct place for threads to work
160745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    test "X$arg" = "X-lc" && continue
160845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
160945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
161045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	elif test "X$arg" = "X-lc_r"; then
161145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	 case $host in
161245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
161345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	   # Do not include libc_r directly, use -pthread flag.
161445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	   continue
161545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	   ;;
161645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	 esac
161745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
161845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	deplibs="$deplibs $arg"
161945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
162045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
162145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
162245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Tru64 UNIX uses -model [arg] to determine the layout of C++
162345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # classes, name mangling, and exception handling.
162445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -model)
162545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	compile_command="$compile_command $arg"
162645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	compiler_flags="$compiler_flags $arg"
162745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	finalize_command="$finalize_command $arg"
162845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	prev=xcompiler
162945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
163045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
163145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
163245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
163345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	compiler_flags="$compiler_flags $arg"
163445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	compile_command="$compile_command $arg"
163545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	finalize_command="$finalize_command $arg"
163645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	deplibs="$deplibs $arg"
163745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
163845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
163945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
164045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -module)
164145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	module=yes
164245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
164345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
164445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
164545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
164645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # -r[0-9][0-9]* specifies the processor on the SGI compiler
164745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
164845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # +DA*, +DD* enable 64-bit mode on the HP compiler
164945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # -q* pass through compiler args for the IBM compiler
165045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # -m* pass through architecture-specific compiler args for GCC
165145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # -m*, -t[45]*, -txscale* pass through architecture-specific
165245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # compiler args for GCC
165345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # -pg pass through profiling flag for GCC
165445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # @file GCC response files
165545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
165645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -t[45]*|-txscale*|@*)
165745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
165845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Unknown arguments in both finalize_command and compile_command need
165945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# to be aesthetically quoted because they are evaled later.
166045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
166145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $arg in
166245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
166345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  arg="\"$arg\""
166445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
166545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
166645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        compile_command="$compile_command $arg"
166745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        finalize_command="$finalize_command $arg"
166845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        compiler_flags="$compiler_flags $arg"
166945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        continue
167045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        ;;
167145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
167245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -shrext)
167345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	prev=shrext
167445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
167545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
167645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
167745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -no-fast-install)
167845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fast_install=no
167945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
168045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
168145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
168245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -no-install)
168345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $host in
168445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
168545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # The PATH hackery in wrapper scripts is required on Windows
168645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # in order for the loader to find any dlls it needs.
168745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
168845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
168945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fast_install=no
169045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
169145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*) no_install=yes ;;
169245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
169345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
169445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
169545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
169645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -no-undefined)
169745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	allow_undefined=no
169845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
169945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
170045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
170145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -objectlist)
170245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	prev=objectlist
170345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
170445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
170545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
170645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -o) prev=output ;;
170745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
170845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -precious-files-regex)
170945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	prev=precious_regex
171045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
171145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
171245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
171345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -release)
171445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	prev=release
171545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
171645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
171745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
171845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -rpath)
171945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	prev=rpath
172045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
172145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
172245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
172345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -R)
172445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	prev=xrpath
172545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
172645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
172745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
172845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -R*)
172945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
173045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# We need an absolute path.
173145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $dir in
173245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	[\\/]* | [A-Za-z]:[\\/]*) ;;
173345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*)
173445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: only absolute run-paths are allowed" 1>&2
173545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
173645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
173745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
173845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case "$xrpath " in
173945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*" $dir "*) ;;
174045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*) xrpath="$xrpath $dir" ;;
174145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
174245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
174345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
174445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
174545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -static)
174645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# The effects of -static are defined in a previous loop.
174745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# We used to do the same as -all-static on platforms that
174845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# didn't have a PIC flag, but the assumption that the effects
174945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# would be equivalent was wrong.  It would break on at least
175045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Digital Unix and AIX.
175145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
175245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
175345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
175445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -thread-safe)
175545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	thread_safe=yes
175645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
175745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
175845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
175945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -version-info)
176045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	prev=vinfo
176145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
176245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
176345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -version-number)
176445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	prev=vinfo
176545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	vinfo_number=yes
176645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
176745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
176845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
176945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -Wc,*)
177045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
177145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	arg=
177245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	save_ifs="$IFS"; IFS=','
177345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	for flag in $args; do
177445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  IFS="$save_ifs"
177545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $flag in
177645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
177745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    flag="\"$flag\""
177845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
177945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
178045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  arg="$arg $wl$flag"
178145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  compiler_flags="$compiler_flags $flag"
178245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	done
178345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	IFS="$save_ifs"
178445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
178545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
178645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
178745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -Wl,*)
178845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
178945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	arg=
179045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	save_ifs="$IFS"; IFS=','
179145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	for flag in $args; do
179245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  IFS="$save_ifs"
179345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $flag in
179445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
179545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    flag="\"$flag\""
179645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
179745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
179845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  arg="$arg $wl$flag"
179945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  compiler_flags="$compiler_flags $wl$flag"
180045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  linker_flags="$linker_flags $flag"
180145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	done
180245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	IFS="$save_ifs"
180345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
180445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
180545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
180645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -Xcompiler)
180745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	prev=xcompiler
180845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
180945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
181045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
181145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -Xlinker)
181245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	prev=xlinker
181345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
181445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
181545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
181645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -XCClinker)
181745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	prev=xcclinker
181845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
181945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
182045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
182145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Some other compiler flag.
182245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -* | +*)
182345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Unknown arguments in both finalize_command and compile_command need
182445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# to be aesthetically quoted because they are evaled later.
182545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
182645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $arg in
182745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
182845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  arg="\"$arg\""
182945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
183045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
183145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
183245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
183345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *.$objext)
183445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# A standard object.
183545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	objs="$objs $arg"
183645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
183745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
183845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *.lo)
183945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# A libtool-controlled object.
184045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
184145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Check to see that this really is a libtool object.
184245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
184345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  pic_object=
184445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  non_pic_object=
184545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
184645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Read the .lo file
184745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # If there is no directory component, then add one.
184845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $arg in
184945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  */* | *\\*) . $arg ;;
185045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *) . ./$arg ;;
185145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
185245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
185345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -z "$pic_object" || \
185445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	     test -z "$non_pic_object" ||
185545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	     test "$pic_object" = none && \
185645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	     test "$non_pic_object" = none; then
185745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
185845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    exit $EXIT_FAILURE
185945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
186045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
186145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Extract subdirectory from the argument.
186245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
186345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "X$xdir" = "X$arg"; then
186445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    xdir=
186545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 	  else
186645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    xdir="$xdir/"
186745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
186845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
186945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$pic_object" != none; then
187045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Prepend the subdirectory the object is found in.
187145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    pic_object="$xdir$pic_object"
187245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
187345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$prev" = dlfiles; then
187445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
187545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		dlfiles="$dlfiles $pic_object"
187645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		prev=
187745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		continue
187845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      else
187945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		# If libtool objects are unsupported, then we need to preload.
188045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		prev=dlprefiles
188145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
188245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
188345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
188445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # CHECK ME:  I think I busted this.  -Ossama
188545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$prev" = dlprefiles; then
188645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # Preload the old-style object.
188745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      dlprefiles="$dlprefiles $pic_object"
188845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      prev=
188945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
189045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
189145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # A PIC object.
189245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    libobjs="$libobjs $pic_object"
189345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    arg="$pic_object"
189445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
189545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
189645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Non-PIC object.
189745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$non_pic_object" != none; then
189845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Prepend the subdirectory the object is found in.
189945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    non_pic_object="$xdir$non_pic_object"
190045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
190145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # A standard non-PIC object
190245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    non_pic_objects="$non_pic_objects $non_pic_object"
190345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -z "$pic_object" || test "$pic_object" = none ; then
190445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      arg="$non_pic_object"
190545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
190645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
190745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # If the PIC object exists, use it instead.
190845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # $xdir was prepended to $pic_object above.
190945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    non_pic_object="$pic_object"
191045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    non_pic_objects="$non_pic_objects $non_pic_object"
191145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
191245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
191345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Only an error if not doing a dry-run.
191445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -z "$run"; then
191545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
191645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    exit $EXIT_FAILURE
191745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
191845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Dry-run case.
191945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
192045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Extract subdirectory from the argument.
192145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
192245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "X$xdir" = "X$arg"; then
192345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      xdir=
192445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
192545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      xdir="$xdir/"
192645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
192745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
192845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
192945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
193045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    libobjs="$libobjs $pic_object"
193145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    non_pic_objects="$non_pic_objects $non_pic_object"
193245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
193345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
193445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
193545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
193645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *.$libext)
193745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# An archive.
193845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	deplibs="$deplibs $arg"
193945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	old_deplibs="$old_deplibs $arg"
194045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
194145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
194245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
194345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *.la)
194445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# A libtool-controlled library.
194545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
194645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$prev" = dlfiles; then
194745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # This library was specified with -dlopen.
194845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  dlfiles="$dlfiles $arg"
194945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prev=
195045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	elif test "$prev" = dlprefiles; then
195145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # The library was specified with -dlpreopen.
195245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  dlprefiles="$dlprefiles $arg"
195345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prev=
195445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
195545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  deplibs="$deplibs $arg"
195645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
195745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
195845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
195945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
196045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Some other compiler argument.
196145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *)
196245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Unknown arguments in both finalize_command and compile_command need
196345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# to be aesthetically quoted because they are evaled later.
196445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
196545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $arg in
196645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
196745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  arg="\"$arg\""
196845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
196945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
197045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
197145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac # arg
197245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
197345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Now actually substitute the argument into the commands.
197445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$arg"; then
197545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	compile_command="$compile_command $arg"
197645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	finalize_command="$finalize_command $arg"
197745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
197845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    done # argument parsing loop
197945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
198045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -n "$prev"; then
198145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
198245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$help" 1>&2
198345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit $EXIT_FAILURE
198445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
198545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
198645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
198745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      eval arg=\"$export_dynamic_flag_spec\"
198845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      compile_command="$compile_command $arg"
198945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      finalize_command="$finalize_command $arg"
199045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
199145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
199245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    oldlibs=
199345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # calculate the name of the file, without its directory
199445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
199545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    libobjs_save="$libobjs"
199645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
199745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -n "$shlibpath_var"; then
199845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # get the directories listed in $shlibpath_var
199945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
200045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    else
200145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      shlib_search_path=
200245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
200345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
200445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
200545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
200645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
200745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test "X$output_objdir" = "X$output"; then
200845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      output_objdir="$objdir"
200945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    else
201045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      output_objdir="$output_objdir/$objdir"
201145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
201245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Create the object directory.
201345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test ! -d "$output_objdir"; then
201445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $show "$mkdir $output_objdir"
201545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $run $mkdir $output_objdir
201645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit_status=$?
201745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
201845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit $exit_status
201945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
202045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
202145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
202245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Determine the type of output
202345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    case $output in
202445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    "")
202545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$modename: you must specify an output file" 1>&2
202645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$help" 1>&2
202745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit $EXIT_FAILURE
202845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
202945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *.$libext) linkmode=oldlib ;;
203045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *.lo | *.$objext) linkmode=obj ;;
203145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *.la) linkmode=lib ;;
203245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *) linkmode=prog ;; # Anything else should be a program.
203345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    esac
203445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
203545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    case $host in
203645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *cygwin* | *mingw* | *pw32*)
203745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # don't eliminate duplications in $postdeps and $predeps
203845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      duplicate_compiler_generated_deps=yes
203945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
204045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *)
204145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      duplicate_compiler_generated_deps=$duplicate_deps
204245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
204345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    esac
204445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    specialdeplibs=
204545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
204645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    libs=
204745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Find all interdependent deplibs by searching for libraries
204845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # that are linked more than once (e.g. -la -lb -la)
204945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    for deplib in $deplibs; do
205045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "X$duplicate_deps" = "Xyes" ; then
205145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case "$libs " in
205245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
205345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
205445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
205545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      libs="$libs $deplib"
205645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    done
205745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
205845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test "$linkmode" = lib; then
205945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      libs="$predeps $libs $compiler_lib_search_path $postdeps"
206045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
206145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Compute libraries that are listed more than once in $predeps
206245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # $postdeps and mark them as special (i.e., whose duplicates are
206345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # not to be eliminated).
206445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      pre_post_deps=
206545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
206645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	for pre_post_dep in $predeps $postdeps; do
206745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case "$pre_post_deps " in
206845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
206945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
207045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  pre_post_deps="$pre_post_deps $pre_post_dep"
207145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	done
207245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
207345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      pre_post_deps=
207445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
207545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
207645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    deplibs=
207745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    newdependency_libs=
207845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    newlib_search_path=
207945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    need_relink=no # whether we're linking any uninstalled libtool libraries
208045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    notinst_deplibs= # not-installed libtool libraries
208145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    case $linkmode in
208245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    lib)
208345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	passes="conv link"
208445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	for file in $dlfiles $dlprefiles; do
208545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $file in
208645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *.la) ;;
208745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *)
208845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
208945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    exit $EXIT_FAILURE
209045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
209145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
209245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	done
209345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
209445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    prog)
209545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	compile_deplibs=
209645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	finalize_deplibs=
209745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	alldeplibs=no
209845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	newdlfiles=
209945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	newdlprefiles=
210045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	passes="conv scan dlopen dlpreopen link"
210145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
210245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *)  passes="conv"
210345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
210445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    esac
210545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    for pass in $passes; do
210645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$linkmode,$pass" = "lib,link" ||
210745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	 test "$linkmode,$pass" = "prog,scan"; then
210845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	libs="$deplibs"
210945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	deplibs=
211045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
211145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$linkmode" = prog; then
211245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $pass in
211345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	dlopen) libs="$dlfiles" ;;
211445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	dlpreopen) libs="$dlprefiles" ;;
211545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
211645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
211745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
211845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$pass" = dlopen; then
211945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Collect dlpreopened libraries
212045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	save_deplibs="$deplibs"
212145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	deplibs=
212245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
212345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for deplib in $libs; do
212445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	lib=
212545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	found=no
212645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $deplib in
212745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
212845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$linkmode,$pass" = "prog,link"; then
212945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    compile_deplibs="$deplib $compile_deplibs"
213045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    finalize_deplibs="$deplib $finalize_deplibs"
213145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
213245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    compiler_flags="$compiler_flags $deplib"
213345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
213445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
213545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $linkmode in
213645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  lib)
213745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    deplibs="$deplib $deplibs"
213845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    test "$pass" = conv && continue
213945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    newdependency_libs="$deplib $newdependency_libs"
214045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
214145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prog)
214245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$pass" = conv; then
214345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      deplibs="$deplib $deplibs"
214445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      continue
214545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
214645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$pass" = scan; then
214745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      deplibs="$deplib $deplibs"
214845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
214945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      compile_deplibs="$deplib $compile_deplibs"
215045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      finalize_deplibs="$deplib $finalize_deplibs"
215145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
215245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
215345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *)
215445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
215545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac # linkmode
215645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
215745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
215845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
215945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	-l*)
216045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$linkmode" != lib && test "$linkmode" != prog; then
216145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
216245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    continue
216345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
216445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
216545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
216645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for search_ext in .la $std_shrext .so .a; do
216745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # Search the libtool library
216845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      lib="$searchdir/lib${name}${search_ext}"
216945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test -f "$lib"; then
217045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if test "$search_ext" = ".la"; then
217145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  found=yes
217245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		else
217345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  found=no
217445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi
217545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		break 2
217645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
217745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done
217845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
217945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$found" != yes; then
218045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # deplib doesn't seem to be a libtool library
218145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$linkmode,$pass" = "prog,link"; then
218245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      compile_deplibs="$deplib $compile_deplibs"
218345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      finalize_deplibs="$deplib $finalize_deplibs"
218445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
218545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      deplibs="$deplib $deplibs"
218645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
218745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
218845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    continue
218945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else # deplib is a libtool library
219045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
219145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # We need to do some special things here, and not later.
219245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
219345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case " $predeps $postdeps " in
219445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *" $deplib "*)
219545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if (${SED} -e '2q' $lib |
219645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
219745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  library_names=
219845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  old_library=
219945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  case $lib in
220045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  */* | *\\*) . $lib ;;
220145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  *) . ./$lib ;;
220245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  esac
220345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  for l in $old_library $library_names; do
220445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    ll="$l"
220545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  done
220645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  if test "X$ll" = "X$old_library" ; then # only static version available
220745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    found=no
220845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
220945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    test "X$ladir" = "X$lib" && ladir="."
221045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    lib=$ladir/$old_library
221145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    if test "$linkmode,$pass" = "prog,link"; then
221245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      compile_deplibs="$deplib $compile_deplibs"
221345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      finalize_deplibs="$deplib $finalize_deplibs"
221445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    else
221545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      deplibs="$deplib $deplibs"
221645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
221745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    fi
221845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    continue
221945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  fi
222045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi
222145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	        ;;
222245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *) ;;
222345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
222445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
222545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
222645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;; # -l
222745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	-L*)
222845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $linkmode in
222945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  lib)
223045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    deplibs="$deplib $deplibs"
223145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    test "$pass" = conv && continue
223245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    newdependency_libs="$deplib $newdependency_libs"
223345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
223445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
223545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prog)
223645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$pass" = conv; then
223745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      deplibs="$deplib $deplibs"
223845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      continue
223945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
224045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$pass" = scan; then
224145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      deplibs="$deplib $deplibs"
224245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
224345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      compile_deplibs="$deplib $compile_deplibs"
224445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      finalize_deplibs="$deplib $finalize_deplibs"
224545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
224645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
224745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
224845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *)
224945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
225045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
225145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac # linkmode
225245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
225345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;; # -L
225445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	-R*)
225545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$pass" = link; then
225645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
225745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Make sure the xrpath contains only unique directories.
225845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case "$xrpath " in
225945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *" $dir "*) ;;
226045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *) xrpath="$xrpath $dir" ;;
226145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac
226245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
226345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  deplibs="$deplib $deplibs"
226445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
226545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
226645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*.la) lib="$deplib" ;;
226745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*.$libext)
226845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$pass" = conv; then
226945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    deplibs="$deplib $deplibs"
227045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    continue
227145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
227245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $linkmode in
227345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  lib)
227445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    valid_a_lib=no
227545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case $deplibs_check_method in
227645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      match_pattern*)
227745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		set dummy $deplibs_check_method
227845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
227945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if eval $echo \"$deplib\" 2>/dev/null \
228045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    | $SED 10q \
228145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    | $EGREP "$match_pattern_regex" > /dev/null; then
228245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  valid_a_lib=yes
228345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi
228445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		;;
228545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      pass_all)
228645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		valid_a_lib=yes
228745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		;;
228845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            esac
228945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$valid_a_lib" != yes; then
229045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo
229145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** Warning: Trying to link with static lib archive $deplib."
229245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** I have the capability to make that library automatically link in when"
229345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** you link to this library.  But I can only do this if you have a"
229445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** shared version of the library, which you do not appear to have"
229545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** because the file extensions .$libext of this argument makes me believe"
229645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** that it is just a static archive that I should not used here."
229745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
229845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo
229945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** Warning: Linking the shared library $output against the"
230045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** static library $deplib is not portable!"
230145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      deplibs="$deplib $deplibs"
230245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
230345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    continue
230445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
230545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prog)
230645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$pass" != link; then
230745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      deplibs="$deplib $deplibs"
230845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
230945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      compile_deplibs="$deplib $compile_deplibs"
231045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      finalize_deplibs="$deplib $finalize_deplibs"
231145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
231245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    continue
231345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
231445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac # linkmode
231545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;; # *.$libext
231645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*.lo | *.$objext)
231745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$pass" = conv; then
231845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    deplibs="$deplib $deplibs"
231945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  elif test "$linkmode" = prog; then
232045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
232145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # If there is no dlopen support or we're linking statically,
232245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # we need to preload.
232345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      newdlprefiles="$newdlprefiles $deplib"
232445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      compile_deplibs="$deplib $compile_deplibs"
232545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      finalize_deplibs="$deplib $finalize_deplibs"
232645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
232745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      newdlfiles="$newdlfiles $deplib"
232845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
232945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
233045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
233145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
233245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	%DEPLIBS%)
233345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  alldeplibs=yes
233445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
233545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
233645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac # case $deplib
233745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$found" = yes || test -f "$lib"; then :
233845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
233945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
234045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
234145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
234245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
234345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Check to see that this really is a libtool archive.
234445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
234545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
234645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
234745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
234845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
234945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
235045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
235145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	test "X$ladir" = "X$lib" && ladir="."
235245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
235345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	dlname=
235445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	dlopen=
235545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	dlpreopen=
235645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	libdir=
235745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	library_names=
235845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	old_library=
235945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# If the library was installed with an old release of libtool,
236045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# it will not redefine variables installed, or shouldnotlink
236145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	installed=yes
236245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	shouldnotlink=no
236345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	avoidtemprpath=
236445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
236545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
236645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Read the .la file
236745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $lib in
236845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*/* | *\\*) . $lib ;;
236945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*) . ./$lib ;;
237045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
237145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
237245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$linkmode,$pass" = "lib,link" ||
237345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	   test "$linkmode,$pass" = "prog,scan" ||
237445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
237545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
237645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
237745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
237845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
237945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$pass" = conv; then
238045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Only check for convenience libraries
238145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  deplibs="$lib $deplibs"
238245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -z "$libdir"; then
238345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -z "$old_library"; then
238445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
238545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      exit $EXIT_FAILURE
238645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
238745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # It is a libtool convenience library, so add in its objects.
238845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    convenience="$convenience $ladir/$objdir/$old_library"
238945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
239045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    tmp_libs=
239145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for deplib in $dependency_libs; do
239245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      deplibs="$deplib $deplibs"
239345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org              if test "X$duplicate_deps" = "Xyes" ; then
239445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	        case "$tmp_libs " in
239545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
239645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	        esac
239745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org              fi
239845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      tmp_libs="$tmp_libs $deplib"
239945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done
240045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
240145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
240245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    exit $EXIT_FAILURE
240345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
240445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
240545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi # $pass = conv
240645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
240745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
240845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Get the name of the library we link against.
240945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	linklib=
241045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	for l in $old_library $library_names; do
241145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  linklib="$l"
241245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	done
241345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -z "$linklib"; then
241445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
241545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
241645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
241745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
241845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# This library was specified with -dlopen.
241945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$pass" = dlopen; then
242045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -z "$libdir"; then
242145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
242245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    exit $EXIT_FAILURE
242345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
242445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -z "$dlname" ||
242545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	     test "$dlopen_support" != yes ||
242645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	     test "$build_libtool_libs" = no; then
242745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # If there is no dlname, no dlopen support or we're linking
242845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # statically, we need to preload.  We also need to preload any
242945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # dependent libraries so libltdl's deplib preloader doesn't
243045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # bomb out in the load deplibs phase.
243145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    dlprefiles="$dlprefiles $lib $dependency_libs"
243245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
243345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    newdlfiles="$newdlfiles $lib"
243445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
243545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
243645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi # $pass = dlopen
243745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
243845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# We need an absolute path.
243945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $ladir in
244045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
244145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*)
244245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  abs_ladir=`cd "$ladir" && pwd`
244345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -z "$abs_ladir"; then
244445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
244545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
244645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    abs_ladir="$ladir"
244745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
244845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
244945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
245045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
245145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
245245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Find the relevant object directory and library name.
245345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "X$installed" = Xyes; then
245445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
245545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
245645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    dir="$ladir"
245745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    absdir="$abs_ladir"
245845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    libdir="$abs_ladir"
245945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
246045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    dir="$libdir"
246145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    absdir="$libdir"
246245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
246345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
246445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
246545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
246645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    dir="$ladir"
246745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    absdir="$abs_ladir"
246845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Remove this search path later
246945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    notinst_path="$notinst_path $abs_ladir"
247045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
247145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    dir="$ladir/$objdir"
247245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    absdir="$abs_ladir/$objdir"
247345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Remove this search path later
247445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    notinst_path="$notinst_path $abs_ladir"
247545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
247645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi # $installed = yes
247745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
247845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
247945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# This library was specified with -dlpreopen.
248045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$pass" = dlpreopen; then
248145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -z "$libdir"; then
248245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
248345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    exit $EXIT_FAILURE
248445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
248545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Prefer using a static library (so that no silly _DYNAMIC symbols
248645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # are required to link).
248745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$old_library"; then
248845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    newdlprefiles="$newdlprefiles $dir/$old_library"
248945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Otherwise, use the dlname, so that lt_dlopen finds it.
249045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  elif test -n "$dlname"; then
249145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    newdlprefiles="$newdlprefiles $dir/$dlname"
249245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
249345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    newdlprefiles="$newdlprefiles $dir/$linklib"
249445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
249545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi # $pass = dlpreopen
249645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
249745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -z "$libdir"; then
249845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Link the convenience library
249945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$linkmode" = lib; then
250045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    deplibs="$dir/$old_library $deplibs"
250145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  elif test "$linkmode,$pass" = "prog,link"; then
250245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    compile_deplibs="$dir/$old_library $compile_deplibs"
250345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
250445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
250545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    deplibs="$lib $deplibs" # used for prog,scan pass
250645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
250745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
250845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
250945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
251045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
251145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$linkmode" = prog && test "$pass" != link; then
251245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  newlib_search_path="$newlib_search_path $ladir"
251345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  deplibs="$lib $deplibs"
251445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
251545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  linkalldeplibs=no
251645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
251745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	     test "$build_libtool_libs" = no; then
251845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    linkalldeplibs=yes
251945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
252045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
252145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  tmp_libs=
252245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for deplib in $dependency_libs; do
252345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case $deplib in
252445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
252545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac
252645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Need to link against all dependency_libs?
252745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$linkalldeplibs" = yes; then
252845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      deplibs="$deplib $deplibs"
252945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
253045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # Need to hardcode shared library paths
253145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # or/and link against static libraries
253245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      newdependency_libs="$deplib $newdependency_libs"
253345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
253445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "X$duplicate_deps" = "Xyes" ; then
253545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case "$tmp_libs " in
253645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
253745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
253845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
253945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    tmp_libs="$tmp_libs $deplib"
254045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done # for deplib
254145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
254245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi # $linkmode = prog...
254345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
254445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$linkmode,$pass" = "prog,link"; then
254545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$library_names" &&
254645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
254745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # We need to hardcode the library path
254845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
254945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # Make sure the rpath contains only unique directories.
255045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case "$temp_rpath " in
255145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *" $dir "*) ;;
255245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *" $absdir "*) ;;
255345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *) temp_rpath="$temp_rpath $absdir" ;;
255445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
255545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
255645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
255745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Hardcode the library path.
255845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Skip directories that are in the system default run-time
255945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # search path.
256045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case " $sys_lib_dlsearch_path " in
256145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *" $absdir "*) ;;
256245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *)
256345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case "$compile_rpath " in
256445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *" $absdir "*) ;;
256545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *) compile_rpath="$compile_rpath $absdir"
256645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
256745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      ;;
256845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac
256945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case " $sys_lib_dlsearch_path " in
257045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *" $libdir "*) ;;
257145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *)
257245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case "$finalize_rpath " in
257345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *" $libdir "*) ;;
257445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *) finalize_rpath="$finalize_rpath $libdir"
257545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
257645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      ;;
257745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac
257845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi # $linkmode,$pass = prog,link...
257945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
258045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$alldeplibs" = yes &&
258145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	     { test "$deplibs_check_method" = pass_all ||
258245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	       { test "$build_libtool_libs" = yes &&
258345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		 test -n "$library_names"; }; }; then
258445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # We only need to search for static libraries
258545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    continue
258645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
258745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
258845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
258945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	link_static=no # Whether the deplib will be linked statically
259045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	use_static_libs=$prefer_static_libs
259145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$use_static_libs" = built && test "$installed" = yes ; then
259245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  use_static_libs=no
259345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
259445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$library_names" &&
259545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
259645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$installed" = no; then
259745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    notinst_deplibs="$notinst_deplibs $lib"
259845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    need_relink=yes
259945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
260045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # This is a shared library
260145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
260245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Warn about portability, can't link against -module's on
260345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # some systems (darwin)
260445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
260545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo
260645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$linkmode" = prog; then
260745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** Warning: Linking the executable $output against the loadable module"
260845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
260945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** Warning: Linking the shared library $output against the loadable module"
261045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
261145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "*** $linklib is not portable!"
261245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
261345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$linkmode" = lib &&
261445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	     test "$hardcode_into_libs" = yes; then
261545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Hardcode the library path.
261645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Skip directories that are in the system default run-time
261745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # search path.
261845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case " $sys_lib_dlsearch_path " in
261945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *" $absdir "*) ;;
262045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *)
262145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case "$compile_rpath " in
262245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *" $absdir "*) ;;
262345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *) compile_rpath="$compile_rpath $absdir"
262445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
262545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      ;;
262645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac
262745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case " $sys_lib_dlsearch_path " in
262845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *" $libdir "*) ;;
262945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *)
263045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case "$finalize_rpath " in
263145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *" $libdir "*) ;;
263245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *) finalize_rpath="$finalize_rpath $libdir"
263345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
263445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      ;;
263545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac
263645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
263745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
263845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$old_archive_from_expsyms_cmds"; then
263945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # figure out the soname
264045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    set dummy $library_names
264145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    realname="$2"
264245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    shift; shift
264345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    libname=`eval \\$echo \"$libname_spec\"`
264445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # use dlname if we got it. it's perfectly good, no?
264545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -n "$dlname"; then
264645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      soname="$dlname"
264745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    elif test -n "$soname_spec"; then
264845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # bleh windows
264945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case $host in
265045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *cygwin* | mingw*)
265145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		major=`expr $current - $age`
265245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		versuffix="-$major"
265345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		;;
265445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
265545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      eval soname=\"$soname_spec\"
265645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
265745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      soname="$realname"
265845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
265945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
266045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Make a new name for the extract_expsyms_cmds to use
266145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    soroot="$soname"
266245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
266345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
266445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
266545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # If the library has no export list, then create one now
266645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -f "$output_objdir/$soname-def"; then :
266745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
266845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $show "extracting exported symbol list from \`$soname'"
266945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      save_ifs="$IFS"; IFS='~'
267045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      cmds=$extract_expsyms_cmds
267145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      for cmd in $cmds; do
267245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		IFS="$save_ifs"
267345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		eval cmd=\"$cmd\"
267445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$show "$cmd"
267545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$run eval "$cmd" || exit $?
267645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      done
267745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      IFS="$save_ifs"
267845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
267945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
268045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Create $newlib
268145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -f "$output_objdir/$newlib"; then :; else
268245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $show "generating import library for \`$soname'"
268345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      save_ifs="$IFS"; IFS='~'
268445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      cmds=$old_archive_from_expsyms_cmds
268545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      for cmd in $cmds; do
268645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		IFS="$save_ifs"
268745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		eval cmd=\"$cmd\"
268845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$show "$cmd"
268945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$run eval "$cmd" || exit $?
269045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      done
269145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      IFS="$save_ifs"
269245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
269345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # make sure the library variables are pointing to the new library
269445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    dir=$output_objdir
269545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    linklib=$newlib
269645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi # test -n "$old_archive_from_expsyms_cmds"
269745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
269845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$linkmode" = prog || test "$mode" != relink; then
269945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    add_shlibpath=
270045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    add_dir=
270145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    add=
270245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    lib_linked=yes
270345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case $hardcode_action in
270445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    immediate | unsupported)
270545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test "$hardcode_direct" = no; then
270645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		add="$dir/$linklib"
270745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		case $host in
270845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
270945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
271045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
271145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    *-*-unixware7*) add_dir="-L$dir" ;;
271245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  *-*-darwin* )
271345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    # if the lib is a module then we can not link against
271445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    # it, someone is ignoring the new warnings I added
271545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    if /usr/bin/file -L $add 2> /dev/null |
271645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org                      $EGREP ": [^:]* bundle" >/dev/null ; then
271745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      $echo "** Warning, lib $linklib is a module, not a shared library"
271845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      if test -z "$old_library" ; then
271945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		        $echo
272045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		        $echo "** And there doesn't seem to be a static archive available"
272145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		        $echo "** The link will probably fail, sorry"
272245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      else
272345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		        add="$dir/$old_library"
272445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      fi
272545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    fi
272645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		esac
272745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      elif test "$hardcode_minus_L" = no; then
272845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		case $host in
272945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*-*-sunos*) add_shlibpath="$dir" ;;
273045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		esac
273145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		add_dir="-L$dir"
273245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		add="-l$name"
273345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      elif test "$hardcode_shlibpath_var" = no; then
273445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		add_shlibpath="$dir"
273545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		add="-l$name"
273645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      else
273745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		lib_linked=no
273845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
273945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      ;;
274045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    relink)
274145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test "$hardcode_direct" = yes; then
274245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		add="$dir/$linklib"
274345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      elif test "$hardcode_minus_L" = yes; then
274445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		add_dir="-L$dir"
274545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		# Try looking first in the location we're being installed to.
274645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if test -n "$inst_prefix_dir"; then
274745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  case $libdir in
274845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    [\\/]*)
274945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
275045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      ;;
275145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  esac
275245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi
275345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		add="-l$name"
275445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      elif test "$hardcode_shlibpath_var" = yes; then
275545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		add_shlibpath="$dir"
275645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		add="-l$name"
275745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      else
275845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		lib_linked=no
275945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
276045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      ;;
276145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *) lib_linked=no ;;
276245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac
276345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
276445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$lib_linked" != yes; then
276545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "$modename: configuration error: unsupported hardcode properties"
276645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      exit $EXIT_FAILURE
276745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
276845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
276945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -n "$add_shlibpath"; then
277045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case :$compile_shlibpath: in
277145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *":$add_shlibpath:"*) ;;
277245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
277345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
277445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
277545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$linkmode" = prog; then
277645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
277745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
277845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
277945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
278045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      test -n "$add" && deplibs="$add $deplibs"
278145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test "$hardcode_direct" != yes && \
278245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		 test "$hardcode_minus_L" != yes && \
278345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		 test "$hardcode_shlibpath_var" = yes; then
278445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		case :$finalize_shlibpath: in
278545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*":$libdir:"*) ;;
278645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
278745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		esac
278845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
278945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
279045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
279145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
279245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$linkmode" = prog || test "$mode" = relink; then
279345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    add_shlibpath=
279445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    add_dir=
279545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    add=
279645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Finalize command for both is simple: just hardcode it.
279745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$hardcode_direct" = yes; then
279845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      add="$libdir/$linklib"
279945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    elif test "$hardcode_minus_L" = yes; then
280045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      add_dir="-L$libdir"
280145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      add="-l$name"
280245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    elif test "$hardcode_shlibpath_var" = yes; then
280345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case :$finalize_shlibpath: in
280445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *":$libdir:"*) ;;
280545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
280645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
280745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      add="-l$name"
280845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    elif test "$hardcode_automatic" = yes; then
280945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test -n "$inst_prefix_dir" &&
281045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
281145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	        add="$inst_prefix_dir$libdir/$linklib"
281245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      else
281345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	        add="$libdir/$linklib"
281445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
281545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
281645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # We cannot seem to hardcode it, guess we'll fake it.
281745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      add_dir="-L$libdir"
281845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # Try looking first in the location we're being installed to.
281945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test -n "$inst_prefix_dir"; then
282045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		case $libdir in
282145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  [\\/]*)
282245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
282345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    ;;
282445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		esac
282545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
282645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      add="-l$name"
282745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
282845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
282945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$linkmode" = prog; then
283045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
283145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
283245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
283345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
283445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      test -n "$add" && deplibs="$add $deplibs"
283545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
283645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
283745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	elif test "$linkmode" = prog; then
283845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Here we assume that one of hardcode_direct or hardcode_minus_L
283945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # is not unsupported.  This is valid on all known static and
284045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # shared platforms.
284145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$hardcode_direct" != unsupported; then
284245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    test -n "$old_library" && linklib="$old_library"
284345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    compile_deplibs="$dir/$linklib $compile_deplibs"
284445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
284545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
284645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    compile_deplibs="-l$name -L$dir $compile_deplibs"
284745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
284845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
284945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	elif test "$build_libtool_libs" = yes; then
285045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Not a shared library
285145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$deplibs_check_method" != pass_all; then
285245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # We're trying link a shared library against a static one
285345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # but the system doesn't support it.
285445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
285545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Just print a warning and add the library to dependency_libs so
285645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # that the program can be linked against the static library.
285745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo
285845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "*** Warning: This system can not link to static lib archive $lib."
285945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "*** I have the capability to make that library automatically link in when"
286045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "*** you link to this library.  But I can only do this if you have a"
286145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "*** shared version of the library, which you do not appear to have."
286245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$module" = yes; then
286345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** But as you try to build a module library, libtool will still create "
286445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** a static module, that should work as long as the dlopening application"
286545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
286645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test -z "$global_symbol_pipe"; then
286745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo
286845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo "*** However, this would only work if libtool was able to extract symbol"
286945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
287045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo "*** not find such a program.  So, this module is probably useless."
287145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
287245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
287345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test "$build_old_libs" = no; then
287445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		build_libtool_libs=module
287545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		build_old_libs=yes
287645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      else
287745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		build_libtool_libs=no
287845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
287945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
288045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
288145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    deplibs="$dir/$old_library $deplibs"
288245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    link_static=yes
288345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
288445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi # link shared/static library?
288545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
288645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$linkmode" = lib; then
288745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$dependency_libs" &&
288845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	     { test "$hardcode_into_libs" != yes ||
288945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	       test "$build_old_libs" = yes ||
289045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	       test "$link_static" = yes; }; then
289145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Extract -R from dependency_libs
289245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    temp_deplibs=
289345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for libdir in $dependency_libs; do
289445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case $libdir in
289545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
289645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		   case " $xrpath " in
289745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		   *" $temp_xrpath "*) ;;
289845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		   *) xrpath="$xrpath $temp_xrpath";;
289945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		   esac;;
290045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *) temp_deplibs="$temp_deplibs $libdir";;
290145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
290245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done
290345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    dependency_libs="$temp_deplibs"
290445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
290545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
290645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  newlib_search_path="$newlib_search_path $absdir"
290745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Link against this library
290845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
290945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # ... and its dependency_libs
291045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  tmp_libs=
291145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for deplib in $dependency_libs; do
291245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    newdependency_libs="$deplib $newdependency_libs"
291345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "X$duplicate_deps" = "Xyes" ; then
291445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case "$tmp_libs " in
291545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
291645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
291745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
291845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    tmp_libs="$tmp_libs $deplib"
291945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
292045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
292145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$link_all_deplibs" != no; then
292245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Add the search paths of all dependency libraries
292345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for deplib in $dependency_libs; do
292445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case $deplib in
292545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      -L*) path="$deplib" ;;
292645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *.la)
292745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
292845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		test "X$dir" = "X$deplib" && dir="."
292945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		# We need an absolute path.
293045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		case $dir in
293145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
293245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*)
293345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  absdir=`cd "$dir" && pwd`
293445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  if test -z "$absdir"; then
293545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
293645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    absdir="$dir"
293745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  fi
293845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  ;;
293945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		esac
294045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if grep "^installed=no" $deplib > /dev/null; then
294145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  path="$absdir/$objdir"
294245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		else
294345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
294445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  if test -z "$libdir"; then
294545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
294645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    exit $EXIT_FAILURE
294745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  fi
294845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  if test "$absdir" != "$libdir"; then
294945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
295045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  fi
295145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  path="$absdir"
295245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi
295345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		depdepl=
295445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		case $host in
295545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*-*-darwin*)
295645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  # we do not want to link against static libs,
295745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  # but need to link against shared
295845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
295945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  if test -n "$deplibrary_names" ; then
296045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    for tmp in $deplibrary_names ; do
296145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      depdepl=$tmp
296245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    done
296345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    if test -f "$path/$depdepl" ; then
296445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      depdepl="$path/$depdepl"
296545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    fi
296645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    # do not add paths which are already there
296745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    case " $newlib_search_path " in
296845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    *" $path "*) ;;
296945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    *) newlib_search_path="$newlib_search_path $path";;
297045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    esac
297145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  fi
297245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  path=""
297345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  ;;
297445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*)
297545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  path="-L$path"
297645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  ;;
297745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		esac
297845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		;;
297945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      -l*)
298045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		case $host in
298145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*-*-darwin*)
298245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  # Again, we only want to link against shared libraries
298345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
298445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  for tmp in $newlib_search_path ; do
298545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
298645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      eval depdepl="$tmp/lib$tmp_libs.dylib"
298745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      break
298845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    fi
298945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  done
299045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  path=""
299145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  ;;
299245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*) continue ;;
299345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		esac
299445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		;;
299545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *) continue ;;
299645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
299745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case " $deplibs " in
299845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *" $path "*) ;;
299945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *) deplibs="$path $deplibs" ;;
300045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
300145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case " $deplibs " in
300245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *" $depdepl "*) ;;
300345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *) deplibs="$depdepl $deplibs" ;;
300445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
300545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done
300645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi # link_all_deplibs != no
300745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi # linkmode = lib
300845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done # for deplib in $libs
300945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      dependency_libs="$newdependency_libs"
301045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$pass" = dlpreopen; then
301145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Link the dlpreopened libraries before other libraries
301245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	for deplib in $save_deplibs; do
301345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  deplibs="$deplib $deplibs"
301445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	done
301545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
301645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$pass" != dlopen; then
301745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$pass" != conv; then
301845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Make sure lib_search_path contains only unique directories.
301945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  lib_search_path=
302045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for dir in $newlib_search_path; do
302145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case "$lib_search_path " in
302245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *" $dir "*) ;;
302345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *) lib_search_path="$lib_search_path $dir" ;;
302445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac
302545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
302645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  newlib_search_path=
302745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
302845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
302945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$linkmode,$pass" != "prog,link"; then
303045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  vars="deplibs"
303145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
303245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  vars="compile_deplibs finalize_deplibs"
303345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
303445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	for var in $vars dependency_libs; do
303545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Add libraries to $var in reverse order
303645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  eval tmp_libs=\"\$$var\"
303745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  new_libs=
303845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for deplib in $tmp_libs; do
303945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # FIXME: Pedantically, this is the right thing to do, so
304045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    #        that some nasty dependency loop isn't accidentally
304145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    #        broken:
304245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    #new_libs="$deplib $new_libs"
304345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Pragmatically, this seems to cause very few problems in
304445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # practice:
304545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case $deplib in
304645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    -L*) new_libs="$deplib $new_libs" ;;
304745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    -R*) ;;
304845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *)
304945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # And here is the reason: when a library appears more
305045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # than once as an explicit dependence of a library, or
305145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # is implicitly linked in more than once by the
305245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # compiler, it is considered special, and multiple
305345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # occurrences thereof are not removed.  Compare this
305445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # with having the same library being listed as a
305545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # dependency of multiple other libraries: in this case,
305645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # we know (pedantically, we assume) the library does not
305745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # need to be listed more than once, so we keep only the
305845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # last copy.  This is not always right, but it is rare
305945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # enough that we require users that really mean to play
306045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # such unportable linking tricks to link the library
306145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # using -Wl,-lname, so that libtool does not consider it
306245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # for duplicate removal.
306345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case " $specialdeplibs " in
306445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
306545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *)
306645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		case " $new_libs " in
306745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*" $deplib "*) ;;
306845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*) new_libs="$deplib $new_libs" ;;
306945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		esac
307045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		;;
307145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
307245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      ;;
307345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac
307445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
307545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  tmp_libs=
307645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for deplib in $new_libs; do
307745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case $deplib in
307845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    -L*)
307945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case " $tmp_libs " in
308045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *" $deplib "*) ;;
308145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *) tmp_libs="$tmp_libs $deplib" ;;
308245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
308345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      ;;
308445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *) tmp_libs="$tmp_libs $deplib" ;;
308545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac
308645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
308745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  eval $var=\"$tmp_libs\"
308845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	done # for var
308945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
309045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Last step: remove runtime libs from dependency_libs
309145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # (they stay in deplibs)
309245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      tmp_libs=
309345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for i in $dependency_libs ; do
309445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case " $predeps $postdeps $compiler_lib_search_path " in
309545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*" $i "*)
309645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  i=""
309745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
309845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
309945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$i" ; then
310045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  tmp_libs="$tmp_libs $i"
310145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
310245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
310345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      dependency_libs=$tmp_libs
310445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    done # for pass
310545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test "$linkmode" = prog; then
310645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      dlfiles="$newdlfiles"
310745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      dlprefiles="$newdlprefiles"
310845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
310945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
311045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    case $linkmode in
311145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    oldlib)
311245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$deplibs"; then
311345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
311445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
311545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
311645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
311745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
311845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
311945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
312045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$rpath"; then
312145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
312245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
312345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
312445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$xrpath"; then
312545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
312645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
312745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
312845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$vinfo"; then
312945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
313045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
313145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
313245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$release"; then
313345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
313445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
313545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
313645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
313745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
313845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
313945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
314045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Now set the variables for building old libraries.
314145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      build_libtool_libs=no
314245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      oldlibs="$output"
314345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      objs="$objs$old_deplibs"
314445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
314545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
314645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    lib)
314745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Make sure we only generate libraries of the form `libNAME.la'.
314845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $outputname in
314945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      lib*)
315045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
315145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	eval shared_ext=\"$shrext_cmds\"
315245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	eval libname=\"$libname_spec\"
315345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
315445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *)
315545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$module" = no; then
315645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
315745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$help" 1>&2
315845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
315945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
316045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$need_lib_prefix" != no; then
316145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Add the "lib" prefix for modules if required
316245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
316345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  eval shared_ext=\"$shrext_cmds\"
316445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  eval libname=\"$libname_spec\"
316545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
316645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
316745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
316845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
316945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
317045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
317145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$objs"; then
317245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$deplibs_check_method" != pass_all; then
317345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
317445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
317545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
317645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo
317745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
317845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "*** objects $objs is not portable!"
317945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  libobjs="$libobjs $objs"
318045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
318145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
318245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
318345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$dlself" != no; then
318445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
318545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
318645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
318745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      set dummy $rpath
318845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$#" -gt 2; then
318945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
319045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
319145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      install_libdir="$2"
319245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
319345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      oldlibs=
319445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -z "$rpath"; then
319545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$build_libtool_libs" = yes; then
319645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Building a libtool convenience library.
319745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Some compilers have problems with a `.al' extension so
319845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # convenience libraries should have the same extension an
319945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # archive normally would.
320045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
320145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  build_libtool_libs=convenience
320245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  build_old_libs=yes
320345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
320445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
320545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$vinfo"; then
320645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
320745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
320845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
320945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$release"; then
321045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
321145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
321245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      else
321345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
321445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Parse the version information argument.
321545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	save_ifs="$IFS"; IFS=':'
321645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	set dummy $vinfo 0 0 0
321745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	IFS="$save_ifs"
321845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
321945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$8"; then
322045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
322145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$help" 1>&2
322245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
322345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
322445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
322545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# convert absolute version numbers to libtool ages
322645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# this retains compatibility with .la files and attempts
322745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# to make the code below a bit more comprehensible
322845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
322945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $vinfo_number in
323045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	yes)
323145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  number_major="$2"
323245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  number_minor="$3"
323345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  number_revision="$4"
323445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  #
323545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # There are really only two kinds -- those that
323645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # use the current revision as the major version
323745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # and those that subtract age and use age as
323845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # a minor version.  But, then there is irix
323945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # which has an extra 1 added just for fun
324045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  #
324145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $version_type in
324245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  darwin|linux|osf|windows)
324345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    current=`expr $number_major + $number_minor`
324445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    age="$number_minor"
324545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    revision="$number_revision"
324645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
324745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  freebsd-aout|freebsd-elf|sunos)
324845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    current="$number_major"
324945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    revision="$number_minor"
325045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    age="0"
325145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
325245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  irix|nonstopux)
325345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    current=`expr $number_major + $number_minor - 1`
325445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    age="$number_minor"
325545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    revision="$number_minor"
325645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
325745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
325845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
325945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	no)
326045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  current="$2"
326145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  revision="$3"
326245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  age="$4"
326345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
326445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
326545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
326645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Check that each of the things are valid numbers.
326745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $current in
326845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
326945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*)
327045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
327145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
327245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
327345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
327445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
327545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
327645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $revision in
327745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
327845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*)
327945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
328045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
328145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
328245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
328345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
328445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
328545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $age in
328645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
328745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*)
328845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
328945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
329045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
329145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
329245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
329345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
329445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$age" -gt "$current"; then
329545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
329645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
329745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
329845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
329945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
330045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Calculate the version variables.
330145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	major=
330245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	versuffix=
330345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	verstring=
330445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $version_type in
330545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	none) ;;
330645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
330745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	darwin)
330845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Like Linux, but with the current version available in
330945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # verstring for coding it into the library header
331045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  major=.`expr $current - $age`
331145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  versuffix="$major.$age.$revision"
331245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Darwin ld doesn't like 0 for these options...
331345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  minor_current=`expr $current + 1`
331445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
331545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
331645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
331745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	freebsd-aout)
331845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  major=".$current"
331945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  versuffix=".$current.$revision";
332045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
332145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
332245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	freebsd-elf)
332345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  major=".$current"
332445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  versuffix=".$current";
332545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
332645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
332745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	irix | nonstopux)
332845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  major=`expr $current - $age + 1`
332945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
333045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $version_type in
333145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    nonstopux) verstring_prefix=nonstopux ;;
333245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *)         verstring_prefix=sgi ;;
333345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
333445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  verstring="$verstring_prefix$major.$revision"
333545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
333645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Add in all the interfaces that we are compatible with.
333745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  loop=$revision
333845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  while test "$loop" -ne 0; do
333945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    iface=`expr $revision - $loop`
334045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    loop=`expr $loop - 1`
334145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    verstring="$verstring_prefix$major.$iface:$verstring"
334245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
334345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
334445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Before this point, $major must not contain `.'.
334545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  major=.$major
334645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  versuffix="$major.$revision"
334745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
334845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
334945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	linux)
335045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  major=.`expr $current - $age`
335145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  versuffix="$major.$age.$revision"
335245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
335345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
335445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	osf)
335545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  major=.`expr $current - $age`
335645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  versuffix=".$current.$age.$revision"
335745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  verstring="$current.$age.$revision"
335845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
335945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Add in all the interfaces that we are compatible with.
336045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  loop=$age
336145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  while test "$loop" -ne 0; do
336245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    iface=`expr $current - $loop`
336345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    loop=`expr $loop - 1`
336445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    verstring="$verstring:${iface}.0"
336545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
336645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
336745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Make executables depend on our current version.
336845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  verstring="$verstring:${current}.0"
336945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
337045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
337145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	sunos)
337245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  major=".$current"
337345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  versuffix=".$current.$revision"
337445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
337545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
337645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	windows)
337745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Use '-' rather than '.', since we only want one
337845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # extension on DOS 8.3 filesystems.
337945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  major=`expr $current - $age`
338045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  versuffix="-$major"
338145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
338245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
338345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*)
338445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
338545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
338645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
338745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
338845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
338945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
339045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Clear the version info if we defaulted, and they specified a release.
339145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -z "$vinfo" && test -n "$release"; then
339245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  major=
339345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $version_type in
339445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  darwin)
339545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # we can't check for "0.0" in archive_cmds due to quoting
339645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # problems, so we reset it completely
339745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    verstring=
339845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
339945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *)
340045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    verstring="0.0"
340145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
340245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
340345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$need_version" = no; then
340445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    versuffix=
340545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
340645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    versuffix=".0.0"
340745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
340845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
340945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
341045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Remove version info from name if versioning should be avoided
341145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$avoid_version" = yes && test "$need_version" = no; then
341245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  major=
341345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  versuffix=
341445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  verstring=""
341545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
341645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
341745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Check to see if the archive will have undefined symbols.
341845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$allow_undefined" = yes; then
341945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$allow_undefined_flag" = unsupported; then
342045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
342145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    build_libtool_libs=no
342245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    build_old_libs=yes
342345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
342445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
342545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Don't allow undefined symbols.
342645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  allow_undefined_flag="$no_undefined_flag"
342745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
342845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
342945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
343045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$mode" != relink; then
343145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Remove our outputs, but don't remove object files since they
343245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# may have been created when compiling PIC objects.
343345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	removelist=
343445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	tempremovelist=`$echo "$output_objdir/*"`
343545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	for p in $tempremovelist; do
343645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $p in
343745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *.$objext)
343845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	       ;;
343945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
344045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	       if test "X$precious_files_regex" != "X"; then
344145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
344245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	         then
344345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		   continue
344445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		 fi
344545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	       fi
344645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	       removelist="$removelist $p"
344745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	       ;;
344845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *) ;;
344945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
345045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	done
345145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$removelist"; then
345245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $show "${rm}r $removelist"
345345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $run ${rm}r $removelist
345445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
345545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
345645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
345745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Now set the variables for building old libraries.
345845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
345945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	oldlibs="$oldlibs $output_objdir/$libname.$libext"
346045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
346145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Transform .lo files to .o files.
346245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
346345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
346445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
346545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Eliminate all temporary directories.
346645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for path in $notinst_path; do
346745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
346845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
346945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
347045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
347145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
347245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$xrpath"; then
347345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# If the user specified any rpath flags, then add them.
347445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	temp_xrpath=
347545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	for libdir in $xrpath; do
347645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  temp_xrpath="$temp_xrpath -R$libdir"
347745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case "$finalize_rpath " in
347845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *" $libdir "*) ;;
347945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *) finalize_rpath="$finalize_rpath $libdir" ;;
348045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
348145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	done
348245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
348345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  dependency_libs="$temp_xrpath $dependency_libs"
348445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
348545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
348645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
348745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Make sure dlfiles contains only unique files that won't be dlpreopened
348845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      old_dlfiles="$dlfiles"
348945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      dlfiles=
349045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for lib in $old_dlfiles; do
349145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case " $dlprefiles $dlfiles " in
349245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*" $lib "*) ;;
349345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*) dlfiles="$dlfiles $lib" ;;
349445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
349545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
349645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
349745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Make sure dlprefiles contains only unique files
349845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      old_dlprefiles="$dlprefiles"
349945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      dlprefiles=
350045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for lib in $old_dlprefiles; do
350145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case "$dlprefiles " in
350245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*" $lib "*) ;;
350345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*) dlprefiles="$dlprefiles $lib" ;;
350445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
350545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
350645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
350745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$build_libtool_libs" = yes; then
350845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$rpath"; then
350945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $host in
351045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
351145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # these systems don't actually have a c library (as such)!
351245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
351345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *-*-rhapsody* | *-*-darwin1.[012])
351445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Rhapsody C library is in the System framework
351545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    deplibs="$deplibs -framework System"
351645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
351745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *-*-netbsd*)
351845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Don't link with libc until the a.out ld.so is fixed.
351945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
352045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
352145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Do not include libc due to us having libc/libc_r.
352245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
352345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *-*-sco3.2v5* | *-*-sco5v6*)
352445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Causes problems with __ctype
352545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
352645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
352745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Compiler inserts libc in the correct place for threads to work
352845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
352945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org 	  *)
353045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Add libc to deplibs on all other systems if necessary.
353145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$build_libtool_need_lc" = "yes"; then
353245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      deplibs="$deplibs -lc"
353345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
353445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
353545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
353645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
353745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
353845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Transform deplibs into only deplibs that can be linked in shared.
353945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	name_save=$name
354045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	libname_save=$libname
354145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	release_save=$release
354245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	versuffix_save=$versuffix
354345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	major_save=$major
354445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# I'm not sure if I'm treating the release correctly.  I think
354545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# release should show up in the -l (ie -lgmp5) so we don't want to
354645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# add it in twice.  Is that correct?
354745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	release=""
354845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	versuffix=""
354945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	major=""
355045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	newdeplibs=
355145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	droppeddeps=no
355245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $deplibs_check_method in
355345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	pass_all)
355445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Don't check for shared/static.  Everything works.
355545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # This might be a little naive.  We might want to check
355645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # whether the library exists or not.  But this is on
355745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # osf3 & osf4 and I'm not really sure... Just
355845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # implementing what was already the behavior.
355945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  newdeplibs=$deplibs
356045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
356145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	test_compile)
356245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # This code stresses the "libraries are programs" paradigm to its
356345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # limits. Maybe even breaks it.  We compile a program, linking it
356445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # against the deplibs as a proxy for the library.  Then we can check
356545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # whether they linked in statically or dynamically with ldd.
356645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $rm conftest.c
356745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  cat > conftest.c <<EOF
356845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  int main() { return 0; }
356945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgEOF
357045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $rm conftest
357145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
357245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$?" -eq 0 ; then
357345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ldd_output=`ldd conftest`
357445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for i in $deplibs; do
357545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      name=`expr $i : '-l\(.*\)'`
357645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # If $name is empty we are operating on a -L argument.
357745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org              if test "$name" != "" && test "$name" -ne "0"; then
357845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
357945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  case " $predeps $postdeps " in
358045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  *" $i "*)
358145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    newdeplibs="$newdeplibs $i"
358245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    i=""
358345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    ;;
358445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  esac
358545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	        fi
358645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if test -n "$i" ; then
358745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  libname=`eval \\$echo \"$libname_spec\"`
358845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
358945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  set dummy $deplib_matches
359045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  deplib_match=$2
359145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
359245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    newdeplibs="$newdeplibs $i"
359345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  else
359445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    droppeddeps=yes
359545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    $echo
359645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    $echo "*** Warning: dynamic linker does not accept needed library $i."
359745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    $echo "*** I have the capability to make that library automatically link in when"
359845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    $echo "*** you link to this library.  But I can only do this if you have a"
359945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    $echo "*** shared version of the library, which I believe you do not have"
360045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    $echo "*** because a test_compile did reveal that the linker did not use it for"
360145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
360245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  fi
360345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi
360445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      else
360545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		newdeplibs="$newdeplibs $i"
360645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
360745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done
360845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
360945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Error occurred in the first compile.  Let's try to salvage
361045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # the situation: Compile a separate program for each library.
361145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for i in $deplibs; do
361245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      name=`expr $i : '-l\(.*\)'`
361345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # If $name is empty we are operating on a -L argument.
361445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org              if test "$name" != "" && test "$name" != "0"; then
361545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$rm conftest
361645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$LTCC $LTCFLAGS -o conftest conftest.c $i
361745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		# Did it work?
361845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if test "$?" -eq 0 ; then
361945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  ldd_output=`ldd conftest`
362045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
362145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    case " $predeps $postdeps " in
362245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    *" $i "*)
362345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      newdeplibs="$newdeplibs $i"
362445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      i=""
362545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      ;;
362645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    esac
362745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  fi
362845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  if test -n "$i" ; then
362945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    libname=`eval \\$echo \"$libname_spec\"`
363045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
363145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    set dummy $deplib_matches
363245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    deplib_match=$2
363345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
363445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      newdeplibs="$newdeplibs $i"
363545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    else
363645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      droppeddeps=yes
363745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      $echo
363845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      $echo "*** Warning: dynamic linker does not accept needed library $i."
363945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      $echo "*** I have the capability to make that library automatically link in when"
364045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      $echo "*** you link to this library.  But I can only do this if you have a"
364145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      $echo "*** shared version of the library, which you do not appear to have"
364245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      $echo "*** because a test_compile did reveal that the linker did not use this one"
364345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
364445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    fi
364545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  fi
364645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		else
364745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  droppeddeps=yes
364845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  $echo
364945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
365045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  $echo "***  make it link in!  You will probably need to install it or some"
365145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  $echo "*** library that it depends on before this library will be fully"
365245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  $echo "*** functional.  Installing it before continuing would be even better."
365345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi
365445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      else
365545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		newdeplibs="$newdeplibs $i"
365645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
365745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done
365845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
365945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
366045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	file_magic*)
366145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  set dummy $deplibs_check_method
366245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
366345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for a_deplib in $deplibs; do
366445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    name=`expr $a_deplib : '-l\(.*\)'`
366545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # If $name is empty we are operating on a -L argument.
366645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            if test "$name" != "" && test  "$name" != "0"; then
366745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
366845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		case " $predeps $postdeps " in
366945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*" $a_deplib "*)
367045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  newdeplibs="$newdeplibs $a_deplib"
367145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  a_deplib=""
367245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  ;;
367345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		esac
367445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
367545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test -n "$a_deplib" ; then
367645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		libname=`eval \\$echo \"$libname_spec\"`
367745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
367845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
367945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  for potent_lib in $potential_libs; do
368045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      # Follow soft links.
368145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      if ls -lLd "$potent_lib" 2>/dev/null \
368245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org			 | grep " -> " >/dev/null; then
368345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org			continue
368445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      fi
368545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      # The statement above tries to avoid entering an
368645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      # endless loop below, in case of cyclic links.
368745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      # We might still enter an endless loop, since a link
368845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      # loop can be closed while we follow links,
368945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      # but so what?
369045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      potlib="$potent_lib"
369145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      while test -h "$potlib" 2>/dev/null; do
369245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
369345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org			case $potliblink in
369445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
369545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
369645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org			esac
369745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      done
369845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
369945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org			 | ${SED} 10q \
370045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org			 | $EGREP "$file_magic_regex" > /dev/null; then
370145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org			newdeplibs="$newdeplibs $a_deplib"
370245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org			a_deplib=""
370345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org			break 2
370445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      fi
370545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  done
370645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		done
370745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
370845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test -n "$a_deplib" ; then
370945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		droppeddeps=yes
371045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo
371145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo "*** Warning: linker path does not have real file for library $a_deplib."
371245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo "*** I have the capability to make that library automatically link in when"
371345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo "*** you link to this library.  But I can only do this if you have a"
371445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo "*** shared version of the library, which you do not appear to have"
371545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo "*** because I did check the linker path looking for a file starting"
371645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if test -z "$potlib" ; then
371745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
371845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		else
371945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  $echo "*** with $libname and none of the candidates passed a file format test"
372045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  $echo "*** using a file magic. Last file checked: $potlib"
372145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi
372245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
372345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
372445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # Add a -L argument.
372545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      newdeplibs="$newdeplibs $a_deplib"
372645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
372745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done # Gone through all deplibs.
372845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
372945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	match_pattern*)
373045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  set dummy $deplibs_check_method
373145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
373245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for a_deplib in $deplibs; do
373345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    name=`expr $a_deplib : '-l\(.*\)'`
373445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # If $name is empty we are operating on a -L argument.
373545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -n "$name" && test "$name" != "0"; then
373645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
373745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		case " $predeps $postdeps " in
373845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*" $a_deplib "*)
373945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  newdeplibs="$newdeplibs $a_deplib"
374045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  a_deplib=""
374145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  ;;
374245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		esac
374345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
374445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test -n "$a_deplib" ; then
374545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		libname=`eval \\$echo \"$libname_spec\"`
374645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
374745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
374845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  for potent_lib in $potential_libs; do
374945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    potlib="$potent_lib" # see symlink-check above in file_magic test
375045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    if eval $echo \"$potent_lib\" 2>/dev/null \
375145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		        | ${SED} 10q \
375245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		        | $EGREP "$match_pattern_regex" > /dev/null; then
375345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      newdeplibs="$newdeplibs $a_deplib"
375445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      a_deplib=""
375545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		      break 2
375645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    fi
375745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  done
375845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		done
375945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
376045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test -n "$a_deplib" ; then
376145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		droppeddeps=yes
376245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo
376345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo "*** Warning: linker path does not have real file for library $a_deplib."
376445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo "*** I have the capability to make that library automatically link in when"
376545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo "*** you link to this library.  But I can only do this if you have a"
376645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo "*** shared version of the library, which you do not appear to have"
376745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo "*** because I did check the linker path looking for a file starting"
376845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if test -z "$potlib" ; then
376945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
377045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		else
377145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  $echo "*** with $libname and none of the candidates passed a file format test"
377245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  $echo "*** using a regex pattern. Last file checked: $potlib"
377345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi
377445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
377545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
377645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # Add a -L argument.
377745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      newdeplibs="$newdeplibs $a_deplib"
377845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
377945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done # Gone through all deplibs.
378045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
378145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	none | unknown | *)
378245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  newdeplibs=""
378345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
378445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    -e 's/ -[LR][^ ]*//g'`
378545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
378645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for i in $predeps $postdeps ; do
378745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # can't use Xsed below, because $i might contain '/'
378845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
378945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done
379045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
379145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
379245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    | grep . >/dev/null; then
379345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo
379445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "X$deplibs_check_method" = "Xnone"; then
379545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
379645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
379745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** Warning: inter-library dependencies are not known to be supported."
379845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
379945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "*** All declared inter-library dependencies are being dropped."
380045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    droppeddeps=yes
380145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
380245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
380345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
380445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	versuffix=$versuffix_save
380545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	major=$major_save
380645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	release=$release_save
380745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	libname=$libname_save
380845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	name=$name_save
380945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
381045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $host in
381145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*-*-rhapsody* | *-*-darwin1.[012])
381245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # On Rhapsody replace the C library is the System framework
381345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
381445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
381545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
381645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
381745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$droppeddeps" = yes; then
381845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$module" = yes; then
381945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo
382045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
382145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
382245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "*** a static module, that should work as long as the dlopening"
382345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "*** application is linked with the -dlopen flag."
382445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -z "$global_symbol_pipe"; then
382545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo
382645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** However, this would only work if libtool was able to extract symbol"
382745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
382845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** not find such a program.  So, this module is probably useless."
382945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
383045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
383145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$build_old_libs" = no; then
383245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      oldlibs="$output_objdir/$libname.$libext"
383345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      build_libtool_libs=module
383445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      build_old_libs=yes
383545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
383645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      build_libtool_libs=no
383745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
383845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
383945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "*** The inter-library dependencies that have been dropped here will be"
384045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "*** automatically added whenever a program is linked with this library"
384145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "*** or is declared to -dlopen it."
384245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
384345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$allow_undefined" = no; then
384445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo
384545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** Since this library must not contain undefined symbols,"
384645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** because either the platform does not support them or"
384745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** it was explicitly requested with -no-undefined,"
384845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "*** libtool will only create a static version of it."
384945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test "$build_old_libs" = no; then
385045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		oldlibs="$output_objdir/$libname.$libext"
385145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		build_libtool_libs=module
385245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		build_old_libs=yes
385345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      else
385445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		build_libtool_libs=no
385545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
385645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
385745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
385845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
385945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Done checking deplibs!
386045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	deplibs=$newdeplibs
386145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
386245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
386345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
386445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # move library search paths that coincide with paths to not yet
386545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # installed libraries to the beginning of the library search list
386645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      new_libs=
386745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for path in $notinst_path; do
386845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case " $new_libs " in
386945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*" -L$path/$objdir "*) ;;
387045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*)
387145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case " $deplibs " in
387245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *" -L$path/$objdir "*)
387345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    new_libs="$new_libs -L$path/$objdir" ;;
387445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
387545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
387645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
387745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
387845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for deplib in $deplibs; do
387945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $deplib in
388045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	-L*)
388145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case " $new_libs " in
388245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *" $deplib "*) ;;
388345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *) new_libs="$new_libs $deplib" ;;
388445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
388545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
388645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*) new_libs="$new_libs $deplib" ;;
388745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
388845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
388945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      deplibs="$new_libs"
389045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
389145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
389245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # All the library-specific variables (install_libdir is set above).
389345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      library_names=
389445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      old_library=
389545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      dlname=
389645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
389745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Test again, we may have decided not to build it any more
389845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$build_libtool_libs" = yes; then
389945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$hardcode_into_libs" = yes; then
390045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Hardcode the library paths
390145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  hardcode_libdirs=
390245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  dep_rpath=
390345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  rpath="$finalize_rpath"
390445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  test "$mode" != relink && rpath="$compile_rpath$rpath"
390545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for libdir in $rpath; do
390645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -n "$hardcode_libdir_flag_spec"; then
390745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test -n "$hardcode_libdir_separator"; then
390845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if test -z "$hardcode_libdirs"; then
390945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  hardcode_libdirs="$libdir"
391045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		else
391145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  # Just accumulate the unique libdirs.
391245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
391345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
391445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    ;;
391545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  *)
391645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
391745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    ;;
391845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  esac
391945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi
392045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      else
392145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		eval flag=\"$hardcode_libdir_flag_spec\"
392245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		dep_rpath="$dep_rpath $flag"
392345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
392445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    elif test -n "$runpath_var"; then
392545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case "$perm_rpath " in
392645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *" $libdir "*) ;;
392745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *) perm_rpath="$perm_rpath $libdir" ;;
392845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
392945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
393045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
393145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Substitute the hardcoded libdirs into the rpath.
393245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$hardcode_libdir_separator" &&
393345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	     test -n "$hardcode_libdirs"; then
393445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    libdir="$hardcode_libdirs"
393545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -n "$hardcode_libdir_flag_spec_ld"; then
393645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
393745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
393845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
393945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
394045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
394145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
394245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # We should set the runpath_var.
394345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    rpath=
394445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for dir in $perm_rpath; do
394545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      rpath="$rpath$dir:"
394645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done
394745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
394845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
394945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
395045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
395145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
395245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	shlibpath="$finalize_shlibpath"
395345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
395445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$shlibpath"; then
395545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
395645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
395745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
395845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Get the real and link names of the library.
395945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	eval shared_ext=\"$shrext_cmds\"
396045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	eval library_names=\"$library_names_spec\"
396145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	set dummy $library_names
396245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	realname="$2"
396345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	shift; shift
396445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
396545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$soname_spec"; then
396645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  eval soname=\"$soname_spec\"
396745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
396845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  soname="$realname"
396945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
397045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -z "$dlname"; then
397145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  dlname=$soname
397245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
397345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
397445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	lib="$output_objdir/$realname"
397545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	linknames=
397645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	for link
397745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	do
397845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  linknames="$linknames $link"
397945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	done
398045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
398145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Use standard objects if they are pic
398245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
398345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
398445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Prepare the list of exported symbols
398545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -z "$export_symbols"; then
398645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
398745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $show "generating symbol list for \`$libname.la'"
398845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    export_symbols="$output_objdir/$libname.exp"
398945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $run $rm $export_symbols
399045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    cmds=$export_symbols_cmds
399145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    save_ifs="$IFS"; IFS='~'
399245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for cmd in $cmds; do
399345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      IFS="$save_ifs"
399445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      eval cmd=\"$cmd\"
399545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if len=`expr "X$cmd" : ".*"` &&
399645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
399745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	        $show "$cmd"
399845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	        $run eval "$cmd" || exit $?
399945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	        skipped_export=false
400045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      else
400145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	        # The command line is too long to execute in one step.
400245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	        $show "using reloadable object file for export list..."
400345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	        skipped_export=:
400445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		# Break out early, otherwise skipped_export may be
400545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		# set to false by a later but shorter cmd.
400645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		break
400745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
400845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done
400945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    IFS="$save_ifs"
401045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -n "$export_symbols_regex"; then
401145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
401245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
401345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
401445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
401545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
401645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
401745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
401845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
401945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$export_symbols" && test -n "$include_expsyms"; then
402045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
402145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
402245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
402345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	tmp_deplibs=
402445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	for test_deplib in $deplibs; do
402545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		case " $convenience " in
402645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*" $test_deplib "*) ;;
402745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*)
402845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org			tmp_deplibs="$tmp_deplibs $test_deplib"
402945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org			;;
403045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		esac
403145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	done
403245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	deplibs="$tmp_deplibs"
403345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
403445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$convenience"; then
403545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$whole_archive_flag_spec"; then
403645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    save_libobjs=$libobjs
403745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
403845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
403945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    gentop="$output_objdir/${outputname}x"
404045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    generated="$generated $gentop"
404145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
404245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    func_extract_archives $gentop $convenience
404345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    libobjs="$libobjs $func_extract_archives_result"
404445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
404545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
404645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	
404745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
404845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  eval flag=\"$thread_safe_flag_spec\"
404945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  linker_flags="$linker_flags $flag"
405045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
405145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
405245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Make a backup of the uninstalled library when relinking
405345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$mode" = relink; then
405445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
405545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
405645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
405745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Do each of the archive commands.
405845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$module" = yes && test -n "$module_cmds" ; then
405945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
406045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    eval test_cmds=\"$module_expsym_cmds\"
406145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    cmds=$module_expsym_cmds
406245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
406345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    eval test_cmds=\"$module_cmds\"
406445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    cmds=$module_cmds
406545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
406645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
406745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
406845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  eval test_cmds=\"$archive_expsym_cmds\"
406945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  cmds=$archive_expsym_cmds
407045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
407145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  eval test_cmds=\"$archive_cmds\"
407245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  cmds=$archive_cmds
407345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
407445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
407545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
407645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "X$skipped_export" != "X:" &&
407745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
407845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
407945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  :
408045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
408145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # The command line is too long to link in one step, link piecewise.
408245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "creating reloadable object files..."
408345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
408445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Save the value of $output and $libobjs because we want to
408545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # use them later.  If we have whole_archive_flag_spec, we
408645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # want to use save_libobjs as it was before
408745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # whole_archive_flag_spec was expanded, because we can't
408845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # assume the linker understands whole_archive_flag_spec.
408945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # This may have to be revisited, in case too many
409045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # convenience libraries get linked in and end up exceeding
409145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # the spec.
409245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
409345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    save_libobjs=$libobjs
409445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
409545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  save_output=$output
409645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
409745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
409845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Clear the reloadable object creation command queue and
409945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # initialize k to one.
410045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  test_cmds=
410145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  concat_cmds=
410245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  objlist=
410345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  delfiles=
410445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  last_robj=
410545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  k=1
410645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  output=$output_objdir/$output_la-${k}.$objext
410745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Loop over the list of objects to be linked.
410845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for obj in $save_libobjs
410945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  do
411045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
411145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "X$objlist" = X ||
411245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
411345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		 test "$len" -le "$max_cmd_len"; }; then
411445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      objlist="$objlist $obj"
411545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
411645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # The command $test_cmds is almost too long, add a
411745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # command to the queue.
411845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test "$k" -eq 1 ; then
411945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		# The first file doesn't have a previous command to add.
412045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
412145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      else
412245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		# All subsequent reloadable object files will link in
412345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		# the last one created.
412445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
412545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
412645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      last_robj=$output_objdir/$output_la-${k}.$objext
412745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      k=`expr $k + 1`
412845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      output=$output_objdir/$output_la-${k}.$objext
412945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      objlist=$obj
413045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      len=1
413145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
413245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
413345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Handle the remaining objects by creating one last
413445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # reloadable object file.  All subsequent reloadable object
413545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # files will link in the last one created.
413645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
413745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
413845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
413945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if ${skipped_export-false}; then
414045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $show "generating symbol list for \`$libname.la'"
414145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    export_symbols="$output_objdir/$libname.exp"
414245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $run $rm $export_symbols
414345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    libobjs=$output
414445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Append the command to create the export file.
414545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
414645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          fi
414745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
414845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Set up a command to remove the reloadable object files
414945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # after they are used.
415045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  i=0
415145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  while test "$i" -lt "$k"
415245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  do
415345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    i=`expr $i + 1`
415445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
415545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
415645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
415745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "creating a temporary reloadable object file: $output"
415845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
415945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Loop through the commands generated above and execute them.
416045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  save_ifs="$IFS"; IFS='~'
416145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for cmd in $concat_cmds; do
416245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    IFS="$save_ifs"
416345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $show "$cmd"
416445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $run eval "$cmd" || exit $?
416545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
416645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  IFS="$save_ifs"
416745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
416845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  libobjs=$output
416945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Restore the value of output.
417045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  output=$save_output
417145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
417245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
417345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
417445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
417545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Expand the library linking commands again to reset the
417645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # value of $libobjs for piecewise linking.
417745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
417845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Do each of the archive commands.
417945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$module" = yes && test -n "$module_cmds" ; then
418045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
418145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      cmds=$module_expsym_cmds
418245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
418345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      cmds=$module_cmds
418445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
418545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
418645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
418745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    cmds=$archive_expsym_cmds
418845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
418945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    cmds=$archive_cmds
419045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
419145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
419245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
419345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Append the command to remove the reloadable object files
419445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # to the just-reset $cmds.
419545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  eval cmds=\"\$cmds~\$rm $delfiles\"
419645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
419745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	save_ifs="$IFS"; IFS='~'
419845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	for cmd in $cmds; do
419945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  IFS="$save_ifs"
420045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  eval cmd=\"$cmd\"
420145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $show "$cmd"
420245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $run eval "$cmd" || {
420345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    lt_exit=$?
420445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
420545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Restore the uninstalled library and exit
420645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$mode" = relink; then
420745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
420845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
420945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
421045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    exit $lt_exit
421145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  }
421245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	done
421345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	IFS="$save_ifs"
421445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
421545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Restore the uninstalled library and exit
421645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$mode" = relink; then
421745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
421845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
421945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$convenience"; then
422045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -z "$whole_archive_flag_spec"; then
422145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $show "${rm}r $gentop"
422245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $run ${rm}r "$gentop"
422345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
422445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
422545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
422645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_SUCCESS
422745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
422845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
422945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Create links to the real library.
423045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	for linkname in $linknames; do
423145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$realname" != "$linkname"; then
423245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
423345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
423445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
423545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	done
423645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
423745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# If -module or -export-dynamic was specified, set the dlname.
423845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$module" = yes || test "$export_dynamic" = yes; then
423945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # On all known operating systems, these are identical.
424045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  dlname="$soname"
424145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
424245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
424345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
424445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
424545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    obj)
424645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$deplibs"; then
424745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
424845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
424945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
425045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
425145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
425245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
425345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
425445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$rpath"; then
425545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
425645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
425745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
425845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$xrpath"; then
425945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
426045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
426145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
426245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$vinfo"; then
426345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
426445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
426545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
426645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$release"; then
426745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
426845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
426945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
427045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $output in
427145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *.lo)
427245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$objs$old_deplibs"; then
427345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
427445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
427545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
427645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	libobj="$output"
427745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
427845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
427945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *)
428045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	libobj=
428145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	obj="$output"
428245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
428345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
428445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
428545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Delete the old objects.
428645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $run $rm $obj $libobj
428745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
428845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Objects from convenience libraries.  This assumes
428945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # single-version convenience libraries.  Whenever we create
429045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # different ones for PIC/non-PIC, this we'll have to duplicate
429145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # the extraction.
429245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      reload_conv_objs=
429345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      gentop=
429445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # reload_cmds runs $LD directly, so let us get rid of
429545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # -Wl from whole_archive_flag_spec
429645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      wl=
429745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
429845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$convenience"; then
429945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$whole_archive_flag_spec"; then
430045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
430145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
430245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  gentop="$output_objdir/${obj}x"
430345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  generated="$generated $gentop"
430445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
430545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  func_extract_archives $gentop $convenience
430645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  reload_conv_objs="$reload_objs $func_extract_archives_result"
430745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
430845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
430945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
431045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Create the old-style object.
431145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
431245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
431345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      output="$obj"
431445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      cmds=$reload_cmds
431545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      save_ifs="$IFS"; IFS='~'
431645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for cmd in $cmds; do
431745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	IFS="$save_ifs"
431845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	eval cmd=\"$cmd\"
431945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$show "$cmd"
432045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$run eval "$cmd" || exit $?
432145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
432245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      IFS="$save_ifs"
432345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
432445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Exit if we aren't doing a library object file.
432545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -z "$libobj"; then
432645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$gentop"; then
432745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $show "${rm}r $gentop"
432845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $run ${rm}r $gentop
432945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
433045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
433145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit $EXIT_SUCCESS
433245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
433345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
433445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$build_libtool_libs" != yes; then
433545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$gentop"; then
433645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $show "${rm}r $gentop"
433745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $run ${rm}r $gentop
433845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
433945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
434045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Create an invalid libtool object if no PIC, so that we don't
434145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# accidentally link it into a program.
434245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# $show "echo timestamp > $libobj"
434345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# $run eval "echo timestamp > $libobj" || exit $?
434445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit $EXIT_SUCCESS
434545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
434645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
434745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$pic_flag" || test "$pic_mode" != default; then
434845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Only do commands if we really have different PIC objects.
434945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	reload_objs="$libobjs $reload_conv_objs"
435045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	output="$libobj"
435145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	cmds=$reload_cmds
435245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	save_ifs="$IFS"; IFS='~'
435345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	for cmd in $cmds; do
435445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  IFS="$save_ifs"
435545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  eval cmd=\"$cmd\"
435645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $show "$cmd"
435745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $run eval "$cmd" || exit $?
435845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	done
435945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	IFS="$save_ifs"
436045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
436145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
436245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$gentop"; then
436345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$show "${rm}r $gentop"
436445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$run ${rm}r $gentop
436545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
436645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
436745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit $EXIT_SUCCESS
436845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
436945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
437045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    prog)
437145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $host in
437245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
437345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
437445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$vinfo"; then
437545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
437645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
437745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
437845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$release"; then
437945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
438045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
438145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
438245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$preload" = yes; then
438345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
438445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	   test "$dlopen_self_static" = unknown; then
438545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
438645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
438745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
438845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
438945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $host in
439045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *-*-rhapsody* | *-*-darwin1.[012])
439145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# On Rhapsody replace the C library is the System framework
439245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
439345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
439445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
439545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
439645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
439745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $host in
439845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *darwin*)
439945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        # Don't allow lazy linking, it breaks C++ global constructors
440045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        if test "$tagname" = CXX ; then
440145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        compile_command="$compile_command ${wl}-bind_at_load"
440245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        finalize_command="$finalize_command ${wl}-bind_at_load"
440345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        fi
440445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        ;;
440545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
440645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
440745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
440845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # move library search paths that coincide with paths to not yet
440945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # installed libraries to the beginning of the library search list
441045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      new_libs=
441145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for path in $notinst_path; do
441245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case " $new_libs " in
441345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*" -L$path/$objdir "*) ;;
441445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*)
441545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case " $compile_deplibs " in
441645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *" -L$path/$objdir "*)
441745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    new_libs="$new_libs -L$path/$objdir" ;;
441845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
441945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
442045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
442145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
442245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for deplib in $compile_deplibs; do
442345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $deplib in
442445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	-L*)
442545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case " $new_libs " in
442645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *" $deplib "*) ;;
442745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *) new_libs="$new_libs $deplib" ;;
442845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
442945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
443045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*) new_libs="$new_libs $deplib" ;;
443145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
443245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
443345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      compile_deplibs="$new_libs"
443445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
443545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
443645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      compile_command="$compile_command $compile_deplibs"
443745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      finalize_command="$finalize_command $finalize_deplibs"
443845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
443945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$rpath$xrpath"; then
444045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# If the user specified any rpath flags, then add them.
444145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	for libdir in $rpath $xrpath; do
444245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # This is the magic to use -rpath.
444345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case "$finalize_rpath " in
444445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *" $libdir "*) ;;
444545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *) finalize_rpath="$finalize_rpath $libdir" ;;
444645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
444745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	done
444845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
444945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
445045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Now hardcode the library paths
445145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      rpath=
445245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      hardcode_libdirs=
445345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for libdir in $compile_rpath $finalize_rpath; do
445445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$hardcode_libdir_flag_spec"; then
445545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$hardcode_libdir_separator"; then
445645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -z "$hardcode_libdirs"; then
445745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      hardcode_libdirs="$libdir"
445845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
445945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # Just accumulate the unique libdirs.
446045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
446145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
446245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		;;
446345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *)
446445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
446545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		;;
446645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
446745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
446845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
446945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    eval flag=\"$hardcode_libdir_flag_spec\"
447045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    rpath="$rpath $flag"
447145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
447245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	elif test -n "$runpath_var"; then
447345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case "$perm_rpath " in
447445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *" $libdir "*) ;;
447545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *) perm_rpath="$perm_rpath $libdir" ;;
447645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
447745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
447845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $host in
447945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
448045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
448145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case :$dllsearchpath: in
448245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *":$libdir:"*) ;;
448345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *) dllsearchpath="$dllsearchpath:$libdir";;
448445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
448545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case :$dllsearchpath: in
448645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *":$testbindir:"*) ;;
448745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *) dllsearchpath="$dllsearchpath:$testbindir";;
448845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
448945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
449045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
449145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
449245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Substitute the hardcoded libdirs into the rpath.
449345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$hardcode_libdir_separator" &&
449445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	 test -n "$hardcode_libdirs"; then
449545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	libdir="$hardcode_libdirs"
449645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	eval rpath=\" $hardcode_libdir_flag_spec\"
449745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
449845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      compile_rpath="$rpath"
449945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
450045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      rpath=
450145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      hardcode_libdirs=
450245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for libdir in $finalize_rpath; do
450345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$hardcode_libdir_flag_spec"; then
450445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$hardcode_libdir_separator"; then
450545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -z "$hardcode_libdirs"; then
450645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      hardcode_libdirs="$libdir"
450745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
450845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # Just accumulate the unique libdirs.
450945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
451045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
451145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		;;
451245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *)
451345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
451445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		;;
451545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
451645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
451745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
451845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    eval flag=\"$hardcode_libdir_flag_spec\"
451945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    rpath="$rpath $flag"
452045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
452145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	elif test -n "$runpath_var"; then
452245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case "$finalize_perm_rpath " in
452345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *" $libdir "*) ;;
452445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
452545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
452645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
452745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
452845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Substitute the hardcoded libdirs into the rpath.
452945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$hardcode_libdir_separator" &&
453045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	 test -n "$hardcode_libdirs"; then
453145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	libdir="$hardcode_libdirs"
453245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	eval rpath=\" $hardcode_libdir_flag_spec\"
453345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
453445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      finalize_rpath="$rpath"
453545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
453645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$libobjs" && test "$build_old_libs" = yes; then
453745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Transform all the library objects into standard objects.
453845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
453945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
454045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
454145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
454245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      dlsyms=
454345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
454445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$NM" && test -n "$global_symbol_pipe"; then
454545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  dlsyms="${outputname}S.c"
454645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
454745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
454845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
454945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
455045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
455145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$dlsyms"; then
455245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $dlsyms in
455345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	"") ;;
455445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*.c)
455545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Discover the nlist of each of the dlfiles.
455645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  nlist="$output_objdir/${outputname}.nm"
455745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
455845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $show "$rm $nlist ${nlist}S ${nlist}T"
455945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
456045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
456145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Parse the name list into a source file.
456245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $show "creating $output_objdir/$dlsyms"
456345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
456445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
456545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
456645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
456745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
456845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#ifdef __cplusplus
456945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgextern \"C\" {
457045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif
457145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
457245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/* Prevent the only kind of declaration conflicts we can make. */
457345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#define lt_preloaded_symbols some_other_symbol
457445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
457545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/* External symbol declarations for the compiler. */\
457645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"
457745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
457845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$dlself" = yes; then
457945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $show "generating symbol list for \`$output'"
458045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
458145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
458245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
458345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Add our own program objects to the symbol list.
458445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
458545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for arg in $progfiles; do
458645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $show "extracting global C symbols from \`$arg'"
458745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
458845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done
458945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
459045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -n "$exclude_expsyms"; then
459145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
459245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $run eval '$mv "$nlist"T "$nlist"'
459345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
459445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
459545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -n "$export_symbols_regex"; then
459645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
459745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $run eval '$mv "$nlist"T "$nlist"'
459845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
459945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
460045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Prepare the list of exported symbols
460145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -z "$export_symbols"; then
460245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      export_symbols="$output_objdir/$outputname.exp"
460345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $run $rm $export_symbols
460445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
460545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org              case $host in
460645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org              *cygwin* | *mingw* )
460745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
460845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
460945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org                ;;
461045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org              esac
461145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
461245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
461345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
461445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $run eval 'mv "$nlist"T "$nlist"'
461545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org              case $host in
461645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org              *cygwin* | *mingw* )
461745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
461845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
461945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org                ;;
462045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org              esac
462145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
462245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
462345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
462445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for arg in $dlprefiles; do
462545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $show "extracting global C symbols from \`$arg'"
462645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
462745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $run eval '$echo ": $name " >> "$nlist"'
462845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
462945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
463045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
463145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -z "$run"; then
463245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Make sure we have at least an empty file.
463345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    test -f "$nlist" || : > "$nlist"
463445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
463545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -n "$exclude_expsyms"; then
463645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
463745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $mv "$nlist"T "$nlist"
463845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
463945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
464045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Try sorting and uniquifying the output.
464145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if grep -v "^: " < "$nlist" |
464245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if sort -k 3 </dev/null >/dev/null 2>&1; then
464345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  sort -k 3
464445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		else
464545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  sort +2
464645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi |
464745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		uniq > "$nlist"S; then
464845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      :
464945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
465045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      grep -v "^: " < "$nlist" > "$nlist"S
465145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
465245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
465345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -f "$nlist"S; then
465445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
465545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
465645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
465745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
465845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
465945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo >> "$output_objdir/$dlsyms" "\
466045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
466145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#undef lt_preloaded_symbols
466245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
466345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#if defined (__STDC__) && __STDC__
466445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# define lt_ptr void *
466545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#else
466645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# define lt_ptr char *
466745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# define const
466845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif
466945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
467045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/* The mapping between symbol names and symbols. */
467145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"
467245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
467345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case $host in
467445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *cygwin* | *mingw* )
467545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo >> "$output_objdir/$dlsyms" "\
467645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/* DATA imports from DLLs on WIN32 can't be const, because
467745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org   runtime relocations are performed -- see ld's documentation
467845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org   on pseudo-relocs */
467945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstruct {
468045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"
468145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      ;;
468245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    * )
468345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo >> "$output_objdir/$dlsyms" "\
468445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgconst struct {
468545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"
468645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      ;;
468745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac
468845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
468945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
469045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo >> "$output_objdir/$dlsyms" "\
469145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  const char *name;
469245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  lt_ptr address;
469345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
469445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orglt_preloaded_symbols[] =
469545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{\
469645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"
469745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
469845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
469945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
470045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo >> "$output_objdir/$dlsyms" "\
470145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  {0, (lt_ptr) 0}
470245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org};
470345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
470445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/* This works around a problem in FreeBSD linker */
470545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#ifdef FREEBSD_WORKAROUND
470645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic const void *lt_preloaded_setup() {
470745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  return lt_preloaded_symbols;
470845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
470945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif
471045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
471145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#ifdef __cplusplus
471245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
471345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif\
471445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"
471545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
471645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
471745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  pic_flag_for_symtable=
471845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $host in
471945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # compiling the symbol table file with pic_flag works around
472045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # a FreeBSD bug that causes programs to crash when -lm is
472145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # linked before any other PIC object.  But we must not use
472245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # pic_flag when linking with -static.  The problem exists in
472345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
472445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
472545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case "$compile_command " in
472645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *" -static "*) ;;
472745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
472845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac;;
472945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *-*-hpux*)
473045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case "$compile_command " in
473145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *" -static "*) ;;
473245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *) pic_flag_for_symtable=" $pic_flag";;
473345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac
473445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
473545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
473645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Now compile the dynamic symbol file.
473745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
473845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
473945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
474045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Clean up the generated files.
474145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
474245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
474345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
474445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Transform the symbol file into the correct name.
474545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          case $host in
474645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          *cygwin* | *mingw* )
474745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            if test -f "$output_objdir/${outputname}.def" ; then
474845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
474945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
475045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            else
475145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
475245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
475345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org             fi
475445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            ;;
475545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          * )
475645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
475745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
475845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            ;;
475945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          esac
476045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
476145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*-*-freebsd*)
476245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # FreeBSD doesn't need this...
476345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
476445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*)
476545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
476645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
476745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
476845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
476945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      else
477045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# We keep going just in case the user didn't refer to
477145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
477245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# really was required.
477345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
477445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Nullify the symbol file.
477545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
477645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
477745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
477845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
477945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
478045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Replace the output file specification.
478145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
478245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	link_command="$compile_command$compile_rpath"
478345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
478445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# We have no uninstalled library dependencies, so finalize right now.
478545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$show "$link_command"
478645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$run eval "$link_command"
478745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit_status=$?
478845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
478945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Delete the generated files.
479045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$dlsyms"; then
479145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $show "$rm $output_objdir/${outputname}S.${objext}"
479245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $run $rm "$output_objdir/${outputname}S.${objext}"
479345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
479445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
479545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit $exit_status
479645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
479745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
479845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$shlibpath_var"; then
479945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# We should set the shlibpath_var
480045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	rpath=
480145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	for dir in $temp_rpath; do
480245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $dir in
480345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  [\\/]* | [A-Za-z]:[\\/]*)
480445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Absolute path.
480545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    rpath="$rpath$dir:"
480645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
480745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *)
480845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Relative path: add a thisdir entry.
480945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    rpath="$rpath\$thisdir/$dir:"
481045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
481145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
481245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	done
481345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	temp_rpath="$rpath"
481445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
481545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
481645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$compile_shlibpath$finalize_shlibpath"; then
481745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
481845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
481945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$finalize_shlibpath"; then
482045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
482145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
482245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
482345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      compile_var=
482445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      finalize_var=
482545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$runpath_var"; then
482645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$perm_rpath"; then
482745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # We should set the runpath_var.
482845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  rpath=
482945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for dir in $perm_rpath; do
483045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    rpath="$rpath$dir:"
483145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
483245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
483345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
483445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$finalize_perm_rpath"; then
483545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # We should set the runpath_var.
483645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  rpath=
483745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for dir in $finalize_perm_rpath; do
483845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    rpath="$rpath$dir:"
483945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
484045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
484145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
484245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
484345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
484445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$no_install" = yes; then
484545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# We don't need to create a wrapper script.
484645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	link_command="$compile_var$compile_command$compile_rpath"
484745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Replace the output file specification.
484845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
484945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Delete the old output file.
485045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$run $rm $output
485145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Link the executable and exit
485245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$show "$link_command"
485345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$run eval "$link_command" || exit $?
485445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit $EXIT_SUCCESS
485545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
485645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
485745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$hardcode_action" = relink; then
485845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Fast installation is not supported
485945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	link_command="$compile_var$compile_command$compile_rpath"
486045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	relink_command="$finalize_var$finalize_command$finalize_rpath"
486145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
486245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
486345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: \`$output' will be relinked during installation" 1>&2
486445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      else
486545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$fast_install" != no; then
486645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  link_command="$finalize_var$compile_command$finalize_rpath"
486745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$fast_install" = yes; then
486845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
486945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
487045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # fast_install is set to needless
487145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    relink_command=
487245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
487345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
487445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  link_command="$compile_var$compile_command$compile_rpath"
487545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  relink_command="$finalize_var$finalize_command$finalize_rpath"
487645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
487745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
487845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
487945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Replace the output file specification.
488045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
488145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
488245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Delete the old output files.
488345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
488445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
488545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $show "$link_command"
488645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $run eval "$link_command" || exit $?
488745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
488845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Now create the wrapper script.
488945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $show "creating $output"
489045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
489145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Quote the relink command for shipping.
489245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$relink_command"; then
489345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Preserve any variables that may affect compiler behavior
489445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	for var in $variables_saved_for_relink; do
489545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if eval test -z \"\${$var+set}\"; then
489645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
489745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  elif eval var_value=\$$var; test -z "$var_value"; then
489845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    relink_command="$var=; export $var; $relink_command"
489945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
490045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
490145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
490245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
490345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	done
490445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	relink_command="(cd `pwd`; $relink_command)"
490545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
490645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
490745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
490845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Quote $echo for shipping.
490945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
491045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $progpath in
491145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
491245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
491345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
491445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
491545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      else
491645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
491745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
491845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
491945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Only actually do things if our run command is non-null.
492045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -z "$run"; then
492145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# win32 will think the script is a binary if it has
492245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# a .exe suffix, so we strip it off here.
492345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $output in
492445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
492545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
492645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# test for cygwin because mv fails w/o .exe extensions
492745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $host in
492845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *cygwin*)
492945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    exeext=.exe
493045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
493145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *) exeext= ;;
493245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
493345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $host in
493445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *cygwin* | *mingw* )
493545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            output_name=`basename $output`
493645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            output_path=`dirname $output`
493745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            cwrappersource="$output_path/$objdir/lt-$output_name.c"
493845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            cwrapper="$output_path/$output_name.exe"
493945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            $rm $cwrappersource $cwrapper
494045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
494145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
494245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    cat > $cwrappersource <<EOF
494345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
494445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
494545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
494645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
494745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org   The $output program cannot be directly executed until all the libtool
494845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org   libraries that it depends on are installed.
494945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
495045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org   This wrapper executable should never be moved out of the build directory.
495145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org   If it is, it will not operate correctly.
495245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
495345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org   Currently, it simply execs the wrapper *script* "/bin/sh $output",
495445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org   but could eventually absorb all of the scripts functionality and
495545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org   exec $objdir/$outputname directly.
495645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org*/
495745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgEOF
495845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    cat >> $cwrappersource<<"EOF"
495945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include <stdio.h>
496045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include <stdlib.h>
496145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include <unistd.h>
496245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include <malloc.h>
496345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include <stdarg.h>
496445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include <assert.h>
496545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include <string.h>
496645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include <ctype.h>
496745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#include <sys/stat.h>
496845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
496945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#if defined(PATH_MAX)
497045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# define LT_PATHMAX PATH_MAX
497145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#elif defined(MAXPATHLEN)
497245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# define LT_PATHMAX MAXPATHLEN
497345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#else
497445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# define LT_PATHMAX 1024
497545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif
497645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
497745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#ifndef DIR_SEPARATOR
497845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# define DIR_SEPARATOR '/'
497945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# define PATH_SEPARATOR ':'
498045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif
498145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
498245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
498345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  defined (__OS2__)
498445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# define HAVE_DOS_BASED_FILE_SYSTEM
498545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# ifndef DIR_SEPARATOR_2
498645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#  define DIR_SEPARATOR_2 '\\'
498745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# endif
498845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# ifndef PATH_SEPARATOR_2
498945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#  define PATH_SEPARATOR_2 ';'
499045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# endif
499145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif
499245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
499345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#ifndef DIR_SEPARATOR_2
499445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
499545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#else /* DIR_SEPARATOR_2 */
499645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# define IS_DIR_SEPARATOR(ch) \
499745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
499845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif /* DIR_SEPARATOR_2 */
499945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
500045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#ifndef PATH_SEPARATOR_2
500145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
500245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#else /* PATH_SEPARATOR_2 */
500345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
500445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif /* PATH_SEPARATOR_2 */
500545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
500645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
500745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#define XFREE(stale) do { \
500845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if (stale) { free ((void *) stale); stale = 0; } \
500945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org} while (0)
501045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
501145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/* -DDEBUG is fairly common in CFLAGS.  */
501245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#undef DEBUG
501345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#if defined DEBUGWRAPPER
501445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
501545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#else
501645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# define DEBUG(format, ...)
501745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif
501845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
501945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgconst char *program_name = NULL;
502045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
502145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid * xmalloc (size_t num);
502245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgchar * xstrdup (const char *string);
502345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgconst char * base_name (const char *name);
502445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgchar * find_executable(const char *wrapper);
502545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgint    check_executable(const char *path);
502645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgchar * strendzap(char *str, const char *pat);
502745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid lt_fatal (const char *message, ...);
502845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
502945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgint
503045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgmain (int argc, char *argv[])
503145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
503245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  char **newargz;
503345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  int i;
503445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
503545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  program_name = (char *) xstrdup (base_name (argv[0]));
503645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  DEBUG("(main) argv[0]      : %s\n",argv[0]);
503745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  DEBUG("(main) program_name : %s\n",program_name);
503845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  newargz = XMALLOC(char *, argc+2);
503945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgEOF
504045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
504145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            cat >> $cwrappersource <<EOF
504245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  newargz[0] = (char *) xstrdup("$SHELL");
504345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgEOF
504445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
504545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            cat >> $cwrappersource <<"EOF"
504645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  newargz[1] = find_executable(argv[0]);
504745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if (newargz[1] == NULL)
504845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    lt_fatal("Couldn't find %s", argv[0]);
504945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  DEBUG("(main) found exe at : %s\n",newargz[1]);
505045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  /* we know the script has the same name, without the .exe */
505145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  /* so make sure newargz[1] doesn't end in .exe */
505245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  strendzap(newargz[1],".exe");
505345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  for (i = 1; i < argc; i++)
505445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    newargz[i+1] = xstrdup(argv[i]);
505545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  newargz[argc+1] = NULL;
505645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
505745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  for (i=0; i<argc+1; i++)
505845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  {
505945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
506045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;
506145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  }
506245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
506345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgEOF
506445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
506545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            case $host_os in
506645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org              mingw*)
506745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org                cat >> $cwrappersource <<EOF
506845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  execv("$SHELL",(char const **)newargz);
506945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgEOF
507045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org              ;;
507145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org              *)
507245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org                cat >> $cwrappersource <<EOF
507345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  execv("$SHELL",newargz);
507445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgEOF
507545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org              ;;
507645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            esac
507745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
507845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            cat >> $cwrappersource <<"EOF"
507945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  return 127;
508045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
508145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
508245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid *
508345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgxmalloc (size_t num)
508445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
508545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  void * p = (void *) malloc (num);
508645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if (!p)
508745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    lt_fatal ("Memory exhausted");
508845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
508945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  return p;
509045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
509145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
509245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgchar *
509345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgxstrdup (const char *string)
509445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
509545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
509645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org;
509745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
509845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
509945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgconst char *
510045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgbase_name (const char *name)
510145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
510245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  const char *base;
510345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
510445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
510545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  /* Skip over the disk name in MSDOS pathnames. */
510645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
510745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    name += 2;
510845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif
510945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
511045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  for (base = name; *name; name++)
511145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if (IS_DIR_SEPARATOR (*name))
511245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      base = name + 1;
511345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  return base;
511445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
511545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
511645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgint
511745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgcheck_executable(const char * path)
511845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
511945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  struct stat st;
512045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
512145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
512245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if ((!path) || (!*path))
512345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    return 0;
512445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
512545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if ((stat (path, &st) >= 0) &&
512645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      (
512745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
512845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#if defined (S_IXOTH)
512945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
513045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif
513145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#if defined (S_IXGRP)
513245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
513345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif
513445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org       ((st.st_mode & S_IXUSR) == S_IXUSR))
513545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      )
513645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    return 1;
513745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  else
513845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    return 0;
513945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
514045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
514145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org/* Searches for the full path of the wrapper.  Returns
514245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org   newly allocated full path name if found, NULL otherwise */
514345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgchar *
514445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgfind_executable (const char* wrapper)
514545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
514645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  int has_slash = 0;
514745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  const char* p;
514845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  const char* p_next;
514945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  /* static buffer for getcwd */
515045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  char tmp[LT_PATHMAX + 1];
515145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  int tmp_len;
515245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  char* concat_name;
515345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
515445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
515545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
515645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if ((wrapper == NULL) || (*wrapper == '\0'))
515745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    return NULL;
515845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
515945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  /* Absolute path? */
516045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
516145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
516245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  {
516345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    concat_name = xstrdup (wrapper);
516445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if (check_executable(concat_name))
516545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      return concat_name;
516645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    XFREE(concat_name);
516745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  }
516845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  else
516945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  {
517045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif
517145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if (IS_DIR_SEPARATOR (wrapper[0]))
517245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    {
517345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      concat_name = xstrdup (wrapper);
517445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if (check_executable(concat_name))
517545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        return concat_name;
517645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      XFREE(concat_name);
517745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    }
517845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
517945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  }
518045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#endif
518145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
518245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  for (p = wrapper; *p; p++)
518345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if (*p == '/')
518445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    {
518545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      has_slash = 1;
518645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      break;
518745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    }
518845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if (!has_slash)
518945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  {
519045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    /* no slashes; search PATH */
519145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    const char* path = getenv ("PATH");
519245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if (path != NULL)
519345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    {
519445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for (p = path; *p; p = p_next)
519545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      {
519645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        const char* q;
519745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        size_t p_len;
519845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        for (q = p; *q; q++)
519945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          if (IS_PATH_SEPARATOR(*q))
520045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            break;
520145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        p_len = q - p;
520245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        p_next = (*q == '\0' ? q : q + 1);
520345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        if (p_len == 0)
520445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        {
520545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          /* empty path: current directory */
520645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          if (getcwd (tmp, LT_PATHMAX) == NULL)
520745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org            lt_fatal ("getcwd failed");
520845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          tmp_len = strlen(tmp);
520945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
521045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          memcpy (concat_name, tmp, tmp_len);
521145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          concat_name[tmp_len] = '/';
521245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          strcpy (concat_name + tmp_len + 1, wrapper);
521345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        }
521445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        else
521545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        {
521645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
521745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          memcpy (concat_name, p, p_len);
521845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          concat_name[p_len] = '/';
521945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          strcpy (concat_name + p_len + 1, wrapper);
522045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        }
522145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        if (check_executable(concat_name))
522245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          return concat_name;
522345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        XFREE(concat_name);
522445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      }
522545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    }
522645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    /* not found in PATH; assume curdir */
522745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  }
522845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  /* Relative path | not found in path: prepend cwd */
522945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if (getcwd (tmp, LT_PATHMAX) == NULL)
523045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    lt_fatal ("getcwd failed");
523145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  tmp_len = strlen(tmp);
523245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
523345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  memcpy (concat_name, tmp, tmp_len);
523445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  concat_name[tmp_len] = '/';
523545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  strcpy (concat_name + tmp_len + 1, wrapper);
523645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
523745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if (check_executable(concat_name))
523845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    return concat_name;
523945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  XFREE(concat_name);
524045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  return NULL;
524145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
524245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
524345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgchar *
524445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstrendzap(char *str, const char *pat)
524545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
524645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  size_t len, patlen;
524745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
524845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  assert(str != NULL);
524945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  assert(pat != NULL);
525045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
525145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  len = strlen(str);
525245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  patlen = strlen(pat);
525345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
525445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if (patlen <= len)
525545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  {
525645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    str += len - patlen;
525745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if (strcmp(str, pat) == 0)
525845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *str = '\0';
525945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  }
526045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  return str;
526145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
526245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
526345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgstatic void
526445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orglt_error_core (int exit_status, const char * mode,
526545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          const char * message, va_list ap)
526645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
526745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  fprintf (stderr, "%s: %s: ", program_name, mode);
526845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  vfprintf (stderr, message, ap);
526945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  fprintf (stderr, ".\n");
527045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
527145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if (exit_status >= 0)
527245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    exit (exit_status);
527345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
527445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
527545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgvoid
527645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orglt_fatal (const char *message, ...)
527745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org{
527845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  va_list ap;
527945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  va_start (ap, message);
528045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
528145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  va_end (ap);
528245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org}
528345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgEOF
528445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          # we should really use a build-platform specific compiler
528545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          # here, but OTOH, the wrappers (shell script and this C one)
528645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          # are only useful if you want to execute the "real" binary.
528745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          # Since the "real" binary is built for $host, then this
528845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          # wrapper might as well be built for $host, too.
528945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
529045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org          ;;
529145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        esac
529245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        $rm $output
529345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
529445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
529545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo > $output "\
529645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#! $SHELL
529745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
529845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# $output - temporary wrapper script for $objdir/$outputname
529945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
530045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#
530145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# The $output program cannot be directly executed until all the libtool
530245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# libraries that it depends on are installed.
530345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#
530445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# This wrapper script should never be moved out of the build directory.
530545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# If it is, it will not operate correctly.
530645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
530745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Sed substitution that helps us do robust quoting.  It backslashifies
530845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# metacharacters that are still active within double-quoted strings.
530945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgXsed='${SED} -e 1s/^X//'
531045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgsed_quote_subst='$sed_quote_subst'
531145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
531245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# The HP-UX ksh and POSIX shell print the target directory to stdout
531345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# if CDPATH is set.
531445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
531545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
531645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgrelink_command=\"$relink_command\"
531745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
531845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# This environment variable determines our operation mode.
531945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgif test \"\$libtool_install_magic\" = \"$magic\"; then
532045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # install mode needs the following variable:
532145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  notinst_deplibs='$notinst_deplibs'
532245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgelse
532345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # When we are sourced in execute mode, \$file and \$echo are already set.
532445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if test \"\$libtool_execute_magic\" != \"$magic\"; then
532545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    echo=\"$qecho\"
532645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    file=\"\$0\"
532745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Make sure echo works.
532845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test \"X\$1\" = X--no-reexec; then
532945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Discard the --no-reexec flag, and continue.
533045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      shift
533145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
533245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Yippee, \$echo works!
533345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      :
533445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    else
533545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Restart under the correct shell, and then maybe \$echo will work.
533645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
533745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
533845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  fi\
533945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"
534045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo >> $output "\
534145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
534245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # Find the directory that this script lives in.
534345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
534445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
534545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
534645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # Follow symbolic links until we get to the real thisdir.
534745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
534845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  while test -n \"\$file\"; do
534945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
535045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
535145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # If there was a directory component, then change thisdir.
535245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test \"x\$destdir\" != \"x\$file\"; then
535345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case \"\$destdir\" in
535445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
535545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *) thisdir=\"\$thisdir/\$destdir\" ;;
535645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
535745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
535845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
535945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
536045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
536145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  done
536245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
536345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # Try to get the absolute directory name.
536445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  absdir=\`cd \"\$thisdir\" && pwd\`
536545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  test -n \"\$absdir\" && thisdir=\"\$absdir\"
536645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"
536745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
536845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$fast_install" = yes; then
536945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo >> $output "\
537045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  program=lt-'$outputname'$exeext
537145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  progdir=\"\$thisdir/$objdir\"
537245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
537345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if test ! -f \"\$progdir/\$program\" || \\
537445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
537545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
537645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
537745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    file=\"\$\$-\$program\"
537845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
537945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test ! -d \"\$progdir\"; then
538045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $mkdir \"\$progdir\"
538145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    else
538245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $rm \"\$progdir/\$file\"
538345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi"
538445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
538545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo >> $output "\
538645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
538745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # relink executable if necessary
538845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -n \"\$relink_command\"; then
538945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
539045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      else
539145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo \"\$relink_command_output\" >&2
539245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$rm \"\$progdir/\$file\"
539345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit $EXIT_FAILURE
539445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
539545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
539645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
539745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
539845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    { $rm \"\$progdir/\$program\";
539945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
540045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $rm \"\$progdir/\$file\"
540145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  fi"
540245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
540345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo >> $output "\
540445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  program='$outputname'
540545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  progdir=\"\$thisdir/$objdir\"
540645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"
540745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
540845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
540945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo >> $output "\
541045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
541145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if test -f \"\$progdir/\$program\"; then"
541245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
541345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Export our shlibpath_var if we have one.
541445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
541545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo >> $output "\
541645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Add our own library path to $shlibpath_var
541745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
541845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
541945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Some systems cannot cope with colon-terminated $shlibpath_var
542045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # The second colon is a workaround for a bug in BeOS R4 sed
542145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
542245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
542345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    export $shlibpath_var
542445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"
542545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
542645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
542745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# fixup the dll searchpath if we need to.
542845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$dllsearchpath"; then
542945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo >> $output "\
543045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Add the dll search path components to the executable PATH
543145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    PATH=$dllsearchpath:\$PATH
543245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"
543345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
543445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
543545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo >> $output "\
543645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test \"\$libtool_execute_magic\" != \"$magic\"; then
543745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Run the actual program with our arguments.
543845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"
543945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $host in
544045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Backslashes separate directories on plain windows
544145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*-*-mingw | *-*-os2*)
544245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo >> $output "\
544345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
544445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"
544545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
544645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
544745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*)
544845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo >> $output "\
544945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exec \"\$progdir/\$program\" \${1+\"\$@\"}
545045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"
545145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
545245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
545345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo >> $output "\
545445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
545545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit $EXIT_FAILURE
545645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
545745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  else
545845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # The program doesn't exist.
545945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
546045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    \$echo \"This script is just a wrapper for \$program.\" 1>&2
546145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
546245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    exit $EXIT_FAILURE
546345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  fi
546445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgfi\
546545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"
546645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	chmod +x $output
546745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
546845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit $EXIT_SUCCESS
546945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
547045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    esac
547145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
547245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # See if we need to build an old-fashioned archive.
547345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    for oldlib in $oldlibs; do
547445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
547545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$build_libtool_libs" = convenience; then
547645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	oldobjs="$libobjs_save"
547745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	addlibs="$convenience"
547845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	build_libtool_libs=no
547945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      else
548045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$build_libtool_libs" = module; then
548145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  oldobjs="$libobjs_save"
548245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  build_libtool_libs=no
548345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
548445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  oldobjs="$old_deplibs $non_pic_objects"
548545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
548645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	addlibs="$old_convenience"
548745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
548845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
548945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$addlibs"; then
549045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	gentop="$output_objdir/${outputname}x"
549145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	generated="$generated $gentop"
549245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
549345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	func_extract_archives $gentop $addlibs
549445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	oldobjs="$oldobjs $func_extract_archives_result"
549545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
549645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
549745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Do each command in the archive commands.
549845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
549945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org       cmds=$old_archive_from_new_cmds
550045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      else
550145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# POSIX demands no paths to be encoded in archives.  We have
550245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# to avoid creating archives with duplicate basenames if we
550345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# might have to extract them afterwards, e.g., when creating a
550445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# static archive out of a convenience library, or when linking
550545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# the entirety of a libtool archive into another (currently
550645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# not supported by libtool).
550745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if (for obj in $oldobjs
550845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    do
550945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
551045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done | sort | sort -uc >/dev/null 2>&1); then
551145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  :
551245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
551345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "copying selected object files to avoid basename conflicts..."
551445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
551545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -z "$gentop"; then
551645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    gentop="$output_objdir/${outputname}x"
551745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    generated="$generated $gentop"
551845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
551945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $show "${rm}r $gentop"
552045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $run ${rm}r "$gentop"
552145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $show "$mkdir $gentop"
552245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $run $mkdir "$gentop"
552345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    exit_status=$?
552445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
552545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      exit $exit_status
552645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
552745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
552845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
552945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  save_oldobjs=$oldobjs
553045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  oldobjs=
553145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  counter=1
553245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for obj in $save_oldobjs
553345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  do
553445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
553545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case " $oldobjs " in
553645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    " ") oldobjs=$obj ;;
553745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *[\ /]"$objbase "*)
553845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      while :; do
553945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		# Make sure we don't pick an alternate name that also
554045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		# overlaps.
554145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		newobj=lt$counter-$objbase
554245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		counter=`expr $counter + 1`
554345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		case " $oldobjs " in
554445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*[\ /]"$newobj "*) ;;
554545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
554645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		esac
554745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      done
554845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
554945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $run ln "$obj" "$gentop/$newobj" ||
555045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $run cp "$obj" "$gentop/$newobj"
555145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      oldobjs="$oldobjs $gentop/$newobj"
555245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      ;;
555345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *) oldobjs="$oldobjs $obj" ;;
555445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac
555545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
555645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
555745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
555845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	eval cmds=\"$old_archive_cmds\"
555945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
556045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if len=`expr "X$cmds" : ".*"` &&
556145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
556245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  cmds=$old_archive_cmds
556345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
556445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # the command line is too long to link in one step, link in parts
556545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "using piecewise archive linking..."
556645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  save_RANLIB=$RANLIB
556745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  RANLIB=:
556845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  objlist=
556945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  concat_cmds=
557045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  save_oldobjs=$oldobjs
557145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
557245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Is there a better way of finding the last object in the list?
557345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for obj in $save_oldobjs
557445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  do
557545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    last_oldobj=$obj
557645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
557745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for obj in $save_oldobjs
557845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  do
557945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    oldobjs="$objlist $obj"
558045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    objlist="$objlist $obj"
558145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    eval test_cmds=\"$old_archive_cmds\"
558245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
558345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	       test "$len" -le "$max_cmd_len"; then
558445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      :
558545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
558645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # the above command should be used before it gets too long
558745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      oldobjs=$objlist
558845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test "$obj" = "$last_oldobj" ; then
558945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	        RANLIB=$save_RANLIB
559045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
559145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
559245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
559345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      objlist=
559445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
559545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
559645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  RANLIB=$save_RANLIB
559745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  oldobjs=$objlist
559845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "X$oldobjs" = "X" ; then
559945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    eval cmds=\"\$concat_cmds\"
560045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
560145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
560245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
560345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
560445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
560545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      save_ifs="$IFS"; IFS='~'
560645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for cmd in $cmds; do
560745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org        eval cmd=\"$cmd\"
560845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	IFS="$save_ifs"
560945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$show "$cmd"
561045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$run eval "$cmd" || exit $?
561145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
561245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      IFS="$save_ifs"
561345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    done
561445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
561545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -n "$generated"; then
561645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $show "${rm}r$generated"
561745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $run ${rm}r$generated
561845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
561945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
562045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Now create the libtool archive.
562145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    case $output in
562245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *.la)
562345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      old_library=
562445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      test "$build_old_libs" = yes && old_library="$libname.$libext"
562545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $show "creating $output"
562645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
562745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Preserve any variables that may affect compiler behavior
562845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for var in $variables_saved_for_relink; do
562945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if eval test -z \"\${$var+set}\"; then
563045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
563145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	elif eval var_value=\$$var; test -z "$var_value"; then
563245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  relink_command="$var=; export $var; $relink_command"
563345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
563445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
563545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
563645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
563745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
563845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Quote the link command for shipping.
563945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
564045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
564145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$hardcode_automatic" = yes ; then
564245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	relink_command=
564345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
564445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
564545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
564645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Only create the output if not a dry run.
564745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -z "$run"; then
564845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	for installed in no yes; do
564945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$installed" = yes; then
565045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -z "$install_libdir"; then
565145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      break
565245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
565345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    output="$output_objdir/$outputname"i
565445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Replace all uninstalled libtool libraries with the installed ones
565545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    newdependency_libs=
565645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for deplib in $dependency_libs; do
565745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case $deplib in
565845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *.la)
565945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
566045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
566145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if test -z "$libdir"; then
566245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
566345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  exit $EXIT_FAILURE
566445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi
566545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		newdependency_libs="$newdependency_libs $libdir/$name"
566645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		;;
566745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *) newdependency_libs="$newdependency_libs $deplib" ;;
566845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
566945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done
567045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    dependency_libs="$newdependency_libs"
567145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    newdlfiles=
567245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for lib in $dlfiles; do
567345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
567445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
567545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test -z "$libdir"; then
567645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
567745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		exit $EXIT_FAILURE
567845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
567945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      newdlfiles="$newdlfiles $libdir/$name"
568045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done
568145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    dlfiles="$newdlfiles"
568245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    newdlprefiles=
568345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for lib in $dlprefiles; do
568445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
568545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
568645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test -z "$libdir"; then
568745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
568845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		exit $EXIT_FAILURE
568945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
569045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      newdlprefiles="$newdlprefiles $libdir/$name"
569145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done
569245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    dlprefiles="$newdlprefiles"
569345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
569445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    newdlfiles=
569545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for lib in $dlfiles; do
569645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case $lib in
569745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
569845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*) abs=`pwd`"/$lib" ;;
569945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
570045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      newdlfiles="$newdlfiles $abs"
570145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done
570245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    dlfiles="$newdlfiles"
570345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    newdlprefiles=
570445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for lib in $dlprefiles; do
570545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case $lib in
570645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
570745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		*) abs=`pwd`"/$lib" ;;
570845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
570945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      newdlprefiles="$newdlprefiles $abs"
571045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done
571145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    dlprefiles="$newdlprefiles"
571245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
571345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $rm $output
571445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # place dlname in correct position for cygwin
571545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  tdlname=$dlname
571645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $host,$output,$installed,$module,$dlname in
571745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
571845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
571945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo > $output "\
572045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# $outputname - a libtool library file
572145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
572245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org#
572345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Please DO NOT delete this file!
572445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# It is necessary for linking the library.
572545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
572645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# The name that we can dlopen(3).
572745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgdlname='$tdlname'
572845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
572945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Names of this library.
573045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orglibrary_names='$library_names'
573145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
573245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# The name of the static archive.
573345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgold_library='$old_library'
573445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
573545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Libraries that this one depends upon.
573645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgdependency_libs='$dependency_libs'
573745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
573845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Version information for $libname.
573945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgcurrent=$current
574045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgage=$age
574145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgrevision=$revision
574245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
574345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Is this an already installed library?
574445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orginstalled=$installed
574545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
574645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Should we warn about portability when linking against -modules?
574745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgshouldnotlink=$module
574845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
574945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Files to dlopen/dlpreopen
575045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgdlopen='$dlfiles'
575145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgdlpreopen='$dlprefiles'
575245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
575345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Directory that this library needs to be installed in:
575445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orglibdir='$install_libdir'"
575545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$installed" = no && test "$need_relink" = yes; then
575645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo >> $output "\
575745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgrelink_command=\"$relink_command\""
575845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
575945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	done
576045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
576145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
576245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Do a symbolic link so that the libtool archive can be found in
576345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # LD_LIBRARY_PATH before the program is installed.
576445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
576545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
576645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
576745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    esac
576845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    exit $EXIT_SUCCESS
576945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
577045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
577145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # libtool install mode
577245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  install)
577345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    modename="$modename: install"
577445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
577545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # There may be an optional sh(1) argument at the beginning of
577645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # install_prog (especially on Windows NT).
577745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
577845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org       # Allow the use of GNU shtool's install command.
577945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org       $echo "X$nonopt" | grep shtool > /dev/null; then
578045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Aesthetically quote it.
578145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
578245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $arg in
578345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
578445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	arg="\"$arg\""
578545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
578645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
578745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      install_prog="$arg "
578845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      arg="$1"
578945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      shift
579045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    else
579145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      install_prog=
579245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      arg=$nonopt
579345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
579445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
579545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # The real first argument should be the name of the installation program.
579645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Aesthetically quote it.
579745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
579845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    case $arg in
579945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
580045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      arg="\"$arg\""
580145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
580245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    esac
580345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    install_prog="$install_prog$arg"
580445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
580545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # We need to accept at least all the BSD install flags.
580645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    dest=
580745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    files=
580845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    opts=
580945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    prev=
581045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    install_type=
581145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    isdir=no
581245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    stripme=
581345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    for arg
581445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    do
581545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$dest"; then
581645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	files="$files $dest"
581745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	dest=$arg
581845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
581945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
582045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
582145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $arg in
582245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -d) isdir=yes ;;
582345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -f) 
582445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      	case " $install_prog " in
582545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*[\\\ /]cp\ *) ;;
582645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*) prev=$arg ;;
582745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
582845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
582945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -g | -m | -o) prev=$arg ;;
583045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -s)
583145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	stripme=" -s"
583245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
583345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
583445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -*)
583545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
583645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *)
583745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# If the previous option needed an argument, then skip it.
583845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$prev"; then
583945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  prev=
584045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
584145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  dest=$arg
584245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
584345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
584445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
584545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
584645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
584745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Aesthetically quote the argument.
584845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
584945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $arg in
585045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
585145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	arg="\"$arg\""
585245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
585345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
585445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      install_prog="$install_prog $arg"
585545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    done
585645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
585745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -z "$install_prog"; then
585845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$modename: you must specify an install program" 1>&2
585945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$help" 1>&2
586045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit $EXIT_FAILURE
586145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
586245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
586345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -n "$prev"; then
586445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$modename: the \`$prev' option requires an argument" 1>&2
586545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$help" 1>&2
586645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit $EXIT_FAILURE
586745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
586845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
586945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -z "$files"; then
587045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -z "$dest"; then
587145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: no file or destination specified" 1>&2
587245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      else
587345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: you must specify a destination" 1>&2
587445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
587545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$help" 1>&2
587645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit $EXIT_FAILURE
587745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
587845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
587945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Strip any trailing slash from the destination.
588045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
588145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
588245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Check to see that the destination is a directory.
588345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    test -d "$dest" && isdir=yes
588445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test "$isdir" = yes; then
588545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      destdir="$dest"
588645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      destname=
588745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    else
588845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
588945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      test "X$destdir" = "X$dest" && destdir=.
589045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
589145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
589245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Not a directory, so check to see that there is only one file specified.
589345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      set dummy $files
589445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$#" -gt 2; then
589545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: \`$dest' is not a directory" 1>&2
589645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$help" 1>&2
589745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit $EXIT_FAILURE
589845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
589945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
590045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    case $destdir in
590145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    [\\/]* | [A-Za-z]:[\\/]*) ;;
590245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    *)
590345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for file in $files; do
590445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $file in
590545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*.lo) ;;
590645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*)
590745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
590845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$help" 1>&2
590945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
591045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
591145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
591245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
591345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      ;;
591445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    esac
591545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
591645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # This variable tells wrapper scripts just to set variables rather
591745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # than running their programs.
591845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    libtool_install_magic="$magic"
591945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
592045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    staticlibs=
592145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    future_libdirs=
592245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    current_libdirs=
592345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    for file in $files; do
592445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
592545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Do each installation.
592645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $file in
592745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *.$libext)
592845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Do the static libraries later.
592945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	staticlibs="$staticlibs $file"
593045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
593145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
593245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *.la)
593345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Check to see that this really is a libtool archive.
593445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
593545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
593645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
593745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$help" 1>&2
593845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
593945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
594045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
594145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	library_names=
594245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	old_library=
594345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	relink_command=
594445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# If there is no directory component, then add one.
594545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $file in
594645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*/* | *\\*) . $file ;;
594745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*) . ./$file ;;
594845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
594945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
595045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Add the libdir to current_libdirs if it is the destination.
595145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "X$destdir" = "X$libdir"; then
595245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case "$current_libdirs " in
595345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *" $libdir "*) ;;
595445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *) current_libdirs="$current_libdirs $libdir" ;;
595545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
595645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
595745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Note the libdir as a future libdir.
595845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case "$future_libdirs " in
595945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *" $libdir "*) ;;
596045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *) future_libdirs="$future_libdirs $libdir" ;;
596145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
596245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
596345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
596445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
596545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	test "X$dir" = "X$file/" && dir=
596645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	dir="$dir$objdir"
596745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
596845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$relink_command"; then
596945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Determine the prefix the user has applied to our future dir.
597045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
597145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
597245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Don't allow the user to place us outside of our expected
597345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # location b/c this prevents finding dependent libraries that
597445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # are installed to the same prefix.
597545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # At present, this check doesn't affect windows .dll's that
597645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # are installed into $libdir/../bin (currently, that works fine)
597745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # but it's something to keep an eye on.
597845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$inst_prefix_dir" = "$destdir"; then
597945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
598045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    exit $EXIT_FAILURE
598145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
598245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
598345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$inst_prefix_dir"; then
598445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Stick the inst_prefix_dir data into the link command.
598545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
598645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
598745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
598845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
598945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
599045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: warning: relinking \`$file'" 1>&2
599145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $show "$relink_command"
599245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if $run eval "$relink_command"; then :
599345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
599445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
599545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    exit $EXIT_FAILURE
599645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
599745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
599845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
599945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# See the names of the shared library.
600045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	set dummy $library_names
600145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$2"; then
600245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  realname="$2"
600345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  shift
600445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  shift
600545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
600645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  srcname="$realname"
600745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  test -n "$relink_command" && srcname="$realname"T
600845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
600945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Install the shared library and build the symlinks.
601045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $show "$install_prog $dir/$srcname $destdir/$realname"
601145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
601245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$stripme" && test -n "$striplib"; then
601345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $show "$striplib $destdir/$realname"
601445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $run eval "$striplib $destdir/$realname" || exit $?
601545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
601645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
601745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$#" -gt 0; then
601845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Delete the old symlinks, and create new ones.
601945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Try `ln -sf' first, because the `ln' binary might depend on
602045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
602145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # so we also need to try rm && ln -s.
602245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    for linkname
602345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    do
602445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test "$linkname" != "$realname"; then
602545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
602645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
602745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
602845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    done
602945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
603045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
603145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Do each command in the postinstall commands.
603245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  lib="$destdir/$realname"
603345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  cmds=$postinstall_cmds
603445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  save_ifs="$IFS"; IFS='~'
603545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for cmd in $cmds; do
603645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    IFS="$save_ifs"
603745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    eval cmd=\"$cmd\"
603845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $show "$cmd"
603945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $run eval "$cmd" || {
604045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      lt_exit=$?
604145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
604245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # Restore the uninstalled library and exit
604345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if test "$mode" = relink; then
604445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
604545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
604645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
604745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      exit $lt_exit
604845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    }
604945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
605045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  IFS="$save_ifs"
605145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
605245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
605345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Install the pseudo-library for information purposes.
605445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
605545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	instname="$dir/$name"i
605645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$show "$install_prog $instname $destdir/$name"
605745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$run eval "$install_prog $instname $destdir/$name" || exit $?
605845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
605945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Maybe install the static library, too.
606045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
606145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
606245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
606345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *.lo)
606445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Install (i.e. copy) a libtool object.
606545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
606645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Figure out destination file name, if it wasn't already specified.
606745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$destname"; then
606845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  destfile="$destdir/$destname"
606945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
607045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
607145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  destfile="$destdir/$destfile"
607245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
607345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
607445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Deduce the name of the destination old-style object file.
607545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $destfile in
607645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*.lo)
607745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
607845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
607945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*.$objext)
608045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  staticdest="$destfile"
608145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  destfile=
608245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
608345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*)
608445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
608545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$help" 1>&2
608645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
608745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
608845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
608945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
609045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Install the libtool object if requested.
609145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$destfile"; then
609245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $show "$install_prog $file $destfile"
609345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $run eval "$install_prog $file $destfile" || exit $?
609445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
609545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
609645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Install the old object if enabled.
609745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$build_old_libs" = yes; then
609845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Deduce the name of the old-style object file.
609945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
610045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
610145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $show "$install_prog $staticobj $staticdest"
610245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
610345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
610445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit $EXIT_SUCCESS
610545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
610645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
610745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *)
610845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Figure out destination file name, if it wasn't already specified.
610945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$destname"; then
611045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  destfile="$destdir/$destname"
611145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
611245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
611345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  destfile="$destdir/$destfile"
611445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
611545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
611645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# If the file is missing, and there is a .exe on the end, strip it
611745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# because it is most likely a libtool script we actually want to
611845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# install
611945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	stripped_ext=""
612045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $file in
612145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *.exe)
612245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test ! -f "$file"; then
612345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      file=`$echo $file|${SED} 's,.exe$,,'`
612445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      stripped_ext=".exe"
612545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
612645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
612745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
612845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
612945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Do a test to see if this is really a libtool program.
613045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $host in
613145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*cygwin*|*mingw*)
613245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
613345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
613445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*)
613545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    wrapper=$file
613645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
613745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
613845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
613945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  notinst_deplibs=
614045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  relink_command=
614145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
614245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Note that it is not necessary on cygwin/mingw to append a dot to
614345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
614445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
614545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # `FILE.' does not work on cygwin managed mounts.
614645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  #
614745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # If there is no directory component, then add one.
614845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $wrapper in
614945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  */* | *\\*) . ${wrapper} ;;
615045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *) . ./${wrapper} ;;
615145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
615245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
615345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Check the variables that should have been set.
615445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -z "$notinst_deplibs"; then
615545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
615645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    exit $EXIT_FAILURE
615745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
615845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
615945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  finalize=yes
616045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for lib in $notinst_deplibs; do
616145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Check to see that each library is installed.
616245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    libdir=
616345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -f "$lib"; then
616445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # If there is no directory component, then add one.
616545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      case $lib in
616645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      */* | *\\*) . $lib ;;
616745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      *) . ./$lib ;;
616845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      esac
616945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
617045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
617145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -n "$libdir" && test ! -f "$libfile"; then
617245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
617345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      finalize=no
617445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
617545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
617645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
617745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  relink_command=
617845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Note that it is not necessary on cygwin/mingw to append a dot to
617945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
618045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
618145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # `FILE.' does not work on cygwin managed mounts.
618245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  #
618345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # If there is no directory component, then add one.
618445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $wrapper in
618545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  */* | *\\*) . ${wrapper} ;;
618645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *) . ./${wrapper} ;;
618745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
618845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
618945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  outputname=
619045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test "$fast_install" = no && test -n "$relink_command"; then
619145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$finalize" = yes && test -z "$run"; then
619245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      tmpdir=`func_mktempdir`
619345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
619445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      outputname="$tmpdir/$file"
619545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # Replace the output file specification.
619645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
619745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
619845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $show "$relink_command"
619945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      if $run eval "$relink_command"; then :
620045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      else
620145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
620245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		${rm}r "$tmpdir"
620345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		continue
620445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      fi
620545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      file="$outputname"
620645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    else
620745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
620845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
620945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  else
621045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # Install the binary that we compiled earlier.
621145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
621245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
621345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
621445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
621545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# remove .exe since cygwin /usr/bin/install will append another
621645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# one anyway 
621745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $install_prog,$host in
621845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*/usr/bin/install*,*cygwin*)
621945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $file:$destfile in
622045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *.exe:*.exe)
622145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # this is ok
622245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
622345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *.exe:*)
622445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    destfile=$destfile.exe
622545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
622645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *:*.exe)
622745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
622845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
622945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
623045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  ;;
623145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
623245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$show "$install_prog$stripme $file $destfile"
623345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
623445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	test -n "$outputname" && ${rm}r "$tmpdir"
623545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
623645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
623745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    done
623845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
623945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    for file in $staticlibs; do
624045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
624145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
624245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Set up the ranlib parameters.
624345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      oldlib="$destdir/$name"
624445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
624545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $show "$install_prog $file $oldlib"
624645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $run eval "$install_prog \$file \$oldlib" || exit $?
624745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
624845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$stripme" && test -n "$old_striplib"; then
624945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$show "$old_striplib $oldlib"
625045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$run eval "$old_striplib $oldlib" || exit $?
625145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
625245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
625345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Do each command in the postinstall commands.
625445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      cmds=$old_postinstall_cmds
625545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      save_ifs="$IFS"; IFS='~'
625645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for cmd in $cmds; do
625745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	IFS="$save_ifs"
625845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	eval cmd=\"$cmd\"
625945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$show "$cmd"
626045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$run eval "$cmd" || exit $?
626145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
626245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      IFS="$save_ifs"
626345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    done
626445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
626545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -n "$future_libdirs"; then
626645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
626745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
626845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
626945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -n "$current_libdirs"; then
627045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Maybe just do a dry run.
627145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      test -n "$run" && current_libdirs=" -n$current_libdirs"
627245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
627345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    else
627445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit $EXIT_SUCCESS
627545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
627645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
627745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
627845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # libtool finish mode
627945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  finish)
628045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    modename="$modename: finish"
628145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    libdirs="$nonopt"
628245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    admincmds=
628345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
628445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
628545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for dir
628645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      do
628745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	libdirs="$libdirs $dir"
628845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
628945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
629045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      for libdir in $libdirs; do
629145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$finish_cmds"; then
629245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Do each command in the finish commands.
629345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  cmds=$finish_cmds
629445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  save_ifs="$IFS"; IFS='~'
629545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for cmd in $cmds; do
629645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    IFS="$save_ifs"
629745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    eval cmd=\"$cmd\"
629845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $show "$cmd"
629945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    $run eval "$cmd" || admincmds="$admincmds
630045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org       $cmd"
630145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
630245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  IFS="$save_ifs"
630345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
630445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -n "$finish_eval"; then
630545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Do the single finish_eval.
630645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  eval cmds=\"$finish_eval\"
630745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $run eval "$cmds" || admincmds="$admincmds
630845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org       $cmds"
630945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
631045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      done
631145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
631245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
631345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Exit here if they wanted silent mode.
631445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    test "$show" = : && exit $EXIT_SUCCESS
631545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
631645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "X----------------------------------------------------------------------" | $Xsed
631745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "Libraries have been installed in:"
631845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    for libdir in $libdirs; do
631945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "   $libdir"
632045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    done
632145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo
632245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "If you ever happen to want to link against installed libraries"
632345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "in a given directory, LIBDIR, you must either use libtool, and"
632445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
632545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "flag during linking and do at least one of the following:"
632645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -n "$shlibpath_var"; then
632745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
632845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "     during execution"
632945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
633045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -n "$runpath_var"; then
633145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
633245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "     during linking"
633345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
633445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -n "$hardcode_libdir_flag_spec"; then
633545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      libdir=LIBDIR
633645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      eval flag=\"$hardcode_libdir_flag_spec\"
633745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
633845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "   - use the \`$flag' linker flag"
633945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
634045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -n "$admincmds"; then
634145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "   - have your system administrator run these commands:$admincmds"
634245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
634345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -f /etc/ld.so.conf; then
634445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
634545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
634645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo
634745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "See any operating system documentation about shared libraries for"
634845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
634945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "X----------------------------------------------------------------------" | $Xsed
635045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    exit $EXIT_SUCCESS
635145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
635245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
635345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # libtool execute mode
635445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  execute)
635545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    modename="$modename: execute"
635645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
635745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # The first argument is the command name.
635845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    cmd="$nonopt"
635945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -z "$cmd"; then
636045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$modename: you must specify a COMMAND" 1>&2
636145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$help"
636245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit $EXIT_FAILURE
636345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
636445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
636545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Handle -dlopen flags immediately.
636645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    for file in $execute_dlfiles; do
636745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test ! -f "$file"; then
636845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: \`$file' is not a file" 1>&2
636945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$help" 1>&2
637045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit $EXIT_FAILURE
637145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
637245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
637345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      dir=
637445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $file in
637545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *.la)
637645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Check to see that this really is a libtool archive.
637745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
637845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
637945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
638045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$help" 1>&2
638145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
638245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
638345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
638445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Read the libtool library.
638545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	dlname=
638645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	library_names=
638745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
638845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# If there is no directory component, then add one.
638945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case $file in
639045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*/* | *\\*) . $file ;;
639145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	*) . ./$file ;;
639245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
639345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
639445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Skip this library if it cannot be dlopened.
639545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -z "$dlname"; then
639645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Warn if it was a shared library.
639745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
639845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  continue
639945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
640045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
640145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
640245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	test "X$dir" = "X$file" && dir=.
640345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
640445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test -f "$dir/$objdir/$dlname"; then
640545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  dir="$dir/$objdir"
640645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	else
640745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
640845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  exit $EXIT_FAILURE
640945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
641045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
641145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
641245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *.lo)
641345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Just add the directory containing the .lo file.
641445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
641545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	test "X$dir" = "X$file" && dir=.
641645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
641745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
641845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *)
641945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
642045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
642145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
642245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
642345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
642445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Get the absolute pathname.
642545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      absdir=`cd "$dir" && pwd`
642645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      test -n "$absdir" && dir="$absdir"
642745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
642845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Now add the directory to shlibpath_var.
642945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if eval "test -z \"\$$shlibpath_var\""; then
643045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	eval "$shlibpath_var=\"\$dir\""
643145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      else
643245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
643345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
643445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    done
643545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
643645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # This variable tells wrapper scripts just to set shlibpath_var
643745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # rather than running their programs.
643845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    libtool_execute_magic="$magic"
643945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
644045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Check if any of the arguments is a wrapper script.
644145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    args=
644245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    for file
644345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    do
644445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $file in
644545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -*) ;;
644645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *)
644745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Do a test to see if this is really a libtool program.
644845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
644945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # If there is no directory component, then add one.
645045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $file in
645145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  */* | *\\*) . $file ;;
645245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *) . ./$file ;;
645345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
645445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
645545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Transform arg to wrapped name.
645645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  file="$progdir/$program"
645745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
645845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
645945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
646045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Quote arguments (to preserve shell metacharacters).
646145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
646245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      args="$args \"$file\""
646345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    done
646445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
646545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -z "$run"; then
646645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$shlibpath_var"; then
646745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Export the shlibpath_var.
646845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	eval "export $shlibpath_var"
646945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
647045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
647145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Restore saved environment variables
647245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "${save_LC_ALL+set}" = set; then
647345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	LC_ALL="$save_LC_ALL"; export LC_ALL
647445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
647545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "${save_LANG+set}" = set; then
647645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	LANG="$save_LANG"; export LANG
647745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
647845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
647945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Now prepare to actually exec the command.
648045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exec_cmd="\$cmd$args"
648145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    else
648245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Display what would be done.
648345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -n "$shlibpath_var"; then
648445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
648545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$echo "export $shlibpath_var"
648645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
648745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$cmd$args"
648845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit $EXIT_SUCCESS
648945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
649045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
649145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
649245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  # libtool clean and uninstall mode
649345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  clean | uninstall)
649445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    modename="$modename: $mode"
649545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    rm="$nonopt"
649645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    files=
649745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    rmforce=
649845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    exit_status=0
649945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
650045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # This variable tells wrapper scripts just to set variables rather
650145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # than running their programs.
650245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    libtool_install_magic="$magic"
650345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
650445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    for arg
650545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    do
650645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $arg in
650745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -f) rm="$rm $arg"; rmforce=yes ;;
650845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      -*) rm="$rm $arg" ;;
650945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *) files="$files $arg" ;;
651045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
651145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    done
651245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
651345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    if test -z "$rm"; then
651445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$modename: you must specify an RM program" 1>&2
651545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $echo "$help" 1>&2
651645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      exit $EXIT_FAILURE
651745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    fi
651845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
651945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    rmdirs=
652045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
652145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    origobjdir="$objdir"
652245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    for file in $files; do
652345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
652445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "X$dir" = "X$file"; then
652545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	dir=.
652645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	objdir="$origobjdir"
652745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      else
652845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	objdir="$dir/$origobjdir"
652945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
653045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
653145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      test "$mode" = uninstall && objdir="$dir"
653245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
653345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Remember objdir for removal later, being careful to avoid duplicates
653445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test "$mode" = clean; then
653545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	case " $rmdirs " in
653645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *" $objdir "*) ;;
653745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *) rmdirs="$rmdirs $objdir" ;;
653845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	esac
653945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
654045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
654145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      # Don't error if the file doesn't exist and rm -f was used.
654245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if (test -L "$file") >/dev/null 2>&1 \
654345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	|| (test -h "$file") >/dev/null 2>&1 \
654445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	|| test -f "$file"; then
654545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	:
654645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      elif test -d "$file"; then
654745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	exit_status=1
654845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
654945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      elif test "$rmforce" = yes; then
655045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	continue
655145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
655245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
655345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      rmfiles="$file"
655445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
655545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      case $name in
655645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *.la)
655745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Possibly a libtool archive, so verify it.
655845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
655945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  . $dir/$name
656045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
656145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Delete the libtool libraries and symlinks.
656245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  for n in $library_names; do
656345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    rmfiles="$rmfiles $objdir/$n"
656445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  done
656545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
656645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
656745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case "$mode" in
656845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  clean)
656945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    case "  $library_names " in
657045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # "  " in the beginning catches empty $dlname
657145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *" $dlname "*) ;;
657245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
657345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    esac
657445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
657545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
657645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  uninstall)
657745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -n "$library_names"; then
657845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # Do each command in the postuninstall commands.
657945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      cmds=$postuninstall_cmds
658045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      save_ifs="$IFS"; IFS='~'
658145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      for cmd in $cmds; do
658245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		IFS="$save_ifs"
658345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		eval cmd=\"$cmd\"
658445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$show "$cmd"
658545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$run eval "$cmd"
658645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if test "$?" -ne 0 && test "$rmforce" != yes; then
658745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  exit_status=1
658845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi
658945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      done
659045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      IFS="$save_ifs"
659145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
659245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
659345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test -n "$old_library"; then
659445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      # Do each command in the old_postuninstall commands.
659545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      cmds=$old_postuninstall_cmds
659645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      save_ifs="$IFS"; IFS='~'
659745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      for cmd in $cmds; do
659845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		IFS="$save_ifs"
659945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		eval cmd=\"$cmd\"
660045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$show "$cmd"
660145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		$run eval "$cmd"
660245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		if test "$?" -ne 0 && test "$rmforce" != yes; then
660345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		  exit_status=1
660445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		fi
660545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      done
660645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      IFS="$save_ifs"
660745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
660845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # FIXME: should reinstall the best remaining shared library.
660945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
661045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
661145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
661245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
661345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
661445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *.lo)
661545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	# Possibly a libtool object, so verify it.
661645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
661745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
661845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Read the .lo file
661945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  . $dir/$name
662045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
662145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Add PIC object to the list of files to remove.
662245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$pic_object" \
662345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	     && test "$pic_object" != none; then
662445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    rmfiles="$rmfiles $dir/$pic_object"
662545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
662645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
662745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Add non-PIC object to the list of files to remove.
662845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if test -n "$non_pic_object" \
662945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	     && test "$non_pic_object" != none; then
663045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    rmfiles="$rmfiles $dir/$non_pic_object"
663145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
663245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
663345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
663445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
663545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      *)
663645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	if test "$mode" = clean ; then
663745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  noexename=$name
663845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  case $file in
663945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  *.exe)
664045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    file=`$echo $file|${SED} 's,.exe$,,'`
664145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    noexename=`$echo $name|${SED} 's,.exe$,,'`
664245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # $file with .exe has already been added to rmfiles,
664345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # add $file without .exe
664445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    rmfiles="$rmfiles $file"
664545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    ;;
664645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  esac
664745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  # Do a test to see if this is a libtool program.
664845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
664945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    relink_command=
665045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    . $dir/$noexename
665145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
665245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # note $name still contains .exe if it was in $file originally
665345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    # as does the version of $file that was added into $rmfiles
665445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
665545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "$fast_install" = yes && test -n "$relink_command"; then
665645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      rmfiles="$rmfiles $objdir/lt-$name"
665745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
665845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    if test "X$noexename" != "X$name" ; then
665945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
666045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	    fi
666145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	  fi
666245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	fi
666345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	;;
666445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      esac
666545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $show "$rm $rmfiles"
666645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      $run $rm $rmfiles || exit_status=1
666745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    done
666845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    objdir="$origobjdir"
666945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
667045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    # Try to remove the ${objdir}s in the directories where we deleted files
667145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    for dir in $rmdirs; do
667245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      if test -d "$dir"; then
667345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$show "rmdir $dir"
667445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org	$run rmdir $dir >/dev/null 2>&1
667545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      fi
667645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    done
667745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
667845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    exit $exit_status
667945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
668045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
668145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  "")
668245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "$modename: you must specify a MODE" 1>&2
668345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "$generic_help" 1>&2
668445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    exit $EXIT_FAILURE
668545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    ;;
668645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  esac
668745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
668845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  if test -z "$exec_cmd"; then
668945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "$modename: invalid operation mode \`$mode'" 1>&2
669045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    $echo "$generic_help" 1>&2
669145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    exit $EXIT_FAILURE
669245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  fi
669345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgfi # test -z "$show_help"
669445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
669545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgif test -n "$exec_cmd"; then
669645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  eval exec $exec_cmd
669745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  exit $EXIT_FAILURE
669845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgfi
669945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
670045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# We need to display help for each of the modes.
670145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgcase $mode in
670245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"") $echo \
670345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"Usage: $modename [OPTION]... [MODE-ARG]...
670445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
670545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgProvide generalized library-building support services.
670645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
670745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    --config          show all configuration variables
670845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    --debug           enable verbose shell tracing
670945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org-n, --dry-run         display commands without modifying any files
671045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    --features        display basic configuration information and exit
671145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    --finish          same as \`--mode=finish'
671245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    --help            display this help message and exit
671345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
671445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    --quiet           same as \`--silent'
671545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    --silent          don't print informational messages
671645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    --tag=TAG         use configuration variables from tag TAG
671745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org    --version         print version information
671845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
671945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgMODE must be one of the following:
672045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
672145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      clean           remove files from the build directory
672245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      compile         compile a source file into a libtool object
672345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      execute         automatically set library path, then run a program
672445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      finish          complete the installation of libtool libraries
672545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      install         install libraries or executables
672645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      link            create a library or an executable
672745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org      uninstall       remove libraries from an installed directory
672845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
672945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgMODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
673045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orga more detailed description of MODE.
673145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
673245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgReport bugs to <bug-libtool@gnu.org>."
673345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  exit $EXIT_SUCCESS
673445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  ;;
673545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
673645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgclean)
673745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  $echo \
673845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
673945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
674045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgRemove files from the build directory.
674145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
674245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgRM is the name of the program to use to delete files associated with each FILE
674345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
674445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgto RM.
674545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
674645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgIf FILE is a libtool library, object or program, all the files associated
674745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgwith it are deleted. Otherwise, only FILE itself is deleted using RM."
674845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  ;;
674945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
675045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgcompile)
675145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  $echo \
675245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
675345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
675445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgCompile a source file into a libtool library object.
675545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
675645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgThis mode accepts the following additional options:
675745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
675845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
675945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -prefer-pic       try to building PIC objects only
676045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -prefer-non-pic   try to building non-PIC objects only
676145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -static           always build a \`.o' file suitable for static linking
676245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
676345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file
676445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgfrom the given SOURCEFILE.
676545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
676645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgThe output file name is determined by removing the directory component from
676745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgSOURCEFILE, then substituting the C source code suffix \`.c' with the
676845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orglibrary object suffix, \`.lo'."
676945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  ;;
677045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
677145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgexecute)
677245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  $echo \
677345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
677445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
677545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgAutomatically set library path, then run a program.
677645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
677745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgThis mode accepts the following additional options:
677845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
677945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -dlopen FILE      add the directory containing FILE to the library path
678045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
678145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgThis mode sets the library path environment variable according to \`-dlopen'
678245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgflags.
678345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
678445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgIf any of the ARGS are libtool executable wrappers, then they are translated
678545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orginto their corresponding uninstalled binary, and any of their required library
678645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgdirectories are added to the library path.
678745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
678845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgThen, COMMAND is executed, with ARGS as arguments."
678945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  ;;
679045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
679145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgfinish)
679245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  $echo \
679345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
679445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
679545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgComplete the installation of libtool libraries.
679645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
679745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgEach LIBDIR is a directory that contains libtool libraries.
679845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
679945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgThe commands that this mode executes may require superuser privileges.  Use
680045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgthe \`--dry-run' option if you just want to see what would be executed."
680145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  ;;
680245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
680345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orginstall)
680445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  $echo \
680545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
680645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
680745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgInstall executables or libraries.
680845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
680945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgINSTALL-COMMAND is the installation command.  The first component should be
681045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgeither the \`install' or \`cp' program.
681145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
681245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgThe rest of the components are interpreted as arguments to that command (only
681345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgBSD-compatible install options are recognized)."
681445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  ;;
681545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
681645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orglink)
681745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  $echo \
681845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
681945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
682045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgLink object files or libraries together to form another library, or to
682145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgcreate an executable program.
682245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
682345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgLINK-COMMAND is a command using the C compiler that you would use to create
682445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orga program from several object files.
682545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
682645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgThe following components of LINK-COMMAND are treated specially:
682745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
682845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -all-static       do not do any dynamic linking at all
682945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -avoid-version    do not add a version suffix if possible
683045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
683145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
683245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
683345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -export-symbols SYMFILE
683445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    try to export only the symbols listed in SYMFILE
683545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -export-symbols-regex REGEX
683645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    try to export only the symbols matching REGEX
683745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -LLIBDIR          search LIBDIR for required installed libraries
683845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -lNAME            OUTPUT-FILE requires the installed library libNAME
683945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -module           build a library that can dlopened
684045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -no-fast-install  disable the fast-install mode
684145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -no-install       link a not-installable executable
684245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -no-undefined     declare that a library does not refer to external symbols
684345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
684445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -objectlist FILE  Use a list of object files found in FILE to specify objects
684545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -precious-files-regex REGEX
684645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org                    don't remove output files matching REGEX
684745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -release RELEASE  specify package release information
684845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
684945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
685045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -static           do not do any dynamic linking of libtool libraries
685145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  -version-info CURRENT[:REVISION[:AGE]]
685245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org		    specify library version info [each variable defaults to 0]
685345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
685445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgAll other options (arguments beginning with \`-') are ignored.
685545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
685645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgEvery other argument is treated as a filename.  Files ending in \`.la' are
685745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgtreated as uninstalled libtool libraries, other files are standard or library
685845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgobject files.
685945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
686045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created,
686145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgonly library objects (\`.lo' files) may be specified, and \`-rpath' is
686245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgrequired, except when creating a convenience library.
686345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
686445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
686545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgusing \`ar' and \`ranlib', or on Windows using \`lib'.
686645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
686745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
686845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgis created, otherwise an executable program is created."
686945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  ;;
687045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
687145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orguninstall)
687245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  $echo \
687345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
687445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
687545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgRemove libraries from an installation directory.
687645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
687745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgRM is the name of the program to use to delete files associated with each FILE
687845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
687945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgto RM.
688045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
688145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgIf FILE is a libtool library, all the files associated with it are deleted.
688245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgOtherwise, only FILE itself is deleted using RM."
688345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  ;;
688445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
688545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org*)
688645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  $echo "$modename: invalid operation mode \`$mode'" 1>&2
688745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  $echo "$help" 1>&2
688845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  exit $EXIT_FAILURE
688945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org  ;;
689045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgesac
689145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
689245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org$echo
689345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org$echo "Try \`$modename --help' for more information about other modes."
689445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
689545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgexit $?
689645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
689745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# The TAGs below are defined such that we never get into a situation
689845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# in which we disable both kinds of libraries.  Given conflicting
689945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# choices, we go for a static library, that is the most portable,
690045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# since we can't tell whether shared libraries were disabled because
690145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# the user asked for that or because the platform doesn't support
690245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# them.  This is particularly important on AIX, because we don't
690345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# support having both static and shared libraries enabled at the same
690445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# time on that platform, so we default to a shared-only configuration.
690545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# If a disable-shared tag is given, we'll fallback to a static-only
690645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# configuration.  But we'll never go from static-only to shared-only.
690745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
690845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
690945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgdisable_libs=shared
691045afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# ### END LIBTOOL TAG CONFIG: disable-shared
691145afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
691245afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# ### BEGIN LIBTOOL TAG CONFIG: disable-static
691345afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.orgdisable_libs=static
691445afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# ### END LIBTOOL TAG CONFIG: disable-static
691545afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org
691645afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# Local Variables:
691745afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# mode:shell-script
691845afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# sh-indentation:2
691945afe016bed87b9c6946184709058b39ede3f77ajwong@chromium.org# End:
6920