ltmain.sh revision 23a0898a
123a0898aSmrg# ltmain.sh - Provide generalized library-building support services.
223a0898aSmrg# NOTE: Changing this file will not affect anything until you rerun configure.
323a0898aSmrg#
423a0898aSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
523a0898aSmrg# 2007  Free Software Foundation, Inc.
623a0898aSmrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
723a0898aSmrg#
823a0898aSmrg# This program is free software; you can redistribute it and/or modify
923a0898aSmrg# it under the terms of the GNU General Public License as published by
1023a0898aSmrg# the Free Software Foundation; either version 2 of the License, or
1123a0898aSmrg# (at your option) any later version.
1223a0898aSmrg#
1323a0898aSmrg# This program is distributed in the hope that it will be useful, but
1423a0898aSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1523a0898aSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1623a0898aSmrg# General Public License for more details.
1723a0898aSmrg#
1823a0898aSmrg# You should have received a copy of the GNU General Public License
1923a0898aSmrg# along with this program; if not, write to the Free Software
2023a0898aSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2123a0898aSmrg#
2223a0898aSmrg# As a special exception to the GNU General Public License, if you
2323a0898aSmrg# distribute this file as part of a program that contains a
2423a0898aSmrg# configuration script generated by Autoconf, you may include it under
2523a0898aSmrg# the same distribution terms that you use for the rest of that program.
2623a0898aSmrg
2723a0898aSmrgbasename="s,^.*/,,g"
2823a0898aSmrg
2923a0898aSmrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
3023a0898aSmrg# is ksh but when the shell is invoked as "sh" and the current value of
3123a0898aSmrg# the _XPG environment variable is not equal to 1 (one), the special
3223a0898aSmrg# positional parameter $0, within a function call, is the name of the
3323a0898aSmrg# function.
3423a0898aSmrgprogpath="$0"
3523a0898aSmrg
3623a0898aSmrg# The name of this program:
3723a0898aSmrgprogname=`echo "$progpath" | $SED $basename`
3823a0898aSmrgmodename="$progname"
3923a0898aSmrg
4023a0898aSmrg# Global variables:
4123a0898aSmrgEXIT_SUCCESS=0
4223a0898aSmrgEXIT_FAILURE=1
4323a0898aSmrg
4423a0898aSmrgPROGRAM=ltmain.sh
4523a0898aSmrgPACKAGE=libtool
4623a0898aSmrgVERSION=1.5.24
4723a0898aSmrgTIMESTAMP=" (1.1220.2.456 2007/06/24 02:25:32)"
4823a0898aSmrg
4923a0898aSmrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5023a0898aSmrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
5123a0898aSmrg  emulate sh
5223a0898aSmrg  NULLCMD=:
5323a0898aSmrg  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
5423a0898aSmrg  # is contrary to our usage.  Disable this feature.
5523a0898aSmrg  alias -g '${1+"$@"}'='"$@"'
5623a0898aSmrg  setopt NO_GLOB_SUBST
5723a0898aSmrgelse
5823a0898aSmrg  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
5923a0898aSmrgfi
6023a0898aSmrgBIN_SH=xpg4; export BIN_SH # for Tru64
6123a0898aSmrgDUALCASE=1; export DUALCASE # for MKS sh
6223a0898aSmrg
6323a0898aSmrg# Check that we have a working $echo.
6423a0898aSmrgif test "X$1" = X--no-reexec; then
6523a0898aSmrg  # Discard the --no-reexec flag, and continue.
6623a0898aSmrg  shift
6723a0898aSmrgelif test "X$1" = X--fallback-echo; then
6823a0898aSmrg  # Avoid inline document here, it may be left over
6923a0898aSmrg  :
7023a0898aSmrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
7123a0898aSmrg  # Yippee, $echo works!
7223a0898aSmrg  :
7323a0898aSmrgelse
7423a0898aSmrg  # Restart under the correct shell, and then maybe $echo will work.
7523a0898aSmrg  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
7623a0898aSmrgfi
7723a0898aSmrg
7823a0898aSmrgif test "X$1" = X--fallback-echo; then
7923a0898aSmrg  # used as fallback echo
8023a0898aSmrg  shift
8123a0898aSmrg  cat <<EOF
8223a0898aSmrg$*
8323a0898aSmrgEOF
8423a0898aSmrg  exit $EXIT_SUCCESS
8523a0898aSmrgfi
8623a0898aSmrg
8723a0898aSmrgdefault_mode=
8823a0898aSmrghelp="Try \`$progname --help' for more information."
8923a0898aSmrgmagic="%%%MAGIC variable%%%"
9023a0898aSmrgmkdir="mkdir"
9123a0898aSmrgmv="mv -f"
9223a0898aSmrgrm="rm -f"
9323a0898aSmrg
9423a0898aSmrg# Sed substitution that helps us do robust quoting.  It backslashifies
9523a0898aSmrg# metacharacters that are still active within double-quoted strings.
9623a0898aSmrgXsed="${SED}"' -e 1s/^X//'
9723a0898aSmrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
9823a0898aSmrg# test EBCDIC or ASCII
9923a0898aSmrgcase `echo X|tr X '\101'` in
10023a0898aSmrg A) # ASCII based system
10123a0898aSmrg    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
10223a0898aSmrg  SP2NL='tr \040 \012'
10323a0898aSmrg  NL2SP='tr \015\012 \040\040'
10423a0898aSmrg  ;;
10523a0898aSmrg *) # EBCDIC based system
10623a0898aSmrg  SP2NL='tr \100 \n'
10723a0898aSmrg  NL2SP='tr \r\n \100\100'
10823a0898aSmrg  ;;
10923a0898aSmrgesac
11023a0898aSmrg
11123a0898aSmrg# NLS nuisances.
11223a0898aSmrg# Only set LANG and LC_ALL to C if already set.
11323a0898aSmrg# These must not be set unconditionally because not all systems understand
11423a0898aSmrg# e.g. LANG=C (notably SCO).
11523a0898aSmrg# We save the old values to restore during execute mode.
11623a0898aSmrgfor lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
11723a0898aSmrgdo
11823a0898aSmrg  eval "if test \"\${$lt_var+set}\" = set; then
11923a0898aSmrg	  save_$lt_var=\$$lt_var
12023a0898aSmrg	  $lt_var=C
12123a0898aSmrg	  export $lt_var
12223a0898aSmrg	fi"
12323a0898aSmrgdone
12423a0898aSmrg
12523a0898aSmrg# Make sure IFS has a sensible default
12623a0898aSmrglt_nl='
12723a0898aSmrg'
12823a0898aSmrgIFS=" 	$lt_nl"
12923a0898aSmrg
13023a0898aSmrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
13123a0898aSmrg  $echo "$modename: not configured to build any kind of library" 1>&2
13223a0898aSmrg  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
13323a0898aSmrg  exit $EXIT_FAILURE
13423a0898aSmrgfi
13523a0898aSmrg
13623a0898aSmrg# Global variables.
13723a0898aSmrgmode=$default_mode
13823a0898aSmrgnonopt=
13923a0898aSmrgprev=
14023a0898aSmrgprevopt=
14123a0898aSmrgrun=
14223a0898aSmrgshow="$echo"
14323a0898aSmrgshow_help=
14423a0898aSmrgexecute_dlfiles=
14523a0898aSmrgduplicate_deps=no
14623a0898aSmrgpreserve_args=
14723a0898aSmrglo2o="s/\\.lo\$/.${objext}/"
14823a0898aSmrgo2lo="s/\\.${objext}\$/.lo/"
14923a0898aSmrgextracted_archives=
15023a0898aSmrgextracted_serial=0
15123a0898aSmrg
15223a0898aSmrg#####################################
15323a0898aSmrg# Shell function definitions:
15423a0898aSmrg# This seems to be the best place for them
15523a0898aSmrg
15623a0898aSmrg# func_mktempdir [string]
15723a0898aSmrg# Make a temporary directory that won't clash with other running
15823a0898aSmrg# libtool processes, and avoids race conditions if possible.  If
15923a0898aSmrg# given, STRING is the basename for that directory.
16023a0898aSmrgfunc_mktempdir ()
16123a0898aSmrg{
16223a0898aSmrg    my_template="${TMPDIR-/tmp}/${1-$progname}"
16323a0898aSmrg
16423a0898aSmrg    if test "$run" = ":"; then
16523a0898aSmrg      # Return a directory name, but don't create it in dry-run mode
16623a0898aSmrg      my_tmpdir="${my_template}-$$"
16723a0898aSmrg    else
16823a0898aSmrg
16923a0898aSmrg      # If mktemp works, use that first and foremost
17023a0898aSmrg      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
17123a0898aSmrg
17223a0898aSmrg      if test ! -d "$my_tmpdir"; then
17323a0898aSmrg	# Failing that, at least try and use $RANDOM to avoid a race
17423a0898aSmrg	my_tmpdir="${my_template}-${RANDOM-0}$$"
17523a0898aSmrg
17623a0898aSmrg	save_mktempdir_umask=`umask`
17723a0898aSmrg	umask 0077
17823a0898aSmrg	$mkdir "$my_tmpdir"
17923a0898aSmrg	umask $save_mktempdir_umask
18023a0898aSmrg      fi
18123a0898aSmrg
18223a0898aSmrg      # If we're not in dry-run mode, bomb out on failure
18323a0898aSmrg      test -d "$my_tmpdir" || {
18423a0898aSmrg        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
18523a0898aSmrg	exit $EXIT_FAILURE
18623a0898aSmrg      }
18723a0898aSmrg    fi
18823a0898aSmrg
18923a0898aSmrg    $echo "X$my_tmpdir" | $Xsed
19023a0898aSmrg}
19123a0898aSmrg
19223a0898aSmrg
19323a0898aSmrg# func_win32_libid arg
19423a0898aSmrg# return the library type of file 'arg'
19523a0898aSmrg#
19623a0898aSmrg# Need a lot of goo to handle *both* DLLs and import libs
19723a0898aSmrg# Has to be a shell function in order to 'eat' the argument
19823a0898aSmrg# that is supplied when $file_magic_command is called.
19923a0898aSmrgfunc_win32_libid ()
20023a0898aSmrg{
20123a0898aSmrg  win32_libid_type="unknown"
20223a0898aSmrg  win32_fileres=`file -L $1 2>/dev/null`
20323a0898aSmrg  case $win32_fileres in
20423a0898aSmrg  *ar\ archive\ import\ library*) # definitely import
20523a0898aSmrg    win32_libid_type="x86 archive import"
20623a0898aSmrg    ;;
20723a0898aSmrg  *ar\ archive*) # could be an import, or static
20823a0898aSmrg    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
20923a0898aSmrg      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
21023a0898aSmrg      win32_nmres=`eval $NM -f posix -A $1 | \
21123a0898aSmrg	$SED -n -e '1,100{
21223a0898aSmrg		/ I /{
21323a0898aSmrg			s,.*,import,
21423a0898aSmrg			p
21523a0898aSmrg			q
21623a0898aSmrg			}
21723a0898aSmrg		}'`
21823a0898aSmrg      case $win32_nmres in
21923a0898aSmrg      import*)  win32_libid_type="x86 archive import";;
22023a0898aSmrg      *)        win32_libid_type="x86 archive static";;
22123a0898aSmrg      esac
22223a0898aSmrg    fi
22323a0898aSmrg    ;;
22423a0898aSmrg  *DLL*)
22523a0898aSmrg    win32_libid_type="x86 DLL"
22623a0898aSmrg    ;;
22723a0898aSmrg  *executable*) # but shell scripts are "executable" too...
22823a0898aSmrg    case $win32_fileres in
22923a0898aSmrg    *MS\ Windows\ PE\ Intel*)
23023a0898aSmrg      win32_libid_type="x86 DLL"
23123a0898aSmrg      ;;
23223a0898aSmrg    esac
23323a0898aSmrg    ;;
23423a0898aSmrg  esac
23523a0898aSmrg  $echo $win32_libid_type
23623a0898aSmrg}
23723a0898aSmrg
23823a0898aSmrg
23923a0898aSmrg# func_infer_tag arg
24023a0898aSmrg# Infer tagged configuration to use if any are available and
24123a0898aSmrg# if one wasn't chosen via the "--tag" command line option.
24223a0898aSmrg# Only attempt this if the compiler in the base compile
24323a0898aSmrg# command doesn't match the default compiler.
24423a0898aSmrg# arg is usually of the form 'gcc ...'
24523a0898aSmrgfunc_infer_tag ()
24623a0898aSmrg{
24723a0898aSmrg    if test -n "$available_tags" && test -z "$tagname"; then
24823a0898aSmrg      CC_quoted=
24923a0898aSmrg      for arg in $CC; do
25023a0898aSmrg	case $arg in
25123a0898aSmrg	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
25223a0898aSmrg	  arg="\"$arg\""
25323a0898aSmrg	  ;;
25423a0898aSmrg	esac
25523a0898aSmrg	CC_quoted="$CC_quoted $arg"
25623a0898aSmrg      done
25723a0898aSmrg      case $@ in
25823a0898aSmrg      # Blanks in the command may have been stripped by the calling shell,
25923a0898aSmrg      # but not from the CC environment variable when configure was run.
26023a0898aSmrg      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
26123a0898aSmrg      # Blanks at the start of $base_compile will cause this to fail
26223a0898aSmrg      # if we don't check for them as well.
26323a0898aSmrg      *)
26423a0898aSmrg	for z in $available_tags; do
26523a0898aSmrg	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
26623a0898aSmrg	    # Evaluate the configuration.
26723a0898aSmrg	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
26823a0898aSmrg	    CC_quoted=
26923a0898aSmrg	    for arg in $CC; do
27023a0898aSmrg	    # Double-quote args containing other shell metacharacters.
27123a0898aSmrg	    case $arg in
27223a0898aSmrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
27323a0898aSmrg	      arg="\"$arg\""
27423a0898aSmrg	      ;;
27523a0898aSmrg	    esac
27623a0898aSmrg	    CC_quoted="$CC_quoted $arg"
27723a0898aSmrg	  done
27823a0898aSmrg	    case "$@ " in
27923a0898aSmrg	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
28023a0898aSmrg	      # The compiler in the base compile command matches
28123a0898aSmrg	      # the one in the tagged configuration.
28223a0898aSmrg	      # Assume this is the tagged configuration we want.
28323a0898aSmrg	      tagname=$z
28423a0898aSmrg	      break
28523a0898aSmrg	      ;;
28623a0898aSmrg	    esac
28723a0898aSmrg	  fi
28823a0898aSmrg	done
28923a0898aSmrg	# If $tagname still isn't set, then no tagged configuration
29023a0898aSmrg	# was found and let the user know that the "--tag" command
29123a0898aSmrg	# line option must be used.
29223a0898aSmrg	if test -z "$tagname"; then
29323a0898aSmrg	  $echo "$modename: unable to infer tagged configuration"
29423a0898aSmrg	  $echo "$modename: specify a tag with \`--tag'" 1>&2
29523a0898aSmrg	  exit $EXIT_FAILURE
29623a0898aSmrg#        else
29723a0898aSmrg#          $echo "$modename: using $tagname tagged configuration"
29823a0898aSmrg	fi
29923a0898aSmrg	;;
30023a0898aSmrg      esac
30123a0898aSmrg    fi
30223a0898aSmrg}
30323a0898aSmrg
30423a0898aSmrg
30523a0898aSmrg# func_extract_an_archive dir oldlib
30623a0898aSmrgfunc_extract_an_archive ()
30723a0898aSmrg{
30823a0898aSmrg    f_ex_an_ar_dir="$1"; shift
30923a0898aSmrg    f_ex_an_ar_oldlib="$1"
31023a0898aSmrg
31123a0898aSmrg    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
31223a0898aSmrg    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
31323a0898aSmrg    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
31423a0898aSmrg     :
31523a0898aSmrg    else
31623a0898aSmrg      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
31723a0898aSmrg      exit $EXIT_FAILURE
31823a0898aSmrg    fi
31923a0898aSmrg}
32023a0898aSmrg
32123a0898aSmrg# func_extract_archives gentop oldlib ...
32223a0898aSmrgfunc_extract_archives ()
32323a0898aSmrg{
32423a0898aSmrg    my_gentop="$1"; shift
32523a0898aSmrg    my_oldlibs=${1+"$@"}
32623a0898aSmrg    my_oldobjs=""
32723a0898aSmrg    my_xlib=""
32823a0898aSmrg    my_xabs=""
32923a0898aSmrg    my_xdir=""
33023a0898aSmrg    my_status=""
33123a0898aSmrg
33223a0898aSmrg    $show "${rm}r $my_gentop"
33323a0898aSmrg    $run ${rm}r "$my_gentop"
33423a0898aSmrg    $show "$mkdir $my_gentop"
33523a0898aSmrg    $run $mkdir "$my_gentop"
33623a0898aSmrg    my_status=$?
33723a0898aSmrg    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
33823a0898aSmrg      exit $my_status
33923a0898aSmrg    fi
34023a0898aSmrg
34123a0898aSmrg    for my_xlib in $my_oldlibs; do
34223a0898aSmrg      # Extract the objects.
34323a0898aSmrg      case $my_xlib in
34423a0898aSmrg	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
34523a0898aSmrg	*) my_xabs=`pwd`"/$my_xlib" ;;
34623a0898aSmrg      esac
34723a0898aSmrg      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
34823a0898aSmrg      my_xlib_u=$my_xlib
34923a0898aSmrg      while :; do
35023a0898aSmrg        case " $extracted_archives " in
35123a0898aSmrg	*" $my_xlib_u "*)
35223a0898aSmrg	  extracted_serial=`expr $extracted_serial + 1`
35323a0898aSmrg	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
35423a0898aSmrg	*) break ;;
35523a0898aSmrg	esac
35623a0898aSmrg      done
35723a0898aSmrg      extracted_archives="$extracted_archives $my_xlib_u"
35823a0898aSmrg      my_xdir="$my_gentop/$my_xlib_u"
35923a0898aSmrg
36023a0898aSmrg      $show "${rm}r $my_xdir"
36123a0898aSmrg      $run ${rm}r "$my_xdir"
36223a0898aSmrg      $show "$mkdir $my_xdir"
36323a0898aSmrg      $run $mkdir "$my_xdir"
36423a0898aSmrg      exit_status=$?
36523a0898aSmrg      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
36623a0898aSmrg	exit $exit_status
36723a0898aSmrg      fi
36823a0898aSmrg      case $host in
36923a0898aSmrg      *-darwin*)
37023a0898aSmrg	$show "Extracting $my_xabs"
37123a0898aSmrg	# Do not bother doing anything if just a dry run
37223a0898aSmrg	if test -z "$run"; then
37323a0898aSmrg	  darwin_orig_dir=`pwd`
37423a0898aSmrg	  cd $my_xdir || exit $?
37523a0898aSmrg	  darwin_archive=$my_xabs
37623a0898aSmrg	  darwin_curdir=`pwd`
37723a0898aSmrg	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
37823a0898aSmrg	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
37923a0898aSmrg	  if test -n "$darwin_arches"; then 
38023a0898aSmrg	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
38123a0898aSmrg	    darwin_arch=
38223a0898aSmrg	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
38323a0898aSmrg	    for darwin_arch in  $darwin_arches ; do
38423a0898aSmrg	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
38523a0898aSmrg	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
38623a0898aSmrg	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
38723a0898aSmrg	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
38823a0898aSmrg	      cd "$darwin_curdir"
38923a0898aSmrg	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
39023a0898aSmrg	    done # $darwin_arches
39123a0898aSmrg      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
39223a0898aSmrg	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
39323a0898aSmrg	    darwin_file=
39423a0898aSmrg	    darwin_files=
39523a0898aSmrg	    for darwin_file in $darwin_filelist; do
39623a0898aSmrg	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
39723a0898aSmrg	      lipo -create -output "$darwin_file" $darwin_files
39823a0898aSmrg	    done # $darwin_filelist
39923a0898aSmrg	    ${rm}r unfat-$$
40023a0898aSmrg	    cd "$darwin_orig_dir"
40123a0898aSmrg	  else
40223a0898aSmrg	    cd "$darwin_orig_dir"
40323a0898aSmrg 	    func_extract_an_archive "$my_xdir" "$my_xabs"
40423a0898aSmrg	  fi # $darwin_arches
40523a0898aSmrg	fi # $run
40623a0898aSmrg	;;
40723a0898aSmrg      *)
40823a0898aSmrg        func_extract_an_archive "$my_xdir" "$my_xabs"
40923a0898aSmrg        ;;
41023a0898aSmrg      esac
41123a0898aSmrg      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
41223a0898aSmrg    done
41323a0898aSmrg    func_extract_archives_result="$my_oldobjs"
41423a0898aSmrg}
41523a0898aSmrg# End of Shell function definitions
41623a0898aSmrg#####################################
41723a0898aSmrg
41823a0898aSmrg# Darwin sucks
41923a0898aSmrgeval std_shrext=\"$shrext_cmds\"
42023a0898aSmrg
42123a0898aSmrgdisable_libs=no
42223a0898aSmrg
42323a0898aSmrg# Parse our command line options once, thoroughly.
42423a0898aSmrgwhile test "$#" -gt 0
42523a0898aSmrgdo
42623a0898aSmrg  arg="$1"
42723a0898aSmrg  shift
42823a0898aSmrg
42923a0898aSmrg  case $arg in
43023a0898aSmrg  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
43123a0898aSmrg  *) optarg= ;;
43223a0898aSmrg  esac
43323a0898aSmrg
43423a0898aSmrg  # If the previous option needs an argument, assign it.
43523a0898aSmrg  if test -n "$prev"; then
43623a0898aSmrg    case $prev in
43723a0898aSmrg    execute_dlfiles)
43823a0898aSmrg      execute_dlfiles="$execute_dlfiles $arg"
43923a0898aSmrg      ;;
44023a0898aSmrg    tag)
44123a0898aSmrg      tagname="$arg"
44223a0898aSmrg      preserve_args="${preserve_args}=$arg"
44323a0898aSmrg
44423a0898aSmrg      # Check whether tagname contains only valid characters
44523a0898aSmrg      case $tagname in
44623a0898aSmrg      *[!-_A-Za-z0-9,/]*)
44723a0898aSmrg	$echo "$progname: invalid tag name: $tagname" 1>&2
44823a0898aSmrg	exit $EXIT_FAILURE
44923a0898aSmrg	;;
45023a0898aSmrg      esac
45123a0898aSmrg
45223a0898aSmrg      case $tagname in
45323a0898aSmrg      CC)
45423a0898aSmrg	# Don't test for the "default" C tag, as we know, it's there, but
45523a0898aSmrg	# not specially marked.
45623a0898aSmrg	;;
45723a0898aSmrg      *)
45823a0898aSmrg	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
45923a0898aSmrg	  taglist="$taglist $tagname"
46023a0898aSmrg	  # Evaluate the configuration.
46123a0898aSmrg	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
46223a0898aSmrg	else
46323a0898aSmrg	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
46423a0898aSmrg	fi
46523a0898aSmrg	;;
46623a0898aSmrg      esac
46723a0898aSmrg      ;;
46823a0898aSmrg    *)
46923a0898aSmrg      eval "$prev=\$arg"
47023a0898aSmrg      ;;
47123a0898aSmrg    esac
47223a0898aSmrg
47323a0898aSmrg    prev=
47423a0898aSmrg    prevopt=
47523a0898aSmrg    continue
47623a0898aSmrg  fi
47723a0898aSmrg
47823a0898aSmrg  # Have we seen a non-optional argument yet?
47923a0898aSmrg  case $arg in
48023a0898aSmrg  --help)
48123a0898aSmrg    show_help=yes
48223a0898aSmrg    ;;
48323a0898aSmrg
48423a0898aSmrg  --version)
48523a0898aSmrg    echo "\
48623a0898aSmrg$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
48723a0898aSmrg
48823a0898aSmrgCopyright (C) 2007  Free Software Foundation, Inc.
48923a0898aSmrgThis is free software; see the source for copying conditions.  There is NO
49023a0898aSmrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
49123a0898aSmrg    exit $?
49223a0898aSmrg    ;;
49323a0898aSmrg
49423a0898aSmrg  --config)
49523a0898aSmrg    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
49623a0898aSmrg    # Now print the configurations for the tags.
49723a0898aSmrg    for tagname in $taglist; do
49823a0898aSmrg      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
49923a0898aSmrg    done
50023a0898aSmrg    exit $?
50123a0898aSmrg    ;;
50223a0898aSmrg
50323a0898aSmrg  --debug)
50423a0898aSmrg    $echo "$progname: enabling shell trace mode"
50523a0898aSmrg    set -x
50623a0898aSmrg    preserve_args="$preserve_args $arg"
50723a0898aSmrg    ;;
50823a0898aSmrg
50923a0898aSmrg  --dry-run | -n)
51023a0898aSmrg    run=:
51123a0898aSmrg    ;;
51223a0898aSmrg
51323a0898aSmrg  --features)
51423a0898aSmrg    $echo "host: $host"
51523a0898aSmrg    if test "$build_libtool_libs" = yes; then
51623a0898aSmrg      $echo "enable shared libraries"
51723a0898aSmrg    else
51823a0898aSmrg      $echo "disable shared libraries"
51923a0898aSmrg    fi
52023a0898aSmrg    if test "$build_old_libs" = yes; then
52123a0898aSmrg      $echo "enable static libraries"
52223a0898aSmrg    else
52323a0898aSmrg      $echo "disable static libraries"
52423a0898aSmrg    fi
52523a0898aSmrg    exit $?
52623a0898aSmrg    ;;
52723a0898aSmrg
52823a0898aSmrg  --finish) mode="finish" ;;
52923a0898aSmrg
53023a0898aSmrg  --mode) prevopt="--mode" prev=mode ;;
53123a0898aSmrg  --mode=*) mode="$optarg" ;;
53223a0898aSmrg
53323a0898aSmrg  --preserve-dup-deps) duplicate_deps="yes" ;;
53423a0898aSmrg
53523a0898aSmrg  --quiet | --silent)
53623a0898aSmrg    show=:
53723a0898aSmrg    preserve_args="$preserve_args $arg"
53823a0898aSmrg    ;;
53923a0898aSmrg
54023a0898aSmrg  --tag)
54123a0898aSmrg    prevopt="--tag"
54223a0898aSmrg    prev=tag
54323a0898aSmrg    preserve_args="$preserve_args --tag"
54423a0898aSmrg    ;;
54523a0898aSmrg  --tag=*)
54623a0898aSmrg    set tag "$optarg" ${1+"$@"}
54723a0898aSmrg    shift
54823a0898aSmrg    prev=tag
54923a0898aSmrg    preserve_args="$preserve_args --tag"
55023a0898aSmrg    ;;
55123a0898aSmrg
55223a0898aSmrg  -dlopen)
55323a0898aSmrg    prevopt="-dlopen"
55423a0898aSmrg    prev=execute_dlfiles
55523a0898aSmrg    ;;
55623a0898aSmrg
55723a0898aSmrg  -*)
55823a0898aSmrg    $echo "$modename: unrecognized option \`$arg'" 1>&2
55923a0898aSmrg    $echo "$help" 1>&2
56023a0898aSmrg    exit $EXIT_FAILURE
56123a0898aSmrg    ;;
56223a0898aSmrg
56323a0898aSmrg  *)
56423a0898aSmrg    nonopt="$arg"
56523a0898aSmrg    break
56623a0898aSmrg    ;;
56723a0898aSmrg  esac
56823a0898aSmrgdone
56923a0898aSmrg
57023a0898aSmrgif test -n "$prevopt"; then
57123a0898aSmrg  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
57223a0898aSmrg  $echo "$help" 1>&2
57323a0898aSmrg  exit $EXIT_FAILURE
57423a0898aSmrgfi
57523a0898aSmrg
57623a0898aSmrgcase $disable_libs in
57723a0898aSmrgno) 
57823a0898aSmrg  ;;
57923a0898aSmrgshared)
58023a0898aSmrg  build_libtool_libs=no
58123a0898aSmrg  build_old_libs=yes
58223a0898aSmrg  ;;
58323a0898aSmrgstatic)
58423a0898aSmrg  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
58523a0898aSmrg  ;;
58623a0898aSmrgesac
58723a0898aSmrg
58823a0898aSmrg# If this variable is set in any of the actions, the command in it
58923a0898aSmrg# will be execed at the end.  This prevents here-documents from being
59023a0898aSmrg# left over by shells.
59123a0898aSmrgexec_cmd=
59223a0898aSmrg
59323a0898aSmrgif test -z "$show_help"; then
59423a0898aSmrg
59523a0898aSmrg  # Infer the operation mode.
59623a0898aSmrg  if test -z "$mode"; then
59723a0898aSmrg    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
59823a0898aSmrg    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
59923a0898aSmrg    case $nonopt in
60023a0898aSmrg    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
60123a0898aSmrg      mode=link
60223a0898aSmrg      for arg
60323a0898aSmrg      do
60423a0898aSmrg	case $arg in
60523a0898aSmrg	-c)
60623a0898aSmrg	   mode=compile
60723a0898aSmrg	   break
60823a0898aSmrg	   ;;
60923a0898aSmrg	esac
61023a0898aSmrg      done
61123a0898aSmrg      ;;
61223a0898aSmrg    *db | *dbx | *strace | *truss)
61323a0898aSmrg      mode=execute
61423a0898aSmrg      ;;
61523a0898aSmrg    *install*|cp|mv)
61623a0898aSmrg      mode=install
61723a0898aSmrg      ;;
61823a0898aSmrg    *rm)
61923a0898aSmrg      mode=uninstall
62023a0898aSmrg      ;;
62123a0898aSmrg    *)
62223a0898aSmrg      # If we have no mode, but dlfiles were specified, then do execute mode.
62323a0898aSmrg      test -n "$execute_dlfiles" && mode=execute
62423a0898aSmrg
62523a0898aSmrg      # Just use the default operation mode.
62623a0898aSmrg      if test -z "$mode"; then
62723a0898aSmrg	if test -n "$nonopt"; then
62823a0898aSmrg	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
62923a0898aSmrg	else
63023a0898aSmrg	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
63123a0898aSmrg	fi
63223a0898aSmrg      fi
63323a0898aSmrg      ;;
63423a0898aSmrg    esac
63523a0898aSmrg  fi
63623a0898aSmrg
63723a0898aSmrg  # Only execute mode is allowed to have -dlopen flags.
63823a0898aSmrg  if test -n "$execute_dlfiles" && test "$mode" != execute; then
63923a0898aSmrg    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
64023a0898aSmrg    $echo "$help" 1>&2
64123a0898aSmrg    exit $EXIT_FAILURE
64223a0898aSmrg  fi
64323a0898aSmrg
64423a0898aSmrg  # Change the help message to a mode-specific one.
64523a0898aSmrg  generic_help="$help"
64623a0898aSmrg  help="Try \`$modename --help --mode=$mode' for more information."
64723a0898aSmrg
64823a0898aSmrg  # These modes are in order of execution frequency so that they run quickly.
64923a0898aSmrg  case $mode in
65023a0898aSmrg  # libtool compile mode
65123a0898aSmrg  compile)
65223a0898aSmrg    modename="$modename: compile"
65323a0898aSmrg    # Get the compilation command and the source file.
65423a0898aSmrg    base_compile=
65523a0898aSmrg    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
65623a0898aSmrg    suppress_opt=yes
65723a0898aSmrg    suppress_output=
65823a0898aSmrg    arg_mode=normal
65923a0898aSmrg    libobj=
66023a0898aSmrg    later=
66123a0898aSmrg
66223a0898aSmrg    for arg
66323a0898aSmrg    do
66423a0898aSmrg      case $arg_mode in
66523a0898aSmrg      arg  )
66623a0898aSmrg	# do not "continue".  Instead, add this to base_compile
66723a0898aSmrg	lastarg="$arg"
66823a0898aSmrg	arg_mode=normal
66923a0898aSmrg	;;
67023a0898aSmrg
67123a0898aSmrg      target )
67223a0898aSmrg	libobj="$arg"
67323a0898aSmrg	arg_mode=normal
67423a0898aSmrg	continue
67523a0898aSmrg	;;
67623a0898aSmrg
67723a0898aSmrg      normal )
67823a0898aSmrg	# Accept any command-line options.
67923a0898aSmrg	case $arg in
68023a0898aSmrg	-o)
68123a0898aSmrg	  if test -n "$libobj" ; then
68223a0898aSmrg	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
68323a0898aSmrg	    exit $EXIT_FAILURE
68423a0898aSmrg	  fi
68523a0898aSmrg	  arg_mode=target
68623a0898aSmrg	  continue
68723a0898aSmrg	  ;;
68823a0898aSmrg
68923a0898aSmrg	-static | -prefer-pic | -prefer-non-pic)
69023a0898aSmrg	  later="$later $arg"
69123a0898aSmrg	  continue
69223a0898aSmrg	  ;;
69323a0898aSmrg
69423a0898aSmrg	-no-suppress)
69523a0898aSmrg	  suppress_opt=no
69623a0898aSmrg	  continue
69723a0898aSmrg	  ;;
69823a0898aSmrg
69923a0898aSmrg	-Xcompiler)
70023a0898aSmrg	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
70123a0898aSmrg	  continue      #  The current "srcfile" will either be retained or
70223a0898aSmrg	  ;;            #  replaced later.  I would guess that would be a bug.
70323a0898aSmrg
70423a0898aSmrg	-Wc,*)
70523a0898aSmrg	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
70623a0898aSmrg	  lastarg=
70723a0898aSmrg	  save_ifs="$IFS"; IFS=','
70823a0898aSmrg 	  for arg in $args; do
70923a0898aSmrg	    IFS="$save_ifs"
71023a0898aSmrg
71123a0898aSmrg	    # Double-quote args containing other shell metacharacters.
71223a0898aSmrg	    # Many Bourne shells cannot handle close brackets correctly
71323a0898aSmrg	    # in scan sets, so we specify it separately.
71423a0898aSmrg	    case $arg in
71523a0898aSmrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
71623a0898aSmrg	      arg="\"$arg\""
71723a0898aSmrg	      ;;
71823a0898aSmrg	    esac
71923a0898aSmrg	    lastarg="$lastarg $arg"
72023a0898aSmrg	  done
72123a0898aSmrg	  IFS="$save_ifs"
72223a0898aSmrg	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
72323a0898aSmrg
72423a0898aSmrg	  # Add the arguments to base_compile.
72523a0898aSmrg	  base_compile="$base_compile $lastarg"
72623a0898aSmrg	  continue
72723a0898aSmrg	  ;;
72823a0898aSmrg
72923a0898aSmrg	* )
73023a0898aSmrg	  # Accept the current argument as the source file.
73123a0898aSmrg	  # The previous "srcfile" becomes the current argument.
73223a0898aSmrg	  #
73323a0898aSmrg	  lastarg="$srcfile"
73423a0898aSmrg	  srcfile="$arg"
73523a0898aSmrg	  ;;
73623a0898aSmrg	esac  #  case $arg
73723a0898aSmrg	;;
73823a0898aSmrg      esac    #  case $arg_mode
73923a0898aSmrg
74023a0898aSmrg      # Aesthetically quote the previous argument.
74123a0898aSmrg      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
74223a0898aSmrg
74323a0898aSmrg      case $lastarg in
74423a0898aSmrg      # Double-quote args containing other shell metacharacters.
74523a0898aSmrg      # Many Bourne shells cannot handle close brackets correctly
74623a0898aSmrg      # in scan sets, and some SunOS ksh mistreat backslash-escaping
74723a0898aSmrg      # in scan sets (worked around with variable expansion),
74823a0898aSmrg      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
74923a0898aSmrg      # at all, so we specify them separately.
75023a0898aSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
75123a0898aSmrg	lastarg="\"$lastarg\""
75223a0898aSmrg	;;
75323a0898aSmrg      esac
75423a0898aSmrg
75523a0898aSmrg      base_compile="$base_compile $lastarg"
75623a0898aSmrg    done # for arg
75723a0898aSmrg
75823a0898aSmrg    case $arg_mode in
75923a0898aSmrg    arg)
76023a0898aSmrg      $echo "$modename: you must specify an argument for -Xcompile"
76123a0898aSmrg      exit $EXIT_FAILURE
76223a0898aSmrg      ;;
76323a0898aSmrg    target)
76423a0898aSmrg      $echo "$modename: you must specify a target with \`-o'" 1>&2
76523a0898aSmrg      exit $EXIT_FAILURE
76623a0898aSmrg      ;;
76723a0898aSmrg    *)
76823a0898aSmrg      # Get the name of the library object.
76923a0898aSmrg      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
77023a0898aSmrg      ;;
77123a0898aSmrg    esac
77223a0898aSmrg
77323a0898aSmrg    # Recognize several different file suffixes.
77423a0898aSmrg    # If the user specifies -o file.o, it is replaced with file.lo
77523a0898aSmrg    xform='[cCFSifmso]'
77623a0898aSmrg    case $libobj in
77723a0898aSmrg    *.ada) xform=ada ;;
77823a0898aSmrg    *.adb) xform=adb ;;
77923a0898aSmrg    *.ads) xform=ads ;;
78023a0898aSmrg    *.asm) xform=asm ;;
78123a0898aSmrg    *.c++) xform=c++ ;;
78223a0898aSmrg    *.cc) xform=cc ;;
78323a0898aSmrg    *.ii) xform=ii ;;
78423a0898aSmrg    *.class) xform=class ;;
78523a0898aSmrg    *.cpp) xform=cpp ;;
78623a0898aSmrg    *.cxx) xform=cxx ;;
78723a0898aSmrg    *.[fF][09]?) xform=[fF][09]. ;;
78823a0898aSmrg    *.for) xform=for ;;
78923a0898aSmrg    *.java) xform=java ;;
79023a0898aSmrg    *.obj) xform=obj ;;
79123a0898aSmrg    esac
79223a0898aSmrg
79323a0898aSmrg    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
79423a0898aSmrg
79523a0898aSmrg    case $libobj in
79623a0898aSmrg    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
79723a0898aSmrg    *)
79823a0898aSmrg      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
79923a0898aSmrg      exit $EXIT_FAILURE
80023a0898aSmrg      ;;
80123a0898aSmrg    esac
80223a0898aSmrg
80323a0898aSmrg    func_infer_tag $base_compile
80423a0898aSmrg
80523a0898aSmrg    for arg in $later; do
80623a0898aSmrg      case $arg in
80723a0898aSmrg      -static)
80823a0898aSmrg	build_old_libs=yes
80923a0898aSmrg	continue
81023a0898aSmrg	;;
81123a0898aSmrg
81223a0898aSmrg      -prefer-pic)
81323a0898aSmrg	pic_mode=yes
81423a0898aSmrg	continue
81523a0898aSmrg	;;
81623a0898aSmrg
81723a0898aSmrg      -prefer-non-pic)
81823a0898aSmrg	pic_mode=no
81923a0898aSmrg	continue
82023a0898aSmrg	;;
82123a0898aSmrg      esac
82223a0898aSmrg    done
82323a0898aSmrg
82423a0898aSmrg    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
82523a0898aSmrg    case $qlibobj in
82623a0898aSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
82723a0898aSmrg	qlibobj="\"$qlibobj\"" ;;
82823a0898aSmrg    esac
82923a0898aSmrg    test "X$libobj" != "X$qlibobj" \
83023a0898aSmrg	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
83123a0898aSmrg	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
83223a0898aSmrg    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
83323a0898aSmrg    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
83423a0898aSmrg    if test "X$xdir" = "X$obj"; then
83523a0898aSmrg      xdir=
83623a0898aSmrg    else
83723a0898aSmrg      xdir=$xdir/
83823a0898aSmrg    fi
83923a0898aSmrg    lobj=${xdir}$objdir/$objname
84023a0898aSmrg
84123a0898aSmrg    if test -z "$base_compile"; then
84223a0898aSmrg      $echo "$modename: you must specify a compilation command" 1>&2
84323a0898aSmrg      $echo "$help" 1>&2
84423a0898aSmrg      exit $EXIT_FAILURE
84523a0898aSmrg    fi
84623a0898aSmrg
84723a0898aSmrg    # Delete any leftover library objects.
84823a0898aSmrg    if test "$build_old_libs" = yes; then
84923a0898aSmrg      removelist="$obj $lobj $libobj ${libobj}T"
85023a0898aSmrg    else
85123a0898aSmrg      removelist="$lobj $libobj ${libobj}T"
85223a0898aSmrg    fi
85323a0898aSmrg
85423a0898aSmrg    $run $rm $removelist
85523a0898aSmrg    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
85623a0898aSmrg
85723a0898aSmrg    # On Cygwin there's no "real" PIC flag so we must build both object types
85823a0898aSmrg    case $host_os in
85923a0898aSmrg    cygwin* | mingw* | pw32* | os2*)
86023a0898aSmrg      pic_mode=default
86123a0898aSmrg      ;;
86223a0898aSmrg    esac
86323a0898aSmrg    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
86423a0898aSmrg      # non-PIC code in shared libraries is not supported
86523a0898aSmrg      pic_mode=default
86623a0898aSmrg    fi
86723a0898aSmrg
86823a0898aSmrg    # Calculate the filename of the output object if compiler does
86923a0898aSmrg    # not support -o with -c
87023a0898aSmrg    if test "$compiler_c_o" = no; then
87123a0898aSmrg      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
87223a0898aSmrg      lockfile="$output_obj.lock"
87323a0898aSmrg      removelist="$removelist $output_obj $lockfile"
87423a0898aSmrg      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
87523a0898aSmrg    else
87623a0898aSmrg      output_obj=
87723a0898aSmrg      need_locks=no
87823a0898aSmrg      lockfile=
87923a0898aSmrg    fi
88023a0898aSmrg
88123a0898aSmrg    # Lock this critical section if it is needed
88223a0898aSmrg    # We use this script file to make the link, it avoids creating a new file
88323a0898aSmrg    if test "$need_locks" = yes; then
88423a0898aSmrg      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
88523a0898aSmrg	$show "Waiting for $lockfile to be removed"
88623a0898aSmrg	sleep 2
88723a0898aSmrg      done
88823a0898aSmrg    elif test "$need_locks" = warn; then
88923a0898aSmrg      if test -f "$lockfile"; then
89023a0898aSmrg	$echo "\
89123a0898aSmrg*** ERROR, $lockfile exists and contains:
89223a0898aSmrg`cat $lockfile 2>/dev/null`
89323a0898aSmrg
89423a0898aSmrgThis indicates that another process is trying to use the same
89523a0898aSmrgtemporary object file, and libtool could not work around it because
89623a0898aSmrgyour compiler does not support \`-c' and \`-o' together.  If you
89723a0898aSmrgrepeat this compilation, it may succeed, by chance, but you had better
89823a0898aSmrgavoid parallel builds (make -j) in this platform, or get a better
89923a0898aSmrgcompiler."
90023a0898aSmrg
90123a0898aSmrg	$run $rm $removelist
90223a0898aSmrg	exit $EXIT_FAILURE
90323a0898aSmrg      fi
90423a0898aSmrg      $echo "$srcfile" > "$lockfile"
90523a0898aSmrg    fi
90623a0898aSmrg
90723a0898aSmrg    if test -n "$fix_srcfile_path"; then
90823a0898aSmrg      eval srcfile=\"$fix_srcfile_path\"
90923a0898aSmrg    fi
91023a0898aSmrg    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
91123a0898aSmrg    case $qsrcfile in
91223a0898aSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
91323a0898aSmrg      qsrcfile="\"$qsrcfile\"" ;;
91423a0898aSmrg    esac
91523a0898aSmrg
91623a0898aSmrg    $run $rm "$libobj" "${libobj}T"
91723a0898aSmrg
91823a0898aSmrg    # Create a libtool object file (analogous to a ".la" file),
91923a0898aSmrg    # but don't create it if we're doing a dry run.
92023a0898aSmrg    test -z "$run" && cat > ${libobj}T <<EOF
92123a0898aSmrg# $libobj - a libtool object file
92223a0898aSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
92323a0898aSmrg#
92423a0898aSmrg# Please DO NOT delete this file!
92523a0898aSmrg# It is necessary for linking the library.
92623a0898aSmrg
92723a0898aSmrg# Name of the PIC object.
92823a0898aSmrgEOF
92923a0898aSmrg
93023a0898aSmrg    # Only build a PIC object if we are building libtool libraries.
93123a0898aSmrg    if test "$build_libtool_libs" = yes; then
93223a0898aSmrg      # Without this assignment, base_compile gets emptied.
93323a0898aSmrg      fbsd_hideous_sh_bug=$base_compile
93423a0898aSmrg
93523a0898aSmrg      if test "$pic_mode" != no; then
93623a0898aSmrg	command="$base_compile $qsrcfile $pic_flag"
93723a0898aSmrg      else
93823a0898aSmrg	# Don't build PIC code
93923a0898aSmrg	command="$base_compile $qsrcfile"
94023a0898aSmrg      fi
94123a0898aSmrg
94223a0898aSmrg      if test ! -d "${xdir}$objdir"; then
94323a0898aSmrg	$show "$mkdir ${xdir}$objdir"
94423a0898aSmrg	$run $mkdir ${xdir}$objdir
94523a0898aSmrg	exit_status=$?
94623a0898aSmrg	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
94723a0898aSmrg	  exit $exit_status
94823a0898aSmrg	fi
94923a0898aSmrg      fi
95023a0898aSmrg
95123a0898aSmrg      if test -z "$output_obj"; then
95223a0898aSmrg	# Place PIC objects in $objdir
95323a0898aSmrg	command="$command -o $lobj"
95423a0898aSmrg      fi
95523a0898aSmrg
95623a0898aSmrg      $run $rm "$lobj" "$output_obj"
95723a0898aSmrg
95823a0898aSmrg      $show "$command"
95923a0898aSmrg      if $run eval "$command"; then :
96023a0898aSmrg      else
96123a0898aSmrg	test -n "$output_obj" && $run $rm $removelist
96223a0898aSmrg	exit $EXIT_FAILURE
96323a0898aSmrg      fi
96423a0898aSmrg
96523a0898aSmrg      if test "$need_locks" = warn &&
96623a0898aSmrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
96723a0898aSmrg	$echo "\
96823a0898aSmrg*** ERROR, $lockfile contains:
96923a0898aSmrg`cat $lockfile 2>/dev/null`
97023a0898aSmrg
97123a0898aSmrgbut it should contain:
97223a0898aSmrg$srcfile
97323a0898aSmrg
97423a0898aSmrgThis indicates that another process is trying to use the same
97523a0898aSmrgtemporary object file, and libtool could not work around it because
97623a0898aSmrgyour compiler does not support \`-c' and \`-o' together.  If you
97723a0898aSmrgrepeat this compilation, it may succeed, by chance, but you had better
97823a0898aSmrgavoid parallel builds (make -j) in this platform, or get a better
97923a0898aSmrgcompiler."
98023a0898aSmrg
98123a0898aSmrg	$run $rm $removelist
98223a0898aSmrg	exit $EXIT_FAILURE
98323a0898aSmrg      fi
98423a0898aSmrg
98523a0898aSmrg      # Just move the object if needed, then go on to compile the next one
98623a0898aSmrg      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
98723a0898aSmrg	$show "$mv $output_obj $lobj"
98823a0898aSmrg	if $run $mv $output_obj $lobj; then :
98923a0898aSmrg	else
99023a0898aSmrg	  error=$?
99123a0898aSmrg	  $run $rm $removelist
99223a0898aSmrg	  exit $error
99323a0898aSmrg	fi
99423a0898aSmrg      fi
99523a0898aSmrg
99623a0898aSmrg      # Append the name of the PIC object to the libtool object file.
99723a0898aSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
99823a0898aSmrgpic_object='$objdir/$objname'
99923a0898aSmrg
100023a0898aSmrgEOF
100123a0898aSmrg
100223a0898aSmrg      # Allow error messages only from the first compilation.
100323a0898aSmrg      if test "$suppress_opt" = yes; then
100423a0898aSmrg        suppress_output=' >/dev/null 2>&1'
100523a0898aSmrg      fi
100623a0898aSmrg    else
100723a0898aSmrg      # No PIC object so indicate it doesn't exist in the libtool
100823a0898aSmrg      # object file.
100923a0898aSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
101023a0898aSmrgpic_object=none
101123a0898aSmrg
101223a0898aSmrgEOF
101323a0898aSmrg    fi
101423a0898aSmrg
101523a0898aSmrg    # Only build a position-dependent object if we build old libraries.
101623a0898aSmrg    if test "$build_old_libs" = yes; then
101723a0898aSmrg      if test "$pic_mode" != yes; then
101823a0898aSmrg	# Don't build PIC code
101923a0898aSmrg	command="$base_compile $qsrcfile"
102023a0898aSmrg      else
102123a0898aSmrg	command="$base_compile $qsrcfile $pic_flag"
102223a0898aSmrg      fi
102323a0898aSmrg      if test "$compiler_c_o" = yes; then
102423a0898aSmrg	command="$command -o $obj"
102523a0898aSmrg      fi
102623a0898aSmrg
102723a0898aSmrg      # Suppress compiler output if we already did a PIC compilation.
102823a0898aSmrg      command="$command$suppress_output"
102923a0898aSmrg      $run $rm "$obj" "$output_obj"
103023a0898aSmrg      $show "$command"
103123a0898aSmrg      if $run eval "$command"; then :
103223a0898aSmrg      else
103323a0898aSmrg	$run $rm $removelist
103423a0898aSmrg	exit $EXIT_FAILURE
103523a0898aSmrg      fi
103623a0898aSmrg
103723a0898aSmrg      if test "$need_locks" = warn &&
103823a0898aSmrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
103923a0898aSmrg	$echo "\
104023a0898aSmrg*** ERROR, $lockfile contains:
104123a0898aSmrg`cat $lockfile 2>/dev/null`
104223a0898aSmrg
104323a0898aSmrgbut it should contain:
104423a0898aSmrg$srcfile
104523a0898aSmrg
104623a0898aSmrgThis indicates that another process is trying to use the same
104723a0898aSmrgtemporary object file, and libtool could not work around it because
104823a0898aSmrgyour compiler does not support \`-c' and \`-o' together.  If you
104923a0898aSmrgrepeat this compilation, it may succeed, by chance, but you had better
105023a0898aSmrgavoid parallel builds (make -j) in this platform, or get a better
105123a0898aSmrgcompiler."
105223a0898aSmrg
105323a0898aSmrg	$run $rm $removelist
105423a0898aSmrg	exit $EXIT_FAILURE
105523a0898aSmrg      fi
105623a0898aSmrg
105723a0898aSmrg      # Just move the object if needed
105823a0898aSmrg      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
105923a0898aSmrg	$show "$mv $output_obj $obj"
106023a0898aSmrg	if $run $mv $output_obj $obj; then :
106123a0898aSmrg	else
106223a0898aSmrg	  error=$?
106323a0898aSmrg	  $run $rm $removelist
106423a0898aSmrg	  exit $error
106523a0898aSmrg	fi
106623a0898aSmrg      fi
106723a0898aSmrg
106823a0898aSmrg      # Append the name of the non-PIC object the libtool object file.
106923a0898aSmrg      # Only append if the libtool object file exists.
107023a0898aSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
107123a0898aSmrg# Name of the non-PIC object.
107223a0898aSmrgnon_pic_object='$objname'
107323a0898aSmrg
107423a0898aSmrgEOF
107523a0898aSmrg    else
107623a0898aSmrg      # Append the name of the non-PIC object the libtool object file.
107723a0898aSmrg      # Only append if the libtool object file exists.
107823a0898aSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
107923a0898aSmrg# Name of the non-PIC object.
108023a0898aSmrgnon_pic_object=none
108123a0898aSmrg
108223a0898aSmrgEOF
108323a0898aSmrg    fi
108423a0898aSmrg
108523a0898aSmrg    $run $mv "${libobj}T" "${libobj}"
108623a0898aSmrg
108723a0898aSmrg    # Unlock the critical section if it was locked
108823a0898aSmrg    if test "$need_locks" != no; then
108923a0898aSmrg      $run $rm "$lockfile"
109023a0898aSmrg    fi
109123a0898aSmrg
109223a0898aSmrg    exit $EXIT_SUCCESS
109323a0898aSmrg    ;;
109423a0898aSmrg
109523a0898aSmrg  # libtool link mode
109623a0898aSmrg  link | relink)
109723a0898aSmrg    modename="$modename: link"
109823a0898aSmrg    case $host in
109923a0898aSmrg    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
110023a0898aSmrg      # It is impossible to link a dll without this setting, and
110123a0898aSmrg      # we shouldn't force the makefile maintainer to figure out
110223a0898aSmrg      # which system we are compiling for in order to pass an extra
110323a0898aSmrg      # flag for every libtool invocation.
110423a0898aSmrg      # allow_undefined=no
110523a0898aSmrg
110623a0898aSmrg      # FIXME: Unfortunately, there are problems with the above when trying
110723a0898aSmrg      # to make a dll which has undefined symbols, in which case not
110823a0898aSmrg      # even a static library is built.  For now, we need to specify
110923a0898aSmrg      # -no-undefined on the libtool link line when we can be certain
111023a0898aSmrg      # that all symbols are satisfied, otherwise we get a static library.
111123a0898aSmrg      allow_undefined=yes
111223a0898aSmrg      ;;
111323a0898aSmrg    *)
111423a0898aSmrg      allow_undefined=yes
111523a0898aSmrg      ;;
111623a0898aSmrg    esac
111723a0898aSmrg    libtool_args="$nonopt"
111823a0898aSmrg    base_compile="$nonopt $@"
111923a0898aSmrg    compile_command="$nonopt"
112023a0898aSmrg    finalize_command="$nonopt"
112123a0898aSmrg
112223a0898aSmrg    compile_rpath=
112323a0898aSmrg    finalize_rpath=
112423a0898aSmrg    compile_shlibpath=
112523a0898aSmrg    finalize_shlibpath=
112623a0898aSmrg    convenience=
112723a0898aSmrg    old_convenience=
112823a0898aSmrg    deplibs=
112923a0898aSmrg    old_deplibs=
113023a0898aSmrg    compiler_flags=
113123a0898aSmrg    linker_flags=
113223a0898aSmrg    dllsearchpath=
113323a0898aSmrg    lib_search_path=`pwd`
113423a0898aSmrg    inst_prefix_dir=
113523a0898aSmrg
113623a0898aSmrg    avoid_version=no
113723a0898aSmrg    dlfiles=
113823a0898aSmrg    dlprefiles=
113923a0898aSmrg    dlself=no
114023a0898aSmrg    export_dynamic=no
114123a0898aSmrg    export_symbols=
114223a0898aSmrg    export_symbols_regex=
114323a0898aSmrg    generated=
114423a0898aSmrg    libobjs=
114523a0898aSmrg    ltlibs=
114623a0898aSmrg    module=no
114723a0898aSmrg    no_install=no
114823a0898aSmrg    objs=
114923a0898aSmrg    non_pic_objects=
115023a0898aSmrg    notinst_path= # paths that contain not-installed libtool libraries
115123a0898aSmrg    precious_files_regex=
115223a0898aSmrg    prefer_static_libs=no
115323a0898aSmrg    preload=no
115423a0898aSmrg    prev=
115523a0898aSmrg    prevarg=
115623a0898aSmrg    release=
115723a0898aSmrg    rpath=
115823a0898aSmrg    xrpath=
115923a0898aSmrg    perm_rpath=
116023a0898aSmrg    temp_rpath=
116123a0898aSmrg    thread_safe=no
116223a0898aSmrg    vinfo=
116323a0898aSmrg    vinfo_number=no
116423a0898aSmrg
116523a0898aSmrg    func_infer_tag $base_compile
116623a0898aSmrg
116723a0898aSmrg    # We need to know -static, to get the right output filenames.
116823a0898aSmrg    for arg
116923a0898aSmrg    do
117023a0898aSmrg      case $arg in
117123a0898aSmrg      -all-static | -static | -static-libtool-libs)
117223a0898aSmrg	case $arg in
117323a0898aSmrg	-all-static)
117423a0898aSmrg	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
117523a0898aSmrg	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
117623a0898aSmrg	  fi
117723a0898aSmrg	  if test -n "$link_static_flag"; then
117823a0898aSmrg	    dlopen_self=$dlopen_self_static
117923a0898aSmrg	  fi
118023a0898aSmrg	  prefer_static_libs=yes
118123a0898aSmrg	  ;;
118223a0898aSmrg	-static)
118323a0898aSmrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
118423a0898aSmrg	    dlopen_self=$dlopen_self_static
118523a0898aSmrg	  fi
118623a0898aSmrg	  prefer_static_libs=built
118723a0898aSmrg	  ;;
118823a0898aSmrg	-static-libtool-libs)
118923a0898aSmrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
119023a0898aSmrg	    dlopen_self=$dlopen_self_static
119123a0898aSmrg	  fi
119223a0898aSmrg	  prefer_static_libs=yes
119323a0898aSmrg	  ;;
119423a0898aSmrg	esac
119523a0898aSmrg	build_libtool_libs=no
119623a0898aSmrg	build_old_libs=yes
119723a0898aSmrg	break
119823a0898aSmrg	;;
119923a0898aSmrg      esac
120023a0898aSmrg    done
120123a0898aSmrg
120223a0898aSmrg    # See if our shared archives depend on static archives.
120323a0898aSmrg    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
120423a0898aSmrg
120523a0898aSmrg    # Go through the arguments, transforming them on the way.
120623a0898aSmrg    while test "$#" -gt 0; do
120723a0898aSmrg      arg="$1"
120823a0898aSmrg      shift
120923a0898aSmrg      case $arg in
121023a0898aSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
121123a0898aSmrg	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
121223a0898aSmrg	;;
121323a0898aSmrg      *) qarg=$arg ;;
121423a0898aSmrg      esac
121523a0898aSmrg      libtool_args="$libtool_args $qarg"
121623a0898aSmrg
121723a0898aSmrg      # If the previous option needs an argument, assign it.
121823a0898aSmrg      if test -n "$prev"; then
121923a0898aSmrg	case $prev in
122023a0898aSmrg	output)
122123a0898aSmrg	  compile_command="$compile_command @OUTPUT@"
122223a0898aSmrg	  finalize_command="$finalize_command @OUTPUT@"
122323a0898aSmrg	  ;;
122423a0898aSmrg	esac
122523a0898aSmrg
122623a0898aSmrg	case $prev in
122723a0898aSmrg	dlfiles|dlprefiles)
122823a0898aSmrg	  if test "$preload" = no; then
122923a0898aSmrg	    # Add the symbol object into the linking commands.
123023a0898aSmrg	    compile_command="$compile_command @SYMFILE@"
123123a0898aSmrg	    finalize_command="$finalize_command @SYMFILE@"
123223a0898aSmrg	    preload=yes
123323a0898aSmrg	  fi
123423a0898aSmrg	  case $arg in
123523a0898aSmrg	  *.la | *.lo) ;;  # We handle these cases below.
123623a0898aSmrg	  force)
123723a0898aSmrg	    if test "$dlself" = no; then
123823a0898aSmrg	      dlself=needless
123923a0898aSmrg	      export_dynamic=yes
124023a0898aSmrg	    fi
124123a0898aSmrg	    prev=
124223a0898aSmrg	    continue
124323a0898aSmrg	    ;;
124423a0898aSmrg	  self)
124523a0898aSmrg	    if test "$prev" = dlprefiles; then
124623a0898aSmrg	      dlself=yes
124723a0898aSmrg	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
124823a0898aSmrg	      dlself=yes
124923a0898aSmrg	    else
125023a0898aSmrg	      dlself=needless
125123a0898aSmrg	      export_dynamic=yes
125223a0898aSmrg	    fi
125323a0898aSmrg	    prev=
125423a0898aSmrg	    continue
125523a0898aSmrg	    ;;
125623a0898aSmrg	  *)
125723a0898aSmrg	    if test "$prev" = dlfiles; then
125823a0898aSmrg	      dlfiles="$dlfiles $arg"
125923a0898aSmrg	    else
126023a0898aSmrg	      dlprefiles="$dlprefiles $arg"
126123a0898aSmrg	    fi
126223a0898aSmrg	    prev=
126323a0898aSmrg	    continue
126423a0898aSmrg	    ;;
126523a0898aSmrg	  esac
126623a0898aSmrg	  ;;
126723a0898aSmrg	expsyms)
126823a0898aSmrg	  export_symbols="$arg"
126923a0898aSmrg	  if test ! -f "$arg"; then
127023a0898aSmrg	    $echo "$modename: symbol file \`$arg' does not exist"
127123a0898aSmrg	    exit $EXIT_FAILURE
127223a0898aSmrg	  fi
127323a0898aSmrg	  prev=
127423a0898aSmrg	  continue
127523a0898aSmrg	  ;;
127623a0898aSmrg	expsyms_regex)
127723a0898aSmrg	  export_symbols_regex="$arg"
127823a0898aSmrg	  prev=
127923a0898aSmrg	  continue
128023a0898aSmrg	  ;;
128123a0898aSmrg	inst_prefix)
128223a0898aSmrg	  inst_prefix_dir="$arg"
128323a0898aSmrg	  prev=
128423a0898aSmrg	  continue
128523a0898aSmrg	  ;;
128623a0898aSmrg	precious_regex)
128723a0898aSmrg	  precious_files_regex="$arg"
128823a0898aSmrg	  prev=
128923a0898aSmrg	  continue
129023a0898aSmrg	  ;;
129123a0898aSmrg	release)
129223a0898aSmrg	  release="-$arg"
129323a0898aSmrg	  prev=
129423a0898aSmrg	  continue
129523a0898aSmrg	  ;;
129623a0898aSmrg	objectlist)
129723a0898aSmrg	  if test -f "$arg"; then
129823a0898aSmrg	    save_arg=$arg
129923a0898aSmrg	    moreargs=
130023a0898aSmrg	    for fil in `cat $save_arg`
130123a0898aSmrg	    do
130223a0898aSmrg#	      moreargs="$moreargs $fil"
130323a0898aSmrg	      arg=$fil
130423a0898aSmrg	      # A libtool-controlled object.
130523a0898aSmrg
130623a0898aSmrg	      # Check to see that this really is a libtool object.
130723a0898aSmrg	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
130823a0898aSmrg		pic_object=
130923a0898aSmrg		non_pic_object=
131023a0898aSmrg
131123a0898aSmrg		# Read the .lo file
131223a0898aSmrg		# If there is no directory component, then add one.
131323a0898aSmrg		case $arg in
131423a0898aSmrg		*/* | *\\*) . $arg ;;
131523a0898aSmrg		*) . ./$arg ;;
131623a0898aSmrg		esac
131723a0898aSmrg
131823a0898aSmrg		if test -z "$pic_object" || \
131923a0898aSmrg		   test -z "$non_pic_object" ||
132023a0898aSmrg		   test "$pic_object" = none && \
132123a0898aSmrg		   test "$non_pic_object" = none; then
132223a0898aSmrg		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
132323a0898aSmrg		  exit $EXIT_FAILURE
132423a0898aSmrg		fi
132523a0898aSmrg
132623a0898aSmrg		# Extract subdirectory from the argument.
132723a0898aSmrg		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
132823a0898aSmrg		if test "X$xdir" = "X$arg"; then
132923a0898aSmrg		  xdir=
133023a0898aSmrg		else
133123a0898aSmrg		  xdir="$xdir/"
133223a0898aSmrg		fi
133323a0898aSmrg
133423a0898aSmrg		if test "$pic_object" != none; then
133523a0898aSmrg		  # Prepend the subdirectory the object is found in.
133623a0898aSmrg		  pic_object="$xdir$pic_object"
133723a0898aSmrg
133823a0898aSmrg		  if test "$prev" = dlfiles; then
133923a0898aSmrg		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
134023a0898aSmrg		      dlfiles="$dlfiles $pic_object"
134123a0898aSmrg		      prev=
134223a0898aSmrg		      continue
134323a0898aSmrg		    else
134423a0898aSmrg		      # If libtool objects are unsupported, then we need to preload.
134523a0898aSmrg		      prev=dlprefiles
134623a0898aSmrg		    fi
134723a0898aSmrg		  fi
134823a0898aSmrg
134923a0898aSmrg		  # CHECK ME:  I think I busted this.  -Ossama
135023a0898aSmrg		  if test "$prev" = dlprefiles; then
135123a0898aSmrg		    # Preload the old-style object.
135223a0898aSmrg		    dlprefiles="$dlprefiles $pic_object"
135323a0898aSmrg		    prev=
135423a0898aSmrg		  fi
135523a0898aSmrg
135623a0898aSmrg		  # A PIC object.
135723a0898aSmrg		  libobjs="$libobjs $pic_object"
135823a0898aSmrg		  arg="$pic_object"
135923a0898aSmrg		fi
136023a0898aSmrg
136123a0898aSmrg		# Non-PIC object.
136223a0898aSmrg		if test "$non_pic_object" != none; then
136323a0898aSmrg		  # Prepend the subdirectory the object is found in.
136423a0898aSmrg		  non_pic_object="$xdir$non_pic_object"
136523a0898aSmrg
136623a0898aSmrg		  # A standard non-PIC object
136723a0898aSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
136823a0898aSmrg		  if test -z "$pic_object" || test "$pic_object" = none ; then
136923a0898aSmrg		    arg="$non_pic_object"
137023a0898aSmrg		  fi
137123a0898aSmrg		else
137223a0898aSmrg		  # If the PIC object exists, use it instead.
137323a0898aSmrg		  # $xdir was prepended to $pic_object above.
137423a0898aSmrg		  non_pic_object="$pic_object"
137523a0898aSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
137623a0898aSmrg		fi
137723a0898aSmrg	      else
137823a0898aSmrg		# Only an error if not doing a dry-run.
137923a0898aSmrg		if test -z "$run"; then
138023a0898aSmrg		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
138123a0898aSmrg		  exit $EXIT_FAILURE
138223a0898aSmrg		else
138323a0898aSmrg		  # Dry-run case.
138423a0898aSmrg
138523a0898aSmrg		  # Extract subdirectory from the argument.
138623a0898aSmrg		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
138723a0898aSmrg		  if test "X$xdir" = "X$arg"; then
138823a0898aSmrg		    xdir=
138923a0898aSmrg		  else
139023a0898aSmrg		    xdir="$xdir/"
139123a0898aSmrg		  fi
139223a0898aSmrg
139323a0898aSmrg		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
139423a0898aSmrg		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
139523a0898aSmrg		  libobjs="$libobjs $pic_object"
139623a0898aSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
139723a0898aSmrg		fi
139823a0898aSmrg	      fi
139923a0898aSmrg	    done
140023a0898aSmrg	  else
140123a0898aSmrg	    $echo "$modename: link input file \`$save_arg' does not exist"
140223a0898aSmrg	    exit $EXIT_FAILURE
140323a0898aSmrg	  fi
140423a0898aSmrg	  arg=$save_arg
140523a0898aSmrg	  prev=
140623a0898aSmrg	  continue
140723a0898aSmrg	  ;;
140823a0898aSmrg	rpath | xrpath)
140923a0898aSmrg	  # We need an absolute path.
141023a0898aSmrg	  case $arg in
141123a0898aSmrg	  [\\/]* | [A-Za-z]:[\\/]*) ;;
141223a0898aSmrg	  *)
141323a0898aSmrg	    $echo "$modename: only absolute run-paths are allowed" 1>&2
141423a0898aSmrg	    exit $EXIT_FAILURE
141523a0898aSmrg	    ;;
141623a0898aSmrg	  esac
141723a0898aSmrg	  if test "$prev" = rpath; then
141823a0898aSmrg	    case "$rpath " in
141923a0898aSmrg	    *" $arg "*) ;;
142023a0898aSmrg	    *) rpath="$rpath $arg" ;;
142123a0898aSmrg	    esac
142223a0898aSmrg	  else
142323a0898aSmrg	    case "$xrpath " in
142423a0898aSmrg	    *" $arg "*) ;;
142523a0898aSmrg	    *) xrpath="$xrpath $arg" ;;
142623a0898aSmrg	    esac
142723a0898aSmrg	  fi
142823a0898aSmrg	  prev=
142923a0898aSmrg	  continue
143023a0898aSmrg	  ;;
143123a0898aSmrg	xcompiler)
143223a0898aSmrg	  compiler_flags="$compiler_flags $qarg"
143323a0898aSmrg	  prev=
143423a0898aSmrg	  compile_command="$compile_command $qarg"
143523a0898aSmrg	  finalize_command="$finalize_command $qarg"
143623a0898aSmrg	  continue
143723a0898aSmrg	  ;;
143823a0898aSmrg	xlinker)
143923a0898aSmrg	  linker_flags="$linker_flags $qarg"
144023a0898aSmrg	  compiler_flags="$compiler_flags $wl$qarg"
144123a0898aSmrg	  prev=
144223a0898aSmrg	  compile_command="$compile_command $wl$qarg"
144323a0898aSmrg	  finalize_command="$finalize_command $wl$qarg"
144423a0898aSmrg	  continue
144523a0898aSmrg	  ;;
144623a0898aSmrg	xcclinker)
144723a0898aSmrg	  linker_flags="$linker_flags $qarg"
144823a0898aSmrg	  compiler_flags="$compiler_flags $qarg"
144923a0898aSmrg	  prev=
145023a0898aSmrg	  compile_command="$compile_command $qarg"
145123a0898aSmrg	  finalize_command="$finalize_command $qarg"
145223a0898aSmrg	  continue
145323a0898aSmrg	  ;;
145423a0898aSmrg	shrext)
145523a0898aSmrg  	  shrext_cmds="$arg"
145623a0898aSmrg	  prev=
145723a0898aSmrg	  continue
145823a0898aSmrg	  ;;
145923a0898aSmrg	darwin_framework|darwin_framework_skip)
146023a0898aSmrg	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
146123a0898aSmrg	  compile_command="$compile_command $arg"
146223a0898aSmrg	  finalize_command="$finalize_command $arg"
146323a0898aSmrg	  prev=
146423a0898aSmrg	  continue
146523a0898aSmrg	  ;;
146623a0898aSmrg	*)
146723a0898aSmrg	  eval "$prev=\"\$arg\""
146823a0898aSmrg	  prev=
146923a0898aSmrg	  continue
147023a0898aSmrg	  ;;
147123a0898aSmrg	esac
147223a0898aSmrg      fi # test -n "$prev"
147323a0898aSmrg
147423a0898aSmrg      prevarg="$arg"
147523a0898aSmrg
147623a0898aSmrg      case $arg in
147723a0898aSmrg      -all-static)
147823a0898aSmrg	if test -n "$link_static_flag"; then
147923a0898aSmrg	  compile_command="$compile_command $link_static_flag"
148023a0898aSmrg	  finalize_command="$finalize_command $link_static_flag"
148123a0898aSmrg	fi
148223a0898aSmrg	continue
148323a0898aSmrg	;;
148423a0898aSmrg
148523a0898aSmrg      -allow-undefined)
148623a0898aSmrg	# FIXME: remove this flag sometime in the future.
148723a0898aSmrg	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
148823a0898aSmrg	continue
148923a0898aSmrg	;;
149023a0898aSmrg
149123a0898aSmrg      -avoid-version)
149223a0898aSmrg	avoid_version=yes
149323a0898aSmrg	continue
149423a0898aSmrg	;;
149523a0898aSmrg
149623a0898aSmrg      -dlopen)
149723a0898aSmrg	prev=dlfiles
149823a0898aSmrg	continue
149923a0898aSmrg	;;
150023a0898aSmrg
150123a0898aSmrg      -dlpreopen)
150223a0898aSmrg	prev=dlprefiles
150323a0898aSmrg	continue
150423a0898aSmrg	;;
150523a0898aSmrg
150623a0898aSmrg      -export-dynamic)
150723a0898aSmrg	export_dynamic=yes
150823a0898aSmrg	continue
150923a0898aSmrg	;;
151023a0898aSmrg
151123a0898aSmrg      -export-symbols | -export-symbols-regex)
151223a0898aSmrg	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
151323a0898aSmrg	  $echo "$modename: more than one -exported-symbols argument is not allowed"
151423a0898aSmrg	  exit $EXIT_FAILURE
151523a0898aSmrg	fi
151623a0898aSmrg	if test "X$arg" = "X-export-symbols"; then
151723a0898aSmrg	  prev=expsyms
151823a0898aSmrg	else
151923a0898aSmrg	  prev=expsyms_regex
152023a0898aSmrg	fi
152123a0898aSmrg	continue
152223a0898aSmrg	;;
152323a0898aSmrg
152423a0898aSmrg      -framework|-arch|-isysroot)
152523a0898aSmrg	case " $CC " in
152623a0898aSmrg	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
152723a0898aSmrg		prev=darwin_framework_skip ;;
152823a0898aSmrg	  *) compiler_flags="$compiler_flags $arg"
152923a0898aSmrg	     prev=darwin_framework ;;
153023a0898aSmrg	esac
153123a0898aSmrg	compile_command="$compile_command $arg"
153223a0898aSmrg	finalize_command="$finalize_command $arg"
153323a0898aSmrg	continue
153423a0898aSmrg	;;
153523a0898aSmrg
153623a0898aSmrg      -inst-prefix-dir)
153723a0898aSmrg	prev=inst_prefix
153823a0898aSmrg	continue
153923a0898aSmrg	;;
154023a0898aSmrg
154123a0898aSmrg      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
154223a0898aSmrg      # so, if we see these flags be careful not to treat them like -L
154323a0898aSmrg      -L[A-Z][A-Z]*:*)
154423a0898aSmrg	case $with_gcc/$host in
154523a0898aSmrg	no/*-*-irix* | /*-*-irix*)
154623a0898aSmrg	  compile_command="$compile_command $arg"
154723a0898aSmrg	  finalize_command="$finalize_command $arg"
154823a0898aSmrg	  ;;
154923a0898aSmrg	esac
155023a0898aSmrg	continue
155123a0898aSmrg	;;
155223a0898aSmrg
155323a0898aSmrg      -L*)
155423a0898aSmrg	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
155523a0898aSmrg	# We need an absolute path.
155623a0898aSmrg	case $dir in
155723a0898aSmrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
155823a0898aSmrg	*)
155923a0898aSmrg	  absdir=`cd "$dir" && pwd`
156023a0898aSmrg	  if test -z "$absdir"; then
156123a0898aSmrg	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
156223a0898aSmrg	    absdir="$dir"
156323a0898aSmrg	    notinst_path="$notinst_path $dir"
156423a0898aSmrg	  fi
156523a0898aSmrg	  dir="$absdir"
156623a0898aSmrg	  ;;
156723a0898aSmrg	esac
156823a0898aSmrg	case "$deplibs " in
156923a0898aSmrg	*" -L$dir "*) ;;
157023a0898aSmrg	*)
157123a0898aSmrg	  deplibs="$deplibs -L$dir"
157223a0898aSmrg	  lib_search_path="$lib_search_path $dir"
157323a0898aSmrg	  ;;
157423a0898aSmrg	esac
157523a0898aSmrg	case $host in
157623a0898aSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
157723a0898aSmrg	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
157823a0898aSmrg	  case :$dllsearchpath: in
157923a0898aSmrg	  *":$dir:"*) ;;
158023a0898aSmrg	  *) dllsearchpath="$dllsearchpath:$dir";;
158123a0898aSmrg	  esac
158223a0898aSmrg	  case :$dllsearchpath: in
158323a0898aSmrg	  *":$testbindir:"*) ;;
158423a0898aSmrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
158523a0898aSmrg	  esac
158623a0898aSmrg	  ;;
158723a0898aSmrg	esac
158823a0898aSmrg	continue
158923a0898aSmrg	;;
159023a0898aSmrg
159123a0898aSmrg      -l*)
159223a0898aSmrg	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
159323a0898aSmrg	  case $host in
159423a0898aSmrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
159523a0898aSmrg	    # These systems don't actually have a C or math library (as such)
159623a0898aSmrg	    continue
159723a0898aSmrg	    ;;
159823a0898aSmrg	  *-*-os2*)
159923a0898aSmrg	    # These systems don't actually have a C library (as such)
160023a0898aSmrg	    test "X$arg" = "X-lc" && continue
160123a0898aSmrg	    ;;
160223a0898aSmrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
160323a0898aSmrg	    # Do not include libc due to us having libc/libc_r.
160423a0898aSmrg	    test "X$arg" = "X-lc" && continue
160523a0898aSmrg	    ;;
160623a0898aSmrg	  *-*-rhapsody* | *-*-darwin1.[012])
160723a0898aSmrg	    # Rhapsody C and math libraries are in the System framework
160823a0898aSmrg	    deplibs="$deplibs -framework System"
160923a0898aSmrg	    continue
161023a0898aSmrg	    ;;
161123a0898aSmrg	  *-*-sco3.2v5* | *-*-sco5v6*)
161223a0898aSmrg	    # Causes problems with __ctype
161323a0898aSmrg	    test "X$arg" = "X-lc" && continue
161423a0898aSmrg	    ;;
161523a0898aSmrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
161623a0898aSmrg	    # Compiler inserts libc in the correct place for threads to work
161723a0898aSmrg	    test "X$arg" = "X-lc" && continue
161823a0898aSmrg	    ;;
161923a0898aSmrg	  esac
162023a0898aSmrg	elif test "X$arg" = "X-lc_r"; then
162123a0898aSmrg	 case $host in
162223a0898aSmrg	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
162323a0898aSmrg	   # Do not include libc_r directly, use -pthread flag.
162423a0898aSmrg	   continue
162523a0898aSmrg	   ;;
162623a0898aSmrg	 esac
162723a0898aSmrg	fi
162823a0898aSmrg	deplibs="$deplibs $arg"
162923a0898aSmrg	continue
163023a0898aSmrg	;;
163123a0898aSmrg
163223a0898aSmrg      # Tru64 UNIX uses -model [arg] to determine the layout of C++
163323a0898aSmrg      # classes, name mangling, and exception handling.
163423a0898aSmrg      -model)
163523a0898aSmrg	compile_command="$compile_command $arg"
163623a0898aSmrg	compiler_flags="$compiler_flags $arg"
163723a0898aSmrg	finalize_command="$finalize_command $arg"
163823a0898aSmrg	prev=xcompiler
163923a0898aSmrg	continue
164023a0898aSmrg	;;
164123a0898aSmrg
164223a0898aSmrg     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
164323a0898aSmrg	compiler_flags="$compiler_flags $arg"
164423a0898aSmrg	compile_command="$compile_command $arg"
164523a0898aSmrg	finalize_command="$finalize_command $arg"
164623a0898aSmrg	continue
164723a0898aSmrg	;;
164823a0898aSmrg
164923a0898aSmrg      -module)
165023a0898aSmrg	module=yes
165123a0898aSmrg	continue
165223a0898aSmrg	;;
165323a0898aSmrg
165423a0898aSmrg      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
165523a0898aSmrg      # -r[0-9][0-9]* specifies the processor on the SGI compiler
165623a0898aSmrg      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
165723a0898aSmrg      # +DA*, +DD* enable 64-bit mode on the HP compiler
165823a0898aSmrg      # -q* pass through compiler args for the IBM compiler
165923a0898aSmrg      # -m* pass through architecture-specific compiler args for GCC
166023a0898aSmrg      # -m*, -t[45]*, -txscale* pass through architecture-specific
166123a0898aSmrg      # compiler args for GCC
166223a0898aSmrg      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
166323a0898aSmrg      # -F/path gives path to uninstalled frameworks, gcc on darwin
166423a0898aSmrg      # @file GCC response files
166523a0898aSmrg      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
166623a0898aSmrg      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
166723a0898aSmrg
166823a0898aSmrg	# Unknown arguments in both finalize_command and compile_command need
166923a0898aSmrg	# to be aesthetically quoted because they are evaled later.
167023a0898aSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
167123a0898aSmrg	case $arg in
167223a0898aSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
167323a0898aSmrg	  arg="\"$arg\""
167423a0898aSmrg	  ;;
167523a0898aSmrg	esac
167623a0898aSmrg        compile_command="$compile_command $arg"
167723a0898aSmrg        finalize_command="$finalize_command $arg"
167823a0898aSmrg        compiler_flags="$compiler_flags $arg"
167923a0898aSmrg        continue
168023a0898aSmrg        ;;
168123a0898aSmrg
168223a0898aSmrg      -shrext)
168323a0898aSmrg	prev=shrext
168423a0898aSmrg	continue
168523a0898aSmrg	;;
168623a0898aSmrg
168723a0898aSmrg      -no-fast-install)
168823a0898aSmrg	fast_install=no
168923a0898aSmrg	continue
169023a0898aSmrg	;;
169123a0898aSmrg
169223a0898aSmrg      -no-install)
169323a0898aSmrg	case $host in
169423a0898aSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
169523a0898aSmrg	  # The PATH hackery in wrapper scripts is required on Windows
169623a0898aSmrg	  # and Darwin in order for the loader to find any dlls it needs.
169723a0898aSmrg	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
169823a0898aSmrg	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
169923a0898aSmrg	  fast_install=no
170023a0898aSmrg	  ;;
170123a0898aSmrg	*) no_install=yes ;;
170223a0898aSmrg	esac
170323a0898aSmrg	continue
170423a0898aSmrg	;;
170523a0898aSmrg
170623a0898aSmrg      -no-undefined)
170723a0898aSmrg	allow_undefined=no
170823a0898aSmrg	continue
170923a0898aSmrg	;;
171023a0898aSmrg
171123a0898aSmrg      -objectlist)
171223a0898aSmrg	prev=objectlist
171323a0898aSmrg	continue
171423a0898aSmrg	;;
171523a0898aSmrg
171623a0898aSmrg      -o) prev=output ;;
171723a0898aSmrg
171823a0898aSmrg      -precious-files-regex)
171923a0898aSmrg	prev=precious_regex
172023a0898aSmrg	continue
172123a0898aSmrg	;;
172223a0898aSmrg
172323a0898aSmrg      -release)
172423a0898aSmrg	prev=release
172523a0898aSmrg	continue
172623a0898aSmrg	;;
172723a0898aSmrg
172823a0898aSmrg      -rpath)
172923a0898aSmrg	prev=rpath
173023a0898aSmrg	continue
173123a0898aSmrg	;;
173223a0898aSmrg
173323a0898aSmrg      -R)
173423a0898aSmrg	prev=xrpath
173523a0898aSmrg	continue
173623a0898aSmrg	;;
173723a0898aSmrg
173823a0898aSmrg      -R*)
173923a0898aSmrg	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
174023a0898aSmrg	# We need an absolute path.
174123a0898aSmrg	case $dir in
174223a0898aSmrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
174323a0898aSmrg	*)
174423a0898aSmrg	  $echo "$modename: only absolute run-paths are allowed" 1>&2
174523a0898aSmrg	  exit $EXIT_FAILURE
174623a0898aSmrg	  ;;
174723a0898aSmrg	esac
174823a0898aSmrg	case "$xrpath " in
174923a0898aSmrg	*" $dir "*) ;;
175023a0898aSmrg	*) xrpath="$xrpath $dir" ;;
175123a0898aSmrg	esac
175223a0898aSmrg	continue
175323a0898aSmrg	;;
175423a0898aSmrg
175523a0898aSmrg      -static | -static-libtool-libs)
175623a0898aSmrg	# The effects of -static are defined in a previous loop.
175723a0898aSmrg	# We used to do the same as -all-static on platforms that
175823a0898aSmrg	# didn't have a PIC flag, but the assumption that the effects
175923a0898aSmrg	# would be equivalent was wrong.  It would break on at least
176023a0898aSmrg	# Digital Unix and AIX.
176123a0898aSmrg	continue
176223a0898aSmrg	;;
176323a0898aSmrg
176423a0898aSmrg      -thread-safe)
176523a0898aSmrg	thread_safe=yes
176623a0898aSmrg	continue
176723a0898aSmrg	;;
176823a0898aSmrg
176923a0898aSmrg      -version-info)
177023a0898aSmrg	prev=vinfo
177123a0898aSmrg	continue
177223a0898aSmrg	;;
177323a0898aSmrg      -version-number)
177423a0898aSmrg	prev=vinfo
177523a0898aSmrg	vinfo_number=yes
177623a0898aSmrg	continue
177723a0898aSmrg	;;
177823a0898aSmrg
177923a0898aSmrg      -Wc,*)
178023a0898aSmrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
178123a0898aSmrg	arg=
178223a0898aSmrg	save_ifs="$IFS"; IFS=','
178323a0898aSmrg	for flag in $args; do
178423a0898aSmrg	  IFS="$save_ifs"
178523a0898aSmrg	  case $flag in
178623a0898aSmrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
178723a0898aSmrg	    flag="\"$flag\""
178823a0898aSmrg	    ;;
178923a0898aSmrg	  esac
179023a0898aSmrg	  arg="$arg $wl$flag"
179123a0898aSmrg	  compiler_flags="$compiler_flags $flag"
179223a0898aSmrg	done
179323a0898aSmrg	IFS="$save_ifs"
179423a0898aSmrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
179523a0898aSmrg	;;
179623a0898aSmrg
179723a0898aSmrg      -Wl,*)
179823a0898aSmrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
179923a0898aSmrg	arg=
180023a0898aSmrg	save_ifs="$IFS"; IFS=','
180123a0898aSmrg	for flag in $args; do
180223a0898aSmrg	  IFS="$save_ifs"
180323a0898aSmrg	  case $flag in
180423a0898aSmrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
180523a0898aSmrg	    flag="\"$flag\""
180623a0898aSmrg	    ;;
180723a0898aSmrg	  esac
180823a0898aSmrg	  arg="$arg $wl$flag"
180923a0898aSmrg	  compiler_flags="$compiler_flags $wl$flag"
181023a0898aSmrg	  linker_flags="$linker_flags $flag"
181123a0898aSmrg	done
181223a0898aSmrg	IFS="$save_ifs"
181323a0898aSmrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
181423a0898aSmrg	;;
181523a0898aSmrg
181623a0898aSmrg      -Xcompiler)
181723a0898aSmrg	prev=xcompiler
181823a0898aSmrg	continue
181923a0898aSmrg	;;
182023a0898aSmrg
182123a0898aSmrg      -Xlinker)
182223a0898aSmrg	prev=xlinker
182323a0898aSmrg	continue
182423a0898aSmrg	;;
182523a0898aSmrg
182623a0898aSmrg      -XCClinker)
182723a0898aSmrg	prev=xcclinker
182823a0898aSmrg	continue
182923a0898aSmrg	;;
183023a0898aSmrg
183123a0898aSmrg      # Some other compiler flag.
183223a0898aSmrg      -* | +*)
183323a0898aSmrg	# Unknown arguments in both finalize_command and compile_command need
183423a0898aSmrg	# to be aesthetically quoted because they are evaled later.
183523a0898aSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
183623a0898aSmrg	case $arg in
183723a0898aSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
183823a0898aSmrg	  arg="\"$arg\""
183923a0898aSmrg	  ;;
184023a0898aSmrg	esac
184123a0898aSmrg	;;
184223a0898aSmrg
184323a0898aSmrg      *.$objext)
184423a0898aSmrg	# A standard object.
184523a0898aSmrg	objs="$objs $arg"
184623a0898aSmrg	;;
184723a0898aSmrg
184823a0898aSmrg      *.lo)
184923a0898aSmrg	# A libtool-controlled object.
185023a0898aSmrg
185123a0898aSmrg	# Check to see that this really is a libtool object.
185223a0898aSmrg	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
185323a0898aSmrg	  pic_object=
185423a0898aSmrg	  non_pic_object=
185523a0898aSmrg
185623a0898aSmrg	  # Read the .lo file
185723a0898aSmrg	  # If there is no directory component, then add one.
185823a0898aSmrg	  case $arg in
185923a0898aSmrg	  */* | *\\*) . $arg ;;
186023a0898aSmrg	  *) . ./$arg ;;
186123a0898aSmrg	  esac
186223a0898aSmrg
186323a0898aSmrg	  if test -z "$pic_object" || \
186423a0898aSmrg	     test -z "$non_pic_object" ||
186523a0898aSmrg	     test "$pic_object" = none && \
186623a0898aSmrg	     test "$non_pic_object" = none; then
186723a0898aSmrg	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
186823a0898aSmrg	    exit $EXIT_FAILURE
186923a0898aSmrg	  fi
187023a0898aSmrg
187123a0898aSmrg	  # Extract subdirectory from the argument.
187223a0898aSmrg	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
187323a0898aSmrg	  if test "X$xdir" = "X$arg"; then
187423a0898aSmrg	    xdir=
187523a0898aSmrg 	  else
187623a0898aSmrg	    xdir="$xdir/"
187723a0898aSmrg	  fi
187823a0898aSmrg
187923a0898aSmrg	  if test "$pic_object" != none; then
188023a0898aSmrg	    # Prepend the subdirectory the object is found in.
188123a0898aSmrg	    pic_object="$xdir$pic_object"
188223a0898aSmrg
188323a0898aSmrg	    if test "$prev" = dlfiles; then
188423a0898aSmrg	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
188523a0898aSmrg		dlfiles="$dlfiles $pic_object"
188623a0898aSmrg		prev=
188723a0898aSmrg		continue
188823a0898aSmrg	      else
188923a0898aSmrg		# If libtool objects are unsupported, then we need to preload.
189023a0898aSmrg		prev=dlprefiles
189123a0898aSmrg	      fi
189223a0898aSmrg	    fi
189323a0898aSmrg
189423a0898aSmrg	    # CHECK ME:  I think I busted this.  -Ossama
189523a0898aSmrg	    if test "$prev" = dlprefiles; then
189623a0898aSmrg	      # Preload the old-style object.
189723a0898aSmrg	      dlprefiles="$dlprefiles $pic_object"
189823a0898aSmrg	      prev=
189923a0898aSmrg	    fi
190023a0898aSmrg
190123a0898aSmrg	    # A PIC object.
190223a0898aSmrg	    libobjs="$libobjs $pic_object"
190323a0898aSmrg	    arg="$pic_object"
190423a0898aSmrg	  fi
190523a0898aSmrg
190623a0898aSmrg	  # Non-PIC object.
190723a0898aSmrg	  if test "$non_pic_object" != none; then
190823a0898aSmrg	    # Prepend the subdirectory the object is found in.
190923a0898aSmrg	    non_pic_object="$xdir$non_pic_object"
191023a0898aSmrg
191123a0898aSmrg	    # A standard non-PIC object
191223a0898aSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
191323a0898aSmrg	    if test -z "$pic_object" || test "$pic_object" = none ; then
191423a0898aSmrg	      arg="$non_pic_object"
191523a0898aSmrg	    fi
191623a0898aSmrg	  else
191723a0898aSmrg	    # If the PIC object exists, use it instead.
191823a0898aSmrg	    # $xdir was prepended to $pic_object above.
191923a0898aSmrg	    non_pic_object="$pic_object"
192023a0898aSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
192123a0898aSmrg	  fi
192223a0898aSmrg	else
192323a0898aSmrg	  # Only an error if not doing a dry-run.
192423a0898aSmrg	  if test -z "$run"; then
192523a0898aSmrg	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
192623a0898aSmrg	    exit $EXIT_FAILURE
192723a0898aSmrg	  else
192823a0898aSmrg	    # Dry-run case.
192923a0898aSmrg
193023a0898aSmrg	    # Extract subdirectory from the argument.
193123a0898aSmrg	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
193223a0898aSmrg	    if test "X$xdir" = "X$arg"; then
193323a0898aSmrg	      xdir=
193423a0898aSmrg	    else
193523a0898aSmrg	      xdir="$xdir/"
193623a0898aSmrg	    fi
193723a0898aSmrg
193823a0898aSmrg	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
193923a0898aSmrg	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
194023a0898aSmrg	    libobjs="$libobjs $pic_object"
194123a0898aSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
194223a0898aSmrg	  fi
194323a0898aSmrg	fi
194423a0898aSmrg	;;
194523a0898aSmrg
194623a0898aSmrg      *.$libext)
194723a0898aSmrg	# An archive.
194823a0898aSmrg	deplibs="$deplibs $arg"
194923a0898aSmrg	old_deplibs="$old_deplibs $arg"
195023a0898aSmrg	continue
195123a0898aSmrg	;;
195223a0898aSmrg
195323a0898aSmrg      *.la)
195423a0898aSmrg	# A libtool-controlled library.
195523a0898aSmrg
195623a0898aSmrg	if test "$prev" = dlfiles; then
195723a0898aSmrg	  # This library was specified with -dlopen.
195823a0898aSmrg	  dlfiles="$dlfiles $arg"
195923a0898aSmrg	  prev=
196023a0898aSmrg	elif test "$prev" = dlprefiles; then
196123a0898aSmrg	  # The library was specified with -dlpreopen.
196223a0898aSmrg	  dlprefiles="$dlprefiles $arg"
196323a0898aSmrg	  prev=
196423a0898aSmrg	else
196523a0898aSmrg	  deplibs="$deplibs $arg"
196623a0898aSmrg	fi
196723a0898aSmrg	continue
196823a0898aSmrg	;;
196923a0898aSmrg
197023a0898aSmrg      # Some other compiler argument.
197123a0898aSmrg      *)
197223a0898aSmrg	# Unknown arguments in both finalize_command and compile_command need
197323a0898aSmrg	# to be aesthetically quoted because they are evaled later.
197423a0898aSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
197523a0898aSmrg	case $arg in
197623a0898aSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
197723a0898aSmrg	  arg="\"$arg\""
197823a0898aSmrg	  ;;
197923a0898aSmrg	esac
198023a0898aSmrg	;;
198123a0898aSmrg      esac # arg
198223a0898aSmrg
198323a0898aSmrg      # Now actually substitute the argument into the commands.
198423a0898aSmrg      if test -n "$arg"; then
198523a0898aSmrg	compile_command="$compile_command $arg"
198623a0898aSmrg	finalize_command="$finalize_command $arg"
198723a0898aSmrg      fi
198823a0898aSmrg    done # argument parsing loop
198923a0898aSmrg
199023a0898aSmrg    if test -n "$prev"; then
199123a0898aSmrg      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
199223a0898aSmrg      $echo "$help" 1>&2
199323a0898aSmrg      exit $EXIT_FAILURE
199423a0898aSmrg    fi
199523a0898aSmrg
199623a0898aSmrg    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
199723a0898aSmrg      eval arg=\"$export_dynamic_flag_spec\"
199823a0898aSmrg      compile_command="$compile_command $arg"
199923a0898aSmrg      finalize_command="$finalize_command $arg"
200023a0898aSmrg    fi
200123a0898aSmrg
200223a0898aSmrg    oldlibs=
200323a0898aSmrg    # calculate the name of the file, without its directory
200423a0898aSmrg    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
200523a0898aSmrg    libobjs_save="$libobjs"
200623a0898aSmrg
200723a0898aSmrg    if test -n "$shlibpath_var"; then
200823a0898aSmrg      # get the directories listed in $shlibpath_var
200923a0898aSmrg      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
201023a0898aSmrg    else
201123a0898aSmrg      shlib_search_path=
201223a0898aSmrg    fi
201323a0898aSmrg    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
201423a0898aSmrg    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
201523a0898aSmrg
201623a0898aSmrg    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
201723a0898aSmrg    if test "X$output_objdir" = "X$output"; then
201823a0898aSmrg      output_objdir="$objdir"
201923a0898aSmrg    else
202023a0898aSmrg      output_objdir="$output_objdir/$objdir"
202123a0898aSmrg    fi
202223a0898aSmrg    # Create the object directory.
202323a0898aSmrg    if test ! -d "$output_objdir"; then
202423a0898aSmrg      $show "$mkdir $output_objdir"
202523a0898aSmrg      $run $mkdir $output_objdir
202623a0898aSmrg      exit_status=$?
202723a0898aSmrg      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
202823a0898aSmrg	exit $exit_status
202923a0898aSmrg      fi
203023a0898aSmrg    fi
203123a0898aSmrg
203223a0898aSmrg    # Determine the type of output
203323a0898aSmrg    case $output in
203423a0898aSmrg    "")
203523a0898aSmrg      $echo "$modename: you must specify an output file" 1>&2
203623a0898aSmrg      $echo "$help" 1>&2
203723a0898aSmrg      exit $EXIT_FAILURE
203823a0898aSmrg      ;;
203923a0898aSmrg    *.$libext) linkmode=oldlib ;;
204023a0898aSmrg    *.lo | *.$objext) linkmode=obj ;;
204123a0898aSmrg    *.la) linkmode=lib ;;
204223a0898aSmrg    *) linkmode=prog ;; # Anything else should be a program.
204323a0898aSmrg    esac
204423a0898aSmrg
204523a0898aSmrg    case $host in
204623a0898aSmrg    *cygwin* | *mingw* | *pw32*)
204723a0898aSmrg      # don't eliminate duplications in $postdeps and $predeps
204823a0898aSmrg      duplicate_compiler_generated_deps=yes
204923a0898aSmrg      ;;
205023a0898aSmrg    *)
205123a0898aSmrg      duplicate_compiler_generated_deps=$duplicate_deps
205223a0898aSmrg      ;;
205323a0898aSmrg    esac
205423a0898aSmrg    specialdeplibs=
205523a0898aSmrg
205623a0898aSmrg    libs=
205723a0898aSmrg    # Find all interdependent deplibs by searching for libraries
205823a0898aSmrg    # that are linked more than once (e.g. -la -lb -la)
205923a0898aSmrg    for deplib in $deplibs; do
206023a0898aSmrg      if test "X$duplicate_deps" = "Xyes" ; then
206123a0898aSmrg	case "$libs " in
206223a0898aSmrg	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
206323a0898aSmrg	esac
206423a0898aSmrg      fi
206523a0898aSmrg      libs="$libs $deplib"
206623a0898aSmrg    done
206723a0898aSmrg
206823a0898aSmrg    if test "$linkmode" = lib; then
206923a0898aSmrg      libs="$predeps $libs $compiler_lib_search_path $postdeps"
207023a0898aSmrg
207123a0898aSmrg      # Compute libraries that are listed more than once in $predeps
207223a0898aSmrg      # $postdeps and mark them as special (i.e., whose duplicates are
207323a0898aSmrg      # not to be eliminated).
207423a0898aSmrg      pre_post_deps=
207523a0898aSmrg      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
207623a0898aSmrg	for pre_post_dep in $predeps $postdeps; do
207723a0898aSmrg	  case "$pre_post_deps " in
207823a0898aSmrg	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
207923a0898aSmrg	  esac
208023a0898aSmrg	  pre_post_deps="$pre_post_deps $pre_post_dep"
208123a0898aSmrg	done
208223a0898aSmrg      fi
208323a0898aSmrg      pre_post_deps=
208423a0898aSmrg    fi
208523a0898aSmrg
208623a0898aSmrg    deplibs=
208723a0898aSmrg    newdependency_libs=
208823a0898aSmrg    newlib_search_path=
208923a0898aSmrg    need_relink=no # whether we're linking any uninstalled libtool libraries
209023a0898aSmrg    notinst_deplibs= # not-installed libtool libraries
209123a0898aSmrg    case $linkmode in
209223a0898aSmrg    lib)
209323a0898aSmrg	passes="conv link"
209423a0898aSmrg	for file in $dlfiles $dlprefiles; do
209523a0898aSmrg	  case $file in
209623a0898aSmrg	  *.la) ;;
209723a0898aSmrg	  *)
209823a0898aSmrg	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
209923a0898aSmrg	    exit $EXIT_FAILURE
210023a0898aSmrg	    ;;
210123a0898aSmrg	  esac
210223a0898aSmrg	done
210323a0898aSmrg	;;
210423a0898aSmrg    prog)
210523a0898aSmrg	compile_deplibs=
210623a0898aSmrg	finalize_deplibs=
210723a0898aSmrg	alldeplibs=no
210823a0898aSmrg	newdlfiles=
210923a0898aSmrg	newdlprefiles=
211023a0898aSmrg	passes="conv scan dlopen dlpreopen link"
211123a0898aSmrg	;;
211223a0898aSmrg    *)  passes="conv"
211323a0898aSmrg	;;
211423a0898aSmrg    esac
211523a0898aSmrg    for pass in $passes; do
211623a0898aSmrg      if test "$linkmode,$pass" = "lib,link" ||
211723a0898aSmrg	 test "$linkmode,$pass" = "prog,scan"; then
211823a0898aSmrg	libs="$deplibs"
211923a0898aSmrg	deplibs=
212023a0898aSmrg      fi
212123a0898aSmrg      if test "$linkmode" = prog; then
212223a0898aSmrg	case $pass in
212323a0898aSmrg	dlopen) libs="$dlfiles" ;;
212423a0898aSmrg	dlpreopen) libs="$dlprefiles" ;;
212523a0898aSmrg	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
212623a0898aSmrg	esac
212723a0898aSmrg      fi
212823a0898aSmrg      if test "$pass" = dlopen; then
212923a0898aSmrg	# Collect dlpreopened libraries
213023a0898aSmrg	save_deplibs="$deplibs"
213123a0898aSmrg	deplibs=
213223a0898aSmrg      fi
213323a0898aSmrg      for deplib in $libs; do
213423a0898aSmrg	lib=
213523a0898aSmrg	found=no
213623a0898aSmrg	case $deplib in
213723a0898aSmrg	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
213823a0898aSmrg	  if test "$linkmode,$pass" = "prog,link"; then
213923a0898aSmrg	    compile_deplibs="$deplib $compile_deplibs"
214023a0898aSmrg	    finalize_deplibs="$deplib $finalize_deplibs"
214123a0898aSmrg	  else
214223a0898aSmrg	    compiler_flags="$compiler_flags $deplib"
214323a0898aSmrg	  fi
214423a0898aSmrg	  continue
214523a0898aSmrg	  ;;
214623a0898aSmrg	-l*)
214723a0898aSmrg	  if test "$linkmode" != lib && test "$linkmode" != prog; then
214823a0898aSmrg	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
214923a0898aSmrg	    continue
215023a0898aSmrg	  fi
215123a0898aSmrg	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
215223a0898aSmrg	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
215323a0898aSmrg	    for search_ext in .la $std_shrext .so .a; do
215423a0898aSmrg	      # Search the libtool library
215523a0898aSmrg	      lib="$searchdir/lib${name}${search_ext}"
215623a0898aSmrg	      if test -f "$lib"; then
215723a0898aSmrg		if test "$search_ext" = ".la"; then
215823a0898aSmrg		  found=yes
215923a0898aSmrg		else
216023a0898aSmrg		  found=no
216123a0898aSmrg		fi
216223a0898aSmrg		break 2
216323a0898aSmrg	      fi
216423a0898aSmrg	    done
216523a0898aSmrg	  done
216623a0898aSmrg	  if test "$found" != yes; then
216723a0898aSmrg	    # deplib doesn't seem to be a libtool library
216823a0898aSmrg	    if test "$linkmode,$pass" = "prog,link"; then
216923a0898aSmrg	      compile_deplibs="$deplib $compile_deplibs"
217023a0898aSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
217123a0898aSmrg	    else
217223a0898aSmrg	      deplibs="$deplib $deplibs"
217323a0898aSmrg	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
217423a0898aSmrg	    fi
217523a0898aSmrg	    continue
217623a0898aSmrg	  else # deplib is a libtool library
217723a0898aSmrg	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
217823a0898aSmrg	    # We need to do some special things here, and not later.
217923a0898aSmrg	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
218023a0898aSmrg	      case " $predeps $postdeps " in
218123a0898aSmrg	      *" $deplib "*)
218223a0898aSmrg		if (${SED} -e '2q' $lib |
218323a0898aSmrg                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
218423a0898aSmrg		  library_names=
218523a0898aSmrg		  old_library=
218623a0898aSmrg		  case $lib in
218723a0898aSmrg		  */* | *\\*) . $lib ;;
218823a0898aSmrg		  *) . ./$lib ;;
218923a0898aSmrg		  esac
219023a0898aSmrg		  for l in $old_library $library_names; do
219123a0898aSmrg		    ll="$l"
219223a0898aSmrg		  done
219323a0898aSmrg		  if test "X$ll" = "X$old_library" ; then # only static version available
219423a0898aSmrg		    found=no
219523a0898aSmrg		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
219623a0898aSmrg		    test "X$ladir" = "X$lib" && ladir="."
219723a0898aSmrg		    lib=$ladir/$old_library
219823a0898aSmrg		    if test "$linkmode,$pass" = "prog,link"; then
219923a0898aSmrg		      compile_deplibs="$deplib $compile_deplibs"
220023a0898aSmrg		      finalize_deplibs="$deplib $finalize_deplibs"
220123a0898aSmrg		    else
220223a0898aSmrg		      deplibs="$deplib $deplibs"
220323a0898aSmrg		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
220423a0898aSmrg		    fi
220523a0898aSmrg		    continue
220623a0898aSmrg		  fi
220723a0898aSmrg		fi
220823a0898aSmrg	        ;;
220923a0898aSmrg	      *) ;;
221023a0898aSmrg	      esac
221123a0898aSmrg	    fi
221223a0898aSmrg	  fi
221323a0898aSmrg	  ;; # -l
221423a0898aSmrg	-L*)
221523a0898aSmrg	  case $linkmode in
221623a0898aSmrg	  lib)
221723a0898aSmrg	    deplibs="$deplib $deplibs"
221823a0898aSmrg	    test "$pass" = conv && continue
221923a0898aSmrg	    newdependency_libs="$deplib $newdependency_libs"
222023a0898aSmrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
222123a0898aSmrg	    ;;
222223a0898aSmrg	  prog)
222323a0898aSmrg	    if test "$pass" = conv; then
222423a0898aSmrg	      deplibs="$deplib $deplibs"
222523a0898aSmrg	      continue
222623a0898aSmrg	    fi
222723a0898aSmrg	    if test "$pass" = scan; then
222823a0898aSmrg	      deplibs="$deplib $deplibs"
222923a0898aSmrg	    else
223023a0898aSmrg	      compile_deplibs="$deplib $compile_deplibs"
223123a0898aSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
223223a0898aSmrg	    fi
223323a0898aSmrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
223423a0898aSmrg	    ;;
223523a0898aSmrg	  *)
223623a0898aSmrg	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
223723a0898aSmrg	    ;;
223823a0898aSmrg	  esac # linkmode
223923a0898aSmrg	  continue
224023a0898aSmrg	  ;; # -L
224123a0898aSmrg	-R*)
224223a0898aSmrg	  if test "$pass" = link; then
224323a0898aSmrg	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
224423a0898aSmrg	    # Make sure the xrpath contains only unique directories.
224523a0898aSmrg	    case "$xrpath " in
224623a0898aSmrg	    *" $dir "*) ;;
224723a0898aSmrg	    *) xrpath="$xrpath $dir" ;;
224823a0898aSmrg	    esac
224923a0898aSmrg	  fi
225023a0898aSmrg	  deplibs="$deplib $deplibs"
225123a0898aSmrg	  continue
225223a0898aSmrg	  ;;
225323a0898aSmrg	*.la) lib="$deplib" ;;
225423a0898aSmrg	*.$libext)
225523a0898aSmrg	  if test "$pass" = conv; then
225623a0898aSmrg	    deplibs="$deplib $deplibs"
225723a0898aSmrg	    continue
225823a0898aSmrg	  fi
225923a0898aSmrg	  case $linkmode in
226023a0898aSmrg	  lib)
226123a0898aSmrg	    valid_a_lib=no
226223a0898aSmrg	    case $deplibs_check_method in
226323a0898aSmrg	      match_pattern*)
226423a0898aSmrg		set dummy $deplibs_check_method
226523a0898aSmrg	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
226623a0898aSmrg		if eval $echo \"$deplib\" 2>/dev/null \
226723a0898aSmrg		    | $SED 10q \
226823a0898aSmrg		    | $EGREP "$match_pattern_regex" > /dev/null; then
226923a0898aSmrg		  valid_a_lib=yes
227023a0898aSmrg		fi
227123a0898aSmrg		;;
227223a0898aSmrg	      pass_all)
227323a0898aSmrg		valid_a_lib=yes
227423a0898aSmrg		;;
227523a0898aSmrg            esac
227623a0898aSmrg	    if test "$valid_a_lib" != yes; then
227723a0898aSmrg	      $echo
227823a0898aSmrg	      $echo "*** Warning: Trying to link with static lib archive $deplib."
227923a0898aSmrg	      $echo "*** I have the capability to make that library automatically link in when"
228023a0898aSmrg	      $echo "*** you link to this library.  But I can only do this if you have a"
228123a0898aSmrg	      $echo "*** shared version of the library, which you do not appear to have"
228223a0898aSmrg	      $echo "*** because the file extensions .$libext of this argument makes me believe"
228323a0898aSmrg	      $echo "*** that it is just a static archive that I should not used here."
228423a0898aSmrg	    else
228523a0898aSmrg	      $echo
228623a0898aSmrg	      $echo "*** Warning: Linking the shared library $output against the"
228723a0898aSmrg	      $echo "*** static library $deplib is not portable!"
228823a0898aSmrg	      deplibs="$deplib $deplibs"
228923a0898aSmrg	    fi
229023a0898aSmrg	    continue
229123a0898aSmrg	    ;;
229223a0898aSmrg	  prog)
229323a0898aSmrg	    if test "$pass" != link; then
229423a0898aSmrg	      deplibs="$deplib $deplibs"
229523a0898aSmrg	    else
229623a0898aSmrg	      compile_deplibs="$deplib $compile_deplibs"
229723a0898aSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
229823a0898aSmrg	    fi
229923a0898aSmrg	    continue
230023a0898aSmrg	    ;;
230123a0898aSmrg	  esac # linkmode
230223a0898aSmrg	  ;; # *.$libext
230323a0898aSmrg	*.lo | *.$objext)
230423a0898aSmrg	  if test "$pass" = conv; then
230523a0898aSmrg	    deplibs="$deplib $deplibs"
230623a0898aSmrg	  elif test "$linkmode" = prog; then
230723a0898aSmrg	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
230823a0898aSmrg	      # If there is no dlopen support or we're linking statically,
230923a0898aSmrg	      # we need to preload.
231023a0898aSmrg	      newdlprefiles="$newdlprefiles $deplib"
231123a0898aSmrg	      compile_deplibs="$deplib $compile_deplibs"
231223a0898aSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
231323a0898aSmrg	    else
231423a0898aSmrg	      newdlfiles="$newdlfiles $deplib"
231523a0898aSmrg	    fi
231623a0898aSmrg	  fi
231723a0898aSmrg	  continue
231823a0898aSmrg	  ;;
231923a0898aSmrg	%DEPLIBS%)
232023a0898aSmrg	  alldeplibs=yes
232123a0898aSmrg	  continue
232223a0898aSmrg	  ;;
232323a0898aSmrg	esac # case $deplib
232423a0898aSmrg	if test "$found" = yes || test -f "$lib"; then :
232523a0898aSmrg	else
232623a0898aSmrg	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
232723a0898aSmrg	  exit $EXIT_FAILURE
232823a0898aSmrg	fi
232923a0898aSmrg
233023a0898aSmrg	# Check to see that this really is a libtool archive.
233123a0898aSmrg	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
233223a0898aSmrg	else
233323a0898aSmrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
233423a0898aSmrg	  exit $EXIT_FAILURE
233523a0898aSmrg	fi
233623a0898aSmrg
233723a0898aSmrg	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
233823a0898aSmrg	test "X$ladir" = "X$lib" && ladir="."
233923a0898aSmrg
234023a0898aSmrg	dlname=
234123a0898aSmrg	dlopen=
234223a0898aSmrg	dlpreopen=
234323a0898aSmrg	libdir=
234423a0898aSmrg	library_names=
234523a0898aSmrg	old_library=
234623a0898aSmrg	# If the library was installed with an old release of libtool,
234723a0898aSmrg	# it will not redefine variables installed, or shouldnotlink
234823a0898aSmrg	installed=yes
234923a0898aSmrg	shouldnotlink=no
235023a0898aSmrg	avoidtemprpath=
235123a0898aSmrg
235223a0898aSmrg
235323a0898aSmrg	# Read the .la file
235423a0898aSmrg	case $lib in
235523a0898aSmrg	*/* | *\\*) . $lib ;;
235623a0898aSmrg	*) . ./$lib ;;
235723a0898aSmrg	esac
235823a0898aSmrg
235923a0898aSmrg	if test "$linkmode,$pass" = "lib,link" ||
236023a0898aSmrg	   test "$linkmode,$pass" = "prog,scan" ||
236123a0898aSmrg	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
236223a0898aSmrg	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
236323a0898aSmrg	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
236423a0898aSmrg	fi
236523a0898aSmrg
236623a0898aSmrg	if test "$pass" = conv; then
236723a0898aSmrg	  # Only check for convenience libraries
236823a0898aSmrg	  deplibs="$lib $deplibs"
236923a0898aSmrg	  if test -z "$libdir"; then
237023a0898aSmrg	    if test -z "$old_library"; then
237123a0898aSmrg	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
237223a0898aSmrg	      exit $EXIT_FAILURE
237323a0898aSmrg	    fi
237423a0898aSmrg	    # It is a libtool convenience library, so add in its objects.
237523a0898aSmrg	    convenience="$convenience $ladir/$objdir/$old_library"
237623a0898aSmrg	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
237723a0898aSmrg	    tmp_libs=
237823a0898aSmrg	    for deplib in $dependency_libs; do
237923a0898aSmrg	      deplibs="$deplib $deplibs"
238023a0898aSmrg              if test "X$duplicate_deps" = "Xyes" ; then
238123a0898aSmrg	        case "$tmp_libs " in
238223a0898aSmrg	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
238323a0898aSmrg	        esac
238423a0898aSmrg              fi
238523a0898aSmrg	      tmp_libs="$tmp_libs $deplib"
238623a0898aSmrg	    done
238723a0898aSmrg	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
238823a0898aSmrg	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
238923a0898aSmrg	    exit $EXIT_FAILURE
239023a0898aSmrg	  fi
239123a0898aSmrg	  continue
239223a0898aSmrg	fi # $pass = conv
239323a0898aSmrg
239423a0898aSmrg
239523a0898aSmrg	# Get the name of the library we link against.
239623a0898aSmrg	linklib=
239723a0898aSmrg	for l in $old_library $library_names; do
239823a0898aSmrg	  linklib="$l"
239923a0898aSmrg	done
240023a0898aSmrg	if test -z "$linklib"; then
240123a0898aSmrg	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
240223a0898aSmrg	  exit $EXIT_FAILURE
240323a0898aSmrg	fi
240423a0898aSmrg
240523a0898aSmrg	# This library was specified with -dlopen.
240623a0898aSmrg	if test "$pass" = dlopen; then
240723a0898aSmrg	  if test -z "$libdir"; then
240823a0898aSmrg	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
240923a0898aSmrg	    exit $EXIT_FAILURE
241023a0898aSmrg	  fi
241123a0898aSmrg	  if test -z "$dlname" ||
241223a0898aSmrg	     test "$dlopen_support" != yes ||
241323a0898aSmrg	     test "$build_libtool_libs" = no; then
241423a0898aSmrg	    # If there is no dlname, no dlopen support or we're linking
241523a0898aSmrg	    # statically, we need to preload.  We also need to preload any
241623a0898aSmrg	    # dependent libraries so libltdl's deplib preloader doesn't
241723a0898aSmrg	    # bomb out in the load deplibs phase.
241823a0898aSmrg	    dlprefiles="$dlprefiles $lib $dependency_libs"
241923a0898aSmrg	  else
242023a0898aSmrg	    newdlfiles="$newdlfiles $lib"
242123a0898aSmrg	  fi
242223a0898aSmrg	  continue
242323a0898aSmrg	fi # $pass = dlopen
242423a0898aSmrg
242523a0898aSmrg	# We need an absolute path.
242623a0898aSmrg	case $ladir in
242723a0898aSmrg	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
242823a0898aSmrg	*)
242923a0898aSmrg	  abs_ladir=`cd "$ladir" && pwd`
243023a0898aSmrg	  if test -z "$abs_ladir"; then
243123a0898aSmrg	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
243223a0898aSmrg	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
243323a0898aSmrg	    abs_ladir="$ladir"
243423a0898aSmrg	  fi
243523a0898aSmrg	  ;;
243623a0898aSmrg	esac
243723a0898aSmrg	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
243823a0898aSmrg
243923a0898aSmrg	# Find the relevant object directory and library name.
244023a0898aSmrg	if test "X$installed" = Xyes; then
244123a0898aSmrg	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
244223a0898aSmrg	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
244323a0898aSmrg	    dir="$ladir"
244423a0898aSmrg	    absdir="$abs_ladir"
244523a0898aSmrg	    libdir="$abs_ladir"
244623a0898aSmrg	  else
244723a0898aSmrg	    dir="$libdir"
244823a0898aSmrg	    absdir="$libdir"
244923a0898aSmrg	  fi
245023a0898aSmrg	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
245123a0898aSmrg	else
245223a0898aSmrg	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
245323a0898aSmrg	    dir="$ladir"
245423a0898aSmrg	    absdir="$abs_ladir"
245523a0898aSmrg	    # Remove this search path later
245623a0898aSmrg	    notinst_path="$notinst_path $abs_ladir"
245723a0898aSmrg	  else
245823a0898aSmrg	    dir="$ladir/$objdir"
245923a0898aSmrg	    absdir="$abs_ladir/$objdir"
246023a0898aSmrg	    # Remove this search path later
246123a0898aSmrg	    notinst_path="$notinst_path $abs_ladir"
246223a0898aSmrg	  fi
246323a0898aSmrg	fi # $installed = yes
246423a0898aSmrg	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
246523a0898aSmrg
246623a0898aSmrg	# This library was specified with -dlpreopen.
246723a0898aSmrg	if test "$pass" = dlpreopen; then
246823a0898aSmrg	  if test -z "$libdir"; then
246923a0898aSmrg	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
247023a0898aSmrg	    exit $EXIT_FAILURE
247123a0898aSmrg	  fi
247223a0898aSmrg	  # Prefer using a static library (so that no silly _DYNAMIC symbols
247323a0898aSmrg	  # are required to link).
247423a0898aSmrg	  if test -n "$old_library"; then
247523a0898aSmrg	    newdlprefiles="$newdlprefiles $dir/$old_library"
247623a0898aSmrg	  # Otherwise, use the dlname, so that lt_dlopen finds it.
247723a0898aSmrg	  elif test -n "$dlname"; then
247823a0898aSmrg	    newdlprefiles="$newdlprefiles $dir/$dlname"
247923a0898aSmrg	  else
248023a0898aSmrg	    newdlprefiles="$newdlprefiles $dir/$linklib"
248123a0898aSmrg	  fi
248223a0898aSmrg	fi # $pass = dlpreopen
248323a0898aSmrg
248423a0898aSmrg	if test -z "$libdir"; then
248523a0898aSmrg	  # Link the convenience library
248623a0898aSmrg	  if test "$linkmode" = lib; then
248723a0898aSmrg	    deplibs="$dir/$old_library $deplibs"
248823a0898aSmrg	  elif test "$linkmode,$pass" = "prog,link"; then
248923a0898aSmrg	    compile_deplibs="$dir/$old_library $compile_deplibs"
249023a0898aSmrg	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
249123a0898aSmrg	  else
249223a0898aSmrg	    deplibs="$lib $deplibs" # used for prog,scan pass
249323a0898aSmrg	  fi
249423a0898aSmrg	  continue
249523a0898aSmrg	fi
249623a0898aSmrg
249723a0898aSmrg
249823a0898aSmrg	if test "$linkmode" = prog && test "$pass" != link; then
249923a0898aSmrg	  newlib_search_path="$newlib_search_path $ladir"
250023a0898aSmrg	  deplibs="$lib $deplibs"
250123a0898aSmrg
250223a0898aSmrg	  linkalldeplibs=no
250323a0898aSmrg	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
250423a0898aSmrg	     test "$build_libtool_libs" = no; then
250523a0898aSmrg	    linkalldeplibs=yes
250623a0898aSmrg	  fi
250723a0898aSmrg
250823a0898aSmrg	  tmp_libs=
250923a0898aSmrg	  for deplib in $dependency_libs; do
251023a0898aSmrg	    case $deplib in
251123a0898aSmrg	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
251223a0898aSmrg	    esac
251323a0898aSmrg	    # Need to link against all dependency_libs?
251423a0898aSmrg	    if test "$linkalldeplibs" = yes; then
251523a0898aSmrg	      deplibs="$deplib $deplibs"
251623a0898aSmrg	    else
251723a0898aSmrg	      # Need to hardcode shared library paths
251823a0898aSmrg	      # or/and link against static libraries
251923a0898aSmrg	      newdependency_libs="$deplib $newdependency_libs"
252023a0898aSmrg	    fi
252123a0898aSmrg	    if test "X$duplicate_deps" = "Xyes" ; then
252223a0898aSmrg	      case "$tmp_libs " in
252323a0898aSmrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
252423a0898aSmrg	      esac
252523a0898aSmrg	    fi
252623a0898aSmrg	    tmp_libs="$tmp_libs $deplib"
252723a0898aSmrg	  done # for deplib
252823a0898aSmrg	  continue
252923a0898aSmrg	fi # $linkmode = prog...
253023a0898aSmrg
253123a0898aSmrg	if test "$linkmode,$pass" = "prog,link"; then
253223a0898aSmrg	  if test -n "$library_names" &&
253323a0898aSmrg	     { { test "$prefer_static_libs" = no ||
253423a0898aSmrg		 test "$prefer_static_libs,$installed" = "built,yes"; } ||
253523a0898aSmrg	       test -z "$old_library"; }; then
253623a0898aSmrg	    # We need to hardcode the library path
253723a0898aSmrg	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
253823a0898aSmrg	      # Make sure the rpath contains only unique directories.
253923a0898aSmrg	      case "$temp_rpath " in
254023a0898aSmrg	      *" $dir "*) ;;
254123a0898aSmrg	      *" $absdir "*) ;;
254223a0898aSmrg	      *) temp_rpath="$temp_rpath $absdir" ;;
254323a0898aSmrg	      esac
254423a0898aSmrg	    fi
254523a0898aSmrg
254623a0898aSmrg	    # Hardcode the library path.
254723a0898aSmrg	    # Skip directories that are in the system default run-time
254823a0898aSmrg	    # search path.
254923a0898aSmrg	    case " $sys_lib_dlsearch_path " in
255023a0898aSmrg	    *" $absdir "*) ;;
255123a0898aSmrg	    *)
255223a0898aSmrg	      case "$compile_rpath " in
255323a0898aSmrg	      *" $absdir "*) ;;
255423a0898aSmrg	      *) compile_rpath="$compile_rpath $absdir"
255523a0898aSmrg	      esac
255623a0898aSmrg	      ;;
255723a0898aSmrg	    esac
255823a0898aSmrg	    case " $sys_lib_dlsearch_path " in
255923a0898aSmrg	    *" $libdir "*) ;;
256023a0898aSmrg	    *)
256123a0898aSmrg	      case "$finalize_rpath " in
256223a0898aSmrg	      *" $libdir "*) ;;
256323a0898aSmrg	      *) finalize_rpath="$finalize_rpath $libdir"
256423a0898aSmrg	      esac
256523a0898aSmrg	      ;;
256623a0898aSmrg	    esac
256723a0898aSmrg	  fi # $linkmode,$pass = prog,link...
256823a0898aSmrg
256923a0898aSmrg	  if test "$alldeplibs" = yes &&
257023a0898aSmrg	     { test "$deplibs_check_method" = pass_all ||
257123a0898aSmrg	       { test "$build_libtool_libs" = yes &&
257223a0898aSmrg		 test -n "$library_names"; }; }; then
257323a0898aSmrg	    # We only need to search for static libraries
257423a0898aSmrg	    continue
257523a0898aSmrg	  fi
257623a0898aSmrg	fi
257723a0898aSmrg
257823a0898aSmrg	link_static=no # Whether the deplib will be linked statically
257923a0898aSmrg	use_static_libs=$prefer_static_libs
258023a0898aSmrg	if test "$use_static_libs" = built && test "$installed" = yes ; then
258123a0898aSmrg	  use_static_libs=no
258223a0898aSmrg	fi
258323a0898aSmrg	if test -n "$library_names" &&
258423a0898aSmrg	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
258523a0898aSmrg	  if test "$installed" = no; then
258623a0898aSmrg	    notinst_deplibs="$notinst_deplibs $lib"
258723a0898aSmrg	    need_relink=yes
258823a0898aSmrg	  fi
258923a0898aSmrg	  # This is a shared library
259023a0898aSmrg
259123a0898aSmrg	  # Warn about portability, can't link against -module's on
259223a0898aSmrg	  # some systems (darwin)
259323a0898aSmrg	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
259423a0898aSmrg	    $echo
259523a0898aSmrg	    if test "$linkmode" = prog; then
259623a0898aSmrg	      $echo "*** Warning: Linking the executable $output against the loadable module"
259723a0898aSmrg	    else
259823a0898aSmrg	      $echo "*** Warning: Linking the shared library $output against the loadable module"
259923a0898aSmrg	    fi
260023a0898aSmrg	    $echo "*** $linklib is not portable!"
260123a0898aSmrg	  fi
260223a0898aSmrg	  if test "$linkmode" = lib &&
260323a0898aSmrg	     test "$hardcode_into_libs" = yes; then
260423a0898aSmrg	    # Hardcode the library path.
260523a0898aSmrg	    # Skip directories that are in the system default run-time
260623a0898aSmrg	    # search path.
260723a0898aSmrg	    case " $sys_lib_dlsearch_path " in
260823a0898aSmrg	    *" $absdir "*) ;;
260923a0898aSmrg	    *)
261023a0898aSmrg	      case "$compile_rpath " in
261123a0898aSmrg	      *" $absdir "*) ;;
261223a0898aSmrg	      *) compile_rpath="$compile_rpath $absdir"
261323a0898aSmrg	      esac
261423a0898aSmrg	      ;;
261523a0898aSmrg	    esac
261623a0898aSmrg	    case " $sys_lib_dlsearch_path " in
261723a0898aSmrg	    *" $libdir "*) ;;
261823a0898aSmrg	    *)
261923a0898aSmrg	      case "$finalize_rpath " in
262023a0898aSmrg	      *" $libdir "*) ;;
262123a0898aSmrg	      *) finalize_rpath="$finalize_rpath $libdir"
262223a0898aSmrg	      esac
262323a0898aSmrg	      ;;
262423a0898aSmrg	    esac
262523a0898aSmrg	  fi
262623a0898aSmrg
262723a0898aSmrg	  if test -n "$old_archive_from_expsyms_cmds"; then
262823a0898aSmrg	    # figure out the soname
262923a0898aSmrg	    set dummy $library_names
263023a0898aSmrg	    realname="$2"
263123a0898aSmrg	    shift; shift
263223a0898aSmrg	    libname=`eval \\$echo \"$libname_spec\"`
263323a0898aSmrg	    # use dlname if we got it. it's perfectly good, no?
263423a0898aSmrg	    if test -n "$dlname"; then
263523a0898aSmrg	      soname="$dlname"
263623a0898aSmrg	    elif test -n "$soname_spec"; then
263723a0898aSmrg	      # bleh windows
263823a0898aSmrg	      case $host in
263923a0898aSmrg	      *cygwin* | mingw*)
264023a0898aSmrg		major=`expr $current - $age`
264123a0898aSmrg		versuffix="-$major"
264223a0898aSmrg		;;
264323a0898aSmrg	      esac
264423a0898aSmrg	      eval soname=\"$soname_spec\"
264523a0898aSmrg	    else
264623a0898aSmrg	      soname="$realname"
264723a0898aSmrg	    fi
264823a0898aSmrg
264923a0898aSmrg	    # Make a new name for the extract_expsyms_cmds to use
265023a0898aSmrg	    soroot="$soname"
265123a0898aSmrg	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
265223a0898aSmrg	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
265323a0898aSmrg
265423a0898aSmrg	    # If the library has no export list, then create one now
265523a0898aSmrg	    if test -f "$output_objdir/$soname-def"; then :
265623a0898aSmrg	    else
265723a0898aSmrg	      $show "extracting exported symbol list from \`$soname'"
265823a0898aSmrg	      save_ifs="$IFS"; IFS='~'
265923a0898aSmrg	      cmds=$extract_expsyms_cmds
266023a0898aSmrg	      for cmd in $cmds; do
266123a0898aSmrg		IFS="$save_ifs"
266223a0898aSmrg		eval cmd=\"$cmd\"
266323a0898aSmrg		$show "$cmd"
266423a0898aSmrg		$run eval "$cmd" || exit $?
266523a0898aSmrg	      done
266623a0898aSmrg	      IFS="$save_ifs"
266723a0898aSmrg	    fi
266823a0898aSmrg
266923a0898aSmrg	    # Create $newlib
267023a0898aSmrg	    if test -f "$output_objdir/$newlib"; then :; else
267123a0898aSmrg	      $show "generating import library for \`$soname'"
267223a0898aSmrg	      save_ifs="$IFS"; IFS='~'
267323a0898aSmrg	      cmds=$old_archive_from_expsyms_cmds
267423a0898aSmrg	      for cmd in $cmds; do
267523a0898aSmrg		IFS="$save_ifs"
267623a0898aSmrg		eval cmd=\"$cmd\"
267723a0898aSmrg		$show "$cmd"
267823a0898aSmrg		$run eval "$cmd" || exit $?
267923a0898aSmrg	      done
268023a0898aSmrg	      IFS="$save_ifs"
268123a0898aSmrg	    fi
268223a0898aSmrg	    # make sure the library variables are pointing to the new library
268323a0898aSmrg	    dir=$output_objdir
268423a0898aSmrg	    linklib=$newlib
268523a0898aSmrg	  fi # test -n "$old_archive_from_expsyms_cmds"
268623a0898aSmrg
268723a0898aSmrg	  if test "$linkmode" = prog || test "$mode" != relink; then
268823a0898aSmrg	    add_shlibpath=
268923a0898aSmrg	    add_dir=
269023a0898aSmrg	    add=
269123a0898aSmrg	    lib_linked=yes
269223a0898aSmrg	    case $hardcode_action in
269323a0898aSmrg	    immediate | unsupported)
269423a0898aSmrg	      if test "$hardcode_direct" = no; then
269523a0898aSmrg		add="$dir/$linklib"
269623a0898aSmrg		case $host in
269723a0898aSmrg		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
269823a0898aSmrg		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
269923a0898aSmrg		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
270023a0898aSmrg		    *-*-unixware7*) add_dir="-L$dir" ;;
270123a0898aSmrg		  *-*-darwin* )
270223a0898aSmrg		    # if the lib is a module then we can not link against
270323a0898aSmrg		    # it, someone is ignoring the new warnings I added
270423a0898aSmrg		    if /usr/bin/file -L $add 2> /dev/null |
270523a0898aSmrg                      $EGREP ": [^:]* bundle" >/dev/null ; then
270623a0898aSmrg		      $echo "** Warning, lib $linklib is a module, not a shared library"
270723a0898aSmrg		      if test -z "$old_library" ; then
270823a0898aSmrg		        $echo
270923a0898aSmrg		        $echo "** And there doesn't seem to be a static archive available"
271023a0898aSmrg		        $echo "** The link will probably fail, sorry"
271123a0898aSmrg		      else
271223a0898aSmrg		        add="$dir/$old_library"
271323a0898aSmrg		      fi
271423a0898aSmrg		    fi
271523a0898aSmrg		esac
271623a0898aSmrg	      elif test "$hardcode_minus_L" = no; then
271723a0898aSmrg		case $host in
271823a0898aSmrg		*-*-sunos*) add_shlibpath="$dir" ;;
271923a0898aSmrg		esac
272023a0898aSmrg		add_dir="-L$dir"
272123a0898aSmrg		add="-l$name"
272223a0898aSmrg	      elif test "$hardcode_shlibpath_var" = no; then
272323a0898aSmrg		add_shlibpath="$dir"
272423a0898aSmrg		add="-l$name"
272523a0898aSmrg	      else
272623a0898aSmrg		lib_linked=no
272723a0898aSmrg	      fi
272823a0898aSmrg	      ;;
272923a0898aSmrg	    relink)
273023a0898aSmrg	      if test "$hardcode_direct" = yes; then
273123a0898aSmrg		add="$dir/$linklib"
273223a0898aSmrg	      elif test "$hardcode_minus_L" = yes; then
273323a0898aSmrg		add_dir="-L$dir"
273423a0898aSmrg		# Try looking first in the location we're being installed to.
273523a0898aSmrg		if test -n "$inst_prefix_dir"; then
273623a0898aSmrg		  case $libdir in
273723a0898aSmrg		    [\\/]*)
273823a0898aSmrg		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
273923a0898aSmrg		      ;;
274023a0898aSmrg		  esac
274123a0898aSmrg		fi
274223a0898aSmrg		add="-l$name"
274323a0898aSmrg	      elif test "$hardcode_shlibpath_var" = yes; then
274423a0898aSmrg		add_shlibpath="$dir"
274523a0898aSmrg		add="-l$name"
274623a0898aSmrg	      else
274723a0898aSmrg		lib_linked=no
274823a0898aSmrg	      fi
274923a0898aSmrg	      ;;
275023a0898aSmrg	    *) lib_linked=no ;;
275123a0898aSmrg	    esac
275223a0898aSmrg
275323a0898aSmrg	    if test "$lib_linked" != yes; then
275423a0898aSmrg	      $echo "$modename: configuration error: unsupported hardcode properties"
275523a0898aSmrg	      exit $EXIT_FAILURE
275623a0898aSmrg	    fi
275723a0898aSmrg
275823a0898aSmrg	    if test -n "$add_shlibpath"; then
275923a0898aSmrg	      case :$compile_shlibpath: in
276023a0898aSmrg	      *":$add_shlibpath:"*) ;;
276123a0898aSmrg	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
276223a0898aSmrg	      esac
276323a0898aSmrg	    fi
276423a0898aSmrg	    if test "$linkmode" = prog; then
276523a0898aSmrg	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
276623a0898aSmrg	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
276723a0898aSmrg	    else
276823a0898aSmrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
276923a0898aSmrg	      test -n "$add" && deplibs="$add $deplibs"
277023a0898aSmrg	      if test "$hardcode_direct" != yes && \
277123a0898aSmrg		 test "$hardcode_minus_L" != yes && \
277223a0898aSmrg		 test "$hardcode_shlibpath_var" = yes; then
277323a0898aSmrg		case :$finalize_shlibpath: in
277423a0898aSmrg		*":$libdir:"*) ;;
277523a0898aSmrg		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
277623a0898aSmrg		esac
277723a0898aSmrg	      fi
277823a0898aSmrg	    fi
277923a0898aSmrg	  fi
278023a0898aSmrg
278123a0898aSmrg	  if test "$linkmode" = prog || test "$mode" = relink; then
278223a0898aSmrg	    add_shlibpath=
278323a0898aSmrg	    add_dir=
278423a0898aSmrg	    add=
278523a0898aSmrg	    # Finalize command for both is simple: just hardcode it.
278623a0898aSmrg	    if test "$hardcode_direct" = yes; then
278723a0898aSmrg	      add="$libdir/$linklib"
278823a0898aSmrg	    elif test "$hardcode_minus_L" = yes; then
278923a0898aSmrg	      add_dir="-L$libdir"
279023a0898aSmrg	      add="-l$name"
279123a0898aSmrg	    elif test "$hardcode_shlibpath_var" = yes; then
279223a0898aSmrg	      case :$finalize_shlibpath: in
279323a0898aSmrg	      *":$libdir:"*) ;;
279423a0898aSmrg	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
279523a0898aSmrg	      esac
279623a0898aSmrg	      add="-l$name"
279723a0898aSmrg	    elif test "$hardcode_automatic" = yes; then
279823a0898aSmrg	      if test -n "$inst_prefix_dir" &&
279923a0898aSmrg		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
280023a0898aSmrg	        add="$inst_prefix_dir$libdir/$linklib"
280123a0898aSmrg	      else
280223a0898aSmrg	        add="$libdir/$linklib"
280323a0898aSmrg	      fi
280423a0898aSmrg	    else
280523a0898aSmrg	      # We cannot seem to hardcode it, guess we'll fake it.
280623a0898aSmrg	      add_dir="-L$libdir"
280723a0898aSmrg	      # Try looking first in the location we're being installed to.
280823a0898aSmrg	      if test -n "$inst_prefix_dir"; then
280923a0898aSmrg		case $libdir in
281023a0898aSmrg		  [\\/]*)
281123a0898aSmrg		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
281223a0898aSmrg		    ;;
281323a0898aSmrg		esac
281423a0898aSmrg	      fi
281523a0898aSmrg	      add="-l$name"
281623a0898aSmrg	    fi
281723a0898aSmrg
281823a0898aSmrg	    if test "$linkmode" = prog; then
281923a0898aSmrg	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
282023a0898aSmrg	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
282123a0898aSmrg	    else
282223a0898aSmrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
282323a0898aSmrg	      test -n "$add" && deplibs="$add $deplibs"
282423a0898aSmrg	    fi
282523a0898aSmrg	  fi
282623a0898aSmrg	elif test "$linkmode" = prog; then
282723a0898aSmrg	  # Here we assume that one of hardcode_direct or hardcode_minus_L
282823a0898aSmrg	  # is not unsupported.  This is valid on all known static and
282923a0898aSmrg	  # shared platforms.
283023a0898aSmrg	  if test "$hardcode_direct" != unsupported; then
283123a0898aSmrg	    test -n "$old_library" && linklib="$old_library"
283223a0898aSmrg	    compile_deplibs="$dir/$linklib $compile_deplibs"
283323a0898aSmrg	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
283423a0898aSmrg	  else
283523a0898aSmrg	    compile_deplibs="-l$name -L$dir $compile_deplibs"
283623a0898aSmrg	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
283723a0898aSmrg	  fi
283823a0898aSmrg	elif test "$build_libtool_libs" = yes; then
283923a0898aSmrg	  # Not a shared library
284023a0898aSmrg	  if test "$deplibs_check_method" != pass_all; then
284123a0898aSmrg	    # We're trying link a shared library against a static one
284223a0898aSmrg	    # but the system doesn't support it.
284323a0898aSmrg
284423a0898aSmrg	    # Just print a warning and add the library to dependency_libs so
284523a0898aSmrg	    # that the program can be linked against the static library.
284623a0898aSmrg	    $echo
284723a0898aSmrg	    $echo "*** Warning: This system can not link to static lib archive $lib."
284823a0898aSmrg	    $echo "*** I have the capability to make that library automatically link in when"
284923a0898aSmrg	    $echo "*** you link to this library.  But I can only do this if you have a"
285023a0898aSmrg	    $echo "*** shared version of the library, which you do not appear to have."
285123a0898aSmrg	    if test "$module" = yes; then
285223a0898aSmrg	      $echo "*** But as you try to build a module library, libtool will still create "
285323a0898aSmrg	      $echo "*** a static module, that should work as long as the dlopening application"
285423a0898aSmrg	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
285523a0898aSmrg	      if test -z "$global_symbol_pipe"; then
285623a0898aSmrg		$echo
285723a0898aSmrg		$echo "*** However, this would only work if libtool was able to extract symbol"
285823a0898aSmrg		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
285923a0898aSmrg		$echo "*** not find such a program.  So, this module is probably useless."
286023a0898aSmrg		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
286123a0898aSmrg	      fi
286223a0898aSmrg	      if test "$build_old_libs" = no; then
286323a0898aSmrg		build_libtool_libs=module
286423a0898aSmrg		build_old_libs=yes
286523a0898aSmrg	      else
286623a0898aSmrg		build_libtool_libs=no
286723a0898aSmrg	      fi
286823a0898aSmrg	    fi
286923a0898aSmrg	  else
287023a0898aSmrg	    deplibs="$dir/$old_library $deplibs"
287123a0898aSmrg	    link_static=yes
287223a0898aSmrg	  fi
287323a0898aSmrg	fi # link shared/static library?
287423a0898aSmrg
287523a0898aSmrg	if test "$linkmode" = lib; then
287623a0898aSmrg	  if test -n "$dependency_libs" &&
287723a0898aSmrg	     { test "$hardcode_into_libs" != yes ||
287823a0898aSmrg	       test "$build_old_libs" = yes ||
287923a0898aSmrg	       test "$link_static" = yes; }; then
288023a0898aSmrg	    # Extract -R from dependency_libs
288123a0898aSmrg	    temp_deplibs=
288223a0898aSmrg	    for libdir in $dependency_libs; do
288323a0898aSmrg	      case $libdir in
288423a0898aSmrg	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
288523a0898aSmrg		   case " $xrpath " in
288623a0898aSmrg		   *" $temp_xrpath "*) ;;
288723a0898aSmrg		   *) xrpath="$xrpath $temp_xrpath";;
288823a0898aSmrg		   esac;;
288923a0898aSmrg	      *) temp_deplibs="$temp_deplibs $libdir";;
289023a0898aSmrg	      esac
289123a0898aSmrg	    done
289223a0898aSmrg	    dependency_libs="$temp_deplibs"
289323a0898aSmrg	  fi
289423a0898aSmrg
289523a0898aSmrg	  newlib_search_path="$newlib_search_path $absdir"
289623a0898aSmrg	  # Link against this library
289723a0898aSmrg	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
289823a0898aSmrg	  # ... and its dependency_libs
289923a0898aSmrg	  tmp_libs=
290023a0898aSmrg	  for deplib in $dependency_libs; do
290123a0898aSmrg	    newdependency_libs="$deplib $newdependency_libs"
290223a0898aSmrg	    if test "X$duplicate_deps" = "Xyes" ; then
290323a0898aSmrg	      case "$tmp_libs " in
290423a0898aSmrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
290523a0898aSmrg	      esac
290623a0898aSmrg	    fi
290723a0898aSmrg	    tmp_libs="$tmp_libs $deplib"
290823a0898aSmrg	  done
290923a0898aSmrg
291023a0898aSmrg	  if test "$link_all_deplibs" != no; then
291123a0898aSmrg	    # Add the search paths of all dependency libraries
291223a0898aSmrg	    for deplib in $dependency_libs; do
291323a0898aSmrg	      case $deplib in
291423a0898aSmrg	      -L*) path="$deplib" ;;
291523a0898aSmrg	      *.la)
291623a0898aSmrg		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
291723a0898aSmrg		test "X$dir" = "X$deplib" && dir="."
291823a0898aSmrg		# We need an absolute path.
291923a0898aSmrg		case $dir in
292023a0898aSmrg		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
292123a0898aSmrg		*)
292223a0898aSmrg		  absdir=`cd "$dir" && pwd`
292323a0898aSmrg		  if test -z "$absdir"; then
292423a0898aSmrg		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
292523a0898aSmrg		    absdir="$dir"
292623a0898aSmrg		  fi
292723a0898aSmrg		  ;;
292823a0898aSmrg		esac
292923a0898aSmrg		if grep "^installed=no" $deplib > /dev/null; then
293023a0898aSmrg		  path="$absdir/$objdir"
293123a0898aSmrg		else
293223a0898aSmrg		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
293323a0898aSmrg		  if test -z "$libdir"; then
293423a0898aSmrg		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
293523a0898aSmrg		    exit $EXIT_FAILURE
293623a0898aSmrg		  fi
293723a0898aSmrg		  if test "$absdir" != "$libdir"; then
293823a0898aSmrg		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
293923a0898aSmrg		  fi
294023a0898aSmrg		  path="$absdir"
294123a0898aSmrg		fi
294223a0898aSmrg		depdepl=
294323a0898aSmrg		case $host in
294423a0898aSmrg		*-*-darwin*)
294523a0898aSmrg		  # we do not want to link against static libs,
294623a0898aSmrg		  # but need to link against shared
294723a0898aSmrg		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
294823a0898aSmrg		  if test -n "$deplibrary_names" ; then
294923a0898aSmrg		    for tmp in $deplibrary_names ; do
295023a0898aSmrg		      depdepl=$tmp
295123a0898aSmrg		    done
295223a0898aSmrg		    if test -f "$path/$depdepl" ; then
295323a0898aSmrg		      depdepl="$path/$depdepl"
295423a0898aSmrg		    fi
295523a0898aSmrg		    # do not add paths which are already there
295623a0898aSmrg		    case " $newlib_search_path " in
295723a0898aSmrg		    *" $path "*) ;;
295823a0898aSmrg		    *) newlib_search_path="$newlib_search_path $path";;
295923a0898aSmrg		    esac
296023a0898aSmrg		  fi
296123a0898aSmrg		  path=""
296223a0898aSmrg		  ;;
296323a0898aSmrg		*)
296423a0898aSmrg		  path="-L$path"
296523a0898aSmrg		  ;;
296623a0898aSmrg		esac
296723a0898aSmrg		;;
296823a0898aSmrg	      -l*)
296923a0898aSmrg		case $host in
297023a0898aSmrg		*-*-darwin*)
297123a0898aSmrg		  # Again, we only want to link against shared libraries
297223a0898aSmrg		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
297323a0898aSmrg		  for tmp in $newlib_search_path ; do
297423a0898aSmrg		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
297523a0898aSmrg		      eval depdepl="$tmp/lib$tmp_libs.dylib"
297623a0898aSmrg		      break
297723a0898aSmrg		    fi
297823a0898aSmrg		  done
297923a0898aSmrg		  path=""
298023a0898aSmrg		  ;;
298123a0898aSmrg		*) continue ;;
298223a0898aSmrg		esac
298323a0898aSmrg		;;
298423a0898aSmrg	      *) continue ;;
298523a0898aSmrg	      esac
298623a0898aSmrg	      case " $deplibs " in
298723a0898aSmrg	      *" $path "*) ;;
298823a0898aSmrg	      *) deplibs="$path $deplibs" ;;
298923a0898aSmrg	      esac
299023a0898aSmrg	      case " $deplibs " in
299123a0898aSmrg	      *" $depdepl "*) ;;
299223a0898aSmrg	      *) deplibs="$depdepl $deplibs" ;;
299323a0898aSmrg	      esac
299423a0898aSmrg	    done
299523a0898aSmrg	  fi # link_all_deplibs != no
299623a0898aSmrg	fi # linkmode = lib
299723a0898aSmrg      done # for deplib in $libs
299823a0898aSmrg      dependency_libs="$newdependency_libs"
299923a0898aSmrg      if test "$pass" = dlpreopen; then
300023a0898aSmrg	# Link the dlpreopened libraries before other libraries
300123a0898aSmrg	for deplib in $save_deplibs; do
300223a0898aSmrg	  deplibs="$deplib $deplibs"
300323a0898aSmrg	done
300423a0898aSmrg      fi
300523a0898aSmrg      if test "$pass" != dlopen; then
300623a0898aSmrg	if test "$pass" != conv; then
300723a0898aSmrg	  # Make sure lib_search_path contains only unique directories.
300823a0898aSmrg	  lib_search_path=
300923a0898aSmrg	  for dir in $newlib_search_path; do
301023a0898aSmrg	    case "$lib_search_path " in
301123a0898aSmrg	    *" $dir "*) ;;
301223a0898aSmrg	    *) lib_search_path="$lib_search_path $dir" ;;
301323a0898aSmrg	    esac
301423a0898aSmrg	  done
301523a0898aSmrg	  newlib_search_path=
301623a0898aSmrg	fi
301723a0898aSmrg
301823a0898aSmrg	if test "$linkmode,$pass" != "prog,link"; then
301923a0898aSmrg	  vars="deplibs"
302023a0898aSmrg	else
302123a0898aSmrg	  vars="compile_deplibs finalize_deplibs"
302223a0898aSmrg	fi
302323a0898aSmrg	for var in $vars dependency_libs; do
302423a0898aSmrg	  # Add libraries to $var in reverse order
302523a0898aSmrg	  eval tmp_libs=\"\$$var\"
302623a0898aSmrg	  new_libs=
302723a0898aSmrg	  for deplib in $tmp_libs; do
302823a0898aSmrg	    # FIXME: Pedantically, this is the right thing to do, so
302923a0898aSmrg	    #        that some nasty dependency loop isn't accidentally
303023a0898aSmrg	    #        broken:
303123a0898aSmrg	    #new_libs="$deplib $new_libs"
303223a0898aSmrg	    # Pragmatically, this seems to cause very few problems in
303323a0898aSmrg	    # practice:
303423a0898aSmrg	    case $deplib in
303523a0898aSmrg	    -L*) new_libs="$deplib $new_libs" ;;
303623a0898aSmrg	    -R*) ;;
303723a0898aSmrg	    *)
303823a0898aSmrg	      # And here is the reason: when a library appears more
303923a0898aSmrg	      # than once as an explicit dependence of a library, or
304023a0898aSmrg	      # is implicitly linked in more than once by the
304123a0898aSmrg	      # compiler, it is considered special, and multiple
304223a0898aSmrg	      # occurrences thereof are not removed.  Compare this
304323a0898aSmrg	      # with having the same library being listed as a
304423a0898aSmrg	      # dependency of multiple other libraries: in this case,
304523a0898aSmrg	      # we know (pedantically, we assume) the library does not
304623a0898aSmrg	      # need to be listed more than once, so we keep only the
304723a0898aSmrg	      # last copy.  This is not always right, but it is rare
304823a0898aSmrg	      # enough that we require users that really mean to play
304923a0898aSmrg	      # such unportable linking tricks to link the library
305023a0898aSmrg	      # using -Wl,-lname, so that libtool does not consider it
305123a0898aSmrg	      # for duplicate removal.
305223a0898aSmrg	      case " $specialdeplibs " in
305323a0898aSmrg	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
305423a0898aSmrg	      *)
305523a0898aSmrg		case " $new_libs " in
305623a0898aSmrg		*" $deplib "*) ;;
305723a0898aSmrg		*) new_libs="$deplib $new_libs" ;;
305823a0898aSmrg		esac
305923a0898aSmrg		;;
306023a0898aSmrg	      esac
306123a0898aSmrg	      ;;
306223a0898aSmrg	    esac
306323a0898aSmrg	  done
306423a0898aSmrg	  tmp_libs=
306523a0898aSmrg	  for deplib in $new_libs; do
306623a0898aSmrg	    case $deplib in
306723a0898aSmrg	    -L*)
306823a0898aSmrg	      case " $tmp_libs " in
306923a0898aSmrg	      *" $deplib "*) ;;
307023a0898aSmrg	      *) tmp_libs="$tmp_libs $deplib" ;;
307123a0898aSmrg	      esac
307223a0898aSmrg	      ;;
307323a0898aSmrg	    *) tmp_libs="$tmp_libs $deplib" ;;
307423a0898aSmrg	    esac
307523a0898aSmrg	  done
307623a0898aSmrg	  eval $var=\"$tmp_libs\"
307723a0898aSmrg	done # for var
307823a0898aSmrg      fi
307923a0898aSmrg      # Last step: remove runtime libs from dependency_libs
308023a0898aSmrg      # (they stay in deplibs)
308123a0898aSmrg      tmp_libs=
308223a0898aSmrg      for i in $dependency_libs ; do
308323a0898aSmrg	case " $predeps $postdeps $compiler_lib_search_path " in
308423a0898aSmrg	*" $i "*)
308523a0898aSmrg	  i=""
308623a0898aSmrg	  ;;
308723a0898aSmrg	esac
308823a0898aSmrg	if test -n "$i" ; then
308923a0898aSmrg	  tmp_libs="$tmp_libs $i"
309023a0898aSmrg	fi
309123a0898aSmrg      done
309223a0898aSmrg      dependency_libs=$tmp_libs
309323a0898aSmrg    done # for pass
309423a0898aSmrg    if test "$linkmode" = prog; then
309523a0898aSmrg      dlfiles="$newdlfiles"
309623a0898aSmrg      dlprefiles="$newdlprefiles"
309723a0898aSmrg    fi
309823a0898aSmrg
309923a0898aSmrg    case $linkmode in
310023a0898aSmrg    oldlib)
310123a0898aSmrg      if test -n "$deplibs"; then
310223a0898aSmrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
310323a0898aSmrg      fi
310423a0898aSmrg
310523a0898aSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
310623a0898aSmrg	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
310723a0898aSmrg      fi
310823a0898aSmrg
310923a0898aSmrg      if test -n "$rpath"; then
311023a0898aSmrg	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
311123a0898aSmrg      fi
311223a0898aSmrg
311323a0898aSmrg      if test -n "$xrpath"; then
311423a0898aSmrg	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
311523a0898aSmrg      fi
311623a0898aSmrg
311723a0898aSmrg      if test -n "$vinfo"; then
311823a0898aSmrg	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
311923a0898aSmrg      fi
312023a0898aSmrg
312123a0898aSmrg      if test -n "$release"; then
312223a0898aSmrg	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
312323a0898aSmrg      fi
312423a0898aSmrg
312523a0898aSmrg      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
312623a0898aSmrg	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
312723a0898aSmrg      fi
312823a0898aSmrg
312923a0898aSmrg      # Now set the variables for building old libraries.
313023a0898aSmrg      build_libtool_libs=no
313123a0898aSmrg      oldlibs="$output"
313223a0898aSmrg      objs="$objs$old_deplibs"
313323a0898aSmrg      ;;
313423a0898aSmrg
313523a0898aSmrg    lib)
313623a0898aSmrg      # Make sure we only generate libraries of the form `libNAME.la'.
313723a0898aSmrg      case $outputname in
313823a0898aSmrg      lib*)
313923a0898aSmrg	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
314023a0898aSmrg	eval shared_ext=\"$shrext_cmds\"
314123a0898aSmrg	eval libname=\"$libname_spec\"
314223a0898aSmrg	;;
314323a0898aSmrg      *)
314423a0898aSmrg	if test "$module" = no; then
314523a0898aSmrg	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
314623a0898aSmrg	  $echo "$help" 1>&2
314723a0898aSmrg	  exit $EXIT_FAILURE
314823a0898aSmrg	fi
314923a0898aSmrg	if test "$need_lib_prefix" != no; then
315023a0898aSmrg	  # Add the "lib" prefix for modules if required
315123a0898aSmrg	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
315223a0898aSmrg	  eval shared_ext=\"$shrext_cmds\"
315323a0898aSmrg	  eval libname=\"$libname_spec\"
315423a0898aSmrg	else
315523a0898aSmrg	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
315623a0898aSmrg	fi
315723a0898aSmrg	;;
315823a0898aSmrg      esac
315923a0898aSmrg
316023a0898aSmrg      if test -n "$objs"; then
316123a0898aSmrg	if test "$deplibs_check_method" != pass_all; then
316223a0898aSmrg	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
316323a0898aSmrg	  exit $EXIT_FAILURE
316423a0898aSmrg	else
316523a0898aSmrg	  $echo
316623a0898aSmrg	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
316723a0898aSmrg	  $echo "*** objects $objs is not portable!"
316823a0898aSmrg	  libobjs="$libobjs $objs"
316923a0898aSmrg	fi
317023a0898aSmrg      fi
317123a0898aSmrg
317223a0898aSmrg      if test "$dlself" != no; then
317323a0898aSmrg	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
317423a0898aSmrg      fi
317523a0898aSmrg
317623a0898aSmrg      set dummy $rpath
317723a0898aSmrg      if test "$#" -gt 2; then
317823a0898aSmrg	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
317923a0898aSmrg      fi
318023a0898aSmrg      install_libdir="$2"
318123a0898aSmrg
318223a0898aSmrg      oldlibs=
318323a0898aSmrg      if test -z "$rpath"; then
318423a0898aSmrg	if test "$build_libtool_libs" = yes; then
318523a0898aSmrg	  # Building a libtool convenience library.
318623a0898aSmrg	  # Some compilers have problems with a `.al' extension so
318723a0898aSmrg	  # convenience libraries should have the same extension an
318823a0898aSmrg	  # archive normally would.
318923a0898aSmrg	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
319023a0898aSmrg	  build_libtool_libs=convenience
319123a0898aSmrg	  build_old_libs=yes
319223a0898aSmrg	fi
319323a0898aSmrg
319423a0898aSmrg	if test -n "$vinfo"; then
319523a0898aSmrg	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
319623a0898aSmrg	fi
319723a0898aSmrg
319823a0898aSmrg	if test -n "$release"; then
319923a0898aSmrg	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
320023a0898aSmrg	fi
320123a0898aSmrg      else
320223a0898aSmrg
320323a0898aSmrg	# Parse the version information argument.
320423a0898aSmrg	save_ifs="$IFS"; IFS=':'
320523a0898aSmrg	set dummy $vinfo 0 0 0
320623a0898aSmrg	IFS="$save_ifs"
320723a0898aSmrg
320823a0898aSmrg	if test -n "$8"; then
320923a0898aSmrg	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
321023a0898aSmrg	  $echo "$help" 1>&2
321123a0898aSmrg	  exit $EXIT_FAILURE
321223a0898aSmrg	fi
321323a0898aSmrg
321423a0898aSmrg	# convert absolute version numbers to libtool ages
321523a0898aSmrg	# this retains compatibility with .la files and attempts
321623a0898aSmrg	# to make the code below a bit more comprehensible
321723a0898aSmrg
321823a0898aSmrg	case $vinfo_number in
321923a0898aSmrg	yes)
322023a0898aSmrg	  number_major="$2"
322123a0898aSmrg	  number_minor="$3"
322223a0898aSmrg	  number_revision="$4"
322323a0898aSmrg	  #
322423a0898aSmrg	  # There are really only two kinds -- those that
322523a0898aSmrg	  # use the current revision as the major version
322623a0898aSmrg	  # and those that subtract age and use age as
322723a0898aSmrg	  # a minor version.  But, then there is irix
322823a0898aSmrg	  # which has an extra 1 added just for fun
322923a0898aSmrg	  #
323023a0898aSmrg	  case $version_type in
323123a0898aSmrg	  darwin|linux|osf|windows|none)
323223a0898aSmrg	    current=`expr $number_major + $number_minor`
323323a0898aSmrg	    age="$number_minor"
323423a0898aSmrg	    revision="$number_revision"
323523a0898aSmrg	    ;;
323623a0898aSmrg	  freebsd-aout|freebsd-elf|sunos)
323723a0898aSmrg	    current="$number_major"
323823a0898aSmrg	    revision="$number_minor"
323923a0898aSmrg	    age="0"
324023a0898aSmrg	    ;;
324123a0898aSmrg	  irix|nonstopux)
324223a0898aSmrg	    current=`expr $number_major + $number_minor`
324323a0898aSmrg	    age="$number_minor"
324423a0898aSmrg	    revision="$number_minor"
324523a0898aSmrg	    lt_irix_increment=no
324623a0898aSmrg	    ;;
324723a0898aSmrg	  esac
324823a0898aSmrg	  ;;
324923a0898aSmrg	no)
325023a0898aSmrg	  current="$2"
325123a0898aSmrg	  revision="$3"
325223a0898aSmrg	  age="$4"
325323a0898aSmrg	  ;;
325423a0898aSmrg	esac
325523a0898aSmrg
325623a0898aSmrg	# Check that each of the things are valid numbers.
325723a0898aSmrg	case $current in
325823a0898aSmrg	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]) ;;
325923a0898aSmrg	*)
326023a0898aSmrg	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
326123a0898aSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
326223a0898aSmrg	  exit $EXIT_FAILURE
326323a0898aSmrg	  ;;
326423a0898aSmrg	esac
326523a0898aSmrg
326623a0898aSmrg	case $revision in
326723a0898aSmrg	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]) ;;
326823a0898aSmrg	*)
326923a0898aSmrg	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
327023a0898aSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
327123a0898aSmrg	  exit $EXIT_FAILURE
327223a0898aSmrg	  ;;
327323a0898aSmrg	esac
327423a0898aSmrg
327523a0898aSmrg	case $age in
327623a0898aSmrg	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]) ;;
327723a0898aSmrg	*)
327823a0898aSmrg	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
327923a0898aSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
328023a0898aSmrg	  exit $EXIT_FAILURE
328123a0898aSmrg	  ;;
328223a0898aSmrg	esac
328323a0898aSmrg
328423a0898aSmrg	if test "$age" -gt "$current"; then
328523a0898aSmrg	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
328623a0898aSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
328723a0898aSmrg	  exit $EXIT_FAILURE
328823a0898aSmrg	fi
328923a0898aSmrg
329023a0898aSmrg	# Calculate the version variables.
329123a0898aSmrg	major=
329223a0898aSmrg	versuffix=
329323a0898aSmrg	verstring=
329423a0898aSmrg	case $version_type in
329523a0898aSmrg	none) ;;
329623a0898aSmrg
329723a0898aSmrg	darwin)
329823a0898aSmrg	  # Like Linux, but with the current version available in
329923a0898aSmrg	  # verstring for coding it into the library header
330023a0898aSmrg	  major=.`expr $current - $age`
330123a0898aSmrg	  versuffix="$major.$age.$revision"
330223a0898aSmrg	  # Darwin ld doesn't like 0 for these options...
330323a0898aSmrg	  minor_current=`expr $current + 1`
330423a0898aSmrg	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
330523a0898aSmrg	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
330623a0898aSmrg	  ;;
330723a0898aSmrg
330823a0898aSmrg	freebsd-aout)
330923a0898aSmrg	  major=".$current"
331023a0898aSmrg	  versuffix=".$current.$revision";
331123a0898aSmrg	  ;;
331223a0898aSmrg
331323a0898aSmrg	freebsd-elf)
331423a0898aSmrg	  major=".$current"
331523a0898aSmrg	  versuffix=".$current";
331623a0898aSmrg	  ;;
331723a0898aSmrg
331823a0898aSmrg	irix | nonstopux)
331923a0898aSmrg	  if test "X$lt_irix_increment" = "Xno"; then
332023a0898aSmrg	    major=`expr $current - $age`
332123a0898aSmrg	  else
332223a0898aSmrg	    major=`expr $current - $age + 1`
332323a0898aSmrg	  fi
332423a0898aSmrg	  case $version_type in
332523a0898aSmrg	    nonstopux) verstring_prefix=nonstopux ;;
332623a0898aSmrg	    *)         verstring_prefix=sgi ;;
332723a0898aSmrg	  esac
332823a0898aSmrg	  verstring="$verstring_prefix$major.$revision"
332923a0898aSmrg
333023a0898aSmrg	  # Add in all the interfaces that we are compatible with.
333123a0898aSmrg	  loop=$revision
333223a0898aSmrg	  while test "$loop" -ne 0; do
333323a0898aSmrg	    iface=`expr $revision - $loop`
333423a0898aSmrg	    loop=`expr $loop - 1`
333523a0898aSmrg	    verstring="$verstring_prefix$major.$iface:$verstring"
333623a0898aSmrg	  done
333723a0898aSmrg
333823a0898aSmrg	  # Before this point, $major must not contain `.'.
333923a0898aSmrg	  major=.$major
334023a0898aSmrg	  versuffix="$major.$revision"
334123a0898aSmrg	  ;;
334223a0898aSmrg
334323a0898aSmrg	linux)
334423a0898aSmrg	  major=.`expr $current - $age`
334523a0898aSmrg	  versuffix="$major.$age.$revision"
334623a0898aSmrg	  ;;
334723a0898aSmrg
334823a0898aSmrg	osf)
334923a0898aSmrg	  major=.`expr $current - $age`
335023a0898aSmrg	  versuffix=".$current.$age.$revision"
335123a0898aSmrg	  verstring="$current.$age.$revision"
335223a0898aSmrg
335323a0898aSmrg	  # Add in all the interfaces that we are compatible with.
335423a0898aSmrg	  loop=$age
335523a0898aSmrg	  while test "$loop" -ne 0; do
335623a0898aSmrg	    iface=`expr $current - $loop`
335723a0898aSmrg	    loop=`expr $loop - 1`
335823a0898aSmrg	    verstring="$verstring:${iface}.0"
335923a0898aSmrg	  done
336023a0898aSmrg
336123a0898aSmrg	  # Make executables depend on our current version.
336223a0898aSmrg	  verstring="$verstring:${current}.0"
336323a0898aSmrg	  ;;
336423a0898aSmrg
336523a0898aSmrg	sunos)
336623a0898aSmrg	  major=".$current"
336723a0898aSmrg	  versuffix=".$current.$revision"
336823a0898aSmrg	  ;;
336923a0898aSmrg
337023a0898aSmrg	windows)
337123a0898aSmrg	  # Use '-' rather than '.', since we only want one
337223a0898aSmrg	  # extension on DOS 8.3 filesystems.
337323a0898aSmrg	  major=`expr $current - $age`
337423a0898aSmrg	  versuffix="-$major"
337523a0898aSmrg	  ;;
337623a0898aSmrg
337723a0898aSmrg	*)
337823a0898aSmrg	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
337923a0898aSmrg	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
338023a0898aSmrg	  exit $EXIT_FAILURE
338123a0898aSmrg	  ;;
338223a0898aSmrg	esac
338323a0898aSmrg
338423a0898aSmrg	# Clear the version info if we defaulted, and they specified a release.
338523a0898aSmrg	if test -z "$vinfo" && test -n "$release"; then
338623a0898aSmrg	  major=
338723a0898aSmrg	  case $version_type in
338823a0898aSmrg	  darwin)
338923a0898aSmrg	    # we can't check for "0.0" in archive_cmds due to quoting
339023a0898aSmrg	    # problems, so we reset it completely
339123a0898aSmrg	    verstring=
339223a0898aSmrg	    ;;
339323a0898aSmrg	  *)
339423a0898aSmrg	    verstring="0.0"
339523a0898aSmrg	    ;;
339623a0898aSmrg	  esac
339723a0898aSmrg	  if test "$need_version" = no; then
339823a0898aSmrg	    versuffix=
339923a0898aSmrg	  else
340023a0898aSmrg	    versuffix=".0.0"
340123a0898aSmrg	  fi
340223a0898aSmrg	fi
340323a0898aSmrg
340423a0898aSmrg	# Remove version info from name if versioning should be avoided
340523a0898aSmrg	if test "$avoid_version" = yes && test "$need_version" = no; then
340623a0898aSmrg	  major=
340723a0898aSmrg	  versuffix=
340823a0898aSmrg	  verstring=""
340923a0898aSmrg	fi
341023a0898aSmrg
341123a0898aSmrg	# Check to see if the archive will have undefined symbols.
341223a0898aSmrg	if test "$allow_undefined" = yes; then
341323a0898aSmrg	  if test "$allow_undefined_flag" = unsupported; then
341423a0898aSmrg	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
341523a0898aSmrg	    build_libtool_libs=no
341623a0898aSmrg	    build_old_libs=yes
341723a0898aSmrg	  fi
341823a0898aSmrg	else
341923a0898aSmrg	  # Don't allow undefined symbols.
342023a0898aSmrg	  allow_undefined_flag="$no_undefined_flag"
342123a0898aSmrg	fi
342223a0898aSmrg      fi
342323a0898aSmrg
342423a0898aSmrg      if test "$mode" != relink; then
342523a0898aSmrg	# Remove our outputs, but don't remove object files since they
342623a0898aSmrg	# may have been created when compiling PIC objects.
342723a0898aSmrg	removelist=
342823a0898aSmrg	tempremovelist=`$echo "$output_objdir/*"`
342923a0898aSmrg	for p in $tempremovelist; do
343023a0898aSmrg	  case $p in
343123a0898aSmrg	    *.$objext)
343223a0898aSmrg	       ;;
343323a0898aSmrg	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
343423a0898aSmrg	       if test "X$precious_files_regex" != "X"; then
343523a0898aSmrg	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
343623a0898aSmrg	         then
343723a0898aSmrg		   continue
343823a0898aSmrg		 fi
343923a0898aSmrg	       fi
344023a0898aSmrg	       removelist="$removelist $p"
344123a0898aSmrg	       ;;
344223a0898aSmrg	    *) ;;
344323a0898aSmrg	  esac
344423a0898aSmrg	done
344523a0898aSmrg	if test -n "$removelist"; then
344623a0898aSmrg	  $show "${rm}r $removelist"
344723a0898aSmrg	  $run ${rm}r $removelist
344823a0898aSmrg	fi
344923a0898aSmrg      fi
345023a0898aSmrg
345123a0898aSmrg      # Now set the variables for building old libraries.
345223a0898aSmrg      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
345323a0898aSmrg	oldlibs="$oldlibs $output_objdir/$libname.$libext"
345423a0898aSmrg
345523a0898aSmrg	# Transform .lo files to .o files.
345623a0898aSmrg	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
345723a0898aSmrg      fi
345823a0898aSmrg
345923a0898aSmrg      # Eliminate all temporary directories.
346023a0898aSmrg      #for path in $notinst_path; do
346123a0898aSmrg      #	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
346223a0898aSmrg      #	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
346323a0898aSmrg      #	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
346423a0898aSmrg      #done
346523a0898aSmrg
346623a0898aSmrg      if test -n "$xrpath"; then
346723a0898aSmrg	# If the user specified any rpath flags, then add them.
346823a0898aSmrg	temp_xrpath=
346923a0898aSmrg	for libdir in $xrpath; do
347023a0898aSmrg	  temp_xrpath="$temp_xrpath -R$libdir"
347123a0898aSmrg	  case "$finalize_rpath " in
347223a0898aSmrg	  *" $libdir "*) ;;
347323a0898aSmrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
347423a0898aSmrg	  esac
347523a0898aSmrg	done
347623a0898aSmrg	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
347723a0898aSmrg	  dependency_libs="$temp_xrpath $dependency_libs"
347823a0898aSmrg	fi
347923a0898aSmrg      fi
348023a0898aSmrg
348123a0898aSmrg      # Make sure dlfiles contains only unique files that won't be dlpreopened
348223a0898aSmrg      old_dlfiles="$dlfiles"
348323a0898aSmrg      dlfiles=
348423a0898aSmrg      for lib in $old_dlfiles; do
348523a0898aSmrg	case " $dlprefiles $dlfiles " in
348623a0898aSmrg	*" $lib "*) ;;
348723a0898aSmrg	*) dlfiles="$dlfiles $lib" ;;
348823a0898aSmrg	esac
348923a0898aSmrg      done
349023a0898aSmrg
349123a0898aSmrg      # Make sure dlprefiles contains only unique files
349223a0898aSmrg      old_dlprefiles="$dlprefiles"
349323a0898aSmrg      dlprefiles=
349423a0898aSmrg      for lib in $old_dlprefiles; do
349523a0898aSmrg	case "$dlprefiles " in
349623a0898aSmrg	*" $lib "*) ;;
349723a0898aSmrg	*) dlprefiles="$dlprefiles $lib" ;;
349823a0898aSmrg	esac
349923a0898aSmrg      done
350023a0898aSmrg
350123a0898aSmrg      if test "$build_libtool_libs" = yes; then
350223a0898aSmrg	if test -n "$rpath"; then
350323a0898aSmrg	  case $host in
350423a0898aSmrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
350523a0898aSmrg	    # these systems don't actually have a c library (as such)!
350623a0898aSmrg	    ;;
350723a0898aSmrg	  *-*-rhapsody* | *-*-darwin1.[012])
350823a0898aSmrg	    # Rhapsody C library is in the System framework
350923a0898aSmrg	    deplibs="$deplibs -framework System"
351023a0898aSmrg	    ;;
351123a0898aSmrg	  *-*-netbsd*)
351223a0898aSmrg	    # Don't link with libc until the a.out ld.so is fixed.
351323a0898aSmrg	    ;;
351423a0898aSmrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
351523a0898aSmrg	    # Do not include libc due to us having libc/libc_r.
351623a0898aSmrg	    ;;
351723a0898aSmrg	  *-*-sco3.2v5* | *-*-sco5v6*)
351823a0898aSmrg	    # Causes problems with __ctype
351923a0898aSmrg	    ;;
352023a0898aSmrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
352123a0898aSmrg	    # Compiler inserts libc in the correct place for threads to work
352223a0898aSmrg	    ;;
352323a0898aSmrg 	  *)
352423a0898aSmrg	    # Add libc to deplibs on all other systems if necessary.
352523a0898aSmrg	    if test "$build_libtool_need_lc" = "yes"; then
352623a0898aSmrg	      deplibs="$deplibs -lc"
352723a0898aSmrg	    fi
352823a0898aSmrg	    ;;
352923a0898aSmrg	  esac
353023a0898aSmrg	fi
353123a0898aSmrg
353223a0898aSmrg	# Transform deplibs into only deplibs that can be linked in shared.
353323a0898aSmrg	name_save=$name
353423a0898aSmrg	libname_save=$libname
353523a0898aSmrg	release_save=$release
353623a0898aSmrg	versuffix_save=$versuffix
353723a0898aSmrg	major_save=$major
353823a0898aSmrg	# I'm not sure if I'm treating the release correctly.  I think
353923a0898aSmrg	# release should show up in the -l (ie -lgmp5) so we don't want to
354023a0898aSmrg	# add it in twice.  Is that correct?
354123a0898aSmrg	release=""
354223a0898aSmrg	versuffix=""
354323a0898aSmrg	major=""
354423a0898aSmrg	newdeplibs=
354523a0898aSmrg	droppeddeps=no
354623a0898aSmrg	case $deplibs_check_method in
354723a0898aSmrg	pass_all)
354823a0898aSmrg	  # Don't check for shared/static.  Everything works.
354923a0898aSmrg	  # This might be a little naive.  We might want to check
355023a0898aSmrg	  # whether the library exists or not.  But this is on
355123a0898aSmrg	  # osf3 & osf4 and I'm not really sure... Just
355223a0898aSmrg	  # implementing what was already the behavior.
355323a0898aSmrg	  newdeplibs=$deplibs
355423a0898aSmrg	  ;;
355523a0898aSmrg	test_compile)
355623a0898aSmrg	  # This code stresses the "libraries are programs" paradigm to its
355723a0898aSmrg	  # limits. Maybe even breaks it.  We compile a program, linking it
355823a0898aSmrg	  # against the deplibs as a proxy for the library.  Then we can check
355923a0898aSmrg	  # whether they linked in statically or dynamically with ldd.
356023a0898aSmrg	  $rm conftest.c
356123a0898aSmrg	  cat > conftest.c <<EOF
356223a0898aSmrg	  int main() { return 0; }
356323a0898aSmrgEOF
356423a0898aSmrg	  $rm conftest
356523a0898aSmrg	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
356623a0898aSmrg	    ldd_output=`ldd conftest`
356723a0898aSmrg	    for i in $deplibs; do
356823a0898aSmrg	      name=`expr $i : '-l\(.*\)'`
356923a0898aSmrg	      # If $name is empty we are operating on a -L argument.
357023a0898aSmrg              if test "$name" != "" && test "$name" != "0"; then
357123a0898aSmrg		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
357223a0898aSmrg		  case " $predeps $postdeps " in
357323a0898aSmrg		  *" $i "*)
357423a0898aSmrg		    newdeplibs="$newdeplibs $i"
357523a0898aSmrg		    i=""
357623a0898aSmrg		    ;;
357723a0898aSmrg		  esac
357823a0898aSmrg	        fi
357923a0898aSmrg		if test -n "$i" ; then
358023a0898aSmrg		  libname=`eval \\$echo \"$libname_spec\"`
358123a0898aSmrg		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
358223a0898aSmrg		  set dummy $deplib_matches
358323a0898aSmrg		  deplib_match=$2
358423a0898aSmrg		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
358523a0898aSmrg		    newdeplibs="$newdeplibs $i"
358623a0898aSmrg		  else
358723a0898aSmrg		    droppeddeps=yes
358823a0898aSmrg		    $echo
358923a0898aSmrg		    $echo "*** Warning: dynamic linker does not accept needed library $i."
359023a0898aSmrg		    $echo "*** I have the capability to make that library automatically link in when"
359123a0898aSmrg		    $echo "*** you link to this library.  But I can only do this if you have a"
359223a0898aSmrg		    $echo "*** shared version of the library, which I believe you do not have"
359323a0898aSmrg		    $echo "*** because a test_compile did reveal that the linker did not use it for"
359423a0898aSmrg		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
359523a0898aSmrg		  fi
359623a0898aSmrg		fi
359723a0898aSmrg	      else
359823a0898aSmrg		newdeplibs="$newdeplibs $i"
359923a0898aSmrg	      fi
360023a0898aSmrg	    done
360123a0898aSmrg	  else
360223a0898aSmrg	    # Error occurred in the first compile.  Let's try to salvage
360323a0898aSmrg	    # the situation: Compile a separate program for each library.
360423a0898aSmrg	    for i in $deplibs; do
360523a0898aSmrg	      name=`expr $i : '-l\(.*\)'`
360623a0898aSmrg	      # If $name is empty we are operating on a -L argument.
360723a0898aSmrg              if test "$name" != "" && test "$name" != "0"; then
360823a0898aSmrg		$rm conftest
360923a0898aSmrg		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
361023a0898aSmrg		  ldd_output=`ldd conftest`
361123a0898aSmrg		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
361223a0898aSmrg		    case " $predeps $postdeps " in
361323a0898aSmrg		    *" $i "*)
361423a0898aSmrg		      newdeplibs="$newdeplibs $i"
361523a0898aSmrg		      i=""
361623a0898aSmrg		      ;;
361723a0898aSmrg		    esac
361823a0898aSmrg		  fi
361923a0898aSmrg		  if test -n "$i" ; then
362023a0898aSmrg		    libname=`eval \\$echo \"$libname_spec\"`
362123a0898aSmrg		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
362223a0898aSmrg		    set dummy $deplib_matches
362323a0898aSmrg		    deplib_match=$2
362423a0898aSmrg		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
362523a0898aSmrg		      newdeplibs="$newdeplibs $i"
362623a0898aSmrg		    else
362723a0898aSmrg		      droppeddeps=yes
362823a0898aSmrg		      $echo
362923a0898aSmrg		      $echo "*** Warning: dynamic linker does not accept needed library $i."
363023a0898aSmrg		      $echo "*** I have the capability to make that library automatically link in when"
363123a0898aSmrg		      $echo "*** you link to this library.  But I can only do this if you have a"
363223a0898aSmrg		      $echo "*** shared version of the library, which you do not appear to have"
363323a0898aSmrg		      $echo "*** because a test_compile did reveal that the linker did not use this one"
363423a0898aSmrg		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
363523a0898aSmrg		    fi
363623a0898aSmrg		  fi
363723a0898aSmrg		else
363823a0898aSmrg		  droppeddeps=yes
363923a0898aSmrg		  $echo
364023a0898aSmrg		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
364123a0898aSmrg		  $echo "*** make it link in!  You will probably need to install it or some"
364223a0898aSmrg		  $echo "*** library that it depends on before this library will be fully"
364323a0898aSmrg		  $echo "*** functional.  Installing it before continuing would be even better."
364423a0898aSmrg		fi
364523a0898aSmrg	      else
364623a0898aSmrg		newdeplibs="$newdeplibs $i"
364723a0898aSmrg	      fi
364823a0898aSmrg	    done
364923a0898aSmrg	  fi
365023a0898aSmrg	  ;;
365123a0898aSmrg	file_magic*)
365223a0898aSmrg	  set dummy $deplibs_check_method
365323a0898aSmrg	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
365423a0898aSmrg	  for a_deplib in $deplibs; do
365523a0898aSmrg	    name=`expr $a_deplib : '-l\(.*\)'`
365623a0898aSmrg	    # If $name is empty we are operating on a -L argument.
365723a0898aSmrg            if test "$name" != "" && test  "$name" != "0"; then
365823a0898aSmrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
365923a0898aSmrg		case " $predeps $postdeps " in
366023a0898aSmrg		*" $a_deplib "*)
366123a0898aSmrg		  newdeplibs="$newdeplibs $a_deplib"
366223a0898aSmrg		  a_deplib=""
366323a0898aSmrg		  ;;
366423a0898aSmrg		esac
366523a0898aSmrg	      fi
366623a0898aSmrg	      if test -n "$a_deplib" ; then
366723a0898aSmrg		libname=`eval \\$echo \"$libname_spec\"`
366823a0898aSmrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
366923a0898aSmrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
367023a0898aSmrg		  for potent_lib in $potential_libs; do
367123a0898aSmrg		      # Follow soft links.
367223a0898aSmrg		      if ls -lLd "$potent_lib" 2>/dev/null \
367323a0898aSmrg			 | grep " -> " >/dev/null; then
367423a0898aSmrg			continue
367523a0898aSmrg		      fi
367623a0898aSmrg		      # The statement above tries to avoid entering an
367723a0898aSmrg		      # endless loop below, in case of cyclic links.
367823a0898aSmrg		      # We might still enter an endless loop, since a link
367923a0898aSmrg		      # loop can be closed while we follow links,
368023a0898aSmrg		      # but so what?
368123a0898aSmrg		      potlib="$potent_lib"
368223a0898aSmrg		      while test -h "$potlib" 2>/dev/null; do
368323a0898aSmrg			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
368423a0898aSmrg			case $potliblink in
368523a0898aSmrg			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
368623a0898aSmrg			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
368723a0898aSmrg			esac
368823a0898aSmrg		      done
368923a0898aSmrg		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
369023a0898aSmrg			 | ${SED} 10q \
369123a0898aSmrg			 | $EGREP "$file_magic_regex" > /dev/null; then
369223a0898aSmrg			newdeplibs="$newdeplibs $a_deplib"
369323a0898aSmrg			a_deplib=""
369423a0898aSmrg			break 2
369523a0898aSmrg		      fi
369623a0898aSmrg		  done
369723a0898aSmrg		done
369823a0898aSmrg	      fi
369923a0898aSmrg	      if test -n "$a_deplib" ; then
370023a0898aSmrg		droppeddeps=yes
370123a0898aSmrg		$echo
370223a0898aSmrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
370323a0898aSmrg		$echo "*** I have the capability to make that library automatically link in when"
370423a0898aSmrg		$echo "*** you link to this library.  But I can only do this if you have a"
370523a0898aSmrg		$echo "*** shared version of the library, which you do not appear to have"
370623a0898aSmrg		$echo "*** because I did check the linker path looking for a file starting"
370723a0898aSmrg		if test -z "$potlib" ; then
370823a0898aSmrg		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
370923a0898aSmrg		else
371023a0898aSmrg		  $echo "*** with $libname and none of the candidates passed a file format test"
371123a0898aSmrg		  $echo "*** using a file magic. Last file checked: $potlib"
371223a0898aSmrg		fi
371323a0898aSmrg	      fi
371423a0898aSmrg	    else
371523a0898aSmrg	      # Add a -L argument.
371623a0898aSmrg	      newdeplibs="$newdeplibs $a_deplib"
371723a0898aSmrg	    fi
371823a0898aSmrg	  done # Gone through all deplibs.
371923a0898aSmrg	  ;;
372023a0898aSmrg	match_pattern*)
372123a0898aSmrg	  set dummy $deplibs_check_method
372223a0898aSmrg	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
372323a0898aSmrg	  for a_deplib in $deplibs; do
372423a0898aSmrg	    name=`expr $a_deplib : '-l\(.*\)'`
372523a0898aSmrg	    # If $name is empty we are operating on a -L argument.
372623a0898aSmrg	    if test -n "$name" && test "$name" != "0"; then
372723a0898aSmrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
372823a0898aSmrg		case " $predeps $postdeps " in
372923a0898aSmrg		*" $a_deplib "*)
373023a0898aSmrg		  newdeplibs="$newdeplibs $a_deplib"
373123a0898aSmrg		  a_deplib=""
373223a0898aSmrg		  ;;
373323a0898aSmrg		esac
373423a0898aSmrg	      fi
373523a0898aSmrg	      if test -n "$a_deplib" ; then
373623a0898aSmrg		libname=`eval \\$echo \"$libname_spec\"`
373723a0898aSmrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
373823a0898aSmrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
373923a0898aSmrg		  for potent_lib in $potential_libs; do
374023a0898aSmrg		    potlib="$potent_lib" # see symlink-check above in file_magic test
374123a0898aSmrg		    if eval $echo \"$potent_lib\" 2>/dev/null \
374223a0898aSmrg		        | ${SED} 10q \
374323a0898aSmrg		        | $EGREP "$match_pattern_regex" > /dev/null; then
374423a0898aSmrg		      newdeplibs="$newdeplibs $a_deplib"
374523a0898aSmrg		      a_deplib=""
374623a0898aSmrg		      break 2
374723a0898aSmrg		    fi
374823a0898aSmrg		  done
374923a0898aSmrg		done
375023a0898aSmrg	      fi
375123a0898aSmrg	      if test -n "$a_deplib" ; then
375223a0898aSmrg		droppeddeps=yes
375323a0898aSmrg		$echo
375423a0898aSmrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
375523a0898aSmrg		$echo "*** I have the capability to make that library automatically link in when"
375623a0898aSmrg		$echo "*** you link to this library.  But I can only do this if you have a"
375723a0898aSmrg		$echo "*** shared version of the library, which you do not appear to have"
375823a0898aSmrg		$echo "*** because I did check the linker path looking for a file starting"
375923a0898aSmrg		if test -z "$potlib" ; then
376023a0898aSmrg		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
376123a0898aSmrg		else
376223a0898aSmrg		  $echo "*** with $libname and none of the candidates passed a file format test"
376323a0898aSmrg		  $echo "*** using a regex pattern. Last file checked: $potlib"
376423a0898aSmrg		fi
376523a0898aSmrg	      fi
376623a0898aSmrg	    else
376723a0898aSmrg	      # Add a -L argument.
376823a0898aSmrg	      newdeplibs="$newdeplibs $a_deplib"
376923a0898aSmrg	    fi
377023a0898aSmrg	  done # Gone through all deplibs.
377123a0898aSmrg	  ;;
377223a0898aSmrg	none | unknown | *)
377323a0898aSmrg	  newdeplibs=""
377423a0898aSmrg	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
377523a0898aSmrg	    -e 's/ -[LR][^ ]*//g'`
377623a0898aSmrg	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
377723a0898aSmrg	    for i in $predeps $postdeps ; do
377823a0898aSmrg	      # can't use Xsed below, because $i might contain '/'
377923a0898aSmrg	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
378023a0898aSmrg	    done
378123a0898aSmrg	  fi
378223a0898aSmrg	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
378323a0898aSmrg	    | grep . >/dev/null; then
378423a0898aSmrg	    $echo
378523a0898aSmrg	    if test "X$deplibs_check_method" = "Xnone"; then
378623a0898aSmrg	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
378723a0898aSmrg	    else
378823a0898aSmrg	      $echo "*** Warning: inter-library dependencies are not known to be supported."
378923a0898aSmrg	    fi
379023a0898aSmrg	    $echo "*** All declared inter-library dependencies are being dropped."
379123a0898aSmrg	    droppeddeps=yes
379223a0898aSmrg	  fi
379323a0898aSmrg	  ;;
379423a0898aSmrg	esac
379523a0898aSmrg	versuffix=$versuffix_save
379623a0898aSmrg	major=$major_save
379723a0898aSmrg	release=$release_save
379823a0898aSmrg	libname=$libname_save
379923a0898aSmrg	name=$name_save
380023a0898aSmrg
380123a0898aSmrg	case $host in
380223a0898aSmrg	*-*-rhapsody* | *-*-darwin1.[012])
380323a0898aSmrg	  # On Rhapsody replace the C library is the System framework
380423a0898aSmrg	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
380523a0898aSmrg	  ;;
380623a0898aSmrg	esac
380723a0898aSmrg
380823a0898aSmrg	if test "$droppeddeps" = yes; then
380923a0898aSmrg	  if test "$module" = yes; then
381023a0898aSmrg	    $echo
381123a0898aSmrg	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
381223a0898aSmrg	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
381323a0898aSmrg	    $echo "*** a static module, that should work as long as the dlopening"
381423a0898aSmrg	    $echo "*** application is linked with the -dlopen flag."
381523a0898aSmrg	    if test -z "$global_symbol_pipe"; then
381623a0898aSmrg	      $echo
381723a0898aSmrg	      $echo "*** However, this would only work if libtool was able to extract symbol"
381823a0898aSmrg	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
381923a0898aSmrg	      $echo "*** not find such a program.  So, this module is probably useless."
382023a0898aSmrg	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
382123a0898aSmrg	    fi
382223a0898aSmrg	    if test "$build_old_libs" = no; then
382323a0898aSmrg	      oldlibs="$output_objdir/$libname.$libext"
382423a0898aSmrg	      build_libtool_libs=module
382523a0898aSmrg	      build_old_libs=yes
382623a0898aSmrg	    else
382723a0898aSmrg	      build_libtool_libs=no
382823a0898aSmrg	    fi
382923a0898aSmrg	  else
383023a0898aSmrg	    $echo "*** The inter-library dependencies that have been dropped here will be"
383123a0898aSmrg	    $echo "*** automatically added whenever a program is linked with this library"
383223a0898aSmrg	    $echo "*** or is declared to -dlopen it."
383323a0898aSmrg
383423a0898aSmrg	    if test "$allow_undefined" = no; then
383523a0898aSmrg	      $echo
383623a0898aSmrg	      $echo "*** Since this library must not contain undefined symbols,"
383723a0898aSmrg	      $echo "*** because either the platform does not support them or"
383823a0898aSmrg	      $echo "*** it was explicitly requested with -no-undefined,"
383923a0898aSmrg	      $echo "*** libtool will only create a static version of it."
384023a0898aSmrg	      if test "$build_old_libs" = no; then
384123a0898aSmrg		oldlibs="$output_objdir/$libname.$libext"
384223a0898aSmrg		build_libtool_libs=module
384323a0898aSmrg		build_old_libs=yes
384423a0898aSmrg	      else
384523a0898aSmrg		build_libtool_libs=no
384623a0898aSmrg	      fi
384723a0898aSmrg	    fi
384823a0898aSmrg	  fi
384923a0898aSmrg	fi
385023a0898aSmrg	# Done checking deplibs!
385123a0898aSmrg	deplibs=$newdeplibs
385223a0898aSmrg      fi
385323a0898aSmrg
385423a0898aSmrg
385523a0898aSmrg      # move library search paths that coincide with paths to not yet
385623a0898aSmrg      # installed libraries to the beginning of the library search list
385723a0898aSmrg      new_libs=
385823a0898aSmrg      for path in $notinst_path; do
385923a0898aSmrg	case " $new_libs " in
386023a0898aSmrg	*" -L$path/$objdir "*) ;;
386123a0898aSmrg	*)
386223a0898aSmrg	  case " $deplibs " in
386323a0898aSmrg	  *" -L$path/$objdir "*)
386423a0898aSmrg	    new_libs="$new_libs -L$path/$objdir" ;;
386523a0898aSmrg	  esac
386623a0898aSmrg	  ;;
386723a0898aSmrg	esac
386823a0898aSmrg      done
386923a0898aSmrg      for deplib in $deplibs; do
387023a0898aSmrg	case $deplib in
387123a0898aSmrg	-L*)
387223a0898aSmrg	  case " $new_libs " in
387323a0898aSmrg	  *" $deplib "*) ;;
387423a0898aSmrg	  *) new_libs="$new_libs $deplib" ;;
387523a0898aSmrg	  esac
387623a0898aSmrg	  ;;
387723a0898aSmrg	*) new_libs="$new_libs $deplib" ;;
387823a0898aSmrg	esac
387923a0898aSmrg      done
388023a0898aSmrg      deplibs="$new_libs"
388123a0898aSmrg
388223a0898aSmrg
388323a0898aSmrg      # All the library-specific variables (install_libdir is set above).
388423a0898aSmrg      library_names=
388523a0898aSmrg      old_library=
388623a0898aSmrg      dlname=
388723a0898aSmrg
388823a0898aSmrg      # Test again, we may have decided not to build it any more
388923a0898aSmrg      if test "$build_libtool_libs" = yes; then
389023a0898aSmrg	if test "$hardcode_into_libs" = yes; then
389123a0898aSmrg	  # Hardcode the library paths
389223a0898aSmrg	  hardcode_libdirs=
389323a0898aSmrg	  dep_rpath=
389423a0898aSmrg	  rpath="$finalize_rpath"
389523a0898aSmrg	  test "$mode" != relink && rpath="$compile_rpath$rpath"
389623a0898aSmrg	  for libdir in $rpath; do
389723a0898aSmrg	    if test -n "$hardcode_libdir_flag_spec"; then
389823a0898aSmrg	      if test -n "$hardcode_libdir_separator"; then
389923a0898aSmrg		if test -z "$hardcode_libdirs"; then
390023a0898aSmrg		  hardcode_libdirs="$libdir"
390123a0898aSmrg		else
390223a0898aSmrg		  # Just accumulate the unique libdirs.
390323a0898aSmrg		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
390423a0898aSmrg		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
390523a0898aSmrg		    ;;
390623a0898aSmrg		  *)
390723a0898aSmrg		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
390823a0898aSmrg		    ;;
390923a0898aSmrg		  esac
391023a0898aSmrg		fi
391123a0898aSmrg	      else
391223a0898aSmrg		eval flag=\"$hardcode_libdir_flag_spec\"
391323a0898aSmrg		dep_rpath="$dep_rpath $flag"
391423a0898aSmrg	      fi
391523a0898aSmrg	    elif test -n "$runpath_var"; then
391623a0898aSmrg	      case "$perm_rpath " in
391723a0898aSmrg	      *" $libdir "*) ;;
391823a0898aSmrg	      *) perm_rpath="$perm_rpath $libdir" ;;
391923a0898aSmrg	      esac
392023a0898aSmrg	    fi
392123a0898aSmrg	  done
392223a0898aSmrg	  # Substitute the hardcoded libdirs into the rpath.
392323a0898aSmrg	  if test -n "$hardcode_libdir_separator" &&
392423a0898aSmrg	     test -n "$hardcode_libdirs"; then
392523a0898aSmrg	    libdir="$hardcode_libdirs"
392623a0898aSmrg	    if test -n "$hardcode_libdir_flag_spec_ld"; then
392723a0898aSmrg	      case $archive_cmds in
392823a0898aSmrg	      *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
392923a0898aSmrg	      *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
393023a0898aSmrg	      esac
393123a0898aSmrg	    else
393223a0898aSmrg	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
393323a0898aSmrg	    fi
393423a0898aSmrg	  fi
393523a0898aSmrg	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
393623a0898aSmrg	    # We should set the runpath_var.
393723a0898aSmrg	    rpath=
393823a0898aSmrg	    for dir in $perm_rpath; do
393923a0898aSmrg	      rpath="$rpath$dir:"
394023a0898aSmrg	    done
394123a0898aSmrg	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
394223a0898aSmrg	  fi
394323a0898aSmrg	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
394423a0898aSmrg	fi
394523a0898aSmrg
394623a0898aSmrg	shlibpath="$finalize_shlibpath"
394723a0898aSmrg	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
394823a0898aSmrg	if test -n "$shlibpath"; then
394923a0898aSmrg	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
395023a0898aSmrg	fi
395123a0898aSmrg
395223a0898aSmrg	# Get the real and link names of the library.
395323a0898aSmrg	eval shared_ext=\"$shrext_cmds\"
395423a0898aSmrg	eval library_names=\"$library_names_spec\"
395523a0898aSmrg	set dummy $library_names
395623a0898aSmrg	realname="$2"
395723a0898aSmrg	shift; shift
395823a0898aSmrg
395923a0898aSmrg	if test -n "$soname_spec"; then
396023a0898aSmrg	  eval soname=\"$soname_spec\"
396123a0898aSmrg	else
396223a0898aSmrg	  soname="$realname"
396323a0898aSmrg	fi
396423a0898aSmrg	if test -z "$dlname"; then
396523a0898aSmrg	  dlname=$soname
396623a0898aSmrg	fi
396723a0898aSmrg
396823a0898aSmrg	lib="$output_objdir/$realname"
396923a0898aSmrg	linknames=
397023a0898aSmrg	for link
397123a0898aSmrg	do
397223a0898aSmrg	  linknames="$linknames $link"
397323a0898aSmrg	done
397423a0898aSmrg
397523a0898aSmrg	# Use standard objects if they are pic
397623a0898aSmrg	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
397723a0898aSmrg
397823a0898aSmrg	# Prepare the list of exported symbols
397923a0898aSmrg	if test -z "$export_symbols"; then
398023a0898aSmrg	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
398123a0898aSmrg	    $show "generating symbol list for \`$libname.la'"
398223a0898aSmrg	    export_symbols="$output_objdir/$libname.exp"
398323a0898aSmrg	    $run $rm $export_symbols
398423a0898aSmrg	    cmds=$export_symbols_cmds
398523a0898aSmrg	    save_ifs="$IFS"; IFS='~'
398623a0898aSmrg	    for cmd in $cmds; do
398723a0898aSmrg	      IFS="$save_ifs"
398823a0898aSmrg	      eval cmd=\"$cmd\"
398923a0898aSmrg	      if len=`expr "X$cmd" : ".*"` &&
399023a0898aSmrg	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
399123a0898aSmrg	        $show "$cmd"
399223a0898aSmrg	        $run eval "$cmd" || exit $?
399323a0898aSmrg	        skipped_export=false
399423a0898aSmrg	      else
399523a0898aSmrg	        # The command line is too long to execute in one step.
399623a0898aSmrg	        $show "using reloadable object file for export list..."
399723a0898aSmrg	        skipped_export=:
399823a0898aSmrg		# Break out early, otherwise skipped_export may be
399923a0898aSmrg		# set to false by a later but shorter cmd.
400023a0898aSmrg		break
400123a0898aSmrg	      fi
400223a0898aSmrg	    done
400323a0898aSmrg	    IFS="$save_ifs"
400423a0898aSmrg	    if test -n "$export_symbols_regex"; then
400523a0898aSmrg	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
400623a0898aSmrg	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
400723a0898aSmrg	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
400823a0898aSmrg	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
400923a0898aSmrg	    fi
401023a0898aSmrg	  fi
401123a0898aSmrg	fi
401223a0898aSmrg
401323a0898aSmrg	if test -n "$export_symbols" && test -n "$include_expsyms"; then
401423a0898aSmrg	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
401523a0898aSmrg	fi
401623a0898aSmrg
401723a0898aSmrg	tmp_deplibs=
401823a0898aSmrg	for test_deplib in $deplibs; do
401923a0898aSmrg		case " $convenience " in
402023a0898aSmrg		*" $test_deplib "*) ;;
402123a0898aSmrg		*)
402223a0898aSmrg			tmp_deplibs="$tmp_deplibs $test_deplib"
402323a0898aSmrg			;;
402423a0898aSmrg		esac
402523a0898aSmrg	done
402623a0898aSmrg	deplibs="$tmp_deplibs"
402723a0898aSmrg
402823a0898aSmrg	if test -n "$convenience"; then
402923a0898aSmrg	  if test -n "$whole_archive_flag_spec"; then
403023a0898aSmrg	    save_libobjs=$libobjs
403123a0898aSmrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
403223a0898aSmrg	  else
403323a0898aSmrg	    gentop="$output_objdir/${outputname}x"
403423a0898aSmrg	    generated="$generated $gentop"
403523a0898aSmrg
403623a0898aSmrg	    func_extract_archives $gentop $convenience
403723a0898aSmrg	    libobjs="$libobjs $func_extract_archives_result"
403823a0898aSmrg	  fi
403923a0898aSmrg	fi
404023a0898aSmrg	
404123a0898aSmrg	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
404223a0898aSmrg	  eval flag=\"$thread_safe_flag_spec\"
404323a0898aSmrg	  linker_flags="$linker_flags $flag"
404423a0898aSmrg	fi
404523a0898aSmrg
404623a0898aSmrg	# Make a backup of the uninstalled library when relinking
404723a0898aSmrg	if test "$mode" = relink; then
404823a0898aSmrg	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
404923a0898aSmrg	fi
405023a0898aSmrg
405123a0898aSmrg	# Do each of the archive commands.
405223a0898aSmrg	if test "$module" = yes && test -n "$module_cmds" ; then
405323a0898aSmrg	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
405423a0898aSmrg	    eval test_cmds=\"$module_expsym_cmds\"
405523a0898aSmrg	    cmds=$module_expsym_cmds
405623a0898aSmrg	  else
405723a0898aSmrg	    eval test_cmds=\"$module_cmds\"
405823a0898aSmrg	    cmds=$module_cmds
405923a0898aSmrg	  fi
406023a0898aSmrg	else
406123a0898aSmrg	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
406223a0898aSmrg	  eval test_cmds=\"$archive_expsym_cmds\"
406323a0898aSmrg	  cmds=$archive_expsym_cmds
406423a0898aSmrg	else
406523a0898aSmrg	  eval test_cmds=\"$archive_cmds\"
406623a0898aSmrg	  cmds=$archive_cmds
406723a0898aSmrg	  fi
406823a0898aSmrg	fi
406923a0898aSmrg
407023a0898aSmrg	if test "X$skipped_export" != "X:" &&
407123a0898aSmrg	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
407223a0898aSmrg	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
407323a0898aSmrg	  :
407423a0898aSmrg	else
407523a0898aSmrg	  # The command line is too long to link in one step, link piecewise.
407623a0898aSmrg	  $echo "creating reloadable object files..."
407723a0898aSmrg
407823a0898aSmrg	  # Save the value of $output and $libobjs because we want to
407923a0898aSmrg	  # use them later.  If we have whole_archive_flag_spec, we
408023a0898aSmrg	  # want to use save_libobjs as it was before
408123a0898aSmrg	  # whole_archive_flag_spec was expanded, because we can't
408223a0898aSmrg	  # assume the linker understands whole_archive_flag_spec.
408323a0898aSmrg	  # This may have to be revisited, in case too many
408423a0898aSmrg	  # convenience libraries get linked in and end up exceeding
408523a0898aSmrg	  # the spec.
408623a0898aSmrg	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
408723a0898aSmrg	    save_libobjs=$libobjs
408823a0898aSmrg	  fi
408923a0898aSmrg	  save_output=$output
409023a0898aSmrg	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
409123a0898aSmrg
409223a0898aSmrg	  # Clear the reloadable object creation command queue and
409323a0898aSmrg	  # initialize k to one.
409423a0898aSmrg	  test_cmds=
409523a0898aSmrg	  concat_cmds=
409623a0898aSmrg	  objlist=
409723a0898aSmrg	  delfiles=
409823a0898aSmrg	  last_robj=
409923a0898aSmrg	  k=1
410023a0898aSmrg	  output=$output_objdir/$output_la-${k}.$objext
410123a0898aSmrg	  # Loop over the list of objects to be linked.
410223a0898aSmrg	  for obj in $save_libobjs
410323a0898aSmrg	  do
410423a0898aSmrg	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
410523a0898aSmrg	    if test "X$objlist" = X ||
410623a0898aSmrg	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
410723a0898aSmrg		 test "$len" -le "$max_cmd_len"; }; then
410823a0898aSmrg	      objlist="$objlist $obj"
410923a0898aSmrg	    else
411023a0898aSmrg	      # The command $test_cmds is almost too long, add a
411123a0898aSmrg	      # command to the queue.
411223a0898aSmrg	      if test "$k" -eq 1 ; then
411323a0898aSmrg		# The first file doesn't have a previous command to add.
411423a0898aSmrg		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
411523a0898aSmrg	      else
411623a0898aSmrg		# All subsequent reloadable object files will link in
411723a0898aSmrg		# the last one created.
411823a0898aSmrg		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
411923a0898aSmrg	      fi
412023a0898aSmrg	      last_robj=$output_objdir/$output_la-${k}.$objext
412123a0898aSmrg	      k=`expr $k + 1`
412223a0898aSmrg	      output=$output_objdir/$output_la-${k}.$objext
412323a0898aSmrg	      objlist=$obj
412423a0898aSmrg	      len=1
412523a0898aSmrg	    fi
412623a0898aSmrg	  done
412723a0898aSmrg	  # Handle the remaining objects by creating one last
412823a0898aSmrg	  # reloadable object file.  All subsequent reloadable object
412923a0898aSmrg	  # files will link in the last one created.
413023a0898aSmrg	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
413123a0898aSmrg	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
413223a0898aSmrg
413323a0898aSmrg	  if ${skipped_export-false}; then
413423a0898aSmrg	    $show "generating symbol list for \`$libname.la'"
413523a0898aSmrg	    export_symbols="$output_objdir/$libname.exp"
413623a0898aSmrg	    $run $rm $export_symbols
413723a0898aSmrg	    libobjs=$output
413823a0898aSmrg	    # Append the command to create the export file.
413923a0898aSmrg	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
414023a0898aSmrg          fi
414123a0898aSmrg
414223a0898aSmrg	  # Set up a command to remove the reloadable object files
414323a0898aSmrg	  # after they are used.
414423a0898aSmrg	  i=0
414523a0898aSmrg	  while test "$i" -lt "$k"
414623a0898aSmrg	  do
414723a0898aSmrg	    i=`expr $i + 1`
414823a0898aSmrg	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
414923a0898aSmrg	  done
415023a0898aSmrg
415123a0898aSmrg	  $echo "creating a temporary reloadable object file: $output"
415223a0898aSmrg
415323a0898aSmrg	  # Loop through the commands generated above and execute them.
415423a0898aSmrg	  save_ifs="$IFS"; IFS='~'
415523a0898aSmrg	  for cmd in $concat_cmds; do
415623a0898aSmrg	    IFS="$save_ifs"
415723a0898aSmrg	    $show "$cmd"
415823a0898aSmrg	    $run eval "$cmd" || exit $?
415923a0898aSmrg	  done
416023a0898aSmrg	  IFS="$save_ifs"
416123a0898aSmrg
416223a0898aSmrg	  libobjs=$output
416323a0898aSmrg	  # Restore the value of output.
416423a0898aSmrg	  output=$save_output
416523a0898aSmrg
416623a0898aSmrg	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
416723a0898aSmrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
416823a0898aSmrg	  fi
416923a0898aSmrg	  # Expand the library linking commands again to reset the
417023a0898aSmrg	  # value of $libobjs for piecewise linking.
417123a0898aSmrg
417223a0898aSmrg	  # Do each of the archive commands.
417323a0898aSmrg	  if test "$module" = yes && test -n "$module_cmds" ; then
417423a0898aSmrg	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
417523a0898aSmrg	      cmds=$module_expsym_cmds
417623a0898aSmrg	    else
417723a0898aSmrg	      cmds=$module_cmds
417823a0898aSmrg	    fi
417923a0898aSmrg	  else
418023a0898aSmrg	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
418123a0898aSmrg	    cmds=$archive_expsym_cmds
418223a0898aSmrg	  else
418323a0898aSmrg	    cmds=$archive_cmds
418423a0898aSmrg	    fi
418523a0898aSmrg	  fi
418623a0898aSmrg
418723a0898aSmrg	  # Append the command to remove the reloadable object files
418823a0898aSmrg	  # to the just-reset $cmds.
418923a0898aSmrg	  eval cmds=\"\$cmds~\$rm $delfiles\"
419023a0898aSmrg	fi
419123a0898aSmrg	save_ifs="$IFS"; IFS='~'
419223a0898aSmrg	for cmd in $cmds; do
419323a0898aSmrg	  IFS="$save_ifs"
419423a0898aSmrg	  eval cmd=\"$cmd\"
419523a0898aSmrg	  $show "$cmd"
419623a0898aSmrg	  $run eval "$cmd" || {
419723a0898aSmrg	    lt_exit=$?
419823a0898aSmrg
419923a0898aSmrg	    # Restore the uninstalled library and exit
420023a0898aSmrg	    if test "$mode" = relink; then
420123a0898aSmrg	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
420223a0898aSmrg	    fi
420323a0898aSmrg
420423a0898aSmrg	    exit $lt_exit
420523a0898aSmrg	  }
420623a0898aSmrg	done
420723a0898aSmrg	IFS="$save_ifs"
420823a0898aSmrg
420923a0898aSmrg	# Restore the uninstalled library and exit
421023a0898aSmrg	if test "$mode" = relink; then
421123a0898aSmrg	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
421223a0898aSmrg
421323a0898aSmrg	  if test -n "$convenience"; then
421423a0898aSmrg	    if test -z "$whole_archive_flag_spec"; then
421523a0898aSmrg	      $show "${rm}r $gentop"
421623a0898aSmrg	      $run ${rm}r "$gentop"
421723a0898aSmrg	    fi
421823a0898aSmrg	  fi
421923a0898aSmrg
422023a0898aSmrg	  exit $EXIT_SUCCESS
422123a0898aSmrg	fi
422223a0898aSmrg
422323a0898aSmrg	# Create links to the real library.
422423a0898aSmrg	for linkname in $linknames; do
422523a0898aSmrg	  if test "$realname" != "$linkname"; then
422623a0898aSmrg	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
422723a0898aSmrg	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
422823a0898aSmrg	  fi
422923a0898aSmrg	done
423023a0898aSmrg
423123a0898aSmrg	# If -module or -export-dynamic was specified, set the dlname.
423223a0898aSmrg	if test "$module" = yes || test "$export_dynamic" = yes; then
423323a0898aSmrg	  # On all known operating systems, these are identical.
423423a0898aSmrg	  dlname="$soname"
423523a0898aSmrg	fi
423623a0898aSmrg      fi
423723a0898aSmrg      ;;
423823a0898aSmrg
423923a0898aSmrg    obj)
424023a0898aSmrg      if test -n "$deplibs"; then
424123a0898aSmrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
424223a0898aSmrg      fi
424323a0898aSmrg
424423a0898aSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
424523a0898aSmrg	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
424623a0898aSmrg      fi
424723a0898aSmrg
424823a0898aSmrg      if test -n "$rpath"; then
424923a0898aSmrg	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
425023a0898aSmrg      fi
425123a0898aSmrg
425223a0898aSmrg      if test -n "$xrpath"; then
425323a0898aSmrg	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
425423a0898aSmrg      fi
425523a0898aSmrg
425623a0898aSmrg      if test -n "$vinfo"; then
425723a0898aSmrg	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
425823a0898aSmrg      fi
425923a0898aSmrg
426023a0898aSmrg      if test -n "$release"; then
426123a0898aSmrg	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
426223a0898aSmrg      fi
426323a0898aSmrg
426423a0898aSmrg      case $output in
426523a0898aSmrg      *.lo)
426623a0898aSmrg	if test -n "$objs$old_deplibs"; then
426723a0898aSmrg	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
426823a0898aSmrg	  exit $EXIT_FAILURE
426923a0898aSmrg	fi
427023a0898aSmrg	libobj="$output"
427123a0898aSmrg	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
427223a0898aSmrg	;;
427323a0898aSmrg      *)
427423a0898aSmrg	libobj=
427523a0898aSmrg	obj="$output"
427623a0898aSmrg	;;
427723a0898aSmrg      esac
427823a0898aSmrg
427923a0898aSmrg      # Delete the old objects.
428023a0898aSmrg      $run $rm $obj $libobj
428123a0898aSmrg
428223a0898aSmrg      # Objects from convenience libraries.  This assumes
428323a0898aSmrg      # single-version convenience libraries.  Whenever we create
428423a0898aSmrg      # different ones for PIC/non-PIC, this we'll have to duplicate
428523a0898aSmrg      # the extraction.
428623a0898aSmrg      reload_conv_objs=
428723a0898aSmrg      gentop=
428823a0898aSmrg      # reload_cmds runs $LD directly, so let us get rid of
428923a0898aSmrg      # -Wl from whole_archive_flag_spec and hope we can get by with
429023a0898aSmrg      # turning comma into space..
429123a0898aSmrg      wl=
429223a0898aSmrg
429323a0898aSmrg      if test -n "$convenience"; then
429423a0898aSmrg	if test -n "$whole_archive_flag_spec"; then
429523a0898aSmrg	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
429623a0898aSmrg	  reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
429723a0898aSmrg	else
429823a0898aSmrg	  gentop="$output_objdir/${obj}x"
429923a0898aSmrg	  generated="$generated $gentop"
430023a0898aSmrg
430123a0898aSmrg	  func_extract_archives $gentop $convenience
430223a0898aSmrg	  reload_conv_objs="$reload_objs $func_extract_archives_result"
430323a0898aSmrg	fi
430423a0898aSmrg      fi
430523a0898aSmrg
430623a0898aSmrg      # Create the old-style object.
430723a0898aSmrg      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
430823a0898aSmrg
430923a0898aSmrg      output="$obj"
431023a0898aSmrg      cmds=$reload_cmds
431123a0898aSmrg      save_ifs="$IFS"; IFS='~'
431223a0898aSmrg      for cmd in $cmds; do
431323a0898aSmrg	IFS="$save_ifs"
431423a0898aSmrg	eval cmd=\"$cmd\"
431523a0898aSmrg	$show "$cmd"
431623a0898aSmrg	$run eval "$cmd" || exit $?
431723a0898aSmrg      done
431823a0898aSmrg      IFS="$save_ifs"
431923a0898aSmrg
432023a0898aSmrg      # Exit if we aren't doing a library object file.
432123a0898aSmrg      if test -z "$libobj"; then
432223a0898aSmrg	if test -n "$gentop"; then
432323a0898aSmrg	  $show "${rm}r $gentop"
432423a0898aSmrg	  $run ${rm}r $gentop
432523a0898aSmrg	fi
432623a0898aSmrg
432723a0898aSmrg	exit $EXIT_SUCCESS
432823a0898aSmrg      fi
432923a0898aSmrg
433023a0898aSmrg      if test "$build_libtool_libs" != yes; then
433123a0898aSmrg	if test -n "$gentop"; then
433223a0898aSmrg	  $show "${rm}r $gentop"
433323a0898aSmrg	  $run ${rm}r $gentop
433423a0898aSmrg	fi
433523a0898aSmrg
433623a0898aSmrg	# Create an invalid libtool object if no PIC, so that we don't
433723a0898aSmrg	# accidentally link it into a program.
433823a0898aSmrg	# $show "echo timestamp > $libobj"
433923a0898aSmrg	# $run eval "echo timestamp > $libobj" || exit $?
434023a0898aSmrg	exit $EXIT_SUCCESS
434123a0898aSmrg      fi
434223a0898aSmrg
434323a0898aSmrg      if test -n "$pic_flag" || test "$pic_mode" != default; then
434423a0898aSmrg	# Only do commands if we really have different PIC objects.
434523a0898aSmrg	reload_objs="$libobjs $reload_conv_objs"
434623a0898aSmrg	output="$libobj"
434723a0898aSmrg	cmds=$reload_cmds
434823a0898aSmrg	save_ifs="$IFS"; IFS='~'
434923a0898aSmrg	for cmd in $cmds; do
435023a0898aSmrg	  IFS="$save_ifs"
435123a0898aSmrg	  eval cmd=\"$cmd\"
435223a0898aSmrg	  $show "$cmd"
435323a0898aSmrg	  $run eval "$cmd" || exit $?
435423a0898aSmrg	done
435523a0898aSmrg	IFS="$save_ifs"
435623a0898aSmrg      fi
435723a0898aSmrg
435823a0898aSmrg      if test -n "$gentop"; then
435923a0898aSmrg	$show "${rm}r $gentop"
436023a0898aSmrg	$run ${rm}r $gentop
436123a0898aSmrg      fi
436223a0898aSmrg
436323a0898aSmrg      exit $EXIT_SUCCESS
436423a0898aSmrg      ;;
436523a0898aSmrg
436623a0898aSmrg    prog)
436723a0898aSmrg      case $host in
436823a0898aSmrg	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
436923a0898aSmrg      esac
437023a0898aSmrg      if test -n "$vinfo"; then
437123a0898aSmrg	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
437223a0898aSmrg      fi
437323a0898aSmrg
437423a0898aSmrg      if test -n "$release"; then
437523a0898aSmrg	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
437623a0898aSmrg      fi
437723a0898aSmrg
437823a0898aSmrg      if test "$preload" = yes; then
437923a0898aSmrg	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
438023a0898aSmrg	   test "$dlopen_self_static" = unknown; then
438123a0898aSmrg	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
438223a0898aSmrg	fi
438323a0898aSmrg      fi
438423a0898aSmrg
438523a0898aSmrg      case $host in
438623a0898aSmrg      *-*-rhapsody* | *-*-darwin1.[012])
438723a0898aSmrg	# On Rhapsody replace the C library is the System framework
438823a0898aSmrg	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
438923a0898aSmrg	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
439023a0898aSmrg	;;
439123a0898aSmrg      esac
439223a0898aSmrg
439323a0898aSmrg      case $host in
439423a0898aSmrg      *darwin*)
439523a0898aSmrg        # Don't allow lazy linking, it breaks C++ global constructors
439623a0898aSmrg        if test "$tagname" = CXX ; then
439723a0898aSmrg        compile_command="$compile_command ${wl}-bind_at_load"
439823a0898aSmrg        finalize_command="$finalize_command ${wl}-bind_at_load"
439923a0898aSmrg        fi
440023a0898aSmrg        ;;
440123a0898aSmrg      esac
440223a0898aSmrg
440323a0898aSmrg
440423a0898aSmrg      # move library search paths that coincide with paths to not yet
440523a0898aSmrg      # installed libraries to the beginning of the library search list
440623a0898aSmrg      new_libs=
440723a0898aSmrg      for path in $notinst_path; do
440823a0898aSmrg	case " $new_libs " in
440923a0898aSmrg	*" -L$path/$objdir "*) ;;
441023a0898aSmrg	*)
441123a0898aSmrg	  case " $compile_deplibs " in
441223a0898aSmrg	  *" -L$path/$objdir "*)
441323a0898aSmrg	    new_libs="$new_libs -L$path/$objdir" ;;
441423a0898aSmrg	  esac
441523a0898aSmrg	  ;;
441623a0898aSmrg	esac
441723a0898aSmrg      done
441823a0898aSmrg      for deplib in $compile_deplibs; do
441923a0898aSmrg	case $deplib in
442023a0898aSmrg	-L*)
442123a0898aSmrg	  case " $new_libs " in
442223a0898aSmrg	  *" $deplib "*) ;;
442323a0898aSmrg	  *) new_libs="$new_libs $deplib" ;;
442423a0898aSmrg	  esac
442523a0898aSmrg	  ;;
442623a0898aSmrg	*) new_libs="$new_libs $deplib" ;;
442723a0898aSmrg	esac
442823a0898aSmrg      done
442923a0898aSmrg      compile_deplibs="$new_libs"
443023a0898aSmrg
443123a0898aSmrg
443223a0898aSmrg      compile_command="$compile_command $compile_deplibs"
443323a0898aSmrg      finalize_command="$finalize_command $finalize_deplibs"
443423a0898aSmrg
443523a0898aSmrg      if test -n "$rpath$xrpath"; then
443623a0898aSmrg	# If the user specified any rpath flags, then add them.
443723a0898aSmrg	for libdir in $rpath $xrpath; do
443823a0898aSmrg	  # This is the magic to use -rpath.
443923a0898aSmrg	  case "$finalize_rpath " in
444023a0898aSmrg	  *" $libdir "*) ;;
444123a0898aSmrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
444223a0898aSmrg	  esac
444323a0898aSmrg	done
444423a0898aSmrg      fi
444523a0898aSmrg
444623a0898aSmrg      # Now hardcode the library paths
444723a0898aSmrg      rpath=
444823a0898aSmrg      hardcode_libdirs=
444923a0898aSmrg      for libdir in $compile_rpath $finalize_rpath; do
445023a0898aSmrg	if test -n "$hardcode_libdir_flag_spec"; then
445123a0898aSmrg	  if test -n "$hardcode_libdir_separator"; then
445223a0898aSmrg	    if test -z "$hardcode_libdirs"; then
445323a0898aSmrg	      hardcode_libdirs="$libdir"
445423a0898aSmrg	    else
445523a0898aSmrg	      # Just accumulate the unique libdirs.
445623a0898aSmrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
445723a0898aSmrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
445823a0898aSmrg		;;
445923a0898aSmrg	      *)
446023a0898aSmrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
446123a0898aSmrg		;;
446223a0898aSmrg	      esac
446323a0898aSmrg	    fi
446423a0898aSmrg	  else
446523a0898aSmrg	    eval flag=\"$hardcode_libdir_flag_spec\"
446623a0898aSmrg	    rpath="$rpath $flag"
446723a0898aSmrg	  fi
446823a0898aSmrg	elif test -n "$runpath_var"; then
446923a0898aSmrg	  case "$perm_rpath " in
447023a0898aSmrg	  *" $libdir "*) ;;
447123a0898aSmrg	  *) perm_rpath="$perm_rpath $libdir" ;;
447223a0898aSmrg	  esac
447323a0898aSmrg	fi
447423a0898aSmrg	case $host in
447523a0898aSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
447623a0898aSmrg	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
447723a0898aSmrg	  case :$dllsearchpath: in
447823a0898aSmrg	  *":$libdir:"*) ;;
447923a0898aSmrg	  *) dllsearchpath="$dllsearchpath:$libdir";;
448023a0898aSmrg	  esac
448123a0898aSmrg	  case :$dllsearchpath: in
448223a0898aSmrg	  *":$testbindir:"*) ;;
448323a0898aSmrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
448423a0898aSmrg	  esac
448523a0898aSmrg	  ;;
448623a0898aSmrg	esac
448723a0898aSmrg      done
448823a0898aSmrg      # Substitute the hardcoded libdirs into the rpath.
448923a0898aSmrg      if test -n "$hardcode_libdir_separator" &&
449023a0898aSmrg	 test -n "$hardcode_libdirs"; then
449123a0898aSmrg	libdir="$hardcode_libdirs"
449223a0898aSmrg	eval rpath=\" $hardcode_libdir_flag_spec\"
449323a0898aSmrg      fi
449423a0898aSmrg      compile_rpath="$rpath"
449523a0898aSmrg
449623a0898aSmrg      rpath=
449723a0898aSmrg      hardcode_libdirs=
449823a0898aSmrg      for libdir in $finalize_rpath; do
449923a0898aSmrg	if test -n "$hardcode_libdir_flag_spec"; then
450023a0898aSmrg	  if test -n "$hardcode_libdir_separator"; then
450123a0898aSmrg	    if test -z "$hardcode_libdirs"; then
450223a0898aSmrg	      hardcode_libdirs="$libdir"
450323a0898aSmrg	    else
450423a0898aSmrg	      # Just accumulate the unique libdirs.
450523a0898aSmrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
450623a0898aSmrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
450723a0898aSmrg		;;
450823a0898aSmrg	      *)
450923a0898aSmrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
451023a0898aSmrg		;;
451123a0898aSmrg	      esac
451223a0898aSmrg	    fi
451323a0898aSmrg	  else
451423a0898aSmrg	    eval flag=\"$hardcode_libdir_flag_spec\"
451523a0898aSmrg	    rpath="$rpath $flag"
451623a0898aSmrg	  fi
451723a0898aSmrg	elif test -n "$runpath_var"; then
451823a0898aSmrg	  case "$finalize_perm_rpath " in
451923a0898aSmrg	  *" $libdir "*) ;;
452023a0898aSmrg	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
452123a0898aSmrg	  esac
452223a0898aSmrg	fi
452323a0898aSmrg      done
452423a0898aSmrg      # Substitute the hardcoded libdirs into the rpath.
452523a0898aSmrg      if test -n "$hardcode_libdir_separator" &&
452623a0898aSmrg	 test -n "$hardcode_libdirs"; then
452723a0898aSmrg	libdir="$hardcode_libdirs"
452823a0898aSmrg	eval rpath=\" $hardcode_libdir_flag_spec\"
452923a0898aSmrg      fi
453023a0898aSmrg      finalize_rpath="$rpath"
453123a0898aSmrg
453223a0898aSmrg      if test -n "$libobjs" && test "$build_old_libs" = yes; then
453323a0898aSmrg	# Transform all the library objects into standard objects.
453423a0898aSmrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
453523a0898aSmrg	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
453623a0898aSmrg      fi
453723a0898aSmrg
453823a0898aSmrg      dlsyms=
453923a0898aSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
454023a0898aSmrg	if test -n "$NM" && test -n "$global_symbol_pipe"; then
454123a0898aSmrg	  dlsyms="${outputname}S.c"
454223a0898aSmrg	else
454323a0898aSmrg	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
454423a0898aSmrg	fi
454523a0898aSmrg      fi
454623a0898aSmrg
454723a0898aSmrg      if test -n "$dlsyms"; then
454823a0898aSmrg	case $dlsyms in
454923a0898aSmrg	"") ;;
455023a0898aSmrg	*.c)
455123a0898aSmrg	  # Discover the nlist of each of the dlfiles.
455223a0898aSmrg	  nlist="$output_objdir/${outputname}.nm"
455323a0898aSmrg
455423a0898aSmrg	  $show "$rm $nlist ${nlist}S ${nlist}T"
455523a0898aSmrg	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
455623a0898aSmrg
455723a0898aSmrg	  # Parse the name list into a source file.
455823a0898aSmrg	  $show "creating $output_objdir/$dlsyms"
455923a0898aSmrg
456023a0898aSmrg	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
456123a0898aSmrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
456223a0898aSmrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
456323a0898aSmrg
456423a0898aSmrg#ifdef __cplusplus
456523a0898aSmrgextern \"C\" {
456623a0898aSmrg#endif
456723a0898aSmrg
456823a0898aSmrg/* Prevent the only kind of declaration conflicts we can make. */
456923a0898aSmrg#define lt_preloaded_symbols some_other_symbol
457023a0898aSmrg
457123a0898aSmrg/* External symbol declarations for the compiler. */\
457223a0898aSmrg"
457323a0898aSmrg
457423a0898aSmrg	  if test "$dlself" = yes; then
457523a0898aSmrg	    $show "generating symbol list for \`$output'"
457623a0898aSmrg
457723a0898aSmrg	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
457823a0898aSmrg
457923a0898aSmrg	    # Add our own program objects to the symbol list.
458023a0898aSmrg	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
458123a0898aSmrg	    for arg in $progfiles; do
458223a0898aSmrg	      $show "extracting global C symbols from \`$arg'"
458323a0898aSmrg	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
458423a0898aSmrg	    done
458523a0898aSmrg
458623a0898aSmrg	    if test -n "$exclude_expsyms"; then
458723a0898aSmrg	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
458823a0898aSmrg	      $run eval '$mv "$nlist"T "$nlist"'
458923a0898aSmrg	    fi
459023a0898aSmrg
459123a0898aSmrg	    if test -n "$export_symbols_regex"; then
459223a0898aSmrg	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
459323a0898aSmrg	      $run eval '$mv "$nlist"T "$nlist"'
459423a0898aSmrg	    fi
459523a0898aSmrg
459623a0898aSmrg	    # Prepare the list of exported symbols
459723a0898aSmrg	    if test -z "$export_symbols"; then
459823a0898aSmrg	      export_symbols="$output_objdir/$outputname.exp"
459923a0898aSmrg	      $run $rm $export_symbols
460023a0898aSmrg	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
460123a0898aSmrg              case $host in
460223a0898aSmrg              *cygwin* | *mingw* )
460323a0898aSmrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
460423a0898aSmrg		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
460523a0898aSmrg                ;;
460623a0898aSmrg              esac
460723a0898aSmrg	    else
460823a0898aSmrg	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
460923a0898aSmrg	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
461023a0898aSmrg	      $run eval 'mv "$nlist"T "$nlist"'
461123a0898aSmrg              case $host in
461223a0898aSmrg              *cygwin* | *mingw* )
461323a0898aSmrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
461423a0898aSmrg		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
461523a0898aSmrg                ;;
461623a0898aSmrg              esac
461723a0898aSmrg	    fi
461823a0898aSmrg	  fi
461923a0898aSmrg
462023a0898aSmrg	  for arg in $dlprefiles; do
462123a0898aSmrg	    $show "extracting global C symbols from \`$arg'"
462223a0898aSmrg	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
462323a0898aSmrg	    $run eval '$echo ": $name " >> "$nlist"'
462423a0898aSmrg	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
462523a0898aSmrg	  done
462623a0898aSmrg
462723a0898aSmrg	  if test -z "$run"; then
462823a0898aSmrg	    # Make sure we have at least an empty file.
462923a0898aSmrg	    test -f "$nlist" || : > "$nlist"
463023a0898aSmrg
463123a0898aSmrg	    if test -n "$exclude_expsyms"; then
463223a0898aSmrg	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
463323a0898aSmrg	      $mv "$nlist"T "$nlist"
463423a0898aSmrg	    fi
463523a0898aSmrg
463623a0898aSmrg	    # Try sorting and uniquifying the output.
463723a0898aSmrg	    if grep -v "^: " < "$nlist" |
463823a0898aSmrg		if sort -k 3 </dev/null >/dev/null 2>&1; then
463923a0898aSmrg		  sort -k 3
464023a0898aSmrg		else
464123a0898aSmrg		  sort +2
464223a0898aSmrg		fi |
464323a0898aSmrg		uniq > "$nlist"S; then
464423a0898aSmrg	      :
464523a0898aSmrg	    else
464623a0898aSmrg	      grep -v "^: " < "$nlist" > "$nlist"S
464723a0898aSmrg	    fi
464823a0898aSmrg
464923a0898aSmrg	    if test -f "$nlist"S; then
465023a0898aSmrg	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
465123a0898aSmrg	    else
465223a0898aSmrg	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
465323a0898aSmrg	    fi
465423a0898aSmrg
465523a0898aSmrg	    $echo >> "$output_objdir/$dlsyms" "\
465623a0898aSmrg
465723a0898aSmrg#undef lt_preloaded_symbols
465823a0898aSmrg
465923a0898aSmrg#if defined (__STDC__) && __STDC__
466023a0898aSmrg# define lt_ptr void *
466123a0898aSmrg#else
466223a0898aSmrg# define lt_ptr char *
466323a0898aSmrg# define const
466423a0898aSmrg#endif
466523a0898aSmrg
466623a0898aSmrg/* The mapping between symbol names and symbols. */
466723a0898aSmrg"
466823a0898aSmrg
466923a0898aSmrg	    case $host in
467023a0898aSmrg	    *cygwin* | *mingw* )
467123a0898aSmrg	  $echo >> "$output_objdir/$dlsyms" "\
467223a0898aSmrg/* DATA imports from DLLs on WIN32 can't be const, because
467323a0898aSmrg   runtime relocations are performed -- see ld's documentation
467423a0898aSmrg   on pseudo-relocs */
467523a0898aSmrgstruct {
467623a0898aSmrg"
467723a0898aSmrg	      ;;
467823a0898aSmrg	    * )
467923a0898aSmrg	  $echo >> "$output_objdir/$dlsyms" "\
468023a0898aSmrgconst struct {
468123a0898aSmrg"
468223a0898aSmrg	      ;;
468323a0898aSmrg	    esac
468423a0898aSmrg
468523a0898aSmrg
468623a0898aSmrg	  $echo >> "$output_objdir/$dlsyms" "\
468723a0898aSmrg  const char *name;
468823a0898aSmrg  lt_ptr address;
468923a0898aSmrg}
469023a0898aSmrglt_preloaded_symbols[] =
469123a0898aSmrg{\
469223a0898aSmrg"
469323a0898aSmrg
469423a0898aSmrg	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
469523a0898aSmrg
469623a0898aSmrg	    $echo >> "$output_objdir/$dlsyms" "\
469723a0898aSmrg  {0, (lt_ptr) 0}
469823a0898aSmrg};
469923a0898aSmrg
470023a0898aSmrg/* This works around a problem in FreeBSD linker */
470123a0898aSmrg#ifdef FREEBSD_WORKAROUND
470223a0898aSmrgstatic const void *lt_preloaded_setup() {
470323a0898aSmrg  return lt_preloaded_symbols;
470423a0898aSmrg}
470523a0898aSmrg#endif
470623a0898aSmrg
470723a0898aSmrg#ifdef __cplusplus
470823a0898aSmrg}
470923a0898aSmrg#endif\
471023a0898aSmrg"
471123a0898aSmrg	  fi
471223a0898aSmrg
471323a0898aSmrg	  pic_flag_for_symtable=
471423a0898aSmrg	  case $host in
471523a0898aSmrg	  # compiling the symbol table file with pic_flag works around
471623a0898aSmrg	  # a FreeBSD bug that causes programs to crash when -lm is
471723a0898aSmrg	  # linked before any other PIC object.  But we must not use
471823a0898aSmrg	  # pic_flag when linking with -static.  The problem exists in
471923a0898aSmrg	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
472023a0898aSmrg	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
472123a0898aSmrg	    case "$compile_command " in
472223a0898aSmrg	    *" -static "*) ;;
472323a0898aSmrg	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
472423a0898aSmrg	    esac;;
472523a0898aSmrg	  *-*-hpux*)
472623a0898aSmrg	    case "$compile_command " in
472723a0898aSmrg	    *" -static "*) ;;
472823a0898aSmrg	    *) pic_flag_for_symtable=" $pic_flag";;
472923a0898aSmrg	    esac
473023a0898aSmrg	  esac
473123a0898aSmrg
473223a0898aSmrg	  # Now compile the dynamic symbol file.
473323a0898aSmrg	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
473423a0898aSmrg	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
473523a0898aSmrg
473623a0898aSmrg	  # Clean up the generated files.
473723a0898aSmrg	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
473823a0898aSmrg	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
473923a0898aSmrg
474023a0898aSmrg	  # Transform the symbol file into the correct name.
474123a0898aSmrg          case $host in
474223a0898aSmrg          *cygwin* | *mingw* )
474323a0898aSmrg            if test -f "$output_objdir/${outputname}.def" ; then
474423a0898aSmrg              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
474523a0898aSmrg              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
474623a0898aSmrg            else
474723a0898aSmrg              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
474823a0898aSmrg              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
474923a0898aSmrg             fi
475023a0898aSmrg            ;;
475123a0898aSmrg          * )
475223a0898aSmrg            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
475323a0898aSmrg            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
475423a0898aSmrg            ;;
475523a0898aSmrg          esac
475623a0898aSmrg	  ;;
475723a0898aSmrg	*)
475823a0898aSmrg	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
475923a0898aSmrg	  exit $EXIT_FAILURE
476023a0898aSmrg	  ;;
476123a0898aSmrg	esac
476223a0898aSmrg      else
476323a0898aSmrg	# We keep going just in case the user didn't refer to
476423a0898aSmrg	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
476523a0898aSmrg	# really was required.
476623a0898aSmrg
476723a0898aSmrg	# Nullify the symbol file.
476823a0898aSmrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
476923a0898aSmrg	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
477023a0898aSmrg      fi
477123a0898aSmrg
477223a0898aSmrg      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
477323a0898aSmrg	# Replace the output file specification.
477423a0898aSmrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
477523a0898aSmrg	link_command="$compile_command$compile_rpath"
477623a0898aSmrg
477723a0898aSmrg	# We have no uninstalled library dependencies, so finalize right now.
477823a0898aSmrg	$show "$link_command"
477923a0898aSmrg	$run eval "$link_command"
478023a0898aSmrg	exit_status=$?
478123a0898aSmrg
478223a0898aSmrg	# Delete the generated files.
478323a0898aSmrg	if test -n "$dlsyms"; then
478423a0898aSmrg	  $show "$rm $output_objdir/${outputname}S.${objext}"
478523a0898aSmrg	  $run $rm "$output_objdir/${outputname}S.${objext}"
478623a0898aSmrg	fi
478723a0898aSmrg
478823a0898aSmrg	exit $exit_status
478923a0898aSmrg      fi
479023a0898aSmrg
479123a0898aSmrg      if test -n "$shlibpath_var"; then
479223a0898aSmrg	# We should set the shlibpath_var
479323a0898aSmrg	rpath=
479423a0898aSmrg	for dir in $temp_rpath; do
479523a0898aSmrg	  case $dir in
479623a0898aSmrg	  [\\/]* | [A-Za-z]:[\\/]*)
479723a0898aSmrg	    # Absolute path.
479823a0898aSmrg	    rpath="$rpath$dir:"
479923a0898aSmrg	    ;;
480023a0898aSmrg	  *)
480123a0898aSmrg	    # Relative path: add a thisdir entry.
480223a0898aSmrg	    rpath="$rpath\$thisdir/$dir:"
480323a0898aSmrg	    ;;
480423a0898aSmrg	  esac
480523a0898aSmrg	done
480623a0898aSmrg	temp_rpath="$rpath"
480723a0898aSmrg      fi
480823a0898aSmrg
480923a0898aSmrg      if test -n "$compile_shlibpath$finalize_shlibpath"; then
481023a0898aSmrg	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
481123a0898aSmrg      fi
481223a0898aSmrg      if test -n "$finalize_shlibpath"; then
481323a0898aSmrg	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
481423a0898aSmrg      fi
481523a0898aSmrg
481623a0898aSmrg      compile_var=
481723a0898aSmrg      finalize_var=
481823a0898aSmrg      if test -n "$runpath_var"; then
481923a0898aSmrg	if test -n "$perm_rpath"; then
482023a0898aSmrg	  # We should set the runpath_var.
482123a0898aSmrg	  rpath=
482223a0898aSmrg	  for dir in $perm_rpath; do
482323a0898aSmrg	    rpath="$rpath$dir:"
482423a0898aSmrg	  done
482523a0898aSmrg	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
482623a0898aSmrg	fi
482723a0898aSmrg	if test -n "$finalize_perm_rpath"; then
482823a0898aSmrg	  # We should set the runpath_var.
482923a0898aSmrg	  rpath=
483023a0898aSmrg	  for dir in $finalize_perm_rpath; do
483123a0898aSmrg	    rpath="$rpath$dir:"
483223a0898aSmrg	  done
483323a0898aSmrg	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
483423a0898aSmrg	fi
483523a0898aSmrg      fi
483623a0898aSmrg
483723a0898aSmrg      if test "$no_install" = yes; then
483823a0898aSmrg	# We don't need to create a wrapper script.
483923a0898aSmrg	link_command="$compile_var$compile_command$compile_rpath"
484023a0898aSmrg	# Replace the output file specification.
484123a0898aSmrg	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
484223a0898aSmrg	# Delete the old output file.
484323a0898aSmrg	$run $rm $output
484423a0898aSmrg	# Link the executable and exit
484523a0898aSmrg	$show "$link_command"
484623a0898aSmrg	$run eval "$link_command" || exit $?
484723a0898aSmrg	exit $EXIT_SUCCESS
484823a0898aSmrg      fi
484923a0898aSmrg
485023a0898aSmrg      if test "$hardcode_action" = relink; then
485123a0898aSmrg	# Fast installation is not supported
485223a0898aSmrg	link_command="$compile_var$compile_command$compile_rpath"
485323a0898aSmrg	relink_command="$finalize_var$finalize_command$finalize_rpath"
485423a0898aSmrg
485523a0898aSmrg	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
485623a0898aSmrg	$echo "$modename: \`$output' will be relinked during installation" 1>&2
485723a0898aSmrg      else
485823a0898aSmrg	if test "$fast_install" != no; then
485923a0898aSmrg	  link_command="$finalize_var$compile_command$finalize_rpath"
486023a0898aSmrg	  if test "$fast_install" = yes; then
486123a0898aSmrg	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
486223a0898aSmrg	  else
486323a0898aSmrg	    # fast_install is set to needless
486423a0898aSmrg	    relink_command=
486523a0898aSmrg	  fi
486623a0898aSmrg	else
486723a0898aSmrg	  link_command="$compile_var$compile_command$compile_rpath"
486823a0898aSmrg	  relink_command="$finalize_var$finalize_command$finalize_rpath"
486923a0898aSmrg	fi
487023a0898aSmrg      fi
487123a0898aSmrg
487223a0898aSmrg      # Replace the output file specification.
487323a0898aSmrg      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
487423a0898aSmrg
487523a0898aSmrg      # Delete the old output files.
487623a0898aSmrg      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
487723a0898aSmrg
487823a0898aSmrg      $show "$link_command"
487923a0898aSmrg      $run eval "$link_command" || exit $?
488023a0898aSmrg
488123a0898aSmrg      # Now create the wrapper script.
488223a0898aSmrg      $show "creating $output"
488323a0898aSmrg
488423a0898aSmrg      # Quote the relink command for shipping.
488523a0898aSmrg      if test -n "$relink_command"; then
488623a0898aSmrg	# Preserve any variables that may affect compiler behavior
488723a0898aSmrg	for var in $variables_saved_for_relink; do
488823a0898aSmrg	  if eval test -z \"\${$var+set}\"; then
488923a0898aSmrg	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
489023a0898aSmrg	  elif eval var_value=\$$var; test -z "$var_value"; then
489123a0898aSmrg	    relink_command="$var=; export $var; $relink_command"
489223a0898aSmrg	  else
489323a0898aSmrg	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
489423a0898aSmrg	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
489523a0898aSmrg	  fi
489623a0898aSmrg	done
489723a0898aSmrg	relink_command="(cd `pwd`; $relink_command)"
489823a0898aSmrg	relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
489923a0898aSmrg      fi
490023a0898aSmrg
490123a0898aSmrg      # Quote $echo for shipping.
490223a0898aSmrg      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
490323a0898aSmrg	case $progpath in
490423a0898aSmrg	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
490523a0898aSmrg	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
490623a0898aSmrg	esac
490723a0898aSmrg	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
490823a0898aSmrg      else
490923a0898aSmrg	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
491023a0898aSmrg      fi
491123a0898aSmrg
491223a0898aSmrg      # Only actually do things if our run command is non-null.
491323a0898aSmrg      if test -z "$run"; then
491423a0898aSmrg	# win32 will think the script is a binary if it has
491523a0898aSmrg	# a .exe suffix, so we strip it off here.
491623a0898aSmrg	case $output in
491723a0898aSmrg	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
491823a0898aSmrg	esac
491923a0898aSmrg	# test for cygwin because mv fails w/o .exe extensions
492023a0898aSmrg	case $host in
492123a0898aSmrg	  *cygwin*)
492223a0898aSmrg	    exeext=.exe
492323a0898aSmrg	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
492423a0898aSmrg	  *) exeext= ;;
492523a0898aSmrg	esac
492623a0898aSmrg	case $host in
492723a0898aSmrg	  *cygwin* | *mingw* )
492823a0898aSmrg            output_name=`basename $output`
492923a0898aSmrg            output_path=`dirname $output`
493023a0898aSmrg            cwrappersource="$output_path/$objdir/lt-$output_name.c"
493123a0898aSmrg            cwrapper="$output_path/$output_name.exe"
493223a0898aSmrg            $rm $cwrappersource $cwrapper
493323a0898aSmrg            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
493423a0898aSmrg
493523a0898aSmrg	    cat > $cwrappersource <<EOF
493623a0898aSmrg
493723a0898aSmrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
493823a0898aSmrg   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
493923a0898aSmrg
494023a0898aSmrg   The $output program cannot be directly executed until all the libtool
494123a0898aSmrg   libraries that it depends on are installed.
494223a0898aSmrg
494323a0898aSmrg   This wrapper executable should never be moved out of the build directory.
494423a0898aSmrg   If it is, it will not operate correctly.
494523a0898aSmrg
494623a0898aSmrg   Currently, it simply execs the wrapper *script* "/bin/sh $output",
494723a0898aSmrg   but could eventually absorb all of the scripts functionality and
494823a0898aSmrg   exec $objdir/$outputname directly.
494923a0898aSmrg*/
495023a0898aSmrgEOF
495123a0898aSmrg	    cat >> $cwrappersource<<"EOF"
495223a0898aSmrg#include <stdio.h>
495323a0898aSmrg#include <stdlib.h>
495423a0898aSmrg#include <unistd.h>
495523a0898aSmrg#include <malloc.h>
495623a0898aSmrg#include <stdarg.h>
495723a0898aSmrg#include <assert.h>
495823a0898aSmrg#include <string.h>
495923a0898aSmrg#include <ctype.h>
496023a0898aSmrg#include <sys/stat.h>
496123a0898aSmrg
496223a0898aSmrg#if defined(PATH_MAX)
496323a0898aSmrg# define LT_PATHMAX PATH_MAX
496423a0898aSmrg#elif defined(MAXPATHLEN)
496523a0898aSmrg# define LT_PATHMAX MAXPATHLEN
496623a0898aSmrg#else
496723a0898aSmrg# define LT_PATHMAX 1024
496823a0898aSmrg#endif
496923a0898aSmrg
497023a0898aSmrg#ifndef DIR_SEPARATOR
497123a0898aSmrg# define DIR_SEPARATOR '/'
497223a0898aSmrg# define PATH_SEPARATOR ':'
497323a0898aSmrg#endif
497423a0898aSmrg
497523a0898aSmrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
497623a0898aSmrg  defined (__OS2__)
497723a0898aSmrg# define HAVE_DOS_BASED_FILE_SYSTEM
497823a0898aSmrg# ifndef DIR_SEPARATOR_2
497923a0898aSmrg#  define DIR_SEPARATOR_2 '\\'
498023a0898aSmrg# endif
498123a0898aSmrg# ifndef PATH_SEPARATOR_2
498223a0898aSmrg#  define PATH_SEPARATOR_2 ';'
498323a0898aSmrg# endif
498423a0898aSmrg#endif
498523a0898aSmrg
498623a0898aSmrg#ifndef DIR_SEPARATOR_2
498723a0898aSmrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
498823a0898aSmrg#else /* DIR_SEPARATOR_2 */
498923a0898aSmrg# define IS_DIR_SEPARATOR(ch) \
499023a0898aSmrg        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
499123a0898aSmrg#endif /* DIR_SEPARATOR_2 */
499223a0898aSmrg
499323a0898aSmrg#ifndef PATH_SEPARATOR_2
499423a0898aSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
499523a0898aSmrg#else /* PATH_SEPARATOR_2 */
499623a0898aSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
499723a0898aSmrg#endif /* PATH_SEPARATOR_2 */
499823a0898aSmrg
499923a0898aSmrg#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
500023a0898aSmrg#define XFREE(stale) do { \
500123a0898aSmrg  if (stale) { free ((void *) stale); stale = 0; } \
500223a0898aSmrg} while (0)
500323a0898aSmrg
500423a0898aSmrg/* -DDEBUG is fairly common in CFLAGS.  */
500523a0898aSmrg#undef DEBUG
500623a0898aSmrg#if defined DEBUGWRAPPER
500723a0898aSmrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
500823a0898aSmrg#else
500923a0898aSmrg# define DEBUG(format, ...)
501023a0898aSmrg#endif
501123a0898aSmrg
501223a0898aSmrgconst char *program_name = NULL;
501323a0898aSmrg
501423a0898aSmrgvoid * xmalloc (size_t num);
501523a0898aSmrgchar * xstrdup (const char *string);
501623a0898aSmrgconst char * base_name (const char *name);
501723a0898aSmrgchar * find_executable(const char *wrapper);
501823a0898aSmrgint    check_executable(const char *path);
501923a0898aSmrgchar * strendzap(char *str, const char *pat);
502023a0898aSmrgvoid lt_fatal (const char *message, ...);
502123a0898aSmrg
502223a0898aSmrgint
502323a0898aSmrgmain (int argc, char *argv[])
502423a0898aSmrg{
502523a0898aSmrg  char **newargz;
502623a0898aSmrg  int i;
502723a0898aSmrg
502823a0898aSmrg  program_name = (char *) xstrdup (base_name (argv[0]));
502923a0898aSmrg  DEBUG("(main) argv[0]      : %s\n",argv[0]);
503023a0898aSmrg  DEBUG("(main) program_name : %s\n",program_name);
503123a0898aSmrg  newargz = XMALLOC(char *, argc+2);
503223a0898aSmrgEOF
503323a0898aSmrg
503423a0898aSmrg            cat >> $cwrappersource <<EOF
503523a0898aSmrg  newargz[0] = (char *) xstrdup("$SHELL");
503623a0898aSmrgEOF
503723a0898aSmrg
503823a0898aSmrg            cat >> $cwrappersource <<"EOF"
503923a0898aSmrg  newargz[1] = find_executable(argv[0]);
504023a0898aSmrg  if (newargz[1] == NULL)
504123a0898aSmrg    lt_fatal("Couldn't find %s", argv[0]);
504223a0898aSmrg  DEBUG("(main) found exe at : %s\n",newargz[1]);
504323a0898aSmrg  /* we know the script has the same name, without the .exe */
504423a0898aSmrg  /* so make sure newargz[1] doesn't end in .exe */
504523a0898aSmrg  strendzap(newargz[1],".exe");
504623a0898aSmrg  for (i = 1; i < argc; i++)
504723a0898aSmrg    newargz[i+1] = xstrdup(argv[i]);
504823a0898aSmrg  newargz[argc+1] = NULL;
504923a0898aSmrg
505023a0898aSmrg  for (i=0; i<argc+1; i++)
505123a0898aSmrg  {
505223a0898aSmrg    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
505323a0898aSmrg    ;
505423a0898aSmrg  }
505523a0898aSmrg
505623a0898aSmrgEOF
505723a0898aSmrg
505823a0898aSmrg            case $host_os in
505923a0898aSmrg              mingw*)
506023a0898aSmrg                cat >> $cwrappersource <<EOF
506123a0898aSmrg  execv("$SHELL",(char const **)newargz);
506223a0898aSmrgEOF
506323a0898aSmrg              ;;
506423a0898aSmrg              *)
506523a0898aSmrg                cat >> $cwrappersource <<EOF
506623a0898aSmrg  execv("$SHELL",newargz);
506723a0898aSmrgEOF
506823a0898aSmrg              ;;
506923a0898aSmrg            esac
507023a0898aSmrg
507123a0898aSmrg            cat >> $cwrappersource <<"EOF"
507223a0898aSmrg  return 127;
507323a0898aSmrg}
507423a0898aSmrg
507523a0898aSmrgvoid *
507623a0898aSmrgxmalloc (size_t num)
507723a0898aSmrg{
507823a0898aSmrg  void * p = (void *) malloc (num);
507923a0898aSmrg  if (!p)
508023a0898aSmrg    lt_fatal ("Memory exhausted");
508123a0898aSmrg
508223a0898aSmrg  return p;
508323a0898aSmrg}
508423a0898aSmrg
508523a0898aSmrgchar *
508623a0898aSmrgxstrdup (const char *string)
508723a0898aSmrg{
508823a0898aSmrg  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
508923a0898aSmrg;
509023a0898aSmrg}
509123a0898aSmrg
509223a0898aSmrgconst char *
509323a0898aSmrgbase_name (const char *name)
509423a0898aSmrg{
509523a0898aSmrg  const char *base;
509623a0898aSmrg
509723a0898aSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
509823a0898aSmrg  /* Skip over the disk name in MSDOS pathnames. */
509923a0898aSmrg  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
510023a0898aSmrg    name += 2;
510123a0898aSmrg#endif
510223a0898aSmrg
510323a0898aSmrg  for (base = name; *name; name++)
510423a0898aSmrg    if (IS_DIR_SEPARATOR (*name))
510523a0898aSmrg      base = name + 1;
510623a0898aSmrg  return base;
510723a0898aSmrg}
510823a0898aSmrg
510923a0898aSmrgint
511023a0898aSmrgcheck_executable(const char * path)
511123a0898aSmrg{
511223a0898aSmrg  struct stat st;
511323a0898aSmrg
511423a0898aSmrg  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
511523a0898aSmrg  if ((!path) || (!*path))
511623a0898aSmrg    return 0;
511723a0898aSmrg
511823a0898aSmrg  if ((stat (path, &st) >= 0) &&
511923a0898aSmrg      (
512023a0898aSmrg        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
512123a0898aSmrg#if defined (S_IXOTH)
512223a0898aSmrg       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
512323a0898aSmrg#endif
512423a0898aSmrg#if defined (S_IXGRP)
512523a0898aSmrg       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
512623a0898aSmrg#endif
512723a0898aSmrg       ((st.st_mode & S_IXUSR) == S_IXUSR))
512823a0898aSmrg      )
512923a0898aSmrg    return 1;
513023a0898aSmrg  else
513123a0898aSmrg    return 0;
513223a0898aSmrg}
513323a0898aSmrg
513423a0898aSmrg/* Searches for the full path of the wrapper.  Returns
513523a0898aSmrg   newly allocated full path name if found, NULL otherwise */
513623a0898aSmrgchar *
513723a0898aSmrgfind_executable (const char* wrapper)
513823a0898aSmrg{
513923a0898aSmrg  int has_slash = 0;
514023a0898aSmrg  const char* p;
514123a0898aSmrg  const char* p_next;
514223a0898aSmrg  /* static buffer for getcwd */
514323a0898aSmrg  char tmp[LT_PATHMAX + 1];
514423a0898aSmrg  int tmp_len;
514523a0898aSmrg  char* concat_name;
514623a0898aSmrg
514723a0898aSmrg  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
514823a0898aSmrg
514923a0898aSmrg  if ((wrapper == NULL) || (*wrapper == '\0'))
515023a0898aSmrg    return NULL;
515123a0898aSmrg
515223a0898aSmrg  /* Absolute path? */
515323a0898aSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
515423a0898aSmrg  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
515523a0898aSmrg  {
515623a0898aSmrg    concat_name = xstrdup (wrapper);
515723a0898aSmrg    if (check_executable(concat_name))
515823a0898aSmrg      return concat_name;
515923a0898aSmrg    XFREE(concat_name);
516023a0898aSmrg  }
516123a0898aSmrg  else
516223a0898aSmrg  {
516323a0898aSmrg#endif
516423a0898aSmrg    if (IS_DIR_SEPARATOR (wrapper[0]))
516523a0898aSmrg    {
516623a0898aSmrg      concat_name = xstrdup (wrapper);
516723a0898aSmrg      if (check_executable(concat_name))
516823a0898aSmrg        return concat_name;
516923a0898aSmrg      XFREE(concat_name);
517023a0898aSmrg    }
517123a0898aSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
517223a0898aSmrg  }
517323a0898aSmrg#endif
517423a0898aSmrg
517523a0898aSmrg  for (p = wrapper; *p; p++)
517623a0898aSmrg    if (*p == '/')
517723a0898aSmrg    {
517823a0898aSmrg      has_slash = 1;
517923a0898aSmrg      break;
518023a0898aSmrg    }
518123a0898aSmrg  if (!has_slash)
518223a0898aSmrg  {
518323a0898aSmrg    /* no slashes; search PATH */
518423a0898aSmrg    const char* path = getenv ("PATH");
518523a0898aSmrg    if (path != NULL)
518623a0898aSmrg    {
518723a0898aSmrg      for (p = path; *p; p = p_next)
518823a0898aSmrg      {
518923a0898aSmrg        const char* q;
519023a0898aSmrg        size_t p_len;
519123a0898aSmrg        for (q = p; *q; q++)
519223a0898aSmrg          if (IS_PATH_SEPARATOR(*q))
519323a0898aSmrg            break;
519423a0898aSmrg        p_len = q - p;
519523a0898aSmrg        p_next = (*q == '\0' ? q : q + 1);
519623a0898aSmrg        if (p_len == 0)
519723a0898aSmrg        {
519823a0898aSmrg          /* empty path: current directory */
519923a0898aSmrg          if (getcwd (tmp, LT_PATHMAX) == NULL)
520023a0898aSmrg            lt_fatal ("getcwd failed");
520123a0898aSmrg          tmp_len = strlen(tmp);
520223a0898aSmrg          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
520323a0898aSmrg          memcpy (concat_name, tmp, tmp_len);
520423a0898aSmrg          concat_name[tmp_len] = '/';
520523a0898aSmrg          strcpy (concat_name + tmp_len + 1, wrapper);
520623a0898aSmrg        }
520723a0898aSmrg        else
520823a0898aSmrg        {
520923a0898aSmrg          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
521023a0898aSmrg          memcpy (concat_name, p, p_len);
521123a0898aSmrg          concat_name[p_len] = '/';
521223a0898aSmrg          strcpy (concat_name + p_len + 1, wrapper);
521323a0898aSmrg        }
521423a0898aSmrg        if (check_executable(concat_name))
521523a0898aSmrg          return concat_name;
521623a0898aSmrg        XFREE(concat_name);
521723a0898aSmrg      }
521823a0898aSmrg    }
521923a0898aSmrg    /* not found in PATH; assume curdir */
522023a0898aSmrg  }
522123a0898aSmrg  /* Relative path | not found in path: prepend cwd */
522223a0898aSmrg  if (getcwd (tmp, LT_PATHMAX) == NULL)
522323a0898aSmrg    lt_fatal ("getcwd failed");
522423a0898aSmrg  tmp_len = strlen(tmp);
522523a0898aSmrg  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
522623a0898aSmrg  memcpy (concat_name, tmp, tmp_len);
522723a0898aSmrg  concat_name[tmp_len] = '/';
522823a0898aSmrg  strcpy (concat_name + tmp_len + 1, wrapper);
522923a0898aSmrg
523023a0898aSmrg  if (check_executable(concat_name))
523123a0898aSmrg    return concat_name;
523223a0898aSmrg  XFREE(concat_name);
523323a0898aSmrg  return NULL;
523423a0898aSmrg}
523523a0898aSmrg
523623a0898aSmrgchar *
523723a0898aSmrgstrendzap(char *str, const char *pat)
523823a0898aSmrg{
523923a0898aSmrg  size_t len, patlen;
524023a0898aSmrg
524123a0898aSmrg  assert(str != NULL);
524223a0898aSmrg  assert(pat != NULL);
524323a0898aSmrg
524423a0898aSmrg  len = strlen(str);
524523a0898aSmrg  patlen = strlen(pat);
524623a0898aSmrg
524723a0898aSmrg  if (patlen <= len)
524823a0898aSmrg  {
524923a0898aSmrg    str += len - patlen;
525023a0898aSmrg    if (strcmp(str, pat) == 0)
525123a0898aSmrg      *str = '\0';
525223a0898aSmrg  }
525323a0898aSmrg  return str;
525423a0898aSmrg}
525523a0898aSmrg
525623a0898aSmrgstatic void
525723a0898aSmrglt_error_core (int exit_status, const char * mode,
525823a0898aSmrg          const char * message, va_list ap)
525923a0898aSmrg{
526023a0898aSmrg  fprintf (stderr, "%s: %s: ", program_name, mode);
526123a0898aSmrg  vfprintf (stderr, message, ap);
526223a0898aSmrg  fprintf (stderr, ".\n");
526323a0898aSmrg
526423a0898aSmrg  if (exit_status >= 0)
526523a0898aSmrg    exit (exit_status);
526623a0898aSmrg}
526723a0898aSmrg
526823a0898aSmrgvoid
526923a0898aSmrglt_fatal (const char *message, ...)
527023a0898aSmrg{
527123a0898aSmrg  va_list ap;
527223a0898aSmrg  va_start (ap, message);
527323a0898aSmrg  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
527423a0898aSmrg  va_end (ap);
527523a0898aSmrg}
527623a0898aSmrgEOF
527723a0898aSmrg          # we should really use a build-platform specific compiler
527823a0898aSmrg          # here, but OTOH, the wrappers (shell script and this C one)
527923a0898aSmrg          # are only useful if you want to execute the "real" binary.
528023a0898aSmrg          # Since the "real" binary is built for $host, then this
528123a0898aSmrg          # wrapper might as well be built for $host, too.
528223a0898aSmrg          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
528323a0898aSmrg          ;;
528423a0898aSmrg        esac
528523a0898aSmrg        $rm $output
528623a0898aSmrg        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
528723a0898aSmrg
528823a0898aSmrg	$echo > $output "\
528923a0898aSmrg#! $SHELL
529023a0898aSmrg
529123a0898aSmrg# $output - temporary wrapper script for $objdir/$outputname
529223a0898aSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
529323a0898aSmrg#
529423a0898aSmrg# The $output program cannot be directly executed until all the libtool
529523a0898aSmrg# libraries that it depends on are installed.
529623a0898aSmrg#
529723a0898aSmrg# This wrapper script should never be moved out of the build directory.
529823a0898aSmrg# If it is, it will not operate correctly.
529923a0898aSmrg
530023a0898aSmrg# Sed substitution that helps us do robust quoting.  It backslashifies
530123a0898aSmrg# metacharacters that are still active within double-quoted strings.
530223a0898aSmrgXsed='${SED} -e 1s/^X//'
530323a0898aSmrgsed_quote_subst='$sed_quote_subst'
530423a0898aSmrg
530523a0898aSmrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
530623a0898aSmrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
530723a0898aSmrg  emulate sh
530823a0898aSmrg  NULLCMD=:
530923a0898aSmrg  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
531023a0898aSmrg  # is contrary to our usage.  Disable this feature.
531123a0898aSmrg  alias -g '\${1+\"\$@\"}'='\"\$@\"'
531223a0898aSmrg  setopt NO_GLOB_SUBST
531323a0898aSmrgelse
531423a0898aSmrg  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
531523a0898aSmrgfi
531623a0898aSmrgBIN_SH=xpg4; export BIN_SH # for Tru64
531723a0898aSmrgDUALCASE=1; export DUALCASE # for MKS sh
531823a0898aSmrg
531923a0898aSmrg# The HP-UX ksh and POSIX shell print the target directory to stdout
532023a0898aSmrg# if CDPATH is set.
532123a0898aSmrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
532223a0898aSmrg
532323a0898aSmrgrelink_command=\"$relink_command\"
532423a0898aSmrg
532523a0898aSmrg# This environment variable determines our operation mode.
532623a0898aSmrgif test \"\$libtool_install_magic\" = \"$magic\"; then
532723a0898aSmrg  # install mode needs the following variable:
532823a0898aSmrg  notinst_deplibs='$notinst_deplibs'
532923a0898aSmrgelse
533023a0898aSmrg  # When we are sourced in execute mode, \$file and \$echo are already set.
533123a0898aSmrg  if test \"\$libtool_execute_magic\" != \"$magic\"; then
533223a0898aSmrg    echo=\"$qecho\"
533323a0898aSmrg    file=\"\$0\"
533423a0898aSmrg    # Make sure echo works.
533523a0898aSmrg    if test \"X\$1\" = X--no-reexec; then
533623a0898aSmrg      # Discard the --no-reexec flag, and continue.
533723a0898aSmrg      shift
533823a0898aSmrg    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
533923a0898aSmrg      # Yippee, \$echo works!
534023a0898aSmrg      :
534123a0898aSmrg    else
534223a0898aSmrg      # Restart under the correct shell, and then maybe \$echo will work.
534323a0898aSmrg      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
534423a0898aSmrg    fi
534523a0898aSmrg  fi\
534623a0898aSmrg"
534723a0898aSmrg	$echo >> $output "\
534823a0898aSmrg
534923a0898aSmrg  # Find the directory that this script lives in.
535023a0898aSmrg  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
535123a0898aSmrg  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
535223a0898aSmrg
535323a0898aSmrg  # Follow symbolic links until we get to the real thisdir.
535423a0898aSmrg  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
535523a0898aSmrg  while test -n \"\$file\"; do
535623a0898aSmrg    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
535723a0898aSmrg
535823a0898aSmrg    # If there was a directory component, then change thisdir.
535923a0898aSmrg    if test \"x\$destdir\" != \"x\$file\"; then
536023a0898aSmrg      case \"\$destdir\" in
536123a0898aSmrg      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
536223a0898aSmrg      *) thisdir=\"\$thisdir/\$destdir\" ;;
536323a0898aSmrg      esac
536423a0898aSmrg    fi
536523a0898aSmrg
536623a0898aSmrg    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
536723a0898aSmrg    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
536823a0898aSmrg  done
536923a0898aSmrg
537023a0898aSmrg  # Try to get the absolute directory name.
537123a0898aSmrg  absdir=\`cd \"\$thisdir\" && pwd\`
537223a0898aSmrg  test -n \"\$absdir\" && thisdir=\"\$absdir\"
537323a0898aSmrg"
537423a0898aSmrg
537523a0898aSmrg	if test "$fast_install" = yes; then
537623a0898aSmrg	  $echo >> $output "\
537723a0898aSmrg  program=lt-'$outputname'$exeext
537823a0898aSmrg  progdir=\"\$thisdir/$objdir\"
537923a0898aSmrg
538023a0898aSmrg  if test ! -f \"\$progdir/\$program\" || \\
538123a0898aSmrg     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
538223a0898aSmrg       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
538323a0898aSmrg
538423a0898aSmrg    file=\"\$\$-\$program\"
538523a0898aSmrg
538623a0898aSmrg    if test ! -d \"\$progdir\"; then
538723a0898aSmrg      $mkdir \"\$progdir\"
538823a0898aSmrg    else
538923a0898aSmrg      $rm \"\$progdir/\$file\"
539023a0898aSmrg    fi"
539123a0898aSmrg
539223a0898aSmrg	  $echo >> $output "\
539323a0898aSmrg
539423a0898aSmrg    # relink executable if necessary
539523a0898aSmrg    if test -n \"\$relink_command\"; then
539623a0898aSmrg      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
539723a0898aSmrg      else
539823a0898aSmrg	$echo \"\$relink_command_output\" >&2
539923a0898aSmrg	$rm \"\$progdir/\$file\"
540023a0898aSmrg	exit $EXIT_FAILURE
540123a0898aSmrg      fi
540223a0898aSmrg    fi
540323a0898aSmrg
540423a0898aSmrg    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
540523a0898aSmrg    { $rm \"\$progdir/\$program\";
540623a0898aSmrg      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
540723a0898aSmrg    $rm \"\$progdir/\$file\"
540823a0898aSmrg  fi"
540923a0898aSmrg	else
541023a0898aSmrg	  $echo >> $output "\
541123a0898aSmrg  program='$outputname'
541223a0898aSmrg  progdir=\"\$thisdir/$objdir\"
541323a0898aSmrg"
541423a0898aSmrg	fi
541523a0898aSmrg
541623a0898aSmrg	$echo >> $output "\
541723a0898aSmrg
541823a0898aSmrg  if test -f \"\$progdir/\$program\"; then"
541923a0898aSmrg
542023a0898aSmrg	# Export our shlibpath_var if we have one.
542123a0898aSmrg	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
542223a0898aSmrg	  $echo >> $output "\
542323a0898aSmrg    # Add our own library path to $shlibpath_var
542423a0898aSmrg    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
542523a0898aSmrg
542623a0898aSmrg    # Some systems cannot cope with colon-terminated $shlibpath_var
542723a0898aSmrg    # The second colon is a workaround for a bug in BeOS R4 sed
542823a0898aSmrg    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
542923a0898aSmrg
543023a0898aSmrg    export $shlibpath_var
543123a0898aSmrg"
543223a0898aSmrg	fi
543323a0898aSmrg
543423a0898aSmrg	# fixup the dll searchpath if we need to.
543523a0898aSmrg	if test -n "$dllsearchpath"; then
543623a0898aSmrg	  $echo >> $output "\
543723a0898aSmrg    # Add the dll search path components to the executable PATH
543823a0898aSmrg    PATH=$dllsearchpath:\$PATH
543923a0898aSmrg"
544023a0898aSmrg	fi
544123a0898aSmrg
544223a0898aSmrg	$echo >> $output "\
544323a0898aSmrg    if test \"\$libtool_execute_magic\" != \"$magic\"; then
544423a0898aSmrg      # Run the actual program with our arguments.
544523a0898aSmrg"
544623a0898aSmrg	case $host in
544723a0898aSmrg	# Backslashes separate directories on plain windows
544823a0898aSmrg	*-*-mingw | *-*-os2*)
544923a0898aSmrg	  $echo >> $output "\
545023a0898aSmrg      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
545123a0898aSmrg"
545223a0898aSmrg	  ;;
545323a0898aSmrg
545423a0898aSmrg	*)
545523a0898aSmrg	  $echo >> $output "\
545623a0898aSmrg      exec \"\$progdir/\$program\" \${1+\"\$@\"}
545723a0898aSmrg"
545823a0898aSmrg	  ;;
545923a0898aSmrg	esac
546023a0898aSmrg	$echo >> $output "\
546123a0898aSmrg      \$echo \"\$0: cannot exec \$program \$*\"
546223a0898aSmrg      exit $EXIT_FAILURE
546323a0898aSmrg    fi
546423a0898aSmrg  else
546523a0898aSmrg    # The program doesn't exist.
546623a0898aSmrg    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
546723a0898aSmrg    \$echo \"This script is just a wrapper for \$program.\" 1>&2
546823a0898aSmrg    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
546923a0898aSmrg    exit $EXIT_FAILURE
547023a0898aSmrg  fi
547123a0898aSmrgfi\
547223a0898aSmrg"
547323a0898aSmrg	chmod +x $output
547423a0898aSmrg      fi
547523a0898aSmrg      exit $EXIT_SUCCESS
547623a0898aSmrg      ;;
547723a0898aSmrg    esac
547823a0898aSmrg
547923a0898aSmrg    # See if we need to build an old-fashioned archive.
548023a0898aSmrg    for oldlib in $oldlibs; do
548123a0898aSmrg
548223a0898aSmrg      if test "$build_libtool_libs" = convenience; then
548323a0898aSmrg	oldobjs="$libobjs_save"
548423a0898aSmrg	addlibs="$convenience"
548523a0898aSmrg	build_libtool_libs=no
548623a0898aSmrg      else
548723a0898aSmrg	if test "$build_libtool_libs" = module; then
548823a0898aSmrg	  oldobjs="$libobjs_save"
548923a0898aSmrg	  build_libtool_libs=no
549023a0898aSmrg	else
549123a0898aSmrg	  oldobjs="$old_deplibs $non_pic_objects"
549223a0898aSmrg	fi
549323a0898aSmrg	addlibs="$old_convenience"
549423a0898aSmrg      fi
549523a0898aSmrg
549623a0898aSmrg      if test -n "$addlibs"; then
549723a0898aSmrg	gentop="$output_objdir/${outputname}x"
549823a0898aSmrg	generated="$generated $gentop"
549923a0898aSmrg
550023a0898aSmrg	func_extract_archives $gentop $addlibs
550123a0898aSmrg	oldobjs="$oldobjs $func_extract_archives_result"
550223a0898aSmrg      fi
550323a0898aSmrg
550423a0898aSmrg      # Do each command in the archive commands.
550523a0898aSmrg      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
550623a0898aSmrg       cmds=$old_archive_from_new_cmds
550723a0898aSmrg      else
550823a0898aSmrg	# POSIX demands no paths to be encoded in archives.  We have
550923a0898aSmrg	# to avoid creating archives with duplicate basenames if we
551023a0898aSmrg	# might have to extract them afterwards, e.g., when creating a
551123a0898aSmrg	# static archive out of a convenience library, or when linking
551223a0898aSmrg	# the entirety of a libtool archive into another (currently
551323a0898aSmrg	# not supported by libtool).
551423a0898aSmrg	if (for obj in $oldobjs
551523a0898aSmrg	    do
551623a0898aSmrg	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
551723a0898aSmrg	    done | sort | sort -uc >/dev/null 2>&1); then
551823a0898aSmrg	  :
551923a0898aSmrg	else
552023a0898aSmrg	  $echo "copying selected object files to avoid basename conflicts..."
552123a0898aSmrg
552223a0898aSmrg	  if test -z "$gentop"; then
552323a0898aSmrg	    gentop="$output_objdir/${outputname}x"
552423a0898aSmrg	    generated="$generated $gentop"
552523a0898aSmrg
552623a0898aSmrg	    $show "${rm}r $gentop"
552723a0898aSmrg	    $run ${rm}r "$gentop"
552823a0898aSmrg	    $show "$mkdir $gentop"
552923a0898aSmrg	    $run $mkdir "$gentop"
553023a0898aSmrg	    exit_status=$?
553123a0898aSmrg	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
553223a0898aSmrg	      exit $exit_status
553323a0898aSmrg	    fi
553423a0898aSmrg	  fi
553523a0898aSmrg
553623a0898aSmrg	  save_oldobjs=$oldobjs
553723a0898aSmrg	  oldobjs=
553823a0898aSmrg	  counter=1
553923a0898aSmrg	  for obj in $save_oldobjs
554023a0898aSmrg	  do
554123a0898aSmrg	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
554223a0898aSmrg	    case " $oldobjs " in
554323a0898aSmrg	    " ") oldobjs=$obj ;;
554423a0898aSmrg	    *[\ /]"$objbase "*)
554523a0898aSmrg	      while :; do
554623a0898aSmrg		# Make sure we don't pick an alternate name that also
554723a0898aSmrg		# overlaps.
554823a0898aSmrg		newobj=lt$counter-$objbase
554923a0898aSmrg		counter=`expr $counter + 1`
555023a0898aSmrg		case " $oldobjs " in
555123a0898aSmrg		*[\ /]"$newobj "*) ;;
555223a0898aSmrg		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
555323a0898aSmrg		esac
555423a0898aSmrg	      done
555523a0898aSmrg	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
555623a0898aSmrg	      $run ln "$obj" "$gentop/$newobj" ||
555723a0898aSmrg	      $run cp "$obj" "$gentop/$newobj"
555823a0898aSmrg	      oldobjs="$oldobjs $gentop/$newobj"
555923a0898aSmrg	      ;;
556023a0898aSmrg	    *) oldobjs="$oldobjs $obj" ;;
556123a0898aSmrg	    esac
556223a0898aSmrg	  done
556323a0898aSmrg	fi
556423a0898aSmrg
556523a0898aSmrg	eval cmds=\"$old_archive_cmds\"
556623a0898aSmrg
556723a0898aSmrg	if len=`expr "X$cmds" : ".*"` &&
556823a0898aSmrg	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
556923a0898aSmrg	  cmds=$old_archive_cmds
557023a0898aSmrg	else
557123a0898aSmrg	  # the command line is too long to link in one step, link in parts
557223a0898aSmrg	  $echo "using piecewise archive linking..."
557323a0898aSmrg	  save_RANLIB=$RANLIB
557423a0898aSmrg	  RANLIB=:
557523a0898aSmrg	  objlist=
557623a0898aSmrg	  concat_cmds=
557723a0898aSmrg	  save_oldobjs=$oldobjs
557823a0898aSmrg
557923a0898aSmrg	  # Is there a better way of finding the last object in the list?
558023a0898aSmrg	  for obj in $save_oldobjs
558123a0898aSmrg	  do
558223a0898aSmrg	    last_oldobj=$obj
558323a0898aSmrg	  done
558423a0898aSmrg	  for obj in $save_oldobjs
558523a0898aSmrg	  do
558623a0898aSmrg	    oldobjs="$objlist $obj"
558723a0898aSmrg	    objlist="$objlist $obj"
558823a0898aSmrg	    eval test_cmds=\"$old_archive_cmds\"
558923a0898aSmrg	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
559023a0898aSmrg	       test "$len" -le "$max_cmd_len"; then
559123a0898aSmrg	      :
559223a0898aSmrg	    else
559323a0898aSmrg	      # the above command should be used before it gets too long
559423a0898aSmrg	      oldobjs=$objlist
559523a0898aSmrg	      if test "$obj" = "$last_oldobj" ; then
559623a0898aSmrg	        RANLIB=$save_RANLIB
559723a0898aSmrg	      fi
559823a0898aSmrg	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
559923a0898aSmrg	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
560023a0898aSmrg	      objlist=
560123a0898aSmrg	    fi
560223a0898aSmrg	  done
560323a0898aSmrg	  RANLIB=$save_RANLIB
560423a0898aSmrg	  oldobjs=$objlist
560523a0898aSmrg	  if test "X$oldobjs" = "X" ; then
560623a0898aSmrg	    eval cmds=\"\$concat_cmds\"
560723a0898aSmrg	  else
560823a0898aSmrg	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
560923a0898aSmrg	  fi
561023a0898aSmrg	fi
561123a0898aSmrg      fi
561223a0898aSmrg      save_ifs="$IFS"; IFS='~'
561323a0898aSmrg      for cmd in $cmds; do
561423a0898aSmrg        eval cmd=\"$cmd\"
561523a0898aSmrg	IFS="$save_ifs"
561623a0898aSmrg	$show "$cmd"
561723a0898aSmrg	$run eval "$cmd" || exit $?
561823a0898aSmrg      done
561923a0898aSmrg      IFS="$save_ifs"
562023a0898aSmrg    done
562123a0898aSmrg
562223a0898aSmrg    if test -n "$generated"; then
562323a0898aSmrg      $show "${rm}r$generated"
562423a0898aSmrg      $run ${rm}r$generated
562523a0898aSmrg    fi
562623a0898aSmrg
562723a0898aSmrg    # Now create the libtool archive.
562823a0898aSmrg    case $output in
562923a0898aSmrg    *.la)
563023a0898aSmrg      old_library=
563123a0898aSmrg      test "$build_old_libs" = yes && old_library="$libname.$libext"
563223a0898aSmrg      $show "creating $output"
563323a0898aSmrg
563423a0898aSmrg      # Preserve any variables that may affect compiler behavior
563523a0898aSmrg      for var in $variables_saved_for_relink; do
563623a0898aSmrg	if eval test -z \"\${$var+set}\"; then
563723a0898aSmrg	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
563823a0898aSmrg	elif eval var_value=\$$var; test -z "$var_value"; then
563923a0898aSmrg	  relink_command="$var=; export $var; $relink_command"
564023a0898aSmrg	else
564123a0898aSmrg	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
564223a0898aSmrg	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
564323a0898aSmrg	fi
564423a0898aSmrg      done
564523a0898aSmrg      # Quote the link command for shipping.
564623a0898aSmrg      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
564723a0898aSmrg      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
564823a0898aSmrg      if test "$hardcode_automatic" = yes ; then
564923a0898aSmrg	relink_command=
565023a0898aSmrg      fi
565123a0898aSmrg
565223a0898aSmrg
565323a0898aSmrg      # Only create the output if not a dry run.
565423a0898aSmrg      if test -z "$run"; then
565523a0898aSmrg	for installed in no yes; do
565623a0898aSmrg	  if test "$installed" = yes; then
565723a0898aSmrg	    if test -z "$install_libdir"; then
565823a0898aSmrg	      break
565923a0898aSmrg	    fi
566023a0898aSmrg	    output="$output_objdir/$outputname"i
566123a0898aSmrg	    # Replace all uninstalled libtool libraries with the installed ones
566223a0898aSmrg	    newdependency_libs=
566323a0898aSmrg	    for deplib in $dependency_libs; do
566423a0898aSmrg	      case $deplib in
566523a0898aSmrg	      *.la)
566623a0898aSmrg		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
566723a0898aSmrg		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
566823a0898aSmrg		if test -z "$libdir"; then
566923a0898aSmrg		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
567023a0898aSmrg		  exit $EXIT_FAILURE
567123a0898aSmrg		fi
567223a0898aSmrg		newdependency_libs="$newdependency_libs $libdir/$name"
567323a0898aSmrg		;;
567423a0898aSmrg	      *) newdependency_libs="$newdependency_libs $deplib" ;;
567523a0898aSmrg	      esac
567623a0898aSmrg	    done
567723a0898aSmrg	    dependency_libs="$newdependency_libs"
567823a0898aSmrg	    newdlfiles=
567923a0898aSmrg	    for lib in $dlfiles; do
568023a0898aSmrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
568123a0898aSmrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
568223a0898aSmrg	      if test -z "$libdir"; then
568323a0898aSmrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
568423a0898aSmrg		exit $EXIT_FAILURE
568523a0898aSmrg	      fi
568623a0898aSmrg	      newdlfiles="$newdlfiles $libdir/$name"
568723a0898aSmrg	    done
568823a0898aSmrg	    dlfiles="$newdlfiles"
568923a0898aSmrg	    newdlprefiles=
569023a0898aSmrg	    for lib in $dlprefiles; do
569123a0898aSmrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
569223a0898aSmrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
569323a0898aSmrg	      if test -z "$libdir"; then
569423a0898aSmrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
569523a0898aSmrg		exit $EXIT_FAILURE
569623a0898aSmrg	      fi
569723a0898aSmrg	      newdlprefiles="$newdlprefiles $libdir/$name"
569823a0898aSmrg	    done
569923a0898aSmrg	    dlprefiles="$newdlprefiles"
570023a0898aSmrg	  else
570123a0898aSmrg	    newdlfiles=
570223a0898aSmrg	    for lib in $dlfiles; do
570323a0898aSmrg	      case $lib in
570423a0898aSmrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
570523a0898aSmrg		*) abs=`pwd`"/$lib" ;;
570623a0898aSmrg	      esac
570723a0898aSmrg	      newdlfiles="$newdlfiles $abs"
570823a0898aSmrg	    done
570923a0898aSmrg	    dlfiles="$newdlfiles"
571023a0898aSmrg	    newdlprefiles=
571123a0898aSmrg	    for lib in $dlprefiles; do
571223a0898aSmrg	      case $lib in
571323a0898aSmrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
571423a0898aSmrg		*) abs=`pwd`"/$lib" ;;
571523a0898aSmrg	      esac
571623a0898aSmrg	      newdlprefiles="$newdlprefiles $abs"
571723a0898aSmrg	    done
571823a0898aSmrg	    dlprefiles="$newdlprefiles"
571923a0898aSmrg	  fi
572023a0898aSmrg	  $rm $output
572123a0898aSmrg	  # place dlname in correct position for cygwin
572223a0898aSmrg	  tdlname=$dlname
572323a0898aSmrg	  case $host,$output,$installed,$module,$dlname in
572423a0898aSmrg	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
572523a0898aSmrg	  esac
572623a0898aSmrg	  $echo > $output "\
572723a0898aSmrg# $outputname - a libtool library file
572823a0898aSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
572923a0898aSmrg#
573023a0898aSmrg# Please DO NOT delete this file!
573123a0898aSmrg# It is necessary for linking the library.
573223a0898aSmrg
573323a0898aSmrg# The name that we can dlopen(3).
573423a0898aSmrgdlname='$tdlname'
573523a0898aSmrg
573623a0898aSmrg# Names of this library.
573723a0898aSmrglibrary_names='$library_names'
573823a0898aSmrg
573923a0898aSmrg# The name of the static archive.
574023a0898aSmrgold_library='$old_library'
574123a0898aSmrg
574223a0898aSmrg# Libraries that this one depends upon.
574323a0898aSmrgdependency_libs='$dependency_libs'
574423a0898aSmrg
574523a0898aSmrg# Version information for $libname.
574623a0898aSmrgcurrent=$current
574723a0898aSmrgage=$age
574823a0898aSmrgrevision=$revision
574923a0898aSmrg
575023a0898aSmrg# Is this an already installed library?
575123a0898aSmrginstalled=$installed
575223a0898aSmrg
575323a0898aSmrg# Should we warn about portability when linking against -modules?
575423a0898aSmrgshouldnotlink=$module
575523a0898aSmrg
575623a0898aSmrg# Files to dlopen/dlpreopen
575723a0898aSmrgdlopen='$dlfiles'
575823a0898aSmrgdlpreopen='$dlprefiles'
575923a0898aSmrg
576023a0898aSmrg# Directory that this library needs to be installed in:
576123a0898aSmrglibdir='$install_libdir'"
576223a0898aSmrg	  if test "$installed" = no && test "$need_relink" = yes; then
576323a0898aSmrg	    $echo >> $output "\
576423a0898aSmrgrelink_command=\"$relink_command\""
576523a0898aSmrg	  fi
576623a0898aSmrg	done
576723a0898aSmrg      fi
576823a0898aSmrg
576923a0898aSmrg      # Do a symbolic link so that the libtool archive can be found in
577023a0898aSmrg      # LD_LIBRARY_PATH before the program is installed.
577123a0898aSmrg      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
577223a0898aSmrg      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
577323a0898aSmrg      ;;
577423a0898aSmrg    esac
577523a0898aSmrg    exit $EXIT_SUCCESS
577623a0898aSmrg    ;;
577723a0898aSmrg
577823a0898aSmrg  # libtool install mode
577923a0898aSmrg  install)
578023a0898aSmrg    modename="$modename: install"
578123a0898aSmrg
578223a0898aSmrg    # There may be an optional sh(1) argument at the beginning of
578323a0898aSmrg    # install_prog (especially on Windows NT).
578423a0898aSmrg    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
578523a0898aSmrg       # Allow the use of GNU shtool's install command.
578623a0898aSmrg       $echo "X$nonopt" | grep shtool > /dev/null; then
578723a0898aSmrg      # Aesthetically quote it.
578823a0898aSmrg      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
578923a0898aSmrg      case $arg in
579023a0898aSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
579123a0898aSmrg	arg="\"$arg\""
579223a0898aSmrg	;;
579323a0898aSmrg      esac
579423a0898aSmrg      install_prog="$arg "
579523a0898aSmrg      arg="$1"
579623a0898aSmrg      shift
579723a0898aSmrg    else
579823a0898aSmrg      install_prog=
579923a0898aSmrg      arg=$nonopt
580023a0898aSmrg    fi
580123a0898aSmrg
580223a0898aSmrg    # The real first argument should be the name of the installation program.
580323a0898aSmrg    # Aesthetically quote it.
580423a0898aSmrg    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
580523a0898aSmrg    case $arg in
580623a0898aSmrg    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
580723a0898aSmrg      arg="\"$arg\""
580823a0898aSmrg      ;;
580923a0898aSmrg    esac
581023a0898aSmrg    install_prog="$install_prog$arg"
581123a0898aSmrg
581223a0898aSmrg    # We need to accept at least all the BSD install flags.
581323a0898aSmrg    dest=
581423a0898aSmrg    files=
581523a0898aSmrg    opts=
581623a0898aSmrg    prev=
581723a0898aSmrg    install_type=
581823a0898aSmrg    isdir=no
581923a0898aSmrg    stripme=
582023a0898aSmrg    for arg
582123a0898aSmrg    do
582223a0898aSmrg      if test -n "$dest"; then
582323a0898aSmrg	files="$files $dest"
582423a0898aSmrg	dest=$arg
582523a0898aSmrg	continue
582623a0898aSmrg      fi
582723a0898aSmrg
582823a0898aSmrg      case $arg in
582923a0898aSmrg      -d) isdir=yes ;;
583023a0898aSmrg      -f) 
583123a0898aSmrg      	case " $install_prog " in
583223a0898aSmrg	*[\\\ /]cp\ *) ;;
583323a0898aSmrg	*) prev=$arg ;;
583423a0898aSmrg	esac
583523a0898aSmrg	;;
583623a0898aSmrg      -g | -m | -o) prev=$arg ;;
583723a0898aSmrg      -s)
583823a0898aSmrg	stripme=" -s"
583923a0898aSmrg	continue
584023a0898aSmrg	;;
584123a0898aSmrg      -*)
584223a0898aSmrg	;;
584323a0898aSmrg      *)
584423a0898aSmrg	# If the previous option needed an argument, then skip it.
584523a0898aSmrg	if test -n "$prev"; then
584623a0898aSmrg	  prev=
584723a0898aSmrg	else
584823a0898aSmrg	  dest=$arg
584923a0898aSmrg	  continue
585023a0898aSmrg	fi
585123a0898aSmrg	;;
585223a0898aSmrg      esac
585323a0898aSmrg
585423a0898aSmrg      # Aesthetically quote the argument.
585523a0898aSmrg      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
585623a0898aSmrg      case $arg in
585723a0898aSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
585823a0898aSmrg	arg="\"$arg\""
585923a0898aSmrg	;;
586023a0898aSmrg      esac
586123a0898aSmrg      install_prog="$install_prog $arg"
586223a0898aSmrg    done
586323a0898aSmrg
586423a0898aSmrg    if test -z "$install_prog"; then
586523a0898aSmrg      $echo "$modename: you must specify an install program" 1>&2
586623a0898aSmrg      $echo "$help" 1>&2
586723a0898aSmrg      exit $EXIT_FAILURE
586823a0898aSmrg    fi
586923a0898aSmrg
587023a0898aSmrg    if test -n "$prev"; then
587123a0898aSmrg      $echo "$modename: the \`$prev' option requires an argument" 1>&2
587223a0898aSmrg      $echo "$help" 1>&2
587323a0898aSmrg      exit $EXIT_FAILURE
587423a0898aSmrg    fi
587523a0898aSmrg
587623a0898aSmrg    if test -z "$files"; then
587723a0898aSmrg      if test -z "$dest"; then
587823a0898aSmrg	$echo "$modename: no file or destination specified" 1>&2
587923a0898aSmrg      else
588023a0898aSmrg	$echo "$modename: you must specify a destination" 1>&2
588123a0898aSmrg      fi
588223a0898aSmrg      $echo "$help" 1>&2
588323a0898aSmrg      exit $EXIT_FAILURE
588423a0898aSmrg    fi
588523a0898aSmrg
588623a0898aSmrg    # Strip any trailing slash from the destination.
588723a0898aSmrg    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
588823a0898aSmrg
588923a0898aSmrg    # Check to see that the destination is a directory.
589023a0898aSmrg    test -d "$dest" && isdir=yes
589123a0898aSmrg    if test "$isdir" = yes; then
589223a0898aSmrg      destdir="$dest"
589323a0898aSmrg      destname=
589423a0898aSmrg    else
589523a0898aSmrg      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
589623a0898aSmrg      test "X$destdir" = "X$dest" && destdir=.
589723a0898aSmrg      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
589823a0898aSmrg
589923a0898aSmrg      # Not a directory, so check to see that there is only one file specified.
590023a0898aSmrg      set dummy $files
590123a0898aSmrg      if test "$#" -gt 2; then
590223a0898aSmrg	$echo "$modename: \`$dest' is not a directory" 1>&2
590323a0898aSmrg	$echo "$help" 1>&2
590423a0898aSmrg	exit $EXIT_FAILURE
590523a0898aSmrg      fi
590623a0898aSmrg    fi
590723a0898aSmrg    case $destdir in
590823a0898aSmrg    [\\/]* | [A-Za-z]:[\\/]*) ;;
590923a0898aSmrg    *)
591023a0898aSmrg      for file in $files; do
591123a0898aSmrg	case $file in
591223a0898aSmrg	*.lo) ;;
591323a0898aSmrg	*)
591423a0898aSmrg	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
591523a0898aSmrg	  $echo "$help" 1>&2
591623a0898aSmrg	  exit $EXIT_FAILURE
591723a0898aSmrg	  ;;
591823a0898aSmrg	esac
591923a0898aSmrg      done
592023a0898aSmrg      ;;
592123a0898aSmrg    esac
592223a0898aSmrg
592323a0898aSmrg    # This variable tells wrapper scripts just to set variables rather
592423a0898aSmrg    # than running their programs.
592523a0898aSmrg    libtool_install_magic="$magic"
592623a0898aSmrg
592723a0898aSmrg    staticlibs=
592823a0898aSmrg    future_libdirs=
592923a0898aSmrg    current_libdirs=
593023a0898aSmrg    for file in $files; do
593123a0898aSmrg
593223a0898aSmrg      # Do each installation.
593323a0898aSmrg      case $file in
593423a0898aSmrg      *.$libext)
593523a0898aSmrg	# Do the static libraries later.
593623a0898aSmrg	staticlibs="$staticlibs $file"
593723a0898aSmrg	;;
593823a0898aSmrg
593923a0898aSmrg      *.la)
594023a0898aSmrg	# Check to see that this really is a libtool archive.
594123a0898aSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
594223a0898aSmrg	else
594323a0898aSmrg	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
594423a0898aSmrg	  $echo "$help" 1>&2
594523a0898aSmrg	  exit $EXIT_FAILURE
594623a0898aSmrg	fi
594723a0898aSmrg
594823a0898aSmrg	library_names=
594923a0898aSmrg	old_library=
595023a0898aSmrg	relink_command=
595123a0898aSmrg	# If there is no directory component, then add one.
595223a0898aSmrg	case $file in
595323a0898aSmrg	*/* | *\\*) . $file ;;
595423a0898aSmrg	*) . ./$file ;;
595523a0898aSmrg	esac
595623a0898aSmrg
595723a0898aSmrg	# Add the libdir to current_libdirs if it is the destination.
595823a0898aSmrg	if test "X$destdir" = "X$libdir"; then
595923a0898aSmrg	  case "$current_libdirs " in
596023a0898aSmrg	  *" $libdir "*) ;;
596123a0898aSmrg	  *) current_libdirs="$current_libdirs $libdir" ;;
596223a0898aSmrg	  esac
596323a0898aSmrg	else
596423a0898aSmrg	  # Note the libdir as a future libdir.
596523a0898aSmrg	  case "$future_libdirs " in
596623a0898aSmrg	  *" $libdir "*) ;;
596723a0898aSmrg	  *) future_libdirs="$future_libdirs $libdir" ;;
596823a0898aSmrg	  esac
596923a0898aSmrg	fi
597023a0898aSmrg
597123a0898aSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
597223a0898aSmrg	test "X$dir" = "X$file/" && dir=
597323a0898aSmrg	dir="$dir$objdir"
597423a0898aSmrg
597523a0898aSmrg	if test -n "$relink_command"; then
597623a0898aSmrg	  # Determine the prefix the user has applied to our future dir.
597723a0898aSmrg	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
597823a0898aSmrg
597923a0898aSmrg	  # Don't allow the user to place us outside of our expected
598023a0898aSmrg	  # location b/c this prevents finding dependent libraries that
598123a0898aSmrg	  # are installed to the same prefix.
598223a0898aSmrg	  # At present, this check doesn't affect windows .dll's that
598323a0898aSmrg	  # are installed into $libdir/../bin (currently, that works fine)
598423a0898aSmrg	  # but it's something to keep an eye on.
598523a0898aSmrg	  if test "$inst_prefix_dir" = "$destdir"; then
598623a0898aSmrg	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
598723a0898aSmrg	    exit $EXIT_FAILURE
598823a0898aSmrg	  fi
598923a0898aSmrg
599023a0898aSmrg	  if test -n "$inst_prefix_dir"; then
599123a0898aSmrg	    # Stick the inst_prefix_dir data into the link command.
599223a0898aSmrg	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
599323a0898aSmrg	  else
599423a0898aSmrg	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
599523a0898aSmrg	  fi
599623a0898aSmrg
599723a0898aSmrg	  $echo "$modename: warning: relinking \`$file'" 1>&2
599823a0898aSmrg	  $show "$relink_command"
599923a0898aSmrg	  if $run eval "$relink_command"; then :
600023a0898aSmrg	  else
600123a0898aSmrg	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
600223a0898aSmrg	    exit $EXIT_FAILURE
600323a0898aSmrg	  fi
600423a0898aSmrg	fi
600523a0898aSmrg
600623a0898aSmrg	# See the names of the shared library.
600723a0898aSmrg	set dummy $library_names
600823a0898aSmrg	if test -n "$2"; then
600923a0898aSmrg	  realname="$2"
601023a0898aSmrg	  shift
601123a0898aSmrg	  shift
601223a0898aSmrg
601323a0898aSmrg	  srcname="$realname"
601423a0898aSmrg	  test -n "$relink_command" && srcname="$realname"T
601523a0898aSmrg
601623a0898aSmrg	  # Install the shared library and build the symlinks.
601723a0898aSmrg	  $show "$install_prog $dir/$srcname $destdir/$realname"
601823a0898aSmrg	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
601923a0898aSmrg	  if test -n "$stripme" && test -n "$striplib"; then
602023a0898aSmrg	    $show "$striplib $destdir/$realname"
602123a0898aSmrg	    $run eval "$striplib $destdir/$realname" || exit $?
602223a0898aSmrg	  fi
602323a0898aSmrg
602423a0898aSmrg	  if test "$#" -gt 0; then
602523a0898aSmrg	    # Delete the old symlinks, and create new ones.
602623a0898aSmrg	    # Try `ln -sf' first, because the `ln' binary might depend on
602723a0898aSmrg	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
602823a0898aSmrg	    # so we also need to try rm && ln -s.
602923a0898aSmrg	    for linkname
603023a0898aSmrg	    do
603123a0898aSmrg	      if test "$linkname" != "$realname"; then
603223a0898aSmrg                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
603323a0898aSmrg                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
603423a0898aSmrg	      fi
603523a0898aSmrg	    done
603623a0898aSmrg	  fi
603723a0898aSmrg
603823a0898aSmrg	  # Do each command in the postinstall commands.
603923a0898aSmrg	  lib="$destdir/$realname"
604023a0898aSmrg	  cmds=$postinstall_cmds
604123a0898aSmrg	  save_ifs="$IFS"; IFS='~'
604223a0898aSmrg	  for cmd in $cmds; do
604323a0898aSmrg	    IFS="$save_ifs"
604423a0898aSmrg	    eval cmd=\"$cmd\"
604523a0898aSmrg	    $show "$cmd"
604623a0898aSmrg	    $run eval "$cmd" || {
604723a0898aSmrg	      lt_exit=$?
604823a0898aSmrg
604923a0898aSmrg	      # Restore the uninstalled library and exit
605023a0898aSmrg	      if test "$mode" = relink; then
605123a0898aSmrg		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
605223a0898aSmrg	      fi
605323a0898aSmrg
605423a0898aSmrg	      exit $lt_exit
605523a0898aSmrg	    }
605623a0898aSmrg	  done
605723a0898aSmrg	  IFS="$save_ifs"
605823a0898aSmrg	fi
605923a0898aSmrg
606023a0898aSmrg	# Install the pseudo-library for information purposes.
606123a0898aSmrg	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
606223a0898aSmrg	instname="$dir/$name"i
606323a0898aSmrg	$show "$install_prog $instname $destdir/$name"
606423a0898aSmrg	$run eval "$install_prog $instname $destdir/$name" || exit $?
606523a0898aSmrg
606623a0898aSmrg	# Maybe install the static library, too.
606723a0898aSmrg	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
606823a0898aSmrg	;;
606923a0898aSmrg
607023a0898aSmrg      *.lo)
607123a0898aSmrg	# Install (i.e. copy) a libtool object.
607223a0898aSmrg
607323a0898aSmrg	# Figure out destination file name, if it wasn't already specified.
607423a0898aSmrg	if test -n "$destname"; then
607523a0898aSmrg	  destfile="$destdir/$destname"
607623a0898aSmrg	else
607723a0898aSmrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
607823a0898aSmrg	  destfile="$destdir/$destfile"
607923a0898aSmrg	fi
608023a0898aSmrg
608123a0898aSmrg	# Deduce the name of the destination old-style object file.
608223a0898aSmrg	case $destfile in
608323a0898aSmrg	*.lo)
608423a0898aSmrg	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
608523a0898aSmrg	  ;;
608623a0898aSmrg	*.$objext)
608723a0898aSmrg	  staticdest="$destfile"
608823a0898aSmrg	  destfile=
608923a0898aSmrg	  ;;
609023a0898aSmrg	*)
609123a0898aSmrg	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
609223a0898aSmrg	  $echo "$help" 1>&2
609323a0898aSmrg	  exit $EXIT_FAILURE
609423a0898aSmrg	  ;;
609523a0898aSmrg	esac
609623a0898aSmrg
609723a0898aSmrg	# Install the libtool object if requested.
609823a0898aSmrg	if test -n "$destfile"; then
609923a0898aSmrg	  $show "$install_prog $file $destfile"
610023a0898aSmrg	  $run eval "$install_prog $file $destfile" || exit $?
610123a0898aSmrg	fi
610223a0898aSmrg
610323a0898aSmrg	# Install the old object if enabled.
610423a0898aSmrg	if test "$build_old_libs" = yes; then
610523a0898aSmrg	  # Deduce the name of the old-style object file.
610623a0898aSmrg	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
610723a0898aSmrg
610823a0898aSmrg	  $show "$install_prog $staticobj $staticdest"
610923a0898aSmrg	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
611023a0898aSmrg	fi
611123a0898aSmrg	exit $EXIT_SUCCESS
611223a0898aSmrg	;;
611323a0898aSmrg
611423a0898aSmrg      *)
611523a0898aSmrg	# Figure out destination file name, if it wasn't already specified.
611623a0898aSmrg	if test -n "$destname"; then
611723a0898aSmrg	  destfile="$destdir/$destname"
611823a0898aSmrg	else
611923a0898aSmrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
612023a0898aSmrg	  destfile="$destdir/$destfile"
612123a0898aSmrg	fi
612223a0898aSmrg
612323a0898aSmrg	# If the file is missing, and there is a .exe on the end, strip it
612423a0898aSmrg	# because it is most likely a libtool script we actually want to
612523a0898aSmrg	# install
612623a0898aSmrg	stripped_ext=""
612723a0898aSmrg	case $file in
612823a0898aSmrg	  *.exe)
612923a0898aSmrg	    if test ! -f "$file"; then
613023a0898aSmrg	      file=`$echo $file|${SED} 's,.exe$,,'`
613123a0898aSmrg	      stripped_ext=".exe"
613223a0898aSmrg	    fi
613323a0898aSmrg	    ;;
613423a0898aSmrg	esac
613523a0898aSmrg
613623a0898aSmrg	# Do a test to see if this is really a libtool program.
613723a0898aSmrg	case $host in
613823a0898aSmrg	*cygwin*|*mingw*)
613923a0898aSmrg	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
614023a0898aSmrg	    ;;
614123a0898aSmrg	*)
614223a0898aSmrg	    wrapper=$file
614323a0898aSmrg	    ;;
614423a0898aSmrg	esac
614523a0898aSmrg	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
614623a0898aSmrg	  notinst_deplibs=
614723a0898aSmrg	  relink_command=
614823a0898aSmrg
614923a0898aSmrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
615023a0898aSmrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
615123a0898aSmrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
615223a0898aSmrg	  # `FILE.' does not work on cygwin managed mounts.
615323a0898aSmrg	  #
615423a0898aSmrg	  # If there is no directory component, then add one.
615523a0898aSmrg	  case $wrapper in
615623a0898aSmrg	  */* | *\\*) . ${wrapper} ;;
615723a0898aSmrg	  *) . ./${wrapper} ;;
615823a0898aSmrg	  esac
615923a0898aSmrg
616023a0898aSmrg	  # Check the variables that should have been set.
616123a0898aSmrg	  if test -z "$notinst_deplibs"; then
616223a0898aSmrg	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
616323a0898aSmrg	    exit $EXIT_FAILURE
616423a0898aSmrg	  fi
616523a0898aSmrg
616623a0898aSmrg	  finalize=yes
616723a0898aSmrg	  for lib in $notinst_deplibs; do
616823a0898aSmrg	    # Check to see that each library is installed.
616923a0898aSmrg	    libdir=
617023a0898aSmrg	    if test -f "$lib"; then
617123a0898aSmrg	      # If there is no directory component, then add one.
617223a0898aSmrg	      case $lib in
617323a0898aSmrg	      */* | *\\*) . $lib ;;
617423a0898aSmrg	      *) . ./$lib ;;
617523a0898aSmrg	      esac
617623a0898aSmrg	    fi
617723a0898aSmrg	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
617823a0898aSmrg	    if test -n "$libdir" && test ! -f "$libfile"; then
617923a0898aSmrg	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
618023a0898aSmrg	      finalize=no
618123a0898aSmrg	    fi
618223a0898aSmrg	  done
618323a0898aSmrg
618423a0898aSmrg	  relink_command=
618523a0898aSmrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
618623a0898aSmrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
618723a0898aSmrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
618823a0898aSmrg	  # `FILE.' does not work on cygwin managed mounts.
618923a0898aSmrg	  #
619023a0898aSmrg	  # If there is no directory component, then add one.
619123a0898aSmrg	  case $wrapper in
619223a0898aSmrg	  */* | *\\*) . ${wrapper} ;;
619323a0898aSmrg	  *) . ./${wrapper} ;;
619423a0898aSmrg	  esac
619523a0898aSmrg
619623a0898aSmrg	  outputname=
619723a0898aSmrg	  if test "$fast_install" = no && test -n "$relink_command"; then
619823a0898aSmrg	    if test "$finalize" = yes && test -z "$run"; then
619923a0898aSmrg	      tmpdir=`func_mktempdir`
620023a0898aSmrg	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
620123a0898aSmrg	      outputname="$tmpdir/$file"
620223a0898aSmrg	      # Replace the output file specification.
620323a0898aSmrg	      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
620423a0898aSmrg
620523a0898aSmrg	      $show "$relink_command"
620623a0898aSmrg	      if $run eval "$relink_command"; then :
620723a0898aSmrg	      else
620823a0898aSmrg		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
620923a0898aSmrg		${rm}r "$tmpdir"
621023a0898aSmrg		continue
621123a0898aSmrg	      fi
621223a0898aSmrg	      file="$outputname"
621323a0898aSmrg	    else
621423a0898aSmrg	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
621523a0898aSmrg	    fi
621623a0898aSmrg	  else
621723a0898aSmrg	    # Install the binary that we compiled earlier.
621823a0898aSmrg	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
621923a0898aSmrg	  fi
622023a0898aSmrg	fi
622123a0898aSmrg
622223a0898aSmrg	# remove .exe since cygwin /usr/bin/install will append another
622323a0898aSmrg	# one anyway 
622423a0898aSmrg	case $install_prog,$host in
622523a0898aSmrg	*/usr/bin/install*,*cygwin*)
622623a0898aSmrg	  case $file:$destfile in
622723a0898aSmrg	  *.exe:*.exe)
622823a0898aSmrg	    # this is ok
622923a0898aSmrg	    ;;
623023a0898aSmrg	  *.exe:*)
623123a0898aSmrg	    destfile=$destfile.exe
623223a0898aSmrg	    ;;
623323a0898aSmrg	  *:*.exe)
623423a0898aSmrg	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
623523a0898aSmrg	    ;;
623623a0898aSmrg	  esac
623723a0898aSmrg	  ;;
623823a0898aSmrg	esac
623923a0898aSmrg	$show "$install_prog$stripme $file $destfile"
624023a0898aSmrg	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
624123a0898aSmrg	test -n "$outputname" && ${rm}r "$tmpdir"
624223a0898aSmrg	;;
624323a0898aSmrg      esac
624423a0898aSmrg    done
624523a0898aSmrg
624623a0898aSmrg    for file in $staticlibs; do
624723a0898aSmrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
624823a0898aSmrg
624923a0898aSmrg      # Set up the ranlib parameters.
625023a0898aSmrg      oldlib="$destdir/$name"
625123a0898aSmrg
625223a0898aSmrg      $show "$install_prog $file $oldlib"
625323a0898aSmrg      $run eval "$install_prog \$file \$oldlib" || exit $?
625423a0898aSmrg
625523a0898aSmrg      if test -n "$stripme" && test -n "$old_striplib"; then
625623a0898aSmrg	$show "$old_striplib $oldlib"
625723a0898aSmrg	$run eval "$old_striplib $oldlib" || exit $?
625823a0898aSmrg      fi
625923a0898aSmrg
626023a0898aSmrg      # Do each command in the postinstall commands.
626123a0898aSmrg      cmds=$old_postinstall_cmds
626223a0898aSmrg      save_ifs="$IFS"; IFS='~'
626323a0898aSmrg      for cmd in $cmds; do
626423a0898aSmrg	IFS="$save_ifs"
626523a0898aSmrg	eval cmd=\"$cmd\"
626623a0898aSmrg	$show "$cmd"
626723a0898aSmrg	$run eval "$cmd" || exit $?
626823a0898aSmrg      done
626923a0898aSmrg      IFS="$save_ifs"
627023a0898aSmrg    done
627123a0898aSmrg
627223a0898aSmrg    if test -n "$future_libdirs"; then
627323a0898aSmrg      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
627423a0898aSmrg    fi
627523a0898aSmrg
627623a0898aSmrg    if test -n "$current_libdirs"; then
627723a0898aSmrg      # Maybe just do a dry run.
627823a0898aSmrg      test -n "$run" && current_libdirs=" -n$current_libdirs"
627923a0898aSmrg      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
628023a0898aSmrg    else
628123a0898aSmrg      exit $EXIT_SUCCESS
628223a0898aSmrg    fi
628323a0898aSmrg    ;;
628423a0898aSmrg
628523a0898aSmrg  # libtool finish mode
628623a0898aSmrg  finish)
628723a0898aSmrg    modename="$modename: finish"
628823a0898aSmrg    libdirs="$nonopt"
628923a0898aSmrg    admincmds=
629023a0898aSmrg
629123a0898aSmrg    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
629223a0898aSmrg      for dir
629323a0898aSmrg      do
629423a0898aSmrg	libdirs="$libdirs $dir"
629523a0898aSmrg      done
629623a0898aSmrg
629723a0898aSmrg      for libdir in $libdirs; do
629823a0898aSmrg	if test -n "$finish_cmds"; then
629923a0898aSmrg	  # Do each command in the finish commands.
630023a0898aSmrg	  cmds=$finish_cmds
630123a0898aSmrg	  save_ifs="$IFS"; IFS='~'
630223a0898aSmrg	  for cmd in $cmds; do
630323a0898aSmrg	    IFS="$save_ifs"
630423a0898aSmrg	    eval cmd=\"$cmd\"
630523a0898aSmrg	    $show "$cmd"
630623a0898aSmrg	    $run eval "$cmd" || admincmds="$admincmds
630723a0898aSmrg       $cmd"
630823a0898aSmrg	  done
630923a0898aSmrg	  IFS="$save_ifs"
631023a0898aSmrg	fi
631123a0898aSmrg	if test -n "$finish_eval"; then
631223a0898aSmrg	  # Do the single finish_eval.
631323a0898aSmrg	  eval cmds=\"$finish_eval\"
631423a0898aSmrg	  $run eval "$cmds" || admincmds="$admincmds
631523a0898aSmrg       $cmds"
631623a0898aSmrg	fi
631723a0898aSmrg      done
631823a0898aSmrg    fi
631923a0898aSmrg
632023a0898aSmrg    # Exit here if they wanted silent mode.
632123a0898aSmrg    test "$show" = : && exit $EXIT_SUCCESS
632223a0898aSmrg
632323a0898aSmrg    $echo "X----------------------------------------------------------------------" | $Xsed
632423a0898aSmrg    $echo "Libraries have been installed in:"
632523a0898aSmrg    for libdir in $libdirs; do
632623a0898aSmrg      $echo "   $libdir"
632723a0898aSmrg    done
632823a0898aSmrg    $echo
632923a0898aSmrg    $echo "If you ever happen to want to link against installed libraries"
633023a0898aSmrg    $echo "in a given directory, LIBDIR, you must either use libtool, and"
633123a0898aSmrg    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
633223a0898aSmrg    $echo "flag during linking and do at least one of the following:"
633323a0898aSmrg    if test -n "$shlibpath_var"; then
633423a0898aSmrg      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
633523a0898aSmrg      $echo "     during execution"
633623a0898aSmrg    fi
633723a0898aSmrg    if test -n "$runpath_var"; then
633823a0898aSmrg      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
633923a0898aSmrg      $echo "     during linking"
634023a0898aSmrg    fi
634123a0898aSmrg    if test -n "$hardcode_libdir_flag_spec"; then
634223a0898aSmrg      libdir=LIBDIR
634323a0898aSmrg      eval flag=\"$hardcode_libdir_flag_spec\"
634423a0898aSmrg
634523a0898aSmrg      $echo "   - use the \`$flag' linker flag"
634623a0898aSmrg    fi
634723a0898aSmrg    if test -n "$admincmds"; then
634823a0898aSmrg      $echo "   - have your system administrator run these commands:$admincmds"
634923a0898aSmrg    fi
635023a0898aSmrg    if test -f /etc/ld.so.conf; then
635123a0898aSmrg      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
635223a0898aSmrg    fi
635323a0898aSmrg    $echo
635423a0898aSmrg    $echo "See any operating system documentation about shared libraries for"
635523a0898aSmrg    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
635623a0898aSmrg    $echo "X----------------------------------------------------------------------" | $Xsed
635723a0898aSmrg    exit $EXIT_SUCCESS
635823a0898aSmrg    ;;
635923a0898aSmrg
636023a0898aSmrg  # libtool execute mode
636123a0898aSmrg  execute)
636223a0898aSmrg    modename="$modename: execute"
636323a0898aSmrg
636423a0898aSmrg    # The first argument is the command name.
636523a0898aSmrg    cmd="$nonopt"
636623a0898aSmrg    if test -z "$cmd"; then
636723a0898aSmrg      $echo "$modename: you must specify a COMMAND" 1>&2
636823a0898aSmrg      $echo "$help"
636923a0898aSmrg      exit $EXIT_FAILURE
637023a0898aSmrg    fi
637123a0898aSmrg
637223a0898aSmrg    # Handle -dlopen flags immediately.
637323a0898aSmrg    for file in $execute_dlfiles; do
637423a0898aSmrg      if test ! -f "$file"; then
637523a0898aSmrg	$echo "$modename: \`$file' is not a file" 1>&2
637623a0898aSmrg	$echo "$help" 1>&2
637723a0898aSmrg	exit $EXIT_FAILURE
637823a0898aSmrg      fi
637923a0898aSmrg
638023a0898aSmrg      dir=
638123a0898aSmrg      case $file in
638223a0898aSmrg      *.la)
638323a0898aSmrg	# Check to see that this really is a libtool archive.
638423a0898aSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
638523a0898aSmrg	else
638623a0898aSmrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
638723a0898aSmrg	  $echo "$help" 1>&2
638823a0898aSmrg	  exit $EXIT_FAILURE
638923a0898aSmrg	fi
639023a0898aSmrg
639123a0898aSmrg	# Read the libtool library.
639223a0898aSmrg	dlname=
639323a0898aSmrg	library_names=
639423a0898aSmrg
639523a0898aSmrg	# If there is no directory component, then add one.
639623a0898aSmrg	case $file in
639723a0898aSmrg	*/* | *\\*) . $file ;;
639823a0898aSmrg	*) . ./$file ;;
639923a0898aSmrg	esac
640023a0898aSmrg
640123a0898aSmrg	# Skip this library if it cannot be dlopened.
640223a0898aSmrg	if test -z "$dlname"; then
640323a0898aSmrg	  # Warn if it was a shared library.
640423a0898aSmrg	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
640523a0898aSmrg	  continue
640623a0898aSmrg	fi
640723a0898aSmrg
640823a0898aSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
640923a0898aSmrg	test "X$dir" = "X$file" && dir=.
641023a0898aSmrg
641123a0898aSmrg	if test -f "$dir/$objdir/$dlname"; then
641223a0898aSmrg	  dir="$dir/$objdir"
641323a0898aSmrg	else
641423a0898aSmrg	  if test ! -f "$dir/$dlname"; then
641523a0898aSmrg	    $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
641623a0898aSmrg	    exit $EXIT_FAILURE
641723a0898aSmrg	  fi
641823a0898aSmrg	fi
641923a0898aSmrg	;;
642023a0898aSmrg
642123a0898aSmrg      *.lo)
642223a0898aSmrg	# Just add the directory containing the .lo file.
642323a0898aSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
642423a0898aSmrg	test "X$dir" = "X$file" && dir=.
642523a0898aSmrg	;;
642623a0898aSmrg
642723a0898aSmrg      *)
642823a0898aSmrg	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
642923a0898aSmrg	continue
643023a0898aSmrg	;;
643123a0898aSmrg      esac
643223a0898aSmrg
643323a0898aSmrg      # Get the absolute pathname.
643423a0898aSmrg      absdir=`cd "$dir" && pwd`
643523a0898aSmrg      test -n "$absdir" && dir="$absdir"
643623a0898aSmrg
643723a0898aSmrg      # Now add the directory to shlibpath_var.
643823a0898aSmrg      if eval "test -z \"\$$shlibpath_var\""; then
643923a0898aSmrg	eval "$shlibpath_var=\"\$dir\""
644023a0898aSmrg      else
644123a0898aSmrg	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
644223a0898aSmrg      fi
644323a0898aSmrg    done
644423a0898aSmrg
644523a0898aSmrg    # This variable tells wrapper scripts just to set shlibpath_var
644623a0898aSmrg    # rather than running their programs.
644723a0898aSmrg    libtool_execute_magic="$magic"
644823a0898aSmrg
644923a0898aSmrg    # Check if any of the arguments is a wrapper script.
645023a0898aSmrg    args=
645123a0898aSmrg    for file
645223a0898aSmrg    do
645323a0898aSmrg      case $file in
645423a0898aSmrg      -*) ;;
645523a0898aSmrg      *)
645623a0898aSmrg	# Do a test to see if this is really a libtool program.
645723a0898aSmrg	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
645823a0898aSmrg	  # If there is no directory component, then add one.
645923a0898aSmrg	  case $file in
646023a0898aSmrg	  */* | *\\*) . $file ;;
646123a0898aSmrg	  *) . ./$file ;;
646223a0898aSmrg	  esac
646323a0898aSmrg
646423a0898aSmrg	  # Transform arg to wrapped name.
646523a0898aSmrg	  file="$progdir/$program"
646623a0898aSmrg	fi
646723a0898aSmrg	;;
646823a0898aSmrg      esac
646923a0898aSmrg      # Quote arguments (to preserve shell metacharacters).
647023a0898aSmrg      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
647123a0898aSmrg      args="$args \"$file\""
647223a0898aSmrg    done
647323a0898aSmrg
647423a0898aSmrg    if test -z "$run"; then
647523a0898aSmrg      if test -n "$shlibpath_var"; then
647623a0898aSmrg	# Export the shlibpath_var.
647723a0898aSmrg	eval "export $shlibpath_var"
647823a0898aSmrg      fi
647923a0898aSmrg
648023a0898aSmrg      # Restore saved environment variables
648123a0898aSmrg      for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
648223a0898aSmrg      do
648323a0898aSmrg	eval "if test \"\${save_$lt_var+set}\" = set; then
648423a0898aSmrg		$lt_var=\$save_$lt_var; export $lt_var
648523a0898aSmrg	      fi"
648623a0898aSmrg      done
648723a0898aSmrg
648823a0898aSmrg      # Now prepare to actually exec the command.
648923a0898aSmrg      exec_cmd="\$cmd$args"
649023a0898aSmrg    else
649123a0898aSmrg      # Display what would be done.
649223a0898aSmrg      if test -n "$shlibpath_var"; then
649323a0898aSmrg	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
649423a0898aSmrg	$echo "export $shlibpath_var"
649523a0898aSmrg      fi
649623a0898aSmrg      $echo "$cmd$args"
649723a0898aSmrg      exit $EXIT_SUCCESS
649823a0898aSmrg    fi
649923a0898aSmrg    ;;
650023a0898aSmrg
650123a0898aSmrg  # libtool clean and uninstall mode
650223a0898aSmrg  clean | uninstall)
650323a0898aSmrg    modename="$modename: $mode"
650423a0898aSmrg    rm="$nonopt"
650523a0898aSmrg    files=
650623a0898aSmrg    rmforce=
650723a0898aSmrg    exit_status=0
650823a0898aSmrg
650923a0898aSmrg    # This variable tells wrapper scripts just to set variables rather
651023a0898aSmrg    # than running their programs.
651123a0898aSmrg    libtool_install_magic="$magic"
651223a0898aSmrg
651323a0898aSmrg    for arg
651423a0898aSmrg    do
651523a0898aSmrg      case $arg in
651623a0898aSmrg      -f) rm="$rm $arg"; rmforce=yes ;;
651723a0898aSmrg      -*) rm="$rm $arg" ;;
651823a0898aSmrg      *) files="$files $arg" ;;
651923a0898aSmrg      esac
652023a0898aSmrg    done
652123a0898aSmrg
652223a0898aSmrg    if test -z "$rm"; then
652323a0898aSmrg      $echo "$modename: you must specify an RM program" 1>&2
652423a0898aSmrg      $echo "$help" 1>&2
652523a0898aSmrg      exit $EXIT_FAILURE
652623a0898aSmrg    fi
652723a0898aSmrg
652823a0898aSmrg    rmdirs=
652923a0898aSmrg
653023a0898aSmrg    origobjdir="$objdir"
653123a0898aSmrg    for file in $files; do
653223a0898aSmrg      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
653323a0898aSmrg      if test "X$dir" = "X$file"; then
653423a0898aSmrg	dir=.
653523a0898aSmrg	objdir="$origobjdir"
653623a0898aSmrg      else
653723a0898aSmrg	objdir="$dir/$origobjdir"
653823a0898aSmrg      fi
653923a0898aSmrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
654023a0898aSmrg      test "$mode" = uninstall && objdir="$dir"
654123a0898aSmrg
654223a0898aSmrg      # Remember objdir for removal later, being careful to avoid duplicates
654323a0898aSmrg      if test "$mode" = clean; then
654423a0898aSmrg	case " $rmdirs " in
654523a0898aSmrg	  *" $objdir "*) ;;
654623a0898aSmrg	  *) rmdirs="$rmdirs $objdir" ;;
654723a0898aSmrg	esac
654823a0898aSmrg      fi
654923a0898aSmrg
655023a0898aSmrg      # Don't error if the file doesn't exist and rm -f was used.
655123a0898aSmrg      if (test -L "$file") >/dev/null 2>&1 \
655223a0898aSmrg	|| (test -h "$file") >/dev/null 2>&1 \
655323a0898aSmrg	|| test -f "$file"; then
655423a0898aSmrg	:
655523a0898aSmrg      elif test -d "$file"; then
655623a0898aSmrg	exit_status=1
655723a0898aSmrg	continue
655823a0898aSmrg      elif test "$rmforce" = yes; then
655923a0898aSmrg	continue
656023a0898aSmrg      fi
656123a0898aSmrg
656223a0898aSmrg      rmfiles="$file"
656323a0898aSmrg
656423a0898aSmrg      case $name in
656523a0898aSmrg      *.la)
656623a0898aSmrg	# Possibly a libtool archive, so verify it.
656723a0898aSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
656823a0898aSmrg	  . $dir/$name
656923a0898aSmrg
657023a0898aSmrg	  # Delete the libtool libraries and symlinks.
657123a0898aSmrg	  for n in $library_names; do
657223a0898aSmrg	    rmfiles="$rmfiles $objdir/$n"
657323a0898aSmrg	  done
657423a0898aSmrg	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
657523a0898aSmrg
657623a0898aSmrg	  case "$mode" in
657723a0898aSmrg	  clean)
657823a0898aSmrg	    case "  $library_names " in
657923a0898aSmrg	    # "  " in the beginning catches empty $dlname
658023a0898aSmrg	    *" $dlname "*) ;;
658123a0898aSmrg	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
658223a0898aSmrg	    esac
658323a0898aSmrg	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
658423a0898aSmrg	    ;;
658523a0898aSmrg	  uninstall)
658623a0898aSmrg	    if test -n "$library_names"; then
658723a0898aSmrg	      # Do each command in the postuninstall commands.
658823a0898aSmrg	      cmds=$postuninstall_cmds
658923a0898aSmrg	      save_ifs="$IFS"; IFS='~'
659023a0898aSmrg	      for cmd in $cmds; do
659123a0898aSmrg		IFS="$save_ifs"
659223a0898aSmrg		eval cmd=\"$cmd\"
659323a0898aSmrg		$show "$cmd"
659423a0898aSmrg		$run eval "$cmd"
659523a0898aSmrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
659623a0898aSmrg		  exit_status=1
659723a0898aSmrg		fi
659823a0898aSmrg	      done
659923a0898aSmrg	      IFS="$save_ifs"
660023a0898aSmrg	    fi
660123a0898aSmrg
660223a0898aSmrg	    if test -n "$old_library"; then
660323a0898aSmrg	      # Do each command in the old_postuninstall commands.
660423a0898aSmrg	      cmds=$old_postuninstall_cmds
660523a0898aSmrg	      save_ifs="$IFS"; IFS='~'
660623a0898aSmrg	      for cmd in $cmds; do
660723a0898aSmrg		IFS="$save_ifs"
660823a0898aSmrg		eval cmd=\"$cmd\"
660923a0898aSmrg		$show "$cmd"
661023a0898aSmrg		$run eval "$cmd"
661123a0898aSmrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
661223a0898aSmrg		  exit_status=1
661323a0898aSmrg		fi
661423a0898aSmrg	      done
661523a0898aSmrg	      IFS="$save_ifs"
661623a0898aSmrg	    fi
661723a0898aSmrg	    # FIXME: should reinstall the best remaining shared library.
661823a0898aSmrg	    ;;
661923a0898aSmrg	  esac
662023a0898aSmrg	fi
662123a0898aSmrg	;;
662223a0898aSmrg
662323a0898aSmrg      *.lo)
662423a0898aSmrg	# Possibly a libtool object, so verify it.
662523a0898aSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
662623a0898aSmrg
662723a0898aSmrg	  # Read the .lo file
662823a0898aSmrg	  . $dir/$name
662923a0898aSmrg
663023a0898aSmrg	  # Add PIC object to the list of files to remove.
663123a0898aSmrg	  if test -n "$pic_object" \
663223a0898aSmrg	     && test "$pic_object" != none; then
663323a0898aSmrg	    rmfiles="$rmfiles $dir/$pic_object"
663423a0898aSmrg	  fi
663523a0898aSmrg
663623a0898aSmrg	  # Add non-PIC object to the list of files to remove.
663723a0898aSmrg	  if test -n "$non_pic_object" \
663823a0898aSmrg	     && test "$non_pic_object" != none; then
663923a0898aSmrg	    rmfiles="$rmfiles $dir/$non_pic_object"
664023a0898aSmrg	  fi
664123a0898aSmrg	fi
664223a0898aSmrg	;;
664323a0898aSmrg
664423a0898aSmrg      *)
664523a0898aSmrg	if test "$mode" = clean ; then
664623a0898aSmrg	  noexename=$name
664723a0898aSmrg	  case $file in
664823a0898aSmrg	  *.exe)
664923a0898aSmrg	    file=`$echo $file|${SED} 's,.exe$,,'`
665023a0898aSmrg	    noexename=`$echo $name|${SED} 's,.exe$,,'`
665123a0898aSmrg	    # $file with .exe has already been added to rmfiles,
665223a0898aSmrg	    # add $file without .exe
665323a0898aSmrg	    rmfiles="$rmfiles $file"
665423a0898aSmrg	    ;;
665523a0898aSmrg	  esac
665623a0898aSmrg	  # Do a test to see if this is a libtool program.
665723a0898aSmrg	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
665823a0898aSmrg	    relink_command=
665923a0898aSmrg	    . $dir/$noexename
666023a0898aSmrg
666123a0898aSmrg	    # note $name still contains .exe if it was in $file originally
666223a0898aSmrg	    # as does the version of $file that was added into $rmfiles
666323a0898aSmrg	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
666423a0898aSmrg	    if test "$fast_install" = yes && test -n "$relink_command"; then
666523a0898aSmrg	      rmfiles="$rmfiles $objdir/lt-$name"
666623a0898aSmrg	    fi
666723a0898aSmrg	    if test "X$noexename" != "X$name" ; then
666823a0898aSmrg	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
666923a0898aSmrg	    fi
667023a0898aSmrg	  fi
667123a0898aSmrg	fi
667223a0898aSmrg	;;
667323a0898aSmrg      esac
667423a0898aSmrg      $show "$rm $rmfiles"
667523a0898aSmrg      $run $rm $rmfiles || exit_status=1
667623a0898aSmrg    done
667723a0898aSmrg    objdir="$origobjdir"
667823a0898aSmrg
667923a0898aSmrg    # Try to remove the ${objdir}s in the directories where we deleted files
668023a0898aSmrg    for dir in $rmdirs; do
668123a0898aSmrg      if test -d "$dir"; then
668223a0898aSmrg	$show "rmdir $dir"
668323a0898aSmrg	$run rmdir $dir >/dev/null 2>&1
668423a0898aSmrg      fi
668523a0898aSmrg    done
668623a0898aSmrg
668723a0898aSmrg    exit $exit_status
668823a0898aSmrg    ;;
668923a0898aSmrg
669023a0898aSmrg  "")
669123a0898aSmrg    $echo "$modename: you must specify a MODE" 1>&2
669223a0898aSmrg    $echo "$generic_help" 1>&2
669323a0898aSmrg    exit $EXIT_FAILURE
669423a0898aSmrg    ;;
669523a0898aSmrg  esac
669623a0898aSmrg
669723a0898aSmrg  if test -z "$exec_cmd"; then
669823a0898aSmrg    $echo "$modename: invalid operation mode \`$mode'" 1>&2
669923a0898aSmrg    $echo "$generic_help" 1>&2
670023a0898aSmrg    exit $EXIT_FAILURE
670123a0898aSmrg  fi
670223a0898aSmrgfi # test -z "$show_help"
670323a0898aSmrg
670423a0898aSmrgif test -n "$exec_cmd"; then
670523a0898aSmrg  eval exec $exec_cmd
670623a0898aSmrg  exit $EXIT_FAILURE
670723a0898aSmrgfi
670823a0898aSmrg
670923a0898aSmrg# We need to display help for each of the modes.
671023a0898aSmrgcase $mode in
671123a0898aSmrg"") $echo \
671223a0898aSmrg"Usage: $modename [OPTION]... [MODE-ARG]...
671323a0898aSmrg
671423a0898aSmrgProvide generalized library-building support services.
671523a0898aSmrg
671623a0898aSmrg    --config          show all configuration variables
671723a0898aSmrg    --debug           enable verbose shell tracing
671823a0898aSmrg-n, --dry-run         display commands without modifying any files
671923a0898aSmrg    --features        display basic configuration information and exit
672023a0898aSmrg    --finish          same as \`--mode=finish'
672123a0898aSmrg    --help            display this help message and exit
672223a0898aSmrg    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
672323a0898aSmrg    --quiet           same as \`--silent'
672423a0898aSmrg    --silent          don't print informational messages
672523a0898aSmrg    --tag=TAG         use configuration variables from tag TAG
672623a0898aSmrg    --version         print version information
672723a0898aSmrg
672823a0898aSmrgMODE must be one of the following:
672923a0898aSmrg
673023a0898aSmrg      clean           remove files from the build directory
673123a0898aSmrg      compile         compile a source file into a libtool object
673223a0898aSmrg      execute         automatically set library path, then run a program
673323a0898aSmrg      finish          complete the installation of libtool libraries
673423a0898aSmrg      install         install libraries or executables
673523a0898aSmrg      link            create a library or an executable
673623a0898aSmrg      uninstall       remove libraries from an installed directory
673723a0898aSmrg
673823a0898aSmrgMODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
673923a0898aSmrga more detailed description of MODE.
674023a0898aSmrg
674123a0898aSmrgReport bugs to <bug-libtool@gnu.org>."
674223a0898aSmrg  exit $EXIT_SUCCESS
674323a0898aSmrg  ;;
674423a0898aSmrg
674523a0898aSmrgclean)
674623a0898aSmrg  $echo \
674723a0898aSmrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
674823a0898aSmrg
674923a0898aSmrgRemove files from the build directory.
675023a0898aSmrg
675123a0898aSmrgRM is the name of the program to use to delete files associated with each FILE
675223a0898aSmrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
675323a0898aSmrgto RM.
675423a0898aSmrg
675523a0898aSmrgIf FILE is a libtool library, object or program, all the files associated
675623a0898aSmrgwith it are deleted. Otherwise, only FILE itself is deleted using RM."
675723a0898aSmrg  ;;
675823a0898aSmrg
675923a0898aSmrgcompile)
676023a0898aSmrg  $echo \
676123a0898aSmrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
676223a0898aSmrg
676323a0898aSmrgCompile a source file into a libtool library object.
676423a0898aSmrg
676523a0898aSmrgThis mode accepts the following additional options:
676623a0898aSmrg
676723a0898aSmrg  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
676823a0898aSmrg  -prefer-pic       try to building PIC objects only
676923a0898aSmrg  -prefer-non-pic   try to building non-PIC objects only
677023a0898aSmrg  -static           always build a \`.o' file suitable for static linking
677123a0898aSmrg
677223a0898aSmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file
677323a0898aSmrgfrom the given SOURCEFILE.
677423a0898aSmrg
677523a0898aSmrgThe output file name is determined by removing the directory component from
677623a0898aSmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the
677723a0898aSmrglibrary object suffix, \`.lo'."
677823a0898aSmrg  ;;
677923a0898aSmrg
678023a0898aSmrgexecute)
678123a0898aSmrg  $echo \
678223a0898aSmrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
678323a0898aSmrg
678423a0898aSmrgAutomatically set library path, then run a program.
678523a0898aSmrg
678623a0898aSmrgThis mode accepts the following additional options:
678723a0898aSmrg
678823a0898aSmrg  -dlopen FILE      add the directory containing FILE to the library path
678923a0898aSmrg
679023a0898aSmrgThis mode sets the library path environment variable according to \`-dlopen'
679123a0898aSmrgflags.
679223a0898aSmrg
679323a0898aSmrgIf any of the ARGS are libtool executable wrappers, then they are translated
679423a0898aSmrginto their corresponding uninstalled binary, and any of their required library
679523a0898aSmrgdirectories are added to the library path.
679623a0898aSmrg
679723a0898aSmrgThen, COMMAND is executed, with ARGS as arguments."
679823a0898aSmrg  ;;
679923a0898aSmrg
680023a0898aSmrgfinish)
680123a0898aSmrg  $echo \
680223a0898aSmrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
680323a0898aSmrg
680423a0898aSmrgComplete the installation of libtool libraries.
680523a0898aSmrg
680623a0898aSmrgEach LIBDIR is a directory that contains libtool libraries.
680723a0898aSmrg
680823a0898aSmrgThe commands that this mode executes may require superuser privileges.  Use
680923a0898aSmrgthe \`--dry-run' option if you just want to see what would be executed."
681023a0898aSmrg  ;;
681123a0898aSmrg
681223a0898aSmrginstall)
681323a0898aSmrg  $echo \
681423a0898aSmrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
681523a0898aSmrg
681623a0898aSmrgInstall executables or libraries.
681723a0898aSmrg
681823a0898aSmrgINSTALL-COMMAND is the installation command.  The first component should be
681923a0898aSmrgeither the \`install' or \`cp' program.
682023a0898aSmrg
682123a0898aSmrgThe rest of the components are interpreted as arguments to that command (only
682223a0898aSmrgBSD-compatible install options are recognized)."
682323a0898aSmrg  ;;
682423a0898aSmrg
682523a0898aSmrglink)
682623a0898aSmrg  $echo \
682723a0898aSmrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
682823a0898aSmrg
682923a0898aSmrgLink object files or libraries together to form another library, or to
683023a0898aSmrgcreate an executable program.
683123a0898aSmrg
683223a0898aSmrgLINK-COMMAND is a command using the C compiler that you would use to create
683323a0898aSmrga program from several object files.
683423a0898aSmrg
683523a0898aSmrgThe following components of LINK-COMMAND are treated specially:
683623a0898aSmrg
683723a0898aSmrg  -all-static       do not do any dynamic linking at all
683823a0898aSmrg  -avoid-version    do not add a version suffix if possible
683923a0898aSmrg  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
684023a0898aSmrg  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
684123a0898aSmrg  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
684223a0898aSmrg  -export-symbols SYMFILE
684323a0898aSmrg                    try to export only the symbols listed in SYMFILE
684423a0898aSmrg  -export-symbols-regex REGEX
684523a0898aSmrg                    try to export only the symbols matching REGEX
684623a0898aSmrg  -LLIBDIR          search LIBDIR for required installed libraries
684723a0898aSmrg  -lNAME            OUTPUT-FILE requires the installed library libNAME
684823a0898aSmrg  -module           build a library that can dlopened
684923a0898aSmrg  -no-fast-install  disable the fast-install mode
685023a0898aSmrg  -no-install       link a not-installable executable
685123a0898aSmrg  -no-undefined     declare that a library does not refer to external symbols
685223a0898aSmrg  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
685323a0898aSmrg  -objectlist FILE  Use a list of object files found in FILE to specify objects
685423a0898aSmrg  -precious-files-regex REGEX
685523a0898aSmrg                    don't remove output files matching REGEX
685623a0898aSmrg  -release RELEASE  specify package release information
685723a0898aSmrg  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
685823a0898aSmrg  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
685923a0898aSmrg  -static           do not do any dynamic linking of uninstalled libtool libraries
686023a0898aSmrg  -static-libtool-libs
686123a0898aSmrg                    do not do any dynamic linking of libtool libraries
686223a0898aSmrg  -version-info CURRENT[:REVISION[:AGE]]
686323a0898aSmrg                    specify library version info [each variable defaults to 0]
686423a0898aSmrg
686523a0898aSmrgAll other options (arguments beginning with \`-') are ignored.
686623a0898aSmrg
686723a0898aSmrgEvery other argument is treated as a filename.  Files ending in \`.la' are
686823a0898aSmrgtreated as uninstalled libtool libraries, other files are standard or library
686923a0898aSmrgobject files.
687023a0898aSmrg
687123a0898aSmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created,
687223a0898aSmrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is
687323a0898aSmrgrequired, except when creating a convenience library.
687423a0898aSmrg
687523a0898aSmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
687623a0898aSmrgusing \`ar' and \`ranlib', or on Windows using \`lib'.
687723a0898aSmrg
687823a0898aSmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
687923a0898aSmrgis created, otherwise an executable program is created."
688023a0898aSmrg  ;;
688123a0898aSmrg
688223a0898aSmrguninstall)
688323a0898aSmrg  $echo \
688423a0898aSmrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
688523a0898aSmrg
688623a0898aSmrgRemove libraries from an installation directory.
688723a0898aSmrg
688823a0898aSmrgRM is the name of the program to use to delete files associated with each FILE
688923a0898aSmrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
689023a0898aSmrgto RM.
689123a0898aSmrg
689223a0898aSmrgIf FILE is a libtool library, all the files associated with it are deleted.
689323a0898aSmrgOtherwise, only FILE itself is deleted using RM."
689423a0898aSmrg  ;;
689523a0898aSmrg
689623a0898aSmrg*)
689723a0898aSmrg  $echo "$modename: invalid operation mode \`$mode'" 1>&2
689823a0898aSmrg  $echo "$help" 1>&2
689923a0898aSmrg  exit $EXIT_FAILURE
690023a0898aSmrg  ;;
690123a0898aSmrgesac
690223a0898aSmrg
690323a0898aSmrg$echo
690423a0898aSmrg$echo "Try \`$modename --help' for more information about other modes."
690523a0898aSmrg
690623a0898aSmrgexit $?
690723a0898aSmrg
690823a0898aSmrg# The TAGs below are defined such that we never get into a situation
690923a0898aSmrg# in which we disable both kinds of libraries.  Given conflicting
691023a0898aSmrg# choices, we go for a static library, that is the most portable,
691123a0898aSmrg# since we can't tell whether shared libraries were disabled because
691223a0898aSmrg# the user asked for that or because the platform doesn't support
691323a0898aSmrg# them.  This is particularly important on AIX, because we don't
691423a0898aSmrg# support having both static and shared libraries enabled at the same
691523a0898aSmrg# time on that platform, so we default to a shared-only configuration.
691623a0898aSmrg# If a disable-shared tag is given, we'll fallback to a static-only
691723a0898aSmrg# configuration.  But we'll never go from static-only to shared-only.
691823a0898aSmrg
691923a0898aSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
692023a0898aSmrgdisable_libs=shared
692123a0898aSmrg# ### END LIBTOOL TAG CONFIG: disable-shared
692223a0898aSmrg
692323a0898aSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static
692423a0898aSmrgdisable_libs=static
692523a0898aSmrg# ### END LIBTOOL TAG CONFIG: disable-static
692623a0898aSmrg
692723a0898aSmrg# Local Variables:
692823a0898aSmrg# mode:shell-script
692923a0898aSmrg# sh-indentation:2
693023a0898aSmrg# End:
6931