ltmain.sh revision 05b261ec
105b261ecSmrg# ltmain.sh - Provide generalized library-building support services.
205b261ecSmrg# NOTE: Changing this file will not affect anything until you rerun configure.
305b261ecSmrg#
405b261ecSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
505b261ecSmrg# 2007, 2008  Free Software Foundation, Inc.
605b261ecSmrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
705b261ecSmrg#
805b261ecSmrg# This program is free software; you can redistribute it and/or modify
905b261ecSmrg# it under the terms of the GNU General Public License as published by
1005b261ecSmrg# the Free Software Foundation; either version 2 of the License, or
1105b261ecSmrg# (at your option) any later version.
1205b261ecSmrg#
1305b261ecSmrg# This program is distributed in the hope that it will be useful, but
1405b261ecSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1505b261ecSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1605b261ecSmrg# General Public License for more details.
1705b261ecSmrg#
1805b261ecSmrg# You should have received a copy of the GNU General Public License
1905b261ecSmrg# along with this program; if not, write to the Free Software
2005b261ecSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2105b261ecSmrg#
2205b261ecSmrg# As a special exception to the GNU General Public License, if you
2305b261ecSmrg# distribute this file as part of a program that contains a
2405b261ecSmrg# configuration script generated by Autoconf, you may include it under
2505b261ecSmrg# the same distribution terms that you use for the rest of that program.
2605b261ecSmrg
2705b261ecSmrgbasename="s,^.*/,,g"
2805b261ecSmrg
2905b261ecSmrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
3005b261ecSmrg# is ksh but when the shell is invoked as "sh" and the current value of
3105b261ecSmrg# the _XPG environment variable is not equal to 1 (one), the special
3205b261ecSmrg# positional parameter $0, within a function call, is the name of the
3305b261ecSmrg# function.
3405b261ecSmrgprogpath="$0"
3505b261ecSmrg
3605b261ecSmrg# The name of this program:
3705b261ecSmrgprogname=`echo "$progpath" | $SED $basename`
3805b261ecSmrgmodename="$progname"
3905b261ecSmrg
4005b261ecSmrg# Global variables:
4105b261ecSmrgEXIT_SUCCESS=0
4205b261ecSmrgEXIT_FAILURE=1
4305b261ecSmrg
4405b261ecSmrgPROGRAM=ltmain.sh
4505b261ecSmrgPACKAGE=libtool
4605b261ecSmrgVERSION="1.5.26 Debian 1.5.26-4"
4705b261ecSmrgTIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)"
4805b261ecSmrg
4905b261ecSmrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5005b261ecSmrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
5105b261ecSmrg  emulate sh
5205b261ecSmrg  NULLCMD=:
5305b261ecSmrg  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
5405b261ecSmrg  # is contrary to our usage.  Disable this feature.
5505b261ecSmrg  alias -g '${1+"$@"}'='"$@"'
5605b261ecSmrg  setopt NO_GLOB_SUBST
5705b261ecSmrgelse
5805b261ecSmrg  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
5905b261ecSmrgfi
6005b261ecSmrgBIN_SH=xpg4; export BIN_SH # for Tru64
6105b261ecSmrgDUALCASE=1; export DUALCASE # for MKS sh
6205b261ecSmrg
6305b261ecSmrg# Check that we have a working $echo.
6405b261ecSmrgif test "X$1" = X--no-reexec; then
6505b261ecSmrg  # Discard the --no-reexec flag, and continue.
6605b261ecSmrg  shift
6705b261ecSmrgelif test "X$1" = X--fallback-echo; then
6805b261ecSmrg  # Avoid inline document here, it may be left over
6905b261ecSmrg  :
7005b261ecSmrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
7105b261ecSmrg  # Yippee, $echo works!
7205b261ecSmrg  :
7305b261ecSmrgelse
7405b261ecSmrg  # Restart under the correct shell, and then maybe $echo will work.
7505b261ecSmrg  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
7605b261ecSmrgfi
7705b261ecSmrg
7805b261ecSmrgif test "X$1" = X--fallback-echo; then
7905b261ecSmrg  # used as fallback echo
8005b261ecSmrg  shift
8105b261ecSmrg  cat <<EOF
8205b261ecSmrg$*
8305b261ecSmrgEOF
8405b261ecSmrg  exit $EXIT_SUCCESS
8505b261ecSmrgfi
8605b261ecSmrg
8705b261ecSmrgdefault_mode=
8805b261ecSmrghelp="Try \`$progname --help' for more information."
8905b261ecSmrgmagic="%%%MAGIC variable%%%"
9005b261ecSmrgmkdir="mkdir"
9105b261ecSmrgmv="mv -f"
9205b261ecSmrgrm="rm -f"
9305b261ecSmrg
9405b261ecSmrg# Sed substitution that helps us do robust quoting.  It backslashifies
9505b261ecSmrg# metacharacters that are still active within double-quoted strings.
9605b261ecSmrgXsed="${SED}"' -e 1s/^X//'
9705b261ecSmrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
9805b261ecSmrg# test EBCDIC or ASCII
9905b261ecSmrgcase `echo X|tr X '\101'` in
10005b261ecSmrg A) # ASCII based system
10105b261ecSmrg    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
10205b261ecSmrg  SP2NL='tr \040 \012'
10305b261ecSmrg  NL2SP='tr \015\012 \040\040'
10405b261ecSmrg  ;;
10505b261ecSmrg *) # EBCDIC based system
10605b261ecSmrg  SP2NL='tr \100 \n'
10705b261ecSmrg  NL2SP='tr \r\n \100\100'
10805b261ecSmrg  ;;
10905b261ecSmrgesac
11005b261ecSmrg
11105b261ecSmrg# NLS nuisances.
11205b261ecSmrg# Only set LANG and LC_ALL to C if already set.
11305b261ecSmrg# These must not be set unconditionally because not all systems understand
11405b261ecSmrg# e.g. LANG=C (notably SCO).
11505b261ecSmrg# We save the old values to restore during execute mode.
11605b261ecSmrglt_env=
11705b261ecSmrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
11805b261ecSmrgdo
11905b261ecSmrg  eval "if test \"\${$lt_var+set}\" = set; then
12005b261ecSmrg	  save_$lt_var=\$$lt_var
12105b261ecSmrg	  lt_env=\"$lt_var=\$$lt_var \$lt_env\"
12205b261ecSmrg	  $lt_var=C
12305b261ecSmrg	  export $lt_var
12405b261ecSmrg	fi"
12505b261ecSmrgdone
12605b261ecSmrg
12705b261ecSmrgif test -n "$lt_env"; then
12805b261ecSmrg  lt_env="env $lt_env"
12905b261ecSmrgfi
13005b261ecSmrg
13105b261ecSmrg# Make sure IFS has a sensible default
13205b261ecSmrglt_nl='
13305b261ecSmrg'
13405b261ecSmrgIFS=" 	$lt_nl"
13505b261ecSmrg
13605b261ecSmrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
13705b261ecSmrg  $echo "$modename: not configured to build any kind of library" 1>&2
13805b261ecSmrg  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
13905b261ecSmrg  exit $EXIT_FAILURE
14005b261ecSmrgfi
14105b261ecSmrg
14205b261ecSmrg# Global variables.
14305b261ecSmrgmode=$default_mode
14405b261ecSmrgnonopt=
14505b261ecSmrgprev=
14605b261ecSmrgprevopt=
14705b261ecSmrgrun=
14805b261ecSmrgshow="$echo"
14905b261ecSmrgshow_help=
15005b261ecSmrgexecute_dlfiles=
15105b261ecSmrgduplicate_deps=no
15205b261ecSmrgpreserve_args=
15305b261ecSmrglo2o="s/\\.lo\$/.${objext}/"
15405b261ecSmrgo2lo="s/\\.${objext}\$/.lo/"
15505b261ecSmrgextracted_archives=
15605b261ecSmrgextracted_serial=0
15705b261ecSmrg
15805b261ecSmrg#####################################
15905b261ecSmrg# Shell function definitions:
16005b261ecSmrg# This seems to be the best place for them
16105b261ecSmrg
16205b261ecSmrg# func_mktempdir [string]
16305b261ecSmrg# Make a temporary directory that won't clash with other running
16405b261ecSmrg# libtool processes, and avoids race conditions if possible.  If
16505b261ecSmrg# given, STRING is the basename for that directory.
16605b261ecSmrgfunc_mktempdir ()
16705b261ecSmrg{
16805b261ecSmrg    my_template="${TMPDIR-/tmp}/${1-$progname}"
16905b261ecSmrg
17005b261ecSmrg    if test "$run" = ":"; then
17105b261ecSmrg      # Return a directory name, but don't create it in dry-run mode
17205b261ecSmrg      my_tmpdir="${my_template}-$$"
17305b261ecSmrg    else
17405b261ecSmrg
17505b261ecSmrg      # If mktemp works, use that first and foremost
17605b261ecSmrg      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
17705b261ecSmrg
17805b261ecSmrg      if test ! -d "$my_tmpdir"; then
17905b261ecSmrg	# Failing that, at least try and use $RANDOM to avoid a race
18005b261ecSmrg	my_tmpdir="${my_template}-${RANDOM-0}$$"
18105b261ecSmrg
18205b261ecSmrg	save_mktempdir_umask=`umask`
18305b261ecSmrg	umask 0077
18405b261ecSmrg	$mkdir "$my_tmpdir"
18505b261ecSmrg	umask $save_mktempdir_umask
18605b261ecSmrg      fi
18705b261ecSmrg
18805b261ecSmrg      # If we're not in dry-run mode, bomb out on failure
18905b261ecSmrg      test -d "$my_tmpdir" || {
19005b261ecSmrg        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
19105b261ecSmrg	exit $EXIT_FAILURE
19205b261ecSmrg      }
19305b261ecSmrg    fi
19405b261ecSmrg
19505b261ecSmrg    $echo "X$my_tmpdir" | $Xsed
19605b261ecSmrg}
19705b261ecSmrg
19805b261ecSmrg
19905b261ecSmrg# func_win32_libid arg
20005b261ecSmrg# return the library type of file 'arg'
20105b261ecSmrg#
20205b261ecSmrg# Need a lot of goo to handle *both* DLLs and import libs
20305b261ecSmrg# Has to be a shell function in order to 'eat' the argument
20405b261ecSmrg# that is supplied when $file_magic_command is called.
20505b261ecSmrgfunc_win32_libid ()
20605b261ecSmrg{
20705b261ecSmrg  win32_libid_type="unknown"
20805b261ecSmrg  win32_fileres=`file -L $1 2>/dev/null`
20905b261ecSmrg  case $win32_fileres in
21005b261ecSmrg  *ar\ archive\ import\ library*) # definitely import
21105b261ecSmrg    win32_libid_type="x86 archive import"
21205b261ecSmrg    ;;
21305b261ecSmrg  *ar\ archive*) # could be an import, or static
21405b261ecSmrg    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
21505b261ecSmrg      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
21605b261ecSmrg      win32_nmres=`eval $NM -f posix -A $1 | \
21705b261ecSmrg	$SED -n -e '1,100{
21805b261ecSmrg		/ I /{
21905b261ecSmrg			s,.*,import,
22005b261ecSmrg			p
22105b261ecSmrg			q
22205b261ecSmrg			}
22305b261ecSmrg		}'`
22405b261ecSmrg      case $win32_nmres in
22505b261ecSmrg      import*)  win32_libid_type="x86 archive import";;
22605b261ecSmrg      *)        win32_libid_type="x86 archive static";;
22705b261ecSmrg      esac
22805b261ecSmrg    fi
22905b261ecSmrg    ;;
23005b261ecSmrg  *DLL*)
23105b261ecSmrg    win32_libid_type="x86 DLL"
23205b261ecSmrg    ;;
23305b261ecSmrg  *executable*) # but shell scripts are "executable" too...
23405b261ecSmrg    case $win32_fileres in
23505b261ecSmrg    *MS\ Windows\ PE\ Intel*)
23605b261ecSmrg      win32_libid_type="x86 DLL"
23705b261ecSmrg      ;;
23805b261ecSmrg    esac
23905b261ecSmrg    ;;
24005b261ecSmrg  esac
24105b261ecSmrg  $echo $win32_libid_type
24205b261ecSmrg}
24305b261ecSmrg
24405b261ecSmrg
24505b261ecSmrg# func_infer_tag arg
24605b261ecSmrg# Infer tagged configuration to use if any are available and
24705b261ecSmrg# if one wasn't chosen via the "--tag" command line option.
24805b261ecSmrg# Only attempt this if the compiler in the base compile
24905b261ecSmrg# command doesn't match the default compiler.
25005b261ecSmrg# arg is usually of the form 'gcc ...'
25105b261ecSmrgfunc_infer_tag ()
25205b261ecSmrg{
25305b261ecSmrg    if test -n "$available_tags" && test -z "$tagname"; then
25405b261ecSmrg      CC_quoted=
25505b261ecSmrg      for arg in $CC; do
25605b261ecSmrg	case $arg in
25705b261ecSmrg	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
25805b261ecSmrg	  arg="\"$arg\""
25905b261ecSmrg	  ;;
26005b261ecSmrg	esac
26105b261ecSmrg	CC_quoted="$CC_quoted $arg"
26205b261ecSmrg      done
26305b261ecSmrg      case $@ in
26405b261ecSmrg      # Blanks in the command may have been stripped by the calling shell,
26505b261ecSmrg      # but not from the CC environment variable when configure was run.
26605b261ecSmrg      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
26705b261ecSmrg      # Blanks at the start of $base_compile will cause this to fail
26805b261ecSmrg      # if we don't check for them as well.
26905b261ecSmrg      *)
27005b261ecSmrg	for z in $available_tags; do
27105b261ecSmrg	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
27205b261ecSmrg	    # Evaluate the configuration.
27305b261ecSmrg	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
27405b261ecSmrg	    CC_quoted=
27505b261ecSmrg	    for arg in $CC; do
27605b261ecSmrg	    # Double-quote args containing other shell metacharacters.
27705b261ecSmrg	    case $arg in
27805b261ecSmrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
27905b261ecSmrg	      arg="\"$arg\""
28005b261ecSmrg	      ;;
28105b261ecSmrg	    esac
28205b261ecSmrg	    CC_quoted="$CC_quoted $arg"
28305b261ecSmrg	  done
28405b261ecSmrg	    case "$@ " in
28505b261ecSmrg	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
28605b261ecSmrg	      # The compiler in the base compile command matches
28705b261ecSmrg	      # the one in the tagged configuration.
28805b261ecSmrg	      # Assume this is the tagged configuration we want.
28905b261ecSmrg	      tagname=$z
29005b261ecSmrg	      break
29105b261ecSmrg	      ;;
29205b261ecSmrg	    esac
29305b261ecSmrg	  fi
29405b261ecSmrg	done
29505b261ecSmrg	# If $tagname still isn't set, then no tagged configuration
29605b261ecSmrg	# was found and let the user know that the "--tag" command
29705b261ecSmrg	# line option must be used.
29805b261ecSmrg	if test -z "$tagname"; then
29905b261ecSmrg	  $echo "$modename: unable to infer tagged configuration"
30005b261ecSmrg	  $echo "$modename: specify a tag with \`--tag'" 1>&2
30105b261ecSmrg	  exit $EXIT_FAILURE
30205b261ecSmrg#        else
30305b261ecSmrg#          $echo "$modename: using $tagname tagged configuration"
30405b261ecSmrg	fi
30505b261ecSmrg	;;
30605b261ecSmrg      esac
30705b261ecSmrg    fi
30805b261ecSmrg}
30905b261ecSmrg
31005b261ecSmrg
31105b261ecSmrg# func_extract_an_archive dir oldlib
31205b261ecSmrgfunc_extract_an_archive ()
31305b261ecSmrg{
31405b261ecSmrg    f_ex_an_ar_dir="$1"; shift
31505b261ecSmrg    f_ex_an_ar_oldlib="$1"
31605b261ecSmrg
31705b261ecSmrg    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
31805b261ecSmrg    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
31905b261ecSmrg    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
32005b261ecSmrg     :
32105b261ecSmrg    else
32205b261ecSmrg      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
32305b261ecSmrg      exit $EXIT_FAILURE
32405b261ecSmrg    fi
32505b261ecSmrg}
32605b261ecSmrg
32705b261ecSmrg# func_extract_archives gentop oldlib ...
32805b261ecSmrgfunc_extract_archives ()
32905b261ecSmrg{
33005b261ecSmrg    my_gentop="$1"; shift
33105b261ecSmrg    my_oldlibs=${1+"$@"}
33205b261ecSmrg    my_oldobjs=""
33305b261ecSmrg    my_xlib=""
33405b261ecSmrg    my_xabs=""
33505b261ecSmrg    my_xdir=""
33605b261ecSmrg    my_status=""
33705b261ecSmrg
33805b261ecSmrg    $show "${rm}r $my_gentop"
33905b261ecSmrg    $run ${rm}r "$my_gentop"
34005b261ecSmrg    $show "$mkdir $my_gentop"
34105b261ecSmrg    $run $mkdir "$my_gentop"
34205b261ecSmrg    my_status=$?
34305b261ecSmrg    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
34405b261ecSmrg      exit $my_status
34505b261ecSmrg    fi
34605b261ecSmrg
34705b261ecSmrg    for my_xlib in $my_oldlibs; do
34805b261ecSmrg      # Extract the objects.
34905b261ecSmrg      case $my_xlib in
35005b261ecSmrg	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
35105b261ecSmrg	*) my_xabs=`pwd`"/$my_xlib" ;;
35205b261ecSmrg      esac
35305b261ecSmrg      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
35405b261ecSmrg      my_xlib_u=$my_xlib
35505b261ecSmrg      while :; do
35605b261ecSmrg        case " $extracted_archives " in
35705b261ecSmrg	*" $my_xlib_u "*)
35805b261ecSmrg	  extracted_serial=`expr $extracted_serial + 1`
35905b261ecSmrg	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
36005b261ecSmrg	*) break ;;
36105b261ecSmrg	esac
36205b261ecSmrg      done
36305b261ecSmrg      extracted_archives="$extracted_archives $my_xlib_u"
36405b261ecSmrg      my_xdir="$my_gentop/$my_xlib_u"
36505b261ecSmrg
36605b261ecSmrg      $show "${rm}r $my_xdir"
36705b261ecSmrg      $run ${rm}r "$my_xdir"
36805b261ecSmrg      $show "$mkdir $my_xdir"
36905b261ecSmrg      $run $mkdir "$my_xdir"
37005b261ecSmrg      exit_status=$?
37105b261ecSmrg      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
37205b261ecSmrg	exit $exit_status
37305b261ecSmrg      fi
37405b261ecSmrg      case $host in
37505b261ecSmrg      *-darwin*)
37605b261ecSmrg	$show "Extracting $my_xabs"
37705b261ecSmrg	# Do not bother doing anything if just a dry run
37805b261ecSmrg	if test -z "$run"; then
37905b261ecSmrg	  darwin_orig_dir=`pwd`
38005b261ecSmrg	  cd $my_xdir || exit $?
38105b261ecSmrg	  darwin_archive=$my_xabs
38205b261ecSmrg	  darwin_curdir=`pwd`
38305b261ecSmrg	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
38405b261ecSmrg	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
38505b261ecSmrg	  if test -n "$darwin_arches"; then 
38605b261ecSmrg	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
38705b261ecSmrg	    darwin_arch=
38805b261ecSmrg	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
38905b261ecSmrg	    for darwin_arch in  $darwin_arches ; do
39005b261ecSmrg	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
39105b261ecSmrg	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
39205b261ecSmrg	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
39305b261ecSmrg	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
39405b261ecSmrg	      cd "$darwin_curdir"
39505b261ecSmrg	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
39605b261ecSmrg	    done # $darwin_arches
39705b261ecSmrg      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
39805b261ecSmrg	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
39905b261ecSmrg	    darwin_file=
40005b261ecSmrg	    darwin_files=
40105b261ecSmrg	    for darwin_file in $darwin_filelist; do
40205b261ecSmrg	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
40305b261ecSmrg	      lipo -create -output "$darwin_file" $darwin_files
40405b261ecSmrg	    done # $darwin_filelist
40505b261ecSmrg	    ${rm}r unfat-$$
40605b261ecSmrg	    cd "$darwin_orig_dir"
40705b261ecSmrg	  else
40805b261ecSmrg	    cd "$darwin_orig_dir"
40905b261ecSmrg 	    func_extract_an_archive "$my_xdir" "$my_xabs"
41005b261ecSmrg	  fi # $darwin_arches
41105b261ecSmrg	fi # $run
41205b261ecSmrg	;;
41305b261ecSmrg      *)
41405b261ecSmrg        func_extract_an_archive "$my_xdir" "$my_xabs"
41505b261ecSmrg        ;;
41605b261ecSmrg      esac
41705b261ecSmrg      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
41805b261ecSmrg    done
41905b261ecSmrg    func_extract_archives_result="$my_oldobjs"
42005b261ecSmrg}
42105b261ecSmrg# End of Shell function definitions
42205b261ecSmrg#####################################
42305b261ecSmrg
42405b261ecSmrg# Darwin sucks
42505b261ecSmrgeval std_shrext=\"$shrext_cmds\"
42605b261ecSmrg
42705b261ecSmrgdisable_libs=no
42805b261ecSmrg
42905b261ecSmrg# Parse our command line options once, thoroughly.
43005b261ecSmrgwhile test "$#" -gt 0
43105b261ecSmrgdo
43205b261ecSmrg  arg="$1"
43305b261ecSmrg  shift
43405b261ecSmrg
43505b261ecSmrg  case $arg in
43605b261ecSmrg  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
43705b261ecSmrg  *) optarg= ;;
43805b261ecSmrg  esac
43905b261ecSmrg
44005b261ecSmrg  # If the previous option needs an argument, assign it.
44105b261ecSmrg  if test -n "$prev"; then
44205b261ecSmrg    case $prev in
44305b261ecSmrg    execute_dlfiles)
44405b261ecSmrg      execute_dlfiles="$execute_dlfiles $arg"
44505b261ecSmrg      ;;
44605b261ecSmrg    tag)
44705b261ecSmrg      tagname="$arg"
44805b261ecSmrg      preserve_args="${preserve_args}=$arg"
44905b261ecSmrg
45005b261ecSmrg      # Check whether tagname contains only valid characters
45105b261ecSmrg      case $tagname in
45205b261ecSmrg      *[!-_A-Za-z0-9,/]*)
45305b261ecSmrg	$echo "$progname: invalid tag name: $tagname" 1>&2
45405b261ecSmrg	exit $EXIT_FAILURE
45505b261ecSmrg	;;
45605b261ecSmrg      esac
45705b261ecSmrg
45805b261ecSmrg      case $tagname in
45905b261ecSmrg      CC)
46005b261ecSmrg	# Don't test for the "default" C tag, as we know, it's there, but
46105b261ecSmrg	# not specially marked.
46205b261ecSmrg	;;
46305b261ecSmrg      *)
46405b261ecSmrg	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
46505b261ecSmrg	  taglist="$taglist $tagname"
46605b261ecSmrg	  # Evaluate the configuration.
46705b261ecSmrg	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
46805b261ecSmrg	else
46905b261ecSmrg	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
47005b261ecSmrg	fi
47105b261ecSmrg	;;
47205b261ecSmrg      esac
47305b261ecSmrg      ;;
47405b261ecSmrg    *)
47505b261ecSmrg      eval "$prev=\$arg"
47605b261ecSmrg      ;;
47705b261ecSmrg    esac
47805b261ecSmrg
47905b261ecSmrg    prev=
48005b261ecSmrg    prevopt=
48105b261ecSmrg    continue
48205b261ecSmrg  fi
48305b261ecSmrg
48405b261ecSmrg  # Have we seen a non-optional argument yet?
48505b261ecSmrg  case $arg in
48605b261ecSmrg  --help)
48705b261ecSmrg    show_help=yes
48805b261ecSmrg    ;;
48905b261ecSmrg
49005b261ecSmrg  --version)
49105b261ecSmrg    echo "\
49205b261ecSmrg$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
49305b261ecSmrg
49405b261ecSmrgCopyright (C) 2008  Free Software Foundation, Inc.
49505b261ecSmrgThis is free software; see the source for copying conditions.  There is NO
49605b261ecSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
49705b261ecSmrg    exit $?
49805b261ecSmrg    ;;
49905b261ecSmrg
50005b261ecSmrg  --config)
50105b261ecSmrg    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
50205b261ecSmrg    # Now print the configurations for the tags.
50305b261ecSmrg    for tagname in $taglist; do
50405b261ecSmrg      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
50505b261ecSmrg    done
50605b261ecSmrg    exit $?
50705b261ecSmrg    ;;
50805b261ecSmrg
50905b261ecSmrg  --debug)
51005b261ecSmrg    $echo "$progname: enabling shell trace mode"
51105b261ecSmrg    set -x
51205b261ecSmrg    preserve_args="$preserve_args $arg"
51305b261ecSmrg    ;;
51405b261ecSmrg
51505b261ecSmrg  --dry-run | -n)
51605b261ecSmrg    run=:
51705b261ecSmrg    ;;
51805b261ecSmrg
51905b261ecSmrg  --features)
52005b261ecSmrg    $echo "host: $host"
52105b261ecSmrg    if test "$build_libtool_libs" = yes; then
52205b261ecSmrg      $echo "enable shared libraries"
52305b261ecSmrg    else
52405b261ecSmrg      $echo "disable shared libraries"
52505b261ecSmrg    fi
52605b261ecSmrg    if test "$build_old_libs" = yes; then
52705b261ecSmrg      $echo "enable static libraries"
52805b261ecSmrg    else
52905b261ecSmrg      $echo "disable static libraries"
53005b261ecSmrg    fi
53105b261ecSmrg    exit $?
53205b261ecSmrg    ;;
53305b261ecSmrg
53405b261ecSmrg  --finish) mode="finish" ;;
53505b261ecSmrg
53605b261ecSmrg  --mode) prevopt="--mode" prev=mode ;;
53705b261ecSmrg  --mode=*) mode="$optarg" ;;
53805b261ecSmrg
53905b261ecSmrg  --preserve-dup-deps) duplicate_deps="yes" ;;
54005b261ecSmrg
54105b261ecSmrg  --quiet | --silent)
54205b261ecSmrg    show=:
54305b261ecSmrg    preserve_args="$preserve_args $arg"
54405b261ecSmrg    ;;
54505b261ecSmrg
54605b261ecSmrg  --tag)
54705b261ecSmrg    prevopt="--tag"
54805b261ecSmrg    prev=tag
54905b261ecSmrg    preserve_args="$preserve_args --tag"
55005b261ecSmrg    ;;
55105b261ecSmrg  --tag=*)
55205b261ecSmrg    set tag "$optarg" ${1+"$@"}
55305b261ecSmrg    shift
55405b261ecSmrg    prev=tag
55505b261ecSmrg    preserve_args="$preserve_args --tag"
55605b261ecSmrg    ;;
55705b261ecSmrg
55805b261ecSmrg  -dlopen)
55905b261ecSmrg    prevopt="-dlopen"
56005b261ecSmrg    prev=execute_dlfiles
56105b261ecSmrg    ;;
56205b261ecSmrg
56305b261ecSmrg  -*)
56405b261ecSmrg    $echo "$modename: unrecognized option \`$arg'" 1>&2
56505b261ecSmrg    $echo "$help" 1>&2
56605b261ecSmrg    exit $EXIT_FAILURE
56705b261ecSmrg    ;;
56805b261ecSmrg
56905b261ecSmrg  *)
57005b261ecSmrg    nonopt="$arg"
57105b261ecSmrg    break
57205b261ecSmrg    ;;
57305b261ecSmrg  esac
57405b261ecSmrgdone
57505b261ecSmrg
57605b261ecSmrgif test -n "$prevopt"; then
57705b261ecSmrg  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
57805b261ecSmrg  $echo "$help" 1>&2
57905b261ecSmrg  exit $EXIT_FAILURE
58005b261ecSmrgfi
58105b261ecSmrg
58205b261ecSmrgcase $disable_libs in
58305b261ecSmrgno) 
58405b261ecSmrg  ;;
58505b261ecSmrgshared)
58605b261ecSmrg  build_libtool_libs=no
58705b261ecSmrg  build_old_libs=yes
58805b261ecSmrg  ;;
58905b261ecSmrgstatic)
59005b261ecSmrg  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
59105b261ecSmrg  ;;
59205b261ecSmrgesac
59305b261ecSmrg
59405b261ecSmrg# If this variable is set in any of the actions, the command in it
59505b261ecSmrg# will be execed at the end.  This prevents here-documents from being
59605b261ecSmrg# left over by shells.
59705b261ecSmrgexec_cmd=
59805b261ecSmrg
59905b261ecSmrgif test -z "$show_help"; then
60005b261ecSmrg
60105b261ecSmrg  # Infer the operation mode.
60205b261ecSmrg  if test -z "$mode"; then
60305b261ecSmrg    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
60405b261ecSmrg    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
60505b261ecSmrg    case $nonopt in
60605b261ecSmrg    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
60705b261ecSmrg      mode=link
60805b261ecSmrg      for arg
60905b261ecSmrg      do
61005b261ecSmrg	case $arg in
61105b261ecSmrg	-c)
61205b261ecSmrg	   mode=compile
61305b261ecSmrg	   break
61405b261ecSmrg	   ;;
61505b261ecSmrg	esac
61605b261ecSmrg      done
61705b261ecSmrg      ;;
61805b261ecSmrg    *db | *dbx | *strace | *truss)
61905b261ecSmrg      mode=execute
62005b261ecSmrg      ;;
62105b261ecSmrg    *install*|cp|mv)
62205b261ecSmrg      mode=install
62305b261ecSmrg      ;;
62405b261ecSmrg    *rm)
62505b261ecSmrg      mode=uninstall
62605b261ecSmrg      ;;
62705b261ecSmrg    *)
62805b261ecSmrg      # If we have no mode, but dlfiles were specified, then do execute mode.
62905b261ecSmrg      test -n "$execute_dlfiles" && mode=execute
63005b261ecSmrg
63105b261ecSmrg      # Just use the default operation mode.
63205b261ecSmrg      if test -z "$mode"; then
63305b261ecSmrg	if test -n "$nonopt"; then
63405b261ecSmrg	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
63505b261ecSmrg	else
63605b261ecSmrg	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
63705b261ecSmrg	fi
63805b261ecSmrg      fi
63905b261ecSmrg      ;;
64005b261ecSmrg    esac
64105b261ecSmrg  fi
64205b261ecSmrg
64305b261ecSmrg  # Only execute mode is allowed to have -dlopen flags.
64405b261ecSmrg  if test -n "$execute_dlfiles" && test "$mode" != execute; then
64505b261ecSmrg    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
64605b261ecSmrg    $echo "$help" 1>&2
64705b261ecSmrg    exit $EXIT_FAILURE
64805b261ecSmrg  fi
64905b261ecSmrg
65005b261ecSmrg  # Change the help message to a mode-specific one.
65105b261ecSmrg  generic_help="$help"
65205b261ecSmrg  help="Try \`$modename --help --mode=$mode' for more information."
65305b261ecSmrg
65405b261ecSmrg  # These modes are in order of execution frequency so that they run quickly.
65505b261ecSmrg  case $mode in
65605b261ecSmrg  # libtool compile mode
65705b261ecSmrg  compile)
65805b261ecSmrg    modename="$modename: compile"
65905b261ecSmrg    # Get the compilation command and the source file.
66005b261ecSmrg    base_compile=
66105b261ecSmrg    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
66205b261ecSmrg    suppress_opt=yes
66305b261ecSmrg    suppress_output=
66405b261ecSmrg    arg_mode=normal
66505b261ecSmrg    libobj=
66605b261ecSmrg    later=
66705b261ecSmrg
66805b261ecSmrg    for arg
66905b261ecSmrg    do
67005b261ecSmrg      case $arg_mode in
67105b261ecSmrg      arg  )
67205b261ecSmrg	# do not "continue".  Instead, add this to base_compile
67305b261ecSmrg	lastarg="$arg"
67405b261ecSmrg	arg_mode=normal
67505b261ecSmrg	;;
67605b261ecSmrg
67705b261ecSmrg      target )
67805b261ecSmrg	libobj="$arg"
67905b261ecSmrg	arg_mode=normal
68005b261ecSmrg	continue
68105b261ecSmrg	;;
68205b261ecSmrg
68305b261ecSmrg      normal )
68405b261ecSmrg	# Accept any command-line options.
68505b261ecSmrg	case $arg in
68605b261ecSmrg	-o)
68705b261ecSmrg	  if test -n "$libobj" ; then
68805b261ecSmrg	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
68905b261ecSmrg	    exit $EXIT_FAILURE
69005b261ecSmrg	  fi
69105b261ecSmrg	  arg_mode=target
69205b261ecSmrg	  continue
69305b261ecSmrg	  ;;
69405b261ecSmrg
69505b261ecSmrg	-static | -prefer-pic | -prefer-non-pic)
69605b261ecSmrg	  later="$later $arg"
69705b261ecSmrg	  continue
69805b261ecSmrg	  ;;
69905b261ecSmrg
70005b261ecSmrg	-no-suppress)
70105b261ecSmrg	  suppress_opt=no
70205b261ecSmrg	  continue
70305b261ecSmrg	  ;;
70405b261ecSmrg
70505b261ecSmrg	-Xcompiler)
70605b261ecSmrg	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
70705b261ecSmrg	  continue      #  The current "srcfile" will either be retained or
70805b261ecSmrg	  ;;            #  replaced later.  I would guess that would be a bug.
70905b261ecSmrg
71005b261ecSmrg	-Wc,*)
71105b261ecSmrg	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
71205b261ecSmrg	  lastarg=
71305b261ecSmrg	  save_ifs="$IFS"; IFS=','
71405b261ecSmrg 	  for arg in $args; do
71505b261ecSmrg	    IFS="$save_ifs"
71605b261ecSmrg
71705b261ecSmrg	    # Double-quote args containing other shell metacharacters.
71805b261ecSmrg	    # Many Bourne shells cannot handle close brackets correctly
71905b261ecSmrg	    # in scan sets, so we specify it separately.
72005b261ecSmrg	    case $arg in
72105b261ecSmrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
72205b261ecSmrg	      arg="\"$arg\""
72305b261ecSmrg	      ;;
72405b261ecSmrg	    esac
72505b261ecSmrg	    lastarg="$lastarg $arg"
72605b261ecSmrg	  done
72705b261ecSmrg	  IFS="$save_ifs"
72805b261ecSmrg	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
72905b261ecSmrg
73005b261ecSmrg	  # Add the arguments to base_compile.
73105b261ecSmrg	  base_compile="$base_compile $lastarg"
73205b261ecSmrg	  continue
73305b261ecSmrg	  ;;
73405b261ecSmrg
73505b261ecSmrg	* )
73605b261ecSmrg	  # Accept the current argument as the source file.
73705b261ecSmrg	  # The previous "srcfile" becomes the current argument.
73805b261ecSmrg	  #
73905b261ecSmrg	  lastarg="$srcfile"
74005b261ecSmrg	  srcfile="$arg"
74105b261ecSmrg	  ;;
74205b261ecSmrg	esac  #  case $arg
74305b261ecSmrg	;;
74405b261ecSmrg      esac    #  case $arg_mode
74505b261ecSmrg
74605b261ecSmrg      # Aesthetically quote the previous argument.
74705b261ecSmrg      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
74805b261ecSmrg
74905b261ecSmrg      case $lastarg in
75005b261ecSmrg      # Double-quote args containing other shell metacharacters.
75105b261ecSmrg      # Many Bourne shells cannot handle close brackets correctly
75205b261ecSmrg      # in scan sets, and some SunOS ksh mistreat backslash-escaping
75305b261ecSmrg      # in scan sets (worked around with variable expansion),
75405b261ecSmrg      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
75505b261ecSmrg      # at all, so we specify them separately.
75605b261ecSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
75705b261ecSmrg	lastarg="\"$lastarg\""
75805b261ecSmrg	;;
75905b261ecSmrg      esac
76005b261ecSmrg
76105b261ecSmrg      base_compile="$base_compile $lastarg"
76205b261ecSmrg    done # for arg
76305b261ecSmrg
76405b261ecSmrg    case $arg_mode in
76505b261ecSmrg    arg)
76605b261ecSmrg      $echo "$modename: you must specify an argument for -Xcompile"
76705b261ecSmrg      exit $EXIT_FAILURE
76805b261ecSmrg      ;;
76905b261ecSmrg    target)
77005b261ecSmrg      $echo "$modename: you must specify a target with \`-o'" 1>&2
77105b261ecSmrg      exit $EXIT_FAILURE
77205b261ecSmrg      ;;
77305b261ecSmrg    *)
77405b261ecSmrg      # Get the name of the library object.
77505b261ecSmrg      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
77605b261ecSmrg      ;;
77705b261ecSmrg    esac
77805b261ecSmrg
77905b261ecSmrg    # Recognize several different file suffixes.
78005b261ecSmrg    # If the user specifies -o file.o, it is replaced with file.lo
78105b261ecSmrg    xform='[cCFSifmso]'
78205b261ecSmrg    case $libobj in
78305b261ecSmrg    *.ada) xform=ada ;;
78405b261ecSmrg    *.adb) xform=adb ;;
78505b261ecSmrg    *.ads) xform=ads ;;
78605b261ecSmrg    *.asm) xform=asm ;;
78705b261ecSmrg    *.c++) xform=c++ ;;
78805b261ecSmrg    *.cc) xform=cc ;;
78905b261ecSmrg    *.ii) xform=ii ;;
79005b261ecSmrg    *.class) xform=class ;;
79105b261ecSmrg    *.cpp) xform=cpp ;;
79205b261ecSmrg    *.cxx) xform=cxx ;;
79305b261ecSmrg    *.[fF][09]?) xform=[fF][09]. ;;
79405b261ecSmrg    *.for) xform=for ;;
79505b261ecSmrg    *.java) xform=java ;;
79605b261ecSmrg    *.obj) xform=obj ;;
79705b261ecSmrg    *.sx) xform=sx ;;
79805b261ecSmrg    esac
79905b261ecSmrg
80005b261ecSmrg    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
80105b261ecSmrg
80205b261ecSmrg    case $libobj in
80305b261ecSmrg    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
80405b261ecSmrg    *)
80505b261ecSmrg      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
80605b261ecSmrg      exit $EXIT_FAILURE
80705b261ecSmrg      ;;
80805b261ecSmrg    esac
80905b261ecSmrg
81005b261ecSmrg    func_infer_tag $base_compile
81105b261ecSmrg
81205b261ecSmrg    for arg in $later; do
81305b261ecSmrg      case $arg in
81405b261ecSmrg      -static)
81505b261ecSmrg	build_old_libs=yes
81605b261ecSmrg	continue
81705b261ecSmrg	;;
81805b261ecSmrg
81905b261ecSmrg      -prefer-pic)
82005b261ecSmrg	pic_mode=yes
82105b261ecSmrg	continue
82205b261ecSmrg	;;
82305b261ecSmrg
82405b261ecSmrg      -prefer-non-pic)
82505b261ecSmrg	pic_mode=no
82605b261ecSmrg	continue
82705b261ecSmrg	;;
82805b261ecSmrg      esac
82905b261ecSmrg    done
83005b261ecSmrg
83105b261ecSmrg    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
83205b261ecSmrg    case $qlibobj in
83305b261ecSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
83405b261ecSmrg	qlibobj="\"$qlibobj\"" ;;
83505b261ecSmrg    esac
83605b261ecSmrg    test "X$libobj" != "X$qlibobj" \
83705b261ecSmrg	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
83805b261ecSmrg	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
83905b261ecSmrg    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
84005b261ecSmrg    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
84105b261ecSmrg    if test "X$xdir" = "X$obj"; then
84205b261ecSmrg      xdir=
84305b261ecSmrg    else
84405b261ecSmrg      xdir=$xdir/
84505b261ecSmrg    fi
84605b261ecSmrg    lobj=${xdir}$objdir/$objname
84705b261ecSmrg
84805b261ecSmrg    if test -z "$base_compile"; then
84905b261ecSmrg      $echo "$modename: you must specify a compilation command" 1>&2
85005b261ecSmrg      $echo "$help" 1>&2
85105b261ecSmrg      exit $EXIT_FAILURE
85205b261ecSmrg    fi
85305b261ecSmrg
85405b261ecSmrg    # Delete any leftover library objects.
85505b261ecSmrg    if test "$build_old_libs" = yes; then
85605b261ecSmrg      removelist="$obj $lobj $libobj ${libobj}T"
85705b261ecSmrg    else
85805b261ecSmrg      removelist="$lobj $libobj ${libobj}T"
85905b261ecSmrg    fi
86005b261ecSmrg
86105b261ecSmrg    $run $rm $removelist
86205b261ecSmrg    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
86305b261ecSmrg
86405b261ecSmrg    # On Cygwin there's no "real" PIC flag so we must build both object types
86505b261ecSmrg    case $host_os in
86605b261ecSmrg    cygwin* | mingw* | pw32* | os2*)
86705b261ecSmrg      pic_mode=default
86805b261ecSmrg      ;;
86905b261ecSmrg    esac
87005b261ecSmrg    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
87105b261ecSmrg      # non-PIC code in shared libraries is not supported
87205b261ecSmrg      pic_mode=default
87305b261ecSmrg    fi
87405b261ecSmrg
87505b261ecSmrg    # Calculate the filename of the output object if compiler does
87605b261ecSmrg    # not support -o with -c
87705b261ecSmrg    if test "$compiler_c_o" = no; then
87805b261ecSmrg      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
87905b261ecSmrg      lockfile="$output_obj.lock"
88005b261ecSmrg      removelist="$removelist $output_obj $lockfile"
88105b261ecSmrg      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
88205b261ecSmrg    else
88305b261ecSmrg      output_obj=
88405b261ecSmrg      need_locks=no
88505b261ecSmrg      lockfile=
88605b261ecSmrg    fi
88705b261ecSmrg
88805b261ecSmrg    # Lock this critical section if it is needed
88905b261ecSmrg    # We use this script file to make the link, it avoids creating a new file
89005b261ecSmrg    if test "$need_locks" = yes; then
89105b261ecSmrg      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
89205b261ecSmrg	$show "Waiting for $lockfile to be removed"
89305b261ecSmrg	sleep 2
89405b261ecSmrg      done
89505b261ecSmrg    elif test "$need_locks" = warn; then
89605b261ecSmrg      if test -f "$lockfile"; then
89705b261ecSmrg	$echo "\
89805b261ecSmrg*** ERROR, $lockfile exists and contains:
89905b261ecSmrg`cat $lockfile 2>/dev/null`
90005b261ecSmrg
90105b261ecSmrgThis indicates that another process is trying to use the same
90205b261ecSmrgtemporary object file, and libtool could not work around it because
90305b261ecSmrgyour compiler does not support \`-c' and \`-o' together.  If you
90405b261ecSmrgrepeat this compilation, it may succeed, by chance, but you had better
90505b261ecSmrgavoid parallel builds (make -j) in this platform, or get a better
90605b261ecSmrgcompiler."
90705b261ecSmrg
90805b261ecSmrg	$run $rm $removelist
90905b261ecSmrg	exit $EXIT_FAILURE
91005b261ecSmrg      fi
91105b261ecSmrg      $echo "$srcfile" > "$lockfile"
91205b261ecSmrg    fi
91305b261ecSmrg
91405b261ecSmrg    if test -n "$fix_srcfile_path"; then
91505b261ecSmrg      eval srcfile=\"$fix_srcfile_path\"
91605b261ecSmrg    fi
91705b261ecSmrg    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
91805b261ecSmrg    case $qsrcfile in
91905b261ecSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
92005b261ecSmrg      qsrcfile="\"$qsrcfile\"" ;;
92105b261ecSmrg    esac
92205b261ecSmrg
92305b261ecSmrg    $run $rm "$libobj" "${libobj}T"
92405b261ecSmrg
92505b261ecSmrg    # Create a libtool object file (analogous to a ".la" file),
92605b261ecSmrg    # but don't create it if we're doing a dry run.
92705b261ecSmrg    test -z "$run" && cat > ${libobj}T <<EOF
92805b261ecSmrg# $libobj - a libtool object file
92905b261ecSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
93005b261ecSmrg#
93105b261ecSmrg# Please DO NOT delete this file!
93205b261ecSmrg# It is necessary for linking the library.
93305b261ecSmrg
93405b261ecSmrg# Name of the PIC object.
93505b261ecSmrgEOF
93605b261ecSmrg
93705b261ecSmrg    # Only build a PIC object if we are building libtool libraries.
93805b261ecSmrg    if test "$build_libtool_libs" = yes; then
93905b261ecSmrg      # Without this assignment, base_compile gets emptied.
94005b261ecSmrg      fbsd_hideous_sh_bug=$base_compile
94105b261ecSmrg
94205b261ecSmrg      if test "$pic_mode" != no; then
94305b261ecSmrg	command="$base_compile $qsrcfile $pic_flag"
94405b261ecSmrg      else
94505b261ecSmrg	# Don't build PIC code
94605b261ecSmrg	command="$base_compile $qsrcfile"
94705b261ecSmrg      fi
94805b261ecSmrg
94905b261ecSmrg      if test ! -d "${xdir}$objdir"; then
95005b261ecSmrg	$show "$mkdir ${xdir}$objdir"
95105b261ecSmrg	$run $mkdir ${xdir}$objdir
95205b261ecSmrg	exit_status=$?
95305b261ecSmrg	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
95405b261ecSmrg	  exit $exit_status
95505b261ecSmrg	fi
95605b261ecSmrg      fi
95705b261ecSmrg
95805b261ecSmrg      if test -z "$output_obj"; then
95905b261ecSmrg	# Place PIC objects in $objdir
96005b261ecSmrg	command="$command -o $lobj"
96105b261ecSmrg      fi
96205b261ecSmrg
96305b261ecSmrg      $run $rm "$lobj" "$output_obj"
96405b261ecSmrg
96505b261ecSmrg      $show "$command"
96605b261ecSmrg      if $run eval $lt_env "$command"; then :
96705b261ecSmrg      else
96805b261ecSmrg	test -n "$output_obj" && $run $rm $removelist
96905b261ecSmrg	exit $EXIT_FAILURE
97005b261ecSmrg      fi
97105b261ecSmrg
97205b261ecSmrg      if test "$need_locks" = warn &&
97305b261ecSmrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
97405b261ecSmrg	$echo "\
97505b261ecSmrg*** ERROR, $lockfile contains:
97605b261ecSmrg`cat $lockfile 2>/dev/null`
97705b261ecSmrg
97805b261ecSmrgbut it should contain:
97905b261ecSmrg$srcfile
98005b261ecSmrg
98105b261ecSmrgThis indicates that another process is trying to use the same
98205b261ecSmrgtemporary object file, and libtool could not work around it because
98305b261ecSmrgyour compiler does not support \`-c' and \`-o' together.  If you
98405b261ecSmrgrepeat this compilation, it may succeed, by chance, but you had better
98505b261ecSmrgavoid parallel builds (make -j) in this platform, or get a better
98605b261ecSmrgcompiler."
98705b261ecSmrg
98805b261ecSmrg	$run $rm $removelist
98905b261ecSmrg	exit $EXIT_FAILURE
99005b261ecSmrg      fi
99105b261ecSmrg
99205b261ecSmrg      # Just move the object if needed, then go on to compile the next one
99305b261ecSmrg      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
99405b261ecSmrg	$show "$mv $output_obj $lobj"
99505b261ecSmrg	if $run $mv $output_obj $lobj; then :
99605b261ecSmrg	else
99705b261ecSmrg	  error=$?
99805b261ecSmrg	  $run $rm $removelist
99905b261ecSmrg	  exit $error
100005b261ecSmrg	fi
100105b261ecSmrg      fi
100205b261ecSmrg
100305b261ecSmrg      # Append the name of the PIC object to the libtool object file.
100405b261ecSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
100505b261ecSmrgpic_object='$objdir/$objname'
100605b261ecSmrg
100705b261ecSmrgEOF
100805b261ecSmrg
100905b261ecSmrg      # Allow error messages only from the first compilation.
101005b261ecSmrg      if test "$suppress_opt" = yes; then
101105b261ecSmrg        suppress_output=' >/dev/null 2>&1'
101205b261ecSmrg      fi
101305b261ecSmrg    else
101405b261ecSmrg      # No PIC object so indicate it doesn't exist in the libtool
101505b261ecSmrg      # object file.
101605b261ecSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
101705b261ecSmrgpic_object=none
101805b261ecSmrg
101905b261ecSmrgEOF
102005b261ecSmrg    fi
102105b261ecSmrg
102205b261ecSmrg    # Only build a position-dependent object if we build old libraries.
102305b261ecSmrg    if test "$build_old_libs" = yes; then
102405b261ecSmrg      if test "$pic_mode" != yes; then
102505b261ecSmrg	# Don't build PIC code
102605b261ecSmrg	command="$base_compile $qsrcfile"
102705b261ecSmrg      else
102805b261ecSmrg	command="$base_compile $qsrcfile $pic_flag"
102905b261ecSmrg      fi
103005b261ecSmrg      if test "$compiler_c_o" = yes; then
103105b261ecSmrg	command="$command -o $obj"
103205b261ecSmrg      fi
103305b261ecSmrg
103405b261ecSmrg      # Suppress compiler output if we already did a PIC compilation.
103505b261ecSmrg      command="$command$suppress_output"
103605b261ecSmrg      $run $rm "$obj" "$output_obj"
103705b261ecSmrg      $show "$command"
103805b261ecSmrg      if $run eval $lt_env "$command"; then :
103905b261ecSmrg      else
104005b261ecSmrg	$run $rm $removelist
104105b261ecSmrg	exit $EXIT_FAILURE
104205b261ecSmrg      fi
104305b261ecSmrg
104405b261ecSmrg      if test "$need_locks" = warn &&
104505b261ecSmrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
104605b261ecSmrg	$echo "\
104705b261ecSmrg*** ERROR, $lockfile contains:
104805b261ecSmrg`cat $lockfile 2>/dev/null`
104905b261ecSmrg
105005b261ecSmrgbut it should contain:
105105b261ecSmrg$srcfile
105205b261ecSmrg
105305b261ecSmrgThis indicates that another process is trying to use the same
105405b261ecSmrgtemporary object file, and libtool could not work around it because
105505b261ecSmrgyour compiler does not support \`-c' and \`-o' together.  If you
105605b261ecSmrgrepeat this compilation, it may succeed, by chance, but you had better
105705b261ecSmrgavoid parallel builds (make -j) in this platform, or get a better
105805b261ecSmrgcompiler."
105905b261ecSmrg
106005b261ecSmrg	$run $rm $removelist
106105b261ecSmrg	exit $EXIT_FAILURE
106205b261ecSmrg      fi
106305b261ecSmrg
106405b261ecSmrg      # Just move the object if needed
106505b261ecSmrg      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
106605b261ecSmrg	$show "$mv $output_obj $obj"
106705b261ecSmrg	if $run $mv $output_obj $obj; then :
106805b261ecSmrg	else
106905b261ecSmrg	  error=$?
107005b261ecSmrg	  $run $rm $removelist
107105b261ecSmrg	  exit $error
107205b261ecSmrg	fi
107305b261ecSmrg      fi
107405b261ecSmrg
107505b261ecSmrg      # Append the name of the non-PIC object the libtool object file.
107605b261ecSmrg      # Only append if the libtool object file exists.
107705b261ecSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
107805b261ecSmrg# Name of the non-PIC object.
107905b261ecSmrgnon_pic_object='$objname'
108005b261ecSmrg
108105b261ecSmrgEOF
108205b261ecSmrg    else
108305b261ecSmrg      # Append the name of the non-PIC object the libtool object file.
108405b261ecSmrg      # Only append if the libtool object file exists.
108505b261ecSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
108605b261ecSmrg# Name of the non-PIC object.
108705b261ecSmrgnon_pic_object=none
108805b261ecSmrg
108905b261ecSmrgEOF
109005b261ecSmrg    fi
109105b261ecSmrg
109205b261ecSmrg    $run $mv "${libobj}T" "${libobj}"
109305b261ecSmrg
109405b261ecSmrg    # Unlock the critical section if it was locked
109505b261ecSmrg    if test "$need_locks" != no; then
109605b261ecSmrg      $run $rm "$lockfile"
109705b261ecSmrg    fi
109805b261ecSmrg
109905b261ecSmrg    exit $EXIT_SUCCESS
110005b261ecSmrg    ;;
110105b261ecSmrg
110205b261ecSmrg  # libtool link mode
110305b261ecSmrg  link | relink)
110405b261ecSmrg    modename="$modename: link"
110505b261ecSmrg    case $host in
110605b261ecSmrg    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
110705b261ecSmrg      # It is impossible to link a dll without this setting, and
110805b261ecSmrg      # we shouldn't force the makefile maintainer to figure out
110905b261ecSmrg      # which system we are compiling for in order to pass an extra
111005b261ecSmrg      # flag for every libtool invocation.
111105b261ecSmrg      # allow_undefined=no
111205b261ecSmrg
111305b261ecSmrg      # FIXME: Unfortunately, there are problems with the above when trying
111405b261ecSmrg      # to make a dll which has undefined symbols, in which case not
111505b261ecSmrg      # even a static library is built.  For now, we need to specify
111605b261ecSmrg      # -no-undefined on the libtool link line when we can be certain
111705b261ecSmrg      # that all symbols are satisfied, otherwise we get a static library.
111805b261ecSmrg      allow_undefined=yes
111905b261ecSmrg      ;;
112005b261ecSmrg    *)
112105b261ecSmrg      allow_undefined=yes
112205b261ecSmrg      ;;
112305b261ecSmrg    esac
112405b261ecSmrg    libtool_args="$nonopt"
112505b261ecSmrg    base_compile="$nonopt $@"
112605b261ecSmrg    compile_command="$nonopt"
112705b261ecSmrg    finalize_command="$nonopt"
112805b261ecSmrg
112905b261ecSmrg    compile_rpath=
113005b261ecSmrg    finalize_rpath=
113105b261ecSmrg    compile_shlibpath=
113205b261ecSmrg    finalize_shlibpath=
113305b261ecSmrg    convenience=
113405b261ecSmrg    old_convenience=
113505b261ecSmrg    deplibs=
113605b261ecSmrg    old_deplibs=
113705b261ecSmrg    compiler_flags=
113805b261ecSmrg    linker_flags=
113905b261ecSmrg    dllsearchpath=
114005b261ecSmrg    lib_search_path=`pwd`
114105b261ecSmrg    inst_prefix_dir=
114205b261ecSmrg
114305b261ecSmrg    avoid_version=no
114405b261ecSmrg    dlfiles=
114505b261ecSmrg    dlprefiles=
114605b261ecSmrg    dlself=no
114705b261ecSmrg    export_dynamic=no
114805b261ecSmrg    export_symbols=
114905b261ecSmrg    export_symbols_regex=
115005b261ecSmrg    generated=
115105b261ecSmrg    libobjs=
115205b261ecSmrg    ltlibs=
115305b261ecSmrg    module=no
115405b261ecSmrg    no_install=no
115505b261ecSmrg    objs=
115605b261ecSmrg    non_pic_objects=
115705b261ecSmrg    notinst_path= # paths that contain not-installed libtool libraries
115805b261ecSmrg    precious_files_regex=
115905b261ecSmrg    prefer_static_libs=no
116005b261ecSmrg    preload=no
116105b261ecSmrg    prev=
116205b261ecSmrg    prevarg=
116305b261ecSmrg    release=
116405b261ecSmrg    rpath=
116505b261ecSmrg    xrpath=
116605b261ecSmrg    perm_rpath=
116705b261ecSmrg    temp_rpath=
116805b261ecSmrg    thread_safe=no
116905b261ecSmrg    vinfo=
117005b261ecSmrg    vinfo_number=no
117105b261ecSmrg    single_module="${wl}-single_module"
117205b261ecSmrg
117305b261ecSmrg    func_infer_tag $base_compile
117405b261ecSmrg
117505b261ecSmrg    # We need to know -static, to get the right output filenames.
117605b261ecSmrg    for arg
117705b261ecSmrg    do
117805b261ecSmrg      case $arg in
117905b261ecSmrg      -all-static | -static | -static-libtool-libs)
118005b261ecSmrg	case $arg in
118105b261ecSmrg	-all-static)
118205b261ecSmrg	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
118305b261ecSmrg	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
118405b261ecSmrg	  fi
118505b261ecSmrg	  if test -n "$link_static_flag"; then
118605b261ecSmrg	    dlopen_self=$dlopen_self_static
118705b261ecSmrg	  fi
118805b261ecSmrg	  prefer_static_libs=yes
118905b261ecSmrg	  ;;
119005b261ecSmrg	-static)
119105b261ecSmrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
119205b261ecSmrg	    dlopen_self=$dlopen_self_static
119305b261ecSmrg	  fi
119405b261ecSmrg	  prefer_static_libs=built
119505b261ecSmrg	  ;;
119605b261ecSmrg	-static-libtool-libs)
119705b261ecSmrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
119805b261ecSmrg	    dlopen_self=$dlopen_self_static
119905b261ecSmrg	  fi
120005b261ecSmrg	  prefer_static_libs=yes
120105b261ecSmrg	  ;;
120205b261ecSmrg	esac
120305b261ecSmrg	build_libtool_libs=no
120405b261ecSmrg	build_old_libs=yes
120505b261ecSmrg	break
120605b261ecSmrg	;;
120705b261ecSmrg      esac
120805b261ecSmrg    done
120905b261ecSmrg
121005b261ecSmrg    # See if our shared archives depend on static archives.
121105b261ecSmrg    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
121205b261ecSmrg
121305b261ecSmrg    # Go through the arguments, transforming them on the way.
121405b261ecSmrg    while test "$#" -gt 0; do
121505b261ecSmrg      arg="$1"
121605b261ecSmrg      shift
121705b261ecSmrg      case $arg in
121805b261ecSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
121905b261ecSmrg	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
122005b261ecSmrg	;;
122105b261ecSmrg      *) qarg=$arg ;;
122205b261ecSmrg      esac
122305b261ecSmrg      libtool_args="$libtool_args $qarg"
122405b261ecSmrg
122505b261ecSmrg      # If the previous option needs an argument, assign it.
122605b261ecSmrg      if test -n "$prev"; then
122705b261ecSmrg	case $prev in
122805b261ecSmrg	output)
122905b261ecSmrg	  compile_command="$compile_command @OUTPUT@"
123005b261ecSmrg	  finalize_command="$finalize_command @OUTPUT@"
123105b261ecSmrg	  ;;
123205b261ecSmrg	esac
123305b261ecSmrg
123405b261ecSmrg	case $prev in
123505b261ecSmrg	dlfiles|dlprefiles)
123605b261ecSmrg	  if test "$preload" = no; then
123705b261ecSmrg	    # Add the symbol object into the linking commands.
123805b261ecSmrg	    compile_command="$compile_command @SYMFILE@"
123905b261ecSmrg	    finalize_command="$finalize_command @SYMFILE@"
124005b261ecSmrg	    preload=yes
124105b261ecSmrg	  fi
124205b261ecSmrg	  case $arg in
124305b261ecSmrg	  *.la | *.lo) ;;  # We handle these cases below.
124405b261ecSmrg	  force)
124505b261ecSmrg	    if test "$dlself" = no; then
124605b261ecSmrg	      dlself=needless
124705b261ecSmrg	      export_dynamic=yes
124805b261ecSmrg	    fi
124905b261ecSmrg	    prev=
125005b261ecSmrg	    continue
125105b261ecSmrg	    ;;
125205b261ecSmrg	  self)
125305b261ecSmrg	    if test "$prev" = dlprefiles; then
125405b261ecSmrg	      dlself=yes
125505b261ecSmrg	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
125605b261ecSmrg	      dlself=yes
125705b261ecSmrg	    else
125805b261ecSmrg	      dlself=needless
125905b261ecSmrg	      export_dynamic=yes
126005b261ecSmrg	    fi
126105b261ecSmrg	    prev=
126205b261ecSmrg	    continue
126305b261ecSmrg	    ;;
126405b261ecSmrg	  *)
126505b261ecSmrg	    if test "$prev" = dlfiles; then
126605b261ecSmrg	      dlfiles="$dlfiles $arg"
126705b261ecSmrg	    else
126805b261ecSmrg	      dlprefiles="$dlprefiles $arg"
126905b261ecSmrg	    fi
127005b261ecSmrg	    prev=
127105b261ecSmrg	    continue
127205b261ecSmrg	    ;;
127305b261ecSmrg	  esac
127405b261ecSmrg	  ;;
127505b261ecSmrg	expsyms)
127605b261ecSmrg	  export_symbols="$arg"
127705b261ecSmrg	  if test ! -f "$arg"; then
127805b261ecSmrg	    $echo "$modename: symbol file \`$arg' does not exist"
127905b261ecSmrg	    exit $EXIT_FAILURE
128005b261ecSmrg	  fi
128105b261ecSmrg	  prev=
128205b261ecSmrg	  continue
128305b261ecSmrg	  ;;
128405b261ecSmrg	expsyms_regex)
128505b261ecSmrg	  export_symbols_regex="$arg"
128605b261ecSmrg	  prev=
128705b261ecSmrg	  continue
128805b261ecSmrg	  ;;
128905b261ecSmrg	inst_prefix)
129005b261ecSmrg	  inst_prefix_dir="$arg"
129105b261ecSmrg	  prev=
129205b261ecSmrg	  continue
129305b261ecSmrg	  ;;
129405b261ecSmrg	precious_regex)
129505b261ecSmrg	  precious_files_regex="$arg"
129605b261ecSmrg	  prev=
129705b261ecSmrg	  continue
129805b261ecSmrg	  ;;
129905b261ecSmrg	release)
130005b261ecSmrg	  release="-$arg"
130105b261ecSmrg	  prev=
130205b261ecSmrg	  continue
130305b261ecSmrg	  ;;
130405b261ecSmrg	objectlist)
130505b261ecSmrg	  if test -f "$arg"; then
130605b261ecSmrg	    save_arg=$arg
130705b261ecSmrg	    moreargs=
130805b261ecSmrg	    for fil in `cat $save_arg`
130905b261ecSmrg	    do
131005b261ecSmrg#	      moreargs="$moreargs $fil"
131105b261ecSmrg	      arg=$fil
131205b261ecSmrg	      # A libtool-controlled object.
131305b261ecSmrg
131405b261ecSmrg	      # Check to see that this really is a libtool object.
131505b261ecSmrg	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
131605b261ecSmrg		pic_object=
131705b261ecSmrg		non_pic_object=
131805b261ecSmrg
131905b261ecSmrg		# Read the .lo file
132005b261ecSmrg		# If there is no directory component, then add one.
132105b261ecSmrg		case $arg in
132205b261ecSmrg		*/* | *\\*) . $arg ;;
132305b261ecSmrg		*) . ./$arg ;;
132405b261ecSmrg		esac
132505b261ecSmrg
132605b261ecSmrg		if test -z "$pic_object" || \
132705b261ecSmrg		   test -z "$non_pic_object" ||
132805b261ecSmrg		   test "$pic_object" = none && \
132905b261ecSmrg		   test "$non_pic_object" = none; then
133005b261ecSmrg		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
133105b261ecSmrg		  exit $EXIT_FAILURE
133205b261ecSmrg		fi
133305b261ecSmrg
133405b261ecSmrg		# Extract subdirectory from the argument.
133505b261ecSmrg		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
133605b261ecSmrg		if test "X$xdir" = "X$arg"; then
133705b261ecSmrg		  xdir=
133805b261ecSmrg		else
133905b261ecSmrg		  xdir="$xdir/"
134005b261ecSmrg		fi
134105b261ecSmrg
134205b261ecSmrg		if test "$pic_object" != none; then
134305b261ecSmrg		  # Prepend the subdirectory the object is found in.
134405b261ecSmrg		  pic_object="$xdir$pic_object"
134505b261ecSmrg
134605b261ecSmrg		  if test "$prev" = dlfiles; then
134705b261ecSmrg		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
134805b261ecSmrg		      dlfiles="$dlfiles $pic_object"
134905b261ecSmrg		      prev=
135005b261ecSmrg		      continue
135105b261ecSmrg		    else
135205b261ecSmrg		      # If libtool objects are unsupported, then we need to preload.
135305b261ecSmrg		      prev=dlprefiles
135405b261ecSmrg		    fi
135505b261ecSmrg		  fi
135605b261ecSmrg
135705b261ecSmrg		  # CHECK ME:  I think I busted this.  -Ossama
135805b261ecSmrg		  if test "$prev" = dlprefiles; then
135905b261ecSmrg		    # Preload the old-style object.
136005b261ecSmrg		    dlprefiles="$dlprefiles $pic_object"
136105b261ecSmrg		    prev=
136205b261ecSmrg		  fi
136305b261ecSmrg
136405b261ecSmrg		  # A PIC object.
136505b261ecSmrg		  libobjs="$libobjs $pic_object"
136605b261ecSmrg		  arg="$pic_object"
136705b261ecSmrg		fi
136805b261ecSmrg
136905b261ecSmrg		# Non-PIC object.
137005b261ecSmrg		if test "$non_pic_object" != none; then
137105b261ecSmrg		  # Prepend the subdirectory the object is found in.
137205b261ecSmrg		  non_pic_object="$xdir$non_pic_object"
137305b261ecSmrg
137405b261ecSmrg		  # A standard non-PIC object
137505b261ecSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
137605b261ecSmrg		  if test -z "$pic_object" || test "$pic_object" = none ; then
137705b261ecSmrg		    arg="$non_pic_object"
137805b261ecSmrg		  fi
137905b261ecSmrg		else
138005b261ecSmrg		  # If the PIC object exists, use it instead.
138105b261ecSmrg		  # $xdir was prepended to $pic_object above.
138205b261ecSmrg		  non_pic_object="$pic_object"
138305b261ecSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
138405b261ecSmrg		fi
138505b261ecSmrg	      else
138605b261ecSmrg		# Only an error if not doing a dry-run.
138705b261ecSmrg		if test -z "$run"; then
138805b261ecSmrg		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
138905b261ecSmrg		  exit $EXIT_FAILURE
139005b261ecSmrg		else
139105b261ecSmrg		  # Dry-run case.
139205b261ecSmrg
139305b261ecSmrg		  # Extract subdirectory from the argument.
139405b261ecSmrg		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
139505b261ecSmrg		  if test "X$xdir" = "X$arg"; then
139605b261ecSmrg		    xdir=
139705b261ecSmrg		  else
139805b261ecSmrg		    xdir="$xdir/"
139905b261ecSmrg		  fi
140005b261ecSmrg
140105b261ecSmrg		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
140205b261ecSmrg		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
140305b261ecSmrg		  libobjs="$libobjs $pic_object"
140405b261ecSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
140505b261ecSmrg		fi
140605b261ecSmrg	      fi
140705b261ecSmrg	    done
140805b261ecSmrg	  else
140905b261ecSmrg	    $echo "$modename: link input file \`$save_arg' does not exist"
141005b261ecSmrg	    exit $EXIT_FAILURE
141105b261ecSmrg	  fi
141205b261ecSmrg	  arg=$save_arg
141305b261ecSmrg	  prev=
141405b261ecSmrg	  continue
141505b261ecSmrg	  ;;
141605b261ecSmrg	rpath | xrpath)
141705b261ecSmrg	  # We need an absolute path.
141805b261ecSmrg	  case $arg in
141905b261ecSmrg	  [\\/]* | [A-Za-z]:[\\/]*) ;;
142005b261ecSmrg	  *)
142105b261ecSmrg	    $echo "$modename: only absolute run-paths are allowed" 1>&2
142205b261ecSmrg	    exit $EXIT_FAILURE
142305b261ecSmrg	    ;;
142405b261ecSmrg	  esac
142505b261ecSmrg	  if test "$prev" = rpath; then
142605b261ecSmrg	    case "$rpath " in
142705b261ecSmrg	    *" $arg "*) ;;
142805b261ecSmrg	    *) rpath="$rpath $arg" ;;
142905b261ecSmrg	    esac
143005b261ecSmrg	  else
143105b261ecSmrg	    case "$xrpath " in
143205b261ecSmrg	    *" $arg "*) ;;
143305b261ecSmrg	    *) xrpath="$xrpath $arg" ;;
143405b261ecSmrg	    esac
143505b261ecSmrg	  fi
143605b261ecSmrg	  prev=
143705b261ecSmrg	  continue
143805b261ecSmrg	  ;;
143905b261ecSmrg	xcompiler)
144005b261ecSmrg	  compiler_flags="$compiler_flags $qarg"
144105b261ecSmrg	  prev=
144205b261ecSmrg	  compile_command="$compile_command $qarg"
144305b261ecSmrg	  finalize_command="$finalize_command $qarg"
144405b261ecSmrg	  continue
144505b261ecSmrg	  ;;
144605b261ecSmrg	xlinker)
144705b261ecSmrg	  linker_flags="$linker_flags $qarg"
144805b261ecSmrg	  compiler_flags="$compiler_flags $wl$qarg"
144905b261ecSmrg	  prev=
145005b261ecSmrg	  compile_command="$compile_command $wl$qarg"
145105b261ecSmrg	  finalize_command="$finalize_command $wl$qarg"
145205b261ecSmrg	  continue
145305b261ecSmrg	  ;;
145405b261ecSmrg	xcclinker)
145505b261ecSmrg	  linker_flags="$linker_flags $qarg"
145605b261ecSmrg	  compiler_flags="$compiler_flags $qarg"
145705b261ecSmrg	  prev=
145805b261ecSmrg	  compile_command="$compile_command $qarg"
145905b261ecSmrg	  finalize_command="$finalize_command $qarg"
146005b261ecSmrg	  continue
146105b261ecSmrg	  ;;
146205b261ecSmrg	shrext)
146305b261ecSmrg  	  shrext_cmds="$arg"
146405b261ecSmrg	  prev=
146505b261ecSmrg	  continue
146605b261ecSmrg	  ;;
146705b261ecSmrg	darwin_framework|darwin_framework_skip)
146805b261ecSmrg	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
146905b261ecSmrg	  compile_command="$compile_command $arg"
147005b261ecSmrg	  finalize_command="$finalize_command $arg"
147105b261ecSmrg	  prev=
147205b261ecSmrg	  continue
147305b261ecSmrg	  ;;
147405b261ecSmrg	*)
147505b261ecSmrg	  eval "$prev=\"\$arg\""
147605b261ecSmrg	  prev=
147705b261ecSmrg	  continue
147805b261ecSmrg	  ;;
147905b261ecSmrg	esac
148005b261ecSmrg      fi # test -n "$prev"
148105b261ecSmrg
148205b261ecSmrg      prevarg="$arg"
148305b261ecSmrg
148405b261ecSmrg      case $arg in
148505b261ecSmrg      -all-static)
148605b261ecSmrg	if test -n "$link_static_flag"; then
148705b261ecSmrg	  compile_command="$compile_command $link_static_flag"
148805b261ecSmrg	  finalize_command="$finalize_command $link_static_flag"
148905b261ecSmrg	fi
149005b261ecSmrg	continue
149105b261ecSmrg	;;
149205b261ecSmrg
149305b261ecSmrg      -allow-undefined)
149405b261ecSmrg	# FIXME: remove this flag sometime in the future.
149505b261ecSmrg	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
149605b261ecSmrg	continue
149705b261ecSmrg	;;
149805b261ecSmrg
149905b261ecSmrg      -avoid-version)
150005b261ecSmrg	avoid_version=yes
150105b261ecSmrg	continue
150205b261ecSmrg	;;
150305b261ecSmrg
150405b261ecSmrg      -dlopen)
150505b261ecSmrg	prev=dlfiles
150605b261ecSmrg	continue
150705b261ecSmrg	;;
150805b261ecSmrg
150905b261ecSmrg      -dlpreopen)
151005b261ecSmrg	prev=dlprefiles
151105b261ecSmrg	continue
151205b261ecSmrg	;;
151305b261ecSmrg
151405b261ecSmrg      -export-dynamic)
151505b261ecSmrg	export_dynamic=yes
151605b261ecSmrg	continue
151705b261ecSmrg	;;
151805b261ecSmrg
151905b261ecSmrg      -export-symbols | -export-symbols-regex)
152005b261ecSmrg	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
152105b261ecSmrg	  $echo "$modename: more than one -exported-symbols argument is not allowed"
152205b261ecSmrg	  exit $EXIT_FAILURE
152305b261ecSmrg	fi
152405b261ecSmrg	if test "X$arg" = "X-export-symbols"; then
152505b261ecSmrg	  prev=expsyms
152605b261ecSmrg	else
152705b261ecSmrg	  prev=expsyms_regex
152805b261ecSmrg	fi
152905b261ecSmrg	continue
153005b261ecSmrg	;;
153105b261ecSmrg
153205b261ecSmrg      -framework|-arch|-isysroot)
153305b261ecSmrg	case " $CC " in
153405b261ecSmrg	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
153505b261ecSmrg		prev=darwin_framework_skip ;;
153605b261ecSmrg	  *) compiler_flags="$compiler_flags $arg"
153705b261ecSmrg	     prev=darwin_framework ;;
153805b261ecSmrg	esac
153905b261ecSmrg	compile_command="$compile_command $arg"
154005b261ecSmrg	finalize_command="$finalize_command $arg"
154105b261ecSmrg	continue
154205b261ecSmrg	;;
154305b261ecSmrg
154405b261ecSmrg      -inst-prefix-dir)
154505b261ecSmrg	prev=inst_prefix
154605b261ecSmrg	continue
154705b261ecSmrg	;;
154805b261ecSmrg
154905b261ecSmrg      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
155005b261ecSmrg      # so, if we see these flags be careful not to treat them like -L
155105b261ecSmrg      -L[A-Z][A-Z]*:*)
155205b261ecSmrg	case $with_gcc/$host in
155305b261ecSmrg	no/*-*-irix* | /*-*-irix*)
155405b261ecSmrg	  compile_command="$compile_command $arg"
155505b261ecSmrg	  finalize_command="$finalize_command $arg"
155605b261ecSmrg	  ;;
155705b261ecSmrg	esac
155805b261ecSmrg	continue
155905b261ecSmrg	;;
156005b261ecSmrg
156105b261ecSmrg      -L*)
156205b261ecSmrg	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
156305b261ecSmrg	# We need an absolute path.
156405b261ecSmrg	case $dir in
156505b261ecSmrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
156605b261ecSmrg	*)
156705b261ecSmrg	  absdir=`cd "$dir" && pwd`
156805b261ecSmrg	  if test -z "$absdir"; then
156905b261ecSmrg	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
157005b261ecSmrg	    absdir="$dir"
157105b261ecSmrg	    notinst_path="$notinst_path $dir"
157205b261ecSmrg	  fi
157305b261ecSmrg	  dir="$absdir"
157405b261ecSmrg	  ;;
157505b261ecSmrg	esac
157605b261ecSmrg	case "$deplibs " in
157705b261ecSmrg	*" -L$dir "*) ;;
157805b261ecSmrg	*)
157905b261ecSmrg	  deplibs="$deplibs -L$dir"
158005b261ecSmrg	  lib_search_path="$lib_search_path $dir"
158105b261ecSmrg	  ;;
158205b261ecSmrg	esac
158305b261ecSmrg	case $host in
158405b261ecSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
158505b261ecSmrg	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
158605b261ecSmrg	  case :$dllsearchpath: in
158705b261ecSmrg	  *":$dir:"*) ;;
158805b261ecSmrg	  *) dllsearchpath="$dllsearchpath:$dir";;
158905b261ecSmrg	  esac
159005b261ecSmrg	  case :$dllsearchpath: in
159105b261ecSmrg	  *":$testbindir:"*) ;;
159205b261ecSmrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
159305b261ecSmrg	  esac
159405b261ecSmrg	  ;;
159505b261ecSmrg	esac
159605b261ecSmrg	continue
159705b261ecSmrg	;;
159805b261ecSmrg
159905b261ecSmrg      -l*)
160005b261ecSmrg	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
160105b261ecSmrg	  case $host in
160205b261ecSmrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
160305b261ecSmrg	    # These systems don't actually have a C or math library (as such)
160405b261ecSmrg	    continue
160505b261ecSmrg	    ;;
160605b261ecSmrg	  *-*-os2*)
160705b261ecSmrg	    # These systems don't actually have a C library (as such)
160805b261ecSmrg	    test "X$arg" = "X-lc" && continue
160905b261ecSmrg	    ;;
161005b261ecSmrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
161105b261ecSmrg	    # Do not include libc due to us having libc/libc_r.
161205b261ecSmrg	    test "X$arg" = "X-lc" && continue
161305b261ecSmrg	    ;;
161405b261ecSmrg	  *-*-rhapsody* | *-*-darwin1.[012])
161505b261ecSmrg	    # Rhapsody C and math libraries are in the System framework
161605b261ecSmrg	    deplibs="$deplibs -framework System"
161705b261ecSmrg	    continue
161805b261ecSmrg	    ;;
161905b261ecSmrg	  *-*-sco3.2v5* | *-*-sco5v6*)
162005b261ecSmrg	    # Causes problems with __ctype
162105b261ecSmrg	    test "X$arg" = "X-lc" && continue
162205b261ecSmrg	    ;;
162305b261ecSmrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
162405b261ecSmrg	    # Compiler inserts libc in the correct place for threads to work
162505b261ecSmrg	    test "X$arg" = "X-lc" && continue
162605b261ecSmrg	    ;;
162705b261ecSmrg	  esac
162805b261ecSmrg	elif test "X$arg" = "X-lc_r"; then
162905b261ecSmrg	 case $host in
163005b261ecSmrg	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
163105b261ecSmrg	   # Do not include libc_r directly, use -pthread flag.
163205b261ecSmrg	   continue
163305b261ecSmrg	   ;;
163405b261ecSmrg	 esac
163505b261ecSmrg	fi
163605b261ecSmrg	deplibs="$deplibs $arg"
163705b261ecSmrg	continue
163805b261ecSmrg	;;
163905b261ecSmrg
164005b261ecSmrg      # Tru64 UNIX uses -model [arg] to determine the layout of C++
164105b261ecSmrg      # classes, name mangling, and exception handling.
164205b261ecSmrg      -model)
164305b261ecSmrg	compile_command="$compile_command $arg"
164405b261ecSmrg	compiler_flags="$compiler_flags $arg"
164505b261ecSmrg	finalize_command="$finalize_command $arg"
164605b261ecSmrg	prev=xcompiler
164705b261ecSmrg	continue
164805b261ecSmrg	;;
164905b261ecSmrg
165005b261ecSmrg     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
165105b261ecSmrg	compiler_flags="$compiler_flags $arg"
165205b261ecSmrg	compile_command="$compile_command $arg"
165305b261ecSmrg	finalize_command="$finalize_command $arg"
165405b261ecSmrg	continue
165505b261ecSmrg	;;
165605b261ecSmrg
165705b261ecSmrg      -multi_module)
165805b261ecSmrg	single_module="${wl}-multi_module"
165905b261ecSmrg	continue
166005b261ecSmrg	;;
166105b261ecSmrg
166205b261ecSmrg      -module)
166305b261ecSmrg	module=yes
166405b261ecSmrg	continue
166505b261ecSmrg	;;
166605b261ecSmrg
166705b261ecSmrg      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
166805b261ecSmrg      # -r[0-9][0-9]* specifies the processor on the SGI compiler
166905b261ecSmrg      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
167005b261ecSmrg      # +DA*, +DD* enable 64-bit mode on the HP compiler
167105b261ecSmrg      # -q* pass through compiler args for the IBM compiler
167205b261ecSmrg      # -m* pass through architecture-specific compiler args for GCC
167305b261ecSmrg      # -m*, -t[45]*, -txscale* pass through architecture-specific
167405b261ecSmrg      # compiler args for GCC
167505b261ecSmrg      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
167605b261ecSmrg      # -F/path gives path to uninstalled frameworks, gcc on darwin
167705b261ecSmrg      # @file GCC response files
167805b261ecSmrg      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
167905b261ecSmrg      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
168005b261ecSmrg
168105b261ecSmrg	# Unknown arguments in both finalize_command and compile_command need
168205b261ecSmrg	# to be aesthetically quoted because they are evaled later.
168305b261ecSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
168405b261ecSmrg	case $arg in
168505b261ecSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
168605b261ecSmrg	  arg="\"$arg\""
168705b261ecSmrg	  ;;
168805b261ecSmrg	esac
168905b261ecSmrg        compile_command="$compile_command $arg"
169005b261ecSmrg        finalize_command="$finalize_command $arg"
169105b261ecSmrg        compiler_flags="$compiler_flags $arg"
169205b261ecSmrg        continue
169305b261ecSmrg        ;;
169405b261ecSmrg
169505b261ecSmrg      -shrext)
169605b261ecSmrg	prev=shrext
169705b261ecSmrg	continue
169805b261ecSmrg	;;
169905b261ecSmrg
170005b261ecSmrg      -no-fast-install)
170105b261ecSmrg	fast_install=no
170205b261ecSmrg	continue
170305b261ecSmrg	;;
170405b261ecSmrg
170505b261ecSmrg      -no-install)
170605b261ecSmrg	case $host in
170705b261ecSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
170805b261ecSmrg	  # The PATH hackery in wrapper scripts is required on Windows
170905b261ecSmrg	  # and Darwin in order for the loader to find any dlls it needs.
171005b261ecSmrg	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
171105b261ecSmrg	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
171205b261ecSmrg	  fast_install=no
171305b261ecSmrg	  ;;
171405b261ecSmrg	*) no_install=yes ;;
171505b261ecSmrg	esac
171605b261ecSmrg	continue
171705b261ecSmrg	;;
171805b261ecSmrg
171905b261ecSmrg      -no-undefined)
172005b261ecSmrg	allow_undefined=no
172105b261ecSmrg	continue
172205b261ecSmrg	;;
172305b261ecSmrg
172405b261ecSmrg      -objectlist)
172505b261ecSmrg	prev=objectlist
172605b261ecSmrg	continue
172705b261ecSmrg	;;
172805b261ecSmrg
172905b261ecSmrg      -o) prev=output ;;
173005b261ecSmrg
173105b261ecSmrg      -precious-files-regex)
173205b261ecSmrg	prev=precious_regex
173305b261ecSmrg	continue
173405b261ecSmrg	;;
173505b261ecSmrg
173605b261ecSmrg      -release)
173705b261ecSmrg	prev=release
173805b261ecSmrg	continue
173905b261ecSmrg	;;
174005b261ecSmrg
174105b261ecSmrg      -rpath)
174205b261ecSmrg	prev=rpath
174305b261ecSmrg	continue
174405b261ecSmrg	;;
174505b261ecSmrg
174605b261ecSmrg      -R)
174705b261ecSmrg	prev=xrpath
174805b261ecSmrg	continue
174905b261ecSmrg	;;
175005b261ecSmrg
175105b261ecSmrg      -R*)
175205b261ecSmrg	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
175305b261ecSmrg	# We need an absolute path.
175405b261ecSmrg	case $dir in
175505b261ecSmrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
175605b261ecSmrg	*)
175705b261ecSmrg	  $echo "$modename: only absolute run-paths are allowed" 1>&2
175805b261ecSmrg	  exit $EXIT_FAILURE
175905b261ecSmrg	  ;;
176005b261ecSmrg	esac
176105b261ecSmrg	case "$xrpath " in
176205b261ecSmrg	*" $dir "*) ;;
176305b261ecSmrg	*) xrpath="$xrpath $dir" ;;
176405b261ecSmrg	esac
176505b261ecSmrg	continue
176605b261ecSmrg	;;
176705b261ecSmrg
176805b261ecSmrg      -static | -static-libtool-libs)
176905b261ecSmrg	# The effects of -static are defined in a previous loop.
177005b261ecSmrg	# We used to do the same as -all-static on platforms that
177105b261ecSmrg	# didn't have a PIC flag, but the assumption that the effects
177205b261ecSmrg	# would be equivalent was wrong.  It would break on at least
177305b261ecSmrg	# Digital Unix and AIX.
177405b261ecSmrg	continue
177505b261ecSmrg	;;
177605b261ecSmrg
177705b261ecSmrg      -thread-safe)
177805b261ecSmrg	thread_safe=yes
177905b261ecSmrg	continue
178005b261ecSmrg	;;
178105b261ecSmrg
178205b261ecSmrg      -version-info)
178305b261ecSmrg	prev=vinfo
178405b261ecSmrg	continue
178505b261ecSmrg	;;
178605b261ecSmrg      -version-number)
178705b261ecSmrg	prev=vinfo
178805b261ecSmrg	vinfo_number=yes
178905b261ecSmrg	continue
179005b261ecSmrg	;;
179105b261ecSmrg
179205b261ecSmrg      -Wc,*)
179305b261ecSmrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
179405b261ecSmrg	arg=
179505b261ecSmrg	save_ifs="$IFS"; IFS=','
179605b261ecSmrg	for flag in $args; do
179705b261ecSmrg	  IFS="$save_ifs"
179805b261ecSmrg	  case $flag in
179905b261ecSmrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
180005b261ecSmrg	    flag="\"$flag\""
180105b261ecSmrg	    ;;
180205b261ecSmrg	  esac
180305b261ecSmrg	  arg="$arg $wl$flag"
180405b261ecSmrg	  compiler_flags="$compiler_flags $flag"
180505b261ecSmrg	done
180605b261ecSmrg	IFS="$save_ifs"
180705b261ecSmrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
180805b261ecSmrg	;;
180905b261ecSmrg
181005b261ecSmrg      -Wl,*)
181105b261ecSmrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
181205b261ecSmrg	arg=
181305b261ecSmrg	save_ifs="$IFS"; IFS=','
181405b261ecSmrg	for flag in $args; do
181505b261ecSmrg	  IFS="$save_ifs"
181605b261ecSmrg	  case $flag in
181705b261ecSmrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
181805b261ecSmrg	    flag="\"$flag\""
181905b261ecSmrg	    ;;
182005b261ecSmrg	  esac
182105b261ecSmrg	  arg="$arg $wl$flag"
182205b261ecSmrg	  compiler_flags="$compiler_flags $wl$flag"
182305b261ecSmrg	  linker_flags="$linker_flags $flag"
182405b261ecSmrg	done
182505b261ecSmrg	IFS="$save_ifs"
182605b261ecSmrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
182705b261ecSmrg	;;
182805b261ecSmrg
182905b261ecSmrg      -Xcompiler)
183005b261ecSmrg	prev=xcompiler
183105b261ecSmrg	continue
183205b261ecSmrg	;;
183305b261ecSmrg
183405b261ecSmrg      -Xlinker)
183505b261ecSmrg	prev=xlinker
183605b261ecSmrg	continue
183705b261ecSmrg	;;
183805b261ecSmrg
183905b261ecSmrg      -XCClinker)
184005b261ecSmrg	prev=xcclinker
184105b261ecSmrg	continue
184205b261ecSmrg	;;
184305b261ecSmrg
184405b261ecSmrg      # Some other compiler flag.
184505b261ecSmrg      -* | +*)
184605b261ecSmrg	# Unknown arguments in both finalize_command and compile_command need
184705b261ecSmrg	# to be aesthetically quoted because they are evaled later.
184805b261ecSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
184905b261ecSmrg	case $arg in
185005b261ecSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
185105b261ecSmrg	  arg="\"$arg\""
185205b261ecSmrg	  ;;
185305b261ecSmrg	esac
185405b261ecSmrg	;;
185505b261ecSmrg
185605b261ecSmrg      *.$objext)
185705b261ecSmrg	# A standard object.
185805b261ecSmrg	objs="$objs $arg"
185905b261ecSmrg	;;
186005b261ecSmrg
186105b261ecSmrg      *.lo)
186205b261ecSmrg	# A libtool-controlled object.
186305b261ecSmrg
186405b261ecSmrg	# Check to see that this really is a libtool object.
186505b261ecSmrg	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
186605b261ecSmrg	  pic_object=
186705b261ecSmrg	  non_pic_object=
186805b261ecSmrg
186905b261ecSmrg	  # Read the .lo file
187005b261ecSmrg	  # If there is no directory component, then add one.
187105b261ecSmrg	  case $arg in
187205b261ecSmrg	  */* | *\\*) . $arg ;;
187305b261ecSmrg	  *) . ./$arg ;;
187405b261ecSmrg	  esac
187505b261ecSmrg
187605b261ecSmrg	  if test -z "$pic_object" || \
187705b261ecSmrg	     test -z "$non_pic_object" ||
187805b261ecSmrg	     test "$pic_object" = none && \
187905b261ecSmrg	     test "$non_pic_object" = none; then
188005b261ecSmrg	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
188105b261ecSmrg	    exit $EXIT_FAILURE
188205b261ecSmrg	  fi
188305b261ecSmrg
188405b261ecSmrg	  # Extract subdirectory from the argument.
188505b261ecSmrg	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
188605b261ecSmrg	  if test "X$xdir" = "X$arg"; then
188705b261ecSmrg	    xdir=
188805b261ecSmrg 	  else
188905b261ecSmrg	    xdir="$xdir/"
189005b261ecSmrg	  fi
189105b261ecSmrg
189205b261ecSmrg	  if test "$pic_object" != none; then
189305b261ecSmrg	    # Prepend the subdirectory the object is found in.
189405b261ecSmrg	    pic_object="$xdir$pic_object"
189505b261ecSmrg
189605b261ecSmrg	    if test "$prev" = dlfiles; then
189705b261ecSmrg	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
189805b261ecSmrg		dlfiles="$dlfiles $pic_object"
189905b261ecSmrg		prev=
190005b261ecSmrg		continue
190105b261ecSmrg	      else
190205b261ecSmrg		# If libtool objects are unsupported, then we need to preload.
190305b261ecSmrg		prev=dlprefiles
190405b261ecSmrg	      fi
190505b261ecSmrg	    fi
190605b261ecSmrg
190705b261ecSmrg	    # CHECK ME:  I think I busted this.  -Ossama
190805b261ecSmrg	    if test "$prev" = dlprefiles; then
190905b261ecSmrg	      # Preload the old-style object.
191005b261ecSmrg	      dlprefiles="$dlprefiles $pic_object"
191105b261ecSmrg	      prev=
191205b261ecSmrg	    fi
191305b261ecSmrg
191405b261ecSmrg	    # A PIC object.
191505b261ecSmrg	    libobjs="$libobjs $pic_object"
191605b261ecSmrg	    arg="$pic_object"
191705b261ecSmrg	  fi
191805b261ecSmrg
191905b261ecSmrg	  # Non-PIC object.
192005b261ecSmrg	  if test "$non_pic_object" != none; then
192105b261ecSmrg	    # Prepend the subdirectory the object is found in.
192205b261ecSmrg	    non_pic_object="$xdir$non_pic_object"
192305b261ecSmrg
192405b261ecSmrg	    # A standard non-PIC object
192505b261ecSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
192605b261ecSmrg	    if test -z "$pic_object" || test "$pic_object" = none ; then
192705b261ecSmrg	      arg="$non_pic_object"
192805b261ecSmrg	    fi
192905b261ecSmrg	  else
193005b261ecSmrg	    # If the PIC object exists, use it instead.
193105b261ecSmrg	    # $xdir was prepended to $pic_object above.
193205b261ecSmrg	    non_pic_object="$pic_object"
193305b261ecSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
193405b261ecSmrg	  fi
193505b261ecSmrg	else
193605b261ecSmrg	  # Only an error if not doing a dry-run.
193705b261ecSmrg	  if test -z "$run"; then
193805b261ecSmrg	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
193905b261ecSmrg	    exit $EXIT_FAILURE
194005b261ecSmrg	  else
194105b261ecSmrg	    # Dry-run case.
194205b261ecSmrg
194305b261ecSmrg	    # Extract subdirectory from the argument.
194405b261ecSmrg	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
194505b261ecSmrg	    if test "X$xdir" = "X$arg"; then
194605b261ecSmrg	      xdir=
194705b261ecSmrg	    else
194805b261ecSmrg	      xdir="$xdir/"
194905b261ecSmrg	    fi
195005b261ecSmrg
195105b261ecSmrg	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
195205b261ecSmrg	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
195305b261ecSmrg	    libobjs="$libobjs $pic_object"
195405b261ecSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
195505b261ecSmrg	  fi
195605b261ecSmrg	fi
195705b261ecSmrg	;;
195805b261ecSmrg
195905b261ecSmrg      *.$libext)
196005b261ecSmrg	# An archive.
196105b261ecSmrg	deplibs="$deplibs $arg"
196205b261ecSmrg	old_deplibs="$old_deplibs $arg"
196305b261ecSmrg	continue
196405b261ecSmrg	;;
196505b261ecSmrg
196605b261ecSmrg      *.la)
196705b261ecSmrg	# A libtool-controlled library.
196805b261ecSmrg
196905b261ecSmrg	if test "$prev" = dlfiles; then
197005b261ecSmrg	  # This library was specified with -dlopen.
197105b261ecSmrg	  dlfiles="$dlfiles $arg"
197205b261ecSmrg	  prev=
197305b261ecSmrg	elif test "$prev" = dlprefiles; then
197405b261ecSmrg	  # The library was specified with -dlpreopen.
197505b261ecSmrg	  dlprefiles="$dlprefiles $arg"
197605b261ecSmrg	  prev=
197705b261ecSmrg	else
197805b261ecSmrg	  deplibs="$deplibs $arg"
197905b261ecSmrg	fi
198005b261ecSmrg	continue
198105b261ecSmrg	;;
198205b261ecSmrg
198305b261ecSmrg      # Some other compiler argument.
198405b261ecSmrg      *)
198505b261ecSmrg	# Unknown arguments in both finalize_command and compile_command need
198605b261ecSmrg	# to be aesthetically quoted because they are evaled later.
198705b261ecSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
198805b261ecSmrg	case $arg in
198905b261ecSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
199005b261ecSmrg	  arg="\"$arg\""
199105b261ecSmrg	  ;;
199205b261ecSmrg	esac
199305b261ecSmrg	;;
199405b261ecSmrg      esac # arg
199505b261ecSmrg
199605b261ecSmrg      # Now actually substitute the argument into the commands.
199705b261ecSmrg      if test -n "$arg"; then
199805b261ecSmrg	compile_command="$compile_command $arg"
199905b261ecSmrg	finalize_command="$finalize_command $arg"
200005b261ecSmrg      fi
200105b261ecSmrg    done # argument parsing loop
200205b261ecSmrg
200305b261ecSmrg    if test -n "$prev"; then
200405b261ecSmrg      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
200505b261ecSmrg      $echo "$help" 1>&2
200605b261ecSmrg      exit $EXIT_FAILURE
200705b261ecSmrg    fi
200805b261ecSmrg
200905b261ecSmrg    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
201005b261ecSmrg      eval arg=\"$export_dynamic_flag_spec\"
201105b261ecSmrg      compile_command="$compile_command $arg"
201205b261ecSmrg      finalize_command="$finalize_command $arg"
201305b261ecSmrg    fi
201405b261ecSmrg
201505b261ecSmrg    oldlibs=
201605b261ecSmrg    # calculate the name of the file, without its directory
201705b261ecSmrg    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
201805b261ecSmrg    libobjs_save="$libobjs"
201905b261ecSmrg
202005b261ecSmrg    if test -n "$shlibpath_var"; then
202105b261ecSmrg      # get the directories listed in $shlibpath_var
202205b261ecSmrg      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
202305b261ecSmrg    else
202405b261ecSmrg      shlib_search_path=
202505b261ecSmrg    fi
202605b261ecSmrg    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
202705b261ecSmrg    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
202805b261ecSmrg
202905b261ecSmrg    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
203005b261ecSmrg    if test "X$output_objdir" = "X$output"; then
203105b261ecSmrg      output_objdir="$objdir"
203205b261ecSmrg    else
203305b261ecSmrg      output_objdir="$output_objdir/$objdir"
203405b261ecSmrg    fi
203505b261ecSmrg    # Create the object directory.
203605b261ecSmrg    if test ! -d "$output_objdir"; then
203705b261ecSmrg      $show "$mkdir $output_objdir"
203805b261ecSmrg      $run $mkdir $output_objdir
203905b261ecSmrg      exit_status=$?
204005b261ecSmrg      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
204105b261ecSmrg	exit $exit_status
204205b261ecSmrg      fi
204305b261ecSmrg    fi
204405b261ecSmrg
204505b261ecSmrg    # Determine the type of output
204605b261ecSmrg    case $output in
204705b261ecSmrg    "")
204805b261ecSmrg      $echo "$modename: you must specify an output file" 1>&2
204905b261ecSmrg      $echo "$help" 1>&2
205005b261ecSmrg      exit $EXIT_FAILURE
205105b261ecSmrg      ;;
205205b261ecSmrg    *.$libext) linkmode=oldlib ;;
205305b261ecSmrg    *.lo | *.$objext) linkmode=obj ;;
205405b261ecSmrg    *.la) linkmode=lib ;;
205505b261ecSmrg    *) linkmode=prog ;; # Anything else should be a program.
205605b261ecSmrg    esac
205705b261ecSmrg
205805b261ecSmrg    case $host in
205905b261ecSmrg    *cygwin* | *mingw* | *pw32*)
206005b261ecSmrg      # don't eliminate duplications in $postdeps and $predeps
206105b261ecSmrg      duplicate_compiler_generated_deps=yes
206205b261ecSmrg      ;;
206305b261ecSmrg    *)
206405b261ecSmrg      duplicate_compiler_generated_deps=$duplicate_deps
206505b261ecSmrg      ;;
206605b261ecSmrg    esac
206705b261ecSmrg    specialdeplibs=
206805b261ecSmrg
206905b261ecSmrg    libs=
207005b261ecSmrg    # Find all interdependent deplibs by searching for libraries
207105b261ecSmrg    # that are linked more than once (e.g. -la -lb -la)
207205b261ecSmrg    for deplib in $deplibs; do
207305b261ecSmrg      if test "X$duplicate_deps" = "Xyes" ; then
207405b261ecSmrg	case "$libs " in
207505b261ecSmrg	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
207605b261ecSmrg	esac
207705b261ecSmrg      fi
207805b261ecSmrg      libs="$libs $deplib"
207905b261ecSmrg    done
208005b261ecSmrg
208105b261ecSmrg    if test "$linkmode" = lib; then
208205b261ecSmrg      libs="$predeps $libs $compiler_lib_search_path $postdeps"
208305b261ecSmrg
208405b261ecSmrg      # Compute libraries that are listed more than once in $predeps
208505b261ecSmrg      # $postdeps and mark them as special (i.e., whose duplicates are
208605b261ecSmrg      # not to be eliminated).
208705b261ecSmrg      pre_post_deps=
208805b261ecSmrg      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
208905b261ecSmrg	for pre_post_dep in $predeps $postdeps; do
209005b261ecSmrg	  case "$pre_post_deps " in
209105b261ecSmrg	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
209205b261ecSmrg	  esac
209305b261ecSmrg	  pre_post_deps="$pre_post_deps $pre_post_dep"
209405b261ecSmrg	done
209505b261ecSmrg      fi
209605b261ecSmrg      pre_post_deps=
209705b261ecSmrg    fi
209805b261ecSmrg
209905b261ecSmrg    deplibs=
210005b261ecSmrg    newdependency_libs=
210105b261ecSmrg    newlib_search_path=
210205b261ecSmrg    need_relink=no # whether we're linking any uninstalled libtool libraries
210305b261ecSmrg    notinst_deplibs= # not-installed libtool libraries
210405b261ecSmrg    case $linkmode in
210505b261ecSmrg    lib)
210605b261ecSmrg	passes="conv link"
210705b261ecSmrg	for file in $dlfiles $dlprefiles; do
210805b261ecSmrg	  case $file in
210905b261ecSmrg	  *.la) ;;
211005b261ecSmrg	  *)
211105b261ecSmrg	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
211205b261ecSmrg	    exit $EXIT_FAILURE
211305b261ecSmrg	    ;;
211405b261ecSmrg	  esac
211505b261ecSmrg	done
211605b261ecSmrg	;;
211705b261ecSmrg    prog)
211805b261ecSmrg	compile_deplibs=
211905b261ecSmrg	finalize_deplibs=
212005b261ecSmrg	alldeplibs=no
212105b261ecSmrg	newdlfiles=
212205b261ecSmrg	newdlprefiles=
212305b261ecSmrg	passes="conv scan dlopen dlpreopen link"
212405b261ecSmrg	;;
212505b261ecSmrg    *)  passes="conv"
212605b261ecSmrg	;;
212705b261ecSmrg    esac
212805b261ecSmrg    for pass in $passes; do
212905b261ecSmrg      if test "$linkmode,$pass" = "lib,link" ||
213005b261ecSmrg	 test "$linkmode,$pass" = "prog,scan"; then
213105b261ecSmrg	libs="$deplibs"
213205b261ecSmrg	deplibs=
213305b261ecSmrg      fi
213405b261ecSmrg      if test "$linkmode" = prog; then
213505b261ecSmrg	case $pass in
213605b261ecSmrg	dlopen) libs="$dlfiles" ;;
213705b261ecSmrg	dlpreopen) libs="$dlprefiles" ;;
213805b261ecSmrg	link)
213905b261ecSmrg	  libs="$deplibs %DEPLIBS%"
214005b261ecSmrg	  test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
214105b261ecSmrg	  ;;
214205b261ecSmrg	esac
214305b261ecSmrg      fi
214405b261ecSmrg      if test "$pass" = dlopen; then
214505b261ecSmrg	# Collect dlpreopened libraries
214605b261ecSmrg	save_deplibs="$deplibs"
214705b261ecSmrg	deplibs=
214805b261ecSmrg      fi
214905b261ecSmrg      for deplib in $libs; do
215005b261ecSmrg	lib=
215105b261ecSmrg	found=no
215205b261ecSmrg	case $deplib in
215305b261ecSmrg	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
215405b261ecSmrg	  if test "$linkmode,$pass" = "prog,link"; then
215505b261ecSmrg	    compile_deplibs="$deplib $compile_deplibs"
215605b261ecSmrg	    finalize_deplibs="$deplib $finalize_deplibs"
215705b261ecSmrg	  else
215805b261ecSmrg	    compiler_flags="$compiler_flags $deplib"
215905b261ecSmrg	  fi
216005b261ecSmrg	  continue
216105b261ecSmrg	  ;;
216205b261ecSmrg	-l*)
216305b261ecSmrg	  if test "$linkmode" != lib && test "$linkmode" != prog; then
216405b261ecSmrg	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
216505b261ecSmrg	    continue
216605b261ecSmrg	  fi
216705b261ecSmrg	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
216805b261ecSmrg	  if test "$linkmode" = lib; then
216905b261ecSmrg	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
217005b261ecSmrg	  else
217105b261ecSmrg	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
217205b261ecSmrg	  fi
217305b261ecSmrg	  for searchdir in $searchdirs; do
217405b261ecSmrg	    for search_ext in .la $std_shrext .so .a; do
217505b261ecSmrg	      # Search the libtool library
217605b261ecSmrg	      lib="$searchdir/lib${name}${search_ext}"
217705b261ecSmrg	      if test -f "$lib"; then
217805b261ecSmrg		if test "$search_ext" = ".la"; then
217905b261ecSmrg		  found=yes
218005b261ecSmrg		else
218105b261ecSmrg		  found=no
218205b261ecSmrg		fi
218305b261ecSmrg		break 2
218405b261ecSmrg	      fi
218505b261ecSmrg	    done
218605b261ecSmrg	  done
218705b261ecSmrg	  if test "$found" != yes; then
218805b261ecSmrg	    # deplib doesn't seem to be a libtool library
218905b261ecSmrg	    if test "$linkmode,$pass" = "prog,link"; then
219005b261ecSmrg	      compile_deplibs="$deplib $compile_deplibs"
219105b261ecSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
219205b261ecSmrg	    else
219305b261ecSmrg	      deplibs="$deplib $deplibs"
219405b261ecSmrg	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
219505b261ecSmrg	    fi
219605b261ecSmrg	    continue
219705b261ecSmrg	  else # deplib is a libtool library
219805b261ecSmrg	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
219905b261ecSmrg	    # We need to do some special things here, and not later.
220005b261ecSmrg	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
220105b261ecSmrg	      case " $predeps $postdeps " in
220205b261ecSmrg	      *" $deplib "*)
220305b261ecSmrg		if (${SED} -e '2q' $lib |
220405b261ecSmrg                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
220505b261ecSmrg		  library_names=
220605b261ecSmrg		  old_library=
220705b261ecSmrg		  case $lib in
220805b261ecSmrg		  */* | *\\*) . $lib ;;
220905b261ecSmrg		  *) . ./$lib ;;
221005b261ecSmrg		  esac
221105b261ecSmrg		  for l in $old_library $library_names; do
221205b261ecSmrg		    ll="$l"
221305b261ecSmrg		  done
221405b261ecSmrg		  if test "X$ll" = "X$old_library" ; then # only static version available
221505b261ecSmrg		    found=no
221605b261ecSmrg		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
221705b261ecSmrg		    test "X$ladir" = "X$lib" && ladir="."
221805b261ecSmrg		    lib=$ladir/$old_library
221905b261ecSmrg		    if test "$linkmode,$pass" = "prog,link"; then
222005b261ecSmrg		      compile_deplibs="$deplib $compile_deplibs"
222105b261ecSmrg		      finalize_deplibs="$deplib $finalize_deplibs"
222205b261ecSmrg		    else
222305b261ecSmrg		      deplibs="$deplib $deplibs"
222405b261ecSmrg		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
222505b261ecSmrg		    fi
222605b261ecSmrg		    continue
222705b261ecSmrg		  fi
222805b261ecSmrg		fi
222905b261ecSmrg	        ;;
223005b261ecSmrg	      *) ;;
223105b261ecSmrg	      esac
223205b261ecSmrg	    fi
223305b261ecSmrg	  fi
223405b261ecSmrg	  ;; # -l
223505b261ecSmrg	-L*)
223605b261ecSmrg	  case $linkmode in
223705b261ecSmrg	  lib)
223805b261ecSmrg	    deplibs="$deplib $deplibs"
223905b261ecSmrg	    test "$pass" = conv && continue
224005b261ecSmrg	    newdependency_libs="$deplib $newdependency_libs"
224105b261ecSmrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
224205b261ecSmrg	    ;;
224305b261ecSmrg	  prog)
224405b261ecSmrg	    if test "$pass" = conv; then
224505b261ecSmrg	      deplibs="$deplib $deplibs"
224605b261ecSmrg	      continue
224705b261ecSmrg	    fi
224805b261ecSmrg	    if test "$pass" = scan; then
224905b261ecSmrg	      deplibs="$deplib $deplibs"
225005b261ecSmrg	    else
225105b261ecSmrg	      compile_deplibs="$deplib $compile_deplibs"
225205b261ecSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
225305b261ecSmrg	    fi
225405b261ecSmrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
225505b261ecSmrg	    ;;
225605b261ecSmrg	  *)
225705b261ecSmrg	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
225805b261ecSmrg	    ;;
225905b261ecSmrg	  esac # linkmode
226005b261ecSmrg	  continue
226105b261ecSmrg	  ;; # -L
226205b261ecSmrg	-R*)
226305b261ecSmrg	  if test "$pass" = link; then
226405b261ecSmrg	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
226505b261ecSmrg	    # Make sure the xrpath contains only unique directories.
226605b261ecSmrg	    case "$xrpath " in
226705b261ecSmrg	    *" $dir "*) ;;
226805b261ecSmrg	    *) xrpath="$xrpath $dir" ;;
226905b261ecSmrg	    esac
227005b261ecSmrg	  fi
227105b261ecSmrg	  deplibs="$deplib $deplibs"
227205b261ecSmrg	  continue
227305b261ecSmrg	  ;;
227405b261ecSmrg	*.la) lib="$deplib" ;;
227505b261ecSmrg	*.$libext)
227605b261ecSmrg	  if test "$pass" = conv; then
227705b261ecSmrg	    deplibs="$deplib $deplibs"
227805b261ecSmrg	    continue
227905b261ecSmrg	  fi
228005b261ecSmrg	  case $linkmode in
228105b261ecSmrg	  lib)
228205b261ecSmrg	    valid_a_lib=no
228305b261ecSmrg	    case $deplibs_check_method in
228405b261ecSmrg	      match_pattern*)
228505b261ecSmrg		set dummy $deplibs_check_method
228605b261ecSmrg	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
228705b261ecSmrg		if eval $echo \"$deplib\" 2>/dev/null \
228805b261ecSmrg		    | $SED 10q \
228905b261ecSmrg		    | $EGREP "$match_pattern_regex" > /dev/null; then
229005b261ecSmrg		  valid_a_lib=yes
229105b261ecSmrg		fi
229205b261ecSmrg		;;
229305b261ecSmrg	      pass_all)
229405b261ecSmrg		valid_a_lib=yes
229505b261ecSmrg		;;
229605b261ecSmrg            esac
229705b261ecSmrg	    if test "$valid_a_lib" != yes; then
229805b261ecSmrg	      $echo
229905b261ecSmrg	      $echo "*** Warning: Trying to link with static lib archive $deplib."
230005b261ecSmrg	      $echo "*** I have the capability to make that library automatically link in when"
230105b261ecSmrg	      $echo "*** you link to this library.  But I can only do this if you have a"
230205b261ecSmrg	      $echo "*** shared version of the library, which you do not appear to have"
230305b261ecSmrg	      $echo "*** because the file extensions .$libext of this argument makes me believe"
230405b261ecSmrg	      $echo "*** that it is just a static archive that I should not used here."
230505b261ecSmrg	    else
230605b261ecSmrg	      $echo
230705b261ecSmrg	      $echo "*** Warning: Linking the shared library $output against the"
230805b261ecSmrg	      $echo "*** static library $deplib is not portable!"
230905b261ecSmrg	      deplibs="$deplib $deplibs"
231005b261ecSmrg	    fi
231105b261ecSmrg	    continue
231205b261ecSmrg	    ;;
231305b261ecSmrg	  prog)
231405b261ecSmrg	    if test "$pass" != link; then
231505b261ecSmrg	      deplibs="$deplib $deplibs"
231605b261ecSmrg	    else
231705b261ecSmrg	      compile_deplibs="$deplib $compile_deplibs"
231805b261ecSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
231905b261ecSmrg	    fi
232005b261ecSmrg	    continue
232105b261ecSmrg	    ;;
232205b261ecSmrg	  esac # linkmode
232305b261ecSmrg	  ;; # *.$libext
232405b261ecSmrg	*.lo | *.$objext)
232505b261ecSmrg	  if test "$pass" = conv; then
232605b261ecSmrg	    deplibs="$deplib $deplibs"
232705b261ecSmrg	  elif test "$linkmode" = prog; then
232805b261ecSmrg	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
232905b261ecSmrg	      # If there is no dlopen support or we're linking statically,
233005b261ecSmrg	      # we need to preload.
233105b261ecSmrg	      newdlprefiles="$newdlprefiles $deplib"
233205b261ecSmrg	      compile_deplibs="$deplib $compile_deplibs"
233305b261ecSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
233405b261ecSmrg	    else
233505b261ecSmrg	      newdlfiles="$newdlfiles $deplib"
233605b261ecSmrg	    fi
233705b261ecSmrg	  fi
233805b261ecSmrg	  continue
233905b261ecSmrg	  ;;
234005b261ecSmrg	%DEPLIBS%)
234105b261ecSmrg	  alldeplibs=yes
234205b261ecSmrg	  continue
234305b261ecSmrg	  ;;
234405b261ecSmrg	esac # case $deplib
234505b261ecSmrg	if test "$found" = yes || test -f "$lib"; then :
234605b261ecSmrg	else
234705b261ecSmrg	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
234805b261ecSmrg	  exit $EXIT_FAILURE
234905b261ecSmrg	fi
235005b261ecSmrg
235105b261ecSmrg	# Check to see that this really is a libtool archive.
235205b261ecSmrg	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
235305b261ecSmrg	else
235405b261ecSmrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
235505b261ecSmrg	  exit $EXIT_FAILURE
235605b261ecSmrg	fi
235705b261ecSmrg
235805b261ecSmrg	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
235905b261ecSmrg	test "X$ladir" = "X$lib" && ladir="."
236005b261ecSmrg
236105b261ecSmrg	dlname=
236205b261ecSmrg	dlopen=
236305b261ecSmrg	dlpreopen=
236405b261ecSmrg	libdir=
236505b261ecSmrg	library_names=
236605b261ecSmrg	old_library=
236705b261ecSmrg	# If the library was installed with an old release of libtool,
236805b261ecSmrg	# it will not redefine variables installed, or shouldnotlink
236905b261ecSmrg	installed=yes
237005b261ecSmrg	shouldnotlink=no
237105b261ecSmrg	avoidtemprpath=
237205b261ecSmrg
237305b261ecSmrg
237405b261ecSmrg	# Read the .la file
237505b261ecSmrg	case $lib in
237605b261ecSmrg	*/* | *\\*) . $lib ;;
237705b261ecSmrg	*) . ./$lib ;;
237805b261ecSmrg	esac
237905b261ecSmrg
238005b261ecSmrg	if test "$linkmode,$pass" = "lib,link" ||
238105b261ecSmrg	   test "$linkmode,$pass" = "prog,scan" ||
238205b261ecSmrg	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
238305b261ecSmrg	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
238405b261ecSmrg	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
238505b261ecSmrg	fi
238605b261ecSmrg
238705b261ecSmrg	if test "$pass" = conv; then
238805b261ecSmrg	  # Only check for convenience libraries
238905b261ecSmrg	  deplibs="$lib $deplibs"
239005b261ecSmrg	  if test -z "$libdir"; then
239105b261ecSmrg	    if test -z "$old_library"; then
239205b261ecSmrg	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
239305b261ecSmrg	      exit $EXIT_FAILURE
239405b261ecSmrg	    fi
239505b261ecSmrg	    # It is a libtool convenience library, so add in its objects.
239605b261ecSmrg	    convenience="$convenience $ladir/$objdir/$old_library"
239705b261ecSmrg	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
239805b261ecSmrg	    tmp_libs=
239905b261ecSmrg	    for deplib in $dependency_libs; do
240005b261ecSmrg	      deplibs="$deplib $deplibs"
240105b261ecSmrg              if test "X$duplicate_deps" = "Xyes" ; then
240205b261ecSmrg	        case "$tmp_libs " in
240305b261ecSmrg	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
240405b261ecSmrg	        esac
240505b261ecSmrg              fi
240605b261ecSmrg	      tmp_libs="$tmp_libs $deplib"
240705b261ecSmrg	    done
240805b261ecSmrg	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
240905b261ecSmrg	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
241005b261ecSmrg	    exit $EXIT_FAILURE
241105b261ecSmrg	  fi
241205b261ecSmrg	  continue
241305b261ecSmrg	fi # $pass = conv
241405b261ecSmrg
241505b261ecSmrg
241605b261ecSmrg	# Get the name of the library we link against.
241705b261ecSmrg	linklib=
241805b261ecSmrg	for l in $old_library $library_names; do
241905b261ecSmrg	  linklib="$l"
242005b261ecSmrg	done
242105b261ecSmrg	if test -z "$linklib"; then
242205b261ecSmrg	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
242305b261ecSmrg	  exit $EXIT_FAILURE
242405b261ecSmrg	fi
242505b261ecSmrg
242605b261ecSmrg	# This library was specified with -dlopen.
242705b261ecSmrg	if test "$pass" = dlopen; then
242805b261ecSmrg	  if test -z "$libdir"; then
242905b261ecSmrg	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
243005b261ecSmrg	    exit $EXIT_FAILURE
243105b261ecSmrg	  fi
243205b261ecSmrg	  if test -z "$dlname" ||
243305b261ecSmrg	     test "$dlopen_support" != yes ||
243405b261ecSmrg	     test "$build_libtool_libs" = no; then
243505b261ecSmrg	    # If there is no dlname, no dlopen support or we're linking
243605b261ecSmrg	    # statically, we need to preload.  We also need to preload any
243705b261ecSmrg	    # dependent libraries so libltdl's deplib preloader doesn't
243805b261ecSmrg	    # bomb out in the load deplibs phase.
243905b261ecSmrg	    dlprefiles="$dlprefiles $lib $dependency_libs"
244005b261ecSmrg	  else
244105b261ecSmrg	    newdlfiles="$newdlfiles $lib"
244205b261ecSmrg	  fi
244305b261ecSmrg	  continue
244405b261ecSmrg	fi # $pass = dlopen
244505b261ecSmrg
244605b261ecSmrg	# We need an absolute path.
244705b261ecSmrg	case $ladir in
244805b261ecSmrg	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
244905b261ecSmrg	*)
245005b261ecSmrg	  abs_ladir=`cd "$ladir" && pwd`
245105b261ecSmrg	  if test -z "$abs_ladir"; then
245205b261ecSmrg	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
245305b261ecSmrg	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
245405b261ecSmrg	    abs_ladir="$ladir"
245505b261ecSmrg	  fi
245605b261ecSmrg	  ;;
245705b261ecSmrg	esac
245805b261ecSmrg	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
245905b261ecSmrg
246005b261ecSmrg	# Find the relevant object directory and library name.
246105b261ecSmrg	if test "X$installed" = Xyes; then
246205b261ecSmrg	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
246305b261ecSmrg	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
246405b261ecSmrg	    dir="$ladir"
246505b261ecSmrg	    absdir="$abs_ladir"
246605b261ecSmrg	    libdir="$abs_ladir"
246705b261ecSmrg	  else
246805b261ecSmrg	    dir="$libdir"
246905b261ecSmrg	    absdir="$libdir"
247005b261ecSmrg	  fi
247105b261ecSmrg	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
247205b261ecSmrg	else
247305b261ecSmrg	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
247405b261ecSmrg	    dir="$ladir"
247505b261ecSmrg	    absdir="$abs_ladir"
247605b261ecSmrg	    # Remove this search path later
247705b261ecSmrg	    notinst_path="$notinst_path $abs_ladir"
247805b261ecSmrg	  else
247905b261ecSmrg	    dir="$ladir/$objdir"
248005b261ecSmrg	    absdir="$abs_ladir/$objdir"
248105b261ecSmrg	    # Remove this search path later
248205b261ecSmrg	    notinst_path="$notinst_path $abs_ladir"
248305b261ecSmrg	  fi
248405b261ecSmrg	fi # $installed = yes
248505b261ecSmrg	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
248605b261ecSmrg
248705b261ecSmrg	# This library was specified with -dlpreopen.
248805b261ecSmrg	if test "$pass" = dlpreopen; then
248905b261ecSmrg	  if test -z "$libdir"; then
249005b261ecSmrg	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
249105b261ecSmrg	    exit $EXIT_FAILURE
249205b261ecSmrg	  fi
249305b261ecSmrg	  # Prefer using a static library (so that no silly _DYNAMIC symbols
249405b261ecSmrg	  # are required to link).
249505b261ecSmrg	  if test -n "$old_library"; then
249605b261ecSmrg	    newdlprefiles="$newdlprefiles $dir/$old_library"
249705b261ecSmrg	  # Otherwise, use the dlname, so that lt_dlopen finds it.
249805b261ecSmrg	  elif test -n "$dlname"; then
249905b261ecSmrg	    newdlprefiles="$newdlprefiles $dir/$dlname"
250005b261ecSmrg	  else
250105b261ecSmrg	    newdlprefiles="$newdlprefiles $dir/$linklib"
250205b261ecSmrg	  fi
250305b261ecSmrg	fi # $pass = dlpreopen
250405b261ecSmrg
250505b261ecSmrg	if test -z "$libdir"; then
250605b261ecSmrg	  # Link the convenience library
250705b261ecSmrg	  if test "$linkmode" = lib; then
250805b261ecSmrg	    deplibs="$dir/$old_library $deplibs"
250905b261ecSmrg	  elif test "$linkmode,$pass" = "prog,link"; then
251005b261ecSmrg	    compile_deplibs="$dir/$old_library $compile_deplibs"
251105b261ecSmrg	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
251205b261ecSmrg	  else
251305b261ecSmrg	    deplibs="$lib $deplibs" # used for prog,scan pass
251405b261ecSmrg	  fi
251505b261ecSmrg	  continue
251605b261ecSmrg	fi
251705b261ecSmrg
251805b261ecSmrg
251905b261ecSmrg	if test "$linkmode" = prog && test "$pass" != link; then
252005b261ecSmrg	  newlib_search_path="$newlib_search_path $ladir"
252105b261ecSmrg	  deplibs="$lib $deplibs"
252205b261ecSmrg
252305b261ecSmrg	  linkalldeplibs=no
252405b261ecSmrg	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
252505b261ecSmrg	     test "$build_libtool_libs" = no; then
252605b261ecSmrg	    linkalldeplibs=yes
252705b261ecSmrg	  fi
252805b261ecSmrg
252905b261ecSmrg	  tmp_libs=
253005b261ecSmrg	  for deplib in $dependency_libs; do
253105b261ecSmrg	    case $deplib in
253205b261ecSmrg	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
253305b261ecSmrg	    esac
253405b261ecSmrg	    # Need to link against all dependency_libs?
253505b261ecSmrg	    if test "$linkalldeplibs" = yes; then
253605b261ecSmrg	      deplibs="$deplib $deplibs"
253705b261ecSmrg	    else
253805b261ecSmrg	      # Need to hardcode shared library paths
253905b261ecSmrg	      # or/and link against static libraries
254005b261ecSmrg	      newdependency_libs="$deplib $newdependency_libs"
254105b261ecSmrg	    fi
254205b261ecSmrg	    if test "X$duplicate_deps" = "Xyes" ; then
254305b261ecSmrg	      case "$tmp_libs " in
254405b261ecSmrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
254505b261ecSmrg	      esac
254605b261ecSmrg	    fi
254705b261ecSmrg	    tmp_libs="$tmp_libs $deplib"
254805b261ecSmrg	  done # for deplib
254905b261ecSmrg	  continue
255005b261ecSmrg	fi # $linkmode = prog...
255105b261ecSmrg
255205b261ecSmrg	if test "$linkmode,$pass" = "prog,link"; then
255305b261ecSmrg	  if test -n "$library_names" &&
255405b261ecSmrg	     { { test "$prefer_static_libs" = no ||
255505b261ecSmrg		 test "$prefer_static_libs,$installed" = "built,yes"; } ||
255605b261ecSmrg	       test -z "$old_library"; }; then
255705b261ecSmrg	    # We need to hardcode the library path
255805b261ecSmrg	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
255905b261ecSmrg	      # Make sure the rpath contains only unique directories.
256005b261ecSmrg	      case "$temp_rpath " in
256105b261ecSmrg	      *" $dir "*) ;;
256205b261ecSmrg	      *" $absdir "*) ;;
256305b261ecSmrg	      *) temp_rpath="$temp_rpath $absdir" ;;
256405b261ecSmrg	      esac
256505b261ecSmrg	    fi
256605b261ecSmrg
256705b261ecSmrg	    # Hardcode the library path.
256805b261ecSmrg	    # Skip directories that are in the system default run-time
256905b261ecSmrg	    # search path.
257005b261ecSmrg	    case " $sys_lib_dlsearch_path " in
257105b261ecSmrg	    *" $absdir "*) ;;
257205b261ecSmrg	    *)
257305b261ecSmrg	      case "$compile_rpath " in
257405b261ecSmrg	      *" $absdir "*) ;;
257505b261ecSmrg	      *) compile_rpath="$compile_rpath $absdir"
257605b261ecSmrg	      esac
257705b261ecSmrg	      ;;
257805b261ecSmrg	    esac
257905b261ecSmrg	    case " $sys_lib_dlsearch_path " in
258005b261ecSmrg	    *" $libdir "*) ;;
258105b261ecSmrg	    *)
258205b261ecSmrg	      case "$finalize_rpath " in
258305b261ecSmrg	      *" $libdir "*) ;;
258405b261ecSmrg	      *) finalize_rpath="$finalize_rpath $libdir"
258505b261ecSmrg	      esac
258605b261ecSmrg	      ;;
258705b261ecSmrg	    esac
258805b261ecSmrg	  fi # $linkmode,$pass = prog,link...
258905b261ecSmrg
259005b261ecSmrg	  if test "$alldeplibs" = yes &&
259105b261ecSmrg	     { test "$deplibs_check_method" = pass_all ||
259205b261ecSmrg	       { test "$build_libtool_libs" = yes &&
259305b261ecSmrg		 test -n "$library_names"; }; }; then
259405b261ecSmrg	    # We only need to search for static libraries
259505b261ecSmrg	    continue
259605b261ecSmrg	  fi
259705b261ecSmrg	fi
259805b261ecSmrg
259905b261ecSmrg	link_static=no # Whether the deplib will be linked statically
260005b261ecSmrg	use_static_libs=$prefer_static_libs
260105b261ecSmrg	if test "$use_static_libs" = built && test "$installed" = yes ; then
260205b261ecSmrg	  use_static_libs=no
260305b261ecSmrg	fi
260405b261ecSmrg	if test -n "$library_names" &&
260505b261ecSmrg	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
260605b261ecSmrg	  if test "$installed" = no; then
260705b261ecSmrg	    notinst_deplibs="$notinst_deplibs $lib"
260805b261ecSmrg	    need_relink=yes
260905b261ecSmrg	  fi
261005b261ecSmrg	  # This is a shared library
261105b261ecSmrg
261205b261ecSmrg	  # Warn about portability, can't link against -module's on
261305b261ecSmrg	  # some systems (darwin)
261405b261ecSmrg	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
261505b261ecSmrg	    $echo
261605b261ecSmrg	    if test "$linkmode" = prog; then
261705b261ecSmrg	      $echo "*** Warning: Linking the executable $output against the loadable module"
261805b261ecSmrg	    else
261905b261ecSmrg	      $echo "*** Warning: Linking the shared library $output against the loadable module"
262005b261ecSmrg	    fi
262105b261ecSmrg	    $echo "*** $linklib is not portable!"
262205b261ecSmrg	  fi
262305b261ecSmrg	  if test "$linkmode" = lib &&
262405b261ecSmrg	     test "$hardcode_into_libs" = yes; then
262505b261ecSmrg	    # Hardcode the library path.
262605b261ecSmrg	    # Skip directories that are in the system default run-time
262705b261ecSmrg	    # search path.
262805b261ecSmrg	    case " $sys_lib_dlsearch_path " in
262905b261ecSmrg	    *" $absdir "*) ;;
263005b261ecSmrg	    *)
263105b261ecSmrg	      case "$compile_rpath " in
263205b261ecSmrg	      *" $absdir "*) ;;
263305b261ecSmrg	      *) compile_rpath="$compile_rpath $absdir"
263405b261ecSmrg	      esac
263505b261ecSmrg	      ;;
263605b261ecSmrg	    esac
263705b261ecSmrg	    case " $sys_lib_dlsearch_path " in
263805b261ecSmrg	    *" $libdir "*) ;;
263905b261ecSmrg	    *)
264005b261ecSmrg	      case "$finalize_rpath " in
264105b261ecSmrg	      *" $libdir "*) ;;
264205b261ecSmrg	      *) finalize_rpath="$finalize_rpath $libdir"
264305b261ecSmrg	      esac
264405b261ecSmrg	      ;;
264505b261ecSmrg	    esac
264605b261ecSmrg	  fi
264705b261ecSmrg
264805b261ecSmrg	  if test -n "$old_archive_from_expsyms_cmds"; then
264905b261ecSmrg	    # figure out the soname
265005b261ecSmrg	    set dummy $library_names
265105b261ecSmrg	    realname="$2"
265205b261ecSmrg	    shift; shift
265305b261ecSmrg	    libname=`eval \\$echo \"$libname_spec\"`
265405b261ecSmrg	    # use dlname if we got it. it's perfectly good, no?
265505b261ecSmrg	    if test -n "$dlname"; then
265605b261ecSmrg	      soname="$dlname"
265705b261ecSmrg	    elif test -n "$soname_spec"; then
265805b261ecSmrg	      # bleh windows
265905b261ecSmrg	      case $host in
266005b261ecSmrg	      *cygwin* | mingw*)
266105b261ecSmrg		major=`expr $current - $age`
266205b261ecSmrg		versuffix="-$major"
266305b261ecSmrg		;;
266405b261ecSmrg	      esac
266505b261ecSmrg	      eval soname=\"$soname_spec\"
266605b261ecSmrg	    else
266705b261ecSmrg	      soname="$realname"
266805b261ecSmrg	    fi
266905b261ecSmrg
267005b261ecSmrg	    # Make a new name for the extract_expsyms_cmds to use
267105b261ecSmrg	    soroot="$soname"
267205b261ecSmrg	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
267305b261ecSmrg	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
267405b261ecSmrg
267505b261ecSmrg	    # If the library has no export list, then create one now
267605b261ecSmrg	    if test -f "$output_objdir/$soname-def"; then :
267705b261ecSmrg	    else
267805b261ecSmrg	      $show "extracting exported symbol list from \`$soname'"
267905b261ecSmrg	      save_ifs="$IFS"; IFS='~'
268005b261ecSmrg	      cmds=$extract_expsyms_cmds
268105b261ecSmrg	      for cmd in $cmds; do
268205b261ecSmrg		IFS="$save_ifs"
268305b261ecSmrg		eval cmd=\"$cmd\"
268405b261ecSmrg		$show "$cmd"
268505b261ecSmrg		$run eval "$cmd" || exit $?
268605b261ecSmrg	      done
268705b261ecSmrg	      IFS="$save_ifs"
268805b261ecSmrg	    fi
268905b261ecSmrg
269005b261ecSmrg	    # Create $newlib
269105b261ecSmrg	    if test -f "$output_objdir/$newlib"; then :; else
269205b261ecSmrg	      $show "generating import library for \`$soname'"
269305b261ecSmrg	      save_ifs="$IFS"; IFS='~'
269405b261ecSmrg	      cmds=$old_archive_from_expsyms_cmds
269505b261ecSmrg	      for cmd in $cmds; do
269605b261ecSmrg		IFS="$save_ifs"
269705b261ecSmrg		eval cmd=\"$cmd\"
269805b261ecSmrg		$show "$cmd"
269905b261ecSmrg		$run eval "$cmd" || exit $?
270005b261ecSmrg	      done
270105b261ecSmrg	      IFS="$save_ifs"
270205b261ecSmrg	    fi
270305b261ecSmrg	    # make sure the library variables are pointing to the new library
270405b261ecSmrg	    dir=$output_objdir
270505b261ecSmrg	    linklib=$newlib
270605b261ecSmrg	  fi # test -n "$old_archive_from_expsyms_cmds"
270705b261ecSmrg
270805b261ecSmrg	  if test "$linkmode" = prog || test "$mode" != relink; then
270905b261ecSmrg	    add_shlibpath=
271005b261ecSmrg	    add_dir=
271105b261ecSmrg	    add=
271205b261ecSmrg	    lib_linked=yes
271305b261ecSmrg	    case $hardcode_action in
271405b261ecSmrg	    immediate | unsupported)
271505b261ecSmrg	      if test "$hardcode_direct" = no; then
271605b261ecSmrg		add="$dir/$linklib"
271705b261ecSmrg		case $host in
271805b261ecSmrg		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
271905b261ecSmrg		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
272005b261ecSmrg		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
272105b261ecSmrg		    *-*-unixware7*) add_dir="-L$dir" ;;
272205b261ecSmrg		  *-*-darwin* )
272305b261ecSmrg		    # if the lib is a module then we can not link against
272405b261ecSmrg		    # it, someone is ignoring the new warnings I added
272505b261ecSmrg		    if /usr/bin/file -L $add 2> /dev/null |
272605b261ecSmrg                      $EGREP ": [^:]* bundle" >/dev/null ; then
272705b261ecSmrg		      $echo "** Warning, lib $linklib is a module, not a shared library"
272805b261ecSmrg		      if test -z "$old_library" ; then
272905b261ecSmrg		        $echo
273005b261ecSmrg		        $echo "** And there doesn't seem to be a static archive available"
273105b261ecSmrg		        $echo "** The link will probably fail, sorry"
273205b261ecSmrg		      else
273305b261ecSmrg		        add="$dir/$old_library"
273405b261ecSmrg		      fi
273505b261ecSmrg		    fi
273605b261ecSmrg		esac
273705b261ecSmrg	      elif test "$hardcode_minus_L" = no; then
273805b261ecSmrg		case $host in
273905b261ecSmrg		*-*-sunos*) add_shlibpath="$dir" ;;
274005b261ecSmrg		esac
274105b261ecSmrg		add_dir="-L$dir"
274205b261ecSmrg		add="-l$name"
274305b261ecSmrg	      elif test "$hardcode_shlibpath_var" = no; then
274405b261ecSmrg		add_shlibpath="$dir"
274505b261ecSmrg		add="-l$name"
274605b261ecSmrg	      else
274705b261ecSmrg		lib_linked=no
274805b261ecSmrg	      fi
274905b261ecSmrg	      ;;
275005b261ecSmrg	    relink)
275105b261ecSmrg	      if test "$hardcode_direct" = yes; then
275205b261ecSmrg		add="$dir/$linklib"
275305b261ecSmrg	      elif test "$hardcode_minus_L" = yes; then
275405b261ecSmrg		add_dir="-L$dir"
275505b261ecSmrg		# Try looking first in the location we're being installed to.
275605b261ecSmrg		if test -n "$inst_prefix_dir"; then
275705b261ecSmrg		  case $libdir in
275805b261ecSmrg		    [\\/]*)
275905b261ecSmrg		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
276005b261ecSmrg		      ;;
276105b261ecSmrg		  esac
276205b261ecSmrg		fi
276305b261ecSmrg		add="-l$name"
276405b261ecSmrg	      elif test "$hardcode_shlibpath_var" = yes; then
276505b261ecSmrg		add_shlibpath="$dir"
276605b261ecSmrg		add="-l$name"
276705b261ecSmrg	      else
276805b261ecSmrg		lib_linked=no
276905b261ecSmrg	      fi
277005b261ecSmrg	      ;;
277105b261ecSmrg	    *) lib_linked=no ;;
277205b261ecSmrg	    esac
277305b261ecSmrg
277405b261ecSmrg	    if test "$lib_linked" != yes; then
277505b261ecSmrg	      $echo "$modename: configuration error: unsupported hardcode properties"
277605b261ecSmrg	      exit $EXIT_FAILURE
277705b261ecSmrg	    fi
277805b261ecSmrg
277905b261ecSmrg	    if test -n "$add_shlibpath"; then
278005b261ecSmrg	      case :$compile_shlibpath: in
278105b261ecSmrg	      *":$add_shlibpath:"*) ;;
278205b261ecSmrg	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
278305b261ecSmrg	      esac
278405b261ecSmrg	    fi
278505b261ecSmrg	    if test "$linkmode" = prog; then
278605b261ecSmrg	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
278705b261ecSmrg	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
278805b261ecSmrg	    else
278905b261ecSmrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
279005b261ecSmrg	      test -n "$add" && deplibs="$add $deplibs"
279105b261ecSmrg	      if test "$hardcode_direct" != yes && \
279205b261ecSmrg		 test "$hardcode_minus_L" != yes && \
279305b261ecSmrg		 test "$hardcode_shlibpath_var" = yes; then
279405b261ecSmrg		case :$finalize_shlibpath: in
279505b261ecSmrg		*":$libdir:"*) ;;
279605b261ecSmrg		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
279705b261ecSmrg		esac
279805b261ecSmrg	      fi
279905b261ecSmrg	    fi
280005b261ecSmrg	  fi
280105b261ecSmrg
280205b261ecSmrg	  if test "$linkmode" = prog || test "$mode" = relink; then
280305b261ecSmrg	    add_shlibpath=
280405b261ecSmrg	    add_dir=
280505b261ecSmrg	    add=
280605b261ecSmrg	    # Finalize command for both is simple: just hardcode it.
280705b261ecSmrg	    if test "$hardcode_direct" = yes; then
280805b261ecSmrg	      add="$libdir/$linklib"
280905b261ecSmrg	    elif test "$hardcode_minus_L" = yes; then
281005b261ecSmrg	      add_dir="-L$libdir"
281105b261ecSmrg	      add="-l$name"
281205b261ecSmrg	    elif test "$hardcode_shlibpath_var" = yes; then
281305b261ecSmrg	      case :$finalize_shlibpath: in
281405b261ecSmrg	      *":$libdir:"*) ;;
281505b261ecSmrg	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
281605b261ecSmrg	      esac
281705b261ecSmrg	      add="-l$name"
281805b261ecSmrg	    elif test "$hardcode_automatic" = yes; then
281905b261ecSmrg	      if test -n "$inst_prefix_dir" &&
282005b261ecSmrg		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
282105b261ecSmrg	        add="$inst_prefix_dir$libdir/$linklib"
282205b261ecSmrg	      else
282305b261ecSmrg	        add="$libdir/$linklib"
282405b261ecSmrg	      fi
282505b261ecSmrg	    else
282605b261ecSmrg	      # We cannot seem to hardcode it, guess we'll fake it.
282705b261ecSmrg	      add_dir="-L$libdir"
282805b261ecSmrg	      # Try looking first in the location we're being installed to.
282905b261ecSmrg	      if test -n "$inst_prefix_dir"; then
283005b261ecSmrg		case $libdir in
283105b261ecSmrg		  [\\/]*)
283205b261ecSmrg		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
283305b261ecSmrg		    ;;
283405b261ecSmrg		esac
283505b261ecSmrg	      fi
283605b261ecSmrg	      add="-l$name"
283705b261ecSmrg	    fi
283805b261ecSmrg
283905b261ecSmrg	    if test "$linkmode" = prog; then
284005b261ecSmrg	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
284105b261ecSmrg	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
284205b261ecSmrg	    else
284305b261ecSmrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
284405b261ecSmrg	      test -n "$add" && deplibs="$add $deplibs"
284505b261ecSmrg	    fi
284605b261ecSmrg	  fi
284705b261ecSmrg	elif test "$linkmode" = prog; then
284805b261ecSmrg	  # Here we assume that one of hardcode_direct or hardcode_minus_L
284905b261ecSmrg	  # is not unsupported.  This is valid on all known static and
285005b261ecSmrg	  # shared platforms.
285105b261ecSmrg	  if test "$hardcode_direct" != unsupported; then
285205b261ecSmrg	    test -n "$old_library" && linklib="$old_library"
285305b261ecSmrg	    compile_deplibs="$dir/$linklib $compile_deplibs"
285405b261ecSmrg	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
285505b261ecSmrg	  else
285605b261ecSmrg	    compile_deplibs="-l$name -L$dir $compile_deplibs"
285705b261ecSmrg	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
285805b261ecSmrg	  fi
285905b261ecSmrg	elif test "$build_libtool_libs" = yes; then
286005b261ecSmrg	  # Not a shared library
286105b261ecSmrg	  if test "$deplibs_check_method" != pass_all; then
286205b261ecSmrg	    # We're trying link a shared library against a static one
286305b261ecSmrg	    # but the system doesn't support it.
286405b261ecSmrg
286505b261ecSmrg	    # Just print a warning and add the library to dependency_libs so
286605b261ecSmrg	    # that the program can be linked against the static library.
286705b261ecSmrg	    $echo
286805b261ecSmrg	    $echo "*** Warning: This system can not link to static lib archive $lib."
286905b261ecSmrg	    $echo "*** I have the capability to make that library automatically link in when"
287005b261ecSmrg	    $echo "*** you link to this library.  But I can only do this if you have a"
287105b261ecSmrg	    $echo "*** shared version of the library, which you do not appear to have."
287205b261ecSmrg	    if test "$module" = yes; then
287305b261ecSmrg	      $echo "*** But as you try to build a module library, libtool will still create "
287405b261ecSmrg	      $echo "*** a static module, that should work as long as the dlopening application"
287505b261ecSmrg	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
287605b261ecSmrg	      if test -z "$global_symbol_pipe"; then
287705b261ecSmrg		$echo
287805b261ecSmrg		$echo "*** However, this would only work if libtool was able to extract symbol"
287905b261ecSmrg		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
288005b261ecSmrg		$echo "*** not find such a program.  So, this module is probably useless."
288105b261ecSmrg		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
288205b261ecSmrg	      fi
288305b261ecSmrg	      if test "$build_old_libs" = no; then
288405b261ecSmrg		build_libtool_libs=module
288505b261ecSmrg		build_old_libs=yes
288605b261ecSmrg	      else
288705b261ecSmrg		build_libtool_libs=no
288805b261ecSmrg	      fi
288905b261ecSmrg	    fi
289005b261ecSmrg	  else
289105b261ecSmrg	    deplibs="$dir/$old_library $deplibs"
289205b261ecSmrg	    link_static=yes
289305b261ecSmrg	  fi
289405b261ecSmrg	fi # link shared/static library?
289505b261ecSmrg
289605b261ecSmrg	if test "$linkmode" = lib; then
289705b261ecSmrg	  if test -n "$dependency_libs" &&
289805b261ecSmrg	     { test "$hardcode_into_libs" != yes ||
289905b261ecSmrg	       test "$build_old_libs" = yes ||
290005b261ecSmrg	       test "$link_static" = yes; }; then
290105b261ecSmrg	    # Extract -R from dependency_libs
290205b261ecSmrg	    temp_deplibs=
290305b261ecSmrg	    for libdir in $dependency_libs; do
290405b261ecSmrg	      case $libdir in
290505b261ecSmrg	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
290605b261ecSmrg		   case " $xrpath " in
290705b261ecSmrg		   *" $temp_xrpath "*) ;;
290805b261ecSmrg		   *) xrpath="$xrpath $temp_xrpath";;
290905b261ecSmrg		   esac;;
291005b261ecSmrg	      *) temp_deplibs="$temp_deplibs $libdir";;
291105b261ecSmrg	      esac
291205b261ecSmrg	    done
291305b261ecSmrg	    dependency_libs="$temp_deplibs"
291405b261ecSmrg	  fi
291505b261ecSmrg
291605b261ecSmrg	  newlib_search_path="$newlib_search_path $absdir"
291705b261ecSmrg	  # Link against this library
291805b261ecSmrg	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
291905b261ecSmrg	  # ... and its dependency_libs
292005b261ecSmrg	  tmp_libs=
292105b261ecSmrg	  for deplib in $dependency_libs; do
292205b261ecSmrg	    newdependency_libs="$deplib $newdependency_libs"
292305b261ecSmrg	    if test "X$duplicate_deps" = "Xyes" ; then
292405b261ecSmrg	      case "$tmp_libs " in
292505b261ecSmrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
292605b261ecSmrg	      esac
292705b261ecSmrg	    fi
292805b261ecSmrg	    tmp_libs="$tmp_libs $deplib"
292905b261ecSmrg	  done
293005b261ecSmrg
293105b261ecSmrg	  if test "$link_all_deplibs" != no; then
293205b261ecSmrg	    # Add the search paths of all dependency libraries
293305b261ecSmrg	    for deplib in $dependency_libs; do
293405b261ecSmrg	      case $deplib in
293505b261ecSmrg	      -L*) path="$deplib" ;;
293605b261ecSmrg	      *.la)
293705b261ecSmrg		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
293805b261ecSmrg		test "X$dir" = "X$deplib" && dir="."
293905b261ecSmrg		# We need an absolute path.
294005b261ecSmrg		case $dir in
294105b261ecSmrg		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
294205b261ecSmrg		*)
294305b261ecSmrg		  absdir=`cd "$dir" && pwd`
294405b261ecSmrg		  if test -z "$absdir"; then
294505b261ecSmrg		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
294605b261ecSmrg		    absdir="$dir"
294705b261ecSmrg		  fi
294805b261ecSmrg		  ;;
294905b261ecSmrg		esac
295005b261ecSmrg		if grep "^installed=no" $deplib > /dev/null; then
295105b261ecSmrg		  path="$absdir/$objdir"
295205b261ecSmrg		else
295305b261ecSmrg		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
295405b261ecSmrg		  if test -z "$libdir"; then
295505b261ecSmrg		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
295605b261ecSmrg		    exit $EXIT_FAILURE
295705b261ecSmrg		  fi
295805b261ecSmrg		  if test "$absdir" != "$libdir"; then
295905b261ecSmrg		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
296005b261ecSmrg		  fi
296105b261ecSmrg		  path="$absdir"
296205b261ecSmrg		fi
296305b261ecSmrg		depdepl=
296405b261ecSmrg		case $host in
296505b261ecSmrg		*-*-darwin*)
296605b261ecSmrg		  # we do not want to link against static libs,
296705b261ecSmrg		  # but need to link against shared
296805b261ecSmrg		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
296905b261ecSmrg		  eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
297005b261ecSmrg		  if test -n "$deplibrary_names" ; then
297105b261ecSmrg		    for tmp in $deplibrary_names ; do
297205b261ecSmrg		      depdepl=$tmp
297305b261ecSmrg		    done
297405b261ecSmrg		    if test -f "$deplibdir/$depdepl" ; then
297505b261ecSmrg		      depdepl="$deplibdir/$depdepl"
297605b261ecSmrg	      	    elif test -f "$path/$depdepl" ; then
297705b261ecSmrg		      depdepl="$path/$depdepl"
297805b261ecSmrg		    else
297905b261ecSmrg		      # Can't find it, oh well...
298005b261ecSmrg		      depdepl=
298105b261ecSmrg		    fi
298205b261ecSmrg		    # do not add paths which are already there
298305b261ecSmrg		    case " $newlib_search_path " in
298405b261ecSmrg		    *" $path "*) ;;
298505b261ecSmrg		    *) newlib_search_path="$newlib_search_path $path";;
298605b261ecSmrg		    esac
298705b261ecSmrg		  fi
298805b261ecSmrg		  path=""
298905b261ecSmrg		  ;;
299005b261ecSmrg		*)
299105b261ecSmrg		  path="-L$path"
299205b261ecSmrg		  ;;
299305b261ecSmrg		esac
299405b261ecSmrg		;;
299505b261ecSmrg	      -l*)
299605b261ecSmrg		case $host in
299705b261ecSmrg		*-*-darwin*)
299805b261ecSmrg		  # Again, we only want to link against shared libraries
299905b261ecSmrg		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
300005b261ecSmrg		  for tmp in $newlib_search_path ; do
300105b261ecSmrg		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
300205b261ecSmrg		      eval depdepl="$tmp/lib$tmp_libs.dylib"
300305b261ecSmrg		      break
300405b261ecSmrg		    fi
300505b261ecSmrg		  done
300605b261ecSmrg		  path=""
300705b261ecSmrg		  ;;
300805b261ecSmrg		*) continue ;;
300905b261ecSmrg		esac
301005b261ecSmrg		;;
301105b261ecSmrg	      *) continue ;;
301205b261ecSmrg	      esac
301305b261ecSmrg	      case " $deplibs " in
301405b261ecSmrg	      *" $path "*) ;;
301505b261ecSmrg	      *) deplibs="$path $deplibs" ;;
301605b261ecSmrg	      esac
301705b261ecSmrg	      case " $deplibs " in
301805b261ecSmrg	      *" $depdepl "*) ;;
301905b261ecSmrg	      *) deplibs="$depdepl $deplibs" ;;
302005b261ecSmrg	      esac
302105b261ecSmrg	    done
302205b261ecSmrg	  fi # link_all_deplibs != no
302305b261ecSmrg	fi # linkmode = lib
302405b261ecSmrg      done # for deplib in $libs
302505b261ecSmrg      dependency_libs="$newdependency_libs"
302605b261ecSmrg      if test "$pass" = dlpreopen; then
302705b261ecSmrg	# Link the dlpreopened libraries before other libraries
302805b261ecSmrg	for deplib in $save_deplibs; do
302905b261ecSmrg	  deplibs="$deplib $deplibs"
303005b261ecSmrg	done
303105b261ecSmrg      fi
303205b261ecSmrg      if test "$pass" != dlopen; then
303305b261ecSmrg	if test "$pass" != conv; then
303405b261ecSmrg	  # Make sure lib_search_path contains only unique directories.
303505b261ecSmrg	  lib_search_path=
303605b261ecSmrg	  for dir in $newlib_search_path; do
303705b261ecSmrg	    case "$lib_search_path " in
303805b261ecSmrg	    *" $dir "*) ;;
303905b261ecSmrg	    *) lib_search_path="$lib_search_path $dir" ;;
304005b261ecSmrg	    esac
304105b261ecSmrg	  done
304205b261ecSmrg	  newlib_search_path=
304305b261ecSmrg	fi
304405b261ecSmrg
304505b261ecSmrg	if test "$linkmode,$pass" != "prog,link"; then
304605b261ecSmrg	  vars="deplibs"
304705b261ecSmrg	else
304805b261ecSmrg	  vars="compile_deplibs finalize_deplibs"
304905b261ecSmrg	fi
305005b261ecSmrg	for var in $vars dependency_libs; do
305105b261ecSmrg	  # Add libraries to $var in reverse order
305205b261ecSmrg	  eval tmp_libs=\"\$$var\"
305305b261ecSmrg	  new_libs=
305405b261ecSmrg	  for deplib in $tmp_libs; do
305505b261ecSmrg	    # FIXME: Pedantically, this is the right thing to do, so
305605b261ecSmrg	    #        that some nasty dependency loop isn't accidentally
305705b261ecSmrg	    #        broken:
305805b261ecSmrg	    #new_libs="$deplib $new_libs"
305905b261ecSmrg	    # Pragmatically, this seems to cause very few problems in
306005b261ecSmrg	    # practice:
306105b261ecSmrg	    case $deplib in
306205b261ecSmrg	    -L*) new_libs="$deplib $new_libs" ;;
306305b261ecSmrg	    -R*) ;;
306405b261ecSmrg	    *)
306505b261ecSmrg	      # And here is the reason: when a library appears more
306605b261ecSmrg	      # than once as an explicit dependence of a library, or
306705b261ecSmrg	      # is implicitly linked in more than once by the
306805b261ecSmrg	      # compiler, it is considered special, and multiple
306905b261ecSmrg	      # occurrences thereof are not removed.  Compare this
307005b261ecSmrg	      # with having the same library being listed as a
307105b261ecSmrg	      # dependency of multiple other libraries: in this case,
307205b261ecSmrg	      # we know (pedantically, we assume) the library does not
307305b261ecSmrg	      # need to be listed more than once, so we keep only the
307405b261ecSmrg	      # last copy.  This is not always right, but it is rare
307505b261ecSmrg	      # enough that we require users that really mean to play
307605b261ecSmrg	      # such unportable linking tricks to link the library
307705b261ecSmrg	      # using -Wl,-lname, so that libtool does not consider it
307805b261ecSmrg	      # for duplicate removal.
307905b261ecSmrg	      case " $specialdeplibs " in
308005b261ecSmrg	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
308105b261ecSmrg	      *)
308205b261ecSmrg		case " $new_libs " in
308305b261ecSmrg		*" $deplib "*) ;;
308405b261ecSmrg		*) new_libs="$deplib $new_libs" ;;
308505b261ecSmrg		esac
308605b261ecSmrg		;;
308705b261ecSmrg	      esac
308805b261ecSmrg	      ;;
308905b261ecSmrg	    esac
309005b261ecSmrg	  done
309105b261ecSmrg	  tmp_libs=
309205b261ecSmrg	  for deplib in $new_libs; do
309305b261ecSmrg	    case $deplib in
309405b261ecSmrg	    -L*)
309505b261ecSmrg	      case " $tmp_libs " in
309605b261ecSmrg	      *" $deplib "*) ;;
309705b261ecSmrg	      *) tmp_libs="$tmp_libs $deplib" ;;
309805b261ecSmrg	      esac
309905b261ecSmrg	      ;;
310005b261ecSmrg	    *) tmp_libs="$tmp_libs $deplib" ;;
310105b261ecSmrg	    esac
310205b261ecSmrg	  done
310305b261ecSmrg	  eval $var=\"$tmp_libs\"
310405b261ecSmrg	done # for var
310505b261ecSmrg      fi
310605b261ecSmrg      # Last step: remove runtime libs from dependency_libs
310705b261ecSmrg      # (they stay in deplibs)
310805b261ecSmrg      tmp_libs=
310905b261ecSmrg      for i in $dependency_libs ; do
311005b261ecSmrg	case " $predeps $postdeps $compiler_lib_search_path " in
311105b261ecSmrg	*" $i "*)
311205b261ecSmrg	  i=""
311305b261ecSmrg	  ;;
311405b261ecSmrg	esac
311505b261ecSmrg	if test -n "$i" ; then
311605b261ecSmrg	  tmp_libs="$tmp_libs $i"
311705b261ecSmrg	fi
311805b261ecSmrg      done
311905b261ecSmrg      dependency_libs=$tmp_libs
312005b261ecSmrg    done # for pass
312105b261ecSmrg    if test "$linkmode" = prog; then
312205b261ecSmrg      dlfiles="$newdlfiles"
312305b261ecSmrg      dlprefiles="$newdlprefiles"
312405b261ecSmrg    fi
312505b261ecSmrg
312605b261ecSmrg    case $linkmode in
312705b261ecSmrg    oldlib)
312805b261ecSmrg      case " $deplibs" in
312905b261ecSmrg      *\ -l* | *\ -L*)
313005b261ecSmrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
313105b261ecSmrg      esac
313205b261ecSmrg
313305b261ecSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
313405b261ecSmrg	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
313505b261ecSmrg      fi
313605b261ecSmrg
313705b261ecSmrg      if test -n "$rpath"; then
313805b261ecSmrg	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
313905b261ecSmrg      fi
314005b261ecSmrg
314105b261ecSmrg      if test -n "$xrpath"; then
314205b261ecSmrg	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
314305b261ecSmrg      fi
314405b261ecSmrg
314505b261ecSmrg      if test -n "$vinfo"; then
314605b261ecSmrg	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
314705b261ecSmrg      fi
314805b261ecSmrg
314905b261ecSmrg      if test -n "$release"; then
315005b261ecSmrg	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
315105b261ecSmrg      fi
315205b261ecSmrg
315305b261ecSmrg      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
315405b261ecSmrg	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
315505b261ecSmrg      fi
315605b261ecSmrg
315705b261ecSmrg      # Now set the variables for building old libraries.
315805b261ecSmrg      build_libtool_libs=no
315905b261ecSmrg      oldlibs="$output"
316005b261ecSmrg      objs="$objs$old_deplibs"
316105b261ecSmrg      ;;
316205b261ecSmrg
316305b261ecSmrg    lib)
316405b261ecSmrg      # Make sure we only generate libraries of the form `libNAME.la'.
316505b261ecSmrg      case $outputname in
316605b261ecSmrg      lib*)
316705b261ecSmrg	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
316805b261ecSmrg	eval shared_ext=\"$shrext_cmds\"
316905b261ecSmrg	eval libname=\"$libname_spec\"
317005b261ecSmrg	;;
317105b261ecSmrg      *)
317205b261ecSmrg	if test "$module" = no; then
317305b261ecSmrg	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
317405b261ecSmrg	  $echo "$help" 1>&2
317505b261ecSmrg	  exit $EXIT_FAILURE
317605b261ecSmrg	fi
317705b261ecSmrg	if test "$need_lib_prefix" != no; then
317805b261ecSmrg	  # Add the "lib" prefix for modules if required
317905b261ecSmrg	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
318005b261ecSmrg	  eval shared_ext=\"$shrext_cmds\"
318105b261ecSmrg	  eval libname=\"$libname_spec\"
318205b261ecSmrg	else
318305b261ecSmrg	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
318405b261ecSmrg	fi
318505b261ecSmrg	;;
318605b261ecSmrg      esac
318705b261ecSmrg
318805b261ecSmrg      if test -n "$objs"; then
318905b261ecSmrg	if test "$deplibs_check_method" != pass_all; then
319005b261ecSmrg	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
319105b261ecSmrg	  exit $EXIT_FAILURE
319205b261ecSmrg	else
319305b261ecSmrg	  $echo
319405b261ecSmrg	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
319505b261ecSmrg	  $echo "*** objects $objs is not portable!"
319605b261ecSmrg	  libobjs="$libobjs $objs"
319705b261ecSmrg	fi
319805b261ecSmrg      fi
319905b261ecSmrg
320005b261ecSmrg      if test "$dlself" != no; then
320105b261ecSmrg	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
320205b261ecSmrg      fi
320305b261ecSmrg
320405b261ecSmrg      set dummy $rpath
320505b261ecSmrg      if test "$#" -gt 2; then
320605b261ecSmrg	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
320705b261ecSmrg      fi
320805b261ecSmrg      install_libdir="$2"
320905b261ecSmrg
321005b261ecSmrg      oldlibs=
321105b261ecSmrg      if test -z "$rpath"; then
321205b261ecSmrg	if test "$build_libtool_libs" = yes; then
321305b261ecSmrg	  # Building a libtool convenience library.
321405b261ecSmrg	  # Some compilers have problems with a `.al' extension so
321505b261ecSmrg	  # convenience libraries should have the same extension an
321605b261ecSmrg	  # archive normally would.
321705b261ecSmrg	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
321805b261ecSmrg	  build_libtool_libs=convenience
321905b261ecSmrg	  build_old_libs=yes
322005b261ecSmrg	fi
322105b261ecSmrg
322205b261ecSmrg	if test -n "$vinfo"; then
322305b261ecSmrg	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
322405b261ecSmrg	fi
322505b261ecSmrg
322605b261ecSmrg	if test -n "$release"; then
322705b261ecSmrg	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
322805b261ecSmrg	fi
322905b261ecSmrg      else
323005b261ecSmrg
323105b261ecSmrg	# Parse the version information argument.
323205b261ecSmrg	save_ifs="$IFS"; IFS=':'
323305b261ecSmrg	set dummy $vinfo 0 0 0
323405b261ecSmrg	IFS="$save_ifs"
323505b261ecSmrg
323605b261ecSmrg	if test -n "$8"; then
323705b261ecSmrg	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
323805b261ecSmrg	  $echo "$help" 1>&2
323905b261ecSmrg	  exit $EXIT_FAILURE
324005b261ecSmrg	fi
324105b261ecSmrg
324205b261ecSmrg	# convert absolute version numbers to libtool ages
324305b261ecSmrg	# this retains compatibility with .la files and attempts
324405b261ecSmrg	# to make the code below a bit more comprehensible
324505b261ecSmrg
324605b261ecSmrg	case $vinfo_number in
324705b261ecSmrg	yes)
324805b261ecSmrg	  number_major="$2"
324905b261ecSmrg	  number_minor="$3"
325005b261ecSmrg	  number_revision="$4"
325105b261ecSmrg	  #
325205b261ecSmrg	  # There are really only two kinds -- those that
325305b261ecSmrg	  # use the current revision as the major version
325405b261ecSmrg	  # and those that subtract age and use age as
325505b261ecSmrg	  # a minor version.  But, then there is irix
325605b261ecSmrg	  # which has an extra 1 added just for fun
325705b261ecSmrg	  #
325805b261ecSmrg	  case $version_type in
325905b261ecSmrg	  darwin|linux|osf|windows|none)
326005b261ecSmrg	    current=`expr $number_major + $number_minor`
326105b261ecSmrg	    age="$number_minor"
326205b261ecSmrg	    revision="$number_revision"
326305b261ecSmrg	    ;;
326405b261ecSmrg	  freebsd-aout|freebsd-elf|sunos)
326505b261ecSmrg	    current="$number_major"
326605b261ecSmrg	    revision="$number_minor"
326705b261ecSmrg	    age="0"
326805b261ecSmrg	    ;;
326905b261ecSmrg	  irix|nonstopux)
327005b261ecSmrg	    current=`expr $number_major + $number_minor`
327105b261ecSmrg	    age="$number_minor"
327205b261ecSmrg	    revision="$number_minor"
327305b261ecSmrg	    lt_irix_increment=no
327405b261ecSmrg	    ;;
327505b261ecSmrg	  *)
327605b261ecSmrg	    $echo "$modename: unknown library version type \`$version_type'" 1>&2
327705b261ecSmrg	    $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
327805b261ecSmrg	    exit $EXIT_FAILURE
327905b261ecSmrg	    ;;
328005b261ecSmrg	  esac
328105b261ecSmrg	  ;;
328205b261ecSmrg	no)
328305b261ecSmrg	  current="$2"
328405b261ecSmrg	  revision="$3"
328505b261ecSmrg	  age="$4"
328605b261ecSmrg	  ;;
328705b261ecSmrg	esac
328805b261ecSmrg
328905b261ecSmrg	# Check that each of the things are valid numbers.
329005b261ecSmrg	case $current in
329105b261ecSmrg	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]) ;;
329205b261ecSmrg	*)
329305b261ecSmrg	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
329405b261ecSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
329505b261ecSmrg	  exit $EXIT_FAILURE
329605b261ecSmrg	  ;;
329705b261ecSmrg	esac
329805b261ecSmrg
329905b261ecSmrg	case $revision in
330005b261ecSmrg	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]) ;;
330105b261ecSmrg	*)
330205b261ecSmrg	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
330305b261ecSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
330405b261ecSmrg	  exit $EXIT_FAILURE
330505b261ecSmrg	  ;;
330605b261ecSmrg	esac
330705b261ecSmrg
330805b261ecSmrg	case $age in
330905b261ecSmrg	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]) ;;
331005b261ecSmrg	*)
331105b261ecSmrg	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
331205b261ecSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
331305b261ecSmrg	  exit $EXIT_FAILURE
331405b261ecSmrg	  ;;
331505b261ecSmrg	esac
331605b261ecSmrg
331705b261ecSmrg	if test "$age" -gt "$current"; then
331805b261ecSmrg	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
331905b261ecSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
332005b261ecSmrg	  exit $EXIT_FAILURE
332105b261ecSmrg	fi
332205b261ecSmrg
332305b261ecSmrg	# Calculate the version variables.
332405b261ecSmrg	major=
332505b261ecSmrg	versuffix=
332605b261ecSmrg	verstring=
332705b261ecSmrg	case $version_type in
332805b261ecSmrg	none) ;;
332905b261ecSmrg
333005b261ecSmrg	darwin)
333105b261ecSmrg	  # Like Linux, but with the current version available in
333205b261ecSmrg	  # verstring for coding it into the library header
333305b261ecSmrg	  major=.`expr $current - $age`
333405b261ecSmrg	  versuffix="$major.$age.$revision"
333505b261ecSmrg	  # Darwin ld doesn't like 0 for these options...
333605b261ecSmrg	  minor_current=`expr $current + 1`
333705b261ecSmrg	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
333805b261ecSmrg	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
333905b261ecSmrg	  ;;
334005b261ecSmrg
334105b261ecSmrg	freebsd-aout)
334205b261ecSmrg	  major=".$current"
334305b261ecSmrg	  versuffix=".$current.$revision";
334405b261ecSmrg	  ;;
334505b261ecSmrg
334605b261ecSmrg	freebsd-elf)
334705b261ecSmrg	  major=".$current"
334805b261ecSmrg	  versuffix=".$current";
334905b261ecSmrg	  ;;
335005b261ecSmrg
335105b261ecSmrg	irix | nonstopux)
335205b261ecSmrg	  if test "X$lt_irix_increment" = "Xno"; then
335305b261ecSmrg	    major=`expr $current - $age`
335405b261ecSmrg	  else
335505b261ecSmrg	    major=`expr $current - $age + 1`
335605b261ecSmrg	  fi
335705b261ecSmrg	  case $version_type in
335805b261ecSmrg	    nonstopux) verstring_prefix=nonstopux ;;
335905b261ecSmrg	    *)         verstring_prefix=sgi ;;
336005b261ecSmrg	  esac
336105b261ecSmrg	  verstring="$verstring_prefix$major.$revision"
336205b261ecSmrg
336305b261ecSmrg	  # Add in all the interfaces that we are compatible with.
336405b261ecSmrg	  loop=$revision
336505b261ecSmrg	  while test "$loop" -ne 0; do
336605b261ecSmrg	    iface=`expr $revision - $loop`
336705b261ecSmrg	    loop=`expr $loop - 1`
336805b261ecSmrg	    verstring="$verstring_prefix$major.$iface:$verstring"
336905b261ecSmrg	  done
337005b261ecSmrg
337105b261ecSmrg	  # Before this point, $major must not contain `.'.
337205b261ecSmrg	  major=.$major
337305b261ecSmrg	  versuffix="$major.$revision"
337405b261ecSmrg	  ;;
337505b261ecSmrg
337605b261ecSmrg	linux)
337705b261ecSmrg	  major=.`expr $current - $age`
337805b261ecSmrg	  versuffix="$major.$age.$revision"
337905b261ecSmrg	  ;;
338005b261ecSmrg
338105b261ecSmrg	osf)
338205b261ecSmrg	  major=.`expr $current - $age`
338305b261ecSmrg	  versuffix=".$current.$age.$revision"
338405b261ecSmrg	  verstring="$current.$age.$revision"
338505b261ecSmrg
338605b261ecSmrg	  # Add in all the interfaces that we are compatible with.
338705b261ecSmrg	  loop=$age
338805b261ecSmrg	  while test "$loop" -ne 0; do
338905b261ecSmrg	    iface=`expr $current - $loop`
339005b261ecSmrg	    loop=`expr $loop - 1`
339105b261ecSmrg	    verstring="$verstring:${iface}.0"
339205b261ecSmrg	  done
339305b261ecSmrg
339405b261ecSmrg	  # Make executables depend on our current version.
339505b261ecSmrg	  verstring="$verstring:${current}.0"
339605b261ecSmrg	  ;;
339705b261ecSmrg
339805b261ecSmrg	sunos)
339905b261ecSmrg	  major=".$current"
340005b261ecSmrg	  versuffix=".$current.$revision"
340105b261ecSmrg	  ;;
340205b261ecSmrg
340305b261ecSmrg	windows)
340405b261ecSmrg	  # Use '-' rather than '.', since we only want one
340505b261ecSmrg	  # extension on DOS 8.3 filesystems.
340605b261ecSmrg	  major=`expr $current - $age`
340705b261ecSmrg	  versuffix="-$major"
340805b261ecSmrg	  ;;
340905b261ecSmrg
341005b261ecSmrg	*)
341105b261ecSmrg	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
341205b261ecSmrg	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
341305b261ecSmrg	  exit $EXIT_FAILURE
341405b261ecSmrg	  ;;
341505b261ecSmrg	esac
341605b261ecSmrg
341705b261ecSmrg	# Clear the version info if we defaulted, and they specified a release.
341805b261ecSmrg	if test -z "$vinfo" && test -n "$release"; then
341905b261ecSmrg	  major=
342005b261ecSmrg	  case $version_type in
342105b261ecSmrg	  darwin)
342205b261ecSmrg	    # we can't check for "0.0" in archive_cmds due to quoting
342305b261ecSmrg	    # problems, so we reset it completely
342405b261ecSmrg	    verstring=
342505b261ecSmrg	    ;;
342605b261ecSmrg	  *)
342705b261ecSmrg	    verstring="0.0"
342805b261ecSmrg	    ;;
342905b261ecSmrg	  esac
343005b261ecSmrg	  if test "$need_version" = no; then
343105b261ecSmrg	    versuffix=
343205b261ecSmrg	  else
343305b261ecSmrg	    versuffix=".0.0"
343405b261ecSmrg	  fi
343505b261ecSmrg	fi
343605b261ecSmrg
343705b261ecSmrg	# Remove version info from name if versioning should be avoided
343805b261ecSmrg	if test "$avoid_version" = yes && test "$need_version" = no; then
343905b261ecSmrg	  major=
344005b261ecSmrg	  versuffix=
344105b261ecSmrg	  verstring=""
344205b261ecSmrg	fi
344305b261ecSmrg
344405b261ecSmrg	# Check to see if the archive will have undefined symbols.
344505b261ecSmrg	if test "$allow_undefined" = yes; then
344605b261ecSmrg	  if test "$allow_undefined_flag" = unsupported; then
344705b261ecSmrg	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
344805b261ecSmrg	    build_libtool_libs=no
344905b261ecSmrg	    build_old_libs=yes
345005b261ecSmrg	  fi
345105b261ecSmrg	else
345205b261ecSmrg	  # Don't allow undefined symbols.
345305b261ecSmrg	  allow_undefined_flag="$no_undefined_flag"
345405b261ecSmrg	fi
345505b261ecSmrg      fi
345605b261ecSmrg
345705b261ecSmrg      if test "$mode" != relink; then
345805b261ecSmrg	# Remove our outputs, but don't remove object files since they
345905b261ecSmrg	# may have been created when compiling PIC objects.
346005b261ecSmrg	removelist=
346105b261ecSmrg	tempremovelist=`$echo "$output_objdir/*"`
346205b261ecSmrg	for p in $tempremovelist; do
346305b261ecSmrg	  case $p in
346405b261ecSmrg	    *.$objext)
346505b261ecSmrg	       ;;
346605b261ecSmrg	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
346705b261ecSmrg	       if test "X$precious_files_regex" != "X"; then
346805b261ecSmrg	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
346905b261ecSmrg	         then
347005b261ecSmrg		   continue
347105b261ecSmrg		 fi
347205b261ecSmrg	       fi
347305b261ecSmrg	       removelist="$removelist $p"
347405b261ecSmrg	       ;;
347505b261ecSmrg	    *) ;;
347605b261ecSmrg	  esac
347705b261ecSmrg	done
347805b261ecSmrg	if test -n "$removelist"; then
347905b261ecSmrg	  $show "${rm}r $removelist"
348005b261ecSmrg	  $run ${rm}r $removelist
348105b261ecSmrg	fi
348205b261ecSmrg      fi
348305b261ecSmrg
348405b261ecSmrg      # Now set the variables for building old libraries.
348505b261ecSmrg      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
348605b261ecSmrg	oldlibs="$oldlibs $output_objdir/$libname.$libext"
348705b261ecSmrg
348805b261ecSmrg	# Transform .lo files to .o files.
348905b261ecSmrg	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
349005b261ecSmrg      fi
349105b261ecSmrg
349205b261ecSmrg      # Eliminate all temporary directories.
349305b261ecSmrg      #for path in $notinst_path; do
349405b261ecSmrg      #	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
349505b261ecSmrg      #	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
349605b261ecSmrg      #	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
349705b261ecSmrg      #done
349805b261ecSmrg
349905b261ecSmrg      if test -n "$xrpath"; then
350005b261ecSmrg	# If the user specified any rpath flags, then add them.
350105b261ecSmrg	temp_xrpath=
350205b261ecSmrg	for libdir in $xrpath; do
350305b261ecSmrg	  temp_xrpath="$temp_xrpath -R$libdir"
350405b261ecSmrg	  case "$finalize_rpath " in
350505b261ecSmrg	  *" $libdir "*) ;;
350605b261ecSmrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
350705b261ecSmrg	  esac
350805b261ecSmrg	done
350905b261ecSmrg	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
351005b261ecSmrg	  dependency_libs="$temp_xrpath $dependency_libs"
351105b261ecSmrg	fi
351205b261ecSmrg      fi
351305b261ecSmrg
351405b261ecSmrg      # Make sure dlfiles contains only unique files that won't be dlpreopened
351505b261ecSmrg      old_dlfiles="$dlfiles"
351605b261ecSmrg      dlfiles=
351705b261ecSmrg      for lib in $old_dlfiles; do
351805b261ecSmrg	case " $dlprefiles $dlfiles " in
351905b261ecSmrg	*" $lib "*) ;;
352005b261ecSmrg	*) dlfiles="$dlfiles $lib" ;;
352105b261ecSmrg	esac
352205b261ecSmrg      done
352305b261ecSmrg
352405b261ecSmrg      # Make sure dlprefiles contains only unique files
352505b261ecSmrg      old_dlprefiles="$dlprefiles"
352605b261ecSmrg      dlprefiles=
352705b261ecSmrg      for lib in $old_dlprefiles; do
352805b261ecSmrg	case "$dlprefiles " in
352905b261ecSmrg	*" $lib "*) ;;
353005b261ecSmrg	*) dlprefiles="$dlprefiles $lib" ;;
353105b261ecSmrg	esac
353205b261ecSmrg      done
353305b261ecSmrg
353405b261ecSmrg      if test "$build_libtool_libs" = yes; then
353505b261ecSmrg	if test -n "$rpath"; then
353605b261ecSmrg	  case $host in
353705b261ecSmrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
353805b261ecSmrg	    # these systems don't actually have a c library (as such)!
353905b261ecSmrg	    ;;
354005b261ecSmrg	  *-*-rhapsody* | *-*-darwin1.[012])
354105b261ecSmrg	    # Rhapsody C library is in the System framework
354205b261ecSmrg	    deplibs="$deplibs -framework System"
354305b261ecSmrg	    ;;
354405b261ecSmrg	  *-*-netbsd*)
354505b261ecSmrg	    # Don't link with libc until the a.out ld.so is fixed.
354605b261ecSmrg	    ;;
354705b261ecSmrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
354805b261ecSmrg	    # Do not include libc due to us having libc/libc_r.
354905b261ecSmrg	    ;;
355005b261ecSmrg	  *-*-sco3.2v5* | *-*-sco5v6*)
355105b261ecSmrg	    # Causes problems with __ctype
355205b261ecSmrg	    ;;
355305b261ecSmrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
355405b261ecSmrg	    # Compiler inserts libc in the correct place for threads to work
355505b261ecSmrg	    ;;
355605b261ecSmrg 	  *)
355705b261ecSmrg	    # Add libc to deplibs on all other systems if necessary.
355805b261ecSmrg	    if test "$build_libtool_need_lc" = "yes"; then
355905b261ecSmrg	      deplibs="$deplibs -lc"
356005b261ecSmrg	    fi
356105b261ecSmrg	    ;;
356205b261ecSmrg	  esac
356305b261ecSmrg	fi
356405b261ecSmrg
356505b261ecSmrg	# Transform deplibs into only deplibs that can be linked in shared.
356605b261ecSmrg	name_save=$name
356705b261ecSmrg	libname_save=$libname
356805b261ecSmrg	release_save=$release
356905b261ecSmrg	versuffix_save=$versuffix
357005b261ecSmrg	major_save=$major
357105b261ecSmrg	# I'm not sure if I'm treating the release correctly.  I think
357205b261ecSmrg	# release should show up in the -l (ie -lgmp5) so we don't want to
357305b261ecSmrg	# add it in twice.  Is that correct?
357405b261ecSmrg	release=""
357505b261ecSmrg	versuffix=""
357605b261ecSmrg	major=""
357705b261ecSmrg	newdeplibs=
357805b261ecSmrg	droppeddeps=no
357905b261ecSmrg	case $deplibs_check_method in
358005b261ecSmrg	pass_all)
358105b261ecSmrg	  # Don't check for shared/static.  Everything works.
358205b261ecSmrg	  # This might be a little naive.  We might want to check
358305b261ecSmrg	  # whether the library exists or not.  But this is on
358405b261ecSmrg	  # osf3 & osf4 and I'm not really sure... Just
358505b261ecSmrg	  # implementing what was already the behavior.
358605b261ecSmrg	  newdeplibs=$deplibs
358705b261ecSmrg	  ;;
358805b261ecSmrg	test_compile)
358905b261ecSmrg	  # This code stresses the "libraries are programs" paradigm to its
359005b261ecSmrg	  # limits. Maybe even breaks it.  We compile a program, linking it
359105b261ecSmrg	  # against the deplibs as a proxy for the library.  Then we can check
359205b261ecSmrg	  # whether they linked in statically or dynamically with ldd.
359305b261ecSmrg	  $rm conftest.c
359405b261ecSmrg	  cat > conftest.c <<EOF
359505b261ecSmrg	  int main() { return 0; }
359605b261ecSmrgEOF
359705b261ecSmrg	  $rm conftest
359805b261ecSmrg	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
359905b261ecSmrg	    ldd_output=`ldd conftest`
360005b261ecSmrg	    for i in $deplibs; do
360105b261ecSmrg	      name=`expr $i : '-l\(.*\)'`
360205b261ecSmrg	      # If $name is empty we are operating on a -L argument.
360305b261ecSmrg              if test "$name" != "" && test "$name" != "0"; then
360405b261ecSmrg		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
360505b261ecSmrg		  case " $predeps $postdeps " in
360605b261ecSmrg		  *" $i "*)
360705b261ecSmrg		    newdeplibs="$newdeplibs $i"
360805b261ecSmrg		    i=""
360905b261ecSmrg		    ;;
361005b261ecSmrg		  esac
361105b261ecSmrg	        fi
361205b261ecSmrg		if test -n "$i" ; then
361305b261ecSmrg		  libname=`eval \\$echo \"$libname_spec\"`
361405b261ecSmrg		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
361505b261ecSmrg		  set dummy $deplib_matches
361605b261ecSmrg		  deplib_match=$2
361705b261ecSmrg		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
361805b261ecSmrg		    newdeplibs="$newdeplibs $i"
361905b261ecSmrg		  else
362005b261ecSmrg		    droppeddeps=yes
362105b261ecSmrg		    $echo
362205b261ecSmrg		    $echo "*** Warning: dynamic linker does not accept needed library $i."
362305b261ecSmrg		    $echo "*** I have the capability to make that library automatically link in when"
362405b261ecSmrg		    $echo "*** you link to this library.  But I can only do this if you have a"
362505b261ecSmrg		    $echo "*** shared version of the library, which I believe you do not have"
362605b261ecSmrg		    $echo "*** because a test_compile did reveal that the linker did not use it for"
362705b261ecSmrg		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
362805b261ecSmrg		  fi
362905b261ecSmrg		fi
363005b261ecSmrg	      else
363105b261ecSmrg		newdeplibs="$newdeplibs $i"
363205b261ecSmrg	      fi
363305b261ecSmrg	    done
363405b261ecSmrg	  else
363505b261ecSmrg	    # Error occurred in the first compile.  Let's try to salvage
363605b261ecSmrg	    # the situation: Compile a separate program for each library.
363705b261ecSmrg	    for i in $deplibs; do
363805b261ecSmrg	      name=`expr $i : '-l\(.*\)'`
363905b261ecSmrg	      # If $name is empty we are operating on a -L argument.
364005b261ecSmrg              if test "$name" != "" && test "$name" != "0"; then
364105b261ecSmrg		$rm conftest
364205b261ecSmrg		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
364305b261ecSmrg		  ldd_output=`ldd conftest`
364405b261ecSmrg		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
364505b261ecSmrg		    case " $predeps $postdeps " in
364605b261ecSmrg		    *" $i "*)
364705b261ecSmrg		      newdeplibs="$newdeplibs $i"
364805b261ecSmrg		      i=""
364905b261ecSmrg		      ;;
365005b261ecSmrg		    esac
365105b261ecSmrg		  fi
365205b261ecSmrg		  if test -n "$i" ; then
365305b261ecSmrg		    libname=`eval \\$echo \"$libname_spec\"`
365405b261ecSmrg		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
365505b261ecSmrg		    set dummy $deplib_matches
365605b261ecSmrg		    deplib_match=$2
365705b261ecSmrg		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
365805b261ecSmrg		      newdeplibs="$newdeplibs $i"
365905b261ecSmrg		    else
366005b261ecSmrg		      droppeddeps=yes
366105b261ecSmrg		      $echo
366205b261ecSmrg		      $echo "*** Warning: dynamic linker does not accept needed library $i."
366305b261ecSmrg		      $echo "*** I have the capability to make that library automatically link in when"
366405b261ecSmrg		      $echo "*** you link to this library.  But I can only do this if you have a"
366505b261ecSmrg		      $echo "*** shared version of the library, which you do not appear to have"
366605b261ecSmrg		      $echo "*** because a test_compile did reveal that the linker did not use this one"
366705b261ecSmrg		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
366805b261ecSmrg		    fi
366905b261ecSmrg		  fi
367005b261ecSmrg		else
367105b261ecSmrg		  droppeddeps=yes
367205b261ecSmrg		  $echo
367305b261ecSmrg		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
367405b261ecSmrg		  $echo "*** make it link in!  You will probably need to install it or some"
367505b261ecSmrg		  $echo "*** library that it depends on before this library will be fully"
367605b261ecSmrg		  $echo "*** functional.  Installing it before continuing would be even better."
367705b261ecSmrg		fi
367805b261ecSmrg	      else
367905b261ecSmrg		newdeplibs="$newdeplibs $i"
368005b261ecSmrg	      fi
368105b261ecSmrg	    done
368205b261ecSmrg	  fi
368305b261ecSmrg	  ;;
368405b261ecSmrg	file_magic*)
368505b261ecSmrg	  set dummy $deplibs_check_method
368605b261ecSmrg	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
368705b261ecSmrg	  for a_deplib in $deplibs; do
368805b261ecSmrg	    name=`expr $a_deplib : '-l\(.*\)'`
368905b261ecSmrg	    # If $name is empty we are operating on a -L argument.
369005b261ecSmrg            if test "$name" != "" && test  "$name" != "0"; then
369105b261ecSmrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
369205b261ecSmrg		case " $predeps $postdeps " in
369305b261ecSmrg		*" $a_deplib "*)
369405b261ecSmrg		  newdeplibs="$newdeplibs $a_deplib"
369505b261ecSmrg		  a_deplib=""
369605b261ecSmrg		  ;;
369705b261ecSmrg		esac
369805b261ecSmrg	      fi
369905b261ecSmrg	      if test -n "$a_deplib" ; then
370005b261ecSmrg		libname=`eval \\$echo \"$libname_spec\"`
370105b261ecSmrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
370205b261ecSmrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
370305b261ecSmrg		  for potent_lib in $potential_libs; do
370405b261ecSmrg		      # Follow soft links.
370505b261ecSmrg		      if ls -lLd "$potent_lib" 2>/dev/null \
370605b261ecSmrg			 | grep " -> " >/dev/null; then
370705b261ecSmrg			continue
370805b261ecSmrg		      fi
370905b261ecSmrg		      # The statement above tries to avoid entering an
371005b261ecSmrg		      # endless loop below, in case of cyclic links.
371105b261ecSmrg		      # We might still enter an endless loop, since a link
371205b261ecSmrg		      # loop can be closed while we follow links,
371305b261ecSmrg		      # but so what?
371405b261ecSmrg		      potlib="$potent_lib"
371505b261ecSmrg		      while test -h "$potlib" 2>/dev/null; do
371605b261ecSmrg			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
371705b261ecSmrg			case $potliblink in
371805b261ecSmrg			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
371905b261ecSmrg			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
372005b261ecSmrg			esac
372105b261ecSmrg		      done
372205b261ecSmrg		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
372305b261ecSmrg			 | ${SED} 10q \
372405b261ecSmrg			 | $EGREP "$file_magic_regex" > /dev/null; then
372505b261ecSmrg			newdeplibs="$newdeplibs $a_deplib"
372605b261ecSmrg			a_deplib=""
372705b261ecSmrg			break 2
372805b261ecSmrg		      fi
372905b261ecSmrg		  done
373005b261ecSmrg		done
373105b261ecSmrg	      fi
373205b261ecSmrg	      if test -n "$a_deplib" ; then
373305b261ecSmrg		droppeddeps=yes
373405b261ecSmrg		$echo
373505b261ecSmrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
373605b261ecSmrg		$echo "*** I have the capability to make that library automatically link in when"
373705b261ecSmrg		$echo "*** you link to this library.  But I can only do this if you have a"
373805b261ecSmrg		$echo "*** shared version of the library, which you do not appear to have"
373905b261ecSmrg		$echo "*** because I did check the linker path looking for a file starting"
374005b261ecSmrg		if test -z "$potlib" ; then
374105b261ecSmrg		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
374205b261ecSmrg		else
374305b261ecSmrg		  $echo "*** with $libname and none of the candidates passed a file format test"
374405b261ecSmrg		  $echo "*** using a file magic. Last file checked: $potlib"
374505b261ecSmrg		fi
374605b261ecSmrg	      fi
374705b261ecSmrg	    else
374805b261ecSmrg	      # Add a -L argument.
374905b261ecSmrg	      newdeplibs="$newdeplibs $a_deplib"
375005b261ecSmrg	    fi
375105b261ecSmrg	  done # Gone through all deplibs.
375205b261ecSmrg	  ;;
375305b261ecSmrg	match_pattern*)
375405b261ecSmrg	  set dummy $deplibs_check_method
375505b261ecSmrg	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
375605b261ecSmrg	  for a_deplib in $deplibs; do
375705b261ecSmrg	    name=`expr $a_deplib : '-l\(.*\)'`
375805b261ecSmrg	    # If $name is empty we are operating on a -L argument.
375905b261ecSmrg	    if test -n "$name" && test "$name" != "0"; then
376005b261ecSmrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
376105b261ecSmrg		case " $predeps $postdeps " in
376205b261ecSmrg		*" $a_deplib "*)
376305b261ecSmrg		  newdeplibs="$newdeplibs $a_deplib"
376405b261ecSmrg		  a_deplib=""
376505b261ecSmrg		  ;;
376605b261ecSmrg		esac
376705b261ecSmrg	      fi
376805b261ecSmrg	      if test -n "$a_deplib" ; then
376905b261ecSmrg		libname=`eval \\$echo \"$libname_spec\"`
377005b261ecSmrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
377105b261ecSmrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
377205b261ecSmrg		  for potent_lib in $potential_libs; do
377305b261ecSmrg		    potlib="$potent_lib" # see symlink-check above in file_magic test
377405b261ecSmrg		    if eval $echo \"$potent_lib\" 2>/dev/null \
377505b261ecSmrg		        | ${SED} 10q \
377605b261ecSmrg		        | $EGREP "$match_pattern_regex" > /dev/null; then
377705b261ecSmrg		      newdeplibs="$newdeplibs $a_deplib"
377805b261ecSmrg		      a_deplib=""
377905b261ecSmrg		      break 2
378005b261ecSmrg		    fi
378105b261ecSmrg		  done
378205b261ecSmrg		done
378305b261ecSmrg	      fi
378405b261ecSmrg	      if test -n "$a_deplib" ; then
378505b261ecSmrg		droppeddeps=yes
378605b261ecSmrg		$echo
378705b261ecSmrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
378805b261ecSmrg		$echo "*** I have the capability to make that library automatically link in when"
378905b261ecSmrg		$echo "*** you link to this library.  But I can only do this if you have a"
379005b261ecSmrg		$echo "*** shared version of the library, which you do not appear to have"
379105b261ecSmrg		$echo "*** because I did check the linker path looking for a file starting"
379205b261ecSmrg		if test -z "$potlib" ; then
379305b261ecSmrg		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
379405b261ecSmrg		else
379505b261ecSmrg		  $echo "*** with $libname and none of the candidates passed a file format test"
379605b261ecSmrg		  $echo "*** using a regex pattern. Last file checked: $potlib"
379705b261ecSmrg		fi
379805b261ecSmrg	      fi
379905b261ecSmrg	    else
380005b261ecSmrg	      # Add a -L argument.
380105b261ecSmrg	      newdeplibs="$newdeplibs $a_deplib"
380205b261ecSmrg	    fi
380305b261ecSmrg	  done # Gone through all deplibs.
380405b261ecSmrg	  ;;
380505b261ecSmrg	none | unknown | *)
380605b261ecSmrg	  newdeplibs=""
380705b261ecSmrg	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
380805b261ecSmrg	    -e 's/ -[LR][^ ]*//g'`
380905b261ecSmrg	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
381005b261ecSmrg	    for i in $predeps $postdeps ; do
381105b261ecSmrg	      # can't use Xsed below, because $i might contain '/'
381205b261ecSmrg	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
381305b261ecSmrg	    done
381405b261ecSmrg	  fi
381505b261ecSmrg	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
381605b261ecSmrg	    | grep . >/dev/null; then
381705b261ecSmrg	    $echo
381805b261ecSmrg	    if test "X$deplibs_check_method" = "Xnone"; then
381905b261ecSmrg	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
382005b261ecSmrg	    else
382105b261ecSmrg	      $echo "*** Warning: inter-library dependencies are not known to be supported."
382205b261ecSmrg	    fi
382305b261ecSmrg	    $echo "*** All declared inter-library dependencies are being dropped."
382405b261ecSmrg	    droppeddeps=yes
382505b261ecSmrg	  fi
382605b261ecSmrg	  ;;
382705b261ecSmrg	esac
382805b261ecSmrg	versuffix=$versuffix_save
382905b261ecSmrg	major=$major_save
383005b261ecSmrg	release=$release_save
383105b261ecSmrg	libname=$libname_save
383205b261ecSmrg	name=$name_save
383305b261ecSmrg
383405b261ecSmrg	case $host in
383505b261ecSmrg	*-*-rhapsody* | *-*-darwin1.[012])
383605b261ecSmrg	  # On Rhapsody replace the C library is the System framework
383705b261ecSmrg	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
383805b261ecSmrg	  ;;
383905b261ecSmrg	esac
384005b261ecSmrg
384105b261ecSmrg	if test "$droppeddeps" = yes; then
384205b261ecSmrg	  if test "$module" = yes; then
384305b261ecSmrg	    $echo
384405b261ecSmrg	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
384505b261ecSmrg	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
384605b261ecSmrg	    $echo "*** a static module, that should work as long as the dlopening"
384705b261ecSmrg	    $echo "*** application is linked with the -dlopen flag."
384805b261ecSmrg	    if test -z "$global_symbol_pipe"; then
384905b261ecSmrg	      $echo
385005b261ecSmrg	      $echo "*** However, this would only work if libtool was able to extract symbol"
385105b261ecSmrg	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
385205b261ecSmrg	      $echo "*** not find such a program.  So, this module is probably useless."
385305b261ecSmrg	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
385405b261ecSmrg	    fi
385505b261ecSmrg	    if test "$build_old_libs" = no; then
385605b261ecSmrg	      oldlibs="$output_objdir/$libname.$libext"
385705b261ecSmrg	      build_libtool_libs=module
385805b261ecSmrg	      build_old_libs=yes
385905b261ecSmrg	    else
386005b261ecSmrg	      build_libtool_libs=no
386105b261ecSmrg	    fi
386205b261ecSmrg	  else
386305b261ecSmrg	    $echo "*** The inter-library dependencies that have been dropped here will be"
386405b261ecSmrg	    $echo "*** automatically added whenever a program is linked with this library"
386505b261ecSmrg	    $echo "*** or is declared to -dlopen it."
386605b261ecSmrg
386705b261ecSmrg	    if test "$allow_undefined" = no; then
386805b261ecSmrg	      $echo
386905b261ecSmrg	      $echo "*** Since this library must not contain undefined symbols,"
387005b261ecSmrg	      $echo "*** because either the platform does not support them or"
387105b261ecSmrg	      $echo "*** it was explicitly requested with -no-undefined,"
387205b261ecSmrg	      $echo "*** libtool will only create a static version of it."
387305b261ecSmrg	      if test "$build_old_libs" = no; then
387405b261ecSmrg		oldlibs="$output_objdir/$libname.$libext"
387505b261ecSmrg		build_libtool_libs=module
387605b261ecSmrg		build_old_libs=yes
387705b261ecSmrg	      else
387805b261ecSmrg		build_libtool_libs=no
387905b261ecSmrg	      fi
388005b261ecSmrg	    fi
388105b261ecSmrg	  fi
388205b261ecSmrg	fi
388305b261ecSmrg	# Done checking deplibs!
388405b261ecSmrg	deplibs=$newdeplibs
388505b261ecSmrg      fi
388605b261ecSmrg
388705b261ecSmrg
388805b261ecSmrg      # move library search paths that coincide with paths to not yet
388905b261ecSmrg      # installed libraries to the beginning of the library search list
389005b261ecSmrg      new_libs=
389105b261ecSmrg      for path in $notinst_path; do
389205b261ecSmrg	case " $new_libs " in
389305b261ecSmrg	*" -L$path/$objdir "*) ;;
389405b261ecSmrg	*)
389505b261ecSmrg	  case " $deplibs " in
389605b261ecSmrg	  *" -L$path/$objdir "*)
389705b261ecSmrg	    new_libs="$new_libs -L$path/$objdir" ;;
389805b261ecSmrg	  esac
389905b261ecSmrg	  ;;
390005b261ecSmrg	esac
390105b261ecSmrg      done
390205b261ecSmrg      for deplib in $deplibs; do
390305b261ecSmrg	case $deplib in
390405b261ecSmrg	-L*)
390505b261ecSmrg	  case " $new_libs " in
390605b261ecSmrg	  *" $deplib "*) ;;
390705b261ecSmrg	  *) new_libs="$new_libs $deplib" ;;
390805b261ecSmrg	  esac
390905b261ecSmrg	  ;;
391005b261ecSmrg	*) new_libs="$new_libs $deplib" ;;
391105b261ecSmrg	esac
391205b261ecSmrg      done
391305b261ecSmrg      deplibs="$new_libs"
391405b261ecSmrg
391505b261ecSmrg
391605b261ecSmrg      # All the library-specific variables (install_libdir is set above).
391705b261ecSmrg      library_names=
391805b261ecSmrg      old_library=
391905b261ecSmrg      dlname=
392005b261ecSmrg
392105b261ecSmrg      # Test again, we may have decided not to build it any more
392205b261ecSmrg      if test "$build_libtool_libs" = yes; then
392305b261ecSmrg	if test "$hardcode_into_libs" = yes; then
392405b261ecSmrg	  # Hardcode the library paths
392505b261ecSmrg	  hardcode_libdirs=
392605b261ecSmrg	  dep_rpath=
392705b261ecSmrg	  rpath="$finalize_rpath"
392805b261ecSmrg	  test "$mode" != relink && rpath="$compile_rpath$rpath"
392905b261ecSmrg	  for libdir in $rpath; do
393005b261ecSmrg	    if test -n "$hardcode_libdir_flag_spec"; then
393105b261ecSmrg	      if test -n "$hardcode_libdir_separator"; then
393205b261ecSmrg		if test -z "$hardcode_libdirs"; then
393305b261ecSmrg		  hardcode_libdirs="$libdir"
393405b261ecSmrg		else
393505b261ecSmrg		  # Just accumulate the unique libdirs.
393605b261ecSmrg		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
393705b261ecSmrg		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
393805b261ecSmrg		    ;;
393905b261ecSmrg		  *)
394005b261ecSmrg		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
394105b261ecSmrg		    ;;
394205b261ecSmrg		  esac
394305b261ecSmrg		fi
394405b261ecSmrg	      else
394505b261ecSmrg		eval flag=\"$hardcode_libdir_flag_spec\"
394605b261ecSmrg		dep_rpath="$dep_rpath $flag"
394705b261ecSmrg	      fi
394805b261ecSmrg	    elif test -n "$runpath_var"; then
394905b261ecSmrg	      case "$perm_rpath " in
395005b261ecSmrg	      *" $libdir "*) ;;
395105b261ecSmrg	      *) perm_rpath="$perm_rpath $libdir" ;;
395205b261ecSmrg	      esac
395305b261ecSmrg	    fi
395405b261ecSmrg	  done
395505b261ecSmrg	  # Substitute the hardcoded libdirs into the rpath.
395605b261ecSmrg	  if test -n "$hardcode_libdir_separator" &&
395705b261ecSmrg	     test -n "$hardcode_libdirs"; then
395805b261ecSmrg	    libdir="$hardcode_libdirs"
395905b261ecSmrg	    if test -n "$hardcode_libdir_flag_spec_ld"; then
396005b261ecSmrg	      case $archive_cmds in
396105b261ecSmrg	      *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
396205b261ecSmrg	      *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
396305b261ecSmrg	      esac
396405b261ecSmrg	    else
396505b261ecSmrg	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
396605b261ecSmrg	    fi
396705b261ecSmrg	  fi
396805b261ecSmrg	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
396905b261ecSmrg	    # We should set the runpath_var.
397005b261ecSmrg	    rpath=
397105b261ecSmrg	    for dir in $perm_rpath; do
397205b261ecSmrg	      rpath="$rpath$dir:"
397305b261ecSmrg	    done
397405b261ecSmrg	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
397505b261ecSmrg	  fi
397605b261ecSmrg	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
397705b261ecSmrg	fi
397805b261ecSmrg
397905b261ecSmrg	shlibpath="$finalize_shlibpath"
398005b261ecSmrg	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
398105b261ecSmrg	if test -n "$shlibpath"; then
398205b261ecSmrg	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
398305b261ecSmrg	fi
398405b261ecSmrg
398505b261ecSmrg	# Get the real and link names of the library.
398605b261ecSmrg	eval shared_ext=\"$shrext_cmds\"
398705b261ecSmrg	eval library_names=\"$library_names_spec\"
398805b261ecSmrg	set dummy $library_names
398905b261ecSmrg	realname="$2"
399005b261ecSmrg	shift; shift
399105b261ecSmrg
399205b261ecSmrg	if test -n "$soname_spec"; then
399305b261ecSmrg	  eval soname=\"$soname_spec\"
399405b261ecSmrg	else
399505b261ecSmrg	  soname="$realname"
399605b261ecSmrg	fi
399705b261ecSmrg	if test -z "$dlname"; then
399805b261ecSmrg	  dlname=$soname
399905b261ecSmrg	fi
400005b261ecSmrg
400105b261ecSmrg	lib="$output_objdir/$realname"
400205b261ecSmrg	linknames=
400305b261ecSmrg	for link
400405b261ecSmrg	do
400505b261ecSmrg	  linknames="$linknames $link"
400605b261ecSmrg	done
400705b261ecSmrg
400805b261ecSmrg	# Use standard objects if they are pic
400905b261ecSmrg	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
401005b261ecSmrg
401105b261ecSmrg	# Prepare the list of exported symbols
401205b261ecSmrg	if test -z "$export_symbols"; then
401305b261ecSmrg	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
401405b261ecSmrg	    $show "generating symbol list for \`$libname.la'"
401505b261ecSmrg	    export_symbols="$output_objdir/$libname.exp"
401605b261ecSmrg	    $run $rm $export_symbols
401705b261ecSmrg	    cmds=$export_symbols_cmds
401805b261ecSmrg	    save_ifs="$IFS"; IFS='~'
401905b261ecSmrg	    for cmd in $cmds; do
402005b261ecSmrg	      IFS="$save_ifs"
402105b261ecSmrg	      eval cmd=\"$cmd\"
402205b261ecSmrg	      if len=`expr "X$cmd" : ".*"` &&
402305b261ecSmrg	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
402405b261ecSmrg	        $show "$cmd"
402505b261ecSmrg	        $run eval "$cmd" || exit $?
402605b261ecSmrg	        skipped_export=false
402705b261ecSmrg	      else
402805b261ecSmrg	        # The command line is too long to execute in one step.
402905b261ecSmrg	        $show "using reloadable object file for export list..."
403005b261ecSmrg	        skipped_export=:
403105b261ecSmrg		# Break out early, otherwise skipped_export may be
403205b261ecSmrg		# set to false by a later but shorter cmd.
403305b261ecSmrg		break
403405b261ecSmrg	      fi
403505b261ecSmrg	    done
403605b261ecSmrg	    IFS="$save_ifs"
403705b261ecSmrg	    if test -n "$export_symbols_regex"; then
403805b261ecSmrg	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
403905b261ecSmrg	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
404005b261ecSmrg	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
404105b261ecSmrg	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
404205b261ecSmrg	    fi
404305b261ecSmrg	  fi
404405b261ecSmrg	fi
404505b261ecSmrg
404605b261ecSmrg	if test -n "$export_symbols" && test -n "$include_expsyms"; then
404705b261ecSmrg	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
404805b261ecSmrg	fi
404905b261ecSmrg
405005b261ecSmrg	tmp_deplibs=
405105b261ecSmrg	for test_deplib in $deplibs; do
405205b261ecSmrg		case " $convenience " in
405305b261ecSmrg		*" $test_deplib "*) ;;
405405b261ecSmrg		*)
405505b261ecSmrg			tmp_deplibs="$tmp_deplibs $test_deplib"
405605b261ecSmrg			;;
405705b261ecSmrg		esac
405805b261ecSmrg	done
405905b261ecSmrg	deplibs="$tmp_deplibs"
406005b261ecSmrg
406105b261ecSmrg	if test -n "$convenience"; then
406205b261ecSmrg	  if test -n "$whole_archive_flag_spec"; then
406305b261ecSmrg	    save_libobjs=$libobjs
406405b261ecSmrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
406505b261ecSmrg	  else
406605b261ecSmrg	    gentop="$output_objdir/${outputname}x"
406705b261ecSmrg	    generated="$generated $gentop"
406805b261ecSmrg
406905b261ecSmrg	    func_extract_archives $gentop $convenience
407005b261ecSmrg	    libobjs="$libobjs $func_extract_archives_result"
407105b261ecSmrg	  fi
407205b261ecSmrg	fi
407305b261ecSmrg	
407405b261ecSmrg	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
407505b261ecSmrg	  eval flag=\"$thread_safe_flag_spec\"
407605b261ecSmrg	  linker_flags="$linker_flags $flag"
407705b261ecSmrg	fi
407805b261ecSmrg
407905b261ecSmrg	# Make a backup of the uninstalled library when relinking
408005b261ecSmrg	if test "$mode" = relink; then
408105b261ecSmrg	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
408205b261ecSmrg	fi
408305b261ecSmrg
408405b261ecSmrg	# Do each of the archive commands.
408505b261ecSmrg	if test "$module" = yes && test -n "$module_cmds" ; then
408605b261ecSmrg	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
408705b261ecSmrg	    eval test_cmds=\"$module_expsym_cmds\"
408805b261ecSmrg	    cmds=$module_expsym_cmds
408905b261ecSmrg	  else
409005b261ecSmrg	    eval test_cmds=\"$module_cmds\"
409105b261ecSmrg	    cmds=$module_cmds
409205b261ecSmrg	  fi
409305b261ecSmrg	else
409405b261ecSmrg	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
409505b261ecSmrg	  eval test_cmds=\"$archive_expsym_cmds\"
409605b261ecSmrg	  cmds=$archive_expsym_cmds
409705b261ecSmrg	else
409805b261ecSmrg	  eval test_cmds=\"$archive_cmds\"
409905b261ecSmrg	  cmds=$archive_cmds
410005b261ecSmrg	  fi
410105b261ecSmrg	fi
410205b261ecSmrg
410305b261ecSmrg	if test "X$skipped_export" != "X:" &&
410405b261ecSmrg	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
410505b261ecSmrg	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
410605b261ecSmrg	  :
410705b261ecSmrg	else
410805b261ecSmrg	  # The command line is too long to link in one step, link piecewise.
410905b261ecSmrg	  $echo "creating reloadable object files..."
411005b261ecSmrg
411105b261ecSmrg	  # Save the value of $output and $libobjs because we want to
411205b261ecSmrg	  # use them later.  If we have whole_archive_flag_spec, we
411305b261ecSmrg	  # want to use save_libobjs as it was before
411405b261ecSmrg	  # whole_archive_flag_spec was expanded, because we can't
411505b261ecSmrg	  # assume the linker understands whole_archive_flag_spec.
411605b261ecSmrg	  # This may have to be revisited, in case too many
411705b261ecSmrg	  # convenience libraries get linked in and end up exceeding
411805b261ecSmrg	  # the spec.
411905b261ecSmrg	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
412005b261ecSmrg	    save_libobjs=$libobjs
412105b261ecSmrg	  fi
412205b261ecSmrg	  save_output=$output
412305b261ecSmrg	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
412405b261ecSmrg
412505b261ecSmrg	  # Clear the reloadable object creation command queue and
412605b261ecSmrg	  # initialize k to one.
412705b261ecSmrg	  test_cmds=
412805b261ecSmrg	  concat_cmds=
412905b261ecSmrg	  objlist=
413005b261ecSmrg	  delfiles=
413105b261ecSmrg	  last_robj=
413205b261ecSmrg	  k=1
413305b261ecSmrg	  output=$output_objdir/$output_la-${k}.$objext
413405b261ecSmrg	  # Loop over the list of objects to be linked.
413505b261ecSmrg	  for obj in $save_libobjs
413605b261ecSmrg	  do
413705b261ecSmrg	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
413805b261ecSmrg	    if test "X$objlist" = X ||
413905b261ecSmrg	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
414005b261ecSmrg		 test "$len" -le "$max_cmd_len"; }; then
414105b261ecSmrg	      objlist="$objlist $obj"
414205b261ecSmrg	    else
414305b261ecSmrg	      # The command $test_cmds is almost too long, add a
414405b261ecSmrg	      # command to the queue.
414505b261ecSmrg	      if test "$k" -eq 1 ; then
414605b261ecSmrg		# The first file doesn't have a previous command to add.
414705b261ecSmrg		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
414805b261ecSmrg	      else
414905b261ecSmrg		# All subsequent reloadable object files will link in
415005b261ecSmrg		# the last one created.
415105b261ecSmrg		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
415205b261ecSmrg	      fi
415305b261ecSmrg	      last_robj=$output_objdir/$output_la-${k}.$objext
415405b261ecSmrg	      k=`expr $k + 1`
415505b261ecSmrg	      output=$output_objdir/$output_la-${k}.$objext
415605b261ecSmrg	      objlist=$obj
415705b261ecSmrg	      len=1
415805b261ecSmrg	    fi
415905b261ecSmrg	  done
416005b261ecSmrg	  # Handle the remaining objects by creating one last
416105b261ecSmrg	  # reloadable object file.  All subsequent reloadable object
416205b261ecSmrg	  # files will link in the last one created.
416305b261ecSmrg	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
416405b261ecSmrg	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
416505b261ecSmrg
416605b261ecSmrg	  if ${skipped_export-false}; then
416705b261ecSmrg	    $show "generating symbol list for \`$libname.la'"
416805b261ecSmrg	    export_symbols="$output_objdir/$libname.exp"
416905b261ecSmrg	    $run $rm $export_symbols
417005b261ecSmrg	    libobjs=$output
417105b261ecSmrg	    # Append the command to create the export file.
417205b261ecSmrg	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
417305b261ecSmrg          fi
417405b261ecSmrg
417505b261ecSmrg	  # Set up a command to remove the reloadable object files
417605b261ecSmrg	  # after they are used.
417705b261ecSmrg	  i=0
417805b261ecSmrg	  while test "$i" -lt "$k"
417905b261ecSmrg	  do
418005b261ecSmrg	    i=`expr $i + 1`
418105b261ecSmrg	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
418205b261ecSmrg	  done
418305b261ecSmrg
418405b261ecSmrg	  $echo "creating a temporary reloadable object file: $output"
418505b261ecSmrg
418605b261ecSmrg	  # Loop through the commands generated above and execute them.
418705b261ecSmrg	  save_ifs="$IFS"; IFS='~'
418805b261ecSmrg	  for cmd in $concat_cmds; do
418905b261ecSmrg	    IFS="$save_ifs"
419005b261ecSmrg	    $show "$cmd"
419105b261ecSmrg	    $run eval "$cmd" || exit $?
419205b261ecSmrg	  done
419305b261ecSmrg	  IFS="$save_ifs"
419405b261ecSmrg
419505b261ecSmrg	  libobjs=$output
419605b261ecSmrg	  # Restore the value of output.
419705b261ecSmrg	  output=$save_output
419805b261ecSmrg
419905b261ecSmrg	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
420005b261ecSmrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
420105b261ecSmrg	  fi
420205b261ecSmrg	  # Expand the library linking commands again to reset the
420305b261ecSmrg	  # value of $libobjs for piecewise linking.
420405b261ecSmrg
420505b261ecSmrg	  # Do each of the archive commands.
420605b261ecSmrg	  if test "$module" = yes && test -n "$module_cmds" ; then
420705b261ecSmrg	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
420805b261ecSmrg	      cmds=$module_expsym_cmds
420905b261ecSmrg	    else
421005b261ecSmrg	      cmds=$module_cmds
421105b261ecSmrg	    fi
421205b261ecSmrg	  else
421305b261ecSmrg	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
421405b261ecSmrg	    cmds=$archive_expsym_cmds
421505b261ecSmrg	  else
421605b261ecSmrg	    cmds=$archive_cmds
421705b261ecSmrg	    fi
421805b261ecSmrg	  fi
421905b261ecSmrg
422005b261ecSmrg	  # Append the command to remove the reloadable object files
422105b261ecSmrg	  # to the just-reset $cmds.
422205b261ecSmrg	  eval cmds=\"\$cmds~\$rm $delfiles\"
422305b261ecSmrg	fi
422405b261ecSmrg	save_ifs="$IFS"; IFS='~'
422505b261ecSmrg	for cmd in $cmds; do
422605b261ecSmrg	  IFS="$save_ifs"
422705b261ecSmrg	  eval cmd=\"$cmd\"
422805b261ecSmrg	  $show "$cmd"
422905b261ecSmrg	  $run eval "$cmd" || {
423005b261ecSmrg	    lt_exit=$?
423105b261ecSmrg
423205b261ecSmrg	    # Restore the uninstalled library and exit
423305b261ecSmrg	    if test "$mode" = relink; then
423405b261ecSmrg	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
423505b261ecSmrg	    fi
423605b261ecSmrg
423705b261ecSmrg	    exit $lt_exit
423805b261ecSmrg	  }
423905b261ecSmrg	done
424005b261ecSmrg	IFS="$save_ifs"
424105b261ecSmrg
424205b261ecSmrg	# Restore the uninstalled library and exit
424305b261ecSmrg	if test "$mode" = relink; then
424405b261ecSmrg	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
424505b261ecSmrg
424605b261ecSmrg	  if test -n "$convenience"; then
424705b261ecSmrg	    if test -z "$whole_archive_flag_spec"; then
424805b261ecSmrg	      $show "${rm}r $gentop"
424905b261ecSmrg	      $run ${rm}r "$gentop"
425005b261ecSmrg	    fi
425105b261ecSmrg	  fi
425205b261ecSmrg
425305b261ecSmrg	  exit $EXIT_SUCCESS
425405b261ecSmrg	fi
425505b261ecSmrg
425605b261ecSmrg	# Create links to the real library.
425705b261ecSmrg	for linkname in $linknames; do
425805b261ecSmrg	  if test "$realname" != "$linkname"; then
425905b261ecSmrg	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
426005b261ecSmrg	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
426105b261ecSmrg	  fi
426205b261ecSmrg	done
426305b261ecSmrg
426405b261ecSmrg	# If -module or -export-dynamic was specified, set the dlname.
426505b261ecSmrg	if test "$module" = yes || test "$export_dynamic" = yes; then
426605b261ecSmrg	  # On all known operating systems, these are identical.
426705b261ecSmrg	  dlname="$soname"
426805b261ecSmrg	fi
426905b261ecSmrg      fi
427005b261ecSmrg      ;;
427105b261ecSmrg
427205b261ecSmrg    obj)
427305b261ecSmrg      case " $deplibs" in
427405b261ecSmrg      *\ -l* | *\ -L*)
427505b261ecSmrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
427605b261ecSmrg      esac
427705b261ecSmrg
427805b261ecSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
427905b261ecSmrg	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
428005b261ecSmrg      fi
428105b261ecSmrg
428205b261ecSmrg      if test -n "$rpath"; then
428305b261ecSmrg	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
428405b261ecSmrg      fi
428505b261ecSmrg
428605b261ecSmrg      if test -n "$xrpath"; then
428705b261ecSmrg	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
428805b261ecSmrg      fi
428905b261ecSmrg
429005b261ecSmrg      if test -n "$vinfo"; then
429105b261ecSmrg	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
429205b261ecSmrg      fi
429305b261ecSmrg
429405b261ecSmrg      if test -n "$release"; then
429505b261ecSmrg	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
429605b261ecSmrg      fi
429705b261ecSmrg
429805b261ecSmrg      case $output in
429905b261ecSmrg      *.lo)
430005b261ecSmrg	if test -n "$objs$old_deplibs"; then
430105b261ecSmrg	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
430205b261ecSmrg	  exit $EXIT_FAILURE
430305b261ecSmrg	fi
430405b261ecSmrg	libobj="$output"
430505b261ecSmrg	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
430605b261ecSmrg	;;
430705b261ecSmrg      *)
430805b261ecSmrg	libobj=
430905b261ecSmrg	obj="$output"
431005b261ecSmrg	;;
431105b261ecSmrg      esac
431205b261ecSmrg
431305b261ecSmrg      # Delete the old objects.
431405b261ecSmrg      $run $rm $obj $libobj
431505b261ecSmrg
431605b261ecSmrg      # Objects from convenience libraries.  This assumes
431705b261ecSmrg      # single-version convenience libraries.  Whenever we create
431805b261ecSmrg      # different ones for PIC/non-PIC, this we'll have to duplicate
431905b261ecSmrg      # the extraction.
432005b261ecSmrg      reload_conv_objs=
432105b261ecSmrg      gentop=
432205b261ecSmrg      # reload_cmds runs $LD directly, so let us get rid of
432305b261ecSmrg      # -Wl from whole_archive_flag_spec and hope we can get by with
432405b261ecSmrg      # turning comma into space..
432505b261ecSmrg      wl=
432605b261ecSmrg
432705b261ecSmrg      if test -n "$convenience"; then
432805b261ecSmrg	if test -n "$whole_archive_flag_spec"; then
432905b261ecSmrg	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
433005b261ecSmrg	  reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
433105b261ecSmrg	else
433205b261ecSmrg	  gentop="$output_objdir/${obj}x"
433305b261ecSmrg	  generated="$generated $gentop"
433405b261ecSmrg
433505b261ecSmrg	  func_extract_archives $gentop $convenience
433605b261ecSmrg	  reload_conv_objs="$reload_objs $func_extract_archives_result"
433705b261ecSmrg	fi
433805b261ecSmrg      fi
433905b261ecSmrg
434005b261ecSmrg      # Create the old-style object.
434105b261ecSmrg      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
434205b261ecSmrg
434305b261ecSmrg      output="$obj"
434405b261ecSmrg      cmds=$reload_cmds
434505b261ecSmrg      save_ifs="$IFS"; IFS='~'
434605b261ecSmrg      for cmd in $cmds; do
434705b261ecSmrg	IFS="$save_ifs"
434805b261ecSmrg	eval cmd=\"$cmd\"
434905b261ecSmrg	$show "$cmd"
435005b261ecSmrg	$run eval "$cmd" || exit $?
435105b261ecSmrg      done
435205b261ecSmrg      IFS="$save_ifs"
435305b261ecSmrg
435405b261ecSmrg      # Exit if we aren't doing a library object file.
435505b261ecSmrg      if test -z "$libobj"; then
435605b261ecSmrg	if test -n "$gentop"; then
435705b261ecSmrg	  $show "${rm}r $gentop"
435805b261ecSmrg	  $run ${rm}r $gentop
435905b261ecSmrg	fi
436005b261ecSmrg
436105b261ecSmrg	exit $EXIT_SUCCESS
436205b261ecSmrg      fi
436305b261ecSmrg
436405b261ecSmrg      if test "$build_libtool_libs" != yes; then
436505b261ecSmrg	if test -n "$gentop"; then
436605b261ecSmrg	  $show "${rm}r $gentop"
436705b261ecSmrg	  $run ${rm}r $gentop
436805b261ecSmrg	fi
436905b261ecSmrg
437005b261ecSmrg	# Create an invalid libtool object if no PIC, so that we don't
437105b261ecSmrg	# accidentally link it into a program.
437205b261ecSmrg	# $show "echo timestamp > $libobj"
437305b261ecSmrg	# $run eval "echo timestamp > $libobj" || exit $?
437405b261ecSmrg	exit $EXIT_SUCCESS
437505b261ecSmrg      fi
437605b261ecSmrg
437705b261ecSmrg      if test -n "$pic_flag" || test "$pic_mode" != default; then
437805b261ecSmrg	# Only do commands if we really have different PIC objects.
437905b261ecSmrg	reload_objs="$libobjs $reload_conv_objs"
438005b261ecSmrg	output="$libobj"
438105b261ecSmrg	cmds=$reload_cmds
438205b261ecSmrg	save_ifs="$IFS"; IFS='~'
438305b261ecSmrg	for cmd in $cmds; do
438405b261ecSmrg	  IFS="$save_ifs"
438505b261ecSmrg	  eval cmd=\"$cmd\"
438605b261ecSmrg	  $show "$cmd"
438705b261ecSmrg	  $run eval "$cmd" || exit $?
438805b261ecSmrg	done
438905b261ecSmrg	IFS="$save_ifs"
439005b261ecSmrg      fi
439105b261ecSmrg
439205b261ecSmrg      if test -n "$gentop"; then
439305b261ecSmrg	$show "${rm}r $gentop"
439405b261ecSmrg	$run ${rm}r $gentop
439505b261ecSmrg      fi
439605b261ecSmrg
439705b261ecSmrg      exit $EXIT_SUCCESS
439805b261ecSmrg      ;;
439905b261ecSmrg
440005b261ecSmrg    prog)
440105b261ecSmrg      case $host in
440205b261ecSmrg	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
440305b261ecSmrg      esac
440405b261ecSmrg      if test -n "$vinfo"; then
440505b261ecSmrg	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
440605b261ecSmrg      fi
440705b261ecSmrg
440805b261ecSmrg      if test -n "$release"; then
440905b261ecSmrg	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
441005b261ecSmrg      fi
441105b261ecSmrg
441205b261ecSmrg      if test "$preload" = yes; then
441305b261ecSmrg	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
441405b261ecSmrg	   test "$dlopen_self_static" = unknown; then
441505b261ecSmrg	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
441605b261ecSmrg	fi
441705b261ecSmrg      fi
441805b261ecSmrg
441905b261ecSmrg      case $host in
442005b261ecSmrg      *-*-rhapsody* | *-*-darwin1.[012])
442105b261ecSmrg	# On Rhapsody replace the C library is the System framework
442205b261ecSmrg	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
442305b261ecSmrg	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
442405b261ecSmrg	;;
442505b261ecSmrg      esac
442605b261ecSmrg
442705b261ecSmrg      case $host in
442805b261ecSmrg      *darwin*)
442905b261ecSmrg        # Don't allow lazy linking, it breaks C++ global constructors
443005b261ecSmrg        if test "$tagname" = CXX ; then
443105b261ecSmrg        compile_command="$compile_command ${wl}-bind_at_load"
443205b261ecSmrg        finalize_command="$finalize_command ${wl}-bind_at_load"
443305b261ecSmrg        fi
443405b261ecSmrg        ;;
443505b261ecSmrg      esac
443605b261ecSmrg
443705b261ecSmrg
443805b261ecSmrg      # move library search paths that coincide with paths to not yet
443905b261ecSmrg      # installed libraries to the beginning of the library search list
444005b261ecSmrg      new_libs=
444105b261ecSmrg      for path in $notinst_path; do
444205b261ecSmrg	case " $new_libs " in
444305b261ecSmrg	*" -L$path/$objdir "*) ;;
444405b261ecSmrg	*)
444505b261ecSmrg	  case " $compile_deplibs " in
444605b261ecSmrg	  *" -L$path/$objdir "*)
444705b261ecSmrg	    new_libs="$new_libs -L$path/$objdir" ;;
444805b261ecSmrg	  esac
444905b261ecSmrg	  ;;
445005b261ecSmrg	esac
445105b261ecSmrg      done
445205b261ecSmrg      for deplib in $compile_deplibs; do
445305b261ecSmrg	case $deplib in
445405b261ecSmrg	-L*)
445505b261ecSmrg	  case " $new_libs " in
445605b261ecSmrg	  *" $deplib "*) ;;
445705b261ecSmrg	  *) new_libs="$new_libs $deplib" ;;
445805b261ecSmrg	  esac
445905b261ecSmrg	  ;;
446005b261ecSmrg	*) new_libs="$new_libs $deplib" ;;
446105b261ecSmrg	esac
446205b261ecSmrg      done
446305b261ecSmrg      compile_deplibs="$new_libs"
446405b261ecSmrg
446505b261ecSmrg
446605b261ecSmrg      compile_command="$compile_command $compile_deplibs"
446705b261ecSmrg      finalize_command="$finalize_command $finalize_deplibs"
446805b261ecSmrg
446905b261ecSmrg      if test -n "$rpath$xrpath"; then
447005b261ecSmrg	# If the user specified any rpath flags, then add them.
447105b261ecSmrg	for libdir in $rpath $xrpath; do
447205b261ecSmrg	  # This is the magic to use -rpath.
447305b261ecSmrg	  case "$finalize_rpath " in
447405b261ecSmrg	  *" $libdir "*) ;;
447505b261ecSmrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
447605b261ecSmrg	  esac
447705b261ecSmrg	done
447805b261ecSmrg      fi
447905b261ecSmrg
448005b261ecSmrg      # Now hardcode the library paths
448105b261ecSmrg      rpath=
448205b261ecSmrg      hardcode_libdirs=
448305b261ecSmrg      for libdir in $compile_rpath $finalize_rpath; do
448405b261ecSmrg	if test -n "$hardcode_libdir_flag_spec"; then
448505b261ecSmrg	  if test -n "$hardcode_libdir_separator"; then
448605b261ecSmrg	    if test -z "$hardcode_libdirs"; then
448705b261ecSmrg	      hardcode_libdirs="$libdir"
448805b261ecSmrg	    else
448905b261ecSmrg	      # Just accumulate the unique libdirs.
449005b261ecSmrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
449105b261ecSmrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
449205b261ecSmrg		;;
449305b261ecSmrg	      *)
449405b261ecSmrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
449505b261ecSmrg		;;
449605b261ecSmrg	      esac
449705b261ecSmrg	    fi
449805b261ecSmrg	  else
449905b261ecSmrg	    eval flag=\"$hardcode_libdir_flag_spec\"
450005b261ecSmrg	    rpath="$rpath $flag"
450105b261ecSmrg	  fi
450205b261ecSmrg	elif test -n "$runpath_var"; then
450305b261ecSmrg	  case "$perm_rpath " in
450405b261ecSmrg	  *" $libdir "*) ;;
450505b261ecSmrg	  *) perm_rpath="$perm_rpath $libdir" ;;
450605b261ecSmrg	  esac
450705b261ecSmrg	fi
450805b261ecSmrg	case $host in
450905b261ecSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
451005b261ecSmrg	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
451105b261ecSmrg	  case :$dllsearchpath: in
451205b261ecSmrg	  *":$libdir:"*) ;;
451305b261ecSmrg	  *) dllsearchpath="$dllsearchpath:$libdir";;
451405b261ecSmrg	  esac
451505b261ecSmrg	  case :$dllsearchpath: in
451605b261ecSmrg	  *":$testbindir:"*) ;;
451705b261ecSmrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
451805b261ecSmrg	  esac
451905b261ecSmrg	  ;;
452005b261ecSmrg	esac
452105b261ecSmrg      done
452205b261ecSmrg      # Substitute the hardcoded libdirs into the rpath.
452305b261ecSmrg      if test -n "$hardcode_libdir_separator" &&
452405b261ecSmrg	 test -n "$hardcode_libdirs"; then
452505b261ecSmrg	libdir="$hardcode_libdirs"
452605b261ecSmrg	eval rpath=\" $hardcode_libdir_flag_spec\"
452705b261ecSmrg      fi
452805b261ecSmrg      compile_rpath="$rpath"
452905b261ecSmrg
453005b261ecSmrg      rpath=
453105b261ecSmrg      hardcode_libdirs=
453205b261ecSmrg      for libdir in $finalize_rpath; do
453305b261ecSmrg	if test -n "$hardcode_libdir_flag_spec"; then
453405b261ecSmrg	  if test -n "$hardcode_libdir_separator"; then
453505b261ecSmrg	    if test -z "$hardcode_libdirs"; then
453605b261ecSmrg	      hardcode_libdirs="$libdir"
453705b261ecSmrg	    else
453805b261ecSmrg	      # Just accumulate the unique libdirs.
453905b261ecSmrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
454005b261ecSmrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
454105b261ecSmrg		;;
454205b261ecSmrg	      *)
454305b261ecSmrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
454405b261ecSmrg		;;
454505b261ecSmrg	      esac
454605b261ecSmrg	    fi
454705b261ecSmrg	  else
454805b261ecSmrg	    eval flag=\"$hardcode_libdir_flag_spec\"
454905b261ecSmrg	    rpath="$rpath $flag"
455005b261ecSmrg	  fi
455105b261ecSmrg	elif test -n "$runpath_var"; then
455205b261ecSmrg	  case "$finalize_perm_rpath " in
455305b261ecSmrg	  *" $libdir "*) ;;
455405b261ecSmrg	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
455505b261ecSmrg	  esac
455605b261ecSmrg	fi
455705b261ecSmrg      done
455805b261ecSmrg      # Substitute the hardcoded libdirs into the rpath.
455905b261ecSmrg      if test -n "$hardcode_libdir_separator" &&
456005b261ecSmrg	 test -n "$hardcode_libdirs"; then
456105b261ecSmrg	libdir="$hardcode_libdirs"
456205b261ecSmrg	eval rpath=\" $hardcode_libdir_flag_spec\"
456305b261ecSmrg      fi
456405b261ecSmrg      finalize_rpath="$rpath"
456505b261ecSmrg
456605b261ecSmrg      if test -n "$libobjs" && test "$build_old_libs" = yes; then
456705b261ecSmrg	# Transform all the library objects into standard objects.
456805b261ecSmrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
456905b261ecSmrg	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
457005b261ecSmrg      fi
457105b261ecSmrg
457205b261ecSmrg      dlsyms=
457305b261ecSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
457405b261ecSmrg	if test -n "$NM" && test -n "$global_symbol_pipe"; then
457505b261ecSmrg	  dlsyms="${outputname}S.c"
457605b261ecSmrg	else
457705b261ecSmrg	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
457805b261ecSmrg	fi
457905b261ecSmrg      fi
458005b261ecSmrg
458105b261ecSmrg      if test -n "$dlsyms"; then
458205b261ecSmrg	case $dlsyms in
458305b261ecSmrg	"") ;;
458405b261ecSmrg	*.c)
458505b261ecSmrg	  # Discover the nlist of each of the dlfiles.
458605b261ecSmrg	  nlist="$output_objdir/${outputname}.nm"
458705b261ecSmrg
458805b261ecSmrg	  $show "$rm $nlist ${nlist}S ${nlist}T"
458905b261ecSmrg	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
459005b261ecSmrg
459105b261ecSmrg	  # Parse the name list into a source file.
459205b261ecSmrg	  $show "creating $output_objdir/$dlsyms"
459305b261ecSmrg
459405b261ecSmrg	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
459505b261ecSmrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
459605b261ecSmrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
459705b261ecSmrg
459805b261ecSmrg#ifdef __cplusplus
459905b261ecSmrgextern \"C\" {
460005b261ecSmrg#endif
460105b261ecSmrg
460205b261ecSmrg/* Prevent the only kind of declaration conflicts we can make. */
460305b261ecSmrg#define lt_preloaded_symbols some_other_symbol
460405b261ecSmrg
460505b261ecSmrg/* External symbol declarations for the compiler. */\
460605b261ecSmrg"
460705b261ecSmrg
460805b261ecSmrg	  if test "$dlself" = yes; then
460905b261ecSmrg	    $show "generating symbol list for \`$output'"
461005b261ecSmrg
461105b261ecSmrg	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
461205b261ecSmrg
461305b261ecSmrg	    # Add our own program objects to the symbol list.
461405b261ecSmrg	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
461505b261ecSmrg	    for arg in $progfiles; do
461605b261ecSmrg	      $show "extracting global C symbols from \`$arg'"
461705b261ecSmrg	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
461805b261ecSmrg	    done
461905b261ecSmrg
462005b261ecSmrg	    if test -n "$exclude_expsyms"; then
462105b261ecSmrg	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
462205b261ecSmrg	      $run eval '$mv "$nlist"T "$nlist"'
462305b261ecSmrg	    fi
462405b261ecSmrg
462505b261ecSmrg	    if test -n "$export_symbols_regex"; then
462605b261ecSmrg	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
462705b261ecSmrg	      $run eval '$mv "$nlist"T "$nlist"'
462805b261ecSmrg	    fi
462905b261ecSmrg
463005b261ecSmrg	    # Prepare the list of exported symbols
463105b261ecSmrg	    if test -z "$export_symbols"; then
463205b261ecSmrg	      export_symbols="$output_objdir/$outputname.exp"
463305b261ecSmrg	      $run $rm $export_symbols
463405b261ecSmrg	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
463505b261ecSmrg              case $host in
463605b261ecSmrg              *cygwin* | *mingw* )
463705b261ecSmrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
463805b261ecSmrg		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
463905b261ecSmrg                ;;
464005b261ecSmrg              esac
464105b261ecSmrg	    else
464205b261ecSmrg	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
464305b261ecSmrg	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
464405b261ecSmrg	      $run eval 'mv "$nlist"T "$nlist"'
464505b261ecSmrg              case $host in
464605b261ecSmrg              *cygwin* | *mingw* )
464705b261ecSmrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
464805b261ecSmrg		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
464905b261ecSmrg                ;;
465005b261ecSmrg              esac
465105b261ecSmrg	    fi
465205b261ecSmrg	  fi
465305b261ecSmrg
465405b261ecSmrg	  for arg in $dlprefiles; do
465505b261ecSmrg	    $show "extracting global C symbols from \`$arg'"
465605b261ecSmrg	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
465705b261ecSmrg	    $run eval '$echo ": $name " >> "$nlist"'
465805b261ecSmrg	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
465905b261ecSmrg	  done
466005b261ecSmrg
466105b261ecSmrg	  if test -z "$run"; then
466205b261ecSmrg	    # Make sure we have at least an empty file.
466305b261ecSmrg	    test -f "$nlist" || : > "$nlist"
466405b261ecSmrg
466505b261ecSmrg	    if test -n "$exclude_expsyms"; then
466605b261ecSmrg	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
466705b261ecSmrg	      $mv "$nlist"T "$nlist"
466805b261ecSmrg	    fi
466905b261ecSmrg
467005b261ecSmrg	    # Try sorting and uniquifying the output.
467105b261ecSmrg	    if grep -v "^: " < "$nlist" |
467205b261ecSmrg		if sort -k 3 </dev/null >/dev/null 2>&1; then
467305b261ecSmrg		  sort -k 3
467405b261ecSmrg		else
467505b261ecSmrg		  sort +2
467605b261ecSmrg		fi |
467705b261ecSmrg		uniq > "$nlist"S; then
467805b261ecSmrg	      :
467905b261ecSmrg	    else
468005b261ecSmrg	      grep -v "^: " < "$nlist" > "$nlist"S
468105b261ecSmrg	    fi
468205b261ecSmrg
468305b261ecSmrg	    if test -f "$nlist"S; then
468405b261ecSmrg	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
468505b261ecSmrg	    else
468605b261ecSmrg	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
468705b261ecSmrg	    fi
468805b261ecSmrg
468905b261ecSmrg	    $echo >> "$output_objdir/$dlsyms" "\
469005b261ecSmrg
469105b261ecSmrg#undef lt_preloaded_symbols
469205b261ecSmrg
469305b261ecSmrg#if defined (__STDC__) && __STDC__
469405b261ecSmrg# define lt_ptr void *
469505b261ecSmrg#else
469605b261ecSmrg# define lt_ptr char *
469705b261ecSmrg# define const
469805b261ecSmrg#endif
469905b261ecSmrg
470005b261ecSmrg/* The mapping between symbol names and symbols. */
470105b261ecSmrg"
470205b261ecSmrg
470305b261ecSmrg	    case $host in
470405b261ecSmrg	    *cygwin* | *mingw* )
470505b261ecSmrg	  $echo >> "$output_objdir/$dlsyms" "\
470605b261ecSmrg/* DATA imports from DLLs on WIN32 can't be const, because
470705b261ecSmrg   runtime relocations are performed -- see ld's documentation
470805b261ecSmrg   on pseudo-relocs */
470905b261ecSmrgstruct {
471005b261ecSmrg"
471105b261ecSmrg	      ;;
471205b261ecSmrg	    * )
471305b261ecSmrg	  $echo >> "$output_objdir/$dlsyms" "\
471405b261ecSmrgconst struct {
471505b261ecSmrg"
471605b261ecSmrg	      ;;
471705b261ecSmrg	    esac
471805b261ecSmrg
471905b261ecSmrg
472005b261ecSmrg	  $echo >> "$output_objdir/$dlsyms" "\
472105b261ecSmrg  const char *name;
472205b261ecSmrg  lt_ptr address;
472305b261ecSmrg}
472405b261ecSmrglt_preloaded_symbols[] =
472505b261ecSmrg{\
472605b261ecSmrg"
472705b261ecSmrg
472805b261ecSmrg	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
472905b261ecSmrg
473005b261ecSmrg	    $echo >> "$output_objdir/$dlsyms" "\
473105b261ecSmrg  {0, (lt_ptr) 0}
473205b261ecSmrg};
473305b261ecSmrg
473405b261ecSmrg/* This works around a problem in FreeBSD linker */
473505b261ecSmrg#ifdef FREEBSD_WORKAROUND
473605b261ecSmrgstatic const void *lt_preloaded_setup() {
473705b261ecSmrg  return lt_preloaded_symbols;
473805b261ecSmrg}
473905b261ecSmrg#endif
474005b261ecSmrg
474105b261ecSmrg#ifdef __cplusplus
474205b261ecSmrg}
474305b261ecSmrg#endif\
474405b261ecSmrg"
474505b261ecSmrg	  fi
474605b261ecSmrg
474705b261ecSmrg	  pic_flag_for_symtable=
474805b261ecSmrg	  case $host in
474905b261ecSmrg	  # compiling the symbol table file with pic_flag works around
475005b261ecSmrg	  # a FreeBSD bug that causes programs to crash when -lm is
475105b261ecSmrg	  # linked before any other PIC object.  But we must not use
475205b261ecSmrg	  # pic_flag when linking with -static.  The problem exists in
475305b261ecSmrg	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
475405b261ecSmrg	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
475505b261ecSmrg	    case "$compile_command " in
475605b261ecSmrg	    *" -static "*) ;;
475705b261ecSmrg	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
475805b261ecSmrg	    esac;;
475905b261ecSmrg	  *-*-hpux*)
476005b261ecSmrg	    case "$compile_command " in
476105b261ecSmrg	    *" -static "*) ;;
476205b261ecSmrg	    *) pic_flag_for_symtable=" $pic_flag";;
476305b261ecSmrg	    esac
476405b261ecSmrg	  esac
476505b261ecSmrg
476605b261ecSmrg	  # Now compile the dynamic symbol file.
476705b261ecSmrg	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
476805b261ecSmrg	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
476905b261ecSmrg
477005b261ecSmrg	  # Clean up the generated files.
477105b261ecSmrg	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
477205b261ecSmrg	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
477305b261ecSmrg
477405b261ecSmrg	  # Transform the symbol file into the correct name.
477505b261ecSmrg          case $host in
477605b261ecSmrg          *cygwin* | *mingw* )
477705b261ecSmrg            if test -f "$output_objdir/${outputname}.def" ; then
477805b261ecSmrg              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
477905b261ecSmrg              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
478005b261ecSmrg            else
478105b261ecSmrg              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
478205b261ecSmrg              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
478305b261ecSmrg             fi
478405b261ecSmrg            ;;
478505b261ecSmrg          * )
478605b261ecSmrg            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
478705b261ecSmrg            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
478805b261ecSmrg            ;;
478905b261ecSmrg          esac
479005b261ecSmrg	  ;;
479105b261ecSmrg	*)
479205b261ecSmrg	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
479305b261ecSmrg	  exit $EXIT_FAILURE
479405b261ecSmrg	  ;;
479505b261ecSmrg	esac
479605b261ecSmrg      else
479705b261ecSmrg	# We keep going just in case the user didn't refer to
479805b261ecSmrg	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
479905b261ecSmrg	# really was required.
480005b261ecSmrg
480105b261ecSmrg	# Nullify the symbol file.
480205b261ecSmrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
480305b261ecSmrg	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
480405b261ecSmrg      fi
480505b261ecSmrg
480605b261ecSmrg      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
480705b261ecSmrg	# Replace the output file specification.
480805b261ecSmrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
480905b261ecSmrg	link_command="$compile_command$compile_rpath"
481005b261ecSmrg
481105b261ecSmrg	# We have no uninstalled library dependencies, so finalize right now.
481205b261ecSmrg	$show "$link_command"
481305b261ecSmrg	$run eval "$link_command"
481405b261ecSmrg	exit_status=$?
481505b261ecSmrg
481605b261ecSmrg	# Delete the generated files.
481705b261ecSmrg	if test -n "$dlsyms"; then
481805b261ecSmrg	  $show "$rm $output_objdir/${outputname}S.${objext}"
481905b261ecSmrg	  $run $rm "$output_objdir/${outputname}S.${objext}"
482005b261ecSmrg	fi
482105b261ecSmrg
482205b261ecSmrg	exit $exit_status
482305b261ecSmrg      fi
482405b261ecSmrg
482505b261ecSmrg      if test -n "$shlibpath_var"; then
482605b261ecSmrg	# We should set the shlibpath_var
482705b261ecSmrg	rpath=
482805b261ecSmrg	for dir in $temp_rpath; do
482905b261ecSmrg	  case $dir in
483005b261ecSmrg	  [\\/]* | [A-Za-z]:[\\/]*)
483105b261ecSmrg	    # Absolute path.
483205b261ecSmrg	    rpath="$rpath$dir:"
483305b261ecSmrg	    ;;
483405b261ecSmrg	  *)
483505b261ecSmrg	    # Relative path: add a thisdir entry.
483605b261ecSmrg	    rpath="$rpath\$thisdir/$dir:"
483705b261ecSmrg	    ;;
483805b261ecSmrg	  esac
483905b261ecSmrg	done
484005b261ecSmrg	temp_rpath="$rpath"
484105b261ecSmrg      fi
484205b261ecSmrg
484305b261ecSmrg      if test -n "$compile_shlibpath$finalize_shlibpath"; then
484405b261ecSmrg	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
484505b261ecSmrg      fi
484605b261ecSmrg      if test -n "$finalize_shlibpath"; then
484705b261ecSmrg	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
484805b261ecSmrg      fi
484905b261ecSmrg
485005b261ecSmrg      compile_var=
485105b261ecSmrg      finalize_var=
485205b261ecSmrg      if test -n "$runpath_var"; then
485305b261ecSmrg	if test -n "$perm_rpath"; then
485405b261ecSmrg	  # We should set the runpath_var.
485505b261ecSmrg	  rpath=
485605b261ecSmrg	  for dir in $perm_rpath; do
485705b261ecSmrg	    rpath="$rpath$dir:"
485805b261ecSmrg	  done
485905b261ecSmrg	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
486005b261ecSmrg	fi
486105b261ecSmrg	if test -n "$finalize_perm_rpath"; then
486205b261ecSmrg	  # We should set the runpath_var.
486305b261ecSmrg	  rpath=
486405b261ecSmrg	  for dir in $finalize_perm_rpath; do
486505b261ecSmrg	    rpath="$rpath$dir:"
486605b261ecSmrg	  done
486705b261ecSmrg	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
486805b261ecSmrg	fi
486905b261ecSmrg      fi
487005b261ecSmrg
487105b261ecSmrg      if test "$no_install" = yes; then
487205b261ecSmrg	# We don't need to create a wrapper script.
487305b261ecSmrg	link_command="$compile_var$compile_command$compile_rpath"
487405b261ecSmrg	# Replace the output file specification.
487505b261ecSmrg	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
487605b261ecSmrg	# Delete the old output file.
487705b261ecSmrg	$run $rm $output
487805b261ecSmrg	# Link the executable and exit
487905b261ecSmrg	$show "$link_command"
488005b261ecSmrg	$run eval "$link_command" || exit $?
488105b261ecSmrg	exit $EXIT_SUCCESS
488205b261ecSmrg      fi
488305b261ecSmrg
488405b261ecSmrg      if test "$hardcode_action" = relink; then
488505b261ecSmrg	# Fast installation is not supported
488605b261ecSmrg	link_command="$compile_var$compile_command$compile_rpath"
488705b261ecSmrg	relink_command="$finalize_var$finalize_command$finalize_rpath"
488805b261ecSmrg
488905b261ecSmrg	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
489005b261ecSmrg	$echo "$modename: \`$output' will be relinked during installation" 1>&2
489105b261ecSmrg      else
489205b261ecSmrg	if test "$fast_install" != no; then
489305b261ecSmrg	  link_command="$finalize_var$compile_command$finalize_rpath"
489405b261ecSmrg	  if test "$fast_install" = yes; then
489505b261ecSmrg	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
489605b261ecSmrg	  else
489705b261ecSmrg	    # fast_install is set to needless
489805b261ecSmrg	    relink_command=
489905b261ecSmrg	  fi
490005b261ecSmrg	else
490105b261ecSmrg	  link_command="$compile_var$compile_command$compile_rpath"
490205b261ecSmrg	  relink_command="$finalize_var$finalize_command$finalize_rpath"
490305b261ecSmrg	fi
490405b261ecSmrg      fi
490505b261ecSmrg
490605b261ecSmrg      # Replace the output file specification.
490705b261ecSmrg      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
490805b261ecSmrg
490905b261ecSmrg      # Delete the old output files.
491005b261ecSmrg      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
491105b261ecSmrg
491205b261ecSmrg      $show "$link_command"
491305b261ecSmrg      $run eval "$link_command" || exit $?
491405b261ecSmrg
491505b261ecSmrg      # Now create the wrapper script.
491605b261ecSmrg      $show "creating $output"
491705b261ecSmrg
491805b261ecSmrg      # Quote the relink command for shipping.
491905b261ecSmrg      if test -n "$relink_command"; then
492005b261ecSmrg	# Preserve any variables that may affect compiler behavior
492105b261ecSmrg	for var in $variables_saved_for_relink; do
492205b261ecSmrg	  if eval test -z \"\${$var+set}\"; then
492305b261ecSmrg	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
492405b261ecSmrg	  elif eval var_value=\$$var; test -z "$var_value"; then
492505b261ecSmrg	    relink_command="$var=; export $var; $relink_command"
492605b261ecSmrg	  else
492705b261ecSmrg	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
492805b261ecSmrg	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
492905b261ecSmrg	  fi
493005b261ecSmrg	done
493105b261ecSmrg	relink_command="(cd `pwd`; $relink_command)"
493205b261ecSmrg	relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
493305b261ecSmrg      fi
493405b261ecSmrg
493505b261ecSmrg      # Quote $echo for shipping.
493605b261ecSmrg      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
493705b261ecSmrg	case $progpath in
493805b261ecSmrg	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
493905b261ecSmrg	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
494005b261ecSmrg	esac
494105b261ecSmrg	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
494205b261ecSmrg      else
494305b261ecSmrg	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
494405b261ecSmrg      fi
494505b261ecSmrg
494605b261ecSmrg      # Only actually do things if our run command is non-null.
494705b261ecSmrg      if test -z "$run"; then
494805b261ecSmrg	# win32 will think the script is a binary if it has
494905b261ecSmrg	# a .exe suffix, so we strip it off here.
495005b261ecSmrg	case $output in
495105b261ecSmrg	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
495205b261ecSmrg	esac
495305b261ecSmrg	# test for cygwin because mv fails w/o .exe extensions
495405b261ecSmrg	case $host in
495505b261ecSmrg	  *cygwin*)
495605b261ecSmrg	    exeext=.exe
495705b261ecSmrg	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
495805b261ecSmrg	  *) exeext= ;;
495905b261ecSmrg	esac
496005b261ecSmrg	case $host in
496105b261ecSmrg	  *cygwin* | *mingw* )
496205b261ecSmrg            output_name=`basename $output`
496305b261ecSmrg            output_path=`dirname $output`
496405b261ecSmrg            cwrappersource="$output_path/$objdir/lt-$output_name.c"
496505b261ecSmrg            cwrapper="$output_path/$output_name.exe"
496605b261ecSmrg            $rm $cwrappersource $cwrapper
496705b261ecSmrg            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
496805b261ecSmrg
496905b261ecSmrg	    cat > $cwrappersource <<EOF
497005b261ecSmrg
497105b261ecSmrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
497205b261ecSmrg   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
497305b261ecSmrg
497405b261ecSmrg   The $output program cannot be directly executed until all the libtool
497505b261ecSmrg   libraries that it depends on are installed.
497605b261ecSmrg
497705b261ecSmrg   This wrapper executable should never be moved out of the build directory.
497805b261ecSmrg   If it is, it will not operate correctly.
497905b261ecSmrg
498005b261ecSmrg   Currently, it simply execs the wrapper *script* "/bin/sh $output",
498105b261ecSmrg   but could eventually absorb all of the scripts functionality and
498205b261ecSmrg   exec $objdir/$outputname directly.
498305b261ecSmrg*/
498405b261ecSmrgEOF
498505b261ecSmrg	    cat >> $cwrappersource<<"EOF"
498605b261ecSmrg#include <stdio.h>
498705b261ecSmrg#include <stdlib.h>
498805b261ecSmrg#include <unistd.h>
498905b261ecSmrg#include <malloc.h>
499005b261ecSmrg#include <stdarg.h>
499105b261ecSmrg#include <assert.h>
499205b261ecSmrg#include <string.h>
499305b261ecSmrg#include <ctype.h>
499405b261ecSmrg#include <sys/stat.h>
499505b261ecSmrg
499605b261ecSmrg#if defined(PATH_MAX)
499705b261ecSmrg# define LT_PATHMAX PATH_MAX
499805b261ecSmrg#elif defined(MAXPATHLEN)
499905b261ecSmrg# define LT_PATHMAX MAXPATHLEN
500005b261ecSmrg#else
500105b261ecSmrg# define LT_PATHMAX 1024
500205b261ecSmrg#endif
500305b261ecSmrg
500405b261ecSmrg#ifndef DIR_SEPARATOR
500505b261ecSmrg# define DIR_SEPARATOR '/'
500605b261ecSmrg# define PATH_SEPARATOR ':'
500705b261ecSmrg#endif
500805b261ecSmrg
500905b261ecSmrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
501005b261ecSmrg  defined (__OS2__)
501105b261ecSmrg# define HAVE_DOS_BASED_FILE_SYSTEM
501205b261ecSmrg# ifndef DIR_SEPARATOR_2
501305b261ecSmrg#  define DIR_SEPARATOR_2 '\\'
501405b261ecSmrg# endif
501505b261ecSmrg# ifndef PATH_SEPARATOR_2
501605b261ecSmrg#  define PATH_SEPARATOR_2 ';'
501705b261ecSmrg# endif
501805b261ecSmrg#endif
501905b261ecSmrg
502005b261ecSmrg#ifndef DIR_SEPARATOR_2
502105b261ecSmrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
502205b261ecSmrg#else /* DIR_SEPARATOR_2 */
502305b261ecSmrg# define IS_DIR_SEPARATOR(ch) \
502405b261ecSmrg        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
502505b261ecSmrg#endif /* DIR_SEPARATOR_2 */
502605b261ecSmrg
502705b261ecSmrg#ifndef PATH_SEPARATOR_2
502805b261ecSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
502905b261ecSmrg#else /* PATH_SEPARATOR_2 */
503005b261ecSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
503105b261ecSmrg#endif /* PATH_SEPARATOR_2 */
503205b261ecSmrg
503305b261ecSmrg#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
503405b261ecSmrg#define XFREE(stale) do { \
503505b261ecSmrg  if (stale) { free ((void *) stale); stale = 0; } \
503605b261ecSmrg} while (0)
503705b261ecSmrg
503805b261ecSmrg/* -DDEBUG is fairly common in CFLAGS.  */
503905b261ecSmrg#undef DEBUG
504005b261ecSmrg#if defined DEBUGWRAPPER
504105b261ecSmrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
504205b261ecSmrg#else
504305b261ecSmrg# define DEBUG(format, ...)
504405b261ecSmrg#endif
504505b261ecSmrg
504605b261ecSmrgconst char *program_name = NULL;
504705b261ecSmrg
504805b261ecSmrgvoid * xmalloc (size_t num);
504905b261ecSmrgchar * xstrdup (const char *string);
505005b261ecSmrgconst char * base_name (const char *name);
505105b261ecSmrgchar * find_executable(const char *wrapper);
505205b261ecSmrgint    check_executable(const char *path);
505305b261ecSmrgchar * strendzap(char *str, const char *pat);
505405b261ecSmrgvoid lt_fatal (const char *message, ...);
505505b261ecSmrg
505605b261ecSmrgint
505705b261ecSmrgmain (int argc, char *argv[])
505805b261ecSmrg{
505905b261ecSmrg  char **newargz;
506005b261ecSmrg  int i;
506105b261ecSmrg
506205b261ecSmrg  program_name = (char *) xstrdup (base_name (argv[0]));
506305b261ecSmrg  DEBUG("(main) argv[0]      : %s\n",argv[0]);
506405b261ecSmrg  DEBUG("(main) program_name : %s\n",program_name);
506505b261ecSmrg  newargz = XMALLOC(char *, argc+2);
506605b261ecSmrgEOF
506705b261ecSmrg
506805b261ecSmrg            cat >> $cwrappersource <<EOF
506905b261ecSmrg  newargz[0] = (char *) xstrdup("$SHELL");
507005b261ecSmrgEOF
507105b261ecSmrg
507205b261ecSmrg            cat >> $cwrappersource <<"EOF"
507305b261ecSmrg  newargz[1] = find_executable(argv[0]);
507405b261ecSmrg  if (newargz[1] == NULL)
507505b261ecSmrg    lt_fatal("Couldn't find %s", argv[0]);
507605b261ecSmrg  DEBUG("(main) found exe at : %s\n",newargz[1]);
507705b261ecSmrg  /* we know the script has the same name, without the .exe */
507805b261ecSmrg  /* so make sure newargz[1] doesn't end in .exe */
507905b261ecSmrg  strendzap(newargz[1],".exe");
508005b261ecSmrg  for (i = 1; i < argc; i++)
508105b261ecSmrg    newargz[i+1] = xstrdup(argv[i]);
508205b261ecSmrg  newargz[argc+1] = NULL;
508305b261ecSmrg
508405b261ecSmrg  for (i=0; i<argc+1; i++)
508505b261ecSmrg  {
508605b261ecSmrg    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
508705b261ecSmrg    ;
508805b261ecSmrg  }
508905b261ecSmrg
509005b261ecSmrgEOF
509105b261ecSmrg
509205b261ecSmrg            case $host_os in
509305b261ecSmrg              mingw*)
509405b261ecSmrg                cat >> $cwrappersource <<EOF
509505b261ecSmrg  execv("$SHELL",(char const **)newargz);
509605b261ecSmrgEOF
509705b261ecSmrg              ;;
509805b261ecSmrg              *)
509905b261ecSmrg                cat >> $cwrappersource <<EOF
510005b261ecSmrg  execv("$SHELL",newargz);
510105b261ecSmrgEOF
510205b261ecSmrg              ;;
510305b261ecSmrg            esac
510405b261ecSmrg
510505b261ecSmrg            cat >> $cwrappersource <<"EOF"
510605b261ecSmrg  return 127;
510705b261ecSmrg}
510805b261ecSmrg
510905b261ecSmrgvoid *
511005b261ecSmrgxmalloc (size_t num)
511105b261ecSmrg{
511205b261ecSmrg  void * p = (void *) malloc (num);
511305b261ecSmrg  if (!p)
511405b261ecSmrg    lt_fatal ("Memory exhausted");
511505b261ecSmrg
511605b261ecSmrg  return p;
511705b261ecSmrg}
511805b261ecSmrg
511905b261ecSmrgchar *
512005b261ecSmrgxstrdup (const char *string)
512105b261ecSmrg{
512205b261ecSmrg  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
512305b261ecSmrg;
512405b261ecSmrg}
512505b261ecSmrg
512605b261ecSmrgconst char *
512705b261ecSmrgbase_name (const char *name)
512805b261ecSmrg{
512905b261ecSmrg  const char *base;
513005b261ecSmrg
513105b261ecSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
513205b261ecSmrg  /* Skip over the disk name in MSDOS pathnames. */
513305b261ecSmrg  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
513405b261ecSmrg    name += 2;
513505b261ecSmrg#endif
513605b261ecSmrg
513705b261ecSmrg  for (base = name; *name; name++)
513805b261ecSmrg    if (IS_DIR_SEPARATOR (*name))
513905b261ecSmrg      base = name + 1;
514005b261ecSmrg  return base;
514105b261ecSmrg}
514205b261ecSmrg
514305b261ecSmrgint
514405b261ecSmrgcheck_executable(const char * path)
514505b261ecSmrg{
514605b261ecSmrg  struct stat st;
514705b261ecSmrg
514805b261ecSmrg  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
514905b261ecSmrg  if ((!path) || (!*path))
515005b261ecSmrg    return 0;
515105b261ecSmrg
515205b261ecSmrg  if ((stat (path, &st) >= 0) &&
515305b261ecSmrg      (
515405b261ecSmrg        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
515505b261ecSmrg#if defined (S_IXOTH)
515605b261ecSmrg       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
515705b261ecSmrg#endif
515805b261ecSmrg#if defined (S_IXGRP)
515905b261ecSmrg       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
516005b261ecSmrg#endif
516105b261ecSmrg       ((st.st_mode & S_IXUSR) == S_IXUSR))
516205b261ecSmrg      )
516305b261ecSmrg    return 1;
516405b261ecSmrg  else
516505b261ecSmrg    return 0;
516605b261ecSmrg}
516705b261ecSmrg
516805b261ecSmrg/* Searches for the full path of the wrapper.  Returns
516905b261ecSmrg   newly allocated full path name if found, NULL otherwise */
517005b261ecSmrgchar *
517105b261ecSmrgfind_executable (const char* wrapper)
517205b261ecSmrg{
517305b261ecSmrg  int has_slash = 0;
517405b261ecSmrg  const char* p;
517505b261ecSmrg  const char* p_next;
517605b261ecSmrg  /* static buffer for getcwd */
517705b261ecSmrg  char tmp[LT_PATHMAX + 1];
517805b261ecSmrg  int tmp_len;
517905b261ecSmrg  char* concat_name;
518005b261ecSmrg
518105b261ecSmrg  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
518205b261ecSmrg
518305b261ecSmrg  if ((wrapper == NULL) || (*wrapper == '\0'))
518405b261ecSmrg    return NULL;
518505b261ecSmrg
518605b261ecSmrg  /* Absolute path? */
518705b261ecSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
518805b261ecSmrg  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
518905b261ecSmrg  {
519005b261ecSmrg    concat_name = xstrdup (wrapper);
519105b261ecSmrg    if (check_executable(concat_name))
519205b261ecSmrg      return concat_name;
519305b261ecSmrg    XFREE(concat_name);
519405b261ecSmrg  }
519505b261ecSmrg  else
519605b261ecSmrg  {
519705b261ecSmrg#endif
519805b261ecSmrg    if (IS_DIR_SEPARATOR (wrapper[0]))
519905b261ecSmrg    {
520005b261ecSmrg      concat_name = xstrdup (wrapper);
520105b261ecSmrg      if (check_executable(concat_name))
520205b261ecSmrg        return concat_name;
520305b261ecSmrg      XFREE(concat_name);
520405b261ecSmrg    }
520505b261ecSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
520605b261ecSmrg  }
520705b261ecSmrg#endif
520805b261ecSmrg
520905b261ecSmrg  for (p = wrapper; *p; p++)
521005b261ecSmrg    if (*p == '/')
521105b261ecSmrg    {
521205b261ecSmrg      has_slash = 1;
521305b261ecSmrg      break;
521405b261ecSmrg    }
521505b261ecSmrg  if (!has_slash)
521605b261ecSmrg  {
521705b261ecSmrg    /* no slashes; search PATH */
521805b261ecSmrg    const char* path = getenv ("PATH");
521905b261ecSmrg    if (path != NULL)
522005b261ecSmrg    {
522105b261ecSmrg      for (p = path; *p; p = p_next)
522205b261ecSmrg      {
522305b261ecSmrg        const char* q;
522405b261ecSmrg        size_t p_len;
522505b261ecSmrg        for (q = p; *q; q++)
522605b261ecSmrg          if (IS_PATH_SEPARATOR(*q))
522705b261ecSmrg            break;
522805b261ecSmrg        p_len = q - p;
522905b261ecSmrg        p_next = (*q == '\0' ? q : q + 1);
523005b261ecSmrg        if (p_len == 0)
523105b261ecSmrg        {
523205b261ecSmrg          /* empty path: current directory */
523305b261ecSmrg          if (getcwd (tmp, LT_PATHMAX) == NULL)
523405b261ecSmrg            lt_fatal ("getcwd failed");
523505b261ecSmrg          tmp_len = strlen(tmp);
523605b261ecSmrg          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
523705b261ecSmrg          memcpy (concat_name, tmp, tmp_len);
523805b261ecSmrg          concat_name[tmp_len] = '/';
523905b261ecSmrg          strcpy (concat_name + tmp_len + 1, wrapper);
524005b261ecSmrg        }
524105b261ecSmrg        else
524205b261ecSmrg        {
524305b261ecSmrg          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
524405b261ecSmrg          memcpy (concat_name, p, p_len);
524505b261ecSmrg          concat_name[p_len] = '/';
524605b261ecSmrg          strcpy (concat_name + p_len + 1, wrapper);
524705b261ecSmrg        }
524805b261ecSmrg        if (check_executable(concat_name))
524905b261ecSmrg          return concat_name;
525005b261ecSmrg        XFREE(concat_name);
525105b261ecSmrg      }
525205b261ecSmrg    }
525305b261ecSmrg    /* not found in PATH; assume curdir */
525405b261ecSmrg  }
525505b261ecSmrg  /* Relative path | not found in path: prepend cwd */
525605b261ecSmrg  if (getcwd (tmp, LT_PATHMAX) == NULL)
525705b261ecSmrg    lt_fatal ("getcwd failed");
525805b261ecSmrg  tmp_len = strlen(tmp);
525905b261ecSmrg  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
526005b261ecSmrg  memcpy (concat_name, tmp, tmp_len);
526105b261ecSmrg  concat_name[tmp_len] = '/';
526205b261ecSmrg  strcpy (concat_name + tmp_len + 1, wrapper);
526305b261ecSmrg
526405b261ecSmrg  if (check_executable(concat_name))
526505b261ecSmrg    return concat_name;
526605b261ecSmrg  XFREE(concat_name);
526705b261ecSmrg  return NULL;
526805b261ecSmrg}
526905b261ecSmrg
527005b261ecSmrgchar *
527105b261ecSmrgstrendzap(char *str, const char *pat)
527205b261ecSmrg{
527305b261ecSmrg  size_t len, patlen;
527405b261ecSmrg
527505b261ecSmrg  assert(str != NULL);
527605b261ecSmrg  assert(pat != NULL);
527705b261ecSmrg
527805b261ecSmrg  len = strlen(str);
527905b261ecSmrg  patlen = strlen(pat);
528005b261ecSmrg
528105b261ecSmrg  if (patlen <= len)
528205b261ecSmrg  {
528305b261ecSmrg    str += len - patlen;
528405b261ecSmrg    if (strcmp(str, pat) == 0)
528505b261ecSmrg      *str = '\0';
528605b261ecSmrg  }
528705b261ecSmrg  return str;
528805b261ecSmrg}
528905b261ecSmrg
529005b261ecSmrgstatic void
529105b261ecSmrglt_error_core (int exit_status, const char * mode,
529205b261ecSmrg          const char * message, va_list ap)
529305b261ecSmrg{
529405b261ecSmrg  fprintf (stderr, "%s: %s: ", program_name, mode);
529505b261ecSmrg  vfprintf (stderr, message, ap);
529605b261ecSmrg  fprintf (stderr, ".\n");
529705b261ecSmrg
529805b261ecSmrg  if (exit_status >= 0)
529905b261ecSmrg    exit (exit_status);
530005b261ecSmrg}
530105b261ecSmrg
530205b261ecSmrgvoid
530305b261ecSmrglt_fatal (const char *message, ...)
530405b261ecSmrg{
530505b261ecSmrg  va_list ap;
530605b261ecSmrg  va_start (ap, message);
530705b261ecSmrg  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
530805b261ecSmrg  va_end (ap);
530905b261ecSmrg}
531005b261ecSmrgEOF
531105b261ecSmrg          # we should really use a build-platform specific compiler
531205b261ecSmrg          # here, but OTOH, the wrappers (shell script and this C one)
531305b261ecSmrg          # are only useful if you want to execute the "real" binary.
531405b261ecSmrg          # Since the "real" binary is built for $host, then this
531505b261ecSmrg          # wrapper might as well be built for $host, too.
531605b261ecSmrg          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
531705b261ecSmrg          ;;
531805b261ecSmrg        esac
531905b261ecSmrg        $rm $output
532005b261ecSmrg        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
532105b261ecSmrg
532205b261ecSmrg	$echo > $output "\
532305b261ecSmrg#! $SHELL
532405b261ecSmrg
532505b261ecSmrg# $output - temporary wrapper script for $objdir/$outputname
532605b261ecSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
532705b261ecSmrg#
532805b261ecSmrg# The $output program cannot be directly executed until all the libtool
532905b261ecSmrg# libraries that it depends on are installed.
533005b261ecSmrg#
533105b261ecSmrg# This wrapper script should never be moved out of the build directory.
533205b261ecSmrg# If it is, it will not operate correctly.
533305b261ecSmrg
533405b261ecSmrg# Sed substitution that helps us do robust quoting.  It backslashifies
533505b261ecSmrg# metacharacters that are still active within double-quoted strings.
533605b261ecSmrgXsed='${SED} -e 1s/^X//'
533705b261ecSmrgsed_quote_subst='$sed_quote_subst'
533805b261ecSmrg
533905b261ecSmrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
534005b261ecSmrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
534105b261ecSmrg  emulate sh
534205b261ecSmrg  NULLCMD=:
534305b261ecSmrg  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
534405b261ecSmrg  # is contrary to our usage.  Disable this feature.
534505b261ecSmrg  alias -g '\${1+\"\$@\"}'='\"\$@\"'
534605b261ecSmrg  setopt NO_GLOB_SUBST
534705b261ecSmrgelse
534805b261ecSmrg  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
534905b261ecSmrgfi
535005b261ecSmrgBIN_SH=xpg4; export BIN_SH # for Tru64
535105b261ecSmrgDUALCASE=1; export DUALCASE # for MKS sh
535205b261ecSmrg
535305b261ecSmrg# The HP-UX ksh and POSIX shell print the target directory to stdout
535405b261ecSmrg# if CDPATH is set.
535505b261ecSmrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
535605b261ecSmrg
535705b261ecSmrgrelink_command=\"$relink_command\"
535805b261ecSmrg
535905b261ecSmrg# This environment variable determines our operation mode.
536005b261ecSmrgif test \"\$libtool_install_magic\" = \"$magic\"; then
536105b261ecSmrg  # install mode needs the following variable:
536205b261ecSmrg  notinst_deplibs='$notinst_deplibs'
536305b261ecSmrgelse
536405b261ecSmrg  # When we are sourced in execute mode, \$file and \$echo are already set.
536505b261ecSmrg  if test \"\$libtool_execute_magic\" != \"$magic\"; then
536605b261ecSmrg    echo=\"$qecho\"
536705b261ecSmrg    file=\"\$0\"
536805b261ecSmrg    # Make sure echo works.
536905b261ecSmrg    if test \"X\$1\" = X--no-reexec; then
537005b261ecSmrg      # Discard the --no-reexec flag, and continue.
537105b261ecSmrg      shift
537205b261ecSmrg    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
537305b261ecSmrg      # Yippee, \$echo works!
537405b261ecSmrg      :
537505b261ecSmrg    else
537605b261ecSmrg      # Restart under the correct shell, and then maybe \$echo will work.
537705b261ecSmrg      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
537805b261ecSmrg    fi
537905b261ecSmrg  fi\
538005b261ecSmrg"
538105b261ecSmrg	$echo >> $output "\
538205b261ecSmrg
538305b261ecSmrg  # Find the directory that this script lives in.
538405b261ecSmrg  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
538505b261ecSmrg  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
538605b261ecSmrg
538705b261ecSmrg  # Follow symbolic links until we get to the real thisdir.
538805b261ecSmrg  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
538905b261ecSmrg  while test -n \"\$file\"; do
539005b261ecSmrg    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
539105b261ecSmrg
539205b261ecSmrg    # If there was a directory component, then change thisdir.
539305b261ecSmrg    if test \"x\$destdir\" != \"x\$file\"; then
539405b261ecSmrg      case \"\$destdir\" in
539505b261ecSmrg      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
539605b261ecSmrg      *) thisdir=\"\$thisdir/\$destdir\" ;;
539705b261ecSmrg      esac
539805b261ecSmrg    fi
539905b261ecSmrg
540005b261ecSmrg    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
540105b261ecSmrg    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
540205b261ecSmrg  done
540305b261ecSmrg
540405b261ecSmrg  # Try to get the absolute directory name.
540505b261ecSmrg  absdir=\`cd \"\$thisdir\" && pwd\`
540605b261ecSmrg  test -n \"\$absdir\" && thisdir=\"\$absdir\"
540705b261ecSmrg"
540805b261ecSmrg
540905b261ecSmrg	if test "$fast_install" = yes; then
541005b261ecSmrg	  $echo >> $output "\
541105b261ecSmrg  program=lt-'$outputname'$exeext
541205b261ecSmrg  progdir=\"\$thisdir/$objdir\"
541305b261ecSmrg
541405b261ecSmrg  if test ! -f \"\$progdir/\$program\" || \\
541505b261ecSmrg     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
541605b261ecSmrg       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
541705b261ecSmrg
541805b261ecSmrg    file=\"\$\$-\$program\"
541905b261ecSmrg
542005b261ecSmrg    if test ! -d \"\$progdir\"; then
542105b261ecSmrg      $mkdir \"\$progdir\"
542205b261ecSmrg    else
542305b261ecSmrg      $rm \"\$progdir/\$file\"
542405b261ecSmrg    fi"
542505b261ecSmrg
542605b261ecSmrg	  $echo >> $output "\
542705b261ecSmrg
542805b261ecSmrg    # relink executable if necessary
542905b261ecSmrg    if test -n \"\$relink_command\"; then
543005b261ecSmrg      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
543105b261ecSmrg      else
543205b261ecSmrg	$echo \"\$relink_command_output\" >&2
543305b261ecSmrg	$rm \"\$progdir/\$file\"
543405b261ecSmrg	exit $EXIT_FAILURE
543505b261ecSmrg      fi
543605b261ecSmrg    fi
543705b261ecSmrg
543805b261ecSmrg    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
543905b261ecSmrg    { $rm \"\$progdir/\$program\";
544005b261ecSmrg      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
544105b261ecSmrg    $rm \"\$progdir/\$file\"
544205b261ecSmrg  fi"
544305b261ecSmrg	else
544405b261ecSmrg	  $echo >> $output "\
544505b261ecSmrg  program='$outputname'
544605b261ecSmrg  progdir=\"\$thisdir/$objdir\"
544705b261ecSmrg"
544805b261ecSmrg	fi
544905b261ecSmrg
545005b261ecSmrg	$echo >> $output "\
545105b261ecSmrg
545205b261ecSmrg  if test -f \"\$progdir/\$program\"; then"
545305b261ecSmrg
545405b261ecSmrg	# Export our shlibpath_var if we have one.
545505b261ecSmrg	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
545605b261ecSmrg	  $echo >> $output "\
545705b261ecSmrg    # Add our own library path to $shlibpath_var
545805b261ecSmrg    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
545905b261ecSmrg
546005b261ecSmrg    # Some systems cannot cope with colon-terminated $shlibpath_var
546105b261ecSmrg    # The second colon is a workaround for a bug in BeOS R4 sed
546205b261ecSmrg    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
546305b261ecSmrg
546405b261ecSmrg    export $shlibpath_var
546505b261ecSmrg"
546605b261ecSmrg	fi
546705b261ecSmrg
546805b261ecSmrg	# fixup the dll searchpath if we need to.
546905b261ecSmrg	if test -n "$dllsearchpath"; then
547005b261ecSmrg	  $echo >> $output "\
547105b261ecSmrg    # Add the dll search path components to the executable PATH
547205b261ecSmrg    PATH=$dllsearchpath:\$PATH
547305b261ecSmrg"
547405b261ecSmrg	fi
547505b261ecSmrg
547605b261ecSmrg	$echo >> $output "\
547705b261ecSmrg    if test \"\$libtool_execute_magic\" != \"$magic\"; then
547805b261ecSmrg      # Run the actual program with our arguments.
547905b261ecSmrg"
548005b261ecSmrg	case $host in
548105b261ecSmrg	# Backslashes separate directories on plain windows
548205b261ecSmrg	*-*-mingw | *-*-os2*)
548305b261ecSmrg	  $echo >> $output "\
548405b261ecSmrg      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
548505b261ecSmrg"
548605b261ecSmrg	  ;;
548705b261ecSmrg
548805b261ecSmrg	*)
548905b261ecSmrg	  $echo >> $output "\
549005b261ecSmrg      exec \"\$progdir/\$program\" \${1+\"\$@\"}
549105b261ecSmrg"
549205b261ecSmrg	  ;;
549305b261ecSmrg	esac
549405b261ecSmrg	$echo >> $output "\
549505b261ecSmrg      \$echo \"\$0: cannot exec \$program \$*\"
549605b261ecSmrg      exit $EXIT_FAILURE
549705b261ecSmrg    fi
549805b261ecSmrg  else
549905b261ecSmrg    # The program doesn't exist.
550005b261ecSmrg    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
550105b261ecSmrg    \$echo \"This script is just a wrapper for \$program.\" 1>&2
550205b261ecSmrg    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
550305b261ecSmrg    exit $EXIT_FAILURE
550405b261ecSmrg  fi
550505b261ecSmrgfi\
550605b261ecSmrg"
550705b261ecSmrg	chmod +x $output
550805b261ecSmrg      fi
550905b261ecSmrg      exit $EXIT_SUCCESS
551005b261ecSmrg      ;;
551105b261ecSmrg    esac
551205b261ecSmrg
551305b261ecSmrg    # See if we need to build an old-fashioned archive.
551405b261ecSmrg    for oldlib in $oldlibs; do
551505b261ecSmrg
551605b261ecSmrg      if test "$build_libtool_libs" = convenience; then
551705b261ecSmrg	oldobjs="$libobjs_save"
551805b261ecSmrg	addlibs="$convenience"
551905b261ecSmrg	build_libtool_libs=no
552005b261ecSmrg      else
552105b261ecSmrg	if test "$build_libtool_libs" = module; then
552205b261ecSmrg	  oldobjs="$libobjs_save"
552305b261ecSmrg	  build_libtool_libs=no
552405b261ecSmrg	else
552505b261ecSmrg	  oldobjs="$old_deplibs $non_pic_objects"
552605b261ecSmrg	fi
552705b261ecSmrg	addlibs="$old_convenience"
552805b261ecSmrg      fi
552905b261ecSmrg
553005b261ecSmrg      if test -n "$addlibs"; then
553105b261ecSmrg	gentop="$output_objdir/${outputname}x"
553205b261ecSmrg	generated="$generated $gentop"
553305b261ecSmrg
553405b261ecSmrg	func_extract_archives $gentop $addlibs
553505b261ecSmrg	oldobjs="$oldobjs $func_extract_archives_result"
553605b261ecSmrg      fi
553705b261ecSmrg
553805b261ecSmrg      # Do each command in the archive commands.
553905b261ecSmrg      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
554005b261ecSmrg       cmds=$old_archive_from_new_cmds
554105b261ecSmrg      else
554205b261ecSmrg	# POSIX demands no paths to be encoded in archives.  We have
554305b261ecSmrg	# to avoid creating archives with duplicate basenames if we
554405b261ecSmrg	# might have to extract them afterwards, e.g., when creating a
554505b261ecSmrg	# static archive out of a convenience library, or when linking
554605b261ecSmrg	# the entirety of a libtool archive into another (currently
554705b261ecSmrg	# not supported by libtool).
554805b261ecSmrg	if (for obj in $oldobjs
554905b261ecSmrg	    do
555005b261ecSmrg	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
555105b261ecSmrg	    done | sort | sort -uc >/dev/null 2>&1); then
555205b261ecSmrg	  :
555305b261ecSmrg	else
555405b261ecSmrg	  $echo "copying selected object files to avoid basename conflicts..."
555505b261ecSmrg
555605b261ecSmrg	  if test -z "$gentop"; then
555705b261ecSmrg	    gentop="$output_objdir/${outputname}x"
555805b261ecSmrg	    generated="$generated $gentop"
555905b261ecSmrg
556005b261ecSmrg	    $show "${rm}r $gentop"
556105b261ecSmrg	    $run ${rm}r "$gentop"
556205b261ecSmrg	    $show "$mkdir $gentop"
556305b261ecSmrg	    $run $mkdir "$gentop"
556405b261ecSmrg	    exit_status=$?
556505b261ecSmrg	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
556605b261ecSmrg	      exit $exit_status
556705b261ecSmrg	    fi
556805b261ecSmrg	  fi
556905b261ecSmrg
557005b261ecSmrg	  save_oldobjs=$oldobjs
557105b261ecSmrg	  oldobjs=
557205b261ecSmrg	  counter=1
557305b261ecSmrg	  for obj in $save_oldobjs
557405b261ecSmrg	  do
557505b261ecSmrg	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
557605b261ecSmrg	    case " $oldobjs " in
557705b261ecSmrg	    " ") oldobjs=$obj ;;
557805b261ecSmrg	    *[\ /]"$objbase "*)
557905b261ecSmrg	      while :; do
558005b261ecSmrg		# Make sure we don't pick an alternate name that also
558105b261ecSmrg		# overlaps.
558205b261ecSmrg		newobj=lt$counter-$objbase
558305b261ecSmrg		counter=`expr $counter + 1`
558405b261ecSmrg		case " $oldobjs " in
558505b261ecSmrg		*[\ /]"$newobj "*) ;;
558605b261ecSmrg		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
558705b261ecSmrg		esac
558805b261ecSmrg	      done
558905b261ecSmrg	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
559005b261ecSmrg	      $run ln "$obj" "$gentop/$newobj" ||
559105b261ecSmrg	      $run cp "$obj" "$gentop/$newobj"
559205b261ecSmrg	      oldobjs="$oldobjs $gentop/$newobj"
559305b261ecSmrg	      ;;
559405b261ecSmrg	    *) oldobjs="$oldobjs $obj" ;;
559505b261ecSmrg	    esac
559605b261ecSmrg	  done
559705b261ecSmrg	fi
559805b261ecSmrg
559905b261ecSmrg	eval cmds=\"$old_archive_cmds\"
560005b261ecSmrg
560105b261ecSmrg	if len=`expr "X$cmds" : ".*"` &&
560205b261ecSmrg	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
560305b261ecSmrg	  cmds=$old_archive_cmds
560405b261ecSmrg	else
560505b261ecSmrg	  # the command line is too long to link in one step, link in parts
560605b261ecSmrg	  $echo "using piecewise archive linking..."
560705b261ecSmrg	  save_RANLIB=$RANLIB
560805b261ecSmrg	  RANLIB=:
560905b261ecSmrg	  objlist=
561005b261ecSmrg	  concat_cmds=
561105b261ecSmrg	  save_oldobjs=$oldobjs
561205b261ecSmrg
561305b261ecSmrg	  # Is there a better way of finding the last object in the list?
561405b261ecSmrg	  for obj in $save_oldobjs
561505b261ecSmrg	  do
561605b261ecSmrg	    last_oldobj=$obj
561705b261ecSmrg	  done
561805b261ecSmrg	  for obj in $save_oldobjs
561905b261ecSmrg	  do
562005b261ecSmrg	    oldobjs="$objlist $obj"
562105b261ecSmrg	    objlist="$objlist $obj"
562205b261ecSmrg	    eval test_cmds=\"$old_archive_cmds\"
562305b261ecSmrg	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
562405b261ecSmrg	       test "$len" -le "$max_cmd_len"; then
562505b261ecSmrg	      :
562605b261ecSmrg	    else
562705b261ecSmrg	      # the above command should be used before it gets too long
562805b261ecSmrg	      oldobjs=$objlist
562905b261ecSmrg	      if test "$obj" = "$last_oldobj" ; then
563005b261ecSmrg	        RANLIB=$save_RANLIB
563105b261ecSmrg	      fi
563205b261ecSmrg	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
563305b261ecSmrg	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
563405b261ecSmrg	      objlist=
563505b261ecSmrg	    fi
563605b261ecSmrg	  done
563705b261ecSmrg	  RANLIB=$save_RANLIB
563805b261ecSmrg	  oldobjs=$objlist
563905b261ecSmrg	  if test "X$oldobjs" = "X" ; then
564005b261ecSmrg	    eval cmds=\"\$concat_cmds\"
564105b261ecSmrg	  else
564205b261ecSmrg	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
564305b261ecSmrg	  fi
564405b261ecSmrg	fi
564505b261ecSmrg      fi
564605b261ecSmrg      save_ifs="$IFS"; IFS='~'
564705b261ecSmrg      for cmd in $cmds; do
564805b261ecSmrg        eval cmd=\"$cmd\"
564905b261ecSmrg	IFS="$save_ifs"
565005b261ecSmrg	$show "$cmd"
565105b261ecSmrg	$run eval "$cmd" || exit $?
565205b261ecSmrg      done
565305b261ecSmrg      IFS="$save_ifs"
565405b261ecSmrg    done
565505b261ecSmrg
565605b261ecSmrg    if test -n "$generated"; then
565705b261ecSmrg      $show "${rm}r$generated"
565805b261ecSmrg      $run ${rm}r$generated
565905b261ecSmrg    fi
566005b261ecSmrg
566105b261ecSmrg    # Now create the libtool archive.
566205b261ecSmrg    case $output in
566305b261ecSmrg    *.la)
566405b261ecSmrg      old_library=
566505b261ecSmrg      test "$build_old_libs" = yes && old_library="$libname.$libext"
566605b261ecSmrg      $show "creating $output"
566705b261ecSmrg
566805b261ecSmrg      # Preserve any variables that may affect compiler behavior
566905b261ecSmrg      for var in $variables_saved_for_relink; do
567005b261ecSmrg	if eval test -z \"\${$var+set}\"; then
567105b261ecSmrg	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
567205b261ecSmrg	elif eval var_value=\$$var; test -z "$var_value"; then
567305b261ecSmrg	  relink_command="$var=; export $var; $relink_command"
567405b261ecSmrg	else
567505b261ecSmrg	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
567605b261ecSmrg	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
567705b261ecSmrg	fi
567805b261ecSmrg      done
567905b261ecSmrg      # Quote the link command for shipping.
568005b261ecSmrg      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
568105b261ecSmrg      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
568205b261ecSmrg      if test "$hardcode_automatic" = yes ; then
568305b261ecSmrg	relink_command=
568405b261ecSmrg      fi
568505b261ecSmrg
568605b261ecSmrg
568705b261ecSmrg      # Only create the output if not a dry run.
568805b261ecSmrg      if test -z "$run"; then
568905b261ecSmrg	for installed in no yes; do
569005b261ecSmrg	  if test "$installed" = yes; then
569105b261ecSmrg	    if test -z "$install_libdir"; then
569205b261ecSmrg	      break
569305b261ecSmrg	    fi
569405b261ecSmrg	    output="$output_objdir/$outputname"i
569505b261ecSmrg	    # Replace all uninstalled libtool libraries with the installed ones
569605b261ecSmrg	    newdependency_libs=
569705b261ecSmrg	    for deplib in $dependency_libs; do
569805b261ecSmrg	      case $deplib in
569905b261ecSmrg	      *.la)
570005b261ecSmrg		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
570105b261ecSmrg		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
570205b261ecSmrg		if test -z "$libdir"; then
570305b261ecSmrg		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
570405b261ecSmrg		  exit $EXIT_FAILURE
570505b261ecSmrg		fi
570605b261ecSmrg		newdependency_libs="$newdependency_libs $libdir/$name"
570705b261ecSmrg		;;
570805b261ecSmrg	      *) newdependency_libs="$newdependency_libs $deplib" ;;
570905b261ecSmrg	      esac
571005b261ecSmrg	    done
571105b261ecSmrg	    dependency_libs="$newdependency_libs"
571205b261ecSmrg	    newdlfiles=
571305b261ecSmrg	    for lib in $dlfiles; do
571405b261ecSmrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
571505b261ecSmrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
571605b261ecSmrg	      if test -z "$libdir"; then
571705b261ecSmrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
571805b261ecSmrg		exit $EXIT_FAILURE
571905b261ecSmrg	      fi
572005b261ecSmrg	      newdlfiles="$newdlfiles $libdir/$name"
572105b261ecSmrg	    done
572205b261ecSmrg	    dlfiles="$newdlfiles"
572305b261ecSmrg	    newdlprefiles=
572405b261ecSmrg	    for lib in $dlprefiles; do
572505b261ecSmrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
572605b261ecSmrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
572705b261ecSmrg	      if test -z "$libdir"; then
572805b261ecSmrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
572905b261ecSmrg		exit $EXIT_FAILURE
573005b261ecSmrg	      fi
573105b261ecSmrg	      newdlprefiles="$newdlprefiles $libdir/$name"
573205b261ecSmrg	    done
573305b261ecSmrg	    dlprefiles="$newdlprefiles"
573405b261ecSmrg	  else
573505b261ecSmrg	    newdlfiles=
573605b261ecSmrg	    for lib in $dlfiles; do
573705b261ecSmrg	      case $lib in
573805b261ecSmrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
573905b261ecSmrg		*) abs=`pwd`"/$lib" ;;
574005b261ecSmrg	      esac
574105b261ecSmrg	      newdlfiles="$newdlfiles $abs"
574205b261ecSmrg	    done
574305b261ecSmrg	    dlfiles="$newdlfiles"
574405b261ecSmrg	    newdlprefiles=
574505b261ecSmrg	    for lib in $dlprefiles; do
574605b261ecSmrg	      case $lib in
574705b261ecSmrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
574805b261ecSmrg		*) abs=`pwd`"/$lib" ;;
574905b261ecSmrg	      esac
575005b261ecSmrg	      newdlprefiles="$newdlprefiles $abs"
575105b261ecSmrg	    done
575205b261ecSmrg	    dlprefiles="$newdlprefiles"
575305b261ecSmrg	  fi
575405b261ecSmrg	  $rm $output
575505b261ecSmrg	  # place dlname in correct position for cygwin
575605b261ecSmrg	  tdlname=$dlname
575705b261ecSmrg	  case $host,$output,$installed,$module,$dlname in
575805b261ecSmrg	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
575905b261ecSmrg	  esac
576005b261ecSmrg	  $echo > $output "\
576105b261ecSmrg# $outputname - a libtool library file
576205b261ecSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
576305b261ecSmrg#
576405b261ecSmrg# Please DO NOT delete this file!
576505b261ecSmrg# It is necessary for linking the library.
576605b261ecSmrg
576705b261ecSmrg# The name that we can dlopen(3).
576805b261ecSmrgdlname='$tdlname'
576905b261ecSmrg
577005b261ecSmrg# Names of this library.
577105b261ecSmrglibrary_names='$library_names'
577205b261ecSmrg
577305b261ecSmrg# The name of the static archive.
577405b261ecSmrgold_library='$old_library'
577505b261ecSmrg
577605b261ecSmrg# Libraries that this one depends upon.
577705b261ecSmrgdependency_libs='$dependency_libs'
577805b261ecSmrg
577905b261ecSmrg# Version information for $libname.
578005b261ecSmrgcurrent=$current
578105b261ecSmrgage=$age
578205b261ecSmrgrevision=$revision
578305b261ecSmrg
578405b261ecSmrg# Is this an already installed library?
578505b261ecSmrginstalled=$installed
578605b261ecSmrg
578705b261ecSmrg# Should we warn about portability when linking against -modules?
578805b261ecSmrgshouldnotlink=$module
578905b261ecSmrg
579005b261ecSmrg# Files to dlopen/dlpreopen
579105b261ecSmrgdlopen='$dlfiles'
579205b261ecSmrgdlpreopen='$dlprefiles'
579305b261ecSmrg
579405b261ecSmrg# Directory that this library needs to be installed in:
579505b261ecSmrglibdir='$install_libdir'"
579605b261ecSmrg	  if test "$installed" = no && test "$need_relink" = yes; then
579705b261ecSmrg	    $echo >> $output "\
579805b261ecSmrgrelink_command=\"$relink_command\""
579905b261ecSmrg	  fi
580005b261ecSmrg	done
580105b261ecSmrg      fi
580205b261ecSmrg
580305b261ecSmrg      # Do a symbolic link so that the libtool archive can be found in
580405b261ecSmrg      # LD_LIBRARY_PATH before the program is installed.
580505b261ecSmrg      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
580605b261ecSmrg      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
580705b261ecSmrg      ;;
580805b261ecSmrg    esac
580905b261ecSmrg    exit $EXIT_SUCCESS
581005b261ecSmrg    ;;
581105b261ecSmrg
581205b261ecSmrg  # libtool install mode
581305b261ecSmrg  install)
581405b261ecSmrg    modename="$modename: install"
581505b261ecSmrg
581605b261ecSmrg    # There may be an optional sh(1) argument at the beginning of
581705b261ecSmrg    # install_prog (especially on Windows NT).
581805b261ecSmrg    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
581905b261ecSmrg       # Allow the use of GNU shtool's install command.
582005b261ecSmrg       $echo "X$nonopt" | grep shtool > /dev/null; then
582105b261ecSmrg      # Aesthetically quote it.
582205b261ecSmrg      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
582305b261ecSmrg      case $arg in
582405b261ecSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
582505b261ecSmrg	arg="\"$arg\""
582605b261ecSmrg	;;
582705b261ecSmrg      esac
582805b261ecSmrg      install_prog="$arg "
582905b261ecSmrg      arg="$1"
583005b261ecSmrg      shift
583105b261ecSmrg    else
583205b261ecSmrg      install_prog=
583305b261ecSmrg      arg=$nonopt
583405b261ecSmrg    fi
583505b261ecSmrg
583605b261ecSmrg    # The real first argument should be the name of the installation program.
583705b261ecSmrg    # Aesthetically quote it.
583805b261ecSmrg    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
583905b261ecSmrg    case $arg in
584005b261ecSmrg    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
584105b261ecSmrg      arg="\"$arg\""
584205b261ecSmrg      ;;
584305b261ecSmrg    esac
584405b261ecSmrg    install_prog="$install_prog$arg"
584505b261ecSmrg
584605b261ecSmrg    # We need to accept at least all the BSD install flags.
584705b261ecSmrg    dest=
584805b261ecSmrg    files=
584905b261ecSmrg    opts=
585005b261ecSmrg    prev=
585105b261ecSmrg    install_type=
585205b261ecSmrg    isdir=no
585305b261ecSmrg    stripme=
585405b261ecSmrg    for arg
585505b261ecSmrg    do
585605b261ecSmrg      if test -n "$dest"; then
585705b261ecSmrg	files="$files $dest"
585805b261ecSmrg	dest=$arg
585905b261ecSmrg	continue
586005b261ecSmrg      fi
586105b261ecSmrg
586205b261ecSmrg      case $arg in
586305b261ecSmrg      -d) isdir=yes ;;
586405b261ecSmrg      -f) 
586505b261ecSmrg      	case " $install_prog " in
586605b261ecSmrg	*[\\\ /]cp\ *) ;;
586705b261ecSmrg	*) prev=$arg ;;
586805b261ecSmrg	esac
586905b261ecSmrg	;;
587005b261ecSmrg      -g | -m | -o) prev=$arg ;;
587105b261ecSmrg      -s)
587205b261ecSmrg	stripme=" -s"
587305b261ecSmrg	continue
587405b261ecSmrg	;;
587505b261ecSmrg      -*)
587605b261ecSmrg	;;
587705b261ecSmrg      *)
587805b261ecSmrg	# If the previous option needed an argument, then skip it.
587905b261ecSmrg	if test -n "$prev"; then
588005b261ecSmrg	  prev=
588105b261ecSmrg	else
588205b261ecSmrg	  dest=$arg
588305b261ecSmrg	  continue
588405b261ecSmrg	fi
588505b261ecSmrg	;;
588605b261ecSmrg      esac
588705b261ecSmrg
588805b261ecSmrg      # Aesthetically quote the argument.
588905b261ecSmrg      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
589005b261ecSmrg      case $arg in
589105b261ecSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
589205b261ecSmrg	arg="\"$arg\""
589305b261ecSmrg	;;
589405b261ecSmrg      esac
589505b261ecSmrg      install_prog="$install_prog $arg"
589605b261ecSmrg    done
589705b261ecSmrg
589805b261ecSmrg    if test -z "$install_prog"; then
589905b261ecSmrg      $echo "$modename: you must specify an install program" 1>&2
590005b261ecSmrg      $echo "$help" 1>&2
590105b261ecSmrg      exit $EXIT_FAILURE
590205b261ecSmrg    fi
590305b261ecSmrg
590405b261ecSmrg    if test -n "$prev"; then
590505b261ecSmrg      $echo "$modename: the \`$prev' option requires an argument" 1>&2
590605b261ecSmrg      $echo "$help" 1>&2
590705b261ecSmrg      exit $EXIT_FAILURE
590805b261ecSmrg    fi
590905b261ecSmrg
591005b261ecSmrg    if test -z "$files"; then
591105b261ecSmrg      if test -z "$dest"; then
591205b261ecSmrg	$echo "$modename: no file or destination specified" 1>&2
591305b261ecSmrg      else
591405b261ecSmrg	$echo "$modename: you must specify a destination" 1>&2
591505b261ecSmrg      fi
591605b261ecSmrg      $echo "$help" 1>&2
591705b261ecSmrg      exit $EXIT_FAILURE
591805b261ecSmrg    fi
591905b261ecSmrg
592005b261ecSmrg    # Strip any trailing slash from the destination.
592105b261ecSmrg    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
592205b261ecSmrg
592305b261ecSmrg    # Check to see that the destination is a directory.
592405b261ecSmrg    test -d "$dest" && isdir=yes
592505b261ecSmrg    if test "$isdir" = yes; then
592605b261ecSmrg      destdir="$dest"
592705b261ecSmrg      destname=
592805b261ecSmrg    else
592905b261ecSmrg      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
593005b261ecSmrg      test "X$destdir" = "X$dest" && destdir=.
593105b261ecSmrg      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
593205b261ecSmrg
593305b261ecSmrg      # Not a directory, so check to see that there is only one file specified.
593405b261ecSmrg      set dummy $files
593505b261ecSmrg      if test "$#" -gt 2; then
593605b261ecSmrg	$echo "$modename: \`$dest' is not a directory" 1>&2
593705b261ecSmrg	$echo "$help" 1>&2
593805b261ecSmrg	exit $EXIT_FAILURE
593905b261ecSmrg      fi
594005b261ecSmrg    fi
594105b261ecSmrg    case $destdir in
594205b261ecSmrg    [\\/]* | [A-Za-z]:[\\/]*) ;;
594305b261ecSmrg    *)
594405b261ecSmrg      for file in $files; do
594505b261ecSmrg	case $file in
594605b261ecSmrg	*.lo) ;;
594705b261ecSmrg	*)
594805b261ecSmrg	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
594905b261ecSmrg	  $echo "$help" 1>&2
595005b261ecSmrg	  exit $EXIT_FAILURE
595105b261ecSmrg	  ;;
595205b261ecSmrg	esac
595305b261ecSmrg      done
595405b261ecSmrg      ;;
595505b261ecSmrg    esac
595605b261ecSmrg
595705b261ecSmrg    # This variable tells wrapper scripts just to set variables rather
595805b261ecSmrg    # than running their programs.
595905b261ecSmrg    libtool_install_magic="$magic"
596005b261ecSmrg
596105b261ecSmrg    staticlibs=
596205b261ecSmrg    future_libdirs=
596305b261ecSmrg    current_libdirs=
596405b261ecSmrg    for file in $files; do
596505b261ecSmrg
596605b261ecSmrg      # Do each installation.
596705b261ecSmrg      case $file in
596805b261ecSmrg      *.$libext)
596905b261ecSmrg	# Do the static libraries later.
597005b261ecSmrg	staticlibs="$staticlibs $file"
597105b261ecSmrg	;;
597205b261ecSmrg
597305b261ecSmrg      *.la)
597405b261ecSmrg	# Check to see that this really is a libtool archive.
597505b261ecSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
597605b261ecSmrg	else
597705b261ecSmrg	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
597805b261ecSmrg	  $echo "$help" 1>&2
597905b261ecSmrg	  exit $EXIT_FAILURE
598005b261ecSmrg	fi
598105b261ecSmrg
598205b261ecSmrg	library_names=
598305b261ecSmrg	old_library=
598405b261ecSmrg	relink_command=
598505b261ecSmrg	# If there is no directory component, then add one.
598605b261ecSmrg	case $file in
598705b261ecSmrg	*/* | *\\*) . $file ;;
598805b261ecSmrg	*) . ./$file ;;
598905b261ecSmrg	esac
599005b261ecSmrg
599105b261ecSmrg	# Add the libdir to current_libdirs if it is the destination.
599205b261ecSmrg	if test "X$destdir" = "X$libdir"; then
599305b261ecSmrg	  case "$current_libdirs " in
599405b261ecSmrg	  *" $libdir "*) ;;
599505b261ecSmrg	  *) current_libdirs="$current_libdirs $libdir" ;;
599605b261ecSmrg	  esac
599705b261ecSmrg	else
599805b261ecSmrg	  # Note the libdir as a future libdir.
599905b261ecSmrg	  case "$future_libdirs " in
600005b261ecSmrg	  *" $libdir "*) ;;
600105b261ecSmrg	  *) future_libdirs="$future_libdirs $libdir" ;;
600205b261ecSmrg	  esac
600305b261ecSmrg	fi
600405b261ecSmrg
600505b261ecSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
600605b261ecSmrg	test "X$dir" = "X$file/" && dir=
600705b261ecSmrg	dir="$dir$objdir"
600805b261ecSmrg
600905b261ecSmrg	if test -n "$relink_command"; then
601005b261ecSmrg	  # Determine the prefix the user has applied to our future dir.
601105b261ecSmrg	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
601205b261ecSmrg
601305b261ecSmrg	  # Don't allow the user to place us outside of our expected
601405b261ecSmrg	  # location b/c this prevents finding dependent libraries that
601505b261ecSmrg	  # are installed to the same prefix.
601605b261ecSmrg	  # At present, this check doesn't affect windows .dll's that
601705b261ecSmrg	  # are installed into $libdir/../bin (currently, that works fine)
601805b261ecSmrg	  # but it's something to keep an eye on.
601905b261ecSmrg	  if test "$inst_prefix_dir" = "$destdir"; then
602005b261ecSmrg	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
602105b261ecSmrg	    exit $EXIT_FAILURE
602205b261ecSmrg	  fi
602305b261ecSmrg
602405b261ecSmrg	  if test -n "$inst_prefix_dir"; then
602505b261ecSmrg	    # Stick the inst_prefix_dir data into the link command.
602605b261ecSmrg	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
602705b261ecSmrg	  else
602805b261ecSmrg	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
602905b261ecSmrg	  fi
603005b261ecSmrg
603105b261ecSmrg	  $echo "$modename: warning: relinking \`$file'" 1>&2
603205b261ecSmrg	  $show "$relink_command"
603305b261ecSmrg	  if $run eval "$relink_command"; then :
603405b261ecSmrg	  else
603505b261ecSmrg	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
603605b261ecSmrg	    exit $EXIT_FAILURE
603705b261ecSmrg	  fi
603805b261ecSmrg	fi
603905b261ecSmrg
604005b261ecSmrg	# See the names of the shared library.
604105b261ecSmrg	set dummy $library_names
604205b261ecSmrg	if test -n "$2"; then
604305b261ecSmrg	  realname="$2"
604405b261ecSmrg	  shift
604505b261ecSmrg	  shift
604605b261ecSmrg
604705b261ecSmrg	  srcname="$realname"
604805b261ecSmrg	  test -n "$relink_command" && srcname="$realname"T
604905b261ecSmrg
605005b261ecSmrg	  # Install the shared library and build the symlinks.
605105b261ecSmrg	  $show "$install_prog $dir/$srcname $destdir/$realname"
605205b261ecSmrg	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
605305b261ecSmrg	  if test -n "$stripme" && test -n "$striplib"; then
605405b261ecSmrg	    $show "$striplib $destdir/$realname"
605505b261ecSmrg	    $run eval "$striplib $destdir/$realname" || exit $?
605605b261ecSmrg	  fi
605705b261ecSmrg
605805b261ecSmrg	  if test "$#" -gt 0; then
605905b261ecSmrg	    # Delete the old symlinks, and create new ones.
606005b261ecSmrg	    # Try `ln -sf' first, because the `ln' binary might depend on
606105b261ecSmrg	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
606205b261ecSmrg	    # so we also need to try rm && ln -s.
606305b261ecSmrg	    for linkname
606405b261ecSmrg	    do
606505b261ecSmrg	      if test "$linkname" != "$realname"; then
606605b261ecSmrg                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
606705b261ecSmrg                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
606805b261ecSmrg	      fi
606905b261ecSmrg	    done
607005b261ecSmrg	  fi
607105b261ecSmrg
607205b261ecSmrg	  # Do each command in the postinstall commands.
607305b261ecSmrg	  lib="$destdir/$realname"
607405b261ecSmrg	  cmds=$postinstall_cmds
607505b261ecSmrg	  save_ifs="$IFS"; IFS='~'
607605b261ecSmrg	  for cmd in $cmds; do
607705b261ecSmrg	    IFS="$save_ifs"
607805b261ecSmrg	    eval cmd=\"$cmd\"
607905b261ecSmrg	    $show "$cmd"
608005b261ecSmrg	    $run eval "$cmd" || {
608105b261ecSmrg	      lt_exit=$?
608205b261ecSmrg
608305b261ecSmrg	      # Restore the uninstalled library and exit
608405b261ecSmrg	      if test "$mode" = relink; then
608505b261ecSmrg		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
608605b261ecSmrg	      fi
608705b261ecSmrg
608805b261ecSmrg	      exit $lt_exit
608905b261ecSmrg	    }
609005b261ecSmrg	  done
609105b261ecSmrg	  IFS="$save_ifs"
609205b261ecSmrg	fi
609305b261ecSmrg
609405b261ecSmrg	# Install the pseudo-library for information purposes.
609505b261ecSmrg	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
609605b261ecSmrg	instname="$dir/$name"i
609705b261ecSmrg	$show "$install_prog $instname $destdir/$name"
609805b261ecSmrg	$run eval "$install_prog $instname $destdir/$name" || exit $?
609905b261ecSmrg
610005b261ecSmrg	# Maybe install the static library, too.
610105b261ecSmrg	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
610205b261ecSmrg	;;
610305b261ecSmrg
610405b261ecSmrg      *.lo)
610505b261ecSmrg	# Install (i.e. copy) a libtool object.
610605b261ecSmrg
610705b261ecSmrg	# Figure out destination file name, if it wasn't already specified.
610805b261ecSmrg	if test -n "$destname"; then
610905b261ecSmrg	  destfile="$destdir/$destname"
611005b261ecSmrg	else
611105b261ecSmrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
611205b261ecSmrg	  destfile="$destdir/$destfile"
611305b261ecSmrg	fi
611405b261ecSmrg
611505b261ecSmrg	# Deduce the name of the destination old-style object file.
611605b261ecSmrg	case $destfile in
611705b261ecSmrg	*.lo)
611805b261ecSmrg	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
611905b261ecSmrg	  ;;
612005b261ecSmrg	*.$objext)
612105b261ecSmrg	  staticdest="$destfile"
612205b261ecSmrg	  destfile=
612305b261ecSmrg	  ;;
612405b261ecSmrg	*)
612505b261ecSmrg	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
612605b261ecSmrg	  $echo "$help" 1>&2
612705b261ecSmrg	  exit $EXIT_FAILURE
612805b261ecSmrg	  ;;
612905b261ecSmrg	esac
613005b261ecSmrg
613105b261ecSmrg	# Install the libtool object if requested.
613205b261ecSmrg	if test -n "$destfile"; then
613305b261ecSmrg	  $show "$install_prog $file $destfile"
613405b261ecSmrg	  $run eval "$install_prog $file $destfile" || exit $?
613505b261ecSmrg	fi
613605b261ecSmrg
613705b261ecSmrg	# Install the old object if enabled.
613805b261ecSmrg	if test "$build_old_libs" = yes; then
613905b261ecSmrg	  # Deduce the name of the old-style object file.
614005b261ecSmrg	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
614105b261ecSmrg
614205b261ecSmrg	  $show "$install_prog $staticobj $staticdest"
614305b261ecSmrg	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
614405b261ecSmrg	fi
614505b261ecSmrg	exit $EXIT_SUCCESS
614605b261ecSmrg	;;
614705b261ecSmrg
614805b261ecSmrg      *)
614905b261ecSmrg	# Figure out destination file name, if it wasn't already specified.
615005b261ecSmrg	if test -n "$destname"; then
615105b261ecSmrg	  destfile="$destdir/$destname"
615205b261ecSmrg	else
615305b261ecSmrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
615405b261ecSmrg	  destfile="$destdir/$destfile"
615505b261ecSmrg	fi
615605b261ecSmrg
615705b261ecSmrg	# If the file is missing, and there is a .exe on the end, strip it
615805b261ecSmrg	# because it is most likely a libtool script we actually want to
615905b261ecSmrg	# install
616005b261ecSmrg	stripped_ext=""
616105b261ecSmrg	case $file in
616205b261ecSmrg	  *.exe)
616305b261ecSmrg	    if test ! -f "$file"; then
616405b261ecSmrg	      file=`$echo $file|${SED} 's,.exe$,,'`
616505b261ecSmrg	      stripped_ext=".exe"
616605b261ecSmrg	    fi
616705b261ecSmrg	    ;;
616805b261ecSmrg	esac
616905b261ecSmrg
617005b261ecSmrg	# Do a test to see if this is really a libtool program.
617105b261ecSmrg	case $host in
617205b261ecSmrg	*cygwin*|*mingw*)
617305b261ecSmrg	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
617405b261ecSmrg	    ;;
617505b261ecSmrg	*)
617605b261ecSmrg	    wrapper=$file
617705b261ecSmrg	    ;;
617805b261ecSmrg	esac
617905b261ecSmrg	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
618005b261ecSmrg	  notinst_deplibs=
618105b261ecSmrg	  relink_command=
618205b261ecSmrg
618305b261ecSmrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
618405b261ecSmrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
618505b261ecSmrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
618605b261ecSmrg	  # `FILE.' does not work on cygwin managed mounts.
618705b261ecSmrg	  #
618805b261ecSmrg	  # If there is no directory component, then add one.
618905b261ecSmrg	  case $wrapper in
619005b261ecSmrg	  */* | *\\*) . ${wrapper} ;;
619105b261ecSmrg	  *) . ./${wrapper} ;;
619205b261ecSmrg	  esac
619305b261ecSmrg
619405b261ecSmrg	  # Check the variables that should have been set.
619505b261ecSmrg	  if test -z "$notinst_deplibs"; then
619605b261ecSmrg	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
619705b261ecSmrg	    exit $EXIT_FAILURE
619805b261ecSmrg	  fi
619905b261ecSmrg
620005b261ecSmrg	  finalize=yes
620105b261ecSmrg	  for lib in $notinst_deplibs; do
620205b261ecSmrg	    # Check to see that each library is installed.
620305b261ecSmrg	    libdir=
620405b261ecSmrg	    if test -f "$lib"; then
620505b261ecSmrg	      # If there is no directory component, then add one.
620605b261ecSmrg	      case $lib in
620705b261ecSmrg	      */* | *\\*) . $lib ;;
620805b261ecSmrg	      *) . ./$lib ;;
620905b261ecSmrg	      esac
621005b261ecSmrg	    fi
621105b261ecSmrg	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
621205b261ecSmrg	    if test -n "$libdir" && test ! -f "$libfile"; then
621305b261ecSmrg	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
621405b261ecSmrg	      finalize=no
621505b261ecSmrg	    fi
621605b261ecSmrg	  done
621705b261ecSmrg
621805b261ecSmrg	  relink_command=
621905b261ecSmrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
622005b261ecSmrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
622105b261ecSmrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
622205b261ecSmrg	  # `FILE.' does not work on cygwin managed mounts.
622305b261ecSmrg	  #
622405b261ecSmrg	  # If there is no directory component, then add one.
622505b261ecSmrg	  case $wrapper in
622605b261ecSmrg	  */* | *\\*) . ${wrapper} ;;
622705b261ecSmrg	  *) . ./${wrapper} ;;
622805b261ecSmrg	  esac
622905b261ecSmrg
623005b261ecSmrg	  outputname=
623105b261ecSmrg	  if test "$fast_install" = no && test -n "$relink_command"; then
623205b261ecSmrg	    if test "$finalize" = yes && test -z "$run"; then
623305b261ecSmrg	      tmpdir=`func_mktempdir`
623405b261ecSmrg	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
623505b261ecSmrg	      outputname="$tmpdir/$file"
623605b261ecSmrg	      # Replace the output file specification.
623705b261ecSmrg	      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
623805b261ecSmrg
623905b261ecSmrg	      $show "$relink_command"
624005b261ecSmrg	      if $run eval "$relink_command"; then :
624105b261ecSmrg	      else
624205b261ecSmrg		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
624305b261ecSmrg		${rm}r "$tmpdir"
624405b261ecSmrg		continue
624505b261ecSmrg	      fi
624605b261ecSmrg	      file="$outputname"
624705b261ecSmrg	    else
624805b261ecSmrg	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
624905b261ecSmrg	    fi
625005b261ecSmrg	  else
625105b261ecSmrg	    # Install the binary that we compiled earlier.
625205b261ecSmrg	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
625305b261ecSmrg	  fi
625405b261ecSmrg	fi
625505b261ecSmrg
625605b261ecSmrg	# remove .exe since cygwin /usr/bin/install will append another
625705b261ecSmrg	# one anyway 
625805b261ecSmrg	case $install_prog,$host in
625905b261ecSmrg	*/usr/bin/install*,*cygwin*)
626005b261ecSmrg	  case $file:$destfile in
626105b261ecSmrg	  *.exe:*.exe)
626205b261ecSmrg	    # this is ok
626305b261ecSmrg	    ;;
626405b261ecSmrg	  *.exe:*)
626505b261ecSmrg	    destfile=$destfile.exe
626605b261ecSmrg	    ;;
626705b261ecSmrg	  *:*.exe)
626805b261ecSmrg	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
626905b261ecSmrg	    ;;
627005b261ecSmrg	  esac
627105b261ecSmrg	  ;;
627205b261ecSmrg	esac
627305b261ecSmrg	$show "$install_prog$stripme $file $destfile"
627405b261ecSmrg	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
627505b261ecSmrg	test -n "$outputname" && ${rm}r "$tmpdir"
627605b261ecSmrg	;;
627705b261ecSmrg      esac
627805b261ecSmrg    done
627905b261ecSmrg
628005b261ecSmrg    for file in $staticlibs; do
628105b261ecSmrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
628205b261ecSmrg
628305b261ecSmrg      # Set up the ranlib parameters.
628405b261ecSmrg      oldlib="$destdir/$name"
628505b261ecSmrg
628605b261ecSmrg      $show "$install_prog $file $oldlib"
628705b261ecSmrg      $run eval "$install_prog \$file \$oldlib" || exit $?
628805b261ecSmrg
628905b261ecSmrg      if test -n "$stripme" && test -n "$old_striplib"; then
629005b261ecSmrg	$show "$old_striplib $oldlib"
629105b261ecSmrg	$run eval "$old_striplib $oldlib" || exit $?
629205b261ecSmrg      fi
629305b261ecSmrg
629405b261ecSmrg      # Do each command in the postinstall commands.
629505b261ecSmrg      cmds=$old_postinstall_cmds
629605b261ecSmrg      save_ifs="$IFS"; IFS='~'
629705b261ecSmrg      for cmd in $cmds; do
629805b261ecSmrg	IFS="$save_ifs"
629905b261ecSmrg	eval cmd=\"$cmd\"
630005b261ecSmrg	$show "$cmd"
630105b261ecSmrg	$run eval "$cmd" || exit $?
630205b261ecSmrg      done
630305b261ecSmrg      IFS="$save_ifs"
630405b261ecSmrg    done
630505b261ecSmrg
630605b261ecSmrg    if test -n "$future_libdirs"; then
630705b261ecSmrg      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
630805b261ecSmrg    fi
630905b261ecSmrg
631005b261ecSmrg    if test -n "$current_libdirs"; then
631105b261ecSmrg      # Maybe just do a dry run.
631205b261ecSmrg      test -n "$run" && current_libdirs=" -n$current_libdirs"
631305b261ecSmrg      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
631405b261ecSmrg    else
631505b261ecSmrg      exit $EXIT_SUCCESS
631605b261ecSmrg    fi
631705b261ecSmrg    ;;
631805b261ecSmrg
631905b261ecSmrg  # libtool finish mode
632005b261ecSmrg  finish)
632105b261ecSmrg    modename="$modename: finish"
632205b261ecSmrg    libdirs="$nonopt"
632305b261ecSmrg    admincmds=
632405b261ecSmrg
632505b261ecSmrg    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
632605b261ecSmrg      for dir
632705b261ecSmrg      do
632805b261ecSmrg	libdirs="$libdirs $dir"
632905b261ecSmrg      done
633005b261ecSmrg
633105b261ecSmrg      for libdir in $libdirs; do
633205b261ecSmrg	if test -n "$finish_cmds"; then
633305b261ecSmrg	  # Do each command in the finish commands.
633405b261ecSmrg	  cmds=$finish_cmds
633505b261ecSmrg	  save_ifs="$IFS"; IFS='~'
633605b261ecSmrg	  for cmd in $cmds; do
633705b261ecSmrg	    IFS="$save_ifs"
633805b261ecSmrg	    eval cmd=\"$cmd\"
633905b261ecSmrg	    $show "$cmd"
634005b261ecSmrg	    $run eval "$cmd" || admincmds="$admincmds
634105b261ecSmrg       $cmd"
634205b261ecSmrg	  done
634305b261ecSmrg	  IFS="$save_ifs"
634405b261ecSmrg	fi
634505b261ecSmrg	if test -n "$finish_eval"; then
634605b261ecSmrg	  # Do the single finish_eval.
634705b261ecSmrg	  eval cmds=\"$finish_eval\"
634805b261ecSmrg	  $run eval "$cmds" || admincmds="$admincmds
634905b261ecSmrg       $cmds"
635005b261ecSmrg	fi
635105b261ecSmrg      done
635205b261ecSmrg    fi
635305b261ecSmrg
635405b261ecSmrg    # Exit here if they wanted silent mode.
635505b261ecSmrg    test "$show" = : && exit $EXIT_SUCCESS
635605b261ecSmrg
635705b261ecSmrg    $echo "X----------------------------------------------------------------------" | $Xsed
635805b261ecSmrg    $echo "Libraries have been installed in:"
635905b261ecSmrg    for libdir in $libdirs; do
636005b261ecSmrg      $echo "   $libdir"
636105b261ecSmrg    done
636205b261ecSmrg    $echo
636305b261ecSmrg    $echo "If you ever happen to want to link against installed libraries"
636405b261ecSmrg    $echo "in a given directory, LIBDIR, you must either use libtool, and"
636505b261ecSmrg    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
636605b261ecSmrg    $echo "flag during linking and do at least one of the following:"
636705b261ecSmrg    if test -n "$shlibpath_var"; then
636805b261ecSmrg      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
636905b261ecSmrg      $echo "     during execution"
637005b261ecSmrg    fi
637105b261ecSmrg    if test -n "$runpath_var"; then
637205b261ecSmrg      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
637305b261ecSmrg      $echo "     during linking"
637405b261ecSmrg    fi
637505b261ecSmrg    if test -n "$hardcode_libdir_flag_spec"; then
637605b261ecSmrg      libdir=LIBDIR
637705b261ecSmrg      eval flag=\"$hardcode_libdir_flag_spec\"
637805b261ecSmrg
637905b261ecSmrg      $echo "   - use the \`$flag' linker flag"
638005b261ecSmrg    fi
638105b261ecSmrg    if test -n "$admincmds"; then
638205b261ecSmrg      $echo "   - have your system administrator run these commands:$admincmds"
638305b261ecSmrg    fi
638405b261ecSmrg    if test -f /etc/ld.so.conf; then
638505b261ecSmrg      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
638605b261ecSmrg    fi
638705b261ecSmrg    $echo
638805b261ecSmrg    $echo "See any operating system documentation about shared libraries for"
638905b261ecSmrg    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
639005b261ecSmrg    $echo "X----------------------------------------------------------------------" | $Xsed
639105b261ecSmrg    exit $EXIT_SUCCESS
639205b261ecSmrg    ;;
639305b261ecSmrg
639405b261ecSmrg  # libtool execute mode
639505b261ecSmrg  execute)
639605b261ecSmrg    modename="$modename: execute"
639705b261ecSmrg
639805b261ecSmrg    # The first argument is the command name.
639905b261ecSmrg    cmd="$nonopt"
640005b261ecSmrg    if test -z "$cmd"; then
640105b261ecSmrg      $echo "$modename: you must specify a COMMAND" 1>&2
640205b261ecSmrg      $echo "$help"
640305b261ecSmrg      exit $EXIT_FAILURE
640405b261ecSmrg    fi
640505b261ecSmrg
640605b261ecSmrg    # Handle -dlopen flags immediately.
640705b261ecSmrg    for file in $execute_dlfiles; do
640805b261ecSmrg      if test ! -f "$file"; then
640905b261ecSmrg	$echo "$modename: \`$file' is not a file" 1>&2
641005b261ecSmrg	$echo "$help" 1>&2
641105b261ecSmrg	exit $EXIT_FAILURE
641205b261ecSmrg      fi
641305b261ecSmrg
641405b261ecSmrg      dir=
641505b261ecSmrg      case $file in
641605b261ecSmrg      *.la)
641705b261ecSmrg	# Check to see that this really is a libtool archive.
641805b261ecSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
641905b261ecSmrg	else
642005b261ecSmrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
642105b261ecSmrg	  $echo "$help" 1>&2
642205b261ecSmrg	  exit $EXIT_FAILURE
642305b261ecSmrg	fi
642405b261ecSmrg
642505b261ecSmrg	# Read the libtool library.
642605b261ecSmrg	dlname=
642705b261ecSmrg	library_names=
642805b261ecSmrg
642905b261ecSmrg	# If there is no directory component, then add one.
643005b261ecSmrg	case $file in
643105b261ecSmrg	*/* | *\\*) . $file ;;
643205b261ecSmrg	*) . ./$file ;;
643305b261ecSmrg	esac
643405b261ecSmrg
643505b261ecSmrg	# Skip this library if it cannot be dlopened.
643605b261ecSmrg	if test -z "$dlname"; then
643705b261ecSmrg	  # Warn if it was a shared library.
643805b261ecSmrg	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
643905b261ecSmrg	  continue
644005b261ecSmrg	fi
644105b261ecSmrg
644205b261ecSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
644305b261ecSmrg	test "X$dir" = "X$file" && dir=.
644405b261ecSmrg
644505b261ecSmrg	if test -f "$dir/$objdir/$dlname"; then
644605b261ecSmrg	  dir="$dir/$objdir"
644705b261ecSmrg	else
644805b261ecSmrg	  if test ! -f "$dir/$dlname"; then
644905b261ecSmrg	    $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
645005b261ecSmrg	    exit $EXIT_FAILURE
645105b261ecSmrg	  fi
645205b261ecSmrg	fi
645305b261ecSmrg	;;
645405b261ecSmrg
645505b261ecSmrg      *.lo)
645605b261ecSmrg	# Just add the directory containing the .lo file.
645705b261ecSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
645805b261ecSmrg	test "X$dir" = "X$file" && dir=.
645905b261ecSmrg	;;
646005b261ecSmrg
646105b261ecSmrg      *)
646205b261ecSmrg	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
646305b261ecSmrg	continue
646405b261ecSmrg	;;
646505b261ecSmrg      esac
646605b261ecSmrg
646705b261ecSmrg      # Get the absolute pathname.
646805b261ecSmrg      absdir=`cd "$dir" && pwd`
646905b261ecSmrg      test -n "$absdir" && dir="$absdir"
647005b261ecSmrg
647105b261ecSmrg      # Now add the directory to shlibpath_var.
647205b261ecSmrg      if eval "test -z \"\$$shlibpath_var\""; then
647305b261ecSmrg	eval "$shlibpath_var=\"\$dir\""
647405b261ecSmrg      else
647505b261ecSmrg	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
647605b261ecSmrg      fi
647705b261ecSmrg    done
647805b261ecSmrg
647905b261ecSmrg    # This variable tells wrapper scripts just to set shlibpath_var
648005b261ecSmrg    # rather than running their programs.
648105b261ecSmrg    libtool_execute_magic="$magic"
648205b261ecSmrg
648305b261ecSmrg    # Check if any of the arguments is a wrapper script.
648405b261ecSmrg    args=
648505b261ecSmrg    for file
648605b261ecSmrg    do
648705b261ecSmrg      case $file in
648805b261ecSmrg      -*) ;;
648905b261ecSmrg      *)
649005b261ecSmrg	# Do a test to see if this is really a libtool program.
649105b261ecSmrg	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
649205b261ecSmrg	  # If there is no directory component, then add one.
649305b261ecSmrg	  case $file in
649405b261ecSmrg	  */* | *\\*) . $file ;;
649505b261ecSmrg	  *) . ./$file ;;
649605b261ecSmrg	  esac
649705b261ecSmrg
649805b261ecSmrg	  # Transform arg to wrapped name.
649905b261ecSmrg	  file="$progdir/$program"
650005b261ecSmrg	fi
650105b261ecSmrg	;;
650205b261ecSmrg      esac
650305b261ecSmrg      # Quote arguments (to preserve shell metacharacters).
650405b261ecSmrg      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
650505b261ecSmrg      args="$args \"$file\""
650605b261ecSmrg    done
650705b261ecSmrg
650805b261ecSmrg    if test -z "$run"; then
650905b261ecSmrg      if test -n "$shlibpath_var"; then
651005b261ecSmrg	# Export the shlibpath_var.
651105b261ecSmrg	eval "export $shlibpath_var"
651205b261ecSmrg      fi
651305b261ecSmrg
651405b261ecSmrg      # Restore saved environment variables
651505b261ecSmrg      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
651605b261ecSmrg      do
651705b261ecSmrg	eval "if test \"\${save_$lt_var+set}\" = set; then
651805b261ecSmrg		$lt_var=\$save_$lt_var; export $lt_var
651905b261ecSmrg	      fi"
652005b261ecSmrg      done
652105b261ecSmrg
652205b261ecSmrg      # Now prepare to actually exec the command.
652305b261ecSmrg      exec_cmd="\$cmd$args"
652405b261ecSmrg    else
652505b261ecSmrg      # Display what would be done.
652605b261ecSmrg      if test -n "$shlibpath_var"; then
652705b261ecSmrg	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
652805b261ecSmrg	$echo "export $shlibpath_var"
652905b261ecSmrg      fi
653005b261ecSmrg      $echo "$cmd$args"
653105b261ecSmrg      exit $EXIT_SUCCESS
653205b261ecSmrg    fi
653305b261ecSmrg    ;;
653405b261ecSmrg
653505b261ecSmrg  # libtool clean and uninstall mode
653605b261ecSmrg  clean | uninstall)
653705b261ecSmrg    modename="$modename: $mode"
653805b261ecSmrg    rm="$nonopt"
653905b261ecSmrg    files=
654005b261ecSmrg    rmforce=
654105b261ecSmrg    exit_status=0
654205b261ecSmrg
654305b261ecSmrg    # This variable tells wrapper scripts just to set variables rather
654405b261ecSmrg    # than running their programs.
654505b261ecSmrg    libtool_install_magic="$magic"
654605b261ecSmrg
654705b261ecSmrg    for arg
654805b261ecSmrg    do
654905b261ecSmrg      case $arg in
655005b261ecSmrg      -f) rm="$rm $arg"; rmforce=yes ;;
655105b261ecSmrg      -*) rm="$rm $arg" ;;
655205b261ecSmrg      *) files="$files $arg" ;;
655305b261ecSmrg      esac
655405b261ecSmrg    done
655505b261ecSmrg
655605b261ecSmrg    if test -z "$rm"; then
655705b261ecSmrg      $echo "$modename: you must specify an RM program" 1>&2
655805b261ecSmrg      $echo "$help" 1>&2
655905b261ecSmrg      exit $EXIT_FAILURE
656005b261ecSmrg    fi
656105b261ecSmrg
656205b261ecSmrg    rmdirs=
656305b261ecSmrg
656405b261ecSmrg    origobjdir="$objdir"
656505b261ecSmrg    for file in $files; do
656605b261ecSmrg      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
656705b261ecSmrg      if test "X$dir" = "X$file"; then
656805b261ecSmrg	dir=.
656905b261ecSmrg	objdir="$origobjdir"
657005b261ecSmrg      else
657105b261ecSmrg	objdir="$dir/$origobjdir"
657205b261ecSmrg      fi
657305b261ecSmrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
657405b261ecSmrg      test "$mode" = uninstall && objdir="$dir"
657505b261ecSmrg
657605b261ecSmrg      # Remember objdir for removal later, being careful to avoid duplicates
657705b261ecSmrg      if test "$mode" = clean; then
657805b261ecSmrg	case " $rmdirs " in
657905b261ecSmrg	  *" $objdir "*) ;;
658005b261ecSmrg	  *) rmdirs="$rmdirs $objdir" ;;
658105b261ecSmrg	esac
658205b261ecSmrg      fi
658305b261ecSmrg
658405b261ecSmrg      # Don't error if the file doesn't exist and rm -f was used.
658505b261ecSmrg      if (test -L "$file") >/dev/null 2>&1 \
658605b261ecSmrg	|| (test -h "$file") >/dev/null 2>&1 \
658705b261ecSmrg	|| test -f "$file"; then
658805b261ecSmrg	:
658905b261ecSmrg      elif test -d "$file"; then
659005b261ecSmrg	exit_status=1
659105b261ecSmrg	continue
659205b261ecSmrg      elif test "$rmforce" = yes; then
659305b261ecSmrg	continue
659405b261ecSmrg      fi
659505b261ecSmrg
659605b261ecSmrg      rmfiles="$file"
659705b261ecSmrg
659805b261ecSmrg      case $name in
659905b261ecSmrg      *.la)
660005b261ecSmrg	# Possibly a libtool archive, so verify it.
660105b261ecSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
660205b261ecSmrg	  . $dir/$name
660305b261ecSmrg
660405b261ecSmrg	  # Delete the libtool libraries and symlinks.
660505b261ecSmrg	  for n in $library_names; do
660605b261ecSmrg	    rmfiles="$rmfiles $objdir/$n"
660705b261ecSmrg	  done
660805b261ecSmrg	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
660905b261ecSmrg
661005b261ecSmrg	  case "$mode" in
661105b261ecSmrg	  clean)
661205b261ecSmrg	    case "  $library_names " in
661305b261ecSmrg	    # "  " in the beginning catches empty $dlname
661405b261ecSmrg	    *" $dlname "*) ;;
661505b261ecSmrg	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
661605b261ecSmrg	    esac
661705b261ecSmrg	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
661805b261ecSmrg	    ;;
661905b261ecSmrg	  uninstall)
662005b261ecSmrg	    if test -n "$library_names"; then
662105b261ecSmrg	      # Do each command in the postuninstall commands.
662205b261ecSmrg	      cmds=$postuninstall_cmds
662305b261ecSmrg	      save_ifs="$IFS"; IFS='~'
662405b261ecSmrg	      for cmd in $cmds; do
662505b261ecSmrg		IFS="$save_ifs"
662605b261ecSmrg		eval cmd=\"$cmd\"
662705b261ecSmrg		$show "$cmd"
662805b261ecSmrg		$run eval "$cmd"
662905b261ecSmrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
663005b261ecSmrg		  exit_status=1
663105b261ecSmrg		fi
663205b261ecSmrg	      done
663305b261ecSmrg	      IFS="$save_ifs"
663405b261ecSmrg	    fi
663505b261ecSmrg
663605b261ecSmrg	    if test -n "$old_library"; then
663705b261ecSmrg	      # Do each command in the old_postuninstall commands.
663805b261ecSmrg	      cmds=$old_postuninstall_cmds
663905b261ecSmrg	      save_ifs="$IFS"; IFS='~'
664005b261ecSmrg	      for cmd in $cmds; do
664105b261ecSmrg		IFS="$save_ifs"
664205b261ecSmrg		eval cmd=\"$cmd\"
664305b261ecSmrg		$show "$cmd"
664405b261ecSmrg		$run eval "$cmd"
664505b261ecSmrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
664605b261ecSmrg		  exit_status=1
664705b261ecSmrg		fi
664805b261ecSmrg	      done
664905b261ecSmrg	      IFS="$save_ifs"
665005b261ecSmrg	    fi
665105b261ecSmrg	    # FIXME: should reinstall the best remaining shared library.
665205b261ecSmrg	    ;;
665305b261ecSmrg	  esac
665405b261ecSmrg	fi
665505b261ecSmrg	;;
665605b261ecSmrg
665705b261ecSmrg      *.lo)
665805b261ecSmrg	# Possibly a libtool object, so verify it.
665905b261ecSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
666005b261ecSmrg
666105b261ecSmrg	  # Read the .lo file
666205b261ecSmrg	  . $dir/$name
666305b261ecSmrg
666405b261ecSmrg	  # Add PIC object to the list of files to remove.
666505b261ecSmrg	  if test -n "$pic_object" \
666605b261ecSmrg	     && test "$pic_object" != none; then
666705b261ecSmrg	    rmfiles="$rmfiles $dir/$pic_object"
666805b261ecSmrg	  fi
666905b261ecSmrg
667005b261ecSmrg	  # Add non-PIC object to the list of files to remove.
667105b261ecSmrg	  if test -n "$non_pic_object" \
667205b261ecSmrg	     && test "$non_pic_object" != none; then
667305b261ecSmrg	    rmfiles="$rmfiles $dir/$non_pic_object"
667405b261ecSmrg	  fi
667505b261ecSmrg	fi
667605b261ecSmrg	;;
667705b261ecSmrg
667805b261ecSmrg      *)
667905b261ecSmrg	if test "$mode" = clean ; then
668005b261ecSmrg	  noexename=$name
668105b261ecSmrg	  case $file in
668205b261ecSmrg	  *.exe)
668305b261ecSmrg	    file=`$echo $file|${SED} 's,.exe$,,'`
668405b261ecSmrg	    noexename=`$echo $name|${SED} 's,.exe$,,'`
668505b261ecSmrg	    # $file with .exe has already been added to rmfiles,
668605b261ecSmrg	    # add $file without .exe
668705b261ecSmrg	    rmfiles="$rmfiles $file"
668805b261ecSmrg	    ;;
668905b261ecSmrg	  esac
669005b261ecSmrg	  # Do a test to see if this is a libtool program.
669105b261ecSmrg	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
669205b261ecSmrg	    relink_command=
669305b261ecSmrg	    . $dir/$noexename
669405b261ecSmrg
669505b261ecSmrg	    # note $name still contains .exe if it was in $file originally
669605b261ecSmrg	    # as does the version of $file that was added into $rmfiles
669705b261ecSmrg	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
669805b261ecSmrg	    if test "$fast_install" = yes && test -n "$relink_command"; then
669905b261ecSmrg	      rmfiles="$rmfiles $objdir/lt-$name"
670005b261ecSmrg	    fi
670105b261ecSmrg	    if test "X$noexename" != "X$name" ; then
670205b261ecSmrg	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
670305b261ecSmrg	    fi
670405b261ecSmrg	  fi
670505b261ecSmrg	fi
670605b261ecSmrg	;;
670705b261ecSmrg      esac
670805b261ecSmrg      $show "$rm $rmfiles"
670905b261ecSmrg      $run $rm $rmfiles || exit_status=1
671005b261ecSmrg    done
671105b261ecSmrg    objdir="$origobjdir"
671205b261ecSmrg
671305b261ecSmrg    # Try to remove the ${objdir}s in the directories where we deleted files
671405b261ecSmrg    for dir in $rmdirs; do
671505b261ecSmrg      if test -d "$dir"; then
671605b261ecSmrg	$show "rmdir $dir"
671705b261ecSmrg	$run rmdir $dir >/dev/null 2>&1
671805b261ecSmrg      fi
671905b261ecSmrg    done
672005b261ecSmrg
672105b261ecSmrg    exit $exit_status
672205b261ecSmrg    ;;
672305b261ecSmrg
672405b261ecSmrg  "")
672505b261ecSmrg    $echo "$modename: you must specify a MODE" 1>&2
672605b261ecSmrg    $echo "$generic_help" 1>&2
672705b261ecSmrg    exit $EXIT_FAILURE
672805b261ecSmrg    ;;
672905b261ecSmrg  esac
673005b261ecSmrg
673105b261ecSmrg  if test -z "$exec_cmd"; then
673205b261ecSmrg    $echo "$modename: invalid operation mode \`$mode'" 1>&2
673305b261ecSmrg    $echo "$generic_help" 1>&2
673405b261ecSmrg    exit $EXIT_FAILURE
673505b261ecSmrg  fi
673605b261ecSmrgfi # test -z "$show_help"
673705b261ecSmrg
673805b261ecSmrgif test -n "$exec_cmd"; then
673905b261ecSmrg  eval exec $exec_cmd
674005b261ecSmrg  exit $EXIT_FAILURE
674105b261ecSmrgfi
674205b261ecSmrg
674305b261ecSmrg# We need to display help for each of the modes.
674405b261ecSmrgcase $mode in
674505b261ecSmrg"") $echo \
674605b261ecSmrg"Usage: $modename [OPTION]... [MODE-ARG]...
674705b261ecSmrg
674805b261ecSmrgProvide generalized library-building support services.
674905b261ecSmrg
675005b261ecSmrg    --config          show all configuration variables
675105b261ecSmrg    --debug           enable verbose shell tracing
675205b261ecSmrg-n, --dry-run         display commands without modifying any files
675305b261ecSmrg    --features        display basic configuration information and exit
675405b261ecSmrg    --finish          same as \`--mode=finish'
675505b261ecSmrg    --help            display this help message and exit
675605b261ecSmrg    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
675705b261ecSmrg    --quiet           same as \`--silent'
675805b261ecSmrg    --silent          don't print informational messages
675905b261ecSmrg    --tag=TAG         use configuration variables from tag TAG
676005b261ecSmrg    --version         print version information
676105b261ecSmrg
676205b261ecSmrgMODE must be one of the following:
676305b261ecSmrg
676405b261ecSmrg      clean           remove files from the build directory
676505b261ecSmrg      compile         compile a source file into a libtool object
676605b261ecSmrg      execute         automatically set library path, then run a program
676705b261ecSmrg      finish          complete the installation of libtool libraries
676805b261ecSmrg      install         install libraries or executables
676905b261ecSmrg      link            create a library or an executable
677005b261ecSmrg      uninstall       remove libraries from an installed directory
677105b261ecSmrg
677205b261ecSmrgMODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
677305b261ecSmrga more detailed description of MODE.
677405b261ecSmrg
677505b261ecSmrgReport bugs to <bug-libtool@gnu.org>."
677605b261ecSmrg  exit $EXIT_SUCCESS
677705b261ecSmrg  ;;
677805b261ecSmrg
677905b261ecSmrgclean)
678005b261ecSmrg  $echo \
678105b261ecSmrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
678205b261ecSmrg
678305b261ecSmrgRemove files from the build directory.
678405b261ecSmrg
678505b261ecSmrgRM is the name of the program to use to delete files associated with each FILE
678605b261ecSmrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
678705b261ecSmrgto RM.
678805b261ecSmrg
678905b261ecSmrgIf FILE is a libtool library, object or program, all the files associated
679005b261ecSmrgwith it are deleted. Otherwise, only FILE itself is deleted using RM."
679105b261ecSmrg  ;;
679205b261ecSmrg
679305b261ecSmrgcompile)
679405b261ecSmrg  $echo \
679505b261ecSmrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
679605b261ecSmrg
679705b261ecSmrgCompile a source file into a libtool library object.
679805b261ecSmrg
679905b261ecSmrgThis mode accepts the following additional options:
680005b261ecSmrg
680105b261ecSmrg  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
680205b261ecSmrg  -prefer-pic       try to building PIC objects only
680305b261ecSmrg  -prefer-non-pic   try to building non-PIC objects only
680405b261ecSmrg  -static           always build a \`.o' file suitable for static linking
680505b261ecSmrg
680605b261ecSmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file
680705b261ecSmrgfrom the given SOURCEFILE.
680805b261ecSmrg
680905b261ecSmrgThe output file name is determined by removing the directory component from
681005b261ecSmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the
681105b261ecSmrglibrary object suffix, \`.lo'."
681205b261ecSmrg  ;;
681305b261ecSmrg
681405b261ecSmrgexecute)
681505b261ecSmrg  $echo \
681605b261ecSmrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
681705b261ecSmrg
681805b261ecSmrgAutomatically set library path, then run a program.
681905b261ecSmrg
682005b261ecSmrgThis mode accepts the following additional options:
682105b261ecSmrg
682205b261ecSmrg  -dlopen FILE      add the directory containing FILE to the library path
682305b261ecSmrg
682405b261ecSmrgThis mode sets the library path environment variable according to \`-dlopen'
682505b261ecSmrgflags.
682605b261ecSmrg
682705b261ecSmrgIf any of the ARGS are libtool executable wrappers, then they are translated
682805b261ecSmrginto their corresponding uninstalled binary, and any of their required library
682905b261ecSmrgdirectories are added to the library path.
683005b261ecSmrg
683105b261ecSmrgThen, COMMAND is executed, with ARGS as arguments."
683205b261ecSmrg  ;;
683305b261ecSmrg
683405b261ecSmrgfinish)
683505b261ecSmrg  $echo \
683605b261ecSmrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
683705b261ecSmrg
683805b261ecSmrgComplete the installation of libtool libraries.
683905b261ecSmrg
684005b261ecSmrgEach LIBDIR is a directory that contains libtool libraries.
684105b261ecSmrg
684205b261ecSmrgThe commands that this mode executes may require superuser privileges.  Use
684305b261ecSmrgthe \`--dry-run' option if you just want to see what would be executed."
684405b261ecSmrg  ;;
684505b261ecSmrg
684605b261ecSmrginstall)
684705b261ecSmrg  $echo \
684805b261ecSmrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
684905b261ecSmrg
685005b261ecSmrgInstall executables or libraries.
685105b261ecSmrg
685205b261ecSmrgINSTALL-COMMAND is the installation command.  The first component should be
685305b261ecSmrgeither the \`install' or \`cp' program.
685405b261ecSmrg
685505b261ecSmrgThe rest of the components are interpreted as arguments to that command (only
685605b261ecSmrgBSD-compatible install options are recognized)."
685705b261ecSmrg  ;;
685805b261ecSmrg
685905b261ecSmrglink)
686005b261ecSmrg  $echo \
686105b261ecSmrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
686205b261ecSmrg
686305b261ecSmrgLink object files or libraries together to form another library, or to
686405b261ecSmrgcreate an executable program.
686505b261ecSmrg
686605b261ecSmrgLINK-COMMAND is a command using the C compiler that you would use to create
686705b261ecSmrga program from several object files.
686805b261ecSmrg
686905b261ecSmrgThe following components of LINK-COMMAND are treated specially:
687005b261ecSmrg
687105b261ecSmrg  -all-static       do not do any dynamic linking at all
687205b261ecSmrg  -avoid-version    do not add a version suffix if possible
687305b261ecSmrg  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
687405b261ecSmrg  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
687505b261ecSmrg  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
687605b261ecSmrg  -export-symbols SYMFILE
687705b261ecSmrg                    try to export only the symbols listed in SYMFILE
687805b261ecSmrg  -export-symbols-regex REGEX
687905b261ecSmrg                    try to export only the symbols matching REGEX
688005b261ecSmrg  -LLIBDIR          search LIBDIR for required installed libraries
688105b261ecSmrg  -lNAME            OUTPUT-FILE requires the installed library libNAME
688205b261ecSmrg  -module           build a library that can dlopened
688305b261ecSmrg  -no-fast-install  disable the fast-install mode
688405b261ecSmrg  -no-install       link a not-installable executable
688505b261ecSmrg  -no-undefined     declare that a library does not refer to external symbols
688605b261ecSmrg  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
688705b261ecSmrg  -objectlist FILE  Use a list of object files found in FILE to specify objects
688805b261ecSmrg  -precious-files-regex REGEX
688905b261ecSmrg                    don't remove output files matching REGEX
689005b261ecSmrg  -release RELEASE  specify package release information
689105b261ecSmrg  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
689205b261ecSmrg  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
689305b261ecSmrg  -static           do not do any dynamic linking of uninstalled libtool libraries
689405b261ecSmrg  -static-libtool-libs
689505b261ecSmrg                    do not do any dynamic linking of libtool libraries
689605b261ecSmrg  -version-info CURRENT[:REVISION[:AGE]]
689705b261ecSmrg                    specify library version info [each variable defaults to 0]
689805b261ecSmrg
689905b261ecSmrgAll other options (arguments beginning with \`-') are ignored.
690005b261ecSmrg
690105b261ecSmrgEvery other argument is treated as a filename.  Files ending in \`.la' are
690205b261ecSmrgtreated as uninstalled libtool libraries, other files are standard or library
690305b261ecSmrgobject files.
690405b261ecSmrg
690505b261ecSmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created,
690605b261ecSmrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is
690705b261ecSmrgrequired, except when creating a convenience library.
690805b261ecSmrg
690905b261ecSmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
691005b261ecSmrgusing \`ar' and \`ranlib', or on Windows using \`lib'.
691105b261ecSmrg
691205b261ecSmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
691305b261ecSmrgis created, otherwise an executable program is created."
691405b261ecSmrg  ;;
691505b261ecSmrg
691605b261ecSmrguninstall)
691705b261ecSmrg  $echo \
691805b261ecSmrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
691905b261ecSmrg
692005b261ecSmrgRemove libraries from an installation directory.
692105b261ecSmrg
692205b261ecSmrgRM is the name of the program to use to delete files associated with each FILE
692305b261ecSmrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
692405b261ecSmrgto RM.
692505b261ecSmrg
692605b261ecSmrgIf FILE is a libtool library, all the files associated with it are deleted.
692705b261ecSmrgOtherwise, only FILE itself is deleted using RM."
692805b261ecSmrg  ;;
692905b261ecSmrg
693005b261ecSmrg*)
693105b261ecSmrg  $echo "$modename: invalid operation mode \`$mode'" 1>&2
693205b261ecSmrg  $echo "$help" 1>&2
693305b261ecSmrg  exit $EXIT_FAILURE
693405b261ecSmrg  ;;
693505b261ecSmrgesac
693605b261ecSmrg
693705b261ecSmrg$echo
693805b261ecSmrg$echo "Try \`$modename --help' for more information about other modes."
693905b261ecSmrg
694005b261ecSmrgexit $?
694105b261ecSmrg
694205b261ecSmrg# The TAGs below are defined such that we never get into a situation
694305b261ecSmrg# in which we disable both kinds of libraries.  Given conflicting
694405b261ecSmrg# choices, we go for a static library, that is the most portable,
694505b261ecSmrg# since we can't tell whether shared libraries were disabled because
694605b261ecSmrg# the user asked for that or because the platform doesn't support
694705b261ecSmrg# them.  This is particularly important on AIX, because we don't
694805b261ecSmrg# support having both static and shared libraries enabled at the same
694905b261ecSmrg# time on that platform, so we default to a shared-only configuration.
695005b261ecSmrg# If a disable-shared tag is given, we'll fallback to a static-only
695105b261ecSmrg# configuration.  But we'll never go from static-only to shared-only.
695205b261ecSmrg
695305b261ecSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
695405b261ecSmrgdisable_libs=shared
695505b261ecSmrg# ### END LIBTOOL TAG CONFIG: disable-shared
695605b261ecSmrg
695705b261ecSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static
695805b261ecSmrgdisable_libs=static
695905b261ecSmrg# ### END LIBTOOL TAG CONFIG: disable-static
696005b261ecSmrg
696105b261ecSmrg# Local Variables:
696205b261ecSmrg# mode:shell-script
696305b261ecSmrg# sh-indentation:2
696405b261ecSmrg# End:
6965