14ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# ltmain.sh - Provide generalized library-building support services.
24ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# NOTE: Changing this file will not affect anything until you rerun configure.
34ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#
4a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
54ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Free Software Foundation, Inc.
64ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
74ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#
84ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# This program is free software; you can redistribute it and/or modify
94ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# it under the terms of the GNU General Public License as published by
104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# the Free Software Foundation; either version 2 of the License, or
114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# (at your option) any later version.
124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#
134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# This program is distributed in the hope that it will be useful, but
144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# WITHOUT ANY WARRANTY; without even the implied warranty of
154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# General Public License for more details.
174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#
184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# You should have received a copy of the GNU General Public License
194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# along with this program; if not, write to the Free Software
20a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#
224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# As a special exception to the GNU General Public License, if you
234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# distribute this file as part of a program that contains a
244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# configuration script generated by Autoconf, you may include it under
254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# the same distribution terms that you use for the rest of that program.
264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
2704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencerbasename="s,^.*/,,g"
2804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
2904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
3004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer# is ksh but when the shell is invoked as "sh" and the current value of
3104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer# the _XPG environment variable is not equal to 1 (one), the special
3204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer# positional parameter $0, within a function call, is the name of the
3304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer# function.
3404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencerprogpath="$0"
3504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
3604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer# The name of this program:
3704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencerprogname=`echo "$progpath" | $SED $basename`
3804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencermodename="$progname"
3904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
4004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer# Global variables:
4104c2144f90f3bec9baf472038cf0ebd28a86e366Reid SpencerEXIT_SUCCESS=0
4204c2144f90f3bec9baf472038cf0ebd28a86e366Reid SpencerEXIT_FAILURE=1
4304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
4404c2144f90f3bec9baf472038cf0ebd28a86e366Reid SpencerPROGRAM=ltmain.sh
4504c2144f90f3bec9baf472038cf0ebd28a86e366Reid SpencerPACKAGE=libtool
46a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid SpencerVERSION=1.5.22
47a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid SpencerTIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
4804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
4904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer# See if we are running on zsh, and set the options which allow our
5004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer# commands through without removal of \ escapes.
5104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencerif test -n "${ZSH_VERSION+set}" ; then
5204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer  setopt NO_GLOB_SUBST
5304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencerfi
5404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Check that we have a working $echo.
564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellif test "X$1" = X--no-reexec; then
574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # Discard the --no-reexec flag, and continue.
584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  shift
594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellelif test "X$1" = X--fallback-echo; then
604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # Avoid inline document here, it may be left over
614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  :
624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # Yippee, $echo works!
644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  :
654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellelse
664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # Restart under the correct shell, and then maybe $echo will work.
6704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellfi
694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellif test "X$1" = X--fallback-echo; then
714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # used as fallback echo
724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  shift
734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  cat <<EOF
744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell$*
754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellEOF
7604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer  exit $EXIT_SUCCESS
774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellfi
784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelldefault_mode=
804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellhelp="Try \`$progname --help' for more information."
814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellmagic="%%%MAGIC variable%%%"
824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellmkdir="mkdir"
834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellmv="mv -f"
844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellrm="rm -f"
854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Sed substitution that helps us do robust quoting.  It backslashifies
874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# metacharacters that are still active within double-quoted strings.
884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellXsed="${SED}"' -e 1s/^X//'
894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# test EBCDIC or ASCII
91a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencercase `echo X|tr X '\101'` in
92a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer A) # ASCII based system
93a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
94a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  SP2NL='tr \040 \012'
95a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  NL2SP='tr \015\012 \040\040'
964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  ;;
97a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer *) # EBCDIC based system
98a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  SP2NL='tr \100 \n'
99a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  NL2SP='tr \r\n \100\100'
1004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  ;;
1014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellesac
1024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
1034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# NLS nuisances.
1044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Only set LANG and LC_ALL to C if already set.
1054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# These must not be set unconditionally because not all systems understand
1064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# e.g. LANG=C (notably SCO).
1074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# We save the old values to restore during execute mode.
1084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellif test "${LC_ALL+set}" = set; then
1094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
1104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellfi
1114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellif test "${LANG+set}" = set; then
1124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  save_LANG="$LANG"; LANG=C; export LANG
1134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellfi
1144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
1154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Make sure IFS has a sensible default
116a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerlt_nl='
117a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer'
118a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid SpencerIFS=" 	$lt_nl"
1194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
1204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  $echo "$modename: not configured to build any kind of library" 1>&2
1224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
12304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer  exit $EXIT_FAILURE
1244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellfi
1254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
1264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Global variables.
1274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellmode=$default_mode
1284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellnonopt=
1294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellprev=
1304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellprevopt=
1314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellrun=
1324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellshow="$echo"
1334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellshow_help=
1344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellexecute_dlfiles=
135a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerduplicate_deps=no
136a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerpreserve_args=
1374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelllo2o="s/\\.lo\$/.${objext}/"
1384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswello2lo="s/\\.${objext}\$/.lo/"
1394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
1404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#####################################
1414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Shell function definitions:
1424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# This seems to be the best place for them
1434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
144a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer# func_mktempdir [string]
145a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer# Make a temporary directory that won't clash with other running
146a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer# libtool processes, and avoids race conditions if possible.  If
147a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer# given, STRING is the basename for that directory.
148a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerfunc_mktempdir ()
149a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer{
150a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    my_template="${TMPDIR-/tmp}/${1-$progname}"
151a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
152a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    if test "$run" = ":"; then
153a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # Return a directory name, but don't create it in dry-run mode
154a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      my_tmpdir="${my_template}-$$"
155a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    else
156a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
157a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # If mktemp works, use that first and foremost
158a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
159a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
160a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      if test ! -d "$my_tmpdir"; then
161a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	# Failing that, at least try and use $RANDOM to avoid a race
162a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	my_tmpdir="${my_template}-${RANDOM-0}$$"
163a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
164a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	save_mktempdir_umask=`umask`
165a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	umask 0077
166a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	$mkdir "$my_tmpdir"
167a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	umask $save_mktempdir_umask
168a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      fi
169a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
170a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # If we're not in dry-run mode, bomb out on failure
171a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      test -d "$my_tmpdir" || {
172a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
173a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	exit $EXIT_FAILURE
174a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      }
175a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    fi
176a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
177a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    $echo "X$my_tmpdir" | $Xsed
178a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer}
179a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
180a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
18104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer# func_win32_libid arg
18204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer# return the library type of file 'arg'
18304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer#
1844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Need a lot of goo to handle *both* DLLs and import libs
1854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Has to be a shell function in order to 'eat' the argument
1864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# that is supplied when $file_magic_command is called.
187a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerfunc_win32_libid ()
188a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer{
1894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  win32_libid_type="unknown"
1904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  win32_fileres=`file -L $1 2>/dev/null`
1914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  case $win32_fileres in
1924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  *ar\ archive\ import\ library*) # definitely import
1934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    win32_libid_type="x86 archive import"
1944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
1954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  *ar\ archive*) # could be an import, or static
1964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
19704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
1984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      win32_nmres=`eval $NM -f posix -A $1 | \
199a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	$SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
200a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      case $win32_nmres in
201a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      import*)  win32_libid_type="x86 archive import";;
202a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      *)        win32_libid_type="x86 archive static";;
203a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      esac
2044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
2054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
20604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer  *DLL*)
2074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    win32_libid_type="x86 DLL"
2084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
2094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  *executable*) # but shell scripts are "executable" too...
2104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    case $win32_fileres in
2114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *MS\ Windows\ PE\ Intel*)
2124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      win32_libid_type="x86 DLL"
2134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
2144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    esac
2154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
2164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  esac
2174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  $echo $win32_libid_type
2184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell}
2194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
22004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
22104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer# func_infer_tag arg
22204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer# Infer tagged configuration to use if any are available and
22304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer# if one wasn't chosen via the "--tag" command line option.
22404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer# Only attempt this if the compiler in the base compile
22504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer# command doesn't match the default compiler.
22604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer# arg is usually of the form 'gcc ...'
227a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerfunc_infer_tag ()
228a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer{
22904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    if test -n "$available_tags" && test -z "$tagname"; then
23004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      CC_quoted=
23104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      for arg in $CC; do
23204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	case $arg in
23304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
23404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  arg="\"$arg\""
23504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  ;;
23604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	esac
23704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	CC_quoted="$CC_quoted $arg"
23804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      done
23904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      case $@ in
24004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      # Blanks in the command may have been stripped by the calling shell,
24104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      # but not from the CC environment variable when configure was run.
24204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
24304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      # Blanks at the start of $base_compile will cause this to fail
24404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      # if we don't check for them as well.
24504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      *)
24604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	for z in $available_tags; do
24704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
24804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    # Evaluate the configuration.
24904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
25004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    CC_quoted=
25104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    for arg in $CC; do
25204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    # Double-quote args containing other shell metacharacters.
25304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    case $arg in
25404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
25504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      arg="\"$arg\""
25604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      ;;
25704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    esac
25804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    CC_quoted="$CC_quoted $arg"
25904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  done
26004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    case "$@ " in
26104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
26204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      # The compiler in the base compile command matches
26304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      # the one in the tagged configuration.
26404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      # Assume this is the tagged configuration we want.
26504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      tagname=$z
26604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      break
26704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      ;;
26804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    esac
26904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  fi
27004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	done
27104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	# If $tagname still isn't set, then no tagged configuration
27204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	# was found and let the user know that the "--tag" command
27304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	# line option must be used.
27404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	if test -z "$tagname"; then
27504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  $echo "$modename: unable to infer tagged configuration"
27604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  $echo "$modename: specify a tag with \`--tag'" 1>&2
27704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
27804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer#        else
27904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer#          $echo "$modename: using $tagname tagged configuration"
28004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	fi
28104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	;;
28204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      esac
28304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    fi
28404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer}
28504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
28604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
287a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer# func_extract_an_archive dir oldlib
288a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerfunc_extract_an_archive ()
289a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer{
290a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    f_ex_an_ar_dir="$1"; shift
291a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    f_ex_an_ar_oldlib="$1"
292a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
293a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
294a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
295a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
296a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer     :
297a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    else
298a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
299a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      exit $EXIT_FAILURE
300a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    fi
301a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer}
302a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
30304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer# func_extract_archives gentop oldlib ...
304a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerfunc_extract_archives ()
305a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer{
30604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    my_gentop="$1"; shift
30704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    my_oldlibs=${1+"$@"}
30804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    my_oldobjs=""
30904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    my_xlib=""
31004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    my_xabs=""
31104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    my_xdir=""
31204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    my_status=""
31304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
31404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    $show "${rm}r $my_gentop"
31504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    $run ${rm}r "$my_gentop"
31604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    $show "$mkdir $my_gentop"
31704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    $run $mkdir "$my_gentop"
31804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    my_status=$?
31904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
32004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      exit $my_status
32104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    fi
32204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
32304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    for my_xlib in $my_oldlibs; do
32404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      # Extract the objects.
32504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      case $my_xlib in
32604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
32704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	*) my_xabs=`pwd`"/$my_xlib" ;;
32804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      esac
32904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
33004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      my_xdir="$my_gentop/$my_xlib"
33104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
33204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      $show "${rm}r $my_xdir"
33304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      $run ${rm}r "$my_xdir"
33404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      $show "$mkdir $my_xdir"
33504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      $run $mkdir "$my_xdir"
336a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      exit_status=$?
337a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
338a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	exit $exit_status
33904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      fi
34004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      case $host in
34104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      *-darwin*)
34204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	$show "Extracting $my_xabs"
34304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	# Do not bother doing anything if just a dry run
34404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	if test -z "$run"; then
34504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  darwin_orig_dir=`pwd`
34604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  cd $my_xdir || exit $?
34704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  darwin_archive=$my_xabs
34804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  darwin_curdir=`pwd`
349a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
35004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
35104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  if test -n "$darwin_arches"; then 
35204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
35304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    darwin_arch=
35404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
35504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    for darwin_arch in  $darwin_arches ; do
35604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
35704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
35804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
359a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
36004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      cd "$darwin_curdir"
361a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
36204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    done # $darwin_arches
36304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
364a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
36504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    darwin_file=
36604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    darwin_files=
36704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    for darwin_file in $darwin_filelist; do
36804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
36904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      lipo -create -output "$darwin_file" $darwin_files
37004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    done # $darwin_filelist
371a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    ${rm}r unfat-$$
37204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    cd "$darwin_orig_dir"
37304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  else
374a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    cd "$darwin_orig_dir"
375a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer 	    func_extract_an_archive "$my_xdir" "$my_xabs"
37604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  fi # $darwin_arches
37704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	fi # $run
37804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	;;
379a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      *)
380a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        func_extract_an_archive "$my_xdir" "$my_xabs"
381a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        ;;
38204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      esac
38304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
38404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    done
38504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    func_extract_archives_result="$my_oldobjs"
38604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer}
3874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# End of Shell function definitions
3884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#####################################
3894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
39004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer# Darwin sucks
39104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencereval std_shrext=\"$shrext_cmds\"
39204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
393a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerdisable_libs=no
394a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
3954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Parse our command line options once, thoroughly.
3964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellwhile test "$#" -gt 0
3974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelldo
3984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  arg="$1"
3994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  shift
4004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  case $arg in
4024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
4034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  *) optarg= ;;
4044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  esac
4054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # If the previous option needs an argument, assign it.
4074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  if test -n "$prev"; then
4084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    case $prev in
4094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    execute_dlfiles)
4104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      execute_dlfiles="$execute_dlfiles $arg"
4114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
4124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    tag)
4134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      tagname="$arg"
41404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      preserve_args="${preserve_args}=$arg"
4154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Check whether tagname contains only valid characters
4174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case $tagname in
4184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *[!-_A-Za-z0-9,/]*)
4194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$progname: invalid tag name: $tagname" 1>&2
42004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	exit $EXIT_FAILURE
4214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
4224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
4234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case $tagname in
4254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      CC)
4264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Don't test for the "default" C tag, as we know, it's there, but
4274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# not specially marked.
4284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
4294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *)
43004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
4314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  taglist="$taglist $tagname"
4324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Evaluate the configuration.
43304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
4344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
4354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
4364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
4374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
4384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
4394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
4404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *)
4414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      eval "$prev=\$arg"
4424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
4434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    esac
4444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    prev=
4464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    prevopt=
4474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    continue
4484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  fi
4494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # Have we seen a non-optional argument yet?
4514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  case $arg in
4524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  --help)
4534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    show_help=yes
4544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
4554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  --version)
4574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
4584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo
459a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
4604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "This is free software; see the source for copying conditions.  There is NO"
4614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
462a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    exit $?
4634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
4644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  --config)
46604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
4674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Now print the configurations for the tags.
4684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    for tagname in $taglist; do
46904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
4704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    done
471a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    exit $?
4724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
4734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  --debug)
4754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "$progname: enabling shell trace mode"
4764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    set -x
47704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    preserve_args="$preserve_args $arg"
4784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
4794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  --dry-run | -n)
4814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    run=:
4824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
4834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  --features)
4854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "host: $host"
4864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test "$build_libtool_libs" = yes; then
4874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "enable shared libraries"
4884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    else
4894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "disable shared libraries"
4904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
4914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test "$build_old_libs" = yes; then
4924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "enable static libraries"
4934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    else
4944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "disable static libraries"
4954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
496a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    exit $?
4974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
4984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  --finish) mode="finish" ;;
5004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
5014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  --mode) prevopt="--mode" prev=mode ;;
5024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  --mode=*) mode="$optarg" ;;
5034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
5044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  --preserve-dup-deps) duplicate_deps="yes" ;;
5054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
5064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  --quiet | --silent)
5074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    show=:
50804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    preserve_args="$preserve_args $arg"
5094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
5104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
511a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  --tag)
512a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    prevopt="--tag"
513a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    prev=tag
514a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    preserve_args="$preserve_args --tag"
515a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    ;;
5164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  --tag=*)
5174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    set tag "$optarg" ${1+"$@"}
5184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    shift
5194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    prev=tag
52004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    preserve_args="$preserve_args --tag"
5214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
5224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
5234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -dlopen)
5244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    prevopt="-dlopen"
5254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    prev=execute_dlfiles
5264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
5274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
5284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -*)
5294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "$modename: unrecognized option \`$arg'" 1>&2
5304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "$help" 1>&2
53104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    exit $EXIT_FAILURE
5324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
5334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
5344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  *)
5354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    nonopt="$arg"
5364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    break
5374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
5384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  esac
5394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelldone
5404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
5414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellif test -n "$prevopt"; then
5424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
5434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  $echo "$help" 1>&2
54404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer  exit $EXIT_FAILURE
5454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellfi
5464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
547a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencercase $disable_libs in
548a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerno) 
549a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  ;;
550a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencershared)
551a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  build_libtool_libs=no
552a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  build_old_libs=yes
553a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  ;;
554a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerstatic)
555a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
556a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  ;;
557a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spenceresac
558a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
5594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# If this variable is set in any of the actions, the command in it
5604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# will be execed at the end.  This prevents here-documents from being
5614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# left over by shells.
5624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellexec_cmd=
5634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
5644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellif test -z "$show_help"; then
5654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
5664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # Infer the operation mode.
5674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  if test -z "$mode"; then
5684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
569a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
5704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    case $nonopt in
5714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
5724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      mode=link
5734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      for arg
5744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      do
5754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $arg in
5764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	-c)
5774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	   mode=compile
5784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	   break
5794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	   ;;
5804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
5814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      done
5824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
5834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *db | *dbx | *strace | *truss)
5844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      mode=execute
5854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
5864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *install*|cp|mv)
5874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      mode=install
5884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
5894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *rm)
5904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      mode=uninstall
5914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
5924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *)
5934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # If we have no mode, but dlfiles were specified, then do execute mode.
5944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      test -n "$execute_dlfiles" && mode=execute
5954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
5964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Just use the default operation mode.
5974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -z "$mode"; then
5984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$nonopt"; then
5994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
6004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
6014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
6024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
6034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
6044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
6054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    esac
6064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  fi
6074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
6084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # Only execute mode is allowed to have -dlopen flags.
6094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  if test -n "$execute_dlfiles" && test "$mode" != execute; then
6104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
6114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "$help" 1>&2
61204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    exit $EXIT_FAILURE
6134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  fi
6144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
6154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # Change the help message to a mode-specific one.
6164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  generic_help="$help"
6174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  help="Try \`$modename --help --mode=$mode' for more information."
6184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
6194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # These modes are in order of execution frequency so that they run quickly.
6204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  case $mode in
6214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # libtool compile mode
6224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  compile)
6234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    modename="$modename: compile"
6244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Get the compilation command and the source file.
6254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    base_compile=
6264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
62704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    suppress_opt=yes
6284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    suppress_output=
6294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    arg_mode=normal
6304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    libobj=
63104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    later=
6324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
6334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    for arg
6344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    do
635a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      case $arg_mode in
6364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      arg  )
6374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# do not "continue".  Instead, add this to base_compile
6384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	lastarg="$arg"
6394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	arg_mode=normal
6404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
6414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
6424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      target )
6434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	libobj="$arg"
6444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	arg_mode=normal
6454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
6464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
6474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
6484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      normal )
6494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Accept any command-line options.
6504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $arg in
6514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	-o)
6524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -n "$libobj" ; then
6534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
65404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    exit $EXIT_FAILURE
6554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
6564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  arg_mode=target
6574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
6584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
6594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	-static | -prefer-pic | -prefer-non-pic)
66104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  later="$later $arg"
6624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
6634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
6644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	-no-suppress)
66604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  suppress_opt=no
6674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
6684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
6694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
6704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	-Xcompiler)
6714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
6724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue      #  The current "srcfile" will either be retained or
6734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;            #  replaced later.  I would guess that would be a bug.
6744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
6754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	-Wc,*)
6764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
6774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  lastarg=
6784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  save_ifs="$IFS"; IFS=','
67904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer 	  for arg in $args; do
6804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    IFS="$save_ifs"
6814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
6824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Double-quote args containing other shell metacharacters.
6834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Many Bourne shells cannot handle close brackets correctly
6844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # in scan sets, so we specify it separately.
6854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    case $arg in
6864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
6874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      arg="\"$arg\""
6884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      ;;
6894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    esac
6904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    lastarg="$lastarg $arg"
6914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
6924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  IFS="$save_ifs"
6934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
6944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
6954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Add the arguments to base_compile.
6964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  base_compile="$base_compile $lastarg"
6974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
6984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
6994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
7004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	* )
7014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Accept the current argument as the source file.
7024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # The previous "srcfile" becomes the current argument.
7034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  #
7044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  lastarg="$srcfile"
7054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  srcfile="$arg"
7064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
7074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac  #  case $arg
7084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
7094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac    #  case $arg_mode
7104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
7114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Aesthetically quote the previous argument.
7124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
7134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
7144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case $lastarg in
7154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Double-quote args containing other shell metacharacters.
7164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Many Bourne shells cannot handle close brackets correctly
717a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # in scan sets, and some SunOS ksh mistreat backslash-escaping
718a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # in scan sets (worked around with variable expansion),
719a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
720a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # at all, so we specify them separately.
7214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
7224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	lastarg="\"$lastarg\""
7234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
7244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
7254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
7264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      base_compile="$base_compile $lastarg"
7274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    done # for arg
7284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
7294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    case $arg_mode in
7304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    arg)
7314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$modename: you must specify an argument for -Xcompile"
73204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      exit $EXIT_FAILURE
7334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
7344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    target)
7354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$modename: you must specify a target with \`-o'" 1>&2
73604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      exit $EXIT_FAILURE
7374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
7384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *)
7394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Get the name of the library object.
7404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
7414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
7424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    esac
7434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
7444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Recognize several different file suffixes.
7454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # If the user specifies -o file.o, it is replaced with file.lo
7464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    xform='[cCFSifmso]'
7474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    case $libobj in
7484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *.ada) xform=ada ;;
7494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *.adb) xform=adb ;;
7504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *.ads) xform=ads ;;
7514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *.asm) xform=asm ;;
7524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *.c++) xform=c++ ;;
7534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *.cc) xform=cc ;;
7544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *.ii) xform=ii ;;
7554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *.class) xform=class ;;
7564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *.cpp) xform=cpp ;;
7574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *.cxx) xform=cxx ;;
7584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *.f90) xform=f90 ;;
7594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *.for) xform=for ;;
7604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *.java) xform=java ;;
7614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    esac
7624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
7634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
7644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
7654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    case $libobj in
7664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
7674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *)
7684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
76904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      exit $EXIT_FAILURE
7704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
7714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    esac
7724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
77304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    func_infer_tag $base_compile
77404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
77504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    for arg in $later; do
77604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      case $arg in
77704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      -static)
77804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	build_old_libs=yes
77904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	continue
78004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	;;
78104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
78204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      -prefer-pic)
78304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	pic_mode=yes
78404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	continue
78504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	;;
78604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
78704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      -prefer-non-pic)
78804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	pic_mode=no
78904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	continue
7904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
7914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
79204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    done
7934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
794a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
795a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    case $qlibobj in
796a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
797a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	qlibobj="\"$qlibobj\"" ;;
798a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    esac
799a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    test "X$libobj" != "X$qlibobj" \
800a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
801a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
8024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
8034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
8044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test "X$xdir" = "X$obj"; then
8054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      xdir=
8064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    else
8074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      xdir=$xdir/
8084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
8094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    lobj=${xdir}$objdir/$objname
8104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
8114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -z "$base_compile"; then
8124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$modename: you must specify a compilation command" 1>&2
8134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$help" 1>&2
81404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      exit $EXIT_FAILURE
8154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
8164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
8174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Delete any leftover library objects.
8184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test "$build_old_libs" = yes; then
8194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      removelist="$obj $lobj $libobj ${libobj}T"
8204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    else
8214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      removelist="$lobj $libobj ${libobj}T"
8224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
8234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
8244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $run $rm $removelist
82504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
8264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
8274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # On Cygwin there's no "real" PIC flag so we must build both object types
8284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    case $host_os in
8294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    cygwin* | mingw* | pw32* | os2*)
8304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      pic_mode=default
8314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
8324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    esac
8334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
8344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # non-PIC code in shared libraries is not supported
8354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      pic_mode=default
8364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
8374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
8384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Calculate the filename of the output object if compiler does
8394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # not support -o with -c
8404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test "$compiler_c_o" = no; then
8414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
8424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      lockfile="$output_obj.lock"
8434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      removelist="$removelist $output_obj $lockfile"
84404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
8454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    else
8464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      output_obj=
8474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      need_locks=no
8484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      lockfile=
8494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
8504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
8514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Lock this critical section if it is needed
8524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # We use this script file to make the link, it avoids creating a new file
8534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test "$need_locks" = yes; then
85404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
8554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$show "Waiting for $lockfile to be removed"
8564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	sleep 2
8574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      done
8584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    elif test "$need_locks" = warn; then
8594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -f "$lockfile"; then
8604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "\
8614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell*** ERROR, $lockfile exists and contains:
8624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell`cat $lockfile 2>/dev/null`
8634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
8644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellThis indicates that another process is trying to use the same
8654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelltemporary object file, and libtool could not work around it because
8664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellyour compiler does not support \`-c' and \`-o' together.  If you
8674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellrepeat this compilation, it may succeed, by chance, but you had better
8684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellavoid parallel builds (make -j) in this platform, or get a better
8694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellcompiler."
8704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
8714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$run $rm $removelist
87204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	exit $EXIT_FAILURE
8734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
874a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      $echo "$srcfile" > "$lockfile"
8754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
8764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
8774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -n "$fix_srcfile_path"; then
8784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      eval srcfile=\"$fix_srcfile_path\"
8794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
880a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
881a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    case $qsrcfile in
882a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
883a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      qsrcfile="\"$qsrcfile\"" ;;
884a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    esac
8854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
8864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $run $rm "$libobj" "${libobj}T"
8874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
8884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Create a libtool object file (analogous to a ".la" file),
8894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # but don't create it if we're doing a dry run.
8904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    test -z "$run" && cat > ${libobj}T <<EOF
8914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# $libobj - a libtool object file
8924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
8934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#
8944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Please DO NOT delete this file!
8954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# It is necessary for linking the library.
8964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
8974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Name of the PIC object.
8984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellEOF
8994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
9004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Only build a PIC object if we are building libtool libraries.
9014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test "$build_libtool_libs" = yes; then
9024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Without this assignment, base_compile gets emptied.
9034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fbsd_hideous_sh_bug=$base_compile
9044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
9054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$pic_mode" != no; then
906a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	command="$base_compile $qsrcfile $pic_flag"
9074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      else
9084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Don't build PIC code
909a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	command="$base_compile $qsrcfile"
9104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
9114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
9124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test ! -d "${xdir}$objdir"; then
9134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$show "$mkdir ${xdir}$objdir"
9144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$run $mkdir ${xdir}$objdir
915a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	exit_status=$?
916a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
917a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  exit $exit_status
9184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
9194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
9204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
9214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -z "$output_obj"; then
9224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Place PIC objects in $objdir
9234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	command="$command -o $lobj"
9244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
9254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
9264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $run $rm "$lobj" "$output_obj"
9274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
9284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $show "$command"
9294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if $run eval "$command"; then :
9304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      else
9314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	test -n "$output_obj" && $run $rm $removelist
93204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	exit $EXIT_FAILURE
9334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
9344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
9354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$need_locks" = warn &&
9364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
9374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "\
9384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell*** ERROR, $lockfile contains:
9394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell`cat $lockfile 2>/dev/null`
9404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
9414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellbut it should contain:
9424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell$srcfile
9434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
9444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellThis indicates that another process is trying to use the same
9454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelltemporary object file, and libtool could not work around it because
9464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellyour compiler does not support \`-c' and \`-o' together.  If you
9474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellrepeat this compilation, it may succeed, by chance, but you had better
9484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellavoid parallel builds (make -j) in this platform, or get a better
9494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellcompiler."
9504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
9514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$run $rm $removelist
95204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	exit $EXIT_FAILURE
9534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
9544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
9554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Just move the object if needed, then go on to compile the next one
9564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
9574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$show "$mv $output_obj $lobj"
9584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if $run $mv $output_obj $lobj; then :
9594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
9604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  error=$?
9614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $run $rm $removelist
9624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  exit $error
9634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
9644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
9654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
9664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Append the name of the PIC object to the libtool object file.
9674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      test -z "$run" && cat >> ${libobj}T <<EOF
9684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellpic_object='$objdir/$objname'
9694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
9704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellEOF
9714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
9724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Allow error messages only from the first compilation.
97304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      if test "$suppress_opt" = yes; then
97404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer        suppress_output=' >/dev/null 2>&1'
97504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      fi
9764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    else
9774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # No PIC object so indicate it doesn't exist in the libtool
9784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # object file.
9794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      test -z "$run" && cat >> ${libobj}T <<EOF
9804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellpic_object=none
9814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
9824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellEOF
9834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
9844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
9854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Only build a position-dependent object if we build old libraries.
9864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test "$build_old_libs" = yes; then
9874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$pic_mode" != yes; then
9884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Don't build PIC code
989a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	command="$base_compile $qsrcfile"
9904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      else
991a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	command="$base_compile $qsrcfile $pic_flag"
9924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
9934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$compiler_c_o" = yes; then
9944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	command="$command -o $obj"
9954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
9964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
9974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Suppress compiler output if we already did a PIC compilation.
9984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      command="$command$suppress_output"
9994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $run $rm "$obj" "$output_obj"
10004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $show "$command"
10014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if $run eval "$command"; then :
10024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      else
10034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$run $rm $removelist
100404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	exit $EXIT_FAILURE
10054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
10064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
10074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$need_locks" = warn &&
10084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
10094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "\
10104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell*** ERROR, $lockfile contains:
10114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell`cat $lockfile 2>/dev/null`
10124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
10134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellbut it should contain:
10144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell$srcfile
10154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
10164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellThis indicates that another process is trying to use the same
10174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelltemporary object file, and libtool could not work around it because
10184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellyour compiler does not support \`-c' and \`-o' together.  If you
10194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellrepeat this compilation, it may succeed, by chance, but you had better
10204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellavoid parallel builds (make -j) in this platform, or get a better
10214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellcompiler."
10224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
10234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$run $rm $removelist
102404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	exit $EXIT_FAILURE
10254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
10264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
10274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Just move the object if needed
10284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
10294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$show "$mv $output_obj $obj"
10304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if $run $mv $output_obj $obj; then :
10314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
10324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  error=$?
10334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $run $rm $removelist
10344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  exit $error
10354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
10364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
10374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
10384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Append the name of the non-PIC object the libtool object file.
10394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Only append if the libtool object file exists.
10404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      test -z "$run" && cat >> ${libobj}T <<EOF
10414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Name of the non-PIC object.
10424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellnon_pic_object='$objname'
10434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
10444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellEOF
10454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    else
10464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Append the name of the non-PIC object the libtool object file.
10474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Only append if the libtool object file exists.
10484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      test -z "$run" && cat >> ${libobj}T <<EOF
10494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Name of the non-PIC object.
10504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellnon_pic_object=none
10514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
10524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellEOF
10534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
10544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
10554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $run $mv "${libobj}T" "${libobj}"
10564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
10574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Unlock the critical section if it was locked
10584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test "$need_locks" != no; then
10594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $run $rm "$lockfile"
10604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
10614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
106204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    exit $EXIT_SUCCESS
10634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
10644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
10654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # libtool link mode
10664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  link | relink)
10674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    modename="$modename: link"
10684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    case $host in
10694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
10704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # It is impossible to link a dll without this setting, and
10714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # we shouldn't force the makefile maintainer to figure out
10724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # which system we are compiling for in order to pass an extra
10734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # flag for every libtool invocation.
10744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # allow_undefined=no
10754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
10764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # FIXME: Unfortunately, there are problems with the above when trying
10774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # to make a dll which has undefined symbols, in which case not
10784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # even a static library is built.  For now, we need to specify
10794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # -no-undefined on the libtool link line when we can be certain
10804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # that all symbols are satisfied, otherwise we get a static library.
10814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      allow_undefined=yes
10824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
10834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *)
10844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      allow_undefined=yes
10854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
10864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    esac
10874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    libtool_args="$nonopt"
108804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    base_compile="$nonopt $@"
10894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    compile_command="$nonopt"
10904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    finalize_command="$nonopt"
10914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
10924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    compile_rpath=
10934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    finalize_rpath=
10944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    compile_shlibpath=
10954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    finalize_shlibpath=
10964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    convenience=
10974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    old_convenience=
10984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    deplibs=
10994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    old_deplibs=
11004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    compiler_flags=
11014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    linker_flags=
11024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    dllsearchpath=
11034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    lib_search_path=`pwd`
11044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    inst_prefix_dir=
11054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
11064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    avoid_version=no
11074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    dlfiles=
11084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    dlprefiles=
11094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    dlself=no
11104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    export_dynamic=no
11114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    export_symbols=
11124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    export_symbols_regex=
11134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    generated=
11144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    libobjs=
11154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ltlibs=
11164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    module=no
11174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    no_install=no
11184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    objs=
11194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    non_pic_objects=
1120a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    notinst_path= # paths that contain not-installed libtool libraries
112104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    precious_files_regex=
11224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    prefer_static_libs=no
11234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    preload=no
11244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    prev=
11254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    prevarg=
11264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    release=
11274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    rpath=
11284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    xrpath=
11294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    perm_rpath=
11304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    temp_rpath=
11314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    thread_safe=no
11324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    vinfo=
11334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    vinfo_number=no
11344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
113504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    func_infer_tag $base_compile
113604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
11374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # We need to know -static, to get the right output filenames.
11384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    for arg
11394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    do
11404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case $arg in
11414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -all-static | -static)
11424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "X$arg" = "X-all-static"; then
11434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
11444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
11454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
11464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -n "$link_static_flag"; then
11474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    dlopen_self=$dlopen_self_static
11484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
1149a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  prefer_static_libs=yes
11504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
11514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
11524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    dlopen_self=$dlopen_self_static
11534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
1154a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  prefer_static_libs=built
11554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
11564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	build_libtool_libs=no
11574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	build_old_libs=yes
11584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	break
11594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
11604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
11614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    done
11624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
11634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # See if our shared archives depend on static archives.
11644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
11654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
11664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Go through the arguments, transforming them on the way.
11674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    while test "$#" -gt 0; do
11684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      arg="$1"
11694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      shift
11704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case $arg in
11714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
11724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
11734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
11744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *) qarg=$arg ;;
11754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
11764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      libtool_args="$libtool_args $qarg"
11774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
11784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # If the previous option needs an argument, assign it.
11794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$prev"; then
11804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $prev in
11814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	output)
11824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  compile_command="$compile_command @OUTPUT@"
11834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  finalize_command="$finalize_command @OUTPUT@"
11844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
11854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
11864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
11874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $prev in
11884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	dlfiles|dlprefiles)
11894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$preload" = no; then
11904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Add the symbol object into the linking commands.
11914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    compile_command="$compile_command @SYMFILE@"
11924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    finalize_command="$finalize_command @SYMFILE@"
11934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    preload=yes
11944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
11954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $arg in
11964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *.la | *.lo) ;;  # We handle these cases below.
11974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  force)
11984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$dlself" = no; then
11994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      dlself=needless
12004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      export_dynamic=yes
12014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
12024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    prev=
12034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    continue
12044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
12054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  self)
12064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$prev" = dlprefiles; then
12074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      dlself=yes
12084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
12094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      dlself=yes
12104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
12114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      dlself=needless
12124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      export_dynamic=yes
12134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
12144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    prev=
12154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    continue
12164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
12174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *)
12184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$prev" = dlfiles; then
12194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      dlfiles="$dlfiles $arg"
12204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
12214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      dlprefiles="$dlprefiles $arg"
12224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
12234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    prev=
12244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    continue
12254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
12264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
12274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
12284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	expsyms)
12294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  export_symbols="$arg"
12304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test ! -f "$arg"; then
12314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: symbol file \`$arg' does not exist"
123204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    exit $EXIT_FAILURE
12334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
12344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  prev=
12354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
12364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
12374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	expsyms_regex)
12384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  export_symbols_regex="$arg"
12394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  prev=
12404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
12414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
12424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	inst_prefix)
12434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  inst_prefix_dir="$arg"
12444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  prev=
12454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
12464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
124704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	precious_regex)
124804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  precious_files_regex="$arg"
124904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  prev=
125004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  continue
125104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  ;;
12524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	release)
12534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  release="-$arg"
12544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  prev=
12554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
12564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
12574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	objectlist)
12584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -f "$arg"; then
12594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    save_arg=$arg
12604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    moreargs=
12614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    for fil in `cat $save_arg`
12624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    do
12634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#	      moreargs="$moreargs $fil"
12644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      arg=$fil
12654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # A libtool-controlled object.
12664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
12674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # Check to see that this really is a libtool object.
12684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
12694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		pic_object=
12704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		non_pic_object=
12714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
12724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		# Read the .lo file
12734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		# If there is no directory component, then add one.
12744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		case $arg in
12754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		*/* | *\\*) . $arg ;;
12764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		*) . ./$arg ;;
12774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		esac
12784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
12794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		if test -z "$pic_object" || \
12804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		   test -z "$non_pic_object" ||
12814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		   test "$pic_object" = none && \
12824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		   test "$non_pic_object" = none; then
12834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
128404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		  exit $EXIT_FAILURE
12854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		fi
12864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
12874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		# Extract subdirectory from the argument.
12884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
12894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		if test "X$xdir" = "X$arg"; then
12904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  xdir=
12914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		else
12924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  xdir="$xdir/"
12934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		fi
12944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
12954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		if test "$pic_object" != none; then
12964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  # Prepend the subdirectory the object is found in.
12974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  pic_object="$xdir$pic_object"
12984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
12994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  if test "$prev" = dlfiles; then
13004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
13014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      dlfiles="$dlfiles $pic_object"
13024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      prev=
13034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      continue
13044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    else
13054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      # If libtool objects are unsupported, then we need to preload.
13064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      prev=dlprefiles
13074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    fi
13084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  fi
13094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
13104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  # CHECK ME:  I think I busted this.  -Ossama
13114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  if test "$prev" = dlprefiles; then
13124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    # Preload the old-style object.
13134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    dlprefiles="$dlprefiles $pic_object"
13144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    prev=
13154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  fi
13164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
13174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  # A PIC object.
13184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  libobjs="$libobjs $pic_object"
13194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  arg="$pic_object"
13204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		fi
13214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
13224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		# Non-PIC object.
13234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		if test "$non_pic_object" != none; then
13244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  # Prepend the subdirectory the object is found in.
13254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  non_pic_object="$xdir$non_pic_object"
13264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
13274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  # A standard non-PIC object
13284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  non_pic_objects="$non_pic_objects $non_pic_object"
13294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  if test -z "$pic_object" || test "$pic_object" = none ; then
13304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    arg="$non_pic_object"
13314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  fi
1332a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		else
1333a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		  # If the PIC object exists, use it instead.
1334a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		  # $xdir was prepended to $pic_object above.
1335a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		  non_pic_object="$pic_object"
1336a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		  non_pic_objects="$non_pic_objects $non_pic_object"
13374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		fi
13384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      else
13394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		# Only an error if not doing a dry-run.
13404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		if test -z "$run"; then
13414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
134204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		  exit $EXIT_FAILURE
13434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		else
13444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  # Dry-run case.
13454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
13464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  # Extract subdirectory from the argument.
13474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
13484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  if test "X$xdir" = "X$arg"; then
13494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    xdir=
13504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  else
13514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    xdir="$xdir/"
13524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  fi
13534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
13544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
13554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
13564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  libobjs="$libobjs $pic_object"
13574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  non_pic_objects="$non_pic_objects $non_pic_object"
13584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		fi
13594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
13604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    done
13614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
13624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: link input file \`$save_arg' does not exist"
136304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    exit $EXIT_FAILURE
13644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
13654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  arg=$save_arg
13664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  prev=
13674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
13684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
13694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	rpath | xrpath)
13704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # We need an absolute path.
13714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $arg in
13724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  [\\/]* | [A-Za-z]:[\\/]*) ;;
13734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *)
13744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: only absolute run-paths are allowed" 1>&2
137504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    exit $EXIT_FAILURE
13764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
13774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
13784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$prev" = rpath; then
13794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    case "$rpath " in
13804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *" $arg "*) ;;
13814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *) rpath="$rpath $arg" ;;
13824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    esac
13834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
13844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    case "$xrpath " in
13854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *" $arg "*) ;;
13864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *) xrpath="$xrpath $arg" ;;
13874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    esac
13884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
13894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  prev=
13904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
13914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
13924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	xcompiler)
13934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  compiler_flags="$compiler_flags $qarg"
13944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  prev=
13954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  compile_command="$compile_command $qarg"
13964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  finalize_command="$finalize_command $qarg"
13974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
13984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
13994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	xlinker)
14004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  linker_flags="$linker_flags $qarg"
14014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  compiler_flags="$compiler_flags $wl$qarg"
14024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  prev=
14034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  compile_command="$compile_command $wl$qarg"
14044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  finalize_command="$finalize_command $wl$qarg"
14054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
14064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
14074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	xcclinker)
14084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  linker_flags="$linker_flags $qarg"
14094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  compiler_flags="$compiler_flags $qarg"
14104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  prev=
14114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  compile_command="$compile_command $qarg"
14124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  finalize_command="$finalize_command $qarg"
14134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
14144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
141504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	shrext)
141604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer  	  shrext_cmds="$arg"
141704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  prev=
141804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  continue
141904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  ;;
1420a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	darwin_framework|darwin_framework_skip)
1421a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
1422a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  compile_command="$compile_command $arg"
1423a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  finalize_command="$finalize_command $arg"
1424a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  prev=
1425a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  continue
1426a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  ;;
14274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*)
14284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  eval "$prev=\"\$arg\""
14294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  prev=
14304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
14314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
14324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
14334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi # test -n "$prev"
14344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
14354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      prevarg="$arg"
14364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
14374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case $arg in
14384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -all-static)
14394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$link_static_flag"; then
14404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  compile_command="$compile_command $link_static_flag"
14414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  finalize_command="$finalize_command $link_static_flag"
14424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
14434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
14444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
14454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
14464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -allow-undefined)
14474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# FIXME: remove this flag sometime in the future.
14484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
14494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
14504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
14514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
14524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -avoid-version)
14534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	avoid_version=yes
14544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
14554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
14564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
14574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -dlopen)
14584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	prev=dlfiles
14594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
14604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
14614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
14624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -dlpreopen)
14634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	prev=dlprefiles
14644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
14654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
14664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
14674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -export-dynamic)
14684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	export_dynamic=yes
14694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
14704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
14714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
14724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -export-symbols | -export-symbols-regex)
14734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
14744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: more than one -exported-symbols argument is not allowed"
147504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
14764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
14774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "X$arg" = "X-export-symbols"; then
14784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  prev=expsyms
14794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
14804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  prev=expsyms_regex
14814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
14824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
14834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
14844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
1485a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      -framework|-arch|-isysroot)
1486a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	case " $CC " in
1487a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
1488a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		prev=darwin_framework_skip ;;
1489a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *) compiler_flags="$compiler_flags $arg"
1490a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	     prev=darwin_framework ;;
1491a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	esac
1492a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	compile_command="$compile_command $arg"
1493a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	finalize_command="$finalize_command $arg"
1494a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	continue
1495a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	;;
1496a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
14974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -inst-prefix-dir)
14984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	prev=inst_prefix
14994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
15004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
15014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
15024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
15034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # so, if we see these flags be careful not to treat them like -L
15044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -L[A-Z][A-Z]*:*)
15054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $with_gcc/$host in
15064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	no/*-*-irix* | /*-*-irix*)
15074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  compile_command="$compile_command $arg"
15084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  finalize_command="$finalize_command $arg"
15094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
15104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
15114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
15124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
15134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
15144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -L*)
15154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
15164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# We need an absolute path.
15174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $dir in
15184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	[\\/]* | [A-Za-z]:[\\/]*) ;;
15194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*)
15204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  absdir=`cd "$dir" && pwd`
15214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -z "$absdir"; then
15224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
1523a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    absdir="$dir"
1524a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    notinst_path="$notinst_path $dir"
15254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
15264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  dir="$absdir"
15274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
15284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
15294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case "$deplibs " in
15304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*" -L$dir "*) ;;
15314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*)
15324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  deplibs="$deplibs -L$dir"
15334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  lib_search_path="$lib_search_path $dir"
15344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
15354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
15364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $host in
15374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
1538a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
15394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case :$dllsearchpath: in
15404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *":$dir:"*) ;;
15414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *) dllsearchpath="$dllsearchpath:$dir";;
15424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
1543a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  case :$dllsearchpath: in
1544a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *":$testbindir:"*) ;;
1545a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *) dllsearchpath="$dllsearchpath:$testbindir";;
1546a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  esac
15474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
15484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
15494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
15504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
15514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
15524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -l*)
15534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
15544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $host in
1555a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
15564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # These systems don't actually have a C or math library (as such)
15574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    continue
15584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
1559a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *-*-os2*)
15604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # These systems don't actually have a C library (as such)
15614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    test "X$arg" = "X-lc" && continue
15624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
1563b0f6759ab93b42570d71665b13d24ca2c4a5f276Eric Christopher	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
15644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Do not include libc due to us having libc/libc_r.
15654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    test "X$arg" = "X-lc" && continue
15664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
15674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *-*-rhapsody* | *-*-darwin1.[012])
15684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Rhapsody C and math libraries are in the System framework
15694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    deplibs="$deplibs -framework System"
15704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    continue
1571a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    ;;
1572a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *-*-sco3.2v5* | *-*-sco5v6*)
1573a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    # Causes problems with __ctype
1574a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    test "X$arg" = "X-lc" && continue
1575a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    ;;
1576a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
1577a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    # Compiler inserts libc in the correct place for threads to work
1578a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    test "X$arg" = "X-lc" && continue
1579a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    ;;
15804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
15814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	elif test "X$arg" = "X-lc_r"; then
15824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	 case $host in
1583b0f6759ab93b42570d71665b13d24ca2c4a5f276Eric Christopher	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | -*-*-bitrig*)
15844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	   # Do not include libc_r directly, use -pthread flag.
15854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	   continue
15864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	   ;;
15874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	 esac
15884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
15894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	deplibs="$deplibs $arg"
15904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
15914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
15924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
1593a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # Tru64 UNIX uses -model [arg] to determine the layout of C++
1594a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # classes, name mangling, and exception handling.
1595a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      -model)
1596a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	compile_command="$compile_command $arg"
1597a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	compiler_flags="$compiler_flags $arg"
1598a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	finalize_command="$finalize_command $arg"
1599a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	prev=xcompiler
1600a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	continue
1601a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	;;
1602a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
160304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
1604a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	compiler_flags="$compiler_flags $arg"
1605a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	compile_command="$compile_command $arg"
1606a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	finalize_command="$finalize_command $arg"
160704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	continue
160804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	;;
160904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
16104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -module)
16114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	module=yes
16124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
16134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
16144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
1615a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
1616a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # -r[0-9][0-9]* specifies the processor on the SGI compiler
1617a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
1618a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # +DA*, +DD* enable 64-bit mode on the HP compiler
1619a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # -q* pass through compiler args for the IBM compiler
1620a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # -m* pass through architecture-specific compiler args for GCC
1621a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # -m*, -t[45]*, -txscale* pass through architecture-specific
1622a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # compiler args for GCC
1623a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # -pg pass through profiling flag for GCC
1624a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # @file GCC response files
1625a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
1626a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      -t[45]*|-txscale*|@*)
1627a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
16284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Unknown arguments in both finalize_command and compile_command need
16294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# to be aesthetically quoted because they are evaled later.
16304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
16314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $arg in
16324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
16334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  arg="\"$arg\""
16344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
16354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
16364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell        compile_command="$compile_command $arg"
16374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell        finalize_command="$finalize_command $arg"
1638a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        compiler_flags="$compiler_flags $arg"
16394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell        continue
16404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell        ;;
16414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
16424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -shrext)
16434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	prev=shrext
16444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
16454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
16464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
16474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -no-fast-install)
16484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fast_install=no
16494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
16504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
16514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
16524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -no-install)
16534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $host in
16544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
16554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # The PATH hackery in wrapper scripts is required on Windows
16564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # in order for the loader to find any dlls it needs.
16574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
16584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
16594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fast_install=no
16604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
16614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*) no_install=yes ;;
16624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
16634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
16644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
16654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
16664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -no-undefined)
16674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	allow_undefined=no
16684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
16694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
16704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
16714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -objectlist)
16724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	prev=objectlist
16734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
16744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
16754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
16764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -o) prev=output ;;
16774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
167804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      -precious-files-regex)
167904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	prev=precious_regex
168004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	continue
168104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	;;
168204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
16834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -release)
16844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	prev=release
16854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
16864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
16874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
16884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -rpath)
16894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	prev=rpath
16904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
16914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
16924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
16934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -R)
16944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	prev=xrpath
16954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
16964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
16974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
16984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -R*)
16994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
17004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# We need an absolute path.
17014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $dir in
17024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	[\\/]* | [A-Za-z]:[\\/]*) ;;
17034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*)
17044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: only absolute run-paths are allowed" 1>&2
170504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
17064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
17074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
17084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case "$xrpath " in
17094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*" $dir "*) ;;
17104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*) xrpath="$xrpath $dir" ;;
17114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
17124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
17134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
17144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
17154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -static)
17164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# The effects of -static are defined in a previous loop.
17174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# We used to do the same as -all-static on platforms that
17184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# didn't have a PIC flag, but the assumption that the effects
17194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# would be equivalent was wrong.  It would break on at least
17204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Digital Unix and AIX.
17214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
17224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
17234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
17244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -thread-safe)
17254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	thread_safe=yes
17264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
17274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
17284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
17294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -version-info)
17304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	prev=vinfo
17314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
17324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
17334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -version-number)
17344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	prev=vinfo
17354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	vinfo_number=yes
17364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
17374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
17384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
17394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -Wc,*)
17404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
17414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	arg=
17424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	save_ifs="$IFS"; IFS=','
17434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	for flag in $args; do
17444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  IFS="$save_ifs"
17454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $flag in
17464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
17474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    flag="\"$flag\""
17484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
17494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
17504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  arg="$arg $wl$flag"
17514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  compiler_flags="$compiler_flags $flag"
17524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	done
17534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	IFS="$save_ifs"
17544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
17554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
17564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
17574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -Wl,*)
17584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
17594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	arg=
17604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	save_ifs="$IFS"; IFS=','
17614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	for flag in $args; do
17624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  IFS="$save_ifs"
17634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $flag in
17644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
17654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    flag="\"$flag\""
17664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
17674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
17684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  arg="$arg $wl$flag"
17694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  compiler_flags="$compiler_flags $wl$flag"
17704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  linker_flags="$linker_flags $flag"
17714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	done
17724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	IFS="$save_ifs"
17734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
17744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
17754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
17764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -Xcompiler)
17774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	prev=xcompiler
17784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
17794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
17804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
17814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -Xlinker)
17824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	prev=xlinker
17834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
17844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
17854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
17864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -XCClinker)
17874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	prev=xcclinker
17884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
17894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
17904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
17914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Some other compiler flag.
17924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -* | +*)
17934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Unknown arguments in both finalize_command and compile_command need
17944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# to be aesthetically quoted because they are evaled later.
17954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
17964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $arg in
17974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
17984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  arg="\"$arg\""
17994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
18004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
18014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
18024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
18034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *.$objext)
18044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# A standard object.
18054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	objs="$objs $arg"
18064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
18074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
18084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *.lo)
18094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# A libtool-controlled object.
18104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
18114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Check to see that this really is a libtool object.
18124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
18134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  pic_object=
18144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  non_pic_object=
18154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
18164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Read the .lo file
18174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # If there is no directory component, then add one.
18184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $arg in
18194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  */* | *\\*) . $arg ;;
18204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *) . ./$arg ;;
18214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
18224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
18234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -z "$pic_object" || \
18244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	     test -z "$non_pic_object" ||
18254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	     test "$pic_object" = none && \
18264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	     test "$non_pic_object" = none; then
18274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
182804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    exit $EXIT_FAILURE
18294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
18304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
18314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Extract subdirectory from the argument.
18324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
18334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "X$xdir" = "X$arg"; then
18344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    xdir=
18354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell 	  else
18364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    xdir="$xdir/"
18374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
18384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
18394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$pic_object" != none; then
18404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Prepend the subdirectory the object is found in.
18414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    pic_object="$xdir$pic_object"
18424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
18434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$prev" = dlfiles; then
18444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
18454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		dlfiles="$dlfiles $pic_object"
18464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		prev=
18474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		continue
18484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      else
18494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		# If libtool objects are unsupported, then we need to preload.
18504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		prev=dlprefiles
18514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
18524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
18534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
18544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # CHECK ME:  I think I busted this.  -Ossama
18554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$prev" = dlprefiles; then
18564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # Preload the old-style object.
18574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      dlprefiles="$dlprefiles $pic_object"
18584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      prev=
18594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
18604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
18614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # A PIC object.
18624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    libobjs="$libobjs $pic_object"
18634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    arg="$pic_object"
18644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
18654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
18664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Non-PIC object.
18674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$non_pic_object" != none; then
18684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Prepend the subdirectory the object is found in.
18694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    non_pic_object="$xdir$non_pic_object"
18704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
18714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # A standard non-PIC object
18724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    non_pic_objects="$non_pic_objects $non_pic_object"
18734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -z "$pic_object" || test "$pic_object" = none ; then
18744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      arg="$non_pic_object"
18754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
1876a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  else
1877a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    # If the PIC object exists, use it instead.
1878a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    # $xdir was prepended to $pic_object above.
1879a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    non_pic_object="$pic_object"
1880a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    non_pic_objects="$non_pic_objects $non_pic_object"
18814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
18824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
18834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Only an error if not doing a dry-run.
18844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -z "$run"; then
18854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
188604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    exit $EXIT_FAILURE
18874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
18884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Dry-run case.
18894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
18904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Extract subdirectory from the argument.
18914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
18924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "X$xdir" = "X$arg"; then
18934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      xdir=
18944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
18954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      xdir="$xdir/"
18964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
18974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
18984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
18994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
19004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    libobjs="$libobjs $pic_object"
19014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    non_pic_objects="$non_pic_objects $non_pic_object"
19024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
19034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
19044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
19054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
19064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *.$libext)
19074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# An archive.
19084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	deplibs="$deplibs $arg"
19094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	old_deplibs="$old_deplibs $arg"
19104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
19114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
19124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
19134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *.la)
19144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# A libtool-controlled library.
19154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
19164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$prev" = dlfiles; then
19174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # This library was specified with -dlopen.
19184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  dlfiles="$dlfiles $arg"
19194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  prev=
19204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	elif test "$prev" = dlprefiles; then
19214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # The library was specified with -dlpreopen.
19224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  dlprefiles="$dlprefiles $arg"
19234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  prev=
19244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
19254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  deplibs="$deplibs $arg"
19264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
19274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
19284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
19294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
19304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Some other compiler argument.
19314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *)
19324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Unknown arguments in both finalize_command and compile_command need
19334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# to be aesthetically quoted because they are evaled later.
19344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
19354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $arg in
19364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
19374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  arg="\"$arg\""
19384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
19394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
19404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
19414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac # arg
19424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
19434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Now actually substitute the argument into the commands.
19444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$arg"; then
19454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	compile_command="$compile_command $arg"
19464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	finalize_command="$finalize_command $arg"
19474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
19484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    done # argument parsing loop
19494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
19504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -n "$prev"; then
19514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
19524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$help" 1>&2
195304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      exit $EXIT_FAILURE
19544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
19554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
19564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
19574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      eval arg=\"$export_dynamic_flag_spec\"
19584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      compile_command="$compile_command $arg"
19594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      finalize_command="$finalize_command $arg"
19604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
19614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
19624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    oldlibs=
19634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # calculate the name of the file, without its directory
19644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
19654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    libobjs_save="$libobjs"
19664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
19674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -n "$shlibpath_var"; then
19684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # get the directories listed in $shlibpath_var
19694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
19704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    else
19714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      shlib_search_path=
19724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
19734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
19744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
19754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
19764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
19774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test "X$output_objdir" = "X$output"; then
19784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      output_objdir="$objdir"
19794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    else
19804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      output_objdir="$output_objdir/$objdir"
19814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
19824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Create the object directory.
19834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test ! -d "$output_objdir"; then
19844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $show "$mkdir $output_objdir"
19854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $run $mkdir $output_objdir
1986a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      exit_status=$?
1987a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
1988a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	exit $exit_status
19894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
19904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
19914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
19924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Determine the type of output
19934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    case $output in
19944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    "")
19954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$modename: you must specify an output file" 1>&2
19964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$help" 1>&2
199704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      exit $EXIT_FAILURE
19984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
19994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *.$libext) linkmode=oldlib ;;
20004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *.lo | *.$objext) linkmode=obj ;;
20014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *.la) linkmode=lib ;;
20024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *) linkmode=prog ;; # Anything else should be a program.
20034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    esac
20044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
20054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    case $host in
20064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *cygwin* | *mingw* | *pw32*)
200704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      # don't eliminate duplications in $postdeps and $predeps
20084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      duplicate_compiler_generated_deps=yes
20094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
20104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *)
20114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      duplicate_compiler_generated_deps=$duplicate_deps
20124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
20134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    esac
20144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    specialdeplibs=
20154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
20164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    libs=
20174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Find all interdependent deplibs by searching for libraries
20184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # that are linked more than once (e.g. -la -lb -la)
20194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    for deplib in $deplibs; do
20204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "X$duplicate_deps" = "Xyes" ; then
20214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case "$libs " in
20224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
20234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
20244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
20254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      libs="$libs $deplib"
20264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    done
20274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
20284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test "$linkmode" = lib; then
20294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      libs="$predeps $libs $compiler_lib_search_path $postdeps"
20304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
20314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Compute libraries that are listed more than once in $predeps
20324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # $postdeps and mark them as special (i.e., whose duplicates are
20334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # not to be eliminated).
20344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      pre_post_deps=
20354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
20364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	for pre_post_dep in $predeps $postdeps; do
20374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case "$pre_post_deps " in
20384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
20394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
20404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  pre_post_deps="$pre_post_deps $pre_post_dep"
20414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	done
20424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
20434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      pre_post_deps=
20444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
20454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
20464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    deplibs=
20474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    newdependency_libs=
20484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    newlib_search_path=
20494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    need_relink=no # whether we're linking any uninstalled libtool libraries
20504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    notinst_deplibs= # not-installed libtool libraries
20514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    case $linkmode in
20524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    lib)
20534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	passes="conv link"
20544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	for file in $dlfiles $dlprefiles; do
20554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $file in
20564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *.la) ;;
20574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *)
20584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
205904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    exit $EXIT_FAILURE
20604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
20614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
20624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	done
20634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
20644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    prog)
20654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	compile_deplibs=
20664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	finalize_deplibs=
20674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	alldeplibs=no
20684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	newdlfiles=
20694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	newdlprefiles=
20704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	passes="conv scan dlopen dlpreopen link"
20714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
20724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *)  passes="conv"
20734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
20744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    esac
20754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    for pass in $passes; do
20764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$linkmode,$pass" = "lib,link" ||
20774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	 test "$linkmode,$pass" = "prog,scan"; then
20784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	libs="$deplibs"
20794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	deplibs=
20804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
20814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$linkmode" = prog; then
20824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $pass in
20834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	dlopen) libs="$dlfiles" ;;
20844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	dlpreopen) libs="$dlprefiles" ;;
20854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
20864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
20874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
20884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$pass" = dlopen; then
20894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Collect dlpreopened libraries
20904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	save_deplibs="$deplibs"
20914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	deplibs=
20924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
20934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      for deplib in $libs; do
20944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	lib=
20954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	found=no
20964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $deplib in
209704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
209804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  if test "$linkmode,$pass" = "prog,link"; then
209904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    compile_deplibs="$deplib $compile_deplibs"
210004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    finalize_deplibs="$deplib $finalize_deplibs"
210104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  else
2102a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    compiler_flags="$compiler_flags $deplib"
210304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  fi
210404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  continue
210504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  ;;
21064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	-l*)
21074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$linkmode" != lib && test "$linkmode" != prog; then
21084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
21094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    continue
21104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
21114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
21124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
211304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    for search_ext in .la $std_shrext .so .a; do
211404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      # Search the libtool library
211504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      lib="$searchdir/lib${name}${search_ext}"
211604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      if test -f "$lib"; then
211704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		if test "$search_ext" = ".la"; then
211804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		  found=yes
211904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		else
212004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		  found=no
212104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		fi
212204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		break 2
212304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      fi
212404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    done
21254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
21264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$found" != yes; then
21274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # deplib doesn't seem to be a libtool library
21284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$linkmode,$pass" = "prog,link"; then
21294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      compile_deplibs="$deplib $compile_deplibs"
21304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      finalize_deplibs="$deplib $finalize_deplibs"
21314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
21324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      deplibs="$deplib $deplibs"
21334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
21344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
21354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    continue
21364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else # deplib is a libtool library
21374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
21384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # We need to do some special things here, and not later.
21394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
21404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case " $predeps $postdeps " in
21414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *" $deplib "*)
21424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		if (${SED} -e '2q' $lib |
21434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
21444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  library_names=
21454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  old_library=
21464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  case $lib in
21474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  */* | *\\*) . $lib ;;
21484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  *) . ./$lib ;;
21494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  esac
21504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  for l in $old_library $library_names; do
21514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    ll="$l"
21524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  done
21534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  if test "X$ll" = "X$old_library" ; then # only static version available
21544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    found=no
21554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
21564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    test "X$ladir" = "X$lib" && ladir="."
21574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    lib=$ladir/$old_library
21584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    if test "$linkmode,$pass" = "prog,link"; then
21594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      compile_deplibs="$deplib $compile_deplibs"
21604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      finalize_deplibs="$deplib $finalize_deplibs"
21614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    else
21624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      deplibs="$deplib $deplibs"
21634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
21644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    fi
21654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    continue
21664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  fi
21674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		fi
21684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	        ;;
21694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *) ;;
21704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
21714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
21724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
21734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;; # -l
21744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	-L*)
21754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $linkmode in
21764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  lib)
21774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    deplibs="$deplib $deplibs"
21784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    test "$pass" = conv && continue
21794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    newdependency_libs="$deplib $newdependency_libs"
21804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
21814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
21824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  prog)
21834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$pass" = conv; then
21844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      deplibs="$deplib $deplibs"
21854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      continue
21864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
21874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$pass" = scan; then
21884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      deplibs="$deplib $deplibs"
21894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
21904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      compile_deplibs="$deplib $compile_deplibs"
21914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      finalize_deplibs="$deplib $finalize_deplibs"
21924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
219304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
21944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
21954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *)
21964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
21974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
21984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac # linkmode
21994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
22004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;; # -L
22014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	-R*)
22024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$pass" = link; then
22034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
22044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Make sure the xrpath contains only unique directories.
22054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    case "$xrpath " in
22064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *" $dir "*) ;;
22074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *) xrpath="$xrpath $dir" ;;
22084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    esac
22094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
22104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  deplibs="$deplib $deplibs"
22114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
22124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
22134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*.la) lib="$deplib" ;;
22144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*.$libext)
22154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$pass" = conv; then
22164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    deplibs="$deplib $deplibs"
22174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    continue
22184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
22194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $linkmode in
22204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  lib)
222104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    valid_a_lib=no
222204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    case $deplibs_check_method in
222304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      match_pattern*)
222404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		set dummy $deplibs_check_method
222504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
222604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		if eval $echo \"$deplib\" 2>/dev/null \
222704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		    | $SED 10q \
222804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		    | $EGREP "$match_pattern_regex" > /dev/null; then
222904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		  valid_a_lib=yes
223004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		fi
223104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		;;
223204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      pass_all)
223304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		valid_a_lib=yes
223404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		;;
223504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer            esac
223604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    if test "$valid_a_lib" != yes; then
22374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo
22384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** Warning: Trying to link with static lib archive $deplib."
22394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** I have the capability to make that library automatically link in when"
22404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** you link to this library.  But I can only do this if you have a"
22414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** shared version of the library, which you do not appear to have"
22424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** because the file extensions .$libext of this argument makes me believe"
22434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** that it is just a static archive that I should not used here."
22444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
22454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo
22464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** Warning: Linking the shared library $output against the"
22474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** static library $deplib is not portable!"
22484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      deplibs="$deplib $deplibs"
22494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
22504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    continue
22514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
22524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  prog)
22534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$pass" != link; then
22544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      deplibs="$deplib $deplibs"
22554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
22564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      compile_deplibs="$deplib $compile_deplibs"
22574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      finalize_deplibs="$deplib $finalize_deplibs"
22584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
22594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    continue
22604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
22614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac # linkmode
22624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;; # *.$libext
22634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*.lo | *.$objext)
22644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$pass" = conv; then
22654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    deplibs="$deplib $deplibs"
22664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  elif test "$linkmode" = prog; then
22674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
22684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # If there is no dlopen support or we're linking statically,
22694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # we need to preload.
22704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      newdlprefiles="$newdlprefiles $deplib"
22714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      compile_deplibs="$deplib $compile_deplibs"
22724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      finalize_deplibs="$deplib $finalize_deplibs"
22734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
22744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      newdlfiles="$newdlfiles $deplib"
22754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
22764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
22774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
22784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
22794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	%DEPLIBS%)
22804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  alldeplibs=yes
22814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
22824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
22834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac # case $deplib
22844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$found" = yes || test -f "$lib"; then :
22854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
2286a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
228704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
22884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
22894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
22904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Check to see that this really is a libtool archive.
22914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
22924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
22934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
229404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
22954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
22964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
22974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
22984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	test "X$ladir" = "X$lib" && ladir="."
22994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
23004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	dlname=
23014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	dlopen=
23024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	dlpreopen=
23034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	libdir=
23044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	library_names=
23054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	old_library=
23064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# If the library was installed with an old release of libtool,
23074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# it will not redefine variables installed, or shouldnotlink
23084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	installed=yes
23094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	shouldnotlink=no
2310a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	avoidtemprpath=
2311a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
23124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
23134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Read the .la file
23144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $lib in
23154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*/* | *\\*) . $lib ;;
23164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*) . ./$lib ;;
23174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
23184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
23194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$linkmode,$pass" = "lib,link" ||
23204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	   test "$linkmode,$pass" = "prog,scan" ||
23214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
23224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
23234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
23244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
23254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
23264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$pass" = conv; then
23274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Only check for convenience libraries
23284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  deplibs="$lib $deplibs"
23294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -z "$libdir"; then
23304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -z "$old_library"; then
23314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
233204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      exit $EXIT_FAILURE
23334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
23344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # It is a libtool convenience library, so add in its objects.
23354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    convenience="$convenience $ladir/$objdir/$old_library"
23364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
23374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    tmp_libs=
23384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    for deplib in $dependency_libs; do
23394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      deplibs="$deplib $deplibs"
23404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell              if test "X$duplicate_deps" = "Xyes" ; then
23414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	        case "$tmp_libs " in
23424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
23434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	        esac
23444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell              fi
23454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      tmp_libs="$tmp_libs $deplib"
23464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    done
23474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
23484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
234904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    exit $EXIT_FAILURE
23504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
23514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
23524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi # $pass = conv
23534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
235404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
23554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Get the name of the library we link against.
23564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	linklib=
23574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	for l in $old_library $library_names; do
23584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  linklib="$l"
23594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	done
23604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -z "$linklib"; then
23614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
236204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
23634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
23644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
23654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# This library was specified with -dlopen.
23664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$pass" = dlopen; then
23674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -z "$libdir"; then
23684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
236904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    exit $EXIT_FAILURE
23704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
237104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  if test -z "$dlname" ||
237204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	     test "$dlopen_support" != yes ||
237304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	     test "$build_libtool_libs" = no; then
23744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # If there is no dlname, no dlopen support or we're linking
23754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # statically, we need to preload.  We also need to preload any
23764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # dependent libraries so libltdl's deplib preloader doesn't
23774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # bomb out in the load deplibs phase.
23784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    dlprefiles="$dlprefiles $lib $dependency_libs"
23794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
23804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    newdlfiles="$newdlfiles $lib"
23814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
23824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
23834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi # $pass = dlopen
23844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
23854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# We need an absolute path.
23864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $ladir in
23874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
23884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*)
23894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  abs_ladir=`cd "$ladir" && pwd`
23904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -z "$abs_ladir"; then
23914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
23924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
23934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    abs_ladir="$ladir"
23944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
23954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
23964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
23974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
23984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
23994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Find the relevant object directory and library name.
24004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "X$installed" = Xyes; then
24014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
24024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
24034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    dir="$ladir"
24044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    absdir="$abs_ladir"
24054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    libdir="$abs_ladir"
24064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
24074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    dir="$libdir"
24084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    absdir="$libdir"
24094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
2410a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
24114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
241204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
241304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    dir="$ladir"
241404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    absdir="$abs_ladir"
241504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    # Remove this search path later
241604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    notinst_path="$notinst_path $abs_ladir"
241704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  else
241804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    dir="$ladir/$objdir"
241904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    absdir="$abs_ladir/$objdir"
242004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    # Remove this search path later
242104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    notinst_path="$notinst_path $abs_ladir"
242204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  fi
24234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi # $installed = yes
24244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
24254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
24264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# This library was specified with -dlpreopen.
24274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$pass" = dlpreopen; then
24284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -z "$libdir"; then
24294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
243004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    exit $EXIT_FAILURE
24314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
24324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Prefer using a static library (so that no silly _DYNAMIC symbols
24334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # are required to link).
24344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -n "$old_library"; then
24354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    newdlprefiles="$newdlprefiles $dir/$old_library"
24364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Otherwise, use the dlname, so that lt_dlopen finds it.
24374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  elif test -n "$dlname"; then
24384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    newdlprefiles="$newdlprefiles $dir/$dlname"
24394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
24404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    newdlprefiles="$newdlprefiles $dir/$linklib"
24414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
24424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi # $pass = dlpreopen
24434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
24444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -z "$libdir"; then
24454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Link the convenience library
24464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$linkmode" = lib; then
24474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    deplibs="$dir/$old_library $deplibs"
24484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  elif test "$linkmode,$pass" = "prog,link"; then
24494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    compile_deplibs="$dir/$old_library $compile_deplibs"
24504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
24514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
24524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    deplibs="$lib $deplibs" # used for prog,scan pass
24534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
24544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
24554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
24564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
245704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
24584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$linkmode" = prog && test "$pass" != link; then
24594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  newlib_search_path="$newlib_search_path $ladir"
24604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  deplibs="$lib $deplibs"
24614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
24624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  linkalldeplibs=no
24634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
24644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	     test "$build_libtool_libs" = no; then
24654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    linkalldeplibs=yes
24664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
24674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
24684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  tmp_libs=
24694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for deplib in $dependency_libs; do
24704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    case $deplib in
24714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
24724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    esac
24734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Need to link against all dependency_libs?
24744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$linkalldeplibs" = yes; then
24754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      deplibs="$deplib $deplibs"
24764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
24774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # Need to hardcode shared library paths
24784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # or/and link against static libraries
24794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      newdependency_libs="$deplib $newdependency_libs"
24804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
24814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "X$duplicate_deps" = "Xyes" ; then
24824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case "$tmp_libs " in
24834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
24844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
24854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
24864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    tmp_libs="$tmp_libs $deplib"
24874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done # for deplib
24884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
24894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi # $linkmode = prog...
24904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
24914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$linkmode,$pass" = "prog,link"; then
24924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -n "$library_names" &&
24934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
24944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # We need to hardcode the library path
2495a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
24964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # Make sure the rpath contains only unique directories.
24974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case "$temp_rpath " in
24984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *" $dir "*) ;;
24994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *" $absdir "*) ;;
2500a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      *) temp_rpath="$temp_rpath $absdir" ;;
25014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
25024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
25034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
25044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Hardcode the library path.
25054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Skip directories that are in the system default run-time
25064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # search path.
25074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    case " $sys_lib_dlsearch_path " in
25084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *" $absdir "*) ;;
25094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *)
25104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case "$compile_rpath " in
25114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *" $absdir "*) ;;
25124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *) compile_rpath="$compile_rpath $absdir"
25134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
25144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      ;;
25154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    esac
25164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    case " $sys_lib_dlsearch_path " in
25174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *" $libdir "*) ;;
25184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *)
25194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case "$finalize_rpath " in
25204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *" $libdir "*) ;;
25214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *) finalize_rpath="$finalize_rpath $libdir"
25224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
25234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      ;;
25244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    esac
25254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi # $linkmode,$pass = prog,link...
25264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
25274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$alldeplibs" = yes &&
25284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	     { test "$deplibs_check_method" = pass_all ||
25294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	       { test "$build_libtool_libs" = yes &&
25304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		 test -n "$library_names"; }; }; then
25314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # We only need to search for static libraries
25324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    continue
25334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
25344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
25354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
25364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	link_static=no # Whether the deplib will be linked statically
2537a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	use_static_libs=$prefer_static_libs
2538a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	if test "$use_static_libs" = built && test "$installed" = yes ; then
2539a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  use_static_libs=no
2540a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	fi
25414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$library_names" &&
2542a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
25434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$installed" = no; then
25444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    notinst_deplibs="$notinst_deplibs $lib"
25454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    need_relink=yes
25464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
25474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # This is a shared library
254804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
254904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  # Warn about portability, can't link against -module's on
255004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  # some systems (darwin)
255104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
25524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo
25534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$linkmode" = prog; then
25544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** Warning: Linking the executable $output against the loadable module"
25554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
25564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** Warning: Linking the shared library $output against the loadable module"
25574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
255804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    $echo "*** $linklib is not portable!"
255904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  fi
25604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$linkmode" = lib &&
25614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	     test "$hardcode_into_libs" = yes; then
25624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Hardcode the library path.
25634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Skip directories that are in the system default run-time
25644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # search path.
25654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    case " $sys_lib_dlsearch_path " in
25664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *" $absdir "*) ;;
25674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *)
25684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case "$compile_rpath " in
25694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *" $absdir "*) ;;
25704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *) compile_rpath="$compile_rpath $absdir"
25714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
25724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      ;;
25734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    esac
25744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    case " $sys_lib_dlsearch_path " in
25754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *" $libdir "*) ;;
25764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *)
25774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case "$finalize_rpath " in
25784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *" $libdir "*) ;;
25794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *) finalize_rpath="$finalize_rpath $libdir"
25804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
25814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      ;;
25824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    esac
25834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
25844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
25854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -n "$old_archive_from_expsyms_cmds"; then
25864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # figure out the soname
25874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    set dummy $library_names
25884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    realname="$2"
25894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    shift; shift
25904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    libname=`eval \\$echo \"$libname_spec\"`
25914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # use dlname if we got it. it's perfectly good, no?
25924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -n "$dlname"; then
25934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      soname="$dlname"
25944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    elif test -n "$soname_spec"; then
25954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # bleh windows
25964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case $host in
25974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *cygwin* | mingw*)
25984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		major=`expr $current - $age`
25994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		versuffix="-$major"
26004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		;;
26014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
26024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      eval soname=\"$soname_spec\"
26034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
26044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      soname="$realname"
26054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
26064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
26074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Make a new name for the extract_expsyms_cmds to use
26084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    soroot="$soname"
26094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
26104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
26114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
26124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # If the library has no export list, then create one now
26134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -f "$output_objdir/$soname-def"; then :
26144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
26154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $show "extracting exported symbol list from \`$soname'"
26164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      save_ifs="$IFS"; IFS='~'
261704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      cmds=$extract_expsyms_cmds
26184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      for cmd in $cmds; do
26194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		IFS="$save_ifs"
262004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		eval cmd=\"$cmd\"
26214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$show "$cmd"
26224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$run eval "$cmd" || exit $?
26234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      done
26244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      IFS="$save_ifs"
26254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
26264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
26274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Create $newlib
26284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -f "$output_objdir/$newlib"; then :; else
26294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $show "generating import library for \`$soname'"
26304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      save_ifs="$IFS"; IFS='~'
263104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      cmds=$old_archive_from_expsyms_cmds
26324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      for cmd in $cmds; do
26334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		IFS="$save_ifs"
263404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		eval cmd=\"$cmd\"
26354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$show "$cmd"
26364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$run eval "$cmd" || exit $?
26374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      done
26384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      IFS="$save_ifs"
26394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
26404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # make sure the library variables are pointing to the new library
26414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    dir=$output_objdir
26424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    linklib=$newlib
26434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi # test -n "$old_archive_from_expsyms_cmds"
26444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
26454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$linkmode" = prog || test "$mode" != relink; then
26464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    add_shlibpath=
26474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    add_dir=
26484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    add=
26494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    lib_linked=yes
26504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    case $hardcode_action in
26514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    immediate | unsupported)
26524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test "$hardcode_direct" = no; then
26534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		add="$dir/$linklib"
26544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		case $host in
2655a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
2656a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
2657a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
2658a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		    *-*-unixware7*) add_dir="-L$dir" ;;
26594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  *-*-darwin* )
266004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		    # if the lib is a module then we can not link against
266104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		    # it, someone is ignoring the new warnings I added
2662a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		    if /usr/bin/file -L $add 2> /dev/null |
2663a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer                      $EGREP ": [^:]* bundle" >/dev/null ; then
26644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      $echo "** Warning, lib $linklib is a module, not a shared library"
26654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      if test -z "$old_library" ; then
26664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		        $echo
26674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		        $echo "** And there doesn't seem to be a static archive available"
26684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		        $echo "** The link will probably fail, sorry"
26694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      else
26704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		        add="$dir/$old_library"
267104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		      fi
26724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    fi
26734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		esac
26744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      elif test "$hardcode_minus_L" = no; then
26754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		case $host in
26764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		*-*-sunos*) add_shlibpath="$dir" ;;
26774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		esac
26784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		add_dir="-L$dir"
26794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		add="-l$name"
26804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      elif test "$hardcode_shlibpath_var" = no; then
26814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		add_shlibpath="$dir"
26824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		add="-l$name"
26834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      else
26844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		lib_linked=no
26854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
26864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      ;;
26874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    relink)
26884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test "$hardcode_direct" = yes; then
26894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		add="$dir/$linklib"
26904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      elif test "$hardcode_minus_L" = yes; then
26914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		add_dir="-L$dir"
26924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		# Try looking first in the location we're being installed to.
26934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		if test -n "$inst_prefix_dir"; then
2694a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		  case $libdir in
26954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    [\\/]*)
269604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
26974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      ;;
26984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  esac
26994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		fi
27004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		add="-l$name"
27014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      elif test "$hardcode_shlibpath_var" = yes; then
27024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		add_shlibpath="$dir"
27034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		add="-l$name"
27044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      else
27054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		lib_linked=no
27064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
27074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      ;;
27084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *) lib_linked=no ;;
27094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    esac
27104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
27114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$lib_linked" != yes; then
27124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "$modename: configuration error: unsupported hardcode properties"
271304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      exit $EXIT_FAILURE
27144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
27154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
27164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -n "$add_shlibpath"; then
27174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case :$compile_shlibpath: in
27184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *":$add_shlibpath:"*) ;;
27194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
27204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
27214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
27224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$linkmode" = prog; then
27234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
27244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
27254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
27264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
27274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      test -n "$add" && deplibs="$add $deplibs"
27284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test "$hardcode_direct" != yes && \
27294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		 test "$hardcode_minus_L" != yes && \
27304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		 test "$hardcode_shlibpath_var" = yes; then
27314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		case :$finalize_shlibpath: in
27324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		*":$libdir:"*) ;;
27334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
27344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		esac
27354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
27364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
27374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
27384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
27394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$linkmode" = prog || test "$mode" = relink; then
27404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    add_shlibpath=
27414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    add_dir=
27424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    add=
27434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Finalize command for both is simple: just hardcode it.
27444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$hardcode_direct" = yes; then
27454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      add="$libdir/$linklib"
27464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    elif test "$hardcode_minus_L" = yes; then
27474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      add_dir="-L$libdir"
27484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      add="-l$name"
27494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    elif test "$hardcode_shlibpath_var" = yes; then
27504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case :$finalize_shlibpath: in
27514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *":$libdir:"*) ;;
27524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
27534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
27544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      add="-l$name"
27554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    elif test "$hardcode_automatic" = yes; then
275604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      if test -n "$inst_prefix_dir" &&
275704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
27584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	        add="$inst_prefix_dir$libdir/$linklib"
27594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      else
27604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	        add="$libdir/$linklib"
27614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
27624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
27634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # We cannot seem to hardcode it, guess we'll fake it.
27644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      add_dir="-L$libdir"
27654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # Try looking first in the location we're being installed to.
27664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test -n "$inst_prefix_dir"; then
2767a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		case $libdir in
27684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  [\\/]*)
276904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
27704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    ;;
27714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		esac
27724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
27734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      add="-l$name"
27744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
27754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
27764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$linkmode" = prog; then
27774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
27784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
27794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
27804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
27814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      test -n "$add" && deplibs="$add $deplibs"
27824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
27834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
27844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	elif test "$linkmode" = prog; then
27854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Here we assume that one of hardcode_direct or hardcode_minus_L
27864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # is not unsupported.  This is valid on all known static and
27874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # shared platforms.
27884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$hardcode_direct" != unsupported; then
27894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    test -n "$old_library" && linklib="$old_library"
27904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    compile_deplibs="$dir/$linklib $compile_deplibs"
27914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
27924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
27934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    compile_deplibs="-l$name -L$dir $compile_deplibs"
27944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
27954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
27964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	elif test "$build_libtool_libs" = yes; then
27974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Not a shared library
27984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$deplibs_check_method" != pass_all; then
27994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # We're trying link a shared library against a static one
28004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # but the system doesn't support it.
28014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
28024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Just print a warning and add the library to dependency_libs so
28034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # that the program can be linked against the static library.
28044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo
28054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "*** Warning: This system can not link to static lib archive $lib."
28064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "*** I have the capability to make that library automatically link in when"
28074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "*** you link to this library.  But I can only do this if you have a"
28084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "*** shared version of the library, which you do not appear to have."
28094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$module" = yes; then
28104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** But as you try to build a module library, libtool will still create "
28114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** a static module, that should work as long as the dlopening application"
28124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
28134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test -z "$global_symbol_pipe"; then
28144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo
28154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo "*** However, this would only work if libtool was able to extract symbol"
28164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
28174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo "*** not find such a program.  So, this module is probably useless."
28184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
28194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
28204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test "$build_old_libs" = no; then
28214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		build_libtool_libs=module
28224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		build_old_libs=yes
28234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      else
28244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		build_libtool_libs=no
28254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
28264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
28274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
28284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    deplibs="$dir/$old_library $deplibs"
28294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    link_static=yes
28304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
28314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi # link shared/static library?
28324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
28334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$linkmode" = lib; then
28344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -n "$dependency_libs" &&
283504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	     { test "$hardcode_into_libs" != yes ||
283604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	       test "$build_old_libs" = yes ||
28374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	       test "$link_static" = yes; }; then
28384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Extract -R from dependency_libs
28394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    temp_deplibs=
28404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    for libdir in $dependency_libs; do
28414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case $libdir in
28424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
28434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		   case " $xrpath " in
28444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		   *" $temp_xrpath "*) ;;
28454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		   *) xrpath="$xrpath $temp_xrpath";;
28464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		   esac;;
28474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *) temp_deplibs="$temp_deplibs $libdir";;
28484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
28494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    done
28504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    dependency_libs="$temp_deplibs"
28514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
28524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
28534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  newlib_search_path="$newlib_search_path $absdir"
28544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Link against this library
28554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
28564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # ... and its dependency_libs
28574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  tmp_libs=
28584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for deplib in $dependency_libs; do
28594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    newdependency_libs="$deplib $newdependency_libs"
28604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "X$duplicate_deps" = "Xyes" ; then
28614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case "$tmp_libs " in
28624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
28634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
28644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
28654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    tmp_libs="$tmp_libs $deplib"
28664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
28674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
28684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$link_all_deplibs" != no; then
28694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Add the search paths of all dependency libraries
28704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    for deplib in $dependency_libs; do
28714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case $deplib in
28724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      -L*) path="$deplib" ;;
28734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *.la)
28744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
28754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		test "X$dir" = "X$deplib" && dir="."
28764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		# We need an absolute path.
28774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		case $dir in
28784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
28794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		*)
28804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  absdir=`cd "$dir" && pwd`
28814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  if test -z "$absdir"; then
28824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
28834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    absdir="$dir"
28844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  fi
28854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  ;;
28864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		esac
28874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		if grep "^installed=no" $deplib > /dev/null; then
28884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  path="$absdir/$objdir"
28894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		else
28904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
28914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  if test -z "$libdir"; then
28924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
289304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		    exit $EXIT_FAILURE
28944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  fi
28954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  if test "$absdir" != "$libdir"; then
28964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
28974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  fi
28984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  path="$absdir"
28994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		fi
29004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		depdepl=
29014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		case $host in
29024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		*-*-darwin*)
290304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		  # we do not want to link against static libs,
290404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		  # but need to link against shared
29054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
29064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  if test -n "$deplibrary_names" ; then
29074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    for tmp in $deplibrary_names ; do
29084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      depdepl=$tmp
29094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    done
29104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    if test -f "$path/$depdepl" ; then
29114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      depdepl="$path/$depdepl"
291204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		    fi
291304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		    # do not add paths which are already there
291404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		    case " $newlib_search_path " in
291504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		    *" $path "*) ;;
291604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		    *) newlib_search_path="$newlib_search_path $path";;
291704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		    esac
29184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  fi
291904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		  path=""
29204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  ;;
29214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		*)
292204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		  path="-L$path"
292304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		  ;;
292404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		esac
29254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		;;
292604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      -l*)
29274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		case $host in
29284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		*-*-darwin*)
292904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		  # Again, we only want to link against shared libraries
293004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
293104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		  for tmp in $newlib_search_path ; do
293204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
293304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		      eval depdepl="$tmp/lib$tmp_libs.dylib"
293404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		      break
293504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		    fi
293604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		  done
293704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		  path=""
29384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  ;;
29394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		*) continue ;;
294004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		esac
29414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		;;
29424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *) continue ;;
29434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
29444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case " $deplibs " in
2945a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      *" $path "*) ;;
2946a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      *) deplibs="$path $deplibs" ;;
294704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      esac
29484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case " $deplibs " in
2949a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      *" $depdepl "*) ;;
2950a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      *) deplibs="$depdepl $deplibs" ;;
29514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
29524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    done
29534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi # link_all_deplibs != no
29544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi # linkmode = lib
29554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      done # for deplib in $libs
29564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      dependency_libs="$newdependency_libs"
29574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$pass" = dlpreopen; then
29584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Link the dlpreopened libraries before other libraries
29594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	for deplib in $save_deplibs; do
29604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  deplibs="$deplib $deplibs"
29614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	done
29624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
29634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$pass" != dlopen; then
29644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$pass" != conv; then
29654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Make sure lib_search_path contains only unique directories.
29664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  lib_search_path=
29674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for dir in $newlib_search_path; do
29684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    case "$lib_search_path " in
29694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *" $dir "*) ;;
29704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *) lib_search_path="$lib_search_path $dir" ;;
29714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    esac
29724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
29734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  newlib_search_path=
29744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
29754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
29764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$linkmode,$pass" != "prog,link"; then
29774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  vars="deplibs"
29784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
29794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  vars="compile_deplibs finalize_deplibs"
29804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
29814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	for var in $vars dependency_libs; do
29824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Add libraries to $var in reverse order
29834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  eval tmp_libs=\"\$$var\"
29844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  new_libs=
29854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for deplib in $tmp_libs; do
29864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # FIXME: Pedantically, this is the right thing to do, so
29874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    #        that some nasty dependency loop isn't accidentally
29884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    #        broken:
29894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    #new_libs="$deplib $new_libs"
29904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Pragmatically, this seems to cause very few problems in
29914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # practice:
29924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    case $deplib in
29934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    -L*) new_libs="$deplib $new_libs" ;;
29944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    -R*) ;;
29954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *)
29964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # And here is the reason: when a library appears more
29974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # than once as an explicit dependence of a library, or
29984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # is implicitly linked in more than once by the
29994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # compiler, it is considered special, and multiple
30004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # occurrences thereof are not removed.  Compare this
30014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # with having the same library being listed as a
30024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # dependency of multiple other libraries: in this case,
30034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # we know (pedantically, we assume) the library does not
30044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # need to be listed more than once, so we keep only the
30054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # last copy.  This is not always right, but it is rare
30064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # enough that we require users that really mean to play
30074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # such unportable linking tricks to link the library
30084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # using -Wl,-lname, so that libtool does not consider it
30094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # for duplicate removal.
30104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case " $specialdeplibs " in
30114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
30124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *)
30134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		case " $new_libs " in
30144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		*" $deplib "*) ;;
30154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		*) new_libs="$deplib $new_libs" ;;
30164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		esac
30174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		;;
30184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
30194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      ;;
30204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    esac
30214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
30224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  tmp_libs=
30234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for deplib in $new_libs; do
30244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    case $deplib in
30254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    -L*)
30264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case " $tmp_libs " in
30274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *" $deplib "*) ;;
30284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *) tmp_libs="$tmp_libs $deplib" ;;
30294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
30304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      ;;
30314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *) tmp_libs="$tmp_libs $deplib" ;;
30324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    esac
30334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
30344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  eval $var=\"$tmp_libs\"
30354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	done # for var
30364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
303704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      # Last step: remove runtime libs from dependency_libs
303804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      # (they stay in deplibs)
30394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      tmp_libs=
30404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      for i in $dependency_libs ; do
30414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case " $predeps $postdeps $compiler_lib_search_path " in
30424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*" $i "*)
30434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  i=""
30444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
30454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
30464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$i" ; then
30474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  tmp_libs="$tmp_libs $i"
30484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
30494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      done
30504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      dependency_libs=$tmp_libs
30514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    done # for pass
30524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test "$linkmode" = prog; then
30534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      dlfiles="$newdlfiles"
30544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      dlprefiles="$newdlprefiles"
30554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
30564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
30574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    case $linkmode in
30584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    oldlib)
30594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$deplibs"; then
30604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
30614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
30624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
30634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
30644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
30654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
30664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
30674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$rpath"; then
30684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
30694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
30704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
30714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$xrpath"; then
30724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
30734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
30744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
30754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$vinfo"; then
30764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
30774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
30784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
30794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$release"; then
30804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
30814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
30824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
30834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
30844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
30854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
30864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
30874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Now set the variables for building old libraries.
30884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      build_libtool_libs=no
30894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      oldlibs="$output"
30904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      objs="$objs$old_deplibs"
30914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
30924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
30934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    lib)
30944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Make sure we only generate libraries of the form `libNAME.la'.
30954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case $outputname in
30964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      lib*)
30974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
309804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	eval shared_ext=\"$shrext_cmds\"
30994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	eval libname=\"$libname_spec\"
31004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
31014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *)
31024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$module" = no; then
31034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
31044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$help" 1>&2
310504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
31064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
31074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$need_lib_prefix" != no; then
31084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Add the "lib" prefix for modules if required
31094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
311004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  eval shared_ext=\"$shrext_cmds\"
31114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  eval libname=\"$libname_spec\"
31124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
31134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
31144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
31154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
31164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
31174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
31184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$objs"; then
31194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$deplibs_check_method" != pass_all; then
31204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
312104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
31224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
31234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo
31244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
31254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "*** objects $objs is not portable!"
31264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  libobjs="$libobjs $objs"
31274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
31284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
31294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
31304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$dlself" != no; then
31314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
31324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
31334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
31344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      set dummy $rpath
31354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$#" -gt 2; then
31364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
31374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
31384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      install_libdir="$2"
31394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
31404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      oldlibs=
31414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -z "$rpath"; then
31424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$build_libtool_libs" = yes; then
31434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Building a libtool convenience library.
31444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Some compilers have problems with a `.al' extension so
31454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # convenience libraries should have the same extension an
31464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # archive normally would.
31474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
31484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  build_libtool_libs=convenience
31494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  build_old_libs=yes
31504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
31514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
31524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$vinfo"; then
31534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
31544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
31554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
31564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$release"; then
31574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
31584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
31594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      else
31604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
31614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Parse the version information argument.
31624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	save_ifs="$IFS"; IFS=':'
31634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	set dummy $vinfo 0 0 0
31644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	IFS="$save_ifs"
31654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
31664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$8"; then
31674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
31684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$help" 1>&2
316904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
31704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
31714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
31724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# convert absolute version numbers to libtool ages
31734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# this retains compatibility with .la files and attempts
31744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# to make the code below a bit more comprehensible
317504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
31764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $vinfo_number in
31774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	yes)
31784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  number_major="$2"
31794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  number_minor="$3"
31804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  number_revision="$4"
31814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  #
31824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # There are really only two kinds -- those that
31834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # use the current revision as the major version
31844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # and those that subtract age and use age as
31854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # a minor version.  But, then there is irix
31864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # which has an extra 1 added just for fun
31874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  #
31884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $version_type in
31894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  darwin|linux|osf|windows)
31904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    current=`expr $number_major + $number_minor`
31914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    age="$number_minor"
31924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    revision="$number_revision"
31934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
31944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  freebsd-aout|freebsd-elf|sunos)
31954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    current="$number_major"
31964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    revision="$number_minor"
31974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    age="0"
31984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
31994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  irix|nonstopux)
32004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    current=`expr $number_major + $number_minor - 1`
32014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    age="$number_minor"
32024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    revision="$number_minor"
32034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
32044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
32054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
32064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	no)
32074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  current="$2"
32084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  revision="$3"
32094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  age="$4"
32104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
32114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
32124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
32134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Check that each of the things are valid numbers.
32144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $current in
3215a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	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]) ;;
32164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*)
3217a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
32184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
321904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
32204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
32214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
32224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
32234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $revision in
3224a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	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]) ;;
32254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*)
3226a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
32274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
322804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
32294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
32304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
32314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
32324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $age in
3233a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	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]) ;;
32344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*)
3235a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
32364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
323704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
32384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
32394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
32404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
32414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$age" -gt "$current"; then
32424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
32434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
324404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
32454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
32464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
32474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Calculate the version variables.
32484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	major=
32494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	versuffix=
32504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	verstring=
32514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $version_type in
32524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	none) ;;
32534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
32544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	darwin)
32554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Like Linux, but with the current version available in
32564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # verstring for coding it into the library header
32574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  major=.`expr $current - $age`
32584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  versuffix="$major.$age.$revision"
32594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Darwin ld doesn't like 0 for these options...
32604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  minor_current=`expr $current + 1`
326104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
32624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
32634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
32644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	freebsd-aout)
32654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  major=".$current"
32664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  versuffix=".$current.$revision";
32674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
32684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
32694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	freebsd-elf)
32704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  major=".$current"
32714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  versuffix=".$current";
32724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
32734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
32744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	irix | nonstopux)
32754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  major=`expr $current - $age + 1`
32764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
32774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $version_type in
32784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    nonstopux) verstring_prefix=nonstopux ;;
32794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *)         verstring_prefix=sgi ;;
32804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
32814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  verstring="$verstring_prefix$major.$revision"
32824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
32834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Add in all the interfaces that we are compatible with.
32844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  loop=$revision
32854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  while test "$loop" -ne 0; do
32864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    iface=`expr $revision - $loop`
32874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    loop=`expr $loop - 1`
32884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    verstring="$verstring_prefix$major.$iface:$verstring"
32894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
32904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
32914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Before this point, $major must not contain `.'.
32924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  major=.$major
32934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  versuffix="$major.$revision"
32944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
32954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
32964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	linux)
32974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  major=.`expr $current - $age`
32984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  versuffix="$major.$age.$revision"
32994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
33004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
33014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	osf)
33024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  major=.`expr $current - $age`
33034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  versuffix=".$current.$age.$revision"
33044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  verstring="$current.$age.$revision"
33054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
33064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Add in all the interfaces that we are compatible with.
33074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  loop=$age
33084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  while test "$loop" -ne 0; do
33094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    iface=`expr $current - $loop`
33104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    loop=`expr $loop - 1`
33114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    verstring="$verstring:${iface}.0"
33124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
33134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
33144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Make executables depend on our current version.
33154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  verstring="$verstring:${current}.0"
33164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
33174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
33184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	sunos)
33194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  major=".$current"
33204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  versuffix=".$current.$revision"
33214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
33224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
33234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	windows)
33244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Use '-' rather than '.', since we only want one
33254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # extension on DOS 8.3 filesystems.
33264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  major=`expr $current - $age`
33274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  versuffix="-$major"
33284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
33294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
33304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*)
33314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
33324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
333304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
33344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
33354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
33364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
33374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Clear the version info if we defaulted, and they specified a release.
33384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -z "$vinfo" && test -n "$release"; then
33394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  major=
33404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $version_type in
33414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  darwin)
33424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # we can't check for "0.0" in archive_cmds due to quoting
33434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # problems, so we reset it completely
33444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    verstring=
33454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
33464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *)
33474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    verstring="0.0"
33484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
33494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
33504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$need_version" = no; then
33514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    versuffix=
33524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
33534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    versuffix=".0.0"
33544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
33554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
33564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
33574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Remove version info from name if versioning should be avoided
33584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$avoid_version" = yes && test "$need_version" = no; then
33594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  major=
33604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  versuffix=
33614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  verstring=""
33624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
33634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
33644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Check to see if the archive will have undefined symbols.
33654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$allow_undefined" = yes; then
33664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$allow_undefined_flag" = unsupported; then
33674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
33684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    build_libtool_libs=no
33694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    build_old_libs=yes
33704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
33714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
33724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Don't allow undefined symbols.
33734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  allow_undefined_flag="$no_undefined_flag"
33744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
33754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
33764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
33774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$mode" != relink; then
33784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Remove our outputs, but don't remove object files since they
33794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# may have been created when compiling PIC objects.
33804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	removelist=
33814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	tempremovelist=`$echo "$output_objdir/*"`
33824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	for p in $tempremovelist; do
33834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $p in
33844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *.$objext)
33854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	       ;;
33864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
338704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	       if test "X$precious_files_regex" != "X"; then
338804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
338904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	         then
339004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		   continue
339104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		 fi
339204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	       fi
33934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	       removelist="$removelist $p"
33944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	       ;;
33954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *) ;;
33964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
33974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	done
33984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$removelist"; then
33994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $show "${rm}r $removelist"
34004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $run ${rm}r $removelist
34014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
34024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
34034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
34044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Now set the variables for building old libraries.
34054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
34064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	oldlibs="$oldlibs $output_objdir/$libname.$libext"
34074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
34084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Transform .lo files to .o files.
34094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
34104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
34114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
34124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Eliminate all temporary directories.
34134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      for path in $notinst_path; do
3414a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
3415a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
3416a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
34174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      done
34184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
34194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$xrpath"; then
34204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# If the user specified any rpath flags, then add them.
34214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	temp_xrpath=
34224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	for libdir in $xrpath; do
34234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  temp_xrpath="$temp_xrpath -R$libdir"
34244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case "$finalize_rpath " in
34254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *" $libdir "*) ;;
34264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *) finalize_rpath="$finalize_rpath $libdir" ;;
34274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
34284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	done
34294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
34304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  dependency_libs="$temp_xrpath $dependency_libs"
34314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
34324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
34334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
34344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Make sure dlfiles contains only unique files that won't be dlpreopened
34354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      old_dlfiles="$dlfiles"
34364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      dlfiles=
34374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      for lib in $old_dlfiles; do
34384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case " $dlprefiles $dlfiles " in
34394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*" $lib "*) ;;
34404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*) dlfiles="$dlfiles $lib" ;;
34414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
34424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      done
34434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
34444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Make sure dlprefiles contains only unique files
34454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      old_dlprefiles="$dlprefiles"
34464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      dlprefiles=
34474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      for lib in $old_dlprefiles; do
34484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case "$dlprefiles " in
34494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*" $lib "*) ;;
34504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*) dlprefiles="$dlprefiles $lib" ;;
34514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
34524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      done
34534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
34544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$build_libtool_libs" = yes; then
34554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$rpath"; then
34564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $host in
34574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
34584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # these systems don't actually have a c library (as such)!
34594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
34604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *-*-rhapsody* | *-*-darwin1.[012])
34614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Rhapsody C library is in the System framework
34624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    deplibs="$deplibs -framework System"
34634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
34644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *-*-netbsd*)
34654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Don't link with libc until the a.out ld.so is fixed.
34664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
3467b0f6759ab93b42570d71665b13d24ca2c4a5f276Eric Christopher	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly* | *-*-bitrig*)
34684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Do not include libc due to us having libc/libc_r.
3469a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    ;;
3470a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *-*-sco3.2v5* | *-*-sco5v6*)
3471a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    # Causes problems with __ctype
3472a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    ;;
3473a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
3474a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    # Compiler inserts libc in the correct place for threads to work
34754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
34764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell 	  *)
34774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Add libc to deplibs on all other systems if necessary.
34784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$build_libtool_need_lc" = "yes"; then
34794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      deplibs="$deplibs -lc"
34804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
34814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
34824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
34834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
34844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
34854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Transform deplibs into only deplibs that can be linked in shared.
34864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	name_save=$name
34874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	libname_save=$libname
34884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	release_save=$release
34894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	versuffix_save=$versuffix
34904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	major_save=$major
34914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# I'm not sure if I'm treating the release correctly.  I think
34924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# release should show up in the -l (ie -lgmp5) so we don't want to
34934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# add it in twice.  Is that correct?
34944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	release=""
34954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	versuffix=""
34964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	major=""
34974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	newdeplibs=
34984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	droppeddeps=no
34994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $deplibs_check_method in
35004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	pass_all)
35014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Don't check for shared/static.  Everything works.
35024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # This might be a little naive.  We might want to check
35034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # whether the library exists or not.  But this is on
35044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # osf3 & osf4 and I'm not really sure... Just
35054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # implementing what was already the behavior.
35064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  newdeplibs=$deplibs
35074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
35084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	test_compile)
35094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # This code stresses the "libraries are programs" paradigm to its
35104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # limits. Maybe even breaks it.  We compile a program, linking it
35114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # against the deplibs as a proxy for the library.  Then we can check
35124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # whether they linked in statically or dynamically with ldd.
35134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $rm conftest.c
35144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  cat > conftest.c <<EOF
35154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  int main() { return 0; }
35164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellEOF
35174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $rm conftest
3518a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
35194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$?" -eq 0 ; then
35204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ldd_output=`ldd conftest`
35214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    for i in $deplibs; do
3522a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      name=`expr $i : '-l\(.*\)'`
35234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # If $name is empty we are operating on a -L argument.
35244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell              if test "$name" != "" && test "$name" -ne "0"; then
35254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
35264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  case " $predeps $postdeps " in
35274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  *" $i "*)
35284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    newdeplibs="$newdeplibs $i"
35294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    i=""
35304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    ;;
35314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  esac
35324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	        fi
35334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		if test -n "$i" ; then
35344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  libname=`eval \\$echo \"$libname_spec\"`
35354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
35364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  set dummy $deplib_matches
35374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  deplib_match=$2
35384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
35394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    newdeplibs="$newdeplibs $i"
35404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  else
35414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    droppeddeps=yes
35424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    $echo
35434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    $echo "*** Warning: dynamic linker does not accept needed library $i."
35444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    $echo "*** I have the capability to make that library automatically link in when"
35454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    $echo "*** you link to this library.  But I can only do this if you have a"
35464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    $echo "*** shared version of the library, which I believe you do not have"
35474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    $echo "*** because a test_compile did reveal that the linker did not use it for"
35484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
35494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  fi
35504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		fi
35514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      else
35524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		newdeplibs="$newdeplibs $i"
35534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
35544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    done
35554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
35564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Error occurred in the first compile.  Let's try to salvage
35574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # the situation: Compile a separate program for each library.
35584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    for i in $deplibs; do
3559a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      name=`expr $i : '-l\(.*\)'`
35604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # If $name is empty we are operating on a -L argument.
35614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell              if test "$name" != "" && test "$name" != "0"; then
35624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$rm conftest
3563a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		$LTCC $LTCFLAGS -o conftest conftest.c $i
35644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		# Did it work?
35654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		if test "$?" -eq 0 ; then
35664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  ldd_output=`ldd conftest`
35674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
35684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    case " $predeps $postdeps " in
35694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    *" $i "*)
35704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      newdeplibs="$newdeplibs $i"
35714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      i=""
35724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      ;;
35734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    esac
35744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  fi
35754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  if test -n "$i" ; then
35764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    libname=`eval \\$echo \"$libname_spec\"`
35774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
35784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    set dummy $deplib_matches
35794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    deplib_match=$2
35804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
35814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      newdeplibs="$newdeplibs $i"
35824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    else
35834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      droppeddeps=yes
35844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      $echo
35854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      $echo "*** Warning: dynamic linker does not accept needed library $i."
35864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      $echo "*** I have the capability to make that library automatically link in when"
35874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      $echo "*** you link to this library.  But I can only do this if you have a"
35884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      $echo "*** shared version of the library, which you do not appear to have"
35894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      $echo "*** because a test_compile did reveal that the linker did not use this one"
35904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
35914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    fi
35924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  fi
35934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		else
35944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  droppeddeps=yes
35954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  $echo
35964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
35974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  $echo "***  make it link in!  You will probably need to install it or some"
35984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  $echo "*** library that it depends on before this library will be fully"
35994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  $echo "*** functional.  Installing it before continuing would be even better."
36004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		fi
36014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      else
36024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		newdeplibs="$newdeplibs $i"
36034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
36044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    done
36054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
36064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
36074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	file_magic*)
36084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  set dummy $deplibs_check_method
36094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
36104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for a_deplib in $deplibs; do
3611a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    name=`expr $a_deplib : '-l\(.*\)'`
36124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # If $name is empty we are operating on a -L argument.
36134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell            if test "$name" != "" && test  "$name" != "0"; then
36144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
36154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		case " $predeps $postdeps " in
36164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		*" $a_deplib "*)
36174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  newdeplibs="$newdeplibs $a_deplib"
36184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  a_deplib=""
36194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  ;;
36204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		esac
36214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
36224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test -n "$a_deplib" ; then
36234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		libname=`eval \\$echo \"$libname_spec\"`
36244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
36254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
36264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  for potent_lib in $potential_libs; do
36274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      # Follow soft links.
36284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      if ls -lLd "$potent_lib" 2>/dev/null \
36294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell			 | grep " -> " >/dev/null; then
36304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell			continue
36314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      fi
36324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      # The statement above tries to avoid entering an
36334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      # endless loop below, in case of cyclic links.
36344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      # We might still enter an endless loop, since a link
36354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      # loop can be closed while we follow links,
36364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      # but so what?
36374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      potlib="$potent_lib"
36384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      while test -h "$potlib" 2>/dev/null; do
36394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
36404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell			case $potliblink in
36414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
36424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
36434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell			esac
36444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      done
36454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
36464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell			 | ${SED} 10q \
36474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell			 | $EGREP "$file_magic_regex" > /dev/null; then
36484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell			newdeplibs="$newdeplibs $a_deplib"
36494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell			a_deplib=""
36504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell			break 2
36514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      fi
36524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  done
36534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		done
36544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
36554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test -n "$a_deplib" ; then
36564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		droppeddeps=yes
36574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo
36584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo "*** Warning: linker path does not have real file for library $a_deplib."
36594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo "*** I have the capability to make that library automatically link in when"
36604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo "*** you link to this library.  But I can only do this if you have a"
36614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo "*** shared version of the library, which you do not appear to have"
36624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo "*** because I did check the linker path looking for a file starting"
36634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		if test -z "$potlib" ; then
36644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
36654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		else
36664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  $echo "*** with $libname and none of the candidates passed a file format test"
36674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  $echo "*** using a file magic. Last file checked: $potlib"
36684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		fi
36694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
36704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
36714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # Add a -L argument.
36724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      newdeplibs="$newdeplibs $a_deplib"
36734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
36744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done # Gone through all deplibs.
36754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
36764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	match_pattern*)
36774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  set dummy $deplibs_check_method
36784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
36794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for a_deplib in $deplibs; do
3680a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    name=`expr $a_deplib : '-l\(.*\)'`
36814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # If $name is empty we are operating on a -L argument.
36824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -n "$name" && test "$name" != "0"; then
36834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
36844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		case " $predeps $postdeps " in
36854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		*" $a_deplib "*)
36864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  newdeplibs="$newdeplibs $a_deplib"
36874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  a_deplib=""
36884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  ;;
36894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		esac
36904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
36914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test -n "$a_deplib" ; then
36924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		libname=`eval \\$echo \"$libname_spec\"`
36934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
36944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
36954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  for potent_lib in $potential_libs; do
36964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    potlib="$potent_lib" # see symlink-check above in file_magic test
36974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    if eval $echo \"$potent_lib\" 2>/dev/null \
36984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		        | ${SED} 10q \
36994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		        | $EGREP "$match_pattern_regex" > /dev/null; then
37004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      newdeplibs="$newdeplibs $a_deplib"
37014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      a_deplib=""
37024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		      break 2
37034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    fi
37044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  done
37054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		done
37064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
37074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test -n "$a_deplib" ; then
37084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		droppeddeps=yes
37094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo
37104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo "*** Warning: linker path does not have real file for library $a_deplib."
37114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo "*** I have the capability to make that library automatically link in when"
37124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo "*** you link to this library.  But I can only do this if you have a"
37134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo "*** shared version of the library, which you do not appear to have"
37144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo "*** because I did check the linker path looking for a file starting"
37154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		if test -z "$potlib" ; then
37164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
37174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		else
37184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  $echo "*** with $libname and none of the candidates passed a file format test"
37194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  $echo "*** using a regex pattern. Last file checked: $potlib"
37204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		fi
37214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
37224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
37234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # Add a -L argument.
37244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      newdeplibs="$newdeplibs $a_deplib"
37254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
37264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done # Gone through all deplibs.
37274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
37284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	none | unknown | *)
37294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  newdeplibs=""
37304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
37314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    -e 's/ -[LR][^ ]*//g'`
37324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
37334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    for i in $predeps $postdeps ; do
37344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # can't use Xsed below, because $i might contain '/'
37354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
37364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    done
37374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
37384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
37394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    | grep . >/dev/null; then
37404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo
37414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "X$deplibs_check_method" = "Xnone"; then
37424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
37434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
37444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** Warning: inter-library dependencies are not known to be supported."
37454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
37464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "*** All declared inter-library dependencies are being dropped."
37474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    droppeddeps=yes
37484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
37494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
37504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
37514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	versuffix=$versuffix_save
37524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	major=$major_save
37534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	release=$release_save
37544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	libname=$libname_save
37554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	name=$name_save
37564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
37574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $host in
37584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*-*-rhapsody* | *-*-darwin1.[012])
37594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # On Rhapsody replace the C library is the System framework
37604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
37614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
37624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
37634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
37644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$droppeddeps" = yes; then
37654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$module" = yes; then
37664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo
37674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
37684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
37694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "*** a static module, that should work as long as the dlopening"
37704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "*** application is linked with the -dlopen flag."
37714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -z "$global_symbol_pipe"; then
37724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo
37734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** However, this would only work if libtool was able to extract symbol"
37744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
37754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** not find such a program.  So, this module is probably useless."
37764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
37774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
37784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$build_old_libs" = no; then
37794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      oldlibs="$output_objdir/$libname.$libext"
37804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      build_libtool_libs=module
37814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      build_old_libs=yes
37824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
37834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      build_libtool_libs=no
37844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
37854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
37864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "*** The inter-library dependencies that have been dropped here will be"
37874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "*** automatically added whenever a program is linked with this library"
37884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "*** or is declared to -dlopen it."
37894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
37904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$allow_undefined" = no; then
37914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo
37924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** Since this library must not contain undefined symbols,"
37934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** because either the platform does not support them or"
37944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** it was explicitly requested with -no-undefined,"
37954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "*** libtool will only create a static version of it."
37964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test "$build_old_libs" = no; then
37974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		oldlibs="$output_objdir/$libname.$libext"
37984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		build_libtool_libs=module
37994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		build_old_libs=yes
38004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      else
38014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		build_libtool_libs=no
38024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
38034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
38044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
38054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
38064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Done checking deplibs!
38074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	deplibs=$newdeplibs
38084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
38094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
3810a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
3811a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # move library search paths that coincide with paths to not yet
3812a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # installed libraries to the beginning of the library search list
3813a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      new_libs=
3814a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      for path in $notinst_path; do
3815a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	case " $new_libs " in
3816a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	*" -L$path/$objdir "*) ;;
3817a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	*)
3818a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  case " $deplibs " in
3819a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *" -L$path/$objdir "*)
3820a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    new_libs="$new_libs -L$path/$objdir" ;;
3821a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  esac
3822a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  ;;
3823a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	esac
3824a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      done
3825a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      for deplib in $deplibs; do
3826a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	case $deplib in
3827a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	-L*)
3828a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  case " $new_libs " in
3829a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *" $deplib "*) ;;
3830a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *) new_libs="$new_libs $deplib" ;;
3831a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  esac
3832a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  ;;
3833a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	*) new_libs="$new_libs $deplib" ;;
3834a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	esac
3835a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      done
3836a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      deplibs="$new_libs"
3837a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
3838a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
38394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # All the library-specific variables (install_libdir is set above).
38404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      library_names=
38414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      old_library=
38424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      dlname=
38434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
38444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Test again, we may have decided not to build it any more
38454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$build_libtool_libs" = yes; then
38464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$hardcode_into_libs" = yes; then
38474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Hardcode the library paths
38484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  hardcode_libdirs=
38494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  dep_rpath=
38504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  rpath="$finalize_rpath"
38514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  test "$mode" != relink && rpath="$compile_rpath$rpath"
38524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for libdir in $rpath; do
38534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -n "$hardcode_libdir_flag_spec"; then
38544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test -n "$hardcode_libdir_separator"; then
38554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		if test -z "$hardcode_libdirs"; then
38564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  hardcode_libdirs="$libdir"
38574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		else
38584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  # Just accumulate the unique libdirs.
38594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
38604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
38614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    ;;
38624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  *)
38634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
38644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    ;;
38654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  esac
38664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		fi
38674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      else
38684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		eval flag=\"$hardcode_libdir_flag_spec\"
38694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		dep_rpath="$dep_rpath $flag"
38704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
38714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    elif test -n "$runpath_var"; then
38724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case "$perm_rpath " in
38734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *" $libdir "*) ;;
38744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *) perm_rpath="$perm_rpath $libdir" ;;
38754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
38764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
38774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
38784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Substitute the hardcoded libdirs into the rpath.
38794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -n "$hardcode_libdir_separator" &&
38804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	     test -n "$hardcode_libdirs"; then
38814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    libdir="$hardcode_libdirs"
38824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -n "$hardcode_libdir_flag_spec_ld"; then
38834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
38844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
38854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
38864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
38874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
38884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
38894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # We should set the runpath_var.
38904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    rpath=
38914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    for dir in $perm_rpath; do
38924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      rpath="$rpath$dir:"
38934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    done
38944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
38954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
38964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
38974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
38984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
38994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	shlibpath="$finalize_shlibpath"
39004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
39014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$shlibpath"; then
39024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
39034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
39044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
39054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Get the real and link names of the library.
390604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	eval shared_ext=\"$shrext_cmds\"
39074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	eval library_names=\"$library_names_spec\"
39084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	set dummy $library_names
39094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	realname="$2"
39104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	shift; shift
39114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
39124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$soname_spec"; then
39134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  eval soname=\"$soname_spec\"
39144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
39154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  soname="$realname"
39164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
39174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -z "$dlname"; then
39184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  dlname=$soname
39194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
39204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
39214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	lib="$output_objdir/$realname"
3922a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	linknames=
39234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	for link
39244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	do
39254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  linknames="$linknames $link"
39264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	done
39274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
39284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Use standard objects if they are pic
39294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
39304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
39314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Prepare the list of exported symbols
39324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -z "$export_symbols"; then
39334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
39344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $show "generating symbol list for \`$libname.la'"
39354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    export_symbols="$output_objdir/$libname.exp"
39364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $run $rm $export_symbols
393704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    cmds=$export_symbols_cmds
39384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    save_ifs="$IFS"; IFS='~'
39394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    for cmd in $cmds; do
39404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      IFS="$save_ifs"
394104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      eval cmd=\"$cmd\"
39424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if len=`expr "X$cmd" : ".*"` &&
39434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
39444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	        $show "$cmd"
39454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	        $run eval "$cmd" || exit $?
39464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	        skipped_export=false
39474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      else
39484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	        # The command line is too long to execute in one step.
39494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	        $show "using reloadable object file for export list..."
39504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	        skipped_export=:
3951a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		# Break out early, otherwise skipped_export may be
3952a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		# set to false by a later but shorter cmd.
3953a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		break
39544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
39554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    done
39564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    IFS="$save_ifs"
39574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -n "$export_symbols_regex"; then
39584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
39594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
39604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
39614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
39624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
39634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
39644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
39654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
39664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$export_symbols" && test -n "$include_expsyms"; then
39674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
39684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
39694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
39704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	tmp_deplibs=
39714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	for test_deplib in $deplibs; do
39724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		case " $convenience " in
39734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		*" $test_deplib "*) ;;
397404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		*)
39754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell			tmp_deplibs="$tmp_deplibs $test_deplib"
39764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell			;;
39774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		esac
39784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	done
397904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	deplibs="$tmp_deplibs"
39804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
39814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$convenience"; then
39824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -n "$whole_archive_flag_spec"; then
39834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    save_libobjs=$libobjs
39844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
39854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
39864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    gentop="$output_objdir/${outputname}x"
39874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    generated="$generated $gentop"
39884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
398904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    func_extract_archives $gentop $convenience
399004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    libobjs="$libobjs $func_extract_archives_result"
39914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
39924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
399304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	
39944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
39954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  eval flag=\"$thread_safe_flag_spec\"
39964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  linker_flags="$linker_flags $flag"
39974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
39984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
39994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Make a backup of the uninstalled library when relinking
40004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$mode" = relink; then
40014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
40024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
40034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
40044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Do each of the archive commands.
40054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$module" = yes && test -n "$module_cmds" ; then
40064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
400704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    eval test_cmds=\"$module_expsym_cmds\"
400804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    cmds=$module_expsym_cmds
40094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
401004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    eval test_cmds=\"$module_cmds\"
401104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    cmds=$module_cmds
40124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
40134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
40144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
401504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  eval test_cmds=\"$archive_expsym_cmds\"
401604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  cmds=$archive_expsym_cmds
40174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
401804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  eval test_cmds=\"$archive_cmds\"
401904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  cmds=$archive_cmds
40204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
40214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
40224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4023a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	if test "X$skipped_export" != "X:" &&
4024a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
40254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
40264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  :
40274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
40284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # The command line is too long to link in one step, link piecewise.
40294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "creating reloadable object files..."
40304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
40314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Save the value of $output and $libobjs because we want to
40324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # use them later.  If we have whole_archive_flag_spec, we
40334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # want to use save_libobjs as it was before
40344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # whole_archive_flag_spec was expanded, because we can't
40354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # assume the linker understands whole_archive_flag_spec.
40364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # This may have to be revisited, in case too many
40374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # convenience libraries get linked in and end up exceeding
40384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # the spec.
40394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
40404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    save_libobjs=$libobjs
40414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
40424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  save_output=$output
4043a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
40444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
40454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Clear the reloadable object creation command queue and
40464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # initialize k to one.
40474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  test_cmds=
40484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  concat_cmds=
40494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  objlist=
40504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  delfiles=
40514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  last_robj=
40524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  k=1
4053a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  output=$output_objdir/$output_la-${k}.$objext
40544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Loop over the list of objects to be linked.
40554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for obj in $save_libobjs
40564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  do
40574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
40584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "X$objlist" = X ||
4059a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
40604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		 test "$len" -le "$max_cmd_len"; }; then
40614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      objlist="$objlist $obj"
40624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
40634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # The command $test_cmds is almost too long, add a
40644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # command to the queue.
40654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test "$k" -eq 1 ; then
40664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		# The first file doesn't have a previous command to add.
40674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
40684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      else
40694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		# All subsequent reloadable object files will link in
40704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		# the last one created.
40714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
40724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
4073a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      last_robj=$output_objdir/$output_la-${k}.$objext
40744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      k=`expr $k + 1`
4075a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      output=$output_objdir/$output_la-${k}.$objext
40764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      objlist=$obj
40774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      len=1
40784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
40794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
40804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Handle the remaining objects by creating one last
40814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # reloadable object file.  All subsequent reloadable object
40824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # files will link in the last one created.
40834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
40844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
40854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
40864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if ${skipped_export-false}; then
40874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $show "generating symbol list for \`$libname.la'"
40884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    export_symbols="$output_objdir/$libname.exp"
40894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $run $rm $export_symbols
40904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    libobjs=$output
40914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Append the command to create the export file.
40924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
40934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell          fi
40944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4095a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  # Set up a command to remove the reloadable object files
40964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # after they are used.
40974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  i=0
40984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  while test "$i" -lt "$k"
40994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  do
41004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    i=`expr $i + 1`
4101a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
41024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
41034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
41044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "creating a temporary reloadable object file: $output"
41054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
41064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Loop through the commands generated above and execute them.
41074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  save_ifs="$IFS"; IFS='~'
41084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for cmd in $concat_cmds; do
41094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    IFS="$save_ifs"
41104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $show "$cmd"
41114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $run eval "$cmd" || exit $?
41124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
41134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  IFS="$save_ifs"
41144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
41154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  libobjs=$output
41164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Restore the value of output.
41174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  output=$save_output
41184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
41194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
41204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
41214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
41224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Expand the library linking commands again to reset the
41234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # value of $libobjs for piecewise linking.
41244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
41254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Do each of the archive commands.
412604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  if test "$module" = yes && test -n "$module_cmds" ; then
412704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
412804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      cmds=$module_expsym_cmds
412904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    else
413004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      cmds=$module_cmds
413104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    fi
413204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  else
41334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
413404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    cmds=$archive_expsym_cmds
41354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
413604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    cmds=$archive_cmds
413704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    fi
41384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
41394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
41404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Append the command to remove the reloadable object files
41414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # to the just-reset $cmds.
414204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  eval cmds=\"\$cmds~\$rm $delfiles\"
41434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
41444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	save_ifs="$IFS"; IFS='~'
41454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	for cmd in $cmds; do
41464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  IFS="$save_ifs"
414704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  eval cmd=\"$cmd\"
41484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $show "$cmd"
4149a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  $run eval "$cmd" || {
4150a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    lt_exit=$?
4151a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
4152a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    # Restore the uninstalled library and exit
4153a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    if test "$mode" = relink; then
4154a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
4155a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    fi
4156a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
4157a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    exit $lt_exit
4158a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  }
41594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	done
41604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	IFS="$save_ifs"
41614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
41624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Restore the uninstalled library and exit
41634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$mode" = relink; then
41644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
4165a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
4166a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  if test -n "$convenience"; then
4167a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    if test -z "$whole_archive_flag_spec"; then
4168a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      $show "${rm}r $gentop"
4169a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      $run ${rm}r "$gentop"
4170a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    fi
4171a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  fi
4172a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
417304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_SUCCESS
41744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
41754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
41764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Create links to the real library.
41774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	for linkname in $linknames; do
41784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$realname" != "$linkname"; then
41794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
41804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
41814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
41824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	done
41834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
41844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# If -module or -export-dynamic was specified, set the dlname.
41854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$module" = yes || test "$export_dynamic" = yes; then
41864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # On all known operating systems, these are identical.
41874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  dlname="$soname"
41884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
41894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
41904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
41914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
41924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    obj)
41934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$deplibs"; then
41944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
41954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
41964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
41974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
41984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
41994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
42004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
42014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$rpath"; then
42024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
42034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
42044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
42054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$xrpath"; then
42064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
42074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
42084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
42094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$vinfo"; then
42104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
42114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
42124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
42134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$release"; then
42144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
42154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
42164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
42174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case $output in
42184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *.lo)
42194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$objs$old_deplibs"; then
42204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
422104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
42224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
42234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	libobj="$output"
42244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
42254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
42264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *)
42274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	libobj=
42284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	obj="$output"
42294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
42304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
42314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
42324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Delete the old objects.
42334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $run $rm $obj $libobj
42344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
42354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Objects from convenience libraries.  This assumes
42364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # single-version convenience libraries.  Whenever we create
42374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # different ones for PIC/non-PIC, this we'll have to duplicate
42384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # the extraction.
42394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      reload_conv_objs=
42404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      gentop=
42414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # reload_cmds runs $LD directly, so let us get rid of
42424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # -Wl from whole_archive_flag_spec
42434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      wl=
42444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
42454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$convenience"; then
42464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$whole_archive_flag_spec"; then
42474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
42484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
42494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  gentop="$output_objdir/${obj}x"
42504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  generated="$generated $gentop"
42514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
425204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  func_extract_archives $gentop $convenience
425304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  reload_conv_objs="$reload_objs $func_extract_archives_result"
42544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
42554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
42564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
42574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Create the old-style object.
42584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      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
42594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
42604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      output="$obj"
426104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      cmds=$reload_cmds
42624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      save_ifs="$IFS"; IFS='~'
42634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      for cmd in $cmds; do
42644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	IFS="$save_ifs"
426504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	eval cmd=\"$cmd\"
42664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$show "$cmd"
42674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$run eval "$cmd" || exit $?
42684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      done
42694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      IFS="$save_ifs"
42704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
42714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Exit if we aren't doing a library object file.
42724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -z "$libobj"; then
42734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$gentop"; then
42744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $show "${rm}r $gentop"
42754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $run ${rm}r $gentop
42764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
42774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
427804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	exit $EXIT_SUCCESS
42794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
42804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
42814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$build_libtool_libs" != yes; then
42824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$gentop"; then
42834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $show "${rm}r $gentop"
42844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $run ${rm}r $gentop
42854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
42864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
42874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Create an invalid libtool object if no PIC, so that we don't
42884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# accidentally link it into a program.
42894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# $show "echo timestamp > $libobj"
42904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# $run eval "echo timestamp > $libobj" || exit $?
429104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	exit $EXIT_SUCCESS
42924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
42934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
42944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$pic_flag" || test "$pic_mode" != default; then
42954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Only do commands if we really have different PIC objects.
42964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	reload_objs="$libobjs $reload_conv_objs"
42974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	output="$libobj"
429804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	cmds=$reload_cmds
42994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	save_ifs="$IFS"; IFS='~'
43004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	for cmd in $cmds; do
43014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  IFS="$save_ifs"
430204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  eval cmd=\"$cmd\"
43034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $show "$cmd"
43044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $run eval "$cmd" || exit $?
43054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	done
43064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	IFS="$save_ifs"
43074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
43084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
43094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$gentop"; then
43104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$show "${rm}r $gentop"
43114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$run ${rm}r $gentop
43124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
43134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
431404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      exit $EXIT_SUCCESS
43154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
43164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
43174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    prog)
43184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case $host in
43194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
43204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
43214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$vinfo"; then
43224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
43234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
43244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
43254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$release"; then
43264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
43274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
43284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
43294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$preload" = yes; then
43304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
43314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	   test "$dlopen_self_static" = unknown; then
43324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
43334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
43344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
43354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
43364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case $host in
43374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *-*-rhapsody* | *-*-darwin1.[012])
43384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# On Rhapsody replace the C library is the System framework
43394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
43404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
43414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
43424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
43434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
43444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case $host in
43454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *darwin*)
43464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell        # Don't allow lazy linking, it breaks C++ global constructors
43474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell        if test "$tagname" = CXX ; then
43484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell        compile_command="$compile_command ${wl}-bind_at_load"
43494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell        finalize_command="$finalize_command ${wl}-bind_at_load"
43504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell        fi
43514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell        ;;
43524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
43534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4354a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
4355a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # move library search paths that coincide with paths to not yet
4356a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      # installed libraries to the beginning of the library search list
4357a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      new_libs=
4358a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      for path in $notinst_path; do
4359a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	case " $new_libs " in
4360a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	*" -L$path/$objdir "*) ;;
4361a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	*)
4362a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  case " $compile_deplibs " in
4363a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *" -L$path/$objdir "*)
4364a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    new_libs="$new_libs -L$path/$objdir" ;;
4365a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  esac
4366a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  ;;
4367a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	esac
4368a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      done
4369a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      for deplib in $compile_deplibs; do
4370a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	case $deplib in
4371a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	-L*)
4372a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  case " $new_libs " in
4373a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *" $deplib "*) ;;
4374a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *) new_libs="$new_libs $deplib" ;;
4375a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  esac
4376a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  ;;
4377a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	*) new_libs="$new_libs $deplib" ;;
4378a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	esac
4379a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      done
4380a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      compile_deplibs="$new_libs"
4381a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
4382a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
43834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      compile_command="$compile_command $compile_deplibs"
43844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      finalize_command="$finalize_command $finalize_deplibs"
43854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
43864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$rpath$xrpath"; then
43874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# If the user specified any rpath flags, then add them.
43884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	for libdir in $rpath $xrpath; do
43894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # This is the magic to use -rpath.
43904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case "$finalize_rpath " in
43914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *" $libdir "*) ;;
43924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *) finalize_rpath="$finalize_rpath $libdir" ;;
43934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
43944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	done
43954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
43964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
43974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Now hardcode the library paths
43984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      rpath=
43994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      hardcode_libdirs=
44004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      for libdir in $compile_rpath $finalize_rpath; do
44014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$hardcode_libdir_flag_spec"; then
44024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -n "$hardcode_libdir_separator"; then
44034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -z "$hardcode_libdirs"; then
44044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      hardcode_libdirs="$libdir"
44054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
44064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # Just accumulate the unique libdirs.
44074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
44084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
44094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		;;
44104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *)
44114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
44124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		;;
44134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
44144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
44154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
44164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    eval flag=\"$hardcode_libdir_flag_spec\"
44174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    rpath="$rpath $flag"
44184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
44194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	elif test -n "$runpath_var"; then
44204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case "$perm_rpath " in
44214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *" $libdir "*) ;;
44224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *) perm_rpath="$perm_rpath $libdir" ;;
44234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
44244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
44254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $host in
44264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
4427a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
44284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case :$dllsearchpath: in
44294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *":$libdir:"*) ;;
44304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *) dllsearchpath="$dllsearchpath:$libdir";;
44314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
4432a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  case :$dllsearchpath: in
4433a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *":$testbindir:"*) ;;
4434a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *) dllsearchpath="$dllsearchpath:$testbindir";;
4435a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  esac
44364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
44374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
44384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      done
44394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Substitute the hardcoded libdirs into the rpath.
44404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$hardcode_libdir_separator" &&
44414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	 test -n "$hardcode_libdirs"; then
44424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	libdir="$hardcode_libdirs"
44434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	eval rpath=\" $hardcode_libdir_flag_spec\"
44444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
44454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      compile_rpath="$rpath"
44464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
44474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      rpath=
44484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      hardcode_libdirs=
44494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      for libdir in $finalize_rpath; do
44504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$hardcode_libdir_flag_spec"; then
44514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -n "$hardcode_libdir_separator"; then
44524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -z "$hardcode_libdirs"; then
44534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      hardcode_libdirs="$libdir"
44544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
44554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # Just accumulate the unique libdirs.
44564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
44574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
44584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		;;
44594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *)
44604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
44614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		;;
44624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
44634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
44644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
44654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    eval flag=\"$hardcode_libdir_flag_spec\"
44664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    rpath="$rpath $flag"
44674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
44684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	elif test -n "$runpath_var"; then
44694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case "$finalize_perm_rpath " in
44704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *" $libdir "*) ;;
44714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
44724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
44734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
44744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      done
44754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Substitute the hardcoded libdirs into the rpath.
44764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$hardcode_libdir_separator" &&
44774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	 test -n "$hardcode_libdirs"; then
44784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	libdir="$hardcode_libdirs"
44794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	eval rpath=\" $hardcode_libdir_flag_spec\"
44804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
44814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      finalize_rpath="$rpath"
44824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
44834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$libobjs" && test "$build_old_libs" = yes; then
44844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Transform all the library objects into standard objects.
44854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
44864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
44874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
44884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
44894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      dlsyms=
44904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
44914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$NM" && test -n "$global_symbol_pipe"; then
44924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  dlsyms="${outputname}S.c"
44934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
44944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
44954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
44964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
44974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
44984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$dlsyms"; then
44994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $dlsyms in
45004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	"") ;;
45014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*.c)
45024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Discover the nlist of each of the dlfiles.
45034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  nlist="$output_objdir/${outputname}.nm"
45044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
45054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $show "$rm $nlist ${nlist}S ${nlist}T"
45064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
45074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
45084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Parse the name list into a source file.
45094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $show "creating $output_objdir/$dlsyms"
45104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
45114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
45124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
45134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
45144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
45154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#ifdef __cplusplus
45164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellextern \"C\" {
45174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#endif
45184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
45194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell/* Prevent the only kind of declaration conflicts we can make. */
45204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#define lt_preloaded_symbols some_other_symbol
45214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
45224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell/* External symbol declarations for the compiler. */\
45234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"
45244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
45254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$dlself" = yes; then
45264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $show "generating symbol list for \`$output'"
45274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
45284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
45294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
45304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Add our own program objects to the symbol list.
45314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
45324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    for arg in $progfiles; do
45334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $show "extracting global C symbols from \`$arg'"
45344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
45354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    done
45364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
45374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -n "$exclude_expsyms"; then
45384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
45394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $run eval '$mv "$nlist"T "$nlist"'
45404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
45414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
45424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -n "$export_symbols_regex"; then
45434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
45444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $run eval '$mv "$nlist"T "$nlist"'
45454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
45464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
45474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Prepare the list of exported symbols
45484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -z "$export_symbols"; then
4549e32beb78d5780fc05ff4e104f49e05c3d6c41f40Reid Spencer	      export_symbols="$output_objdir/$outputname.exp"
45504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $run $rm $export_symbols
4551a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
4552a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer              case $host in
4553a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer              *cygwin* | *mingw* )
4554a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4555a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
4556a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer                ;;
4557a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer              esac
45584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
4559a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
4560e32beb78d5780fc05ff4e104f49e05c3d6c41f40Reid Spencer	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
45614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $run eval 'mv "$nlist"T "$nlist"'
4562a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer              case $host in
4563a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer              *cygwin* | *mingw* )
4564a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
4565a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
4566a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer                ;;
4567a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer              esac
45684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
45694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
45704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
45714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for arg in $dlprefiles; do
45724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $show "extracting global C symbols from \`$arg'"
45734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
45744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $run eval '$echo ": $name " >> "$nlist"'
45754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
45764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
45774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
45784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -z "$run"; then
45794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Make sure we have at least an empty file.
45804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    test -f "$nlist" || : > "$nlist"
45814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
45824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -n "$exclude_expsyms"; then
45834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
45844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $mv "$nlist"T "$nlist"
45854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
45864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
45874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Try sorting and uniquifying the output.
45884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if grep -v "^: " < "$nlist" |
45894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		if sort -k 3 </dev/null >/dev/null 2>&1; then
45904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  sort -k 3
45914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		else
45924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  sort +2
45934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		fi |
45944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		uniq > "$nlist"S; then
45954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      :
45964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
45974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      grep -v "^: " < "$nlist" > "$nlist"S
45984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
45994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
46004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -f "$nlist"S; then
46014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
46024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
46034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
46044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
46054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
46064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo >> "$output_objdir/$dlsyms" "\
46074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
46084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#undef lt_preloaded_symbols
46094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
46104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#if defined (__STDC__) && __STDC__
46114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# define lt_ptr void *
46124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#else
46134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# define lt_ptr char *
46144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# define const
46154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#endif
46164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
46174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell/* The mapping between symbol names and symbols. */
4618a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer"
4619a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
4620a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    case $host in
4621a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    *cygwin* | *mingw* )
4622a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  $echo >> "$output_objdir/$dlsyms" "\
4623a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer/* DATA imports from DLLs on WIN32 can't be const, because
4624a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer   runtime relocations are performed -- see ld's documentation
4625a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer   on pseudo-relocs */
4626a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerstruct {
4627a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer"
4628a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      ;;
4629a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    * )
4630a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  $echo >> "$output_objdir/$dlsyms" "\
46314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellconst struct {
4632a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer"
4633a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      ;;
4634a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    esac
4635a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
4636a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
4637a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  $echo >> "$output_objdir/$dlsyms" "\
46384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  const char *name;
46394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  lt_ptr address;
46404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell}
46414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelllt_preloaded_symbols[] =
46424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell{\
46434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"
46444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
46454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
46464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
46474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo >> "$output_objdir/$dlsyms" "\
46484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  {0, (lt_ptr) 0}
46494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell};
46504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
46514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell/* This works around a problem in FreeBSD linker */
46524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#ifdef FREEBSD_WORKAROUND
46534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellstatic const void *lt_preloaded_setup() {
46544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  return lt_preloaded_symbols;
46554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell}
46564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#endif
46574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
46584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#ifdef __cplusplus
46594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell}
46604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#endif\
46614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"
46624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
46634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
46644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  pic_flag_for_symtable=
46654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $host in
46664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # compiling the symbol table file with pic_flag works around
46674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # a FreeBSD bug that causes programs to crash when -lm is
46684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # linked before any other PIC object.  But we must not use
46694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # pic_flag when linking with -static.  The problem exists in
46704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
4671360fa9a29d65b6c9b69fb2ba9712d69098cfca13Eric Christopher	  *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
46724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    case "$compile_command " in
46734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *" -static "*) ;;
46744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
46754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    esac;;
46764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *-*-hpux*)
46774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    case "$compile_command " in
46784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *" -static "*) ;;
46794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *) pic_flag_for_symtable=" $pic_flag";;
46804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    esac
46814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
46824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
46834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Now compile the dynamic symbol file.
4684a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
4685a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
46864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
46874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Clean up the generated files.
46884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
46894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
46904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
46914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Transform the symbol file into the correct name.
4692a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          case $host in
4693a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          *cygwin* | *mingw* )
4694a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer            if test -f "$output_objdir/${outputname}.def" ; then
4695a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4696a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
4697a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer            else
4698a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4699a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4700a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer             fi
4701a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer            ;;
4702a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          * )
4703a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4704a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
4705a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer            ;;
4706a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          esac
47074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
47084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*)
47094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
471004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
47114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
47124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
47134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      else
47144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# We keep going just in case the user didn't refer to
47154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
47164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# really was required.
47174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
47184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Nullify the symbol file.
47194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
47204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
47214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
47224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
47234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
47244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Replace the output file specification.
47254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
47264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	link_command="$compile_command$compile_rpath"
47274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
47284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# We have no uninstalled library dependencies, so finalize right now.
47294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$show "$link_command"
47304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$run eval "$link_command"
4731a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	exit_status=$?
47324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
47334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Delete the generated files.
47344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$dlsyms"; then
47354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $show "$rm $output_objdir/${outputname}S.${objext}"
47364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $run $rm "$output_objdir/${outputname}S.${objext}"
47374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
47384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4739a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	exit $exit_status
47404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
47414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
47424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$shlibpath_var"; then
47434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# We should set the shlibpath_var
47444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	rpath=
47454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	for dir in $temp_rpath; do
47464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $dir in
47474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  [\\/]* | [A-Za-z]:[\\/]*)
47484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Absolute path.
47494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    rpath="$rpath$dir:"
47504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
47514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *)
47524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Relative path: add a thisdir entry.
47534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    rpath="$rpath\$thisdir/$dir:"
47544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
47554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
47564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	done
47574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	temp_rpath="$rpath"
47584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
47594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
47604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$compile_shlibpath$finalize_shlibpath"; then
47614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
47624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
47634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$finalize_shlibpath"; then
47644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
47654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
47664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
47674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      compile_var=
47684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      finalize_var=
47694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$runpath_var"; then
47704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$perm_rpath"; then
47714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # We should set the runpath_var.
47724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  rpath=
47734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for dir in $perm_rpath; do
47744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    rpath="$rpath$dir:"
47754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
47764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
47774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
47784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$finalize_perm_rpath"; then
47794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # We should set the runpath_var.
47804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  rpath=
47814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for dir in $finalize_perm_rpath; do
47824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    rpath="$rpath$dir:"
47834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
47844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
47854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
47864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
47874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
47884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$no_install" = yes; then
47894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# We don't need to create a wrapper script.
47904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	link_command="$compile_var$compile_command$compile_rpath"
47914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Replace the output file specification.
47924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
47934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Delete the old output file.
47944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$run $rm $output
47954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Link the executable and exit
47964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$show "$link_command"
47974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$run eval "$link_command" || exit $?
479804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	exit $EXIT_SUCCESS
47994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
48004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
48014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$hardcode_action" = relink; then
48024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Fast installation is not supported
48034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	link_command="$compile_var$compile_command$compile_rpath"
48044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	relink_command="$finalize_var$finalize_command$finalize_rpath"
48054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
48064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
48074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: \`$output' will be relinked during installation" 1>&2
48084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      else
48094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$fast_install" != no; then
48104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  link_command="$finalize_var$compile_command$finalize_rpath"
48114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$fast_install" = yes; then
48124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
48134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
48144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # fast_install is set to needless
48154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    relink_command=
48164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
48174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
48184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  link_command="$compile_var$compile_command$compile_rpath"
48194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  relink_command="$finalize_var$finalize_command$finalize_rpath"
48204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
48214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
48224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
48234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Replace the output file specification.
48244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
48254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
48264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Delete the old output files.
48274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
48284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
48294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $show "$link_command"
48304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $run eval "$link_command" || exit $?
48314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
48324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Now create the wrapper script.
48334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $show "creating $output"
48344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
48354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Quote the relink command for shipping.
48364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$relink_command"; then
48374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Preserve any variables that may affect compiler behavior
48384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	for var in $variables_saved_for_relink; do
48394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if eval test -z \"\${$var+set}\"; then
48404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
48414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  elif eval var_value=\$$var; test -z "$var_value"; then
48424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    relink_command="$var=; export $var; $relink_command"
48434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
48444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
48454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
48464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
48474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	done
48484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	relink_command="(cd `pwd`; $relink_command)"
48494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
48504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
48514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
48524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Quote $echo for shipping.
485304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
485404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	case $progpath in
485504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
485604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
48574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
48584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
48594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      else
48604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
48614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
48624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
48634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Only actually do things if our run command is non-null.
48644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -z "$run"; then
48654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# win32 will think the script is a binary if it has
48664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# a .exe suffix, so we strip it off here.
48674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $output in
48684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
48694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
48704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# test for cygwin because mv fails w/o .exe extensions
48714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $host in
48724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *cygwin*)
48734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    exeext=.exe
48744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
48754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *) exeext= ;;
48764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
48774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $host in
48784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *cygwin* | *mingw* )
4879a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer            output_name=`basename $output`
4880a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer            output_path=`dirname $output`
4881a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer            cwrappersource="$output_path/$objdir/lt-$output_name.c"
4882a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer            cwrapper="$output_path/$output_name.exe"
4883a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer            $rm $cwrappersource $cwrapper
4884a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
48854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
48864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    cat > $cwrappersource <<EOF
48874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
48884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
48894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
48904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
48914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell   The $output program cannot be directly executed until all the libtool
48924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell   libraries that it depends on are installed.
489304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
48944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell   This wrapper executable should never be moved out of the build directory.
48954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell   If it is, it will not operate correctly.
48964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
48974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell   Currently, it simply execs the wrapper *script* "/bin/sh $output",
48984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell   but could eventually absorb all of the scripts functionality and
48994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell   exec $objdir/$outputname directly.
49004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell*/
49014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellEOF
49024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    cat >> $cwrappersource<<"EOF"
49034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#include <stdio.h>
49044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#include <stdlib.h>
49054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#include <unistd.h>
49064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#include <malloc.h>
49074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#include <stdarg.h>
49084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#include <assert.h>
4909a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer#include <string.h>
4910a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer#include <ctype.h>
4911a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer#include <sys/stat.h>
49124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
49134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#if defined(PATH_MAX)
49144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# define LT_PATHMAX PATH_MAX
49154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#elif defined(MAXPATHLEN)
49164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# define LT_PATHMAX MAXPATHLEN
49174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#else
49184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# define LT_PATHMAX 1024
49194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#endif
49204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
49214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#ifndef DIR_SEPARATOR
4922a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer# define DIR_SEPARATOR '/'
4923a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer# define PATH_SEPARATOR ':'
49244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#endif
49254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
49264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
49274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  defined (__OS2__)
4928a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer# define HAVE_DOS_BASED_FILE_SYSTEM
4929a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer# ifndef DIR_SEPARATOR_2
4930a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer#  define DIR_SEPARATOR_2 '\\'
4931a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer# endif
4932a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer# ifndef PATH_SEPARATOR_2
4933a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer#  define PATH_SEPARATOR_2 ';'
4934a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer# endif
49354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#endif
49364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
49374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#ifndef DIR_SEPARATOR_2
49384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
49394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#else /* DIR_SEPARATOR_2 */
49404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# define IS_DIR_SEPARATOR(ch) \
49414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
49424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#endif /* DIR_SEPARATOR_2 */
49434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4944a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer#ifndef PATH_SEPARATOR_2
4945a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
4946a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer#else /* PATH_SEPARATOR_2 */
4947a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
4948a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer#endif /* PATH_SEPARATOR_2 */
4949a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
49504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
49514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#define XFREE(stale) do { \
49524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  if (stale) { free ((void *) stale); stale = 0; } \
49534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell} while (0)
49544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4955a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer/* -DDEBUG is fairly common in CFLAGS.  */
4956a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer#undef DEBUG
4957a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer#if defined DEBUGWRAPPER
4958a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
4959a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer#else
4960a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer# define DEBUG(format, ...)
4961a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer#endif
4962a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
49634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellconst char *program_name = NULL;
49644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
49654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellvoid * xmalloc (size_t num);
49664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellchar * xstrdup (const char *string);
4967a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerconst char * base_name (const char *name);
4968a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerchar * find_executable(const char *wrapper);
4969a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerint    check_executable(const char *path);
49704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellchar * strendzap(char *str, const char *pat);
49714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellvoid lt_fatal (const char *message, ...);
49724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
49734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellint
49744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellmain (int argc, char *argv[])
49754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell{
49764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  char **newargz;
49774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  int i;
497804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
4979a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  program_name = (char *) xstrdup (base_name (argv[0]));
4980a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  DEBUG("(main) argv[0]      : %s\n",argv[0]);
4981a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  DEBUG("(main) program_name : %s\n",program_name);
49824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  newargz = XMALLOC(char *, argc+2);
49834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellEOF
49844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4985a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer            cat >> $cwrappersource <<EOF
4986a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  newargz[0] = (char *) xstrdup("$SHELL");
49874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellEOF
49884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
4989a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer            cat >> $cwrappersource <<"EOF"
4990a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  newargz[1] = find_executable(argv[0]);
4991a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  if (newargz[1] == NULL)
4992a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    lt_fatal("Couldn't find %s", argv[0]);
4993a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  DEBUG("(main) found exe at : %s\n",newargz[1]);
49944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  /* we know the script has the same name, without the .exe */
49954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  /* so make sure newargz[1] doesn't end in .exe */
499604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer  strendzap(newargz[1],".exe");
49974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  for (i = 1; i < argc; i++)
49984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    newargz[i+1] = xstrdup(argv[i]);
49994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  newargz[argc+1] = NULL;
5000a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
5001a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  for (i=0; i<argc+1; i++)
5002a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  {
5003a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
5004a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    ;
5005a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  }
5006a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
50074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellEOF
50084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
5009a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer            case $host_os in
5010a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer              mingw*)
5011a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer                cat >> $cwrappersource <<EOF
5012a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  execv("$SHELL",(char const **)newargz);
5013a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid SpencerEOF
5014a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer              ;;
5015a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer              *)
5016a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer                cat >> $cwrappersource <<EOF
50174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  execv("$SHELL",newargz);
50184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellEOF
5019a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer              ;;
5020a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer            esac
50214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
5022a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer            cat >> $cwrappersource <<"EOF"
5023a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  return 127;
50244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell}
50254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
50264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellvoid *
50274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellxmalloc (size_t num)
50284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell{
50294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  void * p = (void *) malloc (num);
50304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  if (!p)
50314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    lt_fatal ("Memory exhausted");
50324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
50334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  return p;
50344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell}
50354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
503604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencerchar *
50374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellxstrdup (const char *string)
50384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell{
50394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
50404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell;
50414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell}
50424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
5043a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerconst char *
5044a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerbase_name (const char *name)
50454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell{
50464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  const char *base;
50474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
50484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
50494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  /* Skip over the disk name in MSDOS pathnames. */
5050a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
50514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    name += 2;
50524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#endif
50534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
50544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  for (base = name; *name; name++)
50554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if (IS_DIR_SEPARATOR (*name))
50564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      base = name + 1;
5057a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  return base;
50584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell}
50594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
5060a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerint
5061a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencercheck_executable(const char * path)
5062a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer{
5063a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  struct stat st;
5064a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
5065a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
5066a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  if ((!path) || (!*path))
5067a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    return 0;
5068a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
5069a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  if ((stat (path, &st) >= 0) &&
5070a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      (
5071a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
5072a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer#if defined (S_IXOTH)
5073a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
5074a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer#endif
5075a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer#if defined (S_IXGRP)
5076a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
5077a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer#endif
5078a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer       ((st.st_mode & S_IXUSR) == S_IXUSR))
5079a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      )
5080a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    return 1;
5081a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  else
5082a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    return 0;
5083a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer}
5084a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
5085a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer/* Searches for the full path of the wrapper.  Returns
5086a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer   newly allocated full path name if found, NULL otherwise */
508704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencerchar *
5088a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerfind_executable (const char* wrapper)
50894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell{
5090a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  int has_slash = 0;
5091a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  const char* p;
5092a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  const char* p_next;
5093a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  /* static buffer for getcwd */
50944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  char tmp[LT_PATHMAX + 1];
5095a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  int tmp_len;
5096a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  char* concat_name;
50974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
5098a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
50994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
5100a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  if ((wrapper == NULL) || (*wrapper == '\0'))
5101a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    return NULL;
5102a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
5103a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  /* Absolute path? */
51044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5105a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
5106a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  {
5107a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    concat_name = xstrdup (wrapper);
5108a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    if (check_executable(concat_name))
5109a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      return concat_name;
5110a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    XFREE(concat_name);
5111a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  }
5112a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  else
5113a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  {
5114a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer#endif
5115a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    if (IS_DIR_SEPARATOR (wrapper[0]))
5116a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    {
5117a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      concat_name = xstrdup (wrapper);
5118a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      if (check_executable(concat_name))
5119a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        return concat_name;
5120a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      XFREE(concat_name);
5121a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    }
5122a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
5123a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  }
51244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#endif
51254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
5126a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  for (p = wrapper; *p; p++)
5127a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    if (*p == '/')
5128a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    {
5129a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      has_slash = 1;
5130a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      break;
5131a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    }
5132a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  if (!has_slash)
5133a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  {
5134a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    /* no slashes; search PATH */
5135a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    const char* path = getenv ("PATH");
5136a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    if (path != NULL)
5137a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    {
5138a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      for (p = path; *p; p = p_next)
5139a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      {
5140a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        const char* q;
5141a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        size_t p_len;
5142a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        for (q = p; *q; q++)
5143a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          if (IS_PATH_SEPARATOR(*q))
5144a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer            break;
5145a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        p_len = q - p;
5146a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        p_next = (*q == '\0' ? q : q + 1);
5147a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        if (p_len == 0)
5148a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        {
5149a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          /* empty path: current directory */
5150a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          if (getcwd (tmp, LT_PATHMAX) == NULL)
5151a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer            lt_fatal ("getcwd failed");
5152a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          tmp_len = strlen(tmp);
5153a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5154a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          memcpy (concat_name, tmp, tmp_len);
5155a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          concat_name[tmp_len] = '/';
5156a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          strcpy (concat_name + tmp_len + 1, wrapper);
5157a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        }
5158a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        else
5159a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        {
5160a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
5161a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          memcpy (concat_name, p, p_len);
5162a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          concat_name[p_len] = '/';
5163a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          strcpy (concat_name + p_len + 1, wrapper);
5164a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        }
5165a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        if (check_executable(concat_name))
5166a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          return concat_name;
5167a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        XFREE(concat_name);
5168a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      }
5169a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    }
5170a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    /* not found in PATH; assume curdir */
5171a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  }
5172a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  /* Relative path | not found in path: prepend cwd */
51734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  if (getcwd (tmp, LT_PATHMAX) == NULL)
51744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    lt_fatal ("getcwd failed");
5175a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  tmp_len = strlen(tmp);
5176a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
5177a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  memcpy (concat_name, tmp, tmp_len);
5178a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  concat_name[tmp_len] = '/';
5179a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  strcpy (concat_name + tmp_len + 1, wrapper);
5180a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
5181a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  if (check_executable(concat_name))
5182a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    return concat_name;
5183a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  XFREE(concat_name);
5184a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer  return NULL;
51854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell}
51864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
51874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellchar *
518804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencerstrendzap(char *str, const char *pat)
51894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell{
51904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  size_t len, patlen;
51914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
51924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  assert(str != NULL);
51934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  assert(pat != NULL);
51944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
51954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  len = strlen(str);
51964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  patlen = strlen(pat);
51974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
51984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  if (patlen <= len)
51994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  {
52004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    str += len - patlen;
52014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if (strcmp(str, pat) == 0)
52024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *str = '\0';
52034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  }
52044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  return str;
52054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell}
52064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
52074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellstatic void
520804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencerlt_error_core (int exit_status, const char * mode,
52094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell          const char * message, va_list ap)
52104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell{
52114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  fprintf (stderr, "%s: %s: ", program_name, mode);
52124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  vfprintf (stderr, message, ap);
52134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  fprintf (stderr, ".\n");
52144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
52154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  if (exit_status >= 0)
52164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    exit (exit_status);
52174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell}
52184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
52194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellvoid
52204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelllt_fatal (const char *message, ...)
52214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell{
52224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  va_list ap;
52234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  va_start (ap, message);
52244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
52254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  va_end (ap);
52264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell}
52274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellEOF
5228a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          # we should really use a build-platform specific compiler
5229a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          # here, but OTOH, the wrappers (shell script and this C one)
5230a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          # are only useful if you want to execute the "real" binary.
5231a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          # Since the "real" binary is built for $host, then this
5232a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          # wrapper might as well be built for $host, too.
5233a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
5234a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer          ;;
5235a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        esac
5236a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        $rm $output
5237a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
52384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
52394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo > $output "\
52404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#! $SHELL
52414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
52424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# $output - temporary wrapper script for $objdir/$outputname
52434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
52444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#
52454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# The $output program cannot be directly executed until all the libtool
52464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# libraries that it depends on are installed.
52474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#
52484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# This wrapper script should never be moved out of the build directory.
52494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# If it is, it will not operate correctly.
52504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
52514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Sed substitution that helps us do robust quoting.  It backslashifies
52524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# metacharacters that are still active within double-quoted strings.
52534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellXsed='${SED} -e 1s/^X//'
52544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellsed_quote_subst='$sed_quote_subst'
52554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
52564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# The HP-UX ksh and POSIX shell print the target directory to stdout
52574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# if CDPATH is set.
525804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
52594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
52604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellrelink_command=\"$relink_command\"
52614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
52624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# This environment variable determines our operation mode.
52634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellif test \"\$libtool_install_magic\" = \"$magic\"; then
52644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # install mode needs the following variable:
52654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  notinst_deplibs='$notinst_deplibs'
52664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellelse
52674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # When we are sourced in execute mode, \$file and \$echo are already set.
52684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  if test \"\$libtool_execute_magic\" != \"$magic\"; then
52694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    echo=\"$qecho\"
52704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    file=\"\$0\"
52714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Make sure echo works.
52724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test \"X\$1\" = X--no-reexec; then
52734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Discard the --no-reexec flag, and continue.
52744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      shift
52754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
52764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Yippee, \$echo works!
52774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      :
52784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    else
52794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Restart under the correct shell, and then maybe \$echo will work.
52804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
52814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
52824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  fi\
52834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"
52844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo >> $output "\
52854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
52864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # Find the directory that this script lives in.
52874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
52884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
52894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
52904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # Follow symbolic links until we get to the real thisdir.
52914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
52924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  while test -n \"\$file\"; do
52934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
52944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
52954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # If there was a directory component, then change thisdir.
52964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test \"x\$destdir\" != \"x\$file\"; then
52974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case \"\$destdir\" in
52984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
52994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *) thisdir=\"\$thisdir/\$destdir\" ;;
53004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
53014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
53024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
53034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
53044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
53054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  done
53064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
53074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # Try to get the absolute directory name.
53084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  absdir=\`cd \"\$thisdir\" && pwd\`
53094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  test -n \"\$absdir\" && thisdir=\"\$absdir\"
53104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"
53114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
53124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$fast_install" = yes; then
53134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo >> $output "\
53144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  program=lt-'$outputname'$exeext
53154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  progdir=\"\$thisdir/$objdir\"
53164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
53174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  if test ! -f \"\$progdir/\$program\" || \\
53184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
53194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
53204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
53214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    file=\"\$\$-\$program\"
53224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
53234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test ! -d \"\$progdir\"; then
53244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $mkdir \"\$progdir\"
53254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    else
53264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $rm \"\$progdir/\$file\"
53274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi"
53284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
53294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo >> $output "\
53304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
53314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # relink executable if necessary
53324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -n \"\$relink_command\"; then
53334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
53344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      else
53354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo \"\$relink_command_output\" >&2
53364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$rm \"\$progdir/\$file\"
533704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	exit $EXIT_FAILURE
53384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
53394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
53404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
53414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
53424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    { $rm \"\$progdir/\$program\";
53434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
53444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $rm \"\$progdir/\$file\"
53454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  fi"
53464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
53474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo >> $output "\
53484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  program='$outputname'
53494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  progdir=\"\$thisdir/$objdir\"
53504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"
53514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
53524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
53534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo >> $output "\
53544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
53554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  if test -f \"\$progdir/\$program\"; then"
53564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
53574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Export our shlibpath_var if we have one.
53584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
53594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo >> $output "\
53604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Add our own library path to $shlibpath_var
53614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
53624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
53634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Some systems cannot cope with colon-terminated $shlibpath_var
53644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # The second colon is a workaround for a bug in BeOS R4 sed
53654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
53664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
53674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    export $shlibpath_var
53684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"
53694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
53704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
53714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# fixup the dll searchpath if we need to.
53724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$dllsearchpath"; then
53734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo >> $output "\
53744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Add the dll search path components to the executable PATH
53754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    PATH=$dllsearchpath:\$PATH
53764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"
53774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
53784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
53794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo >> $output "\
53804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test \"\$libtool_execute_magic\" != \"$magic\"; then
53814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Run the actual program with our arguments.
53824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"
53834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $host in
53844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Backslashes separate directories on plain windows
53854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*-*-mingw | *-*-os2*)
53864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo >> $output "\
5387a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
53884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"
53894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
53904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
53914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*)
53924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo >> $output "\
5393a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      exec \"\$progdir/\$program\" \${1+\"\$@\"}
53944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"
53954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
53964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
53974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo >> $output "\
53984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
539904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      exit $EXIT_FAILURE
54004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
54014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  else
54024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # The program doesn't exist.
5403a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
54044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    \$echo \"This script is just a wrapper for \$program.\" 1>&2
54054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
540604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    exit $EXIT_FAILURE
54074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  fi
54084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellfi\
54094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"
54104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	chmod +x $output
54114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
541204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      exit $EXIT_SUCCESS
54134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
54144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    esac
54154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
54164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # See if we need to build an old-fashioned archive.
54174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    for oldlib in $oldlibs; do
54184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
54194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$build_libtool_libs" = convenience; then
54204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	oldobjs="$libobjs_save"
54214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	addlibs="$convenience"
54224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	build_libtool_libs=no
54234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      else
54244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$build_libtool_libs" = module; then
54254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  oldobjs="$libobjs_save"
54264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  build_libtool_libs=no
54274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
54284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  oldobjs="$old_deplibs $non_pic_objects"
54294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
54304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	addlibs="$old_convenience"
54314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
54324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
54334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$addlibs"; then
54344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	gentop="$output_objdir/${outputname}x"
54354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	generated="$generated $gentop"
54364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
543704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	func_extract_archives $gentop $addlibs
543804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	oldobjs="$oldobjs $func_extract_archives_result"
54394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
54404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
54414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Do each command in the archive commands.
54424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
544304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer       cmds=$old_archive_from_new_cmds
54444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      else
5445a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	# POSIX demands no paths to be encoded in archives.  We have
5446a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	# to avoid creating archives with duplicate basenames if we
5447a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	# might have to extract them afterwards, e.g., when creating a
5448a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	# static archive out of a convenience library, or when linking
5449a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	# the entirety of a libtool archive into another (currently
5450a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	# not supported by libtool).
5451a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	if (for obj in $oldobjs
5452a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    do
5453a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
5454a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    done | sort | sort -uc >/dev/null 2>&1); then
5455a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  :
5456a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	else
5457a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  $echo "copying selected object files to avoid basename conflicts..."
5458a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
5459a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  if test -z "$gentop"; then
5460a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    gentop="$output_objdir/${outputname}x"
5461a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    generated="$generated $gentop"
5462a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
5463a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    $show "${rm}r $gentop"
5464a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    $run ${rm}r "$gentop"
5465a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    $show "$mkdir $gentop"
5466a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    $run $mkdir "$gentop"
5467a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    exit_status=$?
5468a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
5469a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      exit $exit_status
5470a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    fi
5471a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  fi
5472a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
5473a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  save_oldobjs=$oldobjs
5474a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  oldobjs=
5475a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  counter=1
5476a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  for obj in $save_oldobjs
5477a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  do
5478a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
5479a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    case " $oldobjs " in
5480a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    " ") oldobjs=$obj ;;
5481a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    *[\ /]"$objbase "*)
5482a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      while :; do
5483a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		# Make sure we don't pick an alternate name that also
5484a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		# overlaps.
5485a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		newobj=lt$counter-$objbase
5486a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		counter=`expr $counter + 1`
5487a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		case " $oldobjs " in
5488a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		*[\ /]"$newobj "*) ;;
5489a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
5490a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		esac
5491a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      done
5492a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
5493a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      $run ln "$obj" "$gentop/$newobj" ||
5494a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      $run cp "$obj" "$gentop/$newobj"
5495a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      oldobjs="$oldobjs $gentop/$newobj"
5496a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      ;;
5497a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    *) oldobjs="$oldobjs $obj" ;;
5498a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    esac
5499a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  done
5500a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	fi
5501a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
55024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	eval cmds=\"$old_archive_cmds\"
55034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
55044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if len=`expr "X$cmds" : ".*"` &&
55054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
550604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  cmds=$old_archive_cmds
55074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
55084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # the command line is too long to link in one step, link in parts
55094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "using piecewise archive linking..."
55104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  save_RANLIB=$RANLIB
55114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  RANLIB=:
55124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  objlist=
55134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  concat_cmds=
55144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  save_oldobjs=$oldobjs
5515a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
55164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Is there a better way of finding the last object in the list?
55174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for obj in $save_oldobjs
55184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  do
55194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    last_oldobj=$obj
552004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  done
55214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for obj in $save_oldobjs
55224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  do
55234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    oldobjs="$objlist $obj"
55244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    objlist="$objlist $obj"
55254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    eval test_cmds=\"$old_archive_cmds\"
5526a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
55274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	       test "$len" -le "$max_cmd_len"; then
55284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      :
55294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
55304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # the above command should be used before it gets too long
55314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      oldobjs=$objlist
55324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test "$obj" = "$last_oldobj" ; then
55334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	        RANLIB=$save_RANLIB
553404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      fi
55354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
55364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
55374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      objlist=
55384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
55394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
55404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  RANLIB=$save_RANLIB
55414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  oldobjs=$objlist
55424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "X$oldobjs" = "X" ; then
55434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    eval cmds=\"\$concat_cmds\"
55444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
554504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
55464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
55474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
55484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
55494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      save_ifs="$IFS"; IFS='~'
55504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      for cmd in $cmds; do
555104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer        eval cmd=\"$cmd\"
55524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	IFS="$save_ifs"
55534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$show "$cmd"
55544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$run eval "$cmd" || exit $?
55554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      done
55564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      IFS="$save_ifs"
55574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    done
55584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
55594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -n "$generated"; then
55604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $show "${rm}r$generated"
55614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $run ${rm}r$generated
55624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
55634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
55644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Now create the libtool archive.
55654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    case $output in
55664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *.la)
55674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      old_library=
55684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      test "$build_old_libs" = yes && old_library="$libname.$libext"
55694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $show "creating $output"
55704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
55714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Preserve any variables that may affect compiler behavior
55724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      for var in $variables_saved_for_relink; do
55734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if eval test -z \"\${$var+set}\"; then
55744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
55754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	elif eval var_value=\$$var; test -z "$var_value"; then
55764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  relink_command="$var=; export $var; $relink_command"
55774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
55784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
55794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
55804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
55814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      done
55824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Quote the link command for shipping.
558304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
55844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
558504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      if test "$hardcode_automatic" = yes ; then
558604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	relink_command=
558704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      fi
558804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer
55894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
55904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Only create the output if not a dry run.
55914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -z "$run"; then
55924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	for installed in no yes; do
55934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$installed" = yes; then
55944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -z "$install_libdir"; then
55954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      break
55964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
55974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    output="$output_objdir/$outputname"i
55984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Replace all uninstalled libtool libraries with the installed ones
55994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    newdependency_libs=
56004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    for deplib in $dependency_libs; do
56014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case $deplib in
56024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *.la)
56034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
56044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
56054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		if test -z "$libdir"; then
56064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
560704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		  exit $EXIT_FAILURE
56084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		fi
56094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		newdependency_libs="$newdependency_libs $libdir/$name"
56104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		;;
56114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *) newdependency_libs="$newdependency_libs $deplib" ;;
56124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
56134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    done
56144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    dependency_libs="$newdependency_libs"
56154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    newdlfiles=
56164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    for lib in $dlfiles; do
56174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
56184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
56194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test -z "$libdir"; then
56204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
562104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		exit $EXIT_FAILURE
56224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
56234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      newdlfiles="$newdlfiles $libdir/$name"
56244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    done
56254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    dlfiles="$newdlfiles"
56264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    newdlprefiles=
56274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    for lib in $dlprefiles; do
56284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
56294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
56304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test -z "$libdir"; then
56314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
563204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		exit $EXIT_FAILURE
56334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
56344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      newdlprefiles="$newdlprefiles $libdir/$name"
56354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    done
56364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    dlprefiles="$newdlprefiles"
563704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  else
563804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    newdlfiles=
563904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    for lib in $dlfiles; do
564004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      case $lib in
564104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
564204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		*) abs=`pwd`"/$lib" ;;
564304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      esac
564404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      newdlfiles="$newdlfiles $abs"
564504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    done
564604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    dlfiles="$newdlfiles"
564704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    newdlprefiles=
564804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    for lib in $dlprefiles; do
564904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      case $lib in
565004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
565104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		*) abs=`pwd`"/$lib" ;;
565204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      esac
565304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      newdlprefiles="$newdlprefiles $abs"
565404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    done
565504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    dlprefiles="$newdlprefiles"
56564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
56574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $rm $output
56584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # place dlname in correct position for cygwin
56594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  tdlname=$dlname
56604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $host,$output,$installed,$module,$dlname in
56614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
56624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
56634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo > $output "\
56644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# $outputname - a libtool library file
56654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
56664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell#
56674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Please DO NOT delete this file!
56684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# It is necessary for linking the library.
56694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
56704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# The name that we can dlopen(3).
56714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelldlname='$tdlname'
56724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
56734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Names of this library.
56744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelllibrary_names='$library_names'
56754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
56764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# The name of the static archive.
56774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellold_library='$old_library'
56784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
56794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Libraries that this one depends upon.
56804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelldependency_libs='$dependency_libs'
56814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
56824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Version information for $libname.
56834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellcurrent=$current
56844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellage=$age
56854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellrevision=$revision
56864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
56874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Is this an already installed library?
56884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellinstalled=$installed
56894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
56904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Should we warn about portability when linking against -modules?
56914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellshouldnotlink=$module
56924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
56934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Files to dlopen/dlpreopen
56944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelldlopen='$dlfiles'
56954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelldlpreopen='$dlprefiles'
56964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
56974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Directory that this library needs to be installed in:
56984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelllibdir='$install_libdir'"
56994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$installed" = no && test "$need_relink" = yes; then
57004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo >> $output "\
57014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellrelink_command=\"$relink_command\""
57024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
57034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	done
57044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
57054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
57064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Do a symbolic link so that the libtool archive can be found in
57074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # LD_LIBRARY_PATH before the program is installed.
57084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
57094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
57104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
57114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    esac
571204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    exit $EXIT_SUCCESS
57134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
57144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
57154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # libtool install mode
57164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  install)
57174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    modename="$modename: install"
57184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
57194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # There may be an optional sh(1) argument at the beginning of
57204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # install_prog (especially on Windows NT).
57214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
57224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell       # Allow the use of GNU shtool's install command.
5723a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer       $echo "X$nonopt" | grep shtool > /dev/null; then
57244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Aesthetically quote it.
57254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
57264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case $arg in
5727a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
57284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	arg="\"$arg\""
57294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
57304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
57314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      install_prog="$arg "
57324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      arg="$1"
57334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      shift
57344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    else
57354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      install_prog=
5736a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      arg=$nonopt
57374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
57384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
57394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # The real first argument should be the name of the installation program.
57404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Aesthetically quote it.
57414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
57424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    case $arg in
5743a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
57444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      arg="\"$arg\""
57454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
57464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    esac
57474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    install_prog="$install_prog$arg"
57484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
57494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # We need to accept at least all the BSD install flags.
57504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    dest=
57514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    files=
57524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    opts=
57534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    prev=
57544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    install_type=
57554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    isdir=no
57564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    stripme=
57574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    for arg
57584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    do
57594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$dest"; then
57604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	files="$files $dest"
5761a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	dest=$arg
57624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
57634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
57644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
57654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case $arg in
57664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -d) isdir=yes ;;
5767a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      -f) 
5768a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      	case " $install_prog " in
5769a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	*[\\\ /]cp\ *) ;;
5770a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	*) prev=$arg ;;
5771a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	esac
5772a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	;;
5773a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      -g | -m | -o) prev=$arg ;;
57744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -s)
57754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	stripme=" -s"
57764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
57774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
5778a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      -*)
5779a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	;;
57804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *)
57814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# If the previous option needed an argument, then skip it.
57824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$prev"; then
57834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  prev=
57844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
5785a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  dest=$arg
57864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
57874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
57884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
57894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
57904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
57914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Aesthetically quote the argument.
57924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
57934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case $arg in
5794a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
57954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	arg="\"$arg\""
57964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
57974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
57984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      install_prog="$install_prog $arg"
57994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    done
58004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
58014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -z "$install_prog"; then
58024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$modename: you must specify an install program" 1>&2
58034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$help" 1>&2
580404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      exit $EXIT_FAILURE
58054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
58064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
58074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -n "$prev"; then
58084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$modename: the \`$prev' option requires an argument" 1>&2
58094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$help" 1>&2
581004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      exit $EXIT_FAILURE
58114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
58124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
58134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -z "$files"; then
58144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -z "$dest"; then
58154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: no file or destination specified" 1>&2
58164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      else
58174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: you must specify a destination" 1>&2
58184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
58194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$help" 1>&2
582004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      exit $EXIT_FAILURE
58214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
58224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
58234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Strip any trailing slash from the destination.
58244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
58254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
58264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Check to see that the destination is a directory.
58274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    test -d "$dest" && isdir=yes
58284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test "$isdir" = yes; then
58294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      destdir="$dest"
58304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      destname=
58314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    else
58324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
58334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      test "X$destdir" = "X$dest" && destdir=.
58344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
58354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
58364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Not a directory, so check to see that there is only one file specified.
58374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      set dummy $files
58384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$#" -gt 2; then
58394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: \`$dest' is not a directory" 1>&2
58404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$help" 1>&2
584104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	exit $EXIT_FAILURE
58424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
58434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
58444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    case $destdir in
58454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    [\\/]* | [A-Za-z]:[\\/]*) ;;
58464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    *)
58474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      for file in $files; do
58484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $file in
58494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*.lo) ;;
58504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*)
58514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
58524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$help" 1>&2
585304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
58544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
58554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
58564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      done
58574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      ;;
58584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    esac
58594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
58604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # This variable tells wrapper scripts just to set variables rather
58614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # than running their programs.
58624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    libtool_install_magic="$magic"
58634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
58644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    staticlibs=
58654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    future_libdirs=
58664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    current_libdirs=
58674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    for file in $files; do
58684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
58694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Do each installation.
58704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case $file in
58714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *.$libext)
58724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Do the static libraries later.
58734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	staticlibs="$staticlibs $file"
58744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
58754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
58764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *.la)
58774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Check to see that this really is a libtool archive.
58784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
58794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
58804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
58814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$help" 1>&2
588204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
58834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
58844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
58854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	library_names=
58864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	old_library=
58874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	relink_command=
58884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# If there is no directory component, then add one.
58894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $file in
58904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*/* | *\\*) . $file ;;
58914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*) . ./$file ;;
58924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
58934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
58944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Add the libdir to current_libdirs if it is the destination.
58954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "X$destdir" = "X$libdir"; then
58964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case "$current_libdirs " in
58974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *" $libdir "*) ;;
58984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *) current_libdirs="$current_libdirs $libdir" ;;
58994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
59004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
59014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Note the libdir as a future libdir.
59024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case "$future_libdirs " in
59034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *" $libdir "*) ;;
59044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *) future_libdirs="$future_libdirs $libdir" ;;
59054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
59064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
59074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
59084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
59094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	test "X$dir" = "X$file/" && dir=
59104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	dir="$dir$objdir"
59114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
59124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$relink_command"; then
59134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Determine the prefix the user has applied to our future dir.
59144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
59154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
59164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Don't allow the user to place us outside of our expected
59174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # location b/c this prevents finding dependent libraries that
59184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # are installed to the same prefix.
59194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # At present, this check doesn't affect windows .dll's that
59204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # are installed into $libdir/../bin (currently, that works fine)
59214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # but it's something to keep an eye on.
59224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$inst_prefix_dir" = "$destdir"; then
59234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
592404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    exit $EXIT_FAILURE
59254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
59264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
59274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -n "$inst_prefix_dir"; then
59284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Stick the inst_prefix_dir data into the link command.
59294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
59304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
59314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
59324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
59334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
59344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: warning: relinking \`$file'" 1>&2
59354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $show "$relink_command"
59364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if $run eval "$relink_command"; then :
59374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
59384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
593904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    exit $EXIT_FAILURE
59404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
59414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
59424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
59434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# See the names of the shared library.
59444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	set dummy $library_names
59454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$2"; then
59464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  realname="$2"
59474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  shift
59484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  shift
59494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
59504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  srcname="$realname"
59514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  test -n "$relink_command" && srcname="$realname"T
59524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
59534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Install the shared library and build the symlinks.
59544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $show "$install_prog $dir/$srcname $destdir/$realname"
59554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
59564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -n "$stripme" && test -n "$striplib"; then
59574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $show "$striplib $destdir/$realname"
59584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $run eval "$striplib $destdir/$realname" || exit $?
59594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
59604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
59614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$#" -gt 0; then
59624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Delete the old symlinks, and create new ones.
5963a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    # Try `ln -sf' first, because the `ln' binary might depend on
5964a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
5965a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    # so we also need to try rm && ln -s.
59664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    for linkname
59674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    do
59684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if test "$linkname" != "$realname"; then
5969a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
5970a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
59714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
59724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    done
59734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
59744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
59754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Do each command in the postinstall commands.
59764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  lib="$destdir/$realname"
597704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  cmds=$postinstall_cmds
59784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  save_ifs="$IFS"; IFS='~'
59794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for cmd in $cmds; do
59804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    IFS="$save_ifs"
598104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    eval cmd=\"$cmd\"
59824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $show "$cmd"
5983a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    $run eval "$cmd" || {
5984a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      lt_exit=$?
5985a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
5986a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      # Restore the uninstalled library and exit
5987a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      if test "$mode" = relink; then
5988a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
5989a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      fi
5990a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer
5991a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      exit $lt_exit
5992a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    }
59934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
59944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  IFS="$save_ifs"
59954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
59964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
59974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Install the pseudo-library for information purposes.
59984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
59994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	instname="$dir/$name"i
60004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$show "$install_prog $instname $destdir/$name"
60014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$run eval "$install_prog $instname $destdir/$name" || exit $?
60024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
60034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Maybe install the static library, too.
60044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
60054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
60064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
60074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *.lo)
60084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Install (i.e. copy) a libtool object.
60094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
60104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Figure out destination file name, if it wasn't already specified.
60114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$destname"; then
60124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  destfile="$destdir/$destname"
60134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
60144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
60154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  destfile="$destdir/$destfile"
60164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
60174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
60184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Deduce the name of the destination old-style object file.
60194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $destfile in
60204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*.lo)
60214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
60224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
60234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*.$objext)
60244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  staticdest="$destfile"
60254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  destfile=
60264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
60274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*)
60284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
60294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$help" 1>&2
603004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
60314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
60324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
60334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
60344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Install the libtool object if requested.
60354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$destfile"; then
60364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $show "$install_prog $file $destfile"
60374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $run eval "$install_prog $file $destfile" || exit $?
60384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
60394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
60404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Install the old object if enabled.
60414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$build_old_libs" = yes; then
60424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Deduce the name of the old-style object file.
60434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
60444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
60454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $show "$install_prog $staticobj $staticdest"
60464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
60474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
604804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	exit $EXIT_SUCCESS
60494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
60504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
60514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *)
60524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Figure out destination file name, if it wasn't already specified.
60534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$destname"; then
60544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  destfile="$destdir/$destname"
60554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
60564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
60574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  destfile="$destdir/$destfile"
60584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
60594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
60604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# If the file is missing, and there is a .exe on the end, strip it
60614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# because it is most likely a libtool script we actually want to
60624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# install
60634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	stripped_ext=""
60644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $file in
60654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *.exe)
60664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test ! -f "$file"; then
60674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      file=`$echo $file|${SED} 's,.exe$,,'`
60684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      stripped_ext=".exe"
60694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
60704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
60714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
60724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
60734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Do a test to see if this is really a libtool program.
60744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $host in
60754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*cygwin*|*mingw*)
60764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
60774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
60784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*)
60794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    wrapper=$file
60804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
60814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
60824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
60834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  notinst_deplibs=
60844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  relink_command=
60854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
6086a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  # Note that it is not necessary on cygwin/mingw to append a dot to
6087a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
6088a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
6089a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  # `FILE.' does not work on cygwin managed mounts.
6090a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  #
60914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # If there is no directory component, then add one.
6092a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  case $wrapper in
6093a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  */* | *\\*) . ${wrapper} ;;
6094a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *) . ./${wrapper} ;;
60954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
60964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
60974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Check the variables that should have been set.
60984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -z "$notinst_deplibs"; then
60994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
610004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    exit $EXIT_FAILURE
61014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
61024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
61034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  finalize=yes
61044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for lib in $notinst_deplibs; do
61054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Check to see that each library is installed.
61064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    libdir=
61074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -f "$lib"; then
61084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # If there is no directory component, then add one.
61094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      case $lib in
61104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      */* | *\\*) . $lib ;;
61114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      *) . ./$lib ;;
61124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      esac
61134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
61144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
61154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -n "$libdir" && test ! -f "$libfile"; then
61164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
61174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      finalize=no
61184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
61194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
61204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
61214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  relink_command=
6122a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  # Note that it is not necessary on cygwin/mingw to append a dot to
6123a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
6124a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
6125a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  # `FILE.' does not work on cygwin managed mounts.
6126a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  #
61274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # If there is no directory component, then add one.
6128a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  case $wrapper in
6129a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  */* | *\\*) . ${wrapper} ;;
6130a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  *) . ./${wrapper} ;;
61314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
61324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
61334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  outputname=
61344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test "$fast_install" = no && test -n "$relink_command"; then
61354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$finalize" = yes && test -z "$run"; then
6136a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	      tmpdir=`func_mktempdir`
61374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
61384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      outputname="$tmpdir/$file"
61394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # Replace the output file specification.
61404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
61414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
61424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $show "$relink_command"
61434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      if $run eval "$relink_command"; then :
61444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      else
61454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
61464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		${rm}r "$tmpdir"
61474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		continue
61484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      fi
61494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      file="$outputname"
61504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    else
61514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
61524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
61534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  else
61544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # Install the binary that we compiled earlier.
61554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
61564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
61574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
61584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
61594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# remove .exe since cygwin /usr/bin/install will append another
6160a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	# one anyway 
61614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $install_prog,$host in
61624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*/usr/bin/install*,*cygwin*)
61634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $file:$destfile in
61644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *.exe:*.exe)
61654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # this is ok
61664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
61674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *.exe:*)
61684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    destfile=$destfile.exe
61694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
61704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *:*.exe)
61714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
61724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
61734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
61744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  ;;
61754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
61764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$show "$install_prog$stripme $file $destfile"
61774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
61784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	test -n "$outputname" && ${rm}r "$tmpdir"
61794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
61804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
61814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    done
61824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
61834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    for file in $staticlibs; do
61844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
61854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
61864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Set up the ranlib parameters.
61874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      oldlib="$destdir/$name"
61884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
61894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $show "$install_prog $file $oldlib"
61904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $run eval "$install_prog \$file \$oldlib" || exit $?
61914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
619204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      if test -n "$stripme" && test -n "$old_striplib"; then
61934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$show "$old_striplib $oldlib"
61944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$run eval "$old_striplib $oldlib" || exit $?
61954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
61964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
61974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Do each command in the postinstall commands.
619804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      cmds=$old_postinstall_cmds
61994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      save_ifs="$IFS"; IFS='~'
62004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      for cmd in $cmds; do
62014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	IFS="$save_ifs"
620204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	eval cmd=\"$cmd\"
62034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$show "$cmd"
62044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$run eval "$cmd" || exit $?
62054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      done
62064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      IFS="$save_ifs"
62074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    done
62084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
62094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -n "$future_libdirs"; then
62104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
62114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
62124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
62134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -n "$current_libdirs"; then
62144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Maybe just do a dry run.
62154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      test -n "$run" && current_libdirs=" -n$current_libdirs"
621604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
62174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    else
621804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      exit $EXIT_SUCCESS
62194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
62204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
62214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
62224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # libtool finish mode
62234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  finish)
62244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    modename="$modename: finish"
62254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    libdirs="$nonopt"
62264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    admincmds=
62274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
62284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
62294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      for dir
62304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      do
62314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	libdirs="$libdirs $dir"
62324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      done
62334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
62344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      for libdir in $libdirs; do
62354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$finish_cmds"; then
62364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Do each command in the finish commands.
623704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  cmds=$finish_cmds
62384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  save_ifs="$IFS"; IFS='~'
62394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for cmd in $cmds; do
62404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    IFS="$save_ifs"
624104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	    eval cmd=\"$cmd\"
62424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $show "$cmd"
62434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    $run eval "$cmd" || admincmds="$admincmds
62444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell       $cmd"
62454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
62464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  IFS="$save_ifs"
62474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
62484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -n "$finish_eval"; then
62494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Do the single finish_eval.
62504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  eval cmds=\"$finish_eval\"
62514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $run eval "$cmds" || admincmds="$admincmds
62524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell       $cmds"
62534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
62544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      done
62554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
62564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
62574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Exit here if they wanted silent mode.
625804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    test "$show" = : && exit $EXIT_SUCCESS
62594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
6260a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    $echo "X----------------------------------------------------------------------" | $Xsed
62614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "Libraries have been installed in:"
62624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    for libdir in $libdirs; do
62634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "   $libdir"
62644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    done
62654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo
62664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "If you ever happen to want to link against installed libraries"
62674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "in a given directory, LIBDIR, you must either use libtool, and"
62684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
62694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "flag during linking and do at least one of the following:"
62704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -n "$shlibpath_var"; then
62714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
62724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "     during execution"
62734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
62744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -n "$runpath_var"; then
62754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
62764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "     during linking"
62774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
62784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -n "$hardcode_libdir_flag_spec"; then
62794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      libdir=LIBDIR
62804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      eval flag=\"$hardcode_libdir_flag_spec\"
62814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
62824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "   - use the \`$flag' linker flag"
62834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
62844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -n "$admincmds"; then
62854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "   - have your system administrator run these commands:$admincmds"
62864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
62874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -f /etc/ld.so.conf; then
62884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
62894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
62904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo
62914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "See any operating system documentation about shared libraries for"
62924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
6293a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer    $echo "X----------------------------------------------------------------------" | $Xsed
629404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    exit $EXIT_SUCCESS
62954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
62964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
62974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # libtool execute mode
62984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  execute)
62994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    modename="$modename: execute"
63004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
63014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # The first argument is the command name.
63024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    cmd="$nonopt"
63034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -z "$cmd"; then
63044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$modename: you must specify a COMMAND" 1>&2
63054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$help"
630604c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      exit $EXIT_FAILURE
63074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
63084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
63094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Handle -dlopen flags immediately.
63104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    for file in $execute_dlfiles; do
63114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test ! -f "$file"; then
63124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: \`$file' is not a file" 1>&2
63134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$help" 1>&2
631404c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	exit $EXIT_FAILURE
63154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
63164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
63174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      dir=
63184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case $file in
63194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *.la)
63204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Check to see that this really is a libtool archive.
63214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
63224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
63234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
63244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$help" 1>&2
632504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
63264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
63274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
63284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Read the libtool library.
63294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	dlname=
63304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	library_names=
63314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
63324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# If there is no directory component, then add one.
63334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case $file in
63344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*/* | *\\*) . $file ;;
63354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	*) . ./$file ;;
63364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
63374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
63384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Skip this library if it cannot be dlopened.
63394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -z "$dlname"; then
63404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Warn if it was a shared library.
63414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
63424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  continue
63434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
63444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
63454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
63464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	test "X$dir" = "X$file" && dir=.
63474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
63484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test -f "$dir/$objdir/$dlname"; then
63494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  dir="$dir/$objdir"
63504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	else
63514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
635204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  exit $EXIT_FAILURE
63534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
63544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
63554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
63564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *.lo)
63574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Just add the directory containing the .lo file.
63584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
63594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	test "X$dir" = "X$file" && dir=.
63604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
63614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
63624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *)
63634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
63644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
63654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
63664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
63674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
63684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Get the absolute pathname.
63694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      absdir=`cd "$dir" && pwd`
63704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      test -n "$absdir" && dir="$absdir"
63714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
63724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Now add the directory to shlibpath_var.
63734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if eval "test -z \"\$$shlibpath_var\""; then
63744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	eval "$shlibpath_var=\"\$dir\""
63754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      else
63764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
63774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
63784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    done
63794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
63804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # This variable tells wrapper scripts just to set shlibpath_var
63814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # rather than running their programs.
63824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    libtool_execute_magic="$magic"
63834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
63844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Check if any of the arguments is a wrapper script.
63854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    args=
63864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    for file
63874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    do
63884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case $file in
63894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -*) ;;
63904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *)
63914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Do a test to see if this is really a libtool program.
63924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
63934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # If there is no directory component, then add one.
63944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $file in
63954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  */* | *\\*) . $file ;;
63964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *) . ./$file ;;
63974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
63984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
63994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Transform arg to wrapped name.
64004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  file="$progdir/$program"
64014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
64024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
64034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
64044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Quote arguments (to preserve shell metacharacters).
64054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
64064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      args="$args \"$file\""
64074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    done
64084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
64094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -z "$run"; then
64104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$shlibpath_var"; then
64114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Export the shlibpath_var.
64124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	eval "export $shlibpath_var"
64134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
64144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
64154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Restore saved environment variables
64164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "${save_LC_ALL+set}" = set; then
64174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	LC_ALL="$save_LC_ALL"; export LC_ALL
64184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
64194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "${save_LANG+set}" = set; then
64204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	LANG="$save_LANG"; export LANG
64214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
64224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
64234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Now prepare to actually exec the command.
64244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      exec_cmd="\$cmd$args"
64254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    else
64264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Display what would be done.
64274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -n "$shlibpath_var"; then
64284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
64294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$echo "export $shlibpath_var"
64304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
64314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$cmd$args"
643204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      exit $EXIT_SUCCESS
64334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
64344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
64354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
64364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  # libtool clean and uninstall mode
64374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  clean | uninstall)
64384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    modename="$modename: $mode"
64394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    rm="$nonopt"
64404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    files=
64414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    rmforce=
64424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    exit_status=0
64434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
64444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # This variable tells wrapper scripts just to set variables rather
64454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # than running their programs.
64464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    libtool_install_magic="$magic"
64474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
64484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    for arg
64494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    do
64504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case $arg in
64514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -f) rm="$rm $arg"; rmforce=yes ;;
64524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      -*) rm="$rm $arg" ;;
64534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *) files="$files $arg" ;;
64544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
64554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    done
64564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
64574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    if test -z "$rm"; then
64584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$modename: you must specify an RM program" 1>&2
64594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $echo "$help" 1>&2
646004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer      exit $EXIT_FAILURE
64614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    fi
64624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
64634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    rmdirs=
64644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
64654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    origobjdir="$objdir"
64664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    for file in $files; do
64674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
64684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "X$dir" = "X$file"; then
64694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	dir=.
64704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	objdir="$origobjdir"
64714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      else
64724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	objdir="$dir/$origobjdir"
64734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
64744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
64754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      test "$mode" = uninstall && objdir="$dir"
64764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
64774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Remember objdir for removal later, being careful to avoid duplicates
64784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test "$mode" = clean; then
64794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	case " $rmdirs " in
64804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *" $objdir "*) ;;
64814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  *) rmdirs="$rmdirs $objdir" ;;
64824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	esac
64834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
64844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
64854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      # Don't error if the file doesn't exist and rm -f was used.
64864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if (test -L "$file") >/dev/null 2>&1 \
64874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	|| (test -h "$file") >/dev/null 2>&1 \
64884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	|| test -f "$file"; then
64894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	:
64904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      elif test -d "$file"; then
64914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	exit_status=1
64924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
64934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      elif test "$rmforce" = yes; then
64944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	continue
64954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
64964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
64974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      rmfiles="$file"
64984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
64994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      case $name in
65004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *.la)
65014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Possibly a libtool archive, so verify it.
65024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
65034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  . $dir/$name
65044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
65054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Delete the libtool libraries and symlinks.
65064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  for n in $library_names; do
65074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    rmfiles="$rmfiles $objdir/$n"
65084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  done
65094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
65104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
6511a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  case "$mode" in
6512a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  clean)
6513a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    case "  $library_names " in
6514a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    # "  " in the beginning catches empty $dlname
6515a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    *" $dlname "*) ;;
6516a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
6517a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    esac
6518a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
6519a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    ;;
6520a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  uninstall)
65214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -n "$library_names"; then
65224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # Do each command in the postuninstall commands.
652304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      cmds=$postuninstall_cmds
65244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      save_ifs="$IFS"; IFS='~'
65254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      for cmd in $cmds; do
65264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		IFS="$save_ifs"
652704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		eval cmd=\"$cmd\"
65284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$show "$cmd"
65294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$run eval "$cmd"
65304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		if test "$?" -ne 0 && test "$rmforce" != yes; then
65314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  exit_status=1
65324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		fi
65334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      done
65344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      IFS="$save_ifs"
65354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
65364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
65374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test -n "$old_library"; then
65384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      # Do each command in the old_postuninstall commands.
653904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	      cmds=$old_postuninstall_cmds
65404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      save_ifs="$IFS"; IFS='~'
65414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      for cmd in $cmds; do
65424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		IFS="$save_ifs"
654304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer		eval cmd=\"$cmd\"
65444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$show "$cmd"
65454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		$run eval "$cmd"
65464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		if test "$?" -ne 0 && test "$rmforce" != yes; then
65474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		  exit_status=1
65484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		fi
65494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      done
65504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      IFS="$save_ifs"
65514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
65524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # FIXME: should reinstall the best remaining shared library.
6553a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	    ;;
6554a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencer	  esac
65554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
65564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
65574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
65584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *.lo)
65594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	# Possibly a libtool object, so verify it.
65604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
65614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
65624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Read the .lo file
65634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  . $dir/$name
65644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
65654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Add PIC object to the list of files to remove.
65664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -n "$pic_object" \
65674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	     && test "$pic_object" != none; then
65684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    rmfiles="$rmfiles $dir/$pic_object"
65694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
65704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
65714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Add non-PIC object to the list of files to remove.
65724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if test -n "$non_pic_object" \
65734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	     && test "$non_pic_object" != none; then
65744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    rmfiles="$rmfiles $dir/$non_pic_object"
65754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
65764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
65774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
65784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
65794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      *)
65804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	if test "$mode" = clean ; then
65814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  noexename=$name
65824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  case $file in
658304c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer	  *.exe)
65844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    file=`$echo $file|${SED} 's,.exe$,,'`
65854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    noexename=`$echo $name|${SED} 's,.exe$,,'`
65864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # $file with .exe has already been added to rmfiles,
65874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # add $file without .exe
65884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    rmfiles="$rmfiles $file"
65894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    ;;
65904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  esac
65914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  # Do a test to see if this is a libtool program.
65924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
65934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    relink_command=
65944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    . $dir/$noexename
65954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
65964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # note $name still contains .exe if it was in $file originally
65974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    # as does the version of $file that was added into $rmfiles
65984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
65994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "$fast_install" = yes && test -n "$relink_command"; then
66004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      rmfiles="$rmfiles $objdir/lt-$name"
66014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
66024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    if test "X$noexename" != "X$name" ; then
66034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
66044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	    fi
66054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	  fi
66064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	fi
66074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	;;
66084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      esac
66094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $show "$rm $rmfiles"
66104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      $run $rm $rmfiles || exit_status=1
66114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    done
66124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    objdir="$origobjdir"
66134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    # Try to remove the ${objdir}s in the directories where we deleted files
66154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    for dir in $rmdirs; do
66164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      if test -d "$dir"; then
66174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$show "rmdir $dir"
66184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell	$run rmdir $dir >/dev/null 2>&1
66194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      fi
66204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    done
66214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    exit $exit_status
66234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
66244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  "")
66264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "$modename: you must specify a MODE" 1>&2
66274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "$generic_help" 1>&2
662804c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    exit $EXIT_FAILURE
66294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    ;;
66304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  esac
66314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  if test -z "$exec_cmd"; then
66334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "$modename: invalid operation mode \`$mode'" 1>&2
66344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    $echo "$generic_help" 1>&2
663504c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer    exit $EXIT_FAILURE
66364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  fi
66374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellfi # test -z "$show_help"
66384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellif test -n "$exec_cmd"; then
66404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  eval exec $exec_cmd
664104c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer  exit $EXIT_FAILURE
66424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellfi
66434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# We need to display help for each of the modes.
66454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellcase $mode in
66464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"") $echo \
66474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"Usage: $modename [OPTION]... [MODE-ARG]...
66484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellProvide generalized library-building support services.
66504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    --config          show all configuration variables
66524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    --debug           enable verbose shell tracing
66534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell-n, --dry-run         display commands without modifying any files
66544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    --features        display basic configuration information and exit
66554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    --finish          same as \`--mode=finish'
66564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    --help            display this help message and exit
66574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
66584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    --quiet           same as \`--silent'
66594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    --silent          don't print informational messages
66604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    --tag=TAG         use configuration variables from tag TAG
66614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell    --version         print version information
66624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellMODE must be one of the following:
66644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      clean           remove files from the build directory
66664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      compile         compile a source file into a libtool object
66674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      execute         automatically set library path, then run a program
66684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      finish          complete the installation of libtool libraries
66694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      install         install libraries or executables
66704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      link            create a library or an executable
66714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell      uninstall       remove libraries from an installed directory
66724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellMODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
66744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswella more detailed description of MODE.
66754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellReport bugs to <bug-libtool@gnu.org>."
667704c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer  exit $EXIT_SUCCESS
66784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  ;;
66794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellclean)
66814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  $echo \
66824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
66834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellRemove files from the build directory.
66854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellRM is the name of the program to use to delete files associated with each FILE
66874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
66884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellto RM.
66894ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66904ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellIf FILE is a libtool library, object or program, all the files associated
66914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellwith it are deleted. Otherwise, only FILE itself is deleted using RM."
66924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  ;;
66934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellcompile)
66954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  $echo \
66964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
66974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
66984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellCompile a source file into a libtool library object.
66994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellThis mode accepts the following additional options:
67014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
67034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -prefer-pic       try to building PIC objects only
67044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -prefer-non-pic   try to building non-PIC objects only
67054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -static           always build a \`.o' file suitable for static linking
67064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellCOMPILE-COMMAND is a command to be used in creating a \`standard' object file
67084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellfrom the given SOURCEFILE.
67094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellThe output file name is determined by removing the directory component from
67114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellSOURCEFILE, then substituting the C source code suffix \`.c' with the
67124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelllibrary object suffix, \`.lo'."
67134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  ;;
67144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellexecute)
67164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  $echo \
67174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
67184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellAutomatically set library path, then run a program.
67204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellThis mode accepts the following additional options:
67224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -dlopen FILE      add the directory containing FILE to the library path
67244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellThis mode sets the library path environment variable according to \`-dlopen'
67264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellflags.
67274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellIf any of the ARGS are libtool executable wrappers, then they are translated
67294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellinto their corresponding uninstalled binary, and any of their required library
67304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelldirectories are added to the library path.
67314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67324ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellThen, COMMAND is executed, with ARGS as arguments."
67334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  ;;
67344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellfinish)
67364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  $echo \
67374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
67384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67394ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellComplete the installation of libtool libraries.
67404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellEach LIBDIR is a directory that contains libtool libraries.
67424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellThe commands that this mode executes may require superuser privileges.  Use
67444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellthe \`--dry-run' option if you just want to see what would be executed."
67454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  ;;
67464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellinstall)
67484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  $echo \
67494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
67504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellInstall executables or libraries.
67524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67534ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellINSTALL-COMMAND is the installation command.  The first component should be
67544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelleither the \`install' or \`cp' program.
67554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellThe rest of the components are interpreted as arguments to that command (only
67574ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellBSD-compatible install options are recognized)."
67584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  ;;
67594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelllink)
67614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  $echo \
67624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
67634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67644ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellLink object files or libraries together to form another library, or to
67654ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellcreate an executable program.
67664ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67674ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellLINK-COMMAND is a command using the C compiler that you would use to create
67684ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswella program from several object files.
67694ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67704ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellThe following components of LINK-COMMAND are treated specially:
67714ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67724ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -all-static       do not do any dynamic linking at all
67734ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -avoid-version    do not add a version suffix if possible
67744ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
67754ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
67764ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
67774ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -export-symbols SYMFILE
67784ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    try to export only the symbols listed in SYMFILE
67794ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -export-symbols-regex REGEX
67804ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    try to export only the symbols matching REGEX
67814ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -LLIBDIR          search LIBDIR for required installed libraries
67824ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -lNAME            OUTPUT-FILE requires the installed library libNAME
67834ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -module           build a library that can dlopened
67844ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -no-fast-install  disable the fast-install mode
67854ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -no-install       link a not-installable executable
67864ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -no-undefined     declare that a library does not refer to external symbols
67874ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
67884ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -objectlist FILE  Use a list of object files found in FILE to specify objects
678904c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer  -precious-files-regex REGEX
679004c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer                    don't remove output files matching REGEX
67914ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -release RELEASE  specify package release information
67924ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
67934ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
67944ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -static           do not do any dynamic linking of libtool libraries
67954ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  -version-info CURRENT[:REVISION[:AGE]]
67964ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell		    specify library version info [each variable defaults to 0]
67974ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
67984ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellAll other options (arguments beginning with \`-') are ignored.
67994ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
68004ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellEvery other argument is treated as a filename.  Files ending in \`.la' are
68014ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelltreated as uninstalled libtool libraries, other files are standard or library
68024ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellobject files.
68034ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
68044ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellIf the OUTPUT-FILE ends in \`.la', then a libtool library is created,
68054ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellonly library objects (\`.lo' files) may be specified, and \`-rpath' is
68064ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellrequired, except when creating a convenience library.
68074ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
68084ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
68094ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellusing \`ar' and \`ranlib', or on Windows using \`lib'.
68104ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
68114ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
68124ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellis created, otherwise an executable program is created."
68134ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  ;;
68144ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
68154ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswelluninstall)
68164ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  $echo \
68174ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
68184ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
68194ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellRemove libraries from an installation directory.
68204ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
68214ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellRM is the name of the program to use to delete files associated with each FILE
68224ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
68234ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellto RM.
68244ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
68254ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellIf FILE is a libtool library, all the files associated with it are deleted.
68264ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn CriswellOtherwise, only FILE itself is deleted using RM."
68274ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  ;;
68284ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
68294ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell*)
68304ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  $echo "$modename: invalid operation mode \`$mode'" 1>&2
68314ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  $echo "$help" 1>&2
683204c2144f90f3bec9baf472038cf0ebd28a86e366Reid Spencer  exit $EXIT_FAILURE
68334ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell  ;;
68344ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswellesac
68354ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
68364ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell$echo
68374ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell$echo "Try \`$modename --help' for more information about other modes."
68384ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
6839a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerexit $?
68404ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
68414ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# The TAGs below are defined such that we never get into a situation
68424ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# in which we disable both kinds of libraries.  Given conflicting
68434ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# choices, we go for a static library, that is the most portable,
68444ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# since we can't tell whether shared libraries were disabled because
68454ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# the user asked for that or because the platform doesn't support
68464ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# them.  This is particularly important on AIX, because we don't
68474ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# support having both static and shared libraries enabled at the same
68484ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# time on that platform, so we default to a shared-only configuration.
68494ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# If a disable-shared tag is given, we'll fallback to a static-only
68504ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# configuration.  But we'll never go from static-only to shared-only.
68514ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
68524ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
6853a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerdisable_libs=shared
68544ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# ### END LIBTOOL TAG CONFIG: disable-shared
68554ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
68564ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# ### BEGIN LIBTOOL TAG CONFIG: disable-static
6857a773bd54f32ceb55af08286fe00c6ec1b73e5b9aReid Spencerdisable_libs=static
68584ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# ### END LIBTOOL TAG CONFIG: disable-static
68594ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell
68604ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# Local Variables:
68614ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# mode:shell-script
68624ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# sh-indentation:2
68634ea390d888b51dbd2c31516a3ed3c3f6ffdfef4eJohn Criswell# End:
6864