166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# ltmain.sh - Provide generalized library-building support services.
266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# NOTE: Changing this file will not affect anything until you rerun configure.
366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#
466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Free Software Foundation, Inc.
666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#
866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# This program is free software; you can redistribute it and/or modify
966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# it under the terms of the GNU General Public License as published by
1066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# the Free Software Foundation; either version 2 of the License, or
1166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# (at your option) any later version.
1266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#
1366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# This program is distributed in the hope that it will be useful, but
1466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# WITHOUT ANY WARRANTY; without even the implied warranty of
1566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# General Public License for more details.
1766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#
1866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# You should have received a copy of the GNU General Public License
1966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# along with this program; if not, write to the Free Software
2066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#
2266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# As a special exception to the GNU General Public License, if you
2366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# distribute this file as part of a program that contains a
2466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# configuration script generated by Autoconf, you may include it under
2566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# the same distribution terms that you use for the rest of that program.
2666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
2766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanbasename="s,^.*/,,g"
2866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
2966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
3066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# is ksh but when the shell is invoked as "sh" and the current value of
3166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# the _XPG environment variable is not equal to 1 (one), the special
3266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# positional parameter $0, within a function call, is the name of the
3366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# function.
3466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanprogpath="$0"
3566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
3666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# The name of this program:
3766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanprogname=`echo "$progpath" | $SED $basename`
3866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanmodename="$progname"
3966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
4066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Global variables:
4166b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanEXIT_SUCCESS=0
4266b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanEXIT_FAILURE=1
4366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
4466b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanPROGRAM=ltmain.sh
4566b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanPACKAGE=libtool
4666b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanVERSION=1.5.22
4766b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanTIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
4866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
4966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# See if we are running on zsh, and set the options which allow our
5066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# commands through without removal of \ escapes.
5166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanif test -n "${ZSH_VERSION+set}" ; then
5266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  setopt NO_GLOB_SUBST
5366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanfi
5466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
5566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Check that we have a working $echo.
5666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanif test "X$1" = X--no-reexec; then
5766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # Discard the --no-reexec flag, and continue.
5866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  shift
5966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanelif test "X$1" = X--fallback-echo; then
6066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # Avoid inline document here, it may be left over
6166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  :
6266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
6366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # Yippee, $echo works!
6466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  :
6566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanelse
6666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # Restart under the correct shell, and then maybe $echo will work.
6766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
6866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanfi
6966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
7066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanif test "X$1" = X--fallback-echo; then
7166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # used as fallback echo
7266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  shift
7366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  cat <<EOF
7466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman$*
7566b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanEOF
7666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  exit $EXIT_SUCCESS
7766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanfi
7866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
7966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumandefault_mode=
8066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanhelp="Try \`$progname --help' for more information."
8166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanmagic="%%%MAGIC variable%%%"
8266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanmkdir="mkdir"
8366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanmv="mv -f"
8466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanrm="rm -f"
8566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
8666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Sed substitution that helps us do robust quoting.  It backslashifies
8766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# metacharacters that are still active within double-quoted strings.
8866b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanXsed="${SED}"' -e 1s/^X//'
8966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumansed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
9066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# test EBCDIC or ASCII
9166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumancase `echo X|tr X '\101'` in
9266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman A) # ASCII based system
9366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
9466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  SP2NL='tr \040 \012'
9566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  NL2SP='tr \015\012 \040\040'
9666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  ;;
9766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman *) # EBCDIC based system
9866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  SP2NL='tr \100 \n'
9966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  NL2SP='tr \r\n \100\100'
10066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  ;;
10166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanesac
10266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
10366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# NLS nuisances.
10466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Only set LANG and LC_ALL to C if already set.
10566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# These must not be set unconditionally because not all systems understand
10666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# e.g. LANG=C (notably SCO).
10766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# We save the old values to restore during execute mode.
10866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanif test "${LC_ALL+set}" = set; then
10966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
11066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanfi
11166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanif test "${LANG+set}" = set; then
11266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  save_LANG="$LANG"; LANG=C; export LANG
11366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanfi
11466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
11566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Make sure IFS has a sensible default
11666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanlt_nl='
11766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman'
11866b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanIFS=" 	$lt_nl"
11966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
12066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
12166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  $echo "$modename: not configured to build any kind of library" 1>&2
12266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
12366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  exit $EXIT_FAILURE
12466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanfi
12566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
12666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Global variables.
12766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanmode=$default_mode
12866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumannonopt=
12966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanprev=
13066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanprevopt=
13166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanrun=
13266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanshow="$echo"
13366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanshow_help=
13466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanexecute_dlfiles=
13566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanduplicate_deps=no
13666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanpreserve_args=
13766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanlo2o="s/\\.lo\$/.${objext}/"
13866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumano2lo="s/\\.${objext}\$/.lo/"
13966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
14066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#####################################
14166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Shell function definitions:
14266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# This seems to be the best place for them
14366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
14466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# func_mktempdir [string]
14566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Make a temporary directory that won't clash with other running
14666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# libtool processes, and avoids race conditions if possible.  If
14766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# given, STRING is the basename for that directory.
14866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanfunc_mktempdir ()
14966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman{
15066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    my_template="${TMPDIR-/tmp}/${1-$progname}"
15166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
15266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test "$run" = ":"; then
15366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Return a directory name, but don't create it in dry-run mode
15466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      my_tmpdir="${my_template}-$$"
15566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    else
15666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
15766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # If mktemp works, use that first and foremost
15866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
15966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
16066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test ! -d "$my_tmpdir"; then
16166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Failing that, at least try and use $RANDOM to avoid a race
16266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	my_tmpdir="${my_template}-${RANDOM-0}$$"
16366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
16466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	save_mktempdir_umask=`umask`
16566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	umask 0077
16666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$mkdir "$my_tmpdir"
16766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	umask $save_mktempdir_umask
16866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
16966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
17066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # If we're not in dry-run mode, bomb out on failure
17166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      test -d "$my_tmpdir" || {
17266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
17366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit $EXIT_FAILURE
17466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      }
17566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
17666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
17766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "X$my_tmpdir" | $Xsed
17866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman}
17966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
18066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
18166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# func_win32_libid arg
18266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# return the library type of file 'arg'
18366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#
18466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Need a lot of goo to handle *both* DLLs and import libs
18566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Has to be a shell function in order to 'eat' the argument
18666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# that is supplied when $file_magic_command is called.
18766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanfunc_win32_libid ()
18866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman{
18966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  win32_libid_type="unknown"
19066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  win32_fileres=`file -L $1 2>/dev/null`
19166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  case $win32_fileres in
19266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  *ar\ archive\ import\ library*) # definitely import
19366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    win32_libid_type="x86 archive import"
19466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
19566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  *ar\ archive*) # could be an import, or static
19666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
19766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
19866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      win32_nmres=`eval $NM -f posix -A $1 | \
19966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
20066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $win32_nmres in
20166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      import*)  win32_libid_type="x86 archive import";;
20266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *)        win32_libid_type="x86 archive static";;
20366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
20466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
20566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
20666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  *DLL*)
20766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    win32_libid_type="x86 DLL"
20866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
20966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  *executable*) # but shell scripts are "executable" too...
21066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    case $win32_fileres in
21166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *MS\ Windows\ PE\ Intel*)
21266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      win32_libid_type="x86 DLL"
21366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
21466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    esac
21566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
21666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  esac
21766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  $echo $win32_libid_type
21866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman}
21966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
22066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
22166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# func_infer_tag arg
22266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Infer tagged configuration to use if any are available and
22366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# if one wasn't chosen via the "--tag" command line option.
22466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Only attempt this if the compiler in the base compile
22566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# command doesn't match the default compiler.
22666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# arg is usually of the form 'gcc ...'
22766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanfunc_infer_tag ()
22866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman{
22966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -n "$available_tags" && test -z "$tagname"; then
23066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      CC_quoted=
23166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for arg in $CC; do
23266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $arg in
23366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
23466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  arg="\"$arg\""
23566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
23666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
23766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	CC_quoted="$CC_quoted $arg"
23866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
23966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $@ in
24066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Blanks in the command may have been stripped by the calling shell,
24166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # but not from the CC environment variable when configure was run.
24266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
24366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Blanks at the start of $base_compile will cause this to fail
24466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # if we don't check for them as well.
24566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *)
24666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	for z in $available_tags; do
24766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
24866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Evaluate the configuration.
24966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
25066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    CC_quoted=
25166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for arg in $CC; do
25266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Double-quote args containing other shell metacharacters.
25366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case $arg in
25466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
25566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      arg="\"$arg\""
25666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      ;;
25766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac
25866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    CC_quoted="$CC_quoted $arg"
25966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
26066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case "$@ " in
26166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
26266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # The compiler in the base compile command matches
26366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # the one in the tagged configuration.
26466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # Assume this is the tagged configuration we want.
26566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      tagname=$z
26666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      break
26766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      ;;
26866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac
26966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
27066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	done
27166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# If $tagname still isn't set, then no tagged configuration
27266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# was found and let the user know that the "--tag" command
27366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# line option must be used.
27466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -z "$tagname"; then
27566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: unable to infer tagged configuration"
27666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: specify a tag with \`--tag'" 1>&2
27766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
27866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#        else
27966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#          $echo "$modename: using $tagname tagged configuration"
28066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
28166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
28266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
28366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
28466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman}
28566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
28666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
28766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# func_extract_an_archive dir oldlib
28866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanfunc_extract_an_archive ()
28966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman{
29066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    f_ex_an_ar_dir="$1"; shift
29166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    f_ex_an_ar_oldlib="$1"
29266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
29366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
29466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
29566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
29666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman     :
29766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    else
29866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
29966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit $EXIT_FAILURE
30066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
30166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman}
30266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
30366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# func_extract_archives gentop oldlib ...
30466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanfunc_extract_archives ()
30566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman{
30666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    my_gentop="$1"; shift
30766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    my_oldlibs=${1+"$@"}
30866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    my_oldobjs=""
30966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    my_xlib=""
31066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    my_xabs=""
31166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    my_xdir=""
31266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    my_status=""
31366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
31466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $show "${rm}r $my_gentop"
31566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $run ${rm}r "$my_gentop"
31666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $show "$mkdir $my_gentop"
31766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $run $mkdir "$my_gentop"
31866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    my_status=$?
31966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
32066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit $my_status
32166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
32266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
32366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    for my_xlib in $my_oldlibs; do
32466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Extract the objects.
32566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $my_xlib in
32666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
32766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*) my_xabs=`pwd`"/$my_xlib" ;;
32866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
32966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
33066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      my_xdir="$my_gentop/$my_xlib"
33166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
33266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $show "${rm}r $my_xdir"
33366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $run ${rm}r "$my_xdir"
33466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $show "$mkdir $my_xdir"
33566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $run $mkdir "$my_xdir"
33666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit_status=$?
33766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
33866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit $exit_status
33966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
34066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $host in
34166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *-darwin*)
34266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$show "Extracting $my_xabs"
34366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Do not bother doing anything if just a dry run
34466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -z "$run"; then
34566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  darwin_orig_dir=`pwd`
34666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  cd $my_xdir || exit $?
34766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  darwin_archive=$my_xabs
34866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  darwin_curdir=`pwd`
34966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
35066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
35166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$darwin_arches"; then 
35266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
35366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    darwin_arch=
35466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
35566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for darwin_arch in  $darwin_arches ; do
35666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
35766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
35866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
35966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
36066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      cd "$darwin_curdir"
36166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
36266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done # $darwin_arches
36366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
36466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
36566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    darwin_file=
36666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    darwin_files=
36766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for darwin_file in $darwin_filelist; do
36866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
36966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      lipo -create -output "$darwin_file" $darwin_files
37066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done # $darwin_filelist
37166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ${rm}r unfat-$$
37266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    cd "$darwin_orig_dir"
37366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
37466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    cd "$darwin_orig_dir"
37566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman 	    func_extract_an_archive "$my_xdir" "$my_xabs"
37666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi # $darwin_arches
37766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi # $run
37866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
37966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *)
38066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        func_extract_an_archive "$my_xdir" "$my_xabs"
38166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        ;;
38266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
38366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
38466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    done
38566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    func_extract_archives_result="$my_oldobjs"
38666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman}
38766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# End of Shell function definitions
38866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#####################################
38966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
39066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Darwin sucks
39166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumaneval std_shrext=\"$shrext_cmds\"
39266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
39366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumandisable_libs=no
39466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
39566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Parse our command line options once, thoroughly.
39666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanwhile test "$#" -gt 0
39766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumando
39866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  arg="$1"
39966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  shift
40066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
40166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  case $arg in
40266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
40366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  *) optarg= ;;
40466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  esac
40566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
40666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # If the previous option needs an argument, assign it.
40766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if test -n "$prev"; then
40866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    case $prev in
40966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    execute_dlfiles)
41066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      execute_dlfiles="$execute_dlfiles $arg"
41166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
41266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    tag)
41366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      tagname="$arg"
41466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      preserve_args="${preserve_args}=$arg"
41566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
41666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Check whether tagname contains only valid characters
41766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $tagname in
41866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *[!-_A-Za-z0-9,/]*)
41966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$progname: invalid tag name: $tagname" 1>&2
42066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit $EXIT_FAILURE
42166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
42266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
42366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
42466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $tagname in
42566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      CC)
42666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Don't test for the "default" C tag, as we know, it's there, but
42766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# not specially marked.
42866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
42966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *)
43066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
43166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  taglist="$taglist $tagname"
43266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Evaluate the configuration.
43366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
43466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
43566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
43666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
43766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
43866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
43966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
44066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *)
44166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      eval "$prev=\$arg"
44266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
44366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    esac
44466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
44566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    prev=
44666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    prevopt=
44766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    continue
44866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  fi
44966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
45066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # Have we seen a non-optional argument yet?
45166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  case $arg in
45266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  --help)
45366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    show_help=yes
45466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
45566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
45666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  --version)
45766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
45866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo
45966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
46066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "This is free software; see the source for copying conditions.  There is NO"
46166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
46266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    exit $?
46366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
46466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
46566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  --config)
46666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
46766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Now print the configurations for the tags.
46866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    for tagname in $taglist; do
46966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
47066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    done
47166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    exit $?
47266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
47366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
47466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  --debug)
47566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "$progname: enabling shell trace mode"
47666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    set -x
47766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    preserve_args="$preserve_args $arg"
47866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
47966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
48066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  --dry-run | -n)
48166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    run=:
48266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
48366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
48466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  --features)
48566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "host: $host"
48666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test "$build_libtool_libs" = yes; then
48766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "enable shared libraries"
48866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    else
48966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "disable shared libraries"
49066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
49166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test "$build_old_libs" = yes; then
49266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "enable static libraries"
49366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    else
49466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "disable static libraries"
49566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
49666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    exit $?
49766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
49866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
49966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  --finish) mode="finish" ;;
50066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
50166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  --mode) prevopt="--mode" prev=mode ;;
50266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  --mode=*) mode="$optarg" ;;
50366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
50466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  --preserve-dup-deps) duplicate_deps="yes" ;;
50566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
50666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  --quiet | --silent)
50766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    show=:
50866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    preserve_args="$preserve_args $arg"
50966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
51066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
51166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  --tag)
51266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    prevopt="--tag"
51366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    prev=tag
51466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    preserve_args="$preserve_args --tag"
51566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
51666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  --tag=*)
51766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    set tag "$optarg" ${1+"$@"}
51866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    shift
51966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    prev=tag
52066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    preserve_args="$preserve_args --tag"
52166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
52266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
52366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -dlopen)
52466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    prevopt="-dlopen"
52566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    prev=execute_dlfiles
52666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
52766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
52866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -*)
52966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "$modename: unrecognized option \`$arg'" 1>&2
53066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "$help" 1>&2
53166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    exit $EXIT_FAILURE
53266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
53366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
53466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  *)
53566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    nonopt="$arg"
53666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    break
53766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
53866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  esac
53966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumandone
54066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
54166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanif test -n "$prevopt"; then
54266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
54366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  $echo "$help" 1>&2
54466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  exit $EXIT_FAILURE
54566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanfi
54666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
54766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumancase $disable_libs in
54866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanno) 
54966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  ;;
55066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanshared)
55166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  build_libtool_libs=no
55266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  build_old_libs=yes
55366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  ;;
55466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanstatic)
55566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
55666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  ;;
55766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanesac
55866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
55966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# If this variable is set in any of the actions, the command in it
56066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# will be execed at the end.  This prevents here-documents from being
56166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# left over by shells.
56266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanexec_cmd=
56366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
56466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanif test -z "$show_help"; then
56566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
56666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # Infer the operation mode.
56766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if test -z "$mode"; then
56866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
56966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
57066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    case $nonopt in
57166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
57266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      mode=link
57366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for arg
57466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      do
57566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $arg in
57666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	-c)
57766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	   mode=compile
57866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	   break
57966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	   ;;
58066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
58166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
58266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
58366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *db | *dbx | *strace | *truss)
58466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      mode=execute
58566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
58666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *install*|cp|mv)
58766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      mode=install
58866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
58966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *rm)
59066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      mode=uninstall
59166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
59266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *)
59366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # If we have no mode, but dlfiles were specified, then do execute mode.
59466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      test -n "$execute_dlfiles" && mode=execute
59566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
59666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Just use the default operation mode.
59766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -z "$mode"; then
59866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$nonopt"; then
59966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
60066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
60166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
60266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
60366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
60466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
60566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    esac
60666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  fi
60766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
60866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # Only execute mode is allowed to have -dlopen flags.
60966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if test -n "$execute_dlfiles" && test "$mode" != execute; then
61066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
61166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "$help" 1>&2
61266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    exit $EXIT_FAILURE
61366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  fi
61466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
61566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # Change the help message to a mode-specific one.
61666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  generic_help="$help"
61766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  help="Try \`$modename --help --mode=$mode' for more information."
61866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
61966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # These modes are in order of execution frequency so that they run quickly.
62066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  case $mode in
62166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # libtool compile mode
62266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  compile)
62366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    modename="$modename: compile"
62466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Get the compilation command and the source file.
62566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    base_compile=
62666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
62766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    suppress_opt=yes
62866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    suppress_output=
62966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    arg_mode=normal
63066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    libobj=
63166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    later=
63266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
63366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    for arg
63466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    do
63566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $arg_mode in
63666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      arg  )
63766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# do not "continue".  Instead, add this to base_compile
63866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	lastarg="$arg"
63966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	arg_mode=normal
64066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
64166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
64266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      target )
64366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	libobj="$arg"
64466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	arg_mode=normal
64566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
64666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
64766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
64866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      normal )
64966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Accept any command-line options.
65066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $arg in
65166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	-o)
65266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$libobj" ; then
65366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
65466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    exit $EXIT_FAILURE
65566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
65666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  arg_mode=target
65766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
65866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
65966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
66066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	-static | -prefer-pic | -prefer-non-pic)
66166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  later="$later $arg"
66266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
66366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
66466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
66566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	-no-suppress)
66666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  suppress_opt=no
66766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
66866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
66966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
67066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	-Xcompiler)
67166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
67266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue      #  The current "srcfile" will either be retained or
67366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;            #  replaced later.  I would guess that would be a bug.
67466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
67566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	-Wc,*)
67666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
67766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  lastarg=
67866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  save_ifs="$IFS"; IFS=','
67966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman 	  for arg in $args; do
68066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    IFS="$save_ifs"
68166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
68266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Double-quote args containing other shell metacharacters.
68366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Many Bourne shells cannot handle close brackets correctly
68466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # in scan sets, so we specify it separately.
68566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case $arg in
68666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
68766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      arg="\"$arg\""
68866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      ;;
68966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac
69066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    lastarg="$lastarg $arg"
69166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
69266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  IFS="$save_ifs"
69366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
69466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
69566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Add the arguments to base_compile.
69666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  base_compile="$base_compile $lastarg"
69766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
69866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
69966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
70066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	* )
70166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Accept the current argument as the source file.
70266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # The previous "srcfile" becomes the current argument.
70366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  #
70466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  lastarg="$srcfile"
70566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  srcfile="$arg"
70666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
70766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac  #  case $arg
70866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
70966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac    #  case $arg_mode
71066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
71166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Aesthetically quote the previous argument.
71266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
71366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
71466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $lastarg in
71566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Double-quote args containing other shell metacharacters.
71666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Many Bourne shells cannot handle close brackets correctly
71766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # in scan sets, and some SunOS ksh mistreat backslash-escaping
71866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # in scan sets (worked around with variable expansion),
71966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
72066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # at all, so we specify them separately.
72166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
72266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	lastarg="\"$lastarg\""
72366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
72466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
72566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
72666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      base_compile="$base_compile $lastarg"
72766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    done # for arg
72866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
72966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    case $arg_mode in
73066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    arg)
73166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$modename: you must specify an argument for -Xcompile"
73266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit $EXIT_FAILURE
73366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
73466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    target)
73566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$modename: you must specify a target with \`-o'" 1>&2
73666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit $EXIT_FAILURE
73766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
73866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *)
73966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Get the name of the library object.
74066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
74166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
74266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    esac
74366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
74466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Recognize several different file suffixes.
74566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # If the user specifies -o file.o, it is replaced with file.lo
74666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    xform='[cCFSifmso]'
74766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    case $libobj in
74866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *.ada) xform=ada ;;
74966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *.adb) xform=adb ;;
75066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *.ads) xform=ads ;;
75166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *.asm) xform=asm ;;
75266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *.c++) xform=c++ ;;
75366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *.cc) xform=cc ;;
75466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *.ii) xform=ii ;;
75566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *.class) xform=class ;;
75666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *.cpp) xform=cpp ;;
75766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *.cxx) xform=cxx ;;
75866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *.f90) xform=f90 ;;
75966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *.for) xform=for ;;
76066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *.java) xform=java ;;
76166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    esac
76266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
76366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
76466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
76566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    case $libobj in
76666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
76766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *)
76866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
76966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit $EXIT_FAILURE
77066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
77166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    esac
77266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
77366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    func_infer_tag $base_compile
77466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
77566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    for arg in $later; do
77666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $arg in
77766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -static)
77866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	build_old_libs=yes
77966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
78066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
78166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
78266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -prefer-pic)
78366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	pic_mode=yes
78466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
78566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
78666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
78766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -prefer-non-pic)
78866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	pic_mode=no
78966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
79066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
79166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
79266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    done
79366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
79466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
79566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    case $qlibobj in
79666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
79766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	qlibobj="\"$qlibobj\"" ;;
79866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    esac
79966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    test "X$libobj" != "X$qlibobj" \
80066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
80166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
80266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
80366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
80466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test "X$xdir" = "X$obj"; then
80566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      xdir=
80666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    else
80766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      xdir=$xdir/
80866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
80966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    lobj=${xdir}$objdir/$objname
81066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
81166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -z "$base_compile"; then
81266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$modename: you must specify a compilation command" 1>&2
81366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$help" 1>&2
81466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit $EXIT_FAILURE
81566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
81666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
81766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Delete any leftover library objects.
81866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test "$build_old_libs" = yes; then
81966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      removelist="$obj $lobj $libobj ${libobj}T"
82066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    else
82166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      removelist="$lobj $libobj ${libobj}T"
82266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
82366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
82466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $run $rm $removelist
82566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
82666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
82766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # On Cygwin there's no "real" PIC flag so we must build both object types
82866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    case $host_os in
82966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    cygwin* | mingw* | pw32* | os2*)
83066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      pic_mode=default
83166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
83266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    esac
83366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
83466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # non-PIC code in shared libraries is not supported
83566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      pic_mode=default
83666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
83766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
83866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Calculate the filename of the output object if compiler does
83966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # not support -o with -c
84066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test "$compiler_c_o" = no; then
84166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
84266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      lockfile="$output_obj.lock"
84366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      removelist="$removelist $output_obj $lockfile"
84466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
84566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    else
84666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      output_obj=
84766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      need_locks=no
84866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      lockfile=
84966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
85066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
85166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Lock this critical section if it is needed
85266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # We use this script file to make the link, it avoids creating a new file
85366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test "$need_locks" = yes; then
85466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
85566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$show "Waiting for $lockfile to be removed"
85666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	sleep 2
85766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
85866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    elif test "$need_locks" = warn; then
85966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -f "$lockfile"; then
86066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "\
86166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman*** ERROR, $lockfile exists and contains:
86266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman`cat $lockfile 2>/dev/null`
86366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
86466b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanThis indicates that another process is trying to use the same
86566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumantemporary object file, and libtool could not work around it because
86666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanyour compiler does not support \`-c' and \`-o' together.  If you
86766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanrepeat this compilation, it may succeed, by chance, but you had better
86866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanavoid parallel builds (make -j) in this platform, or get a better
86966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumancompiler."
87066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
87166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$run $rm $removelist
87266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit $EXIT_FAILURE
87366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
87466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$srcfile" > "$lockfile"
87566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
87666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
87766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -n "$fix_srcfile_path"; then
87866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      eval srcfile=\"$fix_srcfile_path\"
87966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
88066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
88166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    case $qsrcfile in
88266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
88366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      qsrcfile="\"$qsrcfile\"" ;;
88466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    esac
88566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
88666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $run $rm "$libobj" "${libobj}T"
88766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
88866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Create a libtool object file (analogous to a ".la" file),
88966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # but don't create it if we're doing a dry run.
89066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    test -z "$run" && cat > ${libobj}T <<EOF
89166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# $libobj - a libtool object file
89266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
89366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#
89466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Please DO NOT delete this file!
89566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# It is necessary for linking the library.
89666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
89766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Name of the PIC object.
89866b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanEOF
89966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
90066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Only build a PIC object if we are building libtool libraries.
90166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test "$build_libtool_libs" = yes; then
90266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Without this assignment, base_compile gets emptied.
90366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fbsd_hideous_sh_bug=$base_compile
90466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
90566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$pic_mode" != no; then
90666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	command="$base_compile $qsrcfile $pic_flag"
90766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      else
90866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Don't build PIC code
90966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	command="$base_compile $qsrcfile"
91066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
91166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
91266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test ! -d "${xdir}$objdir"; then
91366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$show "$mkdir ${xdir}$objdir"
91466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$run $mkdir ${xdir}$objdir
91566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit_status=$?
91666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
91766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $exit_status
91866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
91966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
92066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
92166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -z "$output_obj"; then
92266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Place PIC objects in $objdir
92366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	command="$command -o $lobj"
92466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
92566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
92666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $run $rm "$lobj" "$output_obj"
92766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
92866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $show "$command"
92966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if $run eval "$command"; then :
93066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      else
93166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	test -n "$output_obj" && $run $rm $removelist
93266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit $EXIT_FAILURE
93366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
93466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
93566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$need_locks" = warn &&
93666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
93766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "\
93866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman*** ERROR, $lockfile contains:
93966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman`cat $lockfile 2>/dev/null`
94066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
94166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanbut it should contain:
94266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman$srcfile
94366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
94466b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanThis indicates that another process is trying to use the same
94566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumantemporary object file, and libtool could not work around it because
94666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanyour compiler does not support \`-c' and \`-o' together.  If you
94766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanrepeat this compilation, it may succeed, by chance, but you had better
94866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanavoid parallel builds (make -j) in this platform, or get a better
94966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumancompiler."
95066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
95166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$run $rm $removelist
95266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit $EXIT_FAILURE
95366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
95466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
95566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Just move the object if needed, then go on to compile the next one
95666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
95766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$show "$mv $output_obj $lobj"
95866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if $run $mv $output_obj $lobj; then :
95966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
96066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  error=$?
96166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $run $rm $removelist
96266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $error
96366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
96466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
96566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
96666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Append the name of the PIC object to the libtool object file.
96766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      test -z "$run" && cat >> ${libobj}T <<EOF
96866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanpic_object='$objdir/$objname'
96966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
97066b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanEOF
97166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
97266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Allow error messages only from the first compilation.
97366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$suppress_opt" = yes; then
97466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        suppress_output=' >/dev/null 2>&1'
97566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
97666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    else
97766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # No PIC object so indicate it doesn't exist in the libtool
97866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # object file.
97966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      test -z "$run" && cat >> ${libobj}T <<EOF
98066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanpic_object=none
98166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
98266b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanEOF
98366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
98466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
98566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Only build a position-dependent object if we build old libraries.
98666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test "$build_old_libs" = yes; then
98766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$pic_mode" != yes; then
98866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Don't build PIC code
98966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	command="$base_compile $qsrcfile"
99066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      else
99166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	command="$base_compile $qsrcfile $pic_flag"
99266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
99366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$compiler_c_o" = yes; then
99466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	command="$command -o $obj"
99566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
99666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
99766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Suppress compiler output if we already did a PIC compilation.
99866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      command="$command$suppress_output"
99966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $run $rm "$obj" "$output_obj"
100066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $show "$command"
100166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if $run eval "$command"; then :
100266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      else
100366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$run $rm $removelist
100466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit $EXIT_FAILURE
100566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
100666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
100766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$need_locks" = warn &&
100866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
100966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "\
101066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman*** ERROR, $lockfile contains:
101166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman`cat $lockfile 2>/dev/null`
101266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
101366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanbut it should contain:
101466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman$srcfile
101566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
101666b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanThis indicates that another process is trying to use the same
101766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumantemporary object file, and libtool could not work around it because
101866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanyour compiler does not support \`-c' and \`-o' together.  If you
101966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanrepeat this compilation, it may succeed, by chance, but you had better
102066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanavoid parallel builds (make -j) in this platform, or get a better
102166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumancompiler."
102266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
102366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$run $rm $removelist
102466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit $EXIT_FAILURE
102566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
102666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
102766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Just move the object if needed
102866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
102966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$show "$mv $output_obj $obj"
103066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if $run $mv $output_obj $obj; then :
103166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
103266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  error=$?
103366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $run $rm $removelist
103466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $error
103566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
103666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
103766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
103866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Append the name of the non-PIC object the libtool object file.
103966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Only append if the libtool object file exists.
104066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      test -z "$run" && cat >> ${libobj}T <<EOF
104166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Name of the non-PIC object.
104266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumannon_pic_object='$objname'
104366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
104466b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanEOF
104566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    else
104666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Append the name of the non-PIC object the libtool object file.
104766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Only append if the libtool object file exists.
104866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      test -z "$run" && cat >> ${libobj}T <<EOF
104966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Name of the non-PIC object.
105066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumannon_pic_object=none
105166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
105266b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanEOF
105366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
105466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
105566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $run $mv "${libobj}T" "${libobj}"
105666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
105766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Unlock the critical section if it was locked
105866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test "$need_locks" != no; then
105966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $run $rm "$lockfile"
106066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
106166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
106266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    exit $EXIT_SUCCESS
106366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
106466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
106566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # libtool link mode
106666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  link | relink)
106766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    modename="$modename: link"
106866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    case $host in
106966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
107066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # It is impossible to link a dll without this setting, and
107166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # we shouldn't force the makefile maintainer to figure out
107266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # which system we are compiling for in order to pass an extra
107366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # flag for every libtool invocation.
107466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # allow_undefined=no
107566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
107666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # FIXME: Unfortunately, there are problems with the above when trying
107766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # to make a dll which has undefined symbols, in which case not
107866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # even a static library is built.  For now, we need to specify
107966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # -no-undefined on the libtool link line when we can be certain
108066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # that all symbols are satisfied, otherwise we get a static library.
108166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      allow_undefined=yes
108266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
108366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *)
108466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      allow_undefined=yes
108566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
108666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    esac
108766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    libtool_args="$nonopt"
108866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    base_compile="$nonopt $@"
108966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    compile_command="$nonopt"
109066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    finalize_command="$nonopt"
109166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
109266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    compile_rpath=
109366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    finalize_rpath=
109466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    compile_shlibpath=
109566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    finalize_shlibpath=
109666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    convenience=
109766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    old_convenience=
109866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    deplibs=
109966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    old_deplibs=
110066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    compiler_flags=
110166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    linker_flags=
110266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    dllsearchpath=
110366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    lib_search_path=`pwd`
110466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    inst_prefix_dir=
110566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
110666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    avoid_version=no
110766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    dlfiles=
110866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    dlprefiles=
110966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    dlself=no
111066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    export_dynamic=no
111166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    export_symbols=
111266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    export_symbols_regex=
111366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    generated=
111466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    libobjs=
111566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ltlibs=
111666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    module=no
111766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    no_install=no
111866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    objs=
111966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    non_pic_objects=
112066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    notinst_path= # paths that contain not-installed libtool libraries
112166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    precious_files_regex=
112266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    prefer_static_libs=no
112366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    preload=no
112466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    prev=
112566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    prevarg=
112666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    release=
112766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    rpath=
112866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    xrpath=
112966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    perm_rpath=
113066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    temp_rpath=
113166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    thread_safe=no
113266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    vinfo=
113366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    vinfo_number=no
113466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
113566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    func_infer_tag $base_compile
113666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
113766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # We need to know -static, to get the right output filenames.
113866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    for arg
113966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    do
114066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $arg in
114166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -all-static | -static)
114266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "X$arg" = "X-all-static"; then
114366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
114466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
114566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
114666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$link_static_flag"; then
114766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    dlopen_self=$dlopen_self_static
114866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
114966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prefer_static_libs=yes
115066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
115166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
115266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    dlopen_self=$dlopen_self_static
115366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
115466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prefer_static_libs=built
115566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
115666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	build_libtool_libs=no
115766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	build_old_libs=yes
115866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	break
115966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
116066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
116166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    done
116266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
116366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # See if our shared archives depend on static archives.
116466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
116566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
116666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Go through the arguments, transforming them on the way.
116766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    while test "$#" -gt 0; do
116866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      arg="$1"
116966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      shift
117066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $arg in
117166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
117266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
117366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
117466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *) qarg=$arg ;;
117566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
117666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      libtool_args="$libtool_args $qarg"
117766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
117866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # If the previous option needs an argument, assign it.
117966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$prev"; then
118066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $prev in
118166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	output)
118266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  compile_command="$compile_command @OUTPUT@"
118366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  finalize_command="$finalize_command @OUTPUT@"
118466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
118566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
118666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
118766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $prev in
118866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	dlfiles|dlprefiles)
118966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$preload" = no; then
119066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Add the symbol object into the linking commands.
119166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    compile_command="$compile_command @SYMFILE@"
119266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    finalize_command="$finalize_command @SYMFILE@"
119366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    preload=yes
119466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
119566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $arg in
119666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *.la | *.lo) ;;  # We handle these cases below.
119766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  force)
119866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$dlself" = no; then
119966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      dlself=needless
120066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      export_dynamic=yes
120166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
120266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    prev=
120366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    continue
120466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
120566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  self)
120666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$prev" = dlprefiles; then
120766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      dlself=yes
120866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
120966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      dlself=yes
121066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
121166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      dlself=needless
121266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      export_dynamic=yes
121366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
121466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    prev=
121566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    continue
121666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
121766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *)
121866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$prev" = dlfiles; then
121966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      dlfiles="$dlfiles $arg"
122066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
122166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      dlprefiles="$dlprefiles $arg"
122266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
122366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    prev=
122466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    continue
122566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
122666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
122766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
122866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	expsyms)
122966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  export_symbols="$arg"
123066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test ! -f "$arg"; then
123166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: symbol file \`$arg' does not exist"
123266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    exit $EXIT_FAILURE
123366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
123466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prev=
123566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
123666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
123766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	expsyms_regex)
123866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  export_symbols_regex="$arg"
123966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prev=
124066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
124166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
124266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	inst_prefix)
124366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  inst_prefix_dir="$arg"
124466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prev=
124566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
124666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
124766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	precious_regex)
124866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  precious_files_regex="$arg"
124966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prev=
125066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
125166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
125266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	release)
125366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  release="-$arg"
125466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prev=
125566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
125666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
125766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	objectlist)
125866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -f "$arg"; then
125966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    save_arg=$arg
126066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    moreargs=
126166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for fil in `cat $save_arg`
126266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    do
126366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#	      moreargs="$moreargs $fil"
126466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      arg=$fil
126566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # A libtool-controlled object.
126666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
126766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # Check to see that this really is a libtool object.
126866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
126966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		pic_object=
127066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		non_pic_object=
127166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
127266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		# Read the .lo file
127366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		# If there is no directory component, then add one.
127466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		case $arg in
127566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*/* | *\\*) . $arg ;;
127666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*) . ./$arg ;;
127766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		esac
127866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
127966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if test -z "$pic_object" || \
128066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		   test -z "$non_pic_object" ||
128166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		   test "$pic_object" = none && \
128266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		   test "$non_pic_object" = none; then
128366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
128466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  exit $EXIT_FAILURE
128566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		fi
128666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
128766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		# Extract subdirectory from the argument.
128866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
128966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if test "X$xdir" = "X$arg"; then
129066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  xdir=
129166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		else
129266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  xdir="$xdir/"
129366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		fi
129466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
129566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if test "$pic_object" != none; then
129666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  # Prepend the subdirectory the object is found in.
129766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  pic_object="$xdir$pic_object"
129866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
129966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  if test "$prev" = dlfiles; then
130066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
130166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      dlfiles="$dlfiles $pic_object"
130266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      prev=
130366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      continue
130466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    else
130566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      # If libtool objects are unsupported, then we need to preload.
130666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      prev=dlprefiles
130766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    fi
130866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  fi
130966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
131066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  # CHECK ME:  I think I busted this.  -Ossama
131166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  if test "$prev" = dlprefiles; then
131266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    # Preload the old-style object.
131366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    dlprefiles="$dlprefiles $pic_object"
131466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    prev=
131566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  fi
131666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
131766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  # A PIC object.
131866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  libobjs="$libobjs $pic_object"
131966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  arg="$pic_object"
132066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		fi
132166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
132266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		# Non-PIC object.
132366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if test "$non_pic_object" != none; then
132466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  # Prepend the subdirectory the object is found in.
132566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  non_pic_object="$xdir$non_pic_object"
132666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
132766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  # A standard non-PIC object
132866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  non_pic_objects="$non_pic_objects $non_pic_object"
132966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  if test -z "$pic_object" || test "$pic_object" = none ; then
133066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    arg="$non_pic_object"
133166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  fi
133266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		else
133366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  # If the PIC object exists, use it instead.
133466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  # $xdir was prepended to $pic_object above.
133566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  non_pic_object="$pic_object"
133666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  non_pic_objects="$non_pic_objects $non_pic_object"
133766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		fi
133866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      else
133966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		# Only an error if not doing a dry-run.
134066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if test -z "$run"; then
134166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
134266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  exit $EXIT_FAILURE
134366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		else
134466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  # Dry-run case.
134566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
134666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  # Extract subdirectory from the argument.
134766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
134866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  if test "X$xdir" = "X$arg"; then
134966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    xdir=
135066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  else
135166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    xdir="$xdir/"
135266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  fi
135366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
135466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
135566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
135666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  libobjs="$libobjs $pic_object"
135766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  non_pic_objects="$non_pic_objects $non_pic_object"
135866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		fi
135966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
136066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done
136166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
136266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: link input file \`$save_arg' does not exist"
136366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    exit $EXIT_FAILURE
136466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
136566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  arg=$save_arg
136666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prev=
136766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
136866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
136966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	rpath | xrpath)
137066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # We need an absolute path.
137166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $arg in
137266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  [\\/]* | [A-Za-z]:[\\/]*) ;;
137366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *)
137466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: only absolute run-paths are allowed" 1>&2
137566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    exit $EXIT_FAILURE
137666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
137766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
137866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$prev" = rpath; then
137966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case "$rpath " in
138066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *" $arg "*) ;;
138166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *) rpath="$rpath $arg" ;;
138266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac
138366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
138466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case "$xrpath " in
138566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *" $arg "*) ;;
138666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *) xrpath="$xrpath $arg" ;;
138766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac
138866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
138966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prev=
139066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
139166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
139266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	xcompiler)
139366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  compiler_flags="$compiler_flags $qarg"
139466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prev=
139566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  compile_command="$compile_command $qarg"
139666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  finalize_command="$finalize_command $qarg"
139766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
139866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
139966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	xlinker)
140066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  linker_flags="$linker_flags $qarg"
140166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  compiler_flags="$compiler_flags $wl$qarg"
140266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prev=
140366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  compile_command="$compile_command $wl$qarg"
140466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  finalize_command="$finalize_command $wl$qarg"
140566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
140666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
140766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	xcclinker)
140866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  linker_flags="$linker_flags $qarg"
140966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  compiler_flags="$compiler_flags $qarg"
141066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prev=
141166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  compile_command="$compile_command $qarg"
141266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  finalize_command="$finalize_command $qarg"
141366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
141466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
141566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	shrext)
141666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  	  shrext_cmds="$arg"
141766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prev=
141866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
141966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
142066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	darwin_framework|darwin_framework_skip)
142166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
142266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  compile_command="$compile_command $arg"
142366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  finalize_command="$finalize_command $arg"
142466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prev=
142566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
142666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
142766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*)
142866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  eval "$prev=\"\$arg\""
142966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prev=
143066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
143166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
143266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
143366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi # test -n "$prev"
143466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
143566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      prevarg="$arg"
143666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
143766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $arg in
143866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -all-static)
143966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$link_static_flag"; then
144066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  compile_command="$compile_command $link_static_flag"
144166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  finalize_command="$finalize_command $link_static_flag"
144266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
144366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
144466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
144566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
144666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -allow-undefined)
144766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# FIXME: remove this flag sometime in the future.
144866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
144966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
145066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
145166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
145266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -avoid-version)
145366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	avoid_version=yes
145466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
145566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
145666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
145766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -dlopen)
145866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	prev=dlfiles
145966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
146066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
146166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
146266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -dlpreopen)
146366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	prev=dlprefiles
146466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
146566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
146666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
146766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -export-dynamic)
146866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	export_dynamic=yes
146966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
147066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
147166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
147266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -export-symbols | -export-symbols-regex)
147366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
147466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: more than one -exported-symbols argument is not allowed"
147566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
147666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
147766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "X$arg" = "X-export-symbols"; then
147866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prev=expsyms
147966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
148066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prev=expsyms_regex
148166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
148266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
148366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
148466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
148566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -framework|-arch|-isysroot)
148666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case " $CC " in
148766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
148866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		prev=darwin_framework_skip ;;
148966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *) compiler_flags="$compiler_flags $arg"
149066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	     prev=darwin_framework ;;
149166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
149266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	compile_command="$compile_command $arg"
149366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	finalize_command="$finalize_command $arg"
149466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
149566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
149666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
149766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -inst-prefix-dir)
149866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	prev=inst_prefix
149966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
150066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
150166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
150266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
150366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # so, if we see these flags be careful not to treat them like -L
150466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -L[A-Z][A-Z]*:*)
150566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $with_gcc/$host in
150666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	no/*-*-irix* | /*-*-irix*)
150766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  compile_command="$compile_command $arg"
150866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  finalize_command="$finalize_command $arg"
150966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
151066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
151166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
151266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
151366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
151466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -L*)
151566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
151666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# We need an absolute path.
151766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $dir in
151866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	[\\/]* | [A-Za-z]:[\\/]*) ;;
151966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*)
152066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  absdir=`cd "$dir" && pwd`
152166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -z "$absdir"; then
152266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
152366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    absdir="$dir"
152466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    notinst_path="$notinst_path $dir"
152566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
152666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  dir="$absdir"
152766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
152866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
152966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case "$deplibs " in
153066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*" -L$dir "*) ;;
153166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*)
153266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  deplibs="$deplibs -L$dir"
153366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  lib_search_path="$lib_search_path $dir"
153466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
153566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
153666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $host in
153766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
153866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
153966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case :$dllsearchpath: in
154066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *":$dir:"*) ;;
154166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *) dllsearchpath="$dllsearchpath:$dir";;
154266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
154366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case :$dllsearchpath: in
154466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *":$testbindir:"*) ;;
154566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *) dllsearchpath="$dllsearchpath:$testbindir";;
154666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
154766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
154866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
154966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
155066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
155166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
155266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -l*)
155366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
155466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $host in
155566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
155666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # These systems don't actually have a C or math library (as such)
155766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    continue
155866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
155966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *-*-os2*)
156066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # These systems don't actually have a C library (as such)
156166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    test "X$arg" = "X-lc" && continue
156266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
156366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
156466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Do not include libc due to us having libc/libc_r.
156566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    test "X$arg" = "X-lc" && continue
156666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
156766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *-*-rhapsody* | *-*-darwin1.[012])
156866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Rhapsody C and math libraries are in the System framework
156966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    deplibs="$deplibs -framework System"
157066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    continue
157166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
157266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *-*-sco3.2v5* | *-*-sco5v6*)
157366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Causes problems with __ctype
157466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    test "X$arg" = "X-lc" && continue
157566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
157666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
157766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Compiler inserts libc in the correct place for threads to work
157866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    test "X$arg" = "X-lc" && continue
157966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
158066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
158166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	elif test "X$arg" = "X-lc_r"; then
158266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	 case $host in
158366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
158466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	   # Do not include libc_r directly, use -pthread flag.
158566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	   continue
158666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	   ;;
158766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	 esac
158866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
158966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	deplibs="$deplibs $arg"
159066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
159166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
159266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
159366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Tru64 UNIX uses -model [arg] to determine the layout of C++
159466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # classes, name mangling, and exception handling.
159566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -model)
159666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	compile_command="$compile_command $arg"
159766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	compiler_flags="$compiler_flags $arg"
159866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	finalize_command="$finalize_command $arg"
159966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	prev=xcompiler
160066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
160166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
160266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
160366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
160466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	compiler_flags="$compiler_flags $arg"
160566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	compile_command="$compile_command $arg"
160666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	finalize_command="$finalize_command $arg"
160766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
160866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
160966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
161066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -module)
161166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	module=yes
161266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
161366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
161466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
161566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
161666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # -r[0-9][0-9]* specifies the processor on the SGI compiler
161766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
161866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # +DA*, +DD* enable 64-bit mode on the HP compiler
161966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # -q* pass through compiler args for the IBM compiler
162066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # -m* pass through architecture-specific compiler args for GCC
162166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # -m*, -t[45]*, -txscale* pass through architecture-specific
162266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # compiler args for GCC
162366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # -pg pass through profiling flag for GCC
162466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # @file GCC response files
162566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
162666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -t[45]*|-txscale*|@*)
162766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
162866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Unknown arguments in both finalize_command and compile_command need
162966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# to be aesthetically quoted because they are evaled later.
163066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
163166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $arg in
163266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
163366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  arg="\"$arg\""
163466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
163566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
163666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        compile_command="$compile_command $arg"
163766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        finalize_command="$finalize_command $arg"
163866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        compiler_flags="$compiler_flags $arg"
163966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        continue
164066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        ;;
164166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
164266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -shrext)
164366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	prev=shrext
164466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
164566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
164666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
164766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -no-fast-install)
164866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fast_install=no
164966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
165066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
165166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
165266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -no-install)
165366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $host in
165466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
165566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # The PATH hackery in wrapper scripts is required on Windows
165666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # in order for the loader to find any dlls it needs.
165766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
165866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
165966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fast_install=no
166066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
166166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*) no_install=yes ;;
166266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
166366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
166466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
166566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
166666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -no-undefined)
166766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	allow_undefined=no
166866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
166966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
167066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
167166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -objectlist)
167266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	prev=objectlist
167366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
167466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
167566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
167666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -o) prev=output ;;
167766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
167866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -precious-files-regex)
167966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	prev=precious_regex
168066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
168166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
168266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
168366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -release)
168466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	prev=release
168566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
168666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
168766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
168866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -rpath)
168966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	prev=rpath
169066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
169166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
169266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
169366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -R)
169466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	prev=xrpath
169566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
169666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
169766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
169866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -R*)
169966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
170066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# We need an absolute path.
170166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $dir in
170266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	[\\/]* | [A-Za-z]:[\\/]*) ;;
170366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*)
170466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: only absolute run-paths are allowed" 1>&2
170566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
170666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
170766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
170866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case "$xrpath " in
170966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*" $dir "*) ;;
171066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*) xrpath="$xrpath $dir" ;;
171166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
171266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
171366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
171466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
171566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -static)
171666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# The effects of -static are defined in a previous loop.
171766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# We used to do the same as -all-static on platforms that
171866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# didn't have a PIC flag, but the assumption that the effects
171966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# would be equivalent was wrong.  It would break on at least
172066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Digital Unix and AIX.
172166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
172266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
172366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
172466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -thread-safe)
172566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	thread_safe=yes
172666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
172766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
172866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
172966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -version-info)
173066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	prev=vinfo
173166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
173266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
173366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -version-number)
173466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	prev=vinfo
173566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	vinfo_number=yes
173666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
173766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
173866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
173966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -Wc,*)
174066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
174166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	arg=
174266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	save_ifs="$IFS"; IFS=','
174366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	for flag in $args; do
174466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  IFS="$save_ifs"
174566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $flag in
174666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
174766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    flag="\"$flag\""
174866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
174966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
175066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  arg="$arg $wl$flag"
175166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  compiler_flags="$compiler_flags $flag"
175266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	done
175366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	IFS="$save_ifs"
175466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
175566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
175666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
175766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -Wl,*)
175866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
175966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	arg=
176066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	save_ifs="$IFS"; IFS=','
176166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	for flag in $args; do
176266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  IFS="$save_ifs"
176366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $flag in
176466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
176566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    flag="\"$flag\""
176666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
176766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
176866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  arg="$arg $wl$flag"
176966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  compiler_flags="$compiler_flags $wl$flag"
177066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  linker_flags="$linker_flags $flag"
177166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	done
177266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	IFS="$save_ifs"
177366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
177466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
177566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
177666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -Xcompiler)
177766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	prev=xcompiler
177866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
177966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
178066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
178166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -Xlinker)
178266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	prev=xlinker
178366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
178466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
178566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
178666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -XCClinker)
178766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	prev=xcclinker
178866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
178966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
179066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
179166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Some other compiler flag.
179266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -* | +*)
179366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Unknown arguments in both finalize_command and compile_command need
179466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# to be aesthetically quoted because they are evaled later.
179566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
179666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $arg in
179766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
179866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  arg="\"$arg\""
179966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
180066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
180166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
180266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
180366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *.$objext)
180466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# A standard object.
180566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	objs="$objs $arg"
180666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
180766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
180866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *.lo)
180966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# A libtool-controlled object.
181066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
181166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Check to see that this really is a libtool object.
181266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
181366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  pic_object=
181466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  non_pic_object=
181566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
181666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Read the .lo file
181766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # If there is no directory component, then add one.
181866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $arg in
181966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  */* | *\\*) . $arg ;;
182066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *) . ./$arg ;;
182166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
182266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
182366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -z "$pic_object" || \
182466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	     test -z "$non_pic_object" ||
182566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	     test "$pic_object" = none && \
182666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	     test "$non_pic_object" = none; then
182766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
182866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    exit $EXIT_FAILURE
182966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
183066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
183166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Extract subdirectory from the argument.
183266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
183366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "X$xdir" = "X$arg"; then
183466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    xdir=
183566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman 	  else
183666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    xdir="$xdir/"
183766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
183866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
183966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$pic_object" != none; then
184066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Prepend the subdirectory the object is found in.
184166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    pic_object="$xdir$pic_object"
184266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
184366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$prev" = dlfiles; then
184466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
184566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		dlfiles="$dlfiles $pic_object"
184666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		prev=
184766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		continue
184866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      else
184966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		# If libtool objects are unsupported, then we need to preload.
185066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		prev=dlprefiles
185166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
185266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
185366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
185466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # CHECK ME:  I think I busted this.  -Ossama
185566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$prev" = dlprefiles; then
185666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # Preload the old-style object.
185766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      dlprefiles="$dlprefiles $pic_object"
185866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      prev=
185966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
186066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
186166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # A PIC object.
186266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    libobjs="$libobjs $pic_object"
186366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    arg="$pic_object"
186466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
186566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
186666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Non-PIC object.
186766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$non_pic_object" != none; then
186866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Prepend the subdirectory the object is found in.
186966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    non_pic_object="$xdir$non_pic_object"
187066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
187166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # A standard non-PIC object
187266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    non_pic_objects="$non_pic_objects $non_pic_object"
187366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -z "$pic_object" || test "$pic_object" = none ; then
187466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      arg="$non_pic_object"
187566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
187666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
187766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # If the PIC object exists, use it instead.
187866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # $xdir was prepended to $pic_object above.
187966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    non_pic_object="$pic_object"
188066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    non_pic_objects="$non_pic_objects $non_pic_object"
188166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
188266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
188366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Only an error if not doing a dry-run.
188466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -z "$run"; then
188566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
188666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    exit $EXIT_FAILURE
188766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
188866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Dry-run case.
188966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
189066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Extract subdirectory from the argument.
189166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
189266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "X$xdir" = "X$arg"; then
189366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      xdir=
189466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
189566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      xdir="$xdir/"
189666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
189766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
189866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
189966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
190066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    libobjs="$libobjs $pic_object"
190166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    non_pic_objects="$non_pic_objects $non_pic_object"
190266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
190366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
190466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
190566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
190666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *.$libext)
190766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# An archive.
190866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	deplibs="$deplibs $arg"
190966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	old_deplibs="$old_deplibs $arg"
191066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
191166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
191266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
191366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *.la)
191466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# A libtool-controlled library.
191566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
191666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$prev" = dlfiles; then
191766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # This library was specified with -dlopen.
191866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  dlfiles="$dlfiles $arg"
191966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prev=
192066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	elif test "$prev" = dlprefiles; then
192166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # The library was specified with -dlpreopen.
192266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  dlprefiles="$dlprefiles $arg"
192366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prev=
192466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
192566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  deplibs="$deplibs $arg"
192666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
192766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
192866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
192966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
193066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Some other compiler argument.
193166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *)
193266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Unknown arguments in both finalize_command and compile_command need
193366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# to be aesthetically quoted because they are evaled later.
193466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
193566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $arg in
193666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
193766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  arg="\"$arg\""
193866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
193966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
194066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
194166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac # arg
194266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
194366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Now actually substitute the argument into the commands.
194466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$arg"; then
194566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	compile_command="$compile_command $arg"
194666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	finalize_command="$finalize_command $arg"
194766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
194866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    done # argument parsing loop
194966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
195066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -n "$prev"; then
195166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
195266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$help" 1>&2
195366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit $EXIT_FAILURE
195466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
195566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
195666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
195766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      eval arg=\"$export_dynamic_flag_spec\"
195866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      compile_command="$compile_command $arg"
195966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      finalize_command="$finalize_command $arg"
196066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
196166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
196266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    oldlibs=
196366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # calculate the name of the file, without its directory
196466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
196566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    libobjs_save="$libobjs"
196666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
196766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -n "$shlibpath_var"; then
196866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # get the directories listed in $shlibpath_var
196966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
197066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    else
197166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      shlib_search_path=
197266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
197366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
197466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
197566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
197666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
197766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test "X$output_objdir" = "X$output"; then
197866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      output_objdir="$objdir"
197966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    else
198066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      output_objdir="$output_objdir/$objdir"
198166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
198266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Create the object directory.
198366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test ! -d "$output_objdir"; then
198466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $show "$mkdir $output_objdir"
198566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $run $mkdir $output_objdir
198666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit_status=$?
198766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
198866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit $exit_status
198966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
199066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
199166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
199266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Determine the type of output
199366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    case $output in
199466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    "")
199566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$modename: you must specify an output file" 1>&2
199666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$help" 1>&2
199766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit $EXIT_FAILURE
199866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
199966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *.$libext) linkmode=oldlib ;;
200066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *.lo | *.$objext) linkmode=obj ;;
200166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *.la) linkmode=lib ;;
200266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *) linkmode=prog ;; # Anything else should be a program.
200366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    esac
200466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
200566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    case $host in
200666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *cygwin* | *mingw* | *pw32*)
200766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # don't eliminate duplications in $postdeps and $predeps
200866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      duplicate_compiler_generated_deps=yes
200966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
201066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *)
201166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      duplicate_compiler_generated_deps=$duplicate_deps
201266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
201366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    esac
201466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    specialdeplibs=
201566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
201666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    libs=
201766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Find all interdependent deplibs by searching for libraries
201866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # that are linked more than once (e.g. -la -lb -la)
201966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    for deplib in $deplibs; do
202066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "X$duplicate_deps" = "Xyes" ; then
202166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case "$libs " in
202266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
202366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
202466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
202566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      libs="$libs $deplib"
202666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    done
202766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
202866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test "$linkmode" = lib; then
202966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      libs="$predeps $libs $compiler_lib_search_path $postdeps"
203066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
203166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Compute libraries that are listed more than once in $predeps
203266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # $postdeps and mark them as special (i.e., whose duplicates are
203366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # not to be eliminated).
203466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      pre_post_deps=
203566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
203666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	for pre_post_dep in $predeps $postdeps; do
203766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case "$pre_post_deps " in
203866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
203966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
204066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  pre_post_deps="$pre_post_deps $pre_post_dep"
204166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	done
204266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
204366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      pre_post_deps=
204466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
204566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
204666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    deplibs=
204766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    newdependency_libs=
204866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    newlib_search_path=
204966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    need_relink=no # whether we're linking any uninstalled libtool libraries
205066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    notinst_deplibs= # not-installed libtool libraries
205166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    case $linkmode in
205266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    lib)
205366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	passes="conv link"
205466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	for file in $dlfiles $dlprefiles; do
205566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $file in
205666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *.la) ;;
205766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *)
205866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
205966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    exit $EXIT_FAILURE
206066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
206166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
206266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	done
206366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
206466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    prog)
206566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	compile_deplibs=
206666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	finalize_deplibs=
206766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	alldeplibs=no
206866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	newdlfiles=
206966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	newdlprefiles=
207066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	passes="conv scan dlopen dlpreopen link"
207166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
207266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *)  passes="conv"
207366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
207466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    esac
207566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    for pass in $passes; do
207666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$linkmode,$pass" = "lib,link" ||
207766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	 test "$linkmode,$pass" = "prog,scan"; then
207866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	libs="$deplibs"
207966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	deplibs=
208066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
208166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$linkmode" = prog; then
208266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $pass in
208366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	dlopen) libs="$dlfiles" ;;
208466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	dlpreopen) libs="$dlprefiles" ;;
208566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
208666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
208766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
208866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$pass" = dlopen; then
208966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Collect dlpreopened libraries
209066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	save_deplibs="$deplibs"
209166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	deplibs=
209266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
209366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for deplib in $libs; do
209466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	lib=
209566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	found=no
209666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $deplib in
209766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
209866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$linkmode,$pass" = "prog,link"; then
209966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    compile_deplibs="$deplib $compile_deplibs"
210066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    finalize_deplibs="$deplib $finalize_deplibs"
210166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
210266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    compiler_flags="$compiler_flags $deplib"
210366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
210466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
210566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
210666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	-l*)
210766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$linkmode" != lib && test "$linkmode" != prog; then
210866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
210966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    continue
211066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
211166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
211266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
211366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for search_ext in .la $std_shrext .so .a; do
211466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # Search the libtool library
211566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      lib="$searchdir/lib${name}${search_ext}"
211666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test -f "$lib"; then
211766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if test "$search_ext" = ".la"; then
211866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  found=yes
211966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		else
212066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  found=no
212166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		fi
212266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		break 2
212366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
212466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done
212566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
212666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$found" != yes; then
212766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # deplib doesn't seem to be a libtool library
212866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$linkmode,$pass" = "prog,link"; then
212966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      compile_deplibs="$deplib $compile_deplibs"
213066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      finalize_deplibs="$deplib $finalize_deplibs"
213166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
213266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      deplibs="$deplib $deplibs"
213366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
213466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
213566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    continue
213666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else # deplib is a libtool library
213766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
213866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # We need to do some special things here, and not later.
213966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
214066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case " $predeps $postdeps " in
214166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *" $deplib "*)
214266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if (${SED} -e '2q' $lib |
214366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
214466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  library_names=
214566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  old_library=
214666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  case $lib in
214766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  */* | *\\*) . $lib ;;
214866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  *) . ./$lib ;;
214966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  esac
215066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  for l in $old_library $library_names; do
215166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    ll="$l"
215266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  done
215366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  if test "X$ll" = "X$old_library" ; then # only static version available
215466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    found=no
215566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
215666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    test "X$ladir" = "X$lib" && ladir="."
215766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    lib=$ladir/$old_library
215866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    if test "$linkmode,$pass" = "prog,link"; then
215966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      compile_deplibs="$deplib $compile_deplibs"
216066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      finalize_deplibs="$deplib $finalize_deplibs"
216166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    else
216266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      deplibs="$deplib $deplibs"
216366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
216466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    fi
216566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    continue
216666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  fi
216766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		fi
216866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	        ;;
216966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *) ;;
217066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
217166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
217266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
217366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;; # -l
217466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	-L*)
217566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $linkmode in
217666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  lib)
217766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    deplibs="$deplib $deplibs"
217866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    test "$pass" = conv && continue
217966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    newdependency_libs="$deplib $newdependency_libs"
218066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
218166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
218266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prog)
218366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$pass" = conv; then
218466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      deplibs="$deplib $deplibs"
218566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      continue
218666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
218766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$pass" = scan; then
218866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      deplibs="$deplib $deplibs"
218966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
219066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      compile_deplibs="$deplib $compile_deplibs"
219166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      finalize_deplibs="$deplib $finalize_deplibs"
219266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
219366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
219466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
219566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *)
219666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
219766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
219866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac # linkmode
219966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
220066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;; # -L
220166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	-R*)
220266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$pass" = link; then
220366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
220466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Make sure the xrpath contains only unique directories.
220566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case "$xrpath " in
220666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *" $dir "*) ;;
220766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *) xrpath="$xrpath $dir" ;;
220866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac
220966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
221066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  deplibs="$deplib $deplibs"
221166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
221266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
221366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*.la) lib="$deplib" ;;
221466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*.$libext)
221566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$pass" = conv; then
221666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    deplibs="$deplib $deplibs"
221766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    continue
221866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
221966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $linkmode in
222066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  lib)
222166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    valid_a_lib=no
222266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case $deplibs_check_method in
222366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      match_pattern*)
222466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		set dummy $deplibs_check_method
222566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
222666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if eval $echo \"$deplib\" 2>/dev/null \
222766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    | $SED 10q \
222866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    | $EGREP "$match_pattern_regex" > /dev/null; then
222966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  valid_a_lib=yes
223066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		fi
223166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		;;
223266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      pass_all)
223366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		valid_a_lib=yes
223466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		;;
223566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            esac
223666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$valid_a_lib" != yes; then
223766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo
223866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** Warning: Trying to link with static lib archive $deplib."
223966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** I have the capability to make that library automatically link in when"
224066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** you link to this library.  But I can only do this if you have a"
224166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** shared version of the library, which you do not appear to have"
224266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** because the file extensions .$libext of this argument makes me believe"
224366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** that it is just a static archive that I should not used here."
224466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
224566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo
224666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** Warning: Linking the shared library $output against the"
224766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** static library $deplib is not portable!"
224866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      deplibs="$deplib $deplibs"
224966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
225066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    continue
225166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
225266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prog)
225366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$pass" != link; then
225466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      deplibs="$deplib $deplibs"
225566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
225666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      compile_deplibs="$deplib $compile_deplibs"
225766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      finalize_deplibs="$deplib $finalize_deplibs"
225866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
225966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    continue
226066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
226166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac # linkmode
226266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;; # *.$libext
226366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*.lo | *.$objext)
226466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$pass" = conv; then
226566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    deplibs="$deplib $deplibs"
226666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  elif test "$linkmode" = prog; then
226766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
226866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # If there is no dlopen support or we're linking statically,
226966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # we need to preload.
227066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      newdlprefiles="$newdlprefiles $deplib"
227166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      compile_deplibs="$deplib $compile_deplibs"
227266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      finalize_deplibs="$deplib $finalize_deplibs"
227366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
227466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      newdlfiles="$newdlfiles $deplib"
227566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
227666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
227766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
227866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
227966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	%DEPLIBS%)
228066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  alldeplibs=yes
228166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
228266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
228366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac # case $deplib
228466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$found" = yes || test -f "$lib"; then :
228566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
228666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
228766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
228866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
228966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
229066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Check to see that this really is a libtool archive.
229166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
229266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
229366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
229466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
229566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
229666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
229766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
229866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	test "X$ladir" = "X$lib" && ladir="."
229966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
230066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	dlname=
230166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	dlopen=
230266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	dlpreopen=
230366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	libdir=
230466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	library_names=
230566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	old_library=
230666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# If the library was installed with an old release of libtool,
230766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# it will not redefine variables installed, or shouldnotlink
230866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	installed=yes
230966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	shouldnotlink=no
231066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	avoidtemprpath=
231166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
231266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
231366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Read the .la file
231466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $lib in
231566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*/* | *\\*) . $lib ;;
231666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*) . ./$lib ;;
231766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
231866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
231966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$linkmode,$pass" = "lib,link" ||
232066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	   test "$linkmode,$pass" = "prog,scan" ||
232166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
232266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
232366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
232466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
232566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
232666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$pass" = conv; then
232766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Only check for convenience libraries
232866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  deplibs="$lib $deplibs"
232966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -z "$libdir"; then
233066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -z "$old_library"; then
233166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
233266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      exit $EXIT_FAILURE
233366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
233466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # It is a libtool convenience library, so add in its objects.
233566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    convenience="$convenience $ladir/$objdir/$old_library"
233666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
233766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    tmp_libs=
233866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for deplib in $dependency_libs; do
233966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      deplibs="$deplib $deplibs"
234066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman              if test "X$duplicate_deps" = "Xyes" ; then
234166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	        case "$tmp_libs " in
234266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
234366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	        esac
234466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman              fi
234566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      tmp_libs="$tmp_libs $deplib"
234666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done
234766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
234866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
234966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    exit $EXIT_FAILURE
235066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
235166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
235266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi # $pass = conv
235366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
235466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
235566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Get the name of the library we link against.
235666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	linklib=
235766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	for l in $old_library $library_names; do
235866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  linklib="$l"
235966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	done
236066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -z "$linklib"; then
236166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
236266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
236366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
236466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
236566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# This library was specified with -dlopen.
236666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$pass" = dlopen; then
236766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -z "$libdir"; then
236866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
236966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    exit $EXIT_FAILURE
237066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
237166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -z "$dlname" ||
237266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	     test "$dlopen_support" != yes ||
237366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	     test "$build_libtool_libs" = no; then
237466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # If there is no dlname, no dlopen support or we're linking
237566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # statically, we need to preload.  We also need to preload any
237666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # dependent libraries so libltdl's deplib preloader doesn't
237766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # bomb out in the load deplibs phase.
237866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    dlprefiles="$dlprefiles $lib $dependency_libs"
237966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
238066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    newdlfiles="$newdlfiles $lib"
238166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
238266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
238366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi # $pass = dlopen
238466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
238566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# We need an absolute path.
238666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $ladir in
238766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
238866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*)
238966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  abs_ladir=`cd "$ladir" && pwd`
239066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -z "$abs_ladir"; then
239166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
239266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
239366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    abs_ladir="$ladir"
239466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
239566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
239666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
239766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
239866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
239966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Find the relevant object directory and library name.
240066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "X$installed" = Xyes; then
240166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
240266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
240366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    dir="$ladir"
240466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    absdir="$abs_ladir"
240566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    libdir="$abs_ladir"
240666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
240766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    dir="$libdir"
240866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    absdir="$libdir"
240966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
241066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
241166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
241266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
241366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    dir="$ladir"
241466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    absdir="$abs_ladir"
241566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Remove this search path later
241666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    notinst_path="$notinst_path $abs_ladir"
241766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
241866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    dir="$ladir/$objdir"
241966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    absdir="$abs_ladir/$objdir"
242066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Remove this search path later
242166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    notinst_path="$notinst_path $abs_ladir"
242266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
242366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi # $installed = yes
242466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
242566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
242666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# This library was specified with -dlpreopen.
242766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$pass" = dlpreopen; then
242866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -z "$libdir"; then
242966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
243066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    exit $EXIT_FAILURE
243166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
243266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Prefer using a static library (so that no silly _DYNAMIC symbols
243366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # are required to link).
243466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$old_library"; then
243566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    newdlprefiles="$newdlprefiles $dir/$old_library"
243666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Otherwise, use the dlname, so that lt_dlopen finds it.
243766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  elif test -n "$dlname"; then
243866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    newdlprefiles="$newdlprefiles $dir/$dlname"
243966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
244066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    newdlprefiles="$newdlprefiles $dir/$linklib"
244166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
244266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi # $pass = dlpreopen
244366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
244466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -z "$libdir"; then
244566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Link the convenience library
244666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$linkmode" = lib; then
244766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    deplibs="$dir/$old_library $deplibs"
244866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  elif test "$linkmode,$pass" = "prog,link"; then
244966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    compile_deplibs="$dir/$old_library $compile_deplibs"
245066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
245166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
245266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    deplibs="$lib $deplibs" # used for prog,scan pass
245366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
245466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
245566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
245666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
245766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
245866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$linkmode" = prog && test "$pass" != link; then
245966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  newlib_search_path="$newlib_search_path $ladir"
246066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  deplibs="$lib $deplibs"
246166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
246266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  linkalldeplibs=no
246366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
246466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	     test "$build_libtool_libs" = no; then
246566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    linkalldeplibs=yes
246666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
246766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
246866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  tmp_libs=
246966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for deplib in $dependency_libs; do
247066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case $deplib in
247166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
247266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac
247366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Need to link against all dependency_libs?
247466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$linkalldeplibs" = yes; then
247566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      deplibs="$deplib $deplibs"
247666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
247766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # Need to hardcode shared library paths
247866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # or/and link against static libraries
247966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      newdependency_libs="$deplib $newdependency_libs"
248066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
248166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "X$duplicate_deps" = "Xyes" ; then
248266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case "$tmp_libs " in
248366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
248466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
248566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
248666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    tmp_libs="$tmp_libs $deplib"
248766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done # for deplib
248866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
248966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi # $linkmode = prog...
249066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
249166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$linkmode,$pass" = "prog,link"; then
249266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$library_names" &&
249366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
249466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # We need to hardcode the library path
249566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
249666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # Make sure the rpath contains only unique directories.
249766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case "$temp_rpath " in
249866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *" $dir "*) ;;
249966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *" $absdir "*) ;;
250066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *) temp_rpath="$temp_rpath $absdir" ;;
250166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
250266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
250366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
250466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Hardcode the library path.
250566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Skip directories that are in the system default run-time
250666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # search path.
250766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case " $sys_lib_dlsearch_path " in
250866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *" $absdir "*) ;;
250966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *)
251066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case "$compile_rpath " in
251166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *" $absdir "*) ;;
251266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *) compile_rpath="$compile_rpath $absdir"
251366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
251466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      ;;
251566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac
251666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case " $sys_lib_dlsearch_path " in
251766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *" $libdir "*) ;;
251866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *)
251966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case "$finalize_rpath " in
252066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *" $libdir "*) ;;
252166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *) finalize_rpath="$finalize_rpath $libdir"
252266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
252366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      ;;
252466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac
252566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi # $linkmode,$pass = prog,link...
252666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
252766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$alldeplibs" = yes &&
252866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	     { test "$deplibs_check_method" = pass_all ||
252966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	       { test "$build_libtool_libs" = yes &&
253066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		 test -n "$library_names"; }; }; then
253166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # We only need to search for static libraries
253266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    continue
253366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
253466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
253566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
253666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	link_static=no # Whether the deplib will be linked statically
253766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	use_static_libs=$prefer_static_libs
253866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$use_static_libs" = built && test "$installed" = yes ; then
253966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  use_static_libs=no
254066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
254166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$library_names" &&
254266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
254366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$installed" = no; then
254466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    notinst_deplibs="$notinst_deplibs $lib"
254566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    need_relink=yes
254666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
254766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # This is a shared library
254866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
254966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Warn about portability, can't link against -module's on
255066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # some systems (darwin)
255166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
255266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo
255366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$linkmode" = prog; then
255466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** Warning: Linking the executable $output against the loadable module"
255566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
255666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** Warning: Linking the shared library $output against the loadable module"
255766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
255866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "*** $linklib is not portable!"
255966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
256066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$linkmode" = lib &&
256166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	     test "$hardcode_into_libs" = yes; then
256266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Hardcode the library path.
256366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Skip directories that are in the system default run-time
256466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # search path.
256566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case " $sys_lib_dlsearch_path " in
256666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *" $absdir "*) ;;
256766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *)
256866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case "$compile_rpath " in
256966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *" $absdir "*) ;;
257066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *) compile_rpath="$compile_rpath $absdir"
257166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
257266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      ;;
257366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac
257466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case " $sys_lib_dlsearch_path " in
257566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *" $libdir "*) ;;
257666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *)
257766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case "$finalize_rpath " in
257866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *" $libdir "*) ;;
257966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *) finalize_rpath="$finalize_rpath $libdir"
258066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
258166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      ;;
258266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac
258366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
258466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
258566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$old_archive_from_expsyms_cmds"; then
258666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # figure out the soname
258766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    set dummy $library_names
258866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    realname="$2"
258966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    shift; shift
259066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    libname=`eval \\$echo \"$libname_spec\"`
259166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # use dlname if we got it. it's perfectly good, no?
259266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -n "$dlname"; then
259366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      soname="$dlname"
259466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    elif test -n "$soname_spec"; then
259566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # bleh windows
259666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case $host in
259766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *cygwin* | mingw*)
259866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		major=`expr $current - $age`
259966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		versuffix="-$major"
260066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		;;
260166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
260266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      eval soname=\"$soname_spec\"
260366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
260466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      soname="$realname"
260566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
260666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
260766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Make a new name for the extract_expsyms_cmds to use
260866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    soroot="$soname"
260966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
261066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
261166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
261266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # If the library has no export list, then create one now
261366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -f "$output_objdir/$soname-def"; then :
261466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
261566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $show "extracting exported symbol list from \`$soname'"
261666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      save_ifs="$IFS"; IFS='~'
261766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      cmds=$extract_expsyms_cmds
261866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      for cmd in $cmds; do
261966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		IFS="$save_ifs"
262066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		eval cmd=\"$cmd\"
262166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$show "$cmd"
262266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$run eval "$cmd" || exit $?
262366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      done
262466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      IFS="$save_ifs"
262566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
262666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
262766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Create $newlib
262866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -f "$output_objdir/$newlib"; then :; else
262966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $show "generating import library for \`$soname'"
263066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      save_ifs="$IFS"; IFS='~'
263166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      cmds=$old_archive_from_expsyms_cmds
263266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      for cmd in $cmds; do
263366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		IFS="$save_ifs"
263466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		eval cmd=\"$cmd\"
263566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$show "$cmd"
263666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$run eval "$cmd" || exit $?
263766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      done
263866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      IFS="$save_ifs"
263966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
264066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # make sure the library variables are pointing to the new library
264166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    dir=$output_objdir
264266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    linklib=$newlib
264366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi # test -n "$old_archive_from_expsyms_cmds"
264466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
264566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$linkmode" = prog || test "$mode" != relink; then
264666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    add_shlibpath=
264766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    add_dir=
264866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    add=
264966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    lib_linked=yes
265066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case $hardcode_action in
265166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    immediate | unsupported)
265266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test "$hardcode_direct" = no; then
265366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		add="$dir/$linklib"
265466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		case $host in
265566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
265666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
265766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
265866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    *-*-unixware7*) add_dir="-L$dir" ;;
265966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  *-*-darwin* )
266066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    # if the lib is a module then we can not link against
266166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    # it, someone is ignoring the new warnings I added
266266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    if /usr/bin/file -L $add 2> /dev/null |
266366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman                      $EGREP ": [^:]* bundle" >/dev/null ; then
266466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      $echo "** Warning, lib $linklib is a module, not a shared library"
266566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      if test -z "$old_library" ; then
266666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		        $echo
266766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		        $echo "** And there doesn't seem to be a static archive available"
266866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		        $echo "** The link will probably fail, sorry"
266966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      else
267066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		        add="$dir/$old_library"
267166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      fi
267266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    fi
267366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		esac
267466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      elif test "$hardcode_minus_L" = no; then
267566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		case $host in
267666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*-*-sunos*) add_shlibpath="$dir" ;;
267766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		esac
267866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		add_dir="-L$dir"
267966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		add="-l$name"
268066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      elif test "$hardcode_shlibpath_var" = no; then
268166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		add_shlibpath="$dir"
268266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		add="-l$name"
268366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      else
268466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		lib_linked=no
268566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
268666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      ;;
268766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    relink)
268866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test "$hardcode_direct" = yes; then
268966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		add="$dir/$linklib"
269066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      elif test "$hardcode_minus_L" = yes; then
269166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		add_dir="-L$dir"
269266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		# Try looking first in the location we're being installed to.
269366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if test -n "$inst_prefix_dir"; then
269466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  case $libdir in
269566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    [\\/]*)
269666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
269766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      ;;
269866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  esac
269966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		fi
270066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		add="-l$name"
270166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      elif test "$hardcode_shlibpath_var" = yes; then
270266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		add_shlibpath="$dir"
270366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		add="-l$name"
270466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      else
270566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		lib_linked=no
270666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
270766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      ;;
270866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *) lib_linked=no ;;
270966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac
271066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
271166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$lib_linked" != yes; then
271266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "$modename: configuration error: unsupported hardcode properties"
271366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      exit $EXIT_FAILURE
271466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
271566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
271666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -n "$add_shlibpath"; then
271766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case :$compile_shlibpath: in
271866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *":$add_shlibpath:"*) ;;
271966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
272066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
272166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
272266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$linkmode" = prog; then
272366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
272466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
272566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
272666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
272766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      test -n "$add" && deplibs="$add $deplibs"
272866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test "$hardcode_direct" != yes && \
272966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		 test "$hardcode_minus_L" != yes && \
273066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		 test "$hardcode_shlibpath_var" = yes; then
273166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		case :$finalize_shlibpath: in
273266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*":$libdir:"*) ;;
273366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
273466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		esac
273566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
273666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
273766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
273866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
273966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$linkmode" = prog || test "$mode" = relink; then
274066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    add_shlibpath=
274166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    add_dir=
274266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    add=
274366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Finalize command for both is simple: just hardcode it.
274466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$hardcode_direct" = yes; then
274566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      add="$libdir/$linklib"
274666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    elif test "$hardcode_minus_L" = yes; then
274766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      add_dir="-L$libdir"
274866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      add="-l$name"
274966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    elif test "$hardcode_shlibpath_var" = yes; then
275066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case :$finalize_shlibpath: in
275166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *":$libdir:"*) ;;
275266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
275366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
275466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      add="-l$name"
275566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    elif test "$hardcode_automatic" = yes; then
275666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test -n "$inst_prefix_dir" &&
275766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
275866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	        add="$inst_prefix_dir$libdir/$linklib"
275966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      else
276066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	        add="$libdir/$linklib"
276166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
276266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
276366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # We cannot seem to hardcode it, guess we'll fake it.
276466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      add_dir="-L$libdir"
276566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # Try looking first in the location we're being installed to.
276666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test -n "$inst_prefix_dir"; then
276766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		case $libdir in
276866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  [\\/]*)
276966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
277066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    ;;
277166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		esac
277266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
277366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      add="-l$name"
277466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
277566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
277666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$linkmode" = prog; then
277766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
277866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
277966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
278066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
278166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      test -n "$add" && deplibs="$add $deplibs"
278266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
278366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
278466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	elif test "$linkmode" = prog; then
278566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Here we assume that one of hardcode_direct or hardcode_minus_L
278666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # is not unsupported.  This is valid on all known static and
278766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # shared platforms.
278866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$hardcode_direct" != unsupported; then
278966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    test -n "$old_library" && linklib="$old_library"
279066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    compile_deplibs="$dir/$linklib $compile_deplibs"
279166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
279266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
279366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    compile_deplibs="-l$name -L$dir $compile_deplibs"
279466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
279566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
279666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	elif test "$build_libtool_libs" = yes; then
279766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Not a shared library
279866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$deplibs_check_method" != pass_all; then
279966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # We're trying link a shared library against a static one
280066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # but the system doesn't support it.
280166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
280266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Just print a warning and add the library to dependency_libs so
280366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # that the program can be linked against the static library.
280466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo
280566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "*** Warning: This system can not link to static lib archive $lib."
280666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "*** I have the capability to make that library automatically link in when"
280766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "*** you link to this library.  But I can only do this if you have a"
280866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "*** shared version of the library, which you do not appear to have."
280966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$module" = yes; then
281066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** But as you try to build a module library, libtool will still create "
281166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** a static module, that should work as long as the dlopening application"
281266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
281366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test -z "$global_symbol_pipe"; then
281466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo
281566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo "*** However, this would only work if libtool was able to extract symbol"
281666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
281766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo "*** not find such a program.  So, this module is probably useless."
281866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
281966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
282066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test "$build_old_libs" = no; then
282166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		build_libtool_libs=module
282266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		build_old_libs=yes
282366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      else
282466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		build_libtool_libs=no
282566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
282666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
282766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
282866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    deplibs="$dir/$old_library $deplibs"
282966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    link_static=yes
283066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
283166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi # link shared/static library?
283266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
283366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$linkmode" = lib; then
283466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$dependency_libs" &&
283566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	     { test "$hardcode_into_libs" != yes ||
283666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	       test "$build_old_libs" = yes ||
283766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	       test "$link_static" = yes; }; then
283866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Extract -R from dependency_libs
283966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    temp_deplibs=
284066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for libdir in $dependency_libs; do
284166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case $libdir in
284266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
284366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		   case " $xrpath " in
284466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		   *" $temp_xrpath "*) ;;
284566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		   *) xrpath="$xrpath $temp_xrpath";;
284666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		   esac;;
284766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *) temp_deplibs="$temp_deplibs $libdir";;
284866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
284966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done
285066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    dependency_libs="$temp_deplibs"
285166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
285266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
285366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  newlib_search_path="$newlib_search_path $absdir"
285466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Link against this library
285566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
285666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # ... and its dependency_libs
285766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  tmp_libs=
285866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for deplib in $dependency_libs; do
285966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    newdependency_libs="$deplib $newdependency_libs"
286066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "X$duplicate_deps" = "Xyes" ; then
286166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case "$tmp_libs " in
286266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
286366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
286466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
286566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    tmp_libs="$tmp_libs $deplib"
286666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
286766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
286866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$link_all_deplibs" != no; then
286966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Add the search paths of all dependency libraries
287066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for deplib in $dependency_libs; do
287166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case $deplib in
287266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      -L*) path="$deplib" ;;
287366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *.la)
287466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
287566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		test "X$dir" = "X$deplib" && dir="."
287666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		# We need an absolute path.
287766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		case $dir in
287866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
287966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*)
288066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  absdir=`cd "$dir" && pwd`
288166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  if test -z "$absdir"; then
288266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
288366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    absdir="$dir"
288466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  fi
288566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  ;;
288666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		esac
288766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if grep "^installed=no" $deplib > /dev/null; then
288866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  path="$absdir/$objdir"
288966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		else
289066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
289166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  if test -z "$libdir"; then
289266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
289366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    exit $EXIT_FAILURE
289466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  fi
289566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  if test "$absdir" != "$libdir"; then
289666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
289766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  fi
289866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  path="$absdir"
289966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		fi
290066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		depdepl=
290166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		case $host in
290266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*-*-darwin*)
290366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  # we do not want to link against static libs,
290466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  # but need to link against shared
290566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
290666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  if test -n "$deplibrary_names" ; then
290766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    for tmp in $deplibrary_names ; do
290866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      depdepl=$tmp
290966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    done
291066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    if test -f "$path/$depdepl" ; then
291166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      depdepl="$path/$depdepl"
291266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    fi
291366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    # do not add paths which are already there
291466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    case " $newlib_search_path " in
291566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    *" $path "*) ;;
291666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    *) newlib_search_path="$newlib_search_path $path";;
291766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    esac
291866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  fi
291966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  path=""
292066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  ;;
292166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*)
292266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  path="-L$path"
292366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  ;;
292466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		esac
292566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		;;
292666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      -l*)
292766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		case $host in
292866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*-*-darwin*)
292966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  # Again, we only want to link against shared libraries
293066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
293166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  for tmp in $newlib_search_path ; do
293266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
293366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      eval depdepl="$tmp/lib$tmp_libs.dylib"
293466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      break
293566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    fi
293666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  done
293766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  path=""
293866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  ;;
293966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*) continue ;;
294066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		esac
294166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		;;
294266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *) continue ;;
294366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
294466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case " $deplibs " in
294566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *" $path "*) ;;
294666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *) deplibs="$path $deplibs" ;;
294766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
294866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case " $deplibs " in
294966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *" $depdepl "*) ;;
295066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *) deplibs="$depdepl $deplibs" ;;
295166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
295266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done
295366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi # link_all_deplibs != no
295466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi # linkmode = lib
295566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done # for deplib in $libs
295666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      dependency_libs="$newdependency_libs"
295766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$pass" = dlpreopen; then
295866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Link the dlpreopened libraries before other libraries
295966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	for deplib in $save_deplibs; do
296066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  deplibs="$deplib $deplibs"
296166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	done
296266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
296366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$pass" != dlopen; then
296466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$pass" != conv; then
296566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Make sure lib_search_path contains only unique directories.
296666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  lib_search_path=
296766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for dir in $newlib_search_path; do
296866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case "$lib_search_path " in
296966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *" $dir "*) ;;
297066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *) lib_search_path="$lib_search_path $dir" ;;
297166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac
297266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
297366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  newlib_search_path=
297466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
297566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
297666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$linkmode,$pass" != "prog,link"; then
297766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  vars="deplibs"
297866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
297966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  vars="compile_deplibs finalize_deplibs"
298066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
298166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	for var in $vars dependency_libs; do
298266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Add libraries to $var in reverse order
298366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  eval tmp_libs=\"\$$var\"
298466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  new_libs=
298566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for deplib in $tmp_libs; do
298666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # FIXME: Pedantically, this is the right thing to do, so
298766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    #        that some nasty dependency loop isn't accidentally
298866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    #        broken:
298966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    #new_libs="$deplib $new_libs"
299066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Pragmatically, this seems to cause very few problems in
299166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # practice:
299266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case $deplib in
299366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    -L*) new_libs="$deplib $new_libs" ;;
299466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    -R*) ;;
299566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *)
299666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # And here is the reason: when a library appears more
299766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # than once as an explicit dependence of a library, or
299866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # is implicitly linked in more than once by the
299966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # compiler, it is considered special, and multiple
300066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # occurrences thereof are not removed.  Compare this
300166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # with having the same library being listed as a
300266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # dependency of multiple other libraries: in this case,
300366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # we know (pedantically, we assume) the library does not
300466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # need to be listed more than once, so we keep only the
300566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # last copy.  This is not always right, but it is rare
300666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # enough that we require users that really mean to play
300766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # such unportable linking tricks to link the library
300866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # using -Wl,-lname, so that libtool does not consider it
300966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # for duplicate removal.
301066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case " $specialdeplibs " in
301166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
301266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *)
301366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		case " $new_libs " in
301466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*" $deplib "*) ;;
301566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*) new_libs="$deplib $new_libs" ;;
301666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		esac
301766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		;;
301866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
301966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      ;;
302066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac
302166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
302266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  tmp_libs=
302366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for deplib in $new_libs; do
302466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case $deplib in
302566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    -L*)
302666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case " $tmp_libs " in
302766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *" $deplib "*) ;;
302866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *) tmp_libs="$tmp_libs $deplib" ;;
302966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
303066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      ;;
303166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *) tmp_libs="$tmp_libs $deplib" ;;
303266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac
303366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
303466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  eval $var=\"$tmp_libs\"
303566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	done # for var
303666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
303766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Last step: remove runtime libs from dependency_libs
303866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # (they stay in deplibs)
303966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      tmp_libs=
304066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for i in $dependency_libs ; do
304166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case " $predeps $postdeps $compiler_lib_search_path " in
304266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*" $i "*)
304366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  i=""
304466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
304566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
304666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$i" ; then
304766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  tmp_libs="$tmp_libs $i"
304866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
304966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
305066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      dependency_libs=$tmp_libs
305166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    done # for pass
305266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test "$linkmode" = prog; then
305366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      dlfiles="$newdlfiles"
305466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      dlprefiles="$newdlprefiles"
305566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
305666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
305766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    case $linkmode in
305866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    oldlib)
305966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$deplibs"; then
306066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
306166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
306266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
306366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
306466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
306566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
306666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
306766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$rpath"; then
306866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
306966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
307066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
307166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$xrpath"; then
307266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
307366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
307466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
307566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$vinfo"; then
307666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
307766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
307866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
307966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$release"; then
308066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
308166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
308266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
308366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
308466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
308566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
308666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
308766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Now set the variables for building old libraries.
308866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      build_libtool_libs=no
308966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      oldlibs="$output"
309066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      objs="$objs$old_deplibs"
309166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
309266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
309366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    lib)
309466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Make sure we only generate libraries of the form `libNAME.la'.
309566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $outputname in
309666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      lib*)
309766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
309866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	eval shared_ext=\"$shrext_cmds\"
309966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	eval libname=\"$libname_spec\"
310066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
310166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *)
310266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$module" = no; then
310366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
310466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$help" 1>&2
310566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
310666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
310766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$need_lib_prefix" != no; then
310866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Add the "lib" prefix for modules if required
310966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
311066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  eval shared_ext=\"$shrext_cmds\"
311166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  eval libname=\"$libname_spec\"
311266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
311366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
311466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
311566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
311666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
311766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
311866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$objs"; then
311966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$deplibs_check_method" != pass_all; then
312066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
312166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
312266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
312366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo
312466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
312566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "*** objects $objs is not portable!"
312666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  libobjs="$libobjs $objs"
312766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
312866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
312966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
313066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$dlself" != no; then
313166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
313266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
313366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
313466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      set dummy $rpath
313566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$#" -gt 2; then
313666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
313766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
313866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      install_libdir="$2"
313966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
314066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      oldlibs=
314166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -z "$rpath"; then
314266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$build_libtool_libs" = yes; then
314366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Building a libtool convenience library.
314466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Some compilers have problems with a `.al' extension so
314566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # convenience libraries should have the same extension an
314666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # archive normally would.
314766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
314866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  build_libtool_libs=convenience
314966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  build_old_libs=yes
315066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
315166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
315266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$vinfo"; then
315366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
315466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
315566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
315666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$release"; then
315766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
315866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
315966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      else
316066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
316166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Parse the version information argument.
316266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	save_ifs="$IFS"; IFS=':'
316366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	set dummy $vinfo 0 0 0
316466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	IFS="$save_ifs"
316566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
316666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$8"; then
316766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
316866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$help" 1>&2
316966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
317066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
317166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
317266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# convert absolute version numbers to libtool ages
317366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# this retains compatibility with .la files and attempts
317466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# to make the code below a bit more comprehensible
317566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
317666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $vinfo_number in
317766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	yes)
317866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  number_major="$2"
317966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  number_minor="$3"
318066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  number_revision="$4"
318166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  #
318266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # There are really only two kinds -- those that
318366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # use the current revision as the major version
318466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # and those that subtract age and use age as
318566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # a minor version.  But, then there is irix
318666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # which has an extra 1 added just for fun
318766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  #
318866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $version_type in
318966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  darwin|linux|osf|windows)
319066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    current=`expr $number_major + $number_minor`
319166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    age="$number_minor"
319266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    revision="$number_revision"
319366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
319466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  freebsd-aout|freebsd-elf|sunos)
319566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    current="$number_major"
319666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    revision="$number_minor"
319766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    age="0"
319866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
319966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  irix|nonstopux)
320066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    current=`expr $number_major + $number_minor - 1`
320166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    age="$number_minor"
320266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    revision="$number_minor"
320366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
320466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
320566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
320666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	no)
320766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  current="$2"
320866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  revision="$3"
320966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  age="$4"
321066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
321166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
321266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
321366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Check that each of the things are valid numbers.
321466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $current in
321566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	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]) ;;
321666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*)
321766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
321866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
321966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
322066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
322166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
322266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
322366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $revision in
322466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	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]) ;;
322566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*)
322666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
322766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
322866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
322966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
323066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
323166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
323266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $age in
323366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	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]) ;;
323466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*)
323566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
323666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
323766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
323866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
323966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
324066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
324166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$age" -gt "$current"; then
324266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
324366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
324466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
324566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
324666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
324766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Calculate the version variables.
324866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	major=
324966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	versuffix=
325066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	verstring=
325166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $version_type in
325266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	none) ;;
325366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
325466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	darwin)
325566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Like Linux, but with the current version available in
325666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # verstring for coding it into the library header
325766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  major=.`expr $current - $age`
325866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  versuffix="$major.$age.$revision"
325966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Darwin ld doesn't like 0 for these options...
326066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  minor_current=`expr $current + 1`
326166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
326266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
326366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
326466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	freebsd-aout)
326566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  major=".$current"
326666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  versuffix=".$current.$revision";
326766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
326866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
326966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	freebsd-elf)
327066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  major=".$current"
327166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  versuffix=".$current";
327266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
327366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
327466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	irix | nonstopux)
327566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  major=`expr $current - $age + 1`
327666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
327766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $version_type in
327866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    nonstopux) verstring_prefix=nonstopux ;;
327966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *)         verstring_prefix=sgi ;;
328066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
328166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  verstring="$verstring_prefix$major.$revision"
328266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
328366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Add in all the interfaces that we are compatible with.
328466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  loop=$revision
328566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  while test "$loop" -ne 0; do
328666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    iface=`expr $revision - $loop`
328766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    loop=`expr $loop - 1`
328866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    verstring="$verstring_prefix$major.$iface:$verstring"
328966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
329066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
329166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Before this point, $major must not contain `.'.
329266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  major=.$major
329366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  versuffix="$major.$revision"
329466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
329566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
329666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	linux)
329766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  major=.`expr $current - $age`
329866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  versuffix="$major.$age.$revision"
329966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
330066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
330166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	osf)
330266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  major=.`expr $current - $age`
330366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  versuffix=".$current.$age.$revision"
330466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  verstring="$current.$age.$revision"
330566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
330666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Add in all the interfaces that we are compatible with.
330766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  loop=$age
330866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  while test "$loop" -ne 0; do
330966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    iface=`expr $current - $loop`
331066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    loop=`expr $loop - 1`
331166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    verstring="$verstring:${iface}.0"
331266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
331366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
331466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Make executables depend on our current version.
331566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  verstring="$verstring:${current}.0"
331666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
331766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
331866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	sunos)
331966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  major=".$current"
332066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  versuffix=".$current.$revision"
332166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
332266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
332366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	windows)
332466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Use '-' rather than '.', since we only want one
332566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # extension on DOS 8.3 filesystems.
332666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  major=`expr $current - $age`
332766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  versuffix="-$major"
332866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
332966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
333066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*)
333166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
333266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
333366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
333466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
333566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
333666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
333766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Clear the version info if we defaulted, and they specified a release.
333866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -z "$vinfo" && test -n "$release"; then
333966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  major=
334066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $version_type in
334166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  darwin)
334266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # we can't check for "0.0" in archive_cmds due to quoting
334366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # problems, so we reset it completely
334466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    verstring=
334566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
334666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *)
334766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    verstring="0.0"
334866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
334966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
335066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$need_version" = no; then
335166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    versuffix=
335266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
335366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    versuffix=".0.0"
335466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
335566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
335666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
335766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Remove version info from name if versioning should be avoided
335866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$avoid_version" = yes && test "$need_version" = no; then
335966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  major=
336066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  versuffix=
336166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  verstring=""
336266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
336366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
336466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Check to see if the archive will have undefined symbols.
336566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$allow_undefined" = yes; then
336666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$allow_undefined_flag" = unsupported; then
336766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
336866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    build_libtool_libs=no
336966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    build_old_libs=yes
337066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
337166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
337266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Don't allow undefined symbols.
337366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  allow_undefined_flag="$no_undefined_flag"
337466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
337566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
337666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
337766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$mode" != relink; then
337866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Remove our outputs, but don't remove object files since they
337966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# may have been created when compiling PIC objects.
338066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	removelist=
338166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	tempremovelist=`$echo "$output_objdir/*"`
338266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	for p in $tempremovelist; do
338366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $p in
338466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *.$objext)
338566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	       ;;
338666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
338766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	       if test "X$precious_files_regex" != "X"; then
338866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
338966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	         then
339066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		   continue
339166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		 fi
339266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	       fi
339366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	       removelist="$removelist $p"
339466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	       ;;
339566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *) ;;
339666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
339766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	done
339866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$removelist"; then
339966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $show "${rm}r $removelist"
340066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $run ${rm}r $removelist
340166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
340266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
340366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
340466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Now set the variables for building old libraries.
340566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
340666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	oldlibs="$oldlibs $output_objdir/$libname.$libext"
340766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
340866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Transform .lo files to .o files.
340966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
341066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
341166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
341266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Eliminate all temporary directories.
341366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for path in $notinst_path; do
341466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
341566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
341666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
341766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
341866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
341966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$xrpath"; then
342066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# If the user specified any rpath flags, then add them.
342166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	temp_xrpath=
342266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	for libdir in $xrpath; do
342366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  temp_xrpath="$temp_xrpath -R$libdir"
342466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case "$finalize_rpath " in
342566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *" $libdir "*) ;;
342666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *) finalize_rpath="$finalize_rpath $libdir" ;;
342766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
342866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	done
342966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
343066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  dependency_libs="$temp_xrpath $dependency_libs"
343166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
343266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
343366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
343466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Make sure dlfiles contains only unique files that won't be dlpreopened
343566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      old_dlfiles="$dlfiles"
343666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      dlfiles=
343766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for lib in $old_dlfiles; do
343866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case " $dlprefiles $dlfiles " in
343966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*" $lib "*) ;;
344066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*) dlfiles="$dlfiles $lib" ;;
344166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
344266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
344366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
344466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Make sure dlprefiles contains only unique files
344566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      old_dlprefiles="$dlprefiles"
344666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      dlprefiles=
344766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for lib in $old_dlprefiles; do
344866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case "$dlprefiles " in
344966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*" $lib "*) ;;
345066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*) dlprefiles="$dlprefiles $lib" ;;
345166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
345266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
345366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
345466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$build_libtool_libs" = yes; then
345566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$rpath"; then
345666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $host in
345766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
345866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # these systems don't actually have a c library (as such)!
345966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
346066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *-*-rhapsody* | *-*-darwin1.[012])
346166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Rhapsody C library is in the System framework
346266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    deplibs="$deplibs -framework System"
346366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
346466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *-*-netbsd*)
346566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Don't link with libc until the a.out ld.so is fixed.
346666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
346766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
346866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Do not include libc due to us having libc/libc_r.
346966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
347066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *-*-sco3.2v5* | *-*-sco5v6*)
347166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Causes problems with __ctype
347266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
347366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
347466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Compiler inserts libc in the correct place for threads to work
347566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
347666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman 	  *)
347766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Add libc to deplibs on all other systems if necessary.
347866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$build_libtool_need_lc" = "yes"; then
347966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      deplibs="$deplibs -lc"
348066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
348166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
348266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
348366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
348466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
348566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Transform deplibs into only deplibs that can be linked in shared.
348666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	name_save=$name
348766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	libname_save=$libname
348866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	release_save=$release
348966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	versuffix_save=$versuffix
349066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	major_save=$major
349166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# I'm not sure if I'm treating the release correctly.  I think
349266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# release should show up in the -l (ie -lgmp5) so we don't want to
349366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# add it in twice.  Is that correct?
349466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	release=""
349566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	versuffix=""
349666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	major=""
349766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	newdeplibs=
349866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	droppeddeps=no
349966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $deplibs_check_method in
350066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	pass_all)
350166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Don't check for shared/static.  Everything works.
350266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # This might be a little naive.  We might want to check
350366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # whether the library exists or not.  But this is on
350466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # osf3 & osf4 and I'm not really sure... Just
350566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # implementing what was already the behavior.
350666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  newdeplibs=$deplibs
350766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
350866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	test_compile)
350966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # This code stresses the "libraries are programs" paradigm to its
351066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # limits. Maybe even breaks it.  We compile a program, linking it
351166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # against the deplibs as a proxy for the library.  Then we can check
351266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # whether they linked in statically or dynamically with ldd.
351366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $rm conftest.c
351466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  cat > conftest.c <<EOF
351566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  int main() { return 0; }
351666b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanEOF
351766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $rm conftest
351866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
351966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$?" -eq 0 ; then
352066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ldd_output=`ldd conftest`
352166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for i in $deplibs; do
352266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      name=`expr $i : '-l\(.*\)'`
352366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # If $name is empty we are operating on a -L argument.
352466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman              if test "$name" != "" && test "$name" -ne "0"; then
352566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
352666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  case " $predeps $postdeps " in
352766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  *" $i "*)
352866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    newdeplibs="$newdeplibs $i"
352966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    i=""
353066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    ;;
353166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  esac
353266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	        fi
353366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if test -n "$i" ; then
353466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  libname=`eval \\$echo \"$libname_spec\"`
353566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
353666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  set dummy $deplib_matches
353766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  deplib_match=$2
353866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
353966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    newdeplibs="$newdeplibs $i"
354066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  else
354166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    droppeddeps=yes
354266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    $echo
354366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    $echo "*** Warning: dynamic linker does not accept needed library $i."
354466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    $echo "*** I have the capability to make that library automatically link in when"
354566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    $echo "*** you link to this library.  But I can only do this if you have a"
354666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    $echo "*** shared version of the library, which I believe you do not have"
354766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    $echo "*** because a test_compile did reveal that the linker did not use it for"
354866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
354966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  fi
355066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		fi
355166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      else
355266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		newdeplibs="$newdeplibs $i"
355366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
355466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done
355566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
355666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Error occurred in the first compile.  Let's try to salvage
355766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # the situation: Compile a separate program for each library.
355866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for i in $deplibs; do
355966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      name=`expr $i : '-l\(.*\)'`
356066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # If $name is empty we are operating on a -L argument.
356166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman              if test "$name" != "" && test "$name" != "0"; then
356266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$rm conftest
356366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$LTCC $LTCFLAGS -o conftest conftest.c $i
356466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		# Did it work?
356566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if test "$?" -eq 0 ; then
356666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  ldd_output=`ldd conftest`
356766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
356866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    case " $predeps $postdeps " in
356966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    *" $i "*)
357066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      newdeplibs="$newdeplibs $i"
357166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      i=""
357266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      ;;
357366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    esac
357466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  fi
357566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  if test -n "$i" ; then
357666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    libname=`eval \\$echo \"$libname_spec\"`
357766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
357866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    set dummy $deplib_matches
357966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    deplib_match=$2
358066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
358166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      newdeplibs="$newdeplibs $i"
358266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    else
358366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      droppeddeps=yes
358466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      $echo
358566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      $echo "*** Warning: dynamic linker does not accept needed library $i."
358666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      $echo "*** I have the capability to make that library automatically link in when"
358766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      $echo "*** you link to this library.  But I can only do this if you have a"
358866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      $echo "*** shared version of the library, which you do not appear to have"
358966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      $echo "*** because a test_compile did reveal that the linker did not use this one"
359066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
359166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    fi
359266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  fi
359366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		else
359466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  droppeddeps=yes
359566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  $echo
359666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
359766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  $echo "***  make it link in!  You will probably need to install it or some"
359866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  $echo "*** library that it depends on before this library will be fully"
359966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  $echo "*** functional.  Installing it before continuing would be even better."
360066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		fi
360166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      else
360266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		newdeplibs="$newdeplibs $i"
360366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
360466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done
360566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
360666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
360766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	file_magic*)
360866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  set dummy $deplibs_check_method
360966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
361066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for a_deplib in $deplibs; do
361166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    name=`expr $a_deplib : '-l\(.*\)'`
361266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # If $name is empty we are operating on a -L argument.
361366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            if test "$name" != "" && test  "$name" != "0"; then
361466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
361566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		case " $predeps $postdeps " in
361666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*" $a_deplib "*)
361766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  newdeplibs="$newdeplibs $a_deplib"
361866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  a_deplib=""
361966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  ;;
362066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		esac
362166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
362266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test -n "$a_deplib" ; then
362366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		libname=`eval \\$echo \"$libname_spec\"`
362466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
362566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
362666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  for potent_lib in $potential_libs; do
362766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      # Follow soft links.
362866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      if ls -lLd "$potent_lib" 2>/dev/null \
362966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman			 | grep " -> " >/dev/null; then
363066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman			continue
363166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      fi
363266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      # The statement above tries to avoid entering an
363366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      # endless loop below, in case of cyclic links.
363466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      # We might still enter an endless loop, since a link
363566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      # loop can be closed while we follow links,
363666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      # but so what?
363766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      potlib="$potent_lib"
363866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      while test -h "$potlib" 2>/dev/null; do
363966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
364066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman			case $potliblink in
364166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
364266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
364366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman			esac
364466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      done
364566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
364666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman			 | ${SED} 10q \
364766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman			 | $EGREP "$file_magic_regex" > /dev/null; then
364866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman			newdeplibs="$newdeplibs $a_deplib"
364966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman			a_deplib=""
365066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman			break 2
365166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      fi
365266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  done
365366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		done
365466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
365566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test -n "$a_deplib" ; then
365666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		droppeddeps=yes
365766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo
365866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo "*** Warning: linker path does not have real file for library $a_deplib."
365966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo "*** I have the capability to make that library automatically link in when"
366066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo "*** you link to this library.  But I can only do this if you have a"
366166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo "*** shared version of the library, which you do not appear to have"
366266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo "*** because I did check the linker path looking for a file starting"
366366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if test -z "$potlib" ; then
366466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
366566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		else
366666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  $echo "*** with $libname and none of the candidates passed a file format test"
366766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  $echo "*** using a file magic. Last file checked: $potlib"
366866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		fi
366966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
367066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
367166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # Add a -L argument.
367266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      newdeplibs="$newdeplibs $a_deplib"
367366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
367466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done # Gone through all deplibs.
367566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
367666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	match_pattern*)
367766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  set dummy $deplibs_check_method
367866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
367966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for a_deplib in $deplibs; do
368066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    name=`expr $a_deplib : '-l\(.*\)'`
368166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # If $name is empty we are operating on a -L argument.
368266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -n "$name" && test "$name" != "0"; then
368366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
368466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		case " $predeps $postdeps " in
368566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*" $a_deplib "*)
368666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  newdeplibs="$newdeplibs $a_deplib"
368766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  a_deplib=""
368866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  ;;
368966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		esac
369066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
369166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test -n "$a_deplib" ; then
369266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		libname=`eval \\$echo \"$libname_spec\"`
369366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
369466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
369566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  for potent_lib in $potential_libs; do
369666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    potlib="$potent_lib" # see symlink-check above in file_magic test
369766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    if eval $echo \"$potent_lib\" 2>/dev/null \
369866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		        | ${SED} 10q \
369966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		        | $EGREP "$match_pattern_regex" > /dev/null; then
370066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      newdeplibs="$newdeplibs $a_deplib"
370166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      a_deplib=""
370266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		      break 2
370366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    fi
370466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  done
370566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		done
370666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
370766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test -n "$a_deplib" ; then
370866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		droppeddeps=yes
370966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo
371066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo "*** Warning: linker path does not have real file for library $a_deplib."
371166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo "*** I have the capability to make that library automatically link in when"
371266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo "*** you link to this library.  But I can only do this if you have a"
371366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo "*** shared version of the library, which you do not appear to have"
371466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo "*** because I did check the linker path looking for a file starting"
371566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if test -z "$potlib" ; then
371666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
371766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		else
371866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  $echo "*** with $libname and none of the candidates passed a file format test"
371966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  $echo "*** using a regex pattern. Last file checked: $potlib"
372066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		fi
372166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
372266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
372366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # Add a -L argument.
372466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      newdeplibs="$newdeplibs $a_deplib"
372566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
372666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done # Gone through all deplibs.
372766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
372866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	none | unknown | *)
372966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  newdeplibs=""
373066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
373166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    -e 's/ -[LR][^ ]*//g'`
373266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
373366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for i in $predeps $postdeps ; do
373466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # can't use Xsed below, because $i might contain '/'
373566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
373666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done
373766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
373866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
373966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    | grep . >/dev/null; then
374066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo
374166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "X$deplibs_check_method" = "Xnone"; then
374266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
374366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
374466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** Warning: inter-library dependencies are not known to be supported."
374566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
374666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "*** All declared inter-library dependencies are being dropped."
374766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    droppeddeps=yes
374866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
374966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
375066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
375166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	versuffix=$versuffix_save
375266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	major=$major_save
375366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	release=$release_save
375466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	libname=$libname_save
375566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	name=$name_save
375666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
375766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $host in
375866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*-*-rhapsody* | *-*-darwin1.[012])
375966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # On Rhapsody replace the C library is the System framework
376066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
376166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
376266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
376366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
376466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$droppeddeps" = yes; then
376566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$module" = yes; then
376666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo
376766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
376866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
376966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "*** a static module, that should work as long as the dlopening"
377066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "*** application is linked with the -dlopen flag."
377166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -z "$global_symbol_pipe"; then
377266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo
377366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** However, this would only work if libtool was able to extract symbol"
377466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
377566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** not find such a program.  So, this module is probably useless."
377666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
377766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
377866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$build_old_libs" = no; then
377966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      oldlibs="$output_objdir/$libname.$libext"
378066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      build_libtool_libs=module
378166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      build_old_libs=yes
378266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
378366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      build_libtool_libs=no
378466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
378566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
378666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "*** The inter-library dependencies that have been dropped here will be"
378766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "*** automatically added whenever a program is linked with this library"
378866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "*** or is declared to -dlopen it."
378966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
379066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$allow_undefined" = no; then
379166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo
379266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** Since this library must not contain undefined symbols,"
379366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** because either the platform does not support them or"
379466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** it was explicitly requested with -no-undefined,"
379566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "*** libtool will only create a static version of it."
379666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test "$build_old_libs" = no; then
379766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		oldlibs="$output_objdir/$libname.$libext"
379866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		build_libtool_libs=module
379966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		build_old_libs=yes
380066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      else
380166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		build_libtool_libs=no
380266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
380366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
380466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
380566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
380666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Done checking deplibs!
380766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	deplibs=$newdeplibs
380866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
380966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
381066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
381166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # move library search paths that coincide with paths to not yet
381266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # installed libraries to the beginning of the library search list
381366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      new_libs=
381466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for path in $notinst_path; do
381566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case " $new_libs " in
381666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*" -L$path/$objdir "*) ;;
381766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*)
381866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case " $deplibs " in
381966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *" -L$path/$objdir "*)
382066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    new_libs="$new_libs -L$path/$objdir" ;;
382166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
382266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
382366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
382466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
382566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for deplib in $deplibs; do
382666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $deplib in
382766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	-L*)
382866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case " $new_libs " in
382966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *" $deplib "*) ;;
383066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *) new_libs="$new_libs $deplib" ;;
383166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
383266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
383366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*) new_libs="$new_libs $deplib" ;;
383466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
383566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
383666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      deplibs="$new_libs"
383766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
383866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
383966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # All the library-specific variables (install_libdir is set above).
384066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      library_names=
384166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      old_library=
384266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      dlname=
384366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
384466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Test again, we may have decided not to build it any more
384566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$build_libtool_libs" = yes; then
384666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$hardcode_into_libs" = yes; then
384766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Hardcode the library paths
384866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  hardcode_libdirs=
384966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  dep_rpath=
385066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  rpath="$finalize_rpath"
385166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  test "$mode" != relink && rpath="$compile_rpath$rpath"
385266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for libdir in $rpath; do
385366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -n "$hardcode_libdir_flag_spec"; then
385466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test -n "$hardcode_libdir_separator"; then
385566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if test -z "$hardcode_libdirs"; then
385666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  hardcode_libdirs="$libdir"
385766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		else
385866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  # Just accumulate the unique libdirs.
385966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
386066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
386166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    ;;
386266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  *)
386366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
386466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    ;;
386566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  esac
386666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		fi
386766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      else
386866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		eval flag=\"$hardcode_libdir_flag_spec\"
386966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		dep_rpath="$dep_rpath $flag"
387066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
387166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    elif test -n "$runpath_var"; then
387266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case "$perm_rpath " in
387366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *" $libdir "*) ;;
387466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *) perm_rpath="$perm_rpath $libdir" ;;
387566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
387666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
387766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
387866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Substitute the hardcoded libdirs into the rpath.
387966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$hardcode_libdir_separator" &&
388066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	     test -n "$hardcode_libdirs"; then
388166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    libdir="$hardcode_libdirs"
388266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -n "$hardcode_libdir_flag_spec_ld"; then
388366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
388466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
388566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
388666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
388766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
388866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
388966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # We should set the runpath_var.
389066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    rpath=
389166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for dir in $perm_rpath; do
389266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      rpath="$rpath$dir:"
389366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done
389466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
389566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
389666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
389766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
389866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
389966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	shlibpath="$finalize_shlibpath"
390066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
390166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$shlibpath"; then
390266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
390366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
390466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
390566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Get the real and link names of the library.
390666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	eval shared_ext=\"$shrext_cmds\"
390766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	eval library_names=\"$library_names_spec\"
390866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	set dummy $library_names
390966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	realname="$2"
391066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	shift; shift
391166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
391266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$soname_spec"; then
391366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  eval soname=\"$soname_spec\"
391466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
391566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  soname="$realname"
391666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
391766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -z "$dlname"; then
391866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  dlname=$soname
391966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
392066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
392166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	lib="$output_objdir/$realname"
392266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	linknames=
392366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	for link
392466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	do
392566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  linknames="$linknames $link"
392666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	done
392766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
392866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Use standard objects if they are pic
392966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
393066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
393166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Prepare the list of exported symbols
393266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -z "$export_symbols"; then
393366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
393466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $show "generating symbol list for \`$libname.la'"
393566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    export_symbols="$output_objdir/$libname.exp"
393666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $run $rm $export_symbols
393766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    cmds=$export_symbols_cmds
393866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    save_ifs="$IFS"; IFS='~'
393966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for cmd in $cmds; do
394066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      IFS="$save_ifs"
394166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      eval cmd=\"$cmd\"
394266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if len=`expr "X$cmd" : ".*"` &&
394366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
394466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	        $show "$cmd"
394566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	        $run eval "$cmd" || exit $?
394666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	        skipped_export=false
394766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      else
394866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	        # The command line is too long to execute in one step.
394966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	        $show "using reloadable object file for export list..."
395066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	        skipped_export=:
395166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		# Break out early, otherwise skipped_export may be
395266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		# set to false by a later but shorter cmd.
395366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		break
395466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
395566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done
395666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    IFS="$save_ifs"
395766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -n "$export_symbols_regex"; then
395866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
395966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
396066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
396166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
396266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
396366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
396466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
396566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
396666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$export_symbols" && test -n "$include_expsyms"; then
396766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
396866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
396966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
397066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	tmp_deplibs=
397166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	for test_deplib in $deplibs; do
397266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		case " $convenience " in
397366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*" $test_deplib "*) ;;
397466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*)
397566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman			tmp_deplibs="$tmp_deplibs $test_deplib"
397666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman			;;
397766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		esac
397866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	done
397966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	deplibs="$tmp_deplibs"
398066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
398166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$convenience"; then
398266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$whole_archive_flag_spec"; then
398366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    save_libobjs=$libobjs
398466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
398566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
398666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    gentop="$output_objdir/${outputname}x"
398766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    generated="$generated $gentop"
398866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
398966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    func_extract_archives $gentop $convenience
399066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    libobjs="$libobjs $func_extract_archives_result"
399166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
399266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
399366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	
399466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
399566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  eval flag=\"$thread_safe_flag_spec\"
399666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  linker_flags="$linker_flags $flag"
399766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
399866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
399966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Make a backup of the uninstalled library when relinking
400066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$mode" = relink; then
400166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
400266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
400366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
400466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Do each of the archive commands.
400566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$module" = yes && test -n "$module_cmds" ; then
400666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
400766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    eval test_cmds=\"$module_expsym_cmds\"
400866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    cmds=$module_expsym_cmds
400966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
401066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    eval test_cmds=\"$module_cmds\"
401166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    cmds=$module_cmds
401266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
401366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
401466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
401566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  eval test_cmds=\"$archive_expsym_cmds\"
401666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  cmds=$archive_expsym_cmds
401766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
401866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  eval test_cmds=\"$archive_cmds\"
401966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  cmds=$archive_cmds
402066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
402166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
402266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
402366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "X$skipped_export" != "X:" &&
402466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
402566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
402666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  :
402766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
402866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # The command line is too long to link in one step, link piecewise.
402966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "creating reloadable object files..."
403066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
403166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Save the value of $output and $libobjs because we want to
403266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # use them later.  If we have whole_archive_flag_spec, we
403366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # want to use save_libobjs as it was before
403466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # whole_archive_flag_spec was expanded, because we can't
403566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # assume the linker understands whole_archive_flag_spec.
403666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # This may have to be revisited, in case too many
403766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # convenience libraries get linked in and end up exceeding
403866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # the spec.
403966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
404066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    save_libobjs=$libobjs
404166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
404266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  save_output=$output
404366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
404466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
404566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Clear the reloadable object creation command queue and
404666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # initialize k to one.
404766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  test_cmds=
404866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  concat_cmds=
404966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  objlist=
405066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  delfiles=
405166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  last_robj=
405266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  k=1
405366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  output=$output_objdir/$output_la-${k}.$objext
405466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Loop over the list of objects to be linked.
405566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for obj in $save_libobjs
405666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  do
405766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
405866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "X$objlist" = X ||
405966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
406066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		 test "$len" -le "$max_cmd_len"; }; then
406166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      objlist="$objlist $obj"
406266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
406366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # The command $test_cmds is almost too long, add a
406466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # command to the queue.
406566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test "$k" -eq 1 ; then
406666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		# The first file doesn't have a previous command to add.
406766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
406866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      else
406966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		# All subsequent reloadable object files will link in
407066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		# the last one created.
407166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
407266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
407366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      last_robj=$output_objdir/$output_la-${k}.$objext
407466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      k=`expr $k + 1`
407566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      output=$output_objdir/$output_la-${k}.$objext
407666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      objlist=$obj
407766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      len=1
407866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
407966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
408066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Handle the remaining objects by creating one last
408166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # reloadable object file.  All subsequent reloadable object
408266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # files will link in the last one created.
408366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
408466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
408566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
408666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if ${skipped_export-false}; then
408766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $show "generating symbol list for \`$libname.la'"
408866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    export_symbols="$output_objdir/$libname.exp"
408966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $run $rm $export_symbols
409066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    libobjs=$output
409166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Append the command to create the export file.
409266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
409366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          fi
409466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
409566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Set up a command to remove the reloadable object files
409666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # after they are used.
409766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  i=0
409866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  while test "$i" -lt "$k"
409966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  do
410066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    i=`expr $i + 1`
410166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
410266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
410366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
410466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "creating a temporary reloadable object file: $output"
410566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
410666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Loop through the commands generated above and execute them.
410766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  save_ifs="$IFS"; IFS='~'
410866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for cmd in $concat_cmds; do
410966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    IFS="$save_ifs"
411066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $show "$cmd"
411166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $run eval "$cmd" || exit $?
411266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
411366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  IFS="$save_ifs"
411466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
411566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  libobjs=$output
411666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Restore the value of output.
411766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  output=$save_output
411866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
411966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
412066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
412166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
412266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Expand the library linking commands again to reset the
412366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # value of $libobjs for piecewise linking.
412466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
412566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Do each of the archive commands.
412666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$module" = yes && test -n "$module_cmds" ; then
412766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
412866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      cmds=$module_expsym_cmds
412966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
413066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      cmds=$module_cmds
413166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
413266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
413366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
413466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    cmds=$archive_expsym_cmds
413566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
413666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    cmds=$archive_cmds
413766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
413866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
413966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
414066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Append the command to remove the reloadable object files
414166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # to the just-reset $cmds.
414266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  eval cmds=\"\$cmds~\$rm $delfiles\"
414366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
414466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	save_ifs="$IFS"; IFS='~'
414566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	for cmd in $cmds; do
414666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  IFS="$save_ifs"
414766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  eval cmd=\"$cmd\"
414866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $show "$cmd"
414966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $run eval "$cmd" || {
415066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    lt_exit=$?
415166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
415266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Restore the uninstalled library and exit
415366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$mode" = relink; then
415466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
415566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
415666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
415766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    exit $lt_exit
415866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  }
415966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	done
416066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	IFS="$save_ifs"
416166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
416266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Restore the uninstalled library and exit
416366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$mode" = relink; then
416466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
416566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
416666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$convenience"; then
416766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -z "$whole_archive_flag_spec"; then
416866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $show "${rm}r $gentop"
416966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $run ${rm}r "$gentop"
417066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
417166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
417266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
417366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_SUCCESS
417466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
417566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
417666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Create links to the real library.
417766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	for linkname in $linknames; do
417866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$realname" != "$linkname"; then
417966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
418066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
418166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
418266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	done
418366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
418466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# If -module or -export-dynamic was specified, set the dlname.
418566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$module" = yes || test "$export_dynamic" = yes; then
418666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # On all known operating systems, these are identical.
418766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  dlname="$soname"
418866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
418966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
419066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
419166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
419266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    obj)
419366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$deplibs"; then
419466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
419566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
419666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
419766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
419866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
419966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
420066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
420166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$rpath"; then
420266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
420366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
420466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
420566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$xrpath"; then
420666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
420766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
420866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
420966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$vinfo"; then
421066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
421166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
421266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
421366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$release"; then
421466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
421566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
421666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
421766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $output in
421866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *.lo)
421966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$objs$old_deplibs"; then
422066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
422166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
422266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
422366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	libobj="$output"
422466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
422566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
422666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *)
422766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	libobj=
422866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	obj="$output"
422966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
423066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
423166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
423266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Delete the old objects.
423366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $run $rm $obj $libobj
423466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
423566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Objects from convenience libraries.  This assumes
423666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # single-version convenience libraries.  Whenever we create
423766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # different ones for PIC/non-PIC, this we'll have to duplicate
423866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # the extraction.
423966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      reload_conv_objs=
424066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      gentop=
424166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # reload_cmds runs $LD directly, so let us get rid of
424266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # -Wl from whole_archive_flag_spec
424366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      wl=
424466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
424566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$convenience"; then
424666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$whole_archive_flag_spec"; then
424766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
424866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
424966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  gentop="$output_objdir/${obj}x"
425066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  generated="$generated $gentop"
425166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
425266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  func_extract_archives $gentop $convenience
425366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  reload_conv_objs="$reload_objs $func_extract_archives_result"
425466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
425566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
425666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
425766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Create the old-style object.
425866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      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
425966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
426066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      output="$obj"
426166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      cmds=$reload_cmds
426266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      save_ifs="$IFS"; IFS='~'
426366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for cmd in $cmds; do
426466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	IFS="$save_ifs"
426566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	eval cmd=\"$cmd\"
426666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$show "$cmd"
426766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$run eval "$cmd" || exit $?
426866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
426966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      IFS="$save_ifs"
427066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
427166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Exit if we aren't doing a library object file.
427266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -z "$libobj"; then
427366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$gentop"; then
427466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $show "${rm}r $gentop"
427566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $run ${rm}r $gentop
427666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
427766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
427866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit $EXIT_SUCCESS
427966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
428066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
428166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$build_libtool_libs" != yes; then
428266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$gentop"; then
428366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $show "${rm}r $gentop"
428466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $run ${rm}r $gentop
428566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
428666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
428766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Create an invalid libtool object if no PIC, so that we don't
428866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# accidentally link it into a program.
428966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# $show "echo timestamp > $libobj"
429066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# $run eval "echo timestamp > $libobj" || exit $?
429166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit $EXIT_SUCCESS
429266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
429366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
429466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$pic_flag" || test "$pic_mode" != default; then
429566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Only do commands if we really have different PIC objects.
429666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	reload_objs="$libobjs $reload_conv_objs"
429766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	output="$libobj"
429866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	cmds=$reload_cmds
429966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	save_ifs="$IFS"; IFS='~'
430066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	for cmd in $cmds; do
430166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  IFS="$save_ifs"
430266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  eval cmd=\"$cmd\"
430366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $show "$cmd"
430466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $run eval "$cmd" || exit $?
430566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	done
430666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	IFS="$save_ifs"
430766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
430866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
430966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$gentop"; then
431066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$show "${rm}r $gentop"
431166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$run ${rm}r $gentop
431266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
431366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
431466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit $EXIT_SUCCESS
431566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
431666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
431766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    prog)
431866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $host in
431966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
432066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
432166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$vinfo"; then
432266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
432366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
432466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
432566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$release"; then
432666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
432766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
432866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
432966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$preload" = yes; then
433066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
433166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	   test "$dlopen_self_static" = unknown; then
433266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
433366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
433466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
433566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
433666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $host in
433766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *-*-rhapsody* | *-*-darwin1.[012])
433866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# On Rhapsody replace the C library is the System framework
433966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
434066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
434166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
434266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
434366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
434466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $host in
434566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *darwin*)
434666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        # Don't allow lazy linking, it breaks C++ global constructors
434766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        if test "$tagname" = CXX ; then
434866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        compile_command="$compile_command ${wl}-bind_at_load"
434966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        finalize_command="$finalize_command ${wl}-bind_at_load"
435066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        fi
435166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        ;;
435266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
435366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
435466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
435566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # move library search paths that coincide with paths to not yet
435666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # installed libraries to the beginning of the library search list
435766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      new_libs=
435866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for path in $notinst_path; do
435966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case " $new_libs " in
436066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*" -L$path/$objdir "*) ;;
436166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*)
436266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case " $compile_deplibs " in
436366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *" -L$path/$objdir "*)
436466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    new_libs="$new_libs -L$path/$objdir" ;;
436566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
436666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
436766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
436866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
436966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for deplib in $compile_deplibs; do
437066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $deplib in
437166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	-L*)
437266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case " $new_libs " in
437366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *" $deplib "*) ;;
437466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *) new_libs="$new_libs $deplib" ;;
437566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
437666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
437766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*) new_libs="$new_libs $deplib" ;;
437866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
437966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
438066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      compile_deplibs="$new_libs"
438166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
438266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
438366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      compile_command="$compile_command $compile_deplibs"
438466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      finalize_command="$finalize_command $finalize_deplibs"
438566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
438666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$rpath$xrpath"; then
438766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# If the user specified any rpath flags, then add them.
438866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	for libdir in $rpath $xrpath; do
438966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # This is the magic to use -rpath.
439066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case "$finalize_rpath " in
439166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *" $libdir "*) ;;
439266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *) finalize_rpath="$finalize_rpath $libdir" ;;
439366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
439466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	done
439566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
439666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
439766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Now hardcode the library paths
439866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      rpath=
439966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      hardcode_libdirs=
440066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for libdir in $compile_rpath $finalize_rpath; do
440166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$hardcode_libdir_flag_spec"; then
440266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$hardcode_libdir_separator"; then
440366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -z "$hardcode_libdirs"; then
440466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      hardcode_libdirs="$libdir"
440566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
440666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # Just accumulate the unique libdirs.
440766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
440866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
440966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		;;
441066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *)
441166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
441266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		;;
441366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
441466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
441566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
441666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    eval flag=\"$hardcode_libdir_flag_spec\"
441766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    rpath="$rpath $flag"
441866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
441966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	elif test -n "$runpath_var"; then
442066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case "$perm_rpath " in
442166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *" $libdir "*) ;;
442266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *) perm_rpath="$perm_rpath $libdir" ;;
442366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
442466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
442566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $host in
442666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
442766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
442866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case :$dllsearchpath: in
442966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *":$libdir:"*) ;;
443066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *) dllsearchpath="$dllsearchpath:$libdir";;
443166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
443266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case :$dllsearchpath: in
443366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *":$testbindir:"*) ;;
443466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *) dllsearchpath="$dllsearchpath:$testbindir";;
443566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
443666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
443766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
443866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
443966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Substitute the hardcoded libdirs into the rpath.
444066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$hardcode_libdir_separator" &&
444166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	 test -n "$hardcode_libdirs"; then
444266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	libdir="$hardcode_libdirs"
444366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	eval rpath=\" $hardcode_libdir_flag_spec\"
444466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
444566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      compile_rpath="$rpath"
444666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
444766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      rpath=
444866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      hardcode_libdirs=
444966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for libdir in $finalize_rpath; do
445066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$hardcode_libdir_flag_spec"; then
445166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$hardcode_libdir_separator"; then
445266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -z "$hardcode_libdirs"; then
445366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      hardcode_libdirs="$libdir"
445466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
445566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # Just accumulate the unique libdirs.
445666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
445766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
445866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		;;
445966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *)
446066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
446166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		;;
446266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
446366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
446466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
446566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    eval flag=\"$hardcode_libdir_flag_spec\"
446666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    rpath="$rpath $flag"
446766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
446866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	elif test -n "$runpath_var"; then
446966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case "$finalize_perm_rpath " in
447066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *" $libdir "*) ;;
447166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
447266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
447366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
447466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
447566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Substitute the hardcoded libdirs into the rpath.
447666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$hardcode_libdir_separator" &&
447766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	 test -n "$hardcode_libdirs"; then
447866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	libdir="$hardcode_libdirs"
447966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	eval rpath=\" $hardcode_libdir_flag_spec\"
448066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
448166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      finalize_rpath="$rpath"
448266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
448366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$libobjs" && test "$build_old_libs" = yes; then
448466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Transform all the library objects into standard objects.
448566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
448666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
448766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
448866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
448966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      dlsyms=
449066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
449166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$NM" && test -n "$global_symbol_pipe"; then
449266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  dlsyms="${outputname}S.c"
449366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
449466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
449566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
449666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
449766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
449866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$dlsyms"; then
449966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $dlsyms in
450066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	"") ;;
450166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*.c)
450266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Discover the nlist of each of the dlfiles.
450366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  nlist="$output_objdir/${outputname}.nm"
450466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
450566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $show "$rm $nlist ${nlist}S ${nlist}T"
450666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
450766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
450866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Parse the name list into a source file.
450966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $show "creating $output_objdir/$dlsyms"
451066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
451166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
451266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
451366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
451466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
451566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#ifdef __cplusplus
451666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanextern \"C\" {
451766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#endif
451866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
451966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman/* Prevent the only kind of declaration conflicts we can make. */
452066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#define lt_preloaded_symbols some_other_symbol
452166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
452266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman/* External symbol declarations for the compiler. */\
452366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"
452466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
452566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$dlself" = yes; then
452666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $show "generating symbol list for \`$output'"
452766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
452866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
452966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
453066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Add our own program objects to the symbol list.
453166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
453266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for arg in $progfiles; do
453366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $show "extracting global C symbols from \`$arg'"
453466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
453566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done
453666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
453766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -n "$exclude_expsyms"; then
453866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
453966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $run eval '$mv "$nlist"T "$nlist"'
454066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
454166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
454266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -n "$export_symbols_regex"; then
454366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
454466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $run eval '$mv "$nlist"T "$nlist"'
454566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
454666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
454766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Prepare the list of exported symbols
454866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -z "$export_symbols"; then
454966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      export_symbols="$output_objdir/$outputname.exp"
455066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $run $rm $export_symbols
455166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
455266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman              case $host in
455366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman              *cygwin* | *mingw* )
455466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
455566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
455666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman                ;;
455766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman              esac
455866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
455966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
456066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
456166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $run eval 'mv "$nlist"T "$nlist"'
456266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman              case $host in
456366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman              *cygwin* | *mingw* )
456466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
456566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
456666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman                ;;
456766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman              esac
456866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
456966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
457066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
457166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for arg in $dlprefiles; do
457266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $show "extracting global C symbols from \`$arg'"
457366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
457466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $run eval '$echo ": $name " >> "$nlist"'
457566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
457666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
457766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
457866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -z "$run"; then
457966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Make sure we have at least an empty file.
458066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    test -f "$nlist" || : > "$nlist"
458166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
458266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -n "$exclude_expsyms"; then
458366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
458466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $mv "$nlist"T "$nlist"
458566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
458666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
458766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Try sorting and uniquifying the output.
458866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if grep -v "^: " < "$nlist" |
458966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if sort -k 3 </dev/null >/dev/null 2>&1; then
459066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  sort -k 3
459166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		else
459266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  sort +2
459366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		fi |
459466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		uniq > "$nlist"S; then
459566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      :
459666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
459766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      grep -v "^: " < "$nlist" > "$nlist"S
459866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
459966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
460066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -f "$nlist"S; then
460166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
460266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
460366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
460466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
460566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
460666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo >> "$output_objdir/$dlsyms" "\
460766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
460866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#undef lt_preloaded_symbols
460966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
461066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#if defined (__STDC__) && __STDC__
461166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# define lt_ptr void *
461266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#else
461366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# define lt_ptr char *
461466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# define const
461566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#endif
461666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
461766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman/* The mapping between symbol names and symbols. */
461866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"
461966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
462066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case $host in
462166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *cygwin* | *mingw* )
462266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo >> "$output_objdir/$dlsyms" "\
462366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman/* DATA imports from DLLs on WIN32 can't be const, because
462466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman   runtime relocations are performed -- see ld's documentation
462566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman   on pseudo-relocs */
462666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanstruct {
462766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"
462866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      ;;
462966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    * )
463066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo >> "$output_objdir/$dlsyms" "\
463166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanconst struct {
463266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"
463366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      ;;
463466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac
463566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
463666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
463766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo >> "$output_objdir/$dlsyms" "\
463866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  const char *name;
463966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  lt_ptr address;
464066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman}
464166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanlt_preloaded_symbols[] =
464266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman{\
464366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"
464466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
464566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
464666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
464766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo >> "$output_objdir/$dlsyms" "\
464866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  {0, (lt_ptr) 0}
464966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman};
465066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
465166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman/* This works around a problem in FreeBSD linker */
465266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#ifdef FREEBSD_WORKAROUND
465366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanstatic const void *lt_preloaded_setup() {
465466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  return lt_preloaded_symbols;
465566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman}
465666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#endif
465766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
465866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#ifdef __cplusplus
465966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman}
466066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#endif\
466166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"
466266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
466366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
466466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  pic_flag_for_symtable=
466566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $host in
466666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # compiling the symbol table file with pic_flag works around
466766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # a FreeBSD bug that causes programs to crash when -lm is
466866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # linked before any other PIC object.  But we must not use
466966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # pic_flag when linking with -static.  The problem exists in
467066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
467166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
467266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case "$compile_command " in
467366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *" -static "*) ;;
467466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
467566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac;;
467666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *-*-hpux*)
467766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case "$compile_command " in
467866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *" -static "*) ;;
467966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *) pic_flag_for_symtable=" $pic_flag";;
468066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac
468166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
468266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
468366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Now compile the dynamic symbol file.
468466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
468566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
468666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
468766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Clean up the generated files.
468866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
468966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
469066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
469166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Transform the symbol file into the correct name.
469266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          case $host in
469366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          *cygwin* | *mingw* )
469466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            if test -f "$output_objdir/${outputname}.def" ; then
469566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
469666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
469766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            else
469866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
469966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
470066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman             fi
470166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            ;;
470266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          * )
470366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
470466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
470566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            ;;
470666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          esac
470766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
470866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*)
470966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
471066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
471166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
471266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
471366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      else
471466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# We keep going just in case the user didn't refer to
471566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
471666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# really was required.
471766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
471866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Nullify the symbol file.
471966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
472066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
472166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
472266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
472366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
472466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Replace the output file specification.
472566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
472666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	link_command="$compile_command$compile_rpath"
472766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
472866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# We have no uninstalled library dependencies, so finalize right now.
472966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$show "$link_command"
473066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$run eval "$link_command"
473166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit_status=$?
473266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
473366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Delete the generated files.
473466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$dlsyms"; then
473566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $show "$rm $output_objdir/${outputname}S.${objext}"
473666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $run $rm "$output_objdir/${outputname}S.${objext}"
473766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
473866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
473966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit $exit_status
474066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
474166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
474266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$shlibpath_var"; then
474366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# We should set the shlibpath_var
474466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	rpath=
474566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	for dir in $temp_rpath; do
474666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $dir in
474766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  [\\/]* | [A-Za-z]:[\\/]*)
474866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Absolute path.
474966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    rpath="$rpath$dir:"
475066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
475166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *)
475266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Relative path: add a thisdir entry.
475366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    rpath="$rpath\$thisdir/$dir:"
475466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
475566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
475666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	done
475766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	temp_rpath="$rpath"
475866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
475966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
476066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$compile_shlibpath$finalize_shlibpath"; then
476166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
476266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
476366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$finalize_shlibpath"; then
476466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
476566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
476666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
476766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      compile_var=
476866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      finalize_var=
476966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$runpath_var"; then
477066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$perm_rpath"; then
477166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # We should set the runpath_var.
477266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  rpath=
477366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for dir in $perm_rpath; do
477466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    rpath="$rpath$dir:"
477566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
477666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
477766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
477866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$finalize_perm_rpath"; then
477966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # We should set the runpath_var.
478066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  rpath=
478166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for dir in $finalize_perm_rpath; do
478266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    rpath="$rpath$dir:"
478366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
478466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
478566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
478666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
478766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
478866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$no_install" = yes; then
478966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# We don't need to create a wrapper script.
479066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	link_command="$compile_var$compile_command$compile_rpath"
479166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Replace the output file specification.
479266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
479366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Delete the old output file.
479466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$run $rm $output
479566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Link the executable and exit
479666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$show "$link_command"
479766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$run eval "$link_command" || exit $?
479866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit $EXIT_SUCCESS
479966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
480066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
480166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$hardcode_action" = relink; then
480266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Fast installation is not supported
480366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	link_command="$compile_var$compile_command$compile_rpath"
480466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	relink_command="$finalize_var$finalize_command$finalize_rpath"
480566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
480666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
480766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: \`$output' will be relinked during installation" 1>&2
480866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      else
480966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$fast_install" != no; then
481066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  link_command="$finalize_var$compile_command$finalize_rpath"
481166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$fast_install" = yes; then
481266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
481366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
481466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # fast_install is set to needless
481566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    relink_command=
481666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
481766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
481866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  link_command="$compile_var$compile_command$compile_rpath"
481966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  relink_command="$finalize_var$finalize_command$finalize_rpath"
482066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
482166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
482266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
482366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Replace the output file specification.
482466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
482566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
482666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Delete the old output files.
482766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
482866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
482966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $show "$link_command"
483066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $run eval "$link_command" || exit $?
483166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
483266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Now create the wrapper script.
483366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $show "creating $output"
483466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
483566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Quote the relink command for shipping.
483666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$relink_command"; then
483766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Preserve any variables that may affect compiler behavior
483866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	for var in $variables_saved_for_relink; do
483966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if eval test -z \"\${$var+set}\"; then
484066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
484166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  elif eval var_value=\$$var; test -z "$var_value"; then
484266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    relink_command="$var=; export $var; $relink_command"
484366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
484466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
484566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
484666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
484766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	done
484866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	relink_command="(cd `pwd`; $relink_command)"
484966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
485066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
485166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
485266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Quote $echo for shipping.
485366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
485466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $progpath in
485566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
485666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
485766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
485866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
485966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      else
486066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
486166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
486266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
486366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Only actually do things if our run command is non-null.
486466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -z "$run"; then
486566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# win32 will think the script is a binary if it has
486666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# a .exe suffix, so we strip it off here.
486766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $output in
486866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
486966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
487066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# test for cygwin because mv fails w/o .exe extensions
487166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $host in
487266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *cygwin*)
487366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    exeext=.exe
487466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
487566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *) exeext= ;;
487666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
487766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $host in
487866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *cygwin* | *mingw* )
487966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            output_name=`basename $output`
488066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            output_path=`dirname $output`
488166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            cwrappersource="$output_path/$objdir/lt-$output_name.c"
488266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            cwrapper="$output_path/$output_name.exe"
488366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            $rm $cwrappersource $cwrapper
488466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
488566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
488666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    cat > $cwrappersource <<EOF
488766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
488866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
488966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
489066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
489166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman   The $output program cannot be directly executed until all the libtool
489266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman   libraries that it depends on are installed.
489366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
489466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman   This wrapper executable should never be moved out of the build directory.
489566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman   If it is, it will not operate correctly.
489666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
489766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman   Currently, it simply execs the wrapper *script* "/bin/sh $output",
489866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman   but could eventually absorb all of the scripts functionality and
489966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman   exec $objdir/$outputname directly.
490066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman*/
490166b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanEOF
490266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    cat >> $cwrappersource<<"EOF"
490366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#include <stdio.h>
490466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#include <stdlib.h>
490566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#include <unistd.h>
490666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#include <malloc.h>
490766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#include <stdarg.h>
490866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#include <assert.h>
490966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#include <string.h>
491066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#include <ctype.h>
491166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#include <sys/stat.h>
491266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
491366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#if defined(PATH_MAX)
491466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# define LT_PATHMAX PATH_MAX
491566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#elif defined(MAXPATHLEN)
491666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# define LT_PATHMAX MAXPATHLEN
491766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#else
491866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# define LT_PATHMAX 1024
491966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#endif
492066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
492166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#ifndef DIR_SEPARATOR
492266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# define DIR_SEPARATOR '/'
492366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# define PATH_SEPARATOR ':'
492466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#endif
492566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
492666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
492766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  defined (__OS2__)
492866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# define HAVE_DOS_BASED_FILE_SYSTEM
492966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# ifndef DIR_SEPARATOR_2
493066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#  define DIR_SEPARATOR_2 '\\'
493166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# endif
493266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# ifndef PATH_SEPARATOR_2
493366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#  define PATH_SEPARATOR_2 ';'
493466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# endif
493566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#endif
493666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
493766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#ifndef DIR_SEPARATOR_2
493866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
493966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#else /* DIR_SEPARATOR_2 */
494066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# define IS_DIR_SEPARATOR(ch) \
494166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
494266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#endif /* DIR_SEPARATOR_2 */
494366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
494466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#ifndef PATH_SEPARATOR_2
494566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
494666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#else /* PATH_SEPARATOR_2 */
494766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
494866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#endif /* PATH_SEPARATOR_2 */
494966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
495066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
495166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#define XFREE(stale) do { \
495266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if (stale) { free ((void *) stale); stale = 0; } \
495366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman} while (0)
495466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
495566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman/* -DDEBUG is fairly common in CFLAGS.  */
495666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#undef DEBUG
495766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#if defined DEBUGWRAPPER
495866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
495966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#else
496066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# define DEBUG(format, ...)
496166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#endif
496266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
496366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanconst char *program_name = NULL;
496466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
496566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanvoid * xmalloc (size_t num);
496666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanchar * xstrdup (const char *string);
496766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanconst char * base_name (const char *name);
496866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanchar * find_executable(const char *wrapper);
496966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanint    check_executable(const char *path);
497066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanchar * strendzap(char *str, const char *pat);
497166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanvoid lt_fatal (const char *message, ...);
497266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
497366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanint
497466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanmain (int argc, char *argv[])
497566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman{
497666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  char **newargz;
497766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  int i;
497866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
497966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  program_name = (char *) xstrdup (base_name (argv[0]));
498066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  DEBUG("(main) argv[0]      : %s\n",argv[0]);
498166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  DEBUG("(main) program_name : %s\n",program_name);
498266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  newargz = XMALLOC(char *, argc+2);
498366b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanEOF
498466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
498566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            cat >> $cwrappersource <<EOF
498666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  newargz[0] = (char *) xstrdup("$SHELL");
498766b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanEOF
498866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
498966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            cat >> $cwrappersource <<"EOF"
499066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  newargz[1] = find_executable(argv[0]);
499166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if (newargz[1] == NULL)
499266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    lt_fatal("Couldn't find %s", argv[0]);
499366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  DEBUG("(main) found exe at : %s\n",newargz[1]);
499466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  /* we know the script has the same name, without the .exe */
499566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  /* so make sure newargz[1] doesn't end in .exe */
499666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  strendzap(newargz[1],".exe");
499766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  for (i = 1; i < argc; i++)
499866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    newargz[i+1] = xstrdup(argv[i]);
499966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  newargz[argc+1] = NULL;
500066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
500166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  for (i=0; i<argc+1; i++)
500266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  {
500366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
500466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;
500566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  }
500666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
500766b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanEOF
500866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
500966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            case $host_os in
501066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman              mingw*)
501166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman                cat >> $cwrappersource <<EOF
501266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  execv("$SHELL",(char const **)newargz);
501366b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanEOF
501466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman              ;;
501566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman              *)
501666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman                cat >> $cwrappersource <<EOF
501766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  execv("$SHELL",newargz);
501866b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanEOF
501966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman              ;;
502066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            esac
502166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
502266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            cat >> $cwrappersource <<"EOF"
502366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  return 127;
502466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman}
502566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
502666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanvoid *
502766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanxmalloc (size_t num)
502866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman{
502966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  void * p = (void *) malloc (num);
503066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if (!p)
503166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    lt_fatal ("Memory exhausted");
503266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
503366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  return p;
503466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman}
503566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
503666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanchar *
503766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanxstrdup (const char *string)
503866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman{
503966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
504066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman;
504166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman}
504266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
504366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanconst char *
504466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanbase_name (const char *name)
504566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman{
504666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  const char *base;
504766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
504866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
504966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  /* Skip over the disk name in MSDOS pathnames. */
505066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
505166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    name += 2;
505266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#endif
505366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
505466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  for (base = name; *name; name++)
505566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if (IS_DIR_SEPARATOR (*name))
505666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      base = name + 1;
505766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  return base;
505866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman}
505966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
506066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanint
506166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumancheck_executable(const char * path)
506266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman{
506366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  struct stat st;
506466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
506566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
506666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if ((!path) || (!*path))
506766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    return 0;
506866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
506966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if ((stat (path, &st) >= 0) &&
507066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      (
507166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
507266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#if defined (S_IXOTH)
507366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
507466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#endif
507566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#if defined (S_IXGRP)
507666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
507766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#endif
507866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman       ((st.st_mode & S_IXUSR) == S_IXUSR))
507966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      )
508066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    return 1;
508166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  else
508266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    return 0;
508366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman}
508466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
508566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman/* Searches for the full path of the wrapper.  Returns
508666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman   newly allocated full path name if found, NULL otherwise */
508766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanchar *
508866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanfind_executable (const char* wrapper)
508966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman{
509066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  int has_slash = 0;
509166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  const char* p;
509266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  const char* p_next;
509366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  /* static buffer for getcwd */
509466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  char tmp[LT_PATHMAX + 1];
509566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  int tmp_len;
509666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  char* concat_name;
509766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
509866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
509966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
510066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if ((wrapper == NULL) || (*wrapper == '\0'))
510166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    return NULL;
510266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
510366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  /* Absolute path? */
510466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
510566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
510666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  {
510766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    concat_name = xstrdup (wrapper);
510866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if (check_executable(concat_name))
510966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      return concat_name;
511066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    XFREE(concat_name);
511166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  }
511266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  else
511366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  {
511466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#endif
511566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if (IS_DIR_SEPARATOR (wrapper[0]))
511666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    {
511766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      concat_name = xstrdup (wrapper);
511866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if (check_executable(concat_name))
511966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        return concat_name;
512066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      XFREE(concat_name);
512166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    }
512266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
512366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  }
512466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#endif
512566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
512666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  for (p = wrapper; *p; p++)
512766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if (*p == '/')
512866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    {
512966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      has_slash = 1;
513066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      break;
513166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    }
513266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if (!has_slash)
513366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  {
513466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    /* no slashes; search PATH */
513566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    const char* path = getenv ("PATH");
513666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if (path != NULL)
513766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    {
513866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for (p = path; *p; p = p_next)
513966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      {
514066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        const char* q;
514166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        size_t p_len;
514266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        for (q = p; *q; q++)
514366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          if (IS_PATH_SEPARATOR(*q))
514466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            break;
514566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        p_len = q - p;
514666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        p_next = (*q == '\0' ? q : q + 1);
514766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        if (p_len == 0)
514866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        {
514966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          /* empty path: current directory */
515066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          if (getcwd (tmp, LT_PATHMAX) == NULL)
515166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman            lt_fatal ("getcwd failed");
515266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          tmp_len = strlen(tmp);
515366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
515466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          memcpy (concat_name, tmp, tmp_len);
515566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          concat_name[tmp_len] = '/';
515666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          strcpy (concat_name + tmp_len + 1, wrapper);
515766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        }
515866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        else
515966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        {
516066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
516166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          memcpy (concat_name, p, p_len);
516266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          concat_name[p_len] = '/';
516366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          strcpy (concat_name + p_len + 1, wrapper);
516466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        }
516566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        if (check_executable(concat_name))
516666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          return concat_name;
516766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        XFREE(concat_name);
516866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      }
516966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    }
517066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    /* not found in PATH; assume curdir */
517166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  }
517266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  /* Relative path | not found in path: prepend cwd */
517366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if (getcwd (tmp, LT_PATHMAX) == NULL)
517466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    lt_fatal ("getcwd failed");
517566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  tmp_len = strlen(tmp);
517666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
517766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  memcpy (concat_name, tmp, tmp_len);
517866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  concat_name[tmp_len] = '/';
517966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  strcpy (concat_name + tmp_len + 1, wrapper);
518066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
518166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if (check_executable(concat_name))
518266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    return concat_name;
518366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  XFREE(concat_name);
518466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  return NULL;
518566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman}
518666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
518766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanchar *
518866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanstrendzap(char *str, const char *pat)
518966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman{
519066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  size_t len, patlen;
519166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
519266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  assert(str != NULL);
519366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  assert(pat != NULL);
519466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
519566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  len = strlen(str);
519666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  patlen = strlen(pat);
519766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
519866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if (patlen <= len)
519966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  {
520066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    str += len - patlen;
520166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if (strcmp(str, pat) == 0)
520266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *str = '\0';
520366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  }
520466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  return str;
520566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman}
520666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
520766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanstatic void
520866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanlt_error_core (int exit_status, const char * mode,
520966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          const char * message, va_list ap)
521066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman{
521166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  fprintf (stderr, "%s: %s: ", program_name, mode);
521266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  vfprintf (stderr, message, ap);
521366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  fprintf (stderr, ".\n");
521466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
521566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if (exit_status >= 0)
521666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    exit (exit_status);
521766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman}
521866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
521966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanvoid
522066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanlt_fatal (const char *message, ...)
522166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman{
522266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  va_list ap;
522366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  va_start (ap, message);
522466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
522566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  va_end (ap);
522666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman}
522766b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanEOF
522866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          # we should really use a build-platform specific compiler
522966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          # here, but OTOH, the wrappers (shell script and this C one)
523066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          # are only useful if you want to execute the "real" binary.
523166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          # Since the "real" binary is built for $host, then this
523266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          # wrapper might as well be built for $host, too.
523366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
523466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman          ;;
523566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        esac
523666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        $rm $output
523766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
523866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
523966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo > $output "\
524066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#! $SHELL
524166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
524266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# $output - temporary wrapper script for $objdir/$outputname
524366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
524466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#
524566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# The $output program cannot be directly executed until all the libtool
524666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# libraries that it depends on are installed.
524766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#
524866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# This wrapper script should never be moved out of the build directory.
524966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# If it is, it will not operate correctly.
525066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
525166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Sed substitution that helps us do robust quoting.  It backslashifies
525266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# metacharacters that are still active within double-quoted strings.
525366b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanXsed='${SED} -e 1s/^X//'
525466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumansed_quote_subst='$sed_quote_subst'
525566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
525666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# The HP-UX ksh and POSIX shell print the target directory to stdout
525766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# if CDPATH is set.
525866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
525966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
526066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanrelink_command=\"$relink_command\"
526166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
526266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# This environment variable determines our operation mode.
526366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanif test \"\$libtool_install_magic\" = \"$magic\"; then
526466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # install mode needs the following variable:
526566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  notinst_deplibs='$notinst_deplibs'
526666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanelse
526766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # When we are sourced in execute mode, \$file and \$echo are already set.
526866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if test \"\$libtool_execute_magic\" != \"$magic\"; then
526966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    echo=\"$qecho\"
527066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    file=\"\$0\"
527166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Make sure echo works.
527266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test \"X\$1\" = X--no-reexec; then
527366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Discard the --no-reexec flag, and continue.
527466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      shift
527566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
527666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Yippee, \$echo works!
527766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      :
527866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    else
527966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Restart under the correct shell, and then maybe \$echo will work.
528066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
528166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
528266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  fi\
528366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"
528466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo >> $output "\
528566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
528666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # Find the directory that this script lives in.
528766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
528866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
528966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
529066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # Follow symbolic links until we get to the real thisdir.
529166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
529266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  while test -n \"\$file\"; do
529366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
529466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
529566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # If there was a directory component, then change thisdir.
529666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test \"x\$destdir\" != \"x\$file\"; then
529766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case \"\$destdir\" in
529866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
529966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *) thisdir=\"\$thisdir/\$destdir\" ;;
530066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
530166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
530266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
530366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
530466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
530566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  done
530666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
530766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # Try to get the absolute directory name.
530866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  absdir=\`cd \"\$thisdir\" && pwd\`
530966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  test -n \"\$absdir\" && thisdir=\"\$absdir\"
531066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"
531166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
531266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$fast_install" = yes; then
531366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo >> $output "\
531466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  program=lt-'$outputname'$exeext
531566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  progdir=\"\$thisdir/$objdir\"
531666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
531766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if test ! -f \"\$progdir/\$program\" || \\
531866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
531966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
532066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
532166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    file=\"\$\$-\$program\"
532266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
532366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test ! -d \"\$progdir\"; then
532466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $mkdir \"\$progdir\"
532566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    else
532666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $rm \"\$progdir/\$file\"
532766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi"
532866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
532966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo >> $output "\
533066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
533166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # relink executable if necessary
533266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -n \"\$relink_command\"; then
533366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
533466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      else
533566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo \"\$relink_command_output\" >&2
533666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$rm \"\$progdir/\$file\"
533766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit $EXIT_FAILURE
533866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
533966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
534066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
534166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
534266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    { $rm \"\$progdir/\$program\";
534366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
534466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $rm \"\$progdir/\$file\"
534566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  fi"
534666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
534766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo >> $output "\
534866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  program='$outputname'
534966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  progdir=\"\$thisdir/$objdir\"
535066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"
535166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
535266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
535366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo >> $output "\
535466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
535566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if test -f \"\$progdir/\$program\"; then"
535666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
535766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Export our shlibpath_var if we have one.
535866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
535966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo >> $output "\
536066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Add our own library path to $shlibpath_var
536166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
536266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
536366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Some systems cannot cope with colon-terminated $shlibpath_var
536466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # The second colon is a workaround for a bug in BeOS R4 sed
536566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
536666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
536766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    export $shlibpath_var
536866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"
536966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
537066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
537166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# fixup the dll searchpath if we need to.
537266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$dllsearchpath"; then
537366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo >> $output "\
537466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Add the dll search path components to the executable PATH
537566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    PATH=$dllsearchpath:\$PATH
537666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"
537766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
537866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
537966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo >> $output "\
538066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test \"\$libtool_execute_magic\" != \"$magic\"; then
538166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Run the actual program with our arguments.
538266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"
538366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $host in
538466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Backslashes separate directories on plain windows
538566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*-*-mingw | *-*-os2*)
538666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo >> $output "\
538766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
538866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"
538966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
539066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
539166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*)
539266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo >> $output "\
539366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exec \"\$progdir/\$program\" \${1+\"\$@\"}
539466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"
539566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
539666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
539766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo >> $output "\
539866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
539966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit $EXIT_FAILURE
540066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
540166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  else
540266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # The program doesn't exist.
540366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
540466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    \$echo \"This script is just a wrapper for \$program.\" 1>&2
540566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
540666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    exit $EXIT_FAILURE
540766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  fi
540866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanfi\
540966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"
541066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	chmod +x $output
541166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
541266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit $EXIT_SUCCESS
541366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
541466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    esac
541566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
541666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # See if we need to build an old-fashioned archive.
541766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    for oldlib in $oldlibs; do
541866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
541966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$build_libtool_libs" = convenience; then
542066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	oldobjs="$libobjs_save"
542166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	addlibs="$convenience"
542266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	build_libtool_libs=no
542366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      else
542466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$build_libtool_libs" = module; then
542566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  oldobjs="$libobjs_save"
542666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  build_libtool_libs=no
542766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
542866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  oldobjs="$old_deplibs $non_pic_objects"
542966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
543066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	addlibs="$old_convenience"
543166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
543266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
543366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$addlibs"; then
543466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	gentop="$output_objdir/${outputname}x"
543566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	generated="$generated $gentop"
543666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
543766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	func_extract_archives $gentop $addlibs
543866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	oldobjs="$oldobjs $func_extract_archives_result"
543966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
544066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
544166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Do each command in the archive commands.
544266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
544366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman       cmds=$old_archive_from_new_cmds
544466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      else
544566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# POSIX demands no paths to be encoded in archives.  We have
544666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# to avoid creating archives with duplicate basenames if we
544766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# might have to extract them afterwards, e.g., when creating a
544866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# static archive out of a convenience library, or when linking
544966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# the entirety of a libtool archive into another (currently
545066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# not supported by libtool).
545166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if (for obj in $oldobjs
545266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    do
545366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
545466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done | sort | sort -uc >/dev/null 2>&1); then
545566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  :
545666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
545766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "copying selected object files to avoid basename conflicts..."
545866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
545966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -z "$gentop"; then
546066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    gentop="$output_objdir/${outputname}x"
546166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    generated="$generated $gentop"
546266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
546366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $show "${rm}r $gentop"
546466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $run ${rm}r "$gentop"
546566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $show "$mkdir $gentop"
546666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $run $mkdir "$gentop"
546766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    exit_status=$?
546866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
546966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      exit $exit_status
547066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
547166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
547266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
547366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  save_oldobjs=$oldobjs
547466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  oldobjs=
547566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  counter=1
547666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for obj in $save_oldobjs
547766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  do
547866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
547966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case " $oldobjs " in
548066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    " ") oldobjs=$obj ;;
548166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *[\ /]"$objbase "*)
548266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      while :; do
548366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		# Make sure we don't pick an alternate name that also
548466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		# overlaps.
548566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		newobj=lt$counter-$objbase
548666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		counter=`expr $counter + 1`
548766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		case " $oldobjs " in
548866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*[\ /]"$newobj "*) ;;
548966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
549066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		esac
549166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      done
549266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
549366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $run ln "$obj" "$gentop/$newobj" ||
549466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $run cp "$obj" "$gentop/$newobj"
549566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      oldobjs="$oldobjs $gentop/$newobj"
549666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      ;;
549766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *) oldobjs="$oldobjs $obj" ;;
549866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac
549966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
550066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
550166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
550266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	eval cmds=\"$old_archive_cmds\"
550366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
550466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if len=`expr "X$cmds" : ".*"` &&
550566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
550666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  cmds=$old_archive_cmds
550766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
550866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # the command line is too long to link in one step, link in parts
550966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "using piecewise archive linking..."
551066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  save_RANLIB=$RANLIB
551166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  RANLIB=:
551266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  objlist=
551366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  concat_cmds=
551466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  save_oldobjs=$oldobjs
551566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
551666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Is there a better way of finding the last object in the list?
551766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for obj in $save_oldobjs
551866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  do
551966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    last_oldobj=$obj
552066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
552166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for obj in $save_oldobjs
552266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  do
552366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    oldobjs="$objlist $obj"
552466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    objlist="$objlist $obj"
552566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    eval test_cmds=\"$old_archive_cmds\"
552666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
552766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	       test "$len" -le "$max_cmd_len"; then
552866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      :
552966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
553066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # the above command should be used before it gets too long
553166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      oldobjs=$objlist
553266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test "$obj" = "$last_oldobj" ; then
553366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	        RANLIB=$save_RANLIB
553466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
553566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
553666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
553766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      objlist=
553866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
553966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
554066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  RANLIB=$save_RANLIB
554166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  oldobjs=$objlist
554266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "X$oldobjs" = "X" ; then
554366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    eval cmds=\"\$concat_cmds\"
554466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
554566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
554666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
554766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
554866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
554966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      save_ifs="$IFS"; IFS='~'
555066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for cmd in $cmds; do
555166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman        eval cmd=\"$cmd\"
555266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	IFS="$save_ifs"
555366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$show "$cmd"
555466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$run eval "$cmd" || exit $?
555566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
555666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      IFS="$save_ifs"
555766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    done
555866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
555966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -n "$generated"; then
556066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $show "${rm}r$generated"
556166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $run ${rm}r$generated
556266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
556366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
556466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Now create the libtool archive.
556566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    case $output in
556666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *.la)
556766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      old_library=
556866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      test "$build_old_libs" = yes && old_library="$libname.$libext"
556966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $show "creating $output"
557066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
557166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Preserve any variables that may affect compiler behavior
557266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for var in $variables_saved_for_relink; do
557366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if eval test -z \"\${$var+set}\"; then
557466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
557566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	elif eval var_value=\$$var; test -z "$var_value"; then
557666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  relink_command="$var=; export $var; $relink_command"
557766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
557866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
557966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
558066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
558166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
558266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Quote the link command for shipping.
558366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
558466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
558566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$hardcode_automatic" = yes ; then
558666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	relink_command=
558766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
558866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
558966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
559066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Only create the output if not a dry run.
559166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -z "$run"; then
559266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	for installed in no yes; do
559366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$installed" = yes; then
559466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -z "$install_libdir"; then
559566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      break
559666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
559766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    output="$output_objdir/$outputname"i
559866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Replace all uninstalled libtool libraries with the installed ones
559966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    newdependency_libs=
560066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for deplib in $dependency_libs; do
560166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case $deplib in
560266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *.la)
560366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
560466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
560566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if test -z "$libdir"; then
560666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
560766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  exit $EXIT_FAILURE
560866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		fi
560966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		newdependency_libs="$newdependency_libs $libdir/$name"
561066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		;;
561166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *) newdependency_libs="$newdependency_libs $deplib" ;;
561266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
561366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done
561466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    dependency_libs="$newdependency_libs"
561566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    newdlfiles=
561666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for lib in $dlfiles; do
561766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
561866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
561966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test -z "$libdir"; then
562066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
562166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		exit $EXIT_FAILURE
562266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
562366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      newdlfiles="$newdlfiles $libdir/$name"
562466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done
562566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    dlfiles="$newdlfiles"
562666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    newdlprefiles=
562766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for lib in $dlprefiles; do
562866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
562966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
563066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test -z "$libdir"; then
563166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
563266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		exit $EXIT_FAILURE
563366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
563466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      newdlprefiles="$newdlprefiles $libdir/$name"
563566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done
563666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    dlprefiles="$newdlprefiles"
563766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
563866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    newdlfiles=
563966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for lib in $dlfiles; do
564066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case $lib in
564166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
564266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*) abs=`pwd`"/$lib" ;;
564366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
564466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      newdlfiles="$newdlfiles $abs"
564566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done
564666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    dlfiles="$newdlfiles"
564766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    newdlprefiles=
564866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for lib in $dlprefiles; do
564966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case $lib in
565066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
565166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		*) abs=`pwd`"/$lib" ;;
565266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
565366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      newdlprefiles="$newdlprefiles $abs"
565466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done
565566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    dlprefiles="$newdlprefiles"
565666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
565766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $rm $output
565866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # place dlname in correct position for cygwin
565966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  tdlname=$dlname
566066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $host,$output,$installed,$module,$dlname in
566166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
566266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
566366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo > $output "\
566466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# $outputname - a libtool library file
566566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
566666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman#
566766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Please DO NOT delete this file!
566866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# It is necessary for linking the library.
566966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
567066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# The name that we can dlopen(3).
567166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumandlname='$tdlname'
567266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
567366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Names of this library.
567466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanlibrary_names='$library_names'
567566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
567666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# The name of the static archive.
567766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanold_library='$old_library'
567866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
567966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Libraries that this one depends upon.
568066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumandependency_libs='$dependency_libs'
568166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
568266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Version information for $libname.
568366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumancurrent=$current
568466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanage=$age
568566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanrevision=$revision
568666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
568766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Is this an already installed library?
568866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumaninstalled=$installed
568966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
569066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Should we warn about portability when linking against -modules?
569166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanshouldnotlink=$module
569266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
569366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Files to dlopen/dlpreopen
569466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumandlopen='$dlfiles'
569566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumandlpreopen='$dlprefiles'
569666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
569766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Directory that this library needs to be installed in:
569866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanlibdir='$install_libdir'"
569966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$installed" = no && test "$need_relink" = yes; then
570066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo >> $output "\
570166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanrelink_command=\"$relink_command\""
570266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
570366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	done
570466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
570566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
570666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Do a symbolic link so that the libtool archive can be found in
570766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # LD_LIBRARY_PATH before the program is installed.
570866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
570966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
571066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
571166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    esac
571266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    exit $EXIT_SUCCESS
571366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
571466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
571566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # libtool install mode
571666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  install)
571766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    modename="$modename: install"
571866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
571966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # There may be an optional sh(1) argument at the beginning of
572066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # install_prog (especially on Windows NT).
572166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
572266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman       # Allow the use of GNU shtool's install command.
572366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman       $echo "X$nonopt" | grep shtool > /dev/null; then
572466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Aesthetically quote it.
572566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
572666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $arg in
572766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
572866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	arg="\"$arg\""
572966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
573066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
573166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      install_prog="$arg "
573266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      arg="$1"
573366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      shift
573466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    else
573566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      install_prog=
573666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      arg=$nonopt
573766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
573866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
573966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # The real first argument should be the name of the installation program.
574066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Aesthetically quote it.
574166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
574266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    case $arg in
574366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
574466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      arg="\"$arg\""
574566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
574666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    esac
574766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    install_prog="$install_prog$arg"
574866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
574966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # We need to accept at least all the BSD install flags.
575066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    dest=
575166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    files=
575266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    opts=
575366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    prev=
575466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    install_type=
575566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    isdir=no
575666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    stripme=
575766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    for arg
575866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    do
575966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$dest"; then
576066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	files="$files $dest"
576166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	dest=$arg
576266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
576366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
576466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
576566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $arg in
576666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -d) isdir=yes ;;
576766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -f) 
576866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      	case " $install_prog " in
576966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*[\\\ /]cp\ *) ;;
577066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*) prev=$arg ;;
577166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
577266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
577366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -g | -m | -o) prev=$arg ;;
577466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -s)
577566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	stripme=" -s"
577666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
577766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
577866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -*)
577966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
578066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *)
578166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# If the previous option needed an argument, then skip it.
578266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$prev"; then
578366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  prev=
578466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
578566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  dest=$arg
578666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
578766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
578866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
578966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
579066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
579166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Aesthetically quote the argument.
579266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
579366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $arg in
579466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
579566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	arg="\"$arg\""
579666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
579766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
579866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      install_prog="$install_prog $arg"
579966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    done
580066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
580166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -z "$install_prog"; then
580266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$modename: you must specify an install program" 1>&2
580366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$help" 1>&2
580466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit $EXIT_FAILURE
580566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
580666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
580766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -n "$prev"; then
580866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$modename: the \`$prev' option requires an argument" 1>&2
580966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$help" 1>&2
581066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit $EXIT_FAILURE
581166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
581266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
581366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -z "$files"; then
581466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -z "$dest"; then
581566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: no file or destination specified" 1>&2
581666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      else
581766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: you must specify a destination" 1>&2
581866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
581966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$help" 1>&2
582066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit $EXIT_FAILURE
582166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
582266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
582366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Strip any trailing slash from the destination.
582466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
582566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
582666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Check to see that the destination is a directory.
582766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    test -d "$dest" && isdir=yes
582866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test "$isdir" = yes; then
582966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      destdir="$dest"
583066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      destname=
583166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    else
583266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
583366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      test "X$destdir" = "X$dest" && destdir=.
583466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
583566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
583666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Not a directory, so check to see that there is only one file specified.
583766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      set dummy $files
583866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$#" -gt 2; then
583966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: \`$dest' is not a directory" 1>&2
584066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$help" 1>&2
584166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit $EXIT_FAILURE
584266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
584366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
584466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    case $destdir in
584566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    [\\/]* | [A-Za-z]:[\\/]*) ;;
584666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    *)
584766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for file in $files; do
584866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $file in
584966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*.lo) ;;
585066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*)
585166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
585266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$help" 1>&2
585366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
585466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
585566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
585666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
585766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      ;;
585866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    esac
585966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
586066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # This variable tells wrapper scripts just to set variables rather
586166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # than running their programs.
586266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    libtool_install_magic="$magic"
586366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
586466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    staticlibs=
586566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    future_libdirs=
586666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    current_libdirs=
586766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    for file in $files; do
586866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
586966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Do each installation.
587066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $file in
587166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *.$libext)
587266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Do the static libraries later.
587366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	staticlibs="$staticlibs $file"
587466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
587566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
587666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *.la)
587766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Check to see that this really is a libtool archive.
587866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
587966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
588066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
588166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$help" 1>&2
588266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
588366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
588466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
588566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	library_names=
588666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	old_library=
588766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	relink_command=
588866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# If there is no directory component, then add one.
588966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $file in
589066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*/* | *\\*) . $file ;;
589166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*) . ./$file ;;
589266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
589366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
589466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Add the libdir to current_libdirs if it is the destination.
589566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "X$destdir" = "X$libdir"; then
589666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case "$current_libdirs " in
589766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *" $libdir "*) ;;
589866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *) current_libdirs="$current_libdirs $libdir" ;;
589966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
590066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
590166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Note the libdir as a future libdir.
590266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case "$future_libdirs " in
590366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *" $libdir "*) ;;
590466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *) future_libdirs="$future_libdirs $libdir" ;;
590566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
590666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
590766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
590866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
590966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	test "X$dir" = "X$file/" && dir=
591066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	dir="$dir$objdir"
591166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
591266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$relink_command"; then
591366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Determine the prefix the user has applied to our future dir.
591466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
591566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
591666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Don't allow the user to place us outside of our expected
591766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # location b/c this prevents finding dependent libraries that
591866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # are installed to the same prefix.
591966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # At present, this check doesn't affect windows .dll's that
592066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # are installed into $libdir/../bin (currently, that works fine)
592166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # but it's something to keep an eye on.
592266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$inst_prefix_dir" = "$destdir"; then
592366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
592466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    exit $EXIT_FAILURE
592566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
592666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
592766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$inst_prefix_dir"; then
592866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Stick the inst_prefix_dir data into the link command.
592966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
593066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
593166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
593266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
593366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
593466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: warning: relinking \`$file'" 1>&2
593566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $show "$relink_command"
593666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if $run eval "$relink_command"; then :
593766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
593866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
593966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    exit $EXIT_FAILURE
594066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
594166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
594266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
594366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# See the names of the shared library.
594466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	set dummy $library_names
594566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$2"; then
594666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  realname="$2"
594766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  shift
594866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  shift
594966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
595066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  srcname="$realname"
595166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  test -n "$relink_command" && srcname="$realname"T
595266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
595366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Install the shared library and build the symlinks.
595466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $show "$install_prog $dir/$srcname $destdir/$realname"
595566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
595666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$stripme" && test -n "$striplib"; then
595766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $show "$striplib $destdir/$realname"
595866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $run eval "$striplib $destdir/$realname" || exit $?
595966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
596066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
596166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$#" -gt 0; then
596266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Delete the old symlinks, and create new ones.
596366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Try `ln -sf' first, because the `ln' binary might depend on
596466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
596566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # so we also need to try rm && ln -s.
596666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    for linkname
596766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    do
596866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test "$linkname" != "$realname"; then
596966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
597066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
597166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
597266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    done
597366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
597466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
597566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Do each command in the postinstall commands.
597666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  lib="$destdir/$realname"
597766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  cmds=$postinstall_cmds
597866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  save_ifs="$IFS"; IFS='~'
597966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for cmd in $cmds; do
598066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    IFS="$save_ifs"
598166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    eval cmd=\"$cmd\"
598266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $show "$cmd"
598366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $run eval "$cmd" || {
598466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      lt_exit=$?
598566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
598666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # Restore the uninstalled library and exit
598766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if test "$mode" = relink; then
598866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
598966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
599066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
599166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      exit $lt_exit
599266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    }
599366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
599466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  IFS="$save_ifs"
599566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
599666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
599766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Install the pseudo-library for information purposes.
599866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
599966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	instname="$dir/$name"i
600066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$show "$install_prog $instname $destdir/$name"
600166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$run eval "$install_prog $instname $destdir/$name" || exit $?
600266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
600366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Maybe install the static library, too.
600466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
600566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
600666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
600766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *.lo)
600866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Install (i.e. copy) a libtool object.
600966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
601066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Figure out destination file name, if it wasn't already specified.
601166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$destname"; then
601266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  destfile="$destdir/$destname"
601366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
601466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
601566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  destfile="$destdir/$destfile"
601666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
601766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
601866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Deduce the name of the destination old-style object file.
601966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $destfile in
602066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*.lo)
602166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
602266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
602366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*.$objext)
602466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  staticdest="$destfile"
602566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  destfile=
602666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
602766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*)
602866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
602966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$help" 1>&2
603066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
603166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
603266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
603366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
603466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Install the libtool object if requested.
603566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$destfile"; then
603666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $show "$install_prog $file $destfile"
603766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $run eval "$install_prog $file $destfile" || exit $?
603866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
603966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
604066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Install the old object if enabled.
604166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$build_old_libs" = yes; then
604266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Deduce the name of the old-style object file.
604366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
604466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
604566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $show "$install_prog $staticobj $staticdest"
604666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
604766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
604866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit $EXIT_SUCCESS
604966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
605066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
605166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *)
605266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Figure out destination file name, if it wasn't already specified.
605366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$destname"; then
605466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  destfile="$destdir/$destname"
605566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
605666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
605766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  destfile="$destdir/$destfile"
605866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
605966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
606066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# If the file is missing, and there is a .exe on the end, strip it
606166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# because it is most likely a libtool script we actually want to
606266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# install
606366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	stripped_ext=""
606466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $file in
606566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *.exe)
606666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test ! -f "$file"; then
606766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      file=`$echo $file|${SED} 's,.exe$,,'`
606866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      stripped_ext=".exe"
606966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
607066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
607166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
607266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
607366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Do a test to see if this is really a libtool program.
607466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $host in
607566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*cygwin*|*mingw*)
607666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
607766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
607866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*)
607966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    wrapper=$file
608066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
608166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
608266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
608366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  notinst_deplibs=
608466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  relink_command=
608566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
608666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Note that it is not necessary on cygwin/mingw to append a dot to
608766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
608866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
608966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # `FILE.' does not work on cygwin managed mounts.
609066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  #
609166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # If there is no directory component, then add one.
609266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $wrapper in
609366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  */* | *\\*) . ${wrapper} ;;
609466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *) . ./${wrapper} ;;
609566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
609666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
609766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Check the variables that should have been set.
609866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -z "$notinst_deplibs"; then
609966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
610066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    exit $EXIT_FAILURE
610166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
610266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
610366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  finalize=yes
610466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for lib in $notinst_deplibs; do
610566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Check to see that each library is installed.
610666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    libdir=
610766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -f "$lib"; then
610866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # If there is no directory component, then add one.
610966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      case $lib in
611066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      */* | *\\*) . $lib ;;
611166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      *) . ./$lib ;;
611266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      esac
611366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
611466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
611566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -n "$libdir" && test ! -f "$libfile"; then
611666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
611766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      finalize=no
611866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
611966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
612066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
612166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  relink_command=
612266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Note that it is not necessary on cygwin/mingw to append a dot to
612366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
612466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
612566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # `FILE.' does not work on cygwin managed mounts.
612666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  #
612766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # If there is no directory component, then add one.
612866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $wrapper in
612966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  */* | *\\*) . ${wrapper} ;;
613066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *) . ./${wrapper} ;;
613166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
613266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
613366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  outputname=
613466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test "$fast_install" = no && test -n "$relink_command"; then
613566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$finalize" = yes && test -z "$run"; then
613666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      tmpdir=`func_mktempdir`
613766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
613866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      outputname="$tmpdir/$file"
613966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # Replace the output file specification.
614066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
614166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
614266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $show "$relink_command"
614366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      if $run eval "$relink_command"; then :
614466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      else
614566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
614666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		${rm}r "$tmpdir"
614766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		continue
614866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      fi
614966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      file="$outputname"
615066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    else
615166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
615266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
615366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  else
615466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # Install the binary that we compiled earlier.
615566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
615666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
615766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
615866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
615966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# remove .exe since cygwin /usr/bin/install will append another
616066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# one anyway 
616166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $install_prog,$host in
616266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*/usr/bin/install*,*cygwin*)
616366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $file:$destfile in
616466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *.exe:*.exe)
616566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # this is ok
616666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
616766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *.exe:*)
616866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    destfile=$destfile.exe
616966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
617066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *:*.exe)
617166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
617266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
617366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
617466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  ;;
617566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
617666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$show "$install_prog$stripme $file $destfile"
617766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
617866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	test -n "$outputname" && ${rm}r "$tmpdir"
617966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
618066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
618166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    done
618266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
618366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    for file in $staticlibs; do
618466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
618566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
618666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Set up the ranlib parameters.
618766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      oldlib="$destdir/$name"
618866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
618966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $show "$install_prog $file $oldlib"
619066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $run eval "$install_prog \$file \$oldlib" || exit $?
619166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
619266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$stripme" && test -n "$old_striplib"; then
619366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$show "$old_striplib $oldlib"
619466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$run eval "$old_striplib $oldlib" || exit $?
619566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
619666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
619766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Do each command in the postinstall commands.
619866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      cmds=$old_postinstall_cmds
619966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      save_ifs="$IFS"; IFS='~'
620066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for cmd in $cmds; do
620166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	IFS="$save_ifs"
620266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	eval cmd=\"$cmd\"
620366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$show "$cmd"
620466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$run eval "$cmd" || exit $?
620566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
620666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      IFS="$save_ifs"
620766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    done
620866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
620966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -n "$future_libdirs"; then
621066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
621166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
621266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
621366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -n "$current_libdirs"; then
621466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Maybe just do a dry run.
621566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      test -n "$run" && current_libdirs=" -n$current_libdirs"
621666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
621766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    else
621866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit $EXIT_SUCCESS
621966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
622066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
622166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
622266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # libtool finish mode
622366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  finish)
622466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    modename="$modename: finish"
622566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    libdirs="$nonopt"
622666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    admincmds=
622766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
622866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
622966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for dir
623066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      do
623166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	libdirs="$libdirs $dir"
623266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
623366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
623466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      for libdir in $libdirs; do
623566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$finish_cmds"; then
623666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Do each command in the finish commands.
623766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  cmds=$finish_cmds
623866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  save_ifs="$IFS"; IFS='~'
623966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for cmd in $cmds; do
624066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    IFS="$save_ifs"
624166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    eval cmd=\"$cmd\"
624266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $show "$cmd"
624366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    $run eval "$cmd" || admincmds="$admincmds
624466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman       $cmd"
624566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
624666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  IFS="$save_ifs"
624766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
624866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -n "$finish_eval"; then
624966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Do the single finish_eval.
625066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  eval cmds=\"$finish_eval\"
625166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $run eval "$cmds" || admincmds="$admincmds
625266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman       $cmds"
625366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
625466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      done
625566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
625666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
625766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Exit here if they wanted silent mode.
625866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    test "$show" = : && exit $EXIT_SUCCESS
625966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
626066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "X----------------------------------------------------------------------" | $Xsed
626166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "Libraries have been installed in:"
626266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    for libdir in $libdirs; do
626366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "   $libdir"
626466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    done
626566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo
626666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "If you ever happen to want to link against installed libraries"
626766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "in a given directory, LIBDIR, you must either use libtool, and"
626866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
626966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "flag during linking and do at least one of the following:"
627066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -n "$shlibpath_var"; then
627166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
627266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "     during execution"
627366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
627466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -n "$runpath_var"; then
627566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
627666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "     during linking"
627766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
627866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -n "$hardcode_libdir_flag_spec"; then
627966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      libdir=LIBDIR
628066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      eval flag=\"$hardcode_libdir_flag_spec\"
628166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
628266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "   - use the \`$flag' linker flag"
628366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
628466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -n "$admincmds"; then
628566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "   - have your system administrator run these commands:$admincmds"
628666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
628766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -f /etc/ld.so.conf; then
628866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
628966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
629066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo
629166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "See any operating system documentation about shared libraries for"
629266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
629366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "X----------------------------------------------------------------------" | $Xsed
629466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    exit $EXIT_SUCCESS
629566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
629666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
629766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # libtool execute mode
629866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  execute)
629966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    modename="$modename: execute"
630066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
630166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # The first argument is the command name.
630266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    cmd="$nonopt"
630366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -z "$cmd"; then
630466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$modename: you must specify a COMMAND" 1>&2
630566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$help"
630666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit $EXIT_FAILURE
630766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
630866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
630966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Handle -dlopen flags immediately.
631066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    for file in $execute_dlfiles; do
631166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test ! -f "$file"; then
631266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: \`$file' is not a file" 1>&2
631366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$help" 1>&2
631466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit $EXIT_FAILURE
631566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
631666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
631766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      dir=
631866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $file in
631966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *.la)
632066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Check to see that this really is a libtool archive.
632166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
632266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
632366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
632466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$help" 1>&2
632566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
632666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
632766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
632866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Read the libtool library.
632966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	dlname=
633066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	library_names=
633166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
633266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# If there is no directory component, then add one.
633366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case $file in
633466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*/* | *\\*) . $file ;;
633566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	*) . ./$file ;;
633666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
633766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
633866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Skip this library if it cannot be dlopened.
633966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -z "$dlname"; then
634066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Warn if it was a shared library.
634166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
634266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  continue
634366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
634466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
634566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
634666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	test "X$dir" = "X$file" && dir=.
634766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
634866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test -f "$dir/$objdir/$dlname"; then
634966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  dir="$dir/$objdir"
635066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	else
635166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
635266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  exit $EXIT_FAILURE
635366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
635466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
635566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
635666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *.lo)
635766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Just add the directory containing the .lo file.
635866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
635966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	test "X$dir" = "X$file" && dir=.
636066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
636166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
636266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *)
636366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
636466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
636566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
636666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
636766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
636866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Get the absolute pathname.
636966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      absdir=`cd "$dir" && pwd`
637066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      test -n "$absdir" && dir="$absdir"
637166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
637266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Now add the directory to shlibpath_var.
637366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if eval "test -z \"\$$shlibpath_var\""; then
637466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	eval "$shlibpath_var=\"\$dir\""
637566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      else
637666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
637766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
637866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    done
637966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
638066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # This variable tells wrapper scripts just to set shlibpath_var
638166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # rather than running their programs.
638266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    libtool_execute_magic="$magic"
638366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
638466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Check if any of the arguments is a wrapper script.
638566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    args=
638666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    for file
638766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    do
638866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $file in
638966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -*) ;;
639066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *)
639166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Do a test to see if this is really a libtool program.
639266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
639366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # If there is no directory component, then add one.
639466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $file in
639566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  */* | *\\*) . $file ;;
639666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *) . ./$file ;;
639766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
639866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
639966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Transform arg to wrapped name.
640066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  file="$progdir/$program"
640166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
640266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
640366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
640466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Quote arguments (to preserve shell metacharacters).
640566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
640666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      args="$args \"$file\""
640766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    done
640866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
640966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -z "$run"; then
641066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$shlibpath_var"; then
641166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Export the shlibpath_var.
641266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	eval "export $shlibpath_var"
641366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
641466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
641566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Restore saved environment variables
641666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "${save_LC_ALL+set}" = set; then
641766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	LC_ALL="$save_LC_ALL"; export LC_ALL
641866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
641966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "${save_LANG+set}" = set; then
642066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	LANG="$save_LANG"; export LANG
642166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
642266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
642366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Now prepare to actually exec the command.
642466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exec_cmd="\$cmd$args"
642566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    else
642666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Display what would be done.
642766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -n "$shlibpath_var"; then
642866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
642966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$echo "export $shlibpath_var"
643066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
643166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$cmd$args"
643266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit $EXIT_SUCCESS
643366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
643466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
643566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
643666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  # libtool clean and uninstall mode
643766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  clean | uninstall)
643866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    modename="$modename: $mode"
643966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    rm="$nonopt"
644066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    files=
644166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    rmforce=
644266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    exit_status=0
644366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
644466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # This variable tells wrapper scripts just to set variables rather
644566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # than running their programs.
644666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    libtool_install_magic="$magic"
644766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
644866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    for arg
644966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    do
645066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $arg in
645166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -f) rm="$rm $arg"; rmforce=yes ;;
645266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      -*) rm="$rm $arg" ;;
645366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *) files="$files $arg" ;;
645466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
645566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    done
645666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
645766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    if test -z "$rm"; then
645866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$modename: you must specify an RM program" 1>&2
645966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $echo "$help" 1>&2
646066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      exit $EXIT_FAILURE
646166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    fi
646266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
646366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    rmdirs=
646466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
646566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    origobjdir="$objdir"
646666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    for file in $files; do
646766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
646866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "X$dir" = "X$file"; then
646966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	dir=.
647066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	objdir="$origobjdir"
647166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      else
647266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	objdir="$dir/$origobjdir"
647366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
647466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
647566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      test "$mode" = uninstall && objdir="$dir"
647666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
647766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Remember objdir for removal later, being careful to avoid duplicates
647866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test "$mode" = clean; then
647966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	case " $rmdirs " in
648066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *" $objdir "*) ;;
648166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *) rmdirs="$rmdirs $objdir" ;;
648266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	esac
648366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
648466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
648566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      # Don't error if the file doesn't exist and rm -f was used.
648666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if (test -L "$file") >/dev/null 2>&1 \
648766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	|| (test -h "$file") >/dev/null 2>&1 \
648866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	|| test -f "$file"; then
648966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	:
649066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      elif test -d "$file"; then
649166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	exit_status=1
649266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
649366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      elif test "$rmforce" = yes; then
649466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	continue
649566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
649666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
649766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      rmfiles="$file"
649866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
649966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      case $name in
650066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *.la)
650166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Possibly a libtool archive, so verify it.
650266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
650366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  . $dir/$name
650466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
650566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Delete the libtool libraries and symlinks.
650666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  for n in $library_names; do
650766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    rmfiles="$rmfiles $objdir/$n"
650866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  done
650966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
651066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
651166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case "$mode" in
651266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  clean)
651366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    case "  $library_names " in
651466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # "  " in the beginning catches empty $dlname
651566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *" $dlname "*) ;;
651666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
651766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    esac
651866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
651966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
652066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  uninstall)
652166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -n "$library_names"; then
652266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # Do each command in the postuninstall commands.
652366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      cmds=$postuninstall_cmds
652466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      save_ifs="$IFS"; IFS='~'
652566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      for cmd in $cmds; do
652666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		IFS="$save_ifs"
652766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		eval cmd=\"$cmd\"
652866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$show "$cmd"
652966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$run eval "$cmd"
653066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if test "$?" -ne 0 && test "$rmforce" != yes; then
653166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  exit_status=1
653266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		fi
653366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      done
653466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      IFS="$save_ifs"
653566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
653666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
653766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test -n "$old_library"; then
653866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      # Do each command in the old_postuninstall commands.
653966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      cmds=$old_postuninstall_cmds
654066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      save_ifs="$IFS"; IFS='~'
654166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      for cmd in $cmds; do
654266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		IFS="$save_ifs"
654366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		eval cmd=\"$cmd\"
654466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$show "$cmd"
654566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		$run eval "$cmd"
654666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		if test "$?" -ne 0 && test "$rmforce" != yes; then
654766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		  exit_status=1
654866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		fi
654966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      done
655066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      IFS="$save_ifs"
655166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
655266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # FIXME: should reinstall the best remaining shared library.
655366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
655466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
655566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
655666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
655766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
655866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *.lo)
655966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	# Possibly a libtool object, so verify it.
656066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
656166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
656266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Read the .lo file
656366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  . $dir/$name
656466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
656566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Add PIC object to the list of files to remove.
656666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$pic_object" \
656766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	     && test "$pic_object" != none; then
656866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    rmfiles="$rmfiles $dir/$pic_object"
656966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
657066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
657166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Add non-PIC object to the list of files to remove.
657266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if test -n "$non_pic_object" \
657366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	     && test "$non_pic_object" != none; then
657466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    rmfiles="$rmfiles $dir/$non_pic_object"
657566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
657666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
657766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
657866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
657966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      *)
658066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	if test "$mode" = clean ; then
658166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  noexename=$name
658266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  case $file in
658366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  *.exe)
658466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    file=`$echo $file|${SED} 's,.exe$,,'`
658566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    noexename=`$echo $name|${SED} 's,.exe$,,'`
658666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # $file with .exe has already been added to rmfiles,
658766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # add $file without .exe
658866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    rmfiles="$rmfiles $file"
658966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    ;;
659066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  esac
659166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  # Do a test to see if this is a libtool program.
659266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
659366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    relink_command=
659466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    . $dir/$noexename
659566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
659666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # note $name still contains .exe if it was in $file originally
659766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    # as does the version of $file that was added into $rmfiles
659866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
659966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "$fast_install" = yes && test -n "$relink_command"; then
660066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      rmfiles="$rmfiles $objdir/lt-$name"
660166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
660266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    if test "X$noexename" != "X$name" ; then
660366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
660466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	    fi
660566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	  fi
660666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	fi
660766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	;;
660866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      esac
660966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $show "$rm $rmfiles"
661066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      $run $rm $rmfiles || exit_status=1
661166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    done
661266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    objdir="$origobjdir"
661366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
661466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    # Try to remove the ${objdir}s in the directories where we deleted files
661566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    for dir in $rmdirs; do
661666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      if test -d "$dir"; then
661766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$show "rmdir $dir"
661866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman	$run rmdir $dir >/dev/null 2>&1
661966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      fi
662066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    done
662166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
662266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    exit $exit_status
662366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
662466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
662566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  "")
662666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "$modename: you must specify a MODE" 1>&2
662766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "$generic_help" 1>&2
662866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    exit $EXIT_FAILURE
662966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    ;;
663066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  esac
663166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
663266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  if test -z "$exec_cmd"; then
663366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "$modename: invalid operation mode \`$mode'" 1>&2
663466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    $echo "$generic_help" 1>&2
663566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    exit $EXIT_FAILURE
663666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  fi
663766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanfi # test -z "$show_help"
663866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
663966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanif test -n "$exec_cmd"; then
664066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  eval exec $exec_cmd
664166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  exit $EXIT_FAILURE
664266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanfi
664366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
664466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# We need to display help for each of the modes.
664566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumancase $mode in
664666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"") $echo \
664766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"Usage: $modename [OPTION]... [MODE-ARG]...
664866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
664966b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanProvide generalized library-building support services.
665066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
665166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    --config          show all configuration variables
665266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    --debug           enable verbose shell tracing
665366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman-n, --dry-run         display commands without modifying any files
665466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    --features        display basic configuration information and exit
665566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    --finish          same as \`--mode=finish'
665666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    --help            display this help message and exit
665766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
665866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    --quiet           same as \`--silent'
665966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    --silent          don't print informational messages
666066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    --tag=TAG         use configuration variables from tag TAG
666166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman    --version         print version information
666266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
666366b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanMODE must be one of the following:
666466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
666566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      clean           remove files from the build directory
666666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      compile         compile a source file into a libtool object
666766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      execute         automatically set library path, then run a program
666866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      finish          complete the installation of libtool libraries
666966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      install         install libraries or executables
667066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      link            create a library or an executable
667166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman      uninstall       remove libraries from an installed directory
667266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
667366b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanMODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
667466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumana more detailed description of MODE.
667566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
667666b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanReport bugs to <bug-libtool@gnu.org>."
667766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  exit $EXIT_SUCCESS
667866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  ;;
667966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
668066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanclean)
668166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  $echo \
668266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
668366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
668466b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanRemove files from the build directory.
668566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
668666b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanRM is the name of the program to use to delete files associated with each FILE
668766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
668866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanto RM.
668966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
669066b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanIf FILE is a libtool library, object or program, all the files associated
669166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanwith it are deleted. Otherwise, only FILE itself is deleted using RM."
669266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  ;;
669366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
669466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumancompile)
669566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  $echo \
669666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
669766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
669866b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanCompile a source file into a libtool library object.
669966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
670066b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanThis mode accepts the following additional options:
670166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
670266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
670366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -prefer-pic       try to building PIC objects only
670466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -prefer-non-pic   try to building non-PIC objects only
670566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -static           always build a \`.o' file suitable for static linking
670666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
670766b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanCOMPILE-COMMAND is a command to be used in creating a \`standard' object file
670866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanfrom the given SOURCEFILE.
670966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
671066b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanThe output file name is determined by removing the directory component from
671166b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanSOURCEFILE, then substituting the C source code suffix \`.c' with the
671266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanlibrary object suffix, \`.lo'."
671366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  ;;
671466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
671566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanexecute)
671666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  $echo \
671766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
671866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
671966b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanAutomatically set library path, then run a program.
672066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
672166b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanThis mode accepts the following additional options:
672266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
672366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -dlopen FILE      add the directory containing FILE to the library path
672466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
672566b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanThis mode sets the library path environment variable according to \`-dlopen'
672666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanflags.
672766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
672866b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanIf any of the ARGS are libtool executable wrappers, then they are translated
672966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumaninto their corresponding uninstalled binary, and any of their required library
673066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumandirectories are added to the library path.
673166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
673266b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanThen, COMMAND is executed, with ARGS as arguments."
673366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  ;;
673466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
673566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanfinish)
673666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  $echo \
673766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
673866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
673966b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanComplete the installation of libtool libraries.
674066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
674166b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanEach LIBDIR is a directory that contains libtool libraries.
674266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
674366b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanThe commands that this mode executes may require superuser privileges.  Use
674466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanthe \`--dry-run' option if you just want to see what would be executed."
674566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  ;;
674666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
674766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumaninstall)
674866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  $echo \
674966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
675066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
675166b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanInstall executables or libraries.
675266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
675366b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanINSTALL-COMMAND is the installation command.  The first component should be
675466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumaneither the \`install' or \`cp' program.
675566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
675666b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanThe rest of the components are interpreted as arguments to that command (only
675766b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanBSD-compatible install options are recognized)."
675866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  ;;
675966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
676066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanlink)
676166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  $echo \
676266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
676366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
676466b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanLink object files or libraries together to form another library, or to
676566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumancreate an executable program.
676666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
676766b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanLINK-COMMAND is a command using the C compiler that you would use to create
676866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumana program from several object files.
676966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
677066b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanThe following components of LINK-COMMAND are treated specially:
677166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
677266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -all-static       do not do any dynamic linking at all
677366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -avoid-version    do not add a version suffix if possible
677466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
677566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
677666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
677766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -export-symbols SYMFILE
677866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    try to export only the symbols listed in SYMFILE
677966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -export-symbols-regex REGEX
678066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    try to export only the symbols matching REGEX
678166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -LLIBDIR          search LIBDIR for required installed libraries
678266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -lNAME            OUTPUT-FILE requires the installed library libNAME
678366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -module           build a library that can dlopened
678466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -no-fast-install  disable the fast-install mode
678566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -no-install       link a not-installable executable
678666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -no-undefined     declare that a library does not refer to external symbols
678766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
678866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -objectlist FILE  Use a list of object files found in FILE to specify objects
678966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -precious-files-regex REGEX
679066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman                    don't remove output files matching REGEX
679166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -release RELEASE  specify package release information
679266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
679366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
679466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -static           do not do any dynamic linking of libtool libraries
679566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  -version-info CURRENT[:REVISION[:AGE]]
679666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman		    specify library version info [each variable defaults to 0]
679766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
679866b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanAll other options (arguments beginning with \`-') are ignored.
679966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
680066b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanEvery other argument is treated as a filename.  Files ending in \`.la' are
680166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumantreated as uninstalled libtool libraries, other files are standard or library
680266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanobject files.
680366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
680466b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanIf the OUTPUT-FILE ends in \`.la', then a libtool library is created,
680566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanonly library objects (\`.lo' files) may be specified, and \`-rpath' is
680666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanrequired, except when creating a convenience library.
680766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
680866b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
680966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanusing \`ar' and \`ranlib', or on Windows using \`lib'.
681066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
681166b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
681266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanis created, otherwise an executable program is created."
681366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  ;;
681466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
681566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanuninstall)
681666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  $echo \
681766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
681866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
681966b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanRemove libraries from an installation directory.
682066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
682166b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanRM is the name of the program to use to delete files associated with each FILE
682266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
682366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanto RM.
682466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
682566b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanIf FILE is a libtool library, all the files associated with it are deleted.
682666b8ab22586debccb1f787d4d52b7f042d4ddeb8John BaumanOtherwise, only FILE itself is deleted using RM."
682766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  ;;
682866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
682966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman*)
683066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  $echo "$modename: invalid operation mode \`$mode'" 1>&2
683166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  $echo "$help" 1>&2
683266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  exit $EXIT_FAILURE
683366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman  ;;
683466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanesac
683566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
683666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman$echo
683766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman$echo "Try \`$modename --help' for more information about other modes."
683866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
683966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumanexit $?
684066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
684166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# The TAGs below are defined such that we never get into a situation
684266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# in which we disable both kinds of libraries.  Given conflicting
684366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# choices, we go for a static library, that is the most portable,
684466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# since we can't tell whether shared libraries were disabled because
684566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# the user asked for that or because the platform doesn't support
684666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# them.  This is particularly important on AIX, because we don't
684766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# support having both static and shared libraries enabled at the same
684866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# time on that platform, so we default to a shared-only configuration.
684966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# If a disable-shared tag is given, we'll fallback to a static-only
685066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# configuration.  But we'll never go from static-only to shared-only.
685166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
685266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
685366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumandisable_libs=shared
685466b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# ### END LIBTOOL TAG CONFIG: disable-shared
685566b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
685666b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# ### BEGIN LIBTOOL TAG CONFIG: disable-static
685766b8ab22586debccb1f787d4d52b7f042d4ddeb8John Baumandisable_libs=static
685866b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# ### END LIBTOOL TAG CONFIG: disable-static
685966b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman
686066b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# Local Variables:
686166b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# mode:shell-script
686266b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# sh-indentation:2
686366b8ab22586debccb1f787d4d52b7f042d4ddeb8John Bauman# End:
6864