152f9793fSmrg# ltmain.sh - Provide generalized library-building support services.
252f9793fSmrg# NOTE: Changing this file will not affect anything until you rerun configure.
352f9793fSmrg#
42faa96e0Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
52faa96e0Smrg# 2007, 2008  Free Software Foundation, Inc.
652f9793fSmrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
752f9793fSmrg#
852f9793fSmrg# This program is free software; you can redistribute it and/or modify
952f9793fSmrg# it under the terms of the GNU General Public License as published by
1052f9793fSmrg# the Free Software Foundation; either version 2 of the License, or
1152f9793fSmrg# (at your option) any later version.
1252f9793fSmrg#
1352f9793fSmrg# This program is distributed in the hope that it will be useful, but
1452f9793fSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1552f9793fSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1652f9793fSmrg# General Public License for more details.
1752f9793fSmrg#
1852f9793fSmrg# You should have received a copy of the GNU General Public License
1952f9793fSmrg# along with this program; if not, write to the Free Software
2052f9793fSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2152f9793fSmrg#
2252f9793fSmrg# As a special exception to the GNU General Public License, if you
2352f9793fSmrg# distribute this file as part of a program that contains a
2452f9793fSmrg# configuration script generated by Autoconf, you may include it under
2552f9793fSmrg# the same distribution terms that you use for the rest of that program.
2652f9793fSmrg
2752f9793fSmrgbasename="s,^.*/,,g"
2852f9793fSmrg
2952f9793fSmrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
3052f9793fSmrg# is ksh but when the shell is invoked as "sh" and the current value of
3152f9793fSmrg# the _XPG environment variable is not equal to 1 (one), the special
3252f9793fSmrg# positional parameter $0, within a function call, is the name of the
3352f9793fSmrg# function.
3452f9793fSmrgprogpath="$0"
3552f9793fSmrg
3652f9793fSmrg# The name of this program:
3752f9793fSmrgprogname=`echo "$progpath" | $SED $basename`
3852f9793fSmrgmodename="$progname"
3952f9793fSmrg
4052f9793fSmrg# Global variables:
4152f9793fSmrgEXIT_SUCCESS=0
4252f9793fSmrgEXIT_FAILURE=1
4352f9793fSmrg
4452f9793fSmrgPROGRAM=ltmain.sh
4552f9793fSmrgPACKAGE=libtool
462faa96e0SmrgVERSION=1.5.26
472faa96e0SmrgTIMESTAMP=" (1.1220.2.492 2008/01/30 06:40:56)"
482faa96e0Smrg
492faa96e0Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
502faa96e0Smrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
512faa96e0Smrg  emulate sh
522faa96e0Smrg  NULLCMD=:
532faa96e0Smrg  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
542faa96e0Smrg  # is contrary to our usage.  Disable this feature.
552faa96e0Smrg  alias -g '${1+"$@"}'='"$@"'
5652f9793fSmrg  setopt NO_GLOB_SUBST
572faa96e0Smrgelse
582faa96e0Smrg  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
5952f9793fSmrgfi
602faa96e0SmrgBIN_SH=xpg4; export BIN_SH # for Tru64
612faa96e0SmrgDUALCASE=1; export DUALCASE # for MKS sh
6252f9793fSmrg
6352f9793fSmrg# Check that we have a working $echo.
6452f9793fSmrgif test "X$1" = X--no-reexec; then
6552f9793fSmrg  # Discard the --no-reexec flag, and continue.
6652f9793fSmrg  shift
6752f9793fSmrgelif test "X$1" = X--fallback-echo; then
6852f9793fSmrg  # Avoid inline document here, it may be left over
6952f9793fSmrg  :
7052f9793fSmrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
7152f9793fSmrg  # Yippee, $echo works!
7252f9793fSmrg  :
7352f9793fSmrgelse
7452f9793fSmrg  # Restart under the correct shell, and then maybe $echo will work.
7552f9793fSmrg  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
7652f9793fSmrgfi
7752f9793fSmrg
7852f9793fSmrgif test "X$1" = X--fallback-echo; then
7952f9793fSmrg  # used as fallback echo
8052f9793fSmrg  shift
8152f9793fSmrg  cat <<EOF
8252f9793fSmrg$*
8352f9793fSmrgEOF
8452f9793fSmrg  exit $EXIT_SUCCESS
8552f9793fSmrgfi
8652f9793fSmrg
8752f9793fSmrgdefault_mode=
8852f9793fSmrghelp="Try \`$progname --help' for more information."
8952f9793fSmrgmagic="%%%MAGIC variable%%%"
9052f9793fSmrgmkdir="mkdir"
9152f9793fSmrgmv="mv -f"
9252f9793fSmrgrm="rm -f"
9352f9793fSmrg
9452f9793fSmrg# Sed substitution that helps us do robust quoting.  It backslashifies
9552f9793fSmrg# metacharacters that are still active within double-quoted strings.
9652f9793fSmrgXsed="${SED}"' -e 1s/^X//'
9752f9793fSmrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
9852f9793fSmrg# test EBCDIC or ASCII
9952f9793fSmrgcase `echo X|tr X '\101'` in
10052f9793fSmrg A) # ASCII based system
10152f9793fSmrg    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
10252f9793fSmrg  SP2NL='tr \040 \012'
10352f9793fSmrg  NL2SP='tr \015\012 \040\040'
10452f9793fSmrg  ;;
10552f9793fSmrg *) # EBCDIC based system
10652f9793fSmrg  SP2NL='tr \100 \n'
10752f9793fSmrg  NL2SP='tr \r\n \100\100'
10852f9793fSmrg  ;;
10952f9793fSmrgesac
11052f9793fSmrg
11152f9793fSmrg# NLS nuisances.
11252f9793fSmrg# Only set LANG and LC_ALL to C if already set.
11352f9793fSmrg# These must not be set unconditionally because not all systems understand
11452f9793fSmrg# e.g. LANG=C (notably SCO).
11552f9793fSmrg# We save the old values to restore during execute mode.
1162faa96e0Smrglt_env=
1172faa96e0Smrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1182faa96e0Smrgdo
1192faa96e0Smrg  eval "if test \"\${$lt_var+set}\" = set; then
1202faa96e0Smrg	  save_$lt_var=\$$lt_var
1212faa96e0Smrg	  lt_env=\"$lt_var=\$$lt_var \$lt_env\"
1222faa96e0Smrg	  $lt_var=C
1232faa96e0Smrg	  export $lt_var
1242faa96e0Smrg	fi"
1252faa96e0Smrgdone
1262faa96e0Smrg
1272faa96e0Smrgif test -n "$lt_env"; then
1282faa96e0Smrg  lt_env="env $lt_env"
12952f9793fSmrgfi
13052f9793fSmrg
13152f9793fSmrg# Make sure IFS has a sensible default
13252f9793fSmrglt_nl='
13352f9793fSmrg'
13452f9793fSmrgIFS=" 	$lt_nl"
13552f9793fSmrg
13652f9793fSmrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
13752f9793fSmrg  $echo "$modename: not configured to build any kind of library" 1>&2
13852f9793fSmrg  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
13952f9793fSmrg  exit $EXIT_FAILURE
14052f9793fSmrgfi
14152f9793fSmrg
14252f9793fSmrg# Global variables.
14352f9793fSmrgmode=$default_mode
14452f9793fSmrgnonopt=
14552f9793fSmrgprev=
14652f9793fSmrgprevopt=
14752f9793fSmrgrun=
14852f9793fSmrgshow="$echo"
14952f9793fSmrgshow_help=
15052f9793fSmrgexecute_dlfiles=
15152f9793fSmrgduplicate_deps=no
15252f9793fSmrgpreserve_args=
15352f9793fSmrglo2o="s/\\.lo\$/.${objext}/"
15452f9793fSmrgo2lo="s/\\.${objext}\$/.lo/"
1552faa96e0Smrgextracted_archives=
1562faa96e0Smrgextracted_serial=0
15752f9793fSmrg
15852f9793fSmrg#####################################
15952f9793fSmrg# Shell function definitions:
16052f9793fSmrg# This seems to be the best place for them
16152f9793fSmrg
16252f9793fSmrg# func_mktempdir [string]
16352f9793fSmrg# Make a temporary directory that won't clash with other running
16452f9793fSmrg# libtool processes, and avoids race conditions if possible.  If
16552f9793fSmrg# given, STRING is the basename for that directory.
16652f9793fSmrgfunc_mktempdir ()
16752f9793fSmrg{
16852f9793fSmrg    my_template="${TMPDIR-/tmp}/${1-$progname}"
16952f9793fSmrg
17052f9793fSmrg    if test "$run" = ":"; then
17152f9793fSmrg      # Return a directory name, but don't create it in dry-run mode
17252f9793fSmrg      my_tmpdir="${my_template}-$$"
17352f9793fSmrg    else
17452f9793fSmrg
17552f9793fSmrg      # If mktemp works, use that first and foremost
17652f9793fSmrg      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
17752f9793fSmrg
17852f9793fSmrg      if test ! -d "$my_tmpdir"; then
17952f9793fSmrg	# Failing that, at least try and use $RANDOM to avoid a race
18052f9793fSmrg	my_tmpdir="${my_template}-${RANDOM-0}$$"
18152f9793fSmrg
18252f9793fSmrg	save_mktempdir_umask=`umask`
18352f9793fSmrg	umask 0077
18452f9793fSmrg	$mkdir "$my_tmpdir"
18552f9793fSmrg	umask $save_mktempdir_umask
18652f9793fSmrg      fi
18752f9793fSmrg
18852f9793fSmrg      # If we're not in dry-run mode, bomb out on failure
18952f9793fSmrg      test -d "$my_tmpdir" || {
19052f9793fSmrg        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
19152f9793fSmrg	exit $EXIT_FAILURE
19252f9793fSmrg      }
19352f9793fSmrg    fi
19452f9793fSmrg
19552f9793fSmrg    $echo "X$my_tmpdir" | $Xsed
19652f9793fSmrg}
19752f9793fSmrg
19852f9793fSmrg
19952f9793fSmrg# func_win32_libid arg
20052f9793fSmrg# return the library type of file 'arg'
20152f9793fSmrg#
20252f9793fSmrg# Need a lot of goo to handle *both* DLLs and import libs
20352f9793fSmrg# Has to be a shell function in order to 'eat' the argument
20452f9793fSmrg# that is supplied when $file_magic_command is called.
20552f9793fSmrgfunc_win32_libid ()
20652f9793fSmrg{
20752f9793fSmrg  win32_libid_type="unknown"
20852f9793fSmrg  win32_fileres=`file -L $1 2>/dev/null`
20952f9793fSmrg  case $win32_fileres in
21052f9793fSmrg  *ar\ archive\ import\ library*) # definitely import
21152f9793fSmrg    win32_libid_type="x86 archive import"
21252f9793fSmrg    ;;
21352f9793fSmrg  *ar\ archive*) # could be an import, or static
21452f9793fSmrg    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
21552f9793fSmrg      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
21652f9793fSmrg      win32_nmres=`eval $NM -f posix -A $1 | \
2172faa96e0Smrg	$SED -n -e '1,100{
2182faa96e0Smrg		/ I /{
2192faa96e0Smrg			s,.*,import,
2202faa96e0Smrg			p
2212faa96e0Smrg			q
2222faa96e0Smrg			}
2232faa96e0Smrg		}'`
22452f9793fSmrg      case $win32_nmres in
22552f9793fSmrg      import*)  win32_libid_type="x86 archive import";;
22652f9793fSmrg      *)        win32_libid_type="x86 archive static";;
22752f9793fSmrg      esac
22852f9793fSmrg    fi
22952f9793fSmrg    ;;
23052f9793fSmrg  *DLL*)
23152f9793fSmrg    win32_libid_type="x86 DLL"
23252f9793fSmrg    ;;
23352f9793fSmrg  *executable*) # but shell scripts are "executable" too...
23452f9793fSmrg    case $win32_fileres in
23552f9793fSmrg    *MS\ Windows\ PE\ Intel*)
23652f9793fSmrg      win32_libid_type="x86 DLL"
23752f9793fSmrg      ;;
23852f9793fSmrg    esac
23952f9793fSmrg    ;;
24052f9793fSmrg  esac
24152f9793fSmrg  $echo $win32_libid_type
24252f9793fSmrg}
24352f9793fSmrg
24452f9793fSmrg
24552f9793fSmrg# func_infer_tag arg
24652f9793fSmrg# Infer tagged configuration to use if any are available and
24752f9793fSmrg# if one wasn't chosen via the "--tag" command line option.
24852f9793fSmrg# Only attempt this if the compiler in the base compile
24952f9793fSmrg# command doesn't match the default compiler.
25052f9793fSmrg# arg is usually of the form 'gcc ...'
25152f9793fSmrgfunc_infer_tag ()
25252f9793fSmrg{
25352f9793fSmrg    if test -n "$available_tags" && test -z "$tagname"; then
25452f9793fSmrg      CC_quoted=
25552f9793fSmrg      for arg in $CC; do
25652f9793fSmrg	case $arg in
25752f9793fSmrg	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
25852f9793fSmrg	  arg="\"$arg\""
25952f9793fSmrg	  ;;
26052f9793fSmrg	esac
26152f9793fSmrg	CC_quoted="$CC_quoted $arg"
26252f9793fSmrg      done
26352f9793fSmrg      case $@ in
26452f9793fSmrg      # Blanks in the command may have been stripped by the calling shell,
26552f9793fSmrg      # but not from the CC environment variable when configure was run.
26652f9793fSmrg      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
26752f9793fSmrg      # Blanks at the start of $base_compile will cause this to fail
26852f9793fSmrg      # if we don't check for them as well.
26952f9793fSmrg      *)
27052f9793fSmrg	for z in $available_tags; do
27152f9793fSmrg	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
27252f9793fSmrg	    # Evaluate the configuration.
27352f9793fSmrg	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
27452f9793fSmrg	    CC_quoted=
27552f9793fSmrg	    for arg in $CC; do
27652f9793fSmrg	    # Double-quote args containing other shell metacharacters.
27752f9793fSmrg	    case $arg in
27852f9793fSmrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
27952f9793fSmrg	      arg="\"$arg\""
28052f9793fSmrg	      ;;
28152f9793fSmrg	    esac
28252f9793fSmrg	    CC_quoted="$CC_quoted $arg"
28352f9793fSmrg	  done
28452f9793fSmrg	    case "$@ " in
28552f9793fSmrg	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
28652f9793fSmrg	      # The compiler in the base compile command matches
28752f9793fSmrg	      # the one in the tagged configuration.
28852f9793fSmrg	      # Assume this is the tagged configuration we want.
28952f9793fSmrg	      tagname=$z
29052f9793fSmrg	      break
29152f9793fSmrg	      ;;
29252f9793fSmrg	    esac
29352f9793fSmrg	  fi
29452f9793fSmrg	done
29552f9793fSmrg	# If $tagname still isn't set, then no tagged configuration
29652f9793fSmrg	# was found and let the user know that the "--tag" command
29752f9793fSmrg	# line option must be used.
29852f9793fSmrg	if test -z "$tagname"; then
29952f9793fSmrg	  $echo "$modename: unable to infer tagged configuration"
30052f9793fSmrg	  $echo "$modename: specify a tag with \`--tag'" 1>&2
30152f9793fSmrg	  exit $EXIT_FAILURE
30252f9793fSmrg#        else
30352f9793fSmrg#          $echo "$modename: using $tagname tagged configuration"
30452f9793fSmrg	fi
30552f9793fSmrg	;;
30652f9793fSmrg      esac
30752f9793fSmrg    fi
30852f9793fSmrg}
30952f9793fSmrg
31052f9793fSmrg
31152f9793fSmrg# func_extract_an_archive dir oldlib
31252f9793fSmrgfunc_extract_an_archive ()
31352f9793fSmrg{
31452f9793fSmrg    f_ex_an_ar_dir="$1"; shift
31552f9793fSmrg    f_ex_an_ar_oldlib="$1"
31652f9793fSmrg
31752f9793fSmrg    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
31852f9793fSmrg    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
31952f9793fSmrg    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
32052f9793fSmrg     :
32152f9793fSmrg    else
32252f9793fSmrg      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
32352f9793fSmrg      exit $EXIT_FAILURE
32452f9793fSmrg    fi
32552f9793fSmrg}
32652f9793fSmrg
32752f9793fSmrg# func_extract_archives gentop oldlib ...
32852f9793fSmrgfunc_extract_archives ()
32952f9793fSmrg{
33052f9793fSmrg    my_gentop="$1"; shift
33152f9793fSmrg    my_oldlibs=${1+"$@"}
33252f9793fSmrg    my_oldobjs=""
33352f9793fSmrg    my_xlib=""
33452f9793fSmrg    my_xabs=""
33552f9793fSmrg    my_xdir=""
33652f9793fSmrg    my_status=""
33752f9793fSmrg
33852f9793fSmrg    $show "${rm}r $my_gentop"
33952f9793fSmrg    $run ${rm}r "$my_gentop"
34052f9793fSmrg    $show "$mkdir $my_gentop"
34152f9793fSmrg    $run $mkdir "$my_gentop"
34252f9793fSmrg    my_status=$?
34352f9793fSmrg    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
34452f9793fSmrg      exit $my_status
34552f9793fSmrg    fi
34652f9793fSmrg
34752f9793fSmrg    for my_xlib in $my_oldlibs; do
34852f9793fSmrg      # Extract the objects.
34952f9793fSmrg      case $my_xlib in
35052f9793fSmrg	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
35152f9793fSmrg	*) my_xabs=`pwd`"/$my_xlib" ;;
35252f9793fSmrg      esac
35352f9793fSmrg      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
3542faa96e0Smrg      my_xlib_u=$my_xlib
3552faa96e0Smrg      while :; do
3562faa96e0Smrg        case " $extracted_archives " in
3572faa96e0Smrg	*" $my_xlib_u "*)
3582faa96e0Smrg	  extracted_serial=`expr $extracted_serial + 1`
3592faa96e0Smrg	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
3602faa96e0Smrg	*) break ;;
3612faa96e0Smrg	esac
3622faa96e0Smrg      done
3632faa96e0Smrg      extracted_archives="$extracted_archives $my_xlib_u"
3642faa96e0Smrg      my_xdir="$my_gentop/$my_xlib_u"
36552f9793fSmrg
36652f9793fSmrg      $show "${rm}r $my_xdir"
36752f9793fSmrg      $run ${rm}r "$my_xdir"
36852f9793fSmrg      $show "$mkdir $my_xdir"
36952f9793fSmrg      $run $mkdir "$my_xdir"
37052f9793fSmrg      exit_status=$?
37152f9793fSmrg      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
37252f9793fSmrg	exit $exit_status
37352f9793fSmrg      fi
37452f9793fSmrg      case $host in
37552f9793fSmrg      *-darwin*)
37652f9793fSmrg	$show "Extracting $my_xabs"
37752f9793fSmrg	# Do not bother doing anything if just a dry run
37852f9793fSmrg	if test -z "$run"; then
37952f9793fSmrg	  darwin_orig_dir=`pwd`
38052f9793fSmrg	  cd $my_xdir || exit $?
38152f9793fSmrg	  darwin_archive=$my_xabs
38252f9793fSmrg	  darwin_curdir=`pwd`
38352f9793fSmrg	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
38452f9793fSmrg	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
38552f9793fSmrg	  if test -n "$darwin_arches"; then 
38652f9793fSmrg	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
38752f9793fSmrg	    darwin_arch=
38852f9793fSmrg	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
38952f9793fSmrg	    for darwin_arch in  $darwin_arches ; do
39052f9793fSmrg	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
39152f9793fSmrg	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
39252f9793fSmrg	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
39352f9793fSmrg	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
39452f9793fSmrg	      cd "$darwin_curdir"
39552f9793fSmrg	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
39652f9793fSmrg	    done # $darwin_arches
39752f9793fSmrg      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
39852f9793fSmrg	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
39952f9793fSmrg	    darwin_file=
40052f9793fSmrg	    darwin_files=
40152f9793fSmrg	    for darwin_file in $darwin_filelist; do
40252f9793fSmrg	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
40352f9793fSmrg	      lipo -create -output "$darwin_file" $darwin_files
40452f9793fSmrg	    done # $darwin_filelist
40552f9793fSmrg	    ${rm}r unfat-$$
40652f9793fSmrg	    cd "$darwin_orig_dir"
40752f9793fSmrg	  else
40852f9793fSmrg	    cd "$darwin_orig_dir"
40952f9793fSmrg 	    func_extract_an_archive "$my_xdir" "$my_xabs"
41052f9793fSmrg	  fi # $darwin_arches
41152f9793fSmrg	fi # $run
41252f9793fSmrg	;;
41352f9793fSmrg      *)
41452f9793fSmrg        func_extract_an_archive "$my_xdir" "$my_xabs"
41552f9793fSmrg        ;;
41652f9793fSmrg      esac
41752f9793fSmrg      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
41852f9793fSmrg    done
41952f9793fSmrg    func_extract_archives_result="$my_oldobjs"
42052f9793fSmrg}
42152f9793fSmrg# End of Shell function definitions
42252f9793fSmrg#####################################
42352f9793fSmrg
42452f9793fSmrg# Darwin sucks
42552f9793fSmrgeval std_shrext=\"$shrext_cmds\"
42652f9793fSmrg
42752f9793fSmrgdisable_libs=no
42852f9793fSmrg
42952f9793fSmrg# Parse our command line options once, thoroughly.
43052f9793fSmrgwhile test "$#" -gt 0
43152f9793fSmrgdo
43252f9793fSmrg  arg="$1"
43352f9793fSmrg  shift
43452f9793fSmrg
43552f9793fSmrg  case $arg in
43652f9793fSmrg  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
43752f9793fSmrg  *) optarg= ;;
43852f9793fSmrg  esac
43952f9793fSmrg
44052f9793fSmrg  # If the previous option needs an argument, assign it.
44152f9793fSmrg  if test -n "$prev"; then
44252f9793fSmrg    case $prev in
44352f9793fSmrg    execute_dlfiles)
44452f9793fSmrg      execute_dlfiles="$execute_dlfiles $arg"
44552f9793fSmrg      ;;
44652f9793fSmrg    tag)
44752f9793fSmrg      tagname="$arg"
44852f9793fSmrg      preserve_args="${preserve_args}=$arg"
44952f9793fSmrg
45052f9793fSmrg      # Check whether tagname contains only valid characters
45152f9793fSmrg      case $tagname in
45252f9793fSmrg      *[!-_A-Za-z0-9,/]*)
45352f9793fSmrg	$echo "$progname: invalid tag name: $tagname" 1>&2
45452f9793fSmrg	exit $EXIT_FAILURE
45552f9793fSmrg	;;
45652f9793fSmrg      esac
45752f9793fSmrg
45852f9793fSmrg      case $tagname in
45952f9793fSmrg      CC)
46052f9793fSmrg	# Don't test for the "default" C tag, as we know, it's there, but
46152f9793fSmrg	# not specially marked.
46252f9793fSmrg	;;
46352f9793fSmrg      *)
46452f9793fSmrg	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
46552f9793fSmrg	  taglist="$taglist $tagname"
46652f9793fSmrg	  # Evaluate the configuration.
46752f9793fSmrg	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
46852f9793fSmrg	else
46952f9793fSmrg	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
47052f9793fSmrg	fi
47152f9793fSmrg	;;
47252f9793fSmrg      esac
47352f9793fSmrg      ;;
47452f9793fSmrg    *)
47552f9793fSmrg      eval "$prev=\$arg"
47652f9793fSmrg      ;;
47752f9793fSmrg    esac
47852f9793fSmrg
47952f9793fSmrg    prev=
48052f9793fSmrg    prevopt=
48152f9793fSmrg    continue
48252f9793fSmrg  fi
48352f9793fSmrg
48452f9793fSmrg  # Have we seen a non-optional argument yet?
48552f9793fSmrg  case $arg in
48652f9793fSmrg  --help)
48752f9793fSmrg    show_help=yes
48852f9793fSmrg    ;;
48952f9793fSmrg
49052f9793fSmrg  --version)
4912faa96e0Smrg    echo "\
4922faa96e0Smrg$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
4932faa96e0Smrg
4942faa96e0SmrgCopyright (C) 2008  Free Software Foundation, Inc.
4952faa96e0SmrgThis is free software; see the source for copying conditions.  There is NO
4962faa96e0Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
49752f9793fSmrg    exit $?
49852f9793fSmrg    ;;
49952f9793fSmrg
50052f9793fSmrg  --config)
50152f9793fSmrg    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
50252f9793fSmrg    # Now print the configurations for the tags.
50352f9793fSmrg    for tagname in $taglist; do
50452f9793fSmrg      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
50552f9793fSmrg    done
50652f9793fSmrg    exit $?
50752f9793fSmrg    ;;
50852f9793fSmrg
50952f9793fSmrg  --debug)
51052f9793fSmrg    $echo "$progname: enabling shell trace mode"
51152f9793fSmrg    set -x
51252f9793fSmrg    preserve_args="$preserve_args $arg"
51352f9793fSmrg    ;;
51452f9793fSmrg
51552f9793fSmrg  --dry-run | -n)
51652f9793fSmrg    run=:
51752f9793fSmrg    ;;
51852f9793fSmrg
51952f9793fSmrg  --features)
52052f9793fSmrg    $echo "host: $host"
52152f9793fSmrg    if test "$build_libtool_libs" = yes; then
52252f9793fSmrg      $echo "enable shared libraries"
52352f9793fSmrg    else
52452f9793fSmrg      $echo "disable shared libraries"
52552f9793fSmrg    fi
52652f9793fSmrg    if test "$build_old_libs" = yes; then
52752f9793fSmrg      $echo "enable static libraries"
52852f9793fSmrg    else
52952f9793fSmrg      $echo "disable static libraries"
53052f9793fSmrg    fi
53152f9793fSmrg    exit $?
53252f9793fSmrg    ;;
53352f9793fSmrg
53452f9793fSmrg  --finish) mode="finish" ;;
53552f9793fSmrg
53652f9793fSmrg  --mode) prevopt="--mode" prev=mode ;;
53752f9793fSmrg  --mode=*) mode="$optarg" ;;
53852f9793fSmrg
53952f9793fSmrg  --preserve-dup-deps) duplicate_deps="yes" ;;
54052f9793fSmrg
54152f9793fSmrg  --quiet | --silent)
54252f9793fSmrg    show=:
54352f9793fSmrg    preserve_args="$preserve_args $arg"
54452f9793fSmrg    ;;
54552f9793fSmrg
54652f9793fSmrg  --tag)
54752f9793fSmrg    prevopt="--tag"
54852f9793fSmrg    prev=tag
54952f9793fSmrg    preserve_args="$preserve_args --tag"
55052f9793fSmrg    ;;
55152f9793fSmrg  --tag=*)
55252f9793fSmrg    set tag "$optarg" ${1+"$@"}
55352f9793fSmrg    shift
55452f9793fSmrg    prev=tag
55552f9793fSmrg    preserve_args="$preserve_args --tag"
55652f9793fSmrg    ;;
55752f9793fSmrg
55852f9793fSmrg  -dlopen)
55952f9793fSmrg    prevopt="-dlopen"
56052f9793fSmrg    prev=execute_dlfiles
56152f9793fSmrg    ;;
56252f9793fSmrg
56352f9793fSmrg  -*)
56452f9793fSmrg    $echo "$modename: unrecognized option \`$arg'" 1>&2
56552f9793fSmrg    $echo "$help" 1>&2
56652f9793fSmrg    exit $EXIT_FAILURE
56752f9793fSmrg    ;;
56852f9793fSmrg
56952f9793fSmrg  *)
57052f9793fSmrg    nonopt="$arg"
57152f9793fSmrg    break
57252f9793fSmrg    ;;
57352f9793fSmrg  esac
57452f9793fSmrgdone
57552f9793fSmrg
57652f9793fSmrgif test -n "$prevopt"; then
57752f9793fSmrg  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
57852f9793fSmrg  $echo "$help" 1>&2
57952f9793fSmrg  exit $EXIT_FAILURE
58052f9793fSmrgfi
58152f9793fSmrg
58252f9793fSmrgcase $disable_libs in
58352f9793fSmrgno) 
58452f9793fSmrg  ;;
58552f9793fSmrgshared)
58652f9793fSmrg  build_libtool_libs=no
58752f9793fSmrg  build_old_libs=yes
58852f9793fSmrg  ;;
58952f9793fSmrgstatic)
59052f9793fSmrg  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
59152f9793fSmrg  ;;
59252f9793fSmrgesac
59352f9793fSmrg
59452f9793fSmrg# If this variable is set in any of the actions, the command in it
59552f9793fSmrg# will be execed at the end.  This prevents here-documents from being
59652f9793fSmrg# left over by shells.
59752f9793fSmrgexec_cmd=
59852f9793fSmrg
59952f9793fSmrgif test -z "$show_help"; then
60052f9793fSmrg
60152f9793fSmrg  # Infer the operation mode.
60252f9793fSmrg  if test -z "$mode"; then
60352f9793fSmrg    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
60452f9793fSmrg    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
60552f9793fSmrg    case $nonopt in
60652f9793fSmrg    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
60752f9793fSmrg      mode=link
60852f9793fSmrg      for arg
60952f9793fSmrg      do
61052f9793fSmrg	case $arg in
61152f9793fSmrg	-c)
61252f9793fSmrg	   mode=compile
61352f9793fSmrg	   break
61452f9793fSmrg	   ;;
61552f9793fSmrg	esac
61652f9793fSmrg      done
61752f9793fSmrg      ;;
61852f9793fSmrg    *db | *dbx | *strace | *truss)
61952f9793fSmrg      mode=execute
62052f9793fSmrg      ;;
62152f9793fSmrg    *install*|cp|mv)
62252f9793fSmrg      mode=install
62352f9793fSmrg      ;;
62452f9793fSmrg    *rm)
62552f9793fSmrg      mode=uninstall
62652f9793fSmrg      ;;
62752f9793fSmrg    *)
62852f9793fSmrg      # If we have no mode, but dlfiles were specified, then do execute mode.
62952f9793fSmrg      test -n "$execute_dlfiles" && mode=execute
63052f9793fSmrg
63152f9793fSmrg      # Just use the default operation mode.
63252f9793fSmrg      if test -z "$mode"; then
63352f9793fSmrg	if test -n "$nonopt"; then
63452f9793fSmrg	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
63552f9793fSmrg	else
63652f9793fSmrg	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
63752f9793fSmrg	fi
63852f9793fSmrg      fi
63952f9793fSmrg      ;;
64052f9793fSmrg    esac
64152f9793fSmrg  fi
64252f9793fSmrg
64352f9793fSmrg  # Only execute mode is allowed to have -dlopen flags.
64452f9793fSmrg  if test -n "$execute_dlfiles" && test "$mode" != execute; then
64552f9793fSmrg    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
64652f9793fSmrg    $echo "$help" 1>&2
64752f9793fSmrg    exit $EXIT_FAILURE
64852f9793fSmrg  fi
64952f9793fSmrg
65052f9793fSmrg  # Change the help message to a mode-specific one.
65152f9793fSmrg  generic_help="$help"
65252f9793fSmrg  help="Try \`$modename --help --mode=$mode' for more information."
65352f9793fSmrg
65452f9793fSmrg  # These modes are in order of execution frequency so that they run quickly.
65552f9793fSmrg  case $mode in
65652f9793fSmrg  # libtool compile mode
65752f9793fSmrg  compile)
65852f9793fSmrg    modename="$modename: compile"
65952f9793fSmrg    # Get the compilation command and the source file.
66052f9793fSmrg    base_compile=
66152f9793fSmrg    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
66252f9793fSmrg    suppress_opt=yes
66352f9793fSmrg    suppress_output=
66452f9793fSmrg    arg_mode=normal
66552f9793fSmrg    libobj=
66652f9793fSmrg    later=
66752f9793fSmrg
66852f9793fSmrg    for arg
66952f9793fSmrg    do
67052f9793fSmrg      case $arg_mode in
67152f9793fSmrg      arg  )
67252f9793fSmrg	# do not "continue".  Instead, add this to base_compile
67352f9793fSmrg	lastarg="$arg"
67452f9793fSmrg	arg_mode=normal
67552f9793fSmrg	;;
67652f9793fSmrg
67752f9793fSmrg      target )
67852f9793fSmrg	libobj="$arg"
67952f9793fSmrg	arg_mode=normal
68052f9793fSmrg	continue
68152f9793fSmrg	;;
68252f9793fSmrg
68352f9793fSmrg      normal )
68452f9793fSmrg	# Accept any command-line options.
68552f9793fSmrg	case $arg in
68652f9793fSmrg	-o)
68752f9793fSmrg	  if test -n "$libobj" ; then
68852f9793fSmrg	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
68952f9793fSmrg	    exit $EXIT_FAILURE
69052f9793fSmrg	  fi
69152f9793fSmrg	  arg_mode=target
69252f9793fSmrg	  continue
69352f9793fSmrg	  ;;
69452f9793fSmrg
69552f9793fSmrg	-static | -prefer-pic | -prefer-non-pic)
69652f9793fSmrg	  later="$later $arg"
69752f9793fSmrg	  continue
69852f9793fSmrg	  ;;
69952f9793fSmrg
70052f9793fSmrg	-no-suppress)
70152f9793fSmrg	  suppress_opt=no
70252f9793fSmrg	  continue
70352f9793fSmrg	  ;;
70452f9793fSmrg
70552f9793fSmrg	-Xcompiler)
70652f9793fSmrg	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
70752f9793fSmrg	  continue      #  The current "srcfile" will either be retained or
70852f9793fSmrg	  ;;            #  replaced later.  I would guess that would be a bug.
70952f9793fSmrg
71052f9793fSmrg	-Wc,*)
71152f9793fSmrg	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
71252f9793fSmrg	  lastarg=
71352f9793fSmrg	  save_ifs="$IFS"; IFS=','
71452f9793fSmrg 	  for arg in $args; do
71552f9793fSmrg	    IFS="$save_ifs"
71652f9793fSmrg
71752f9793fSmrg	    # Double-quote args containing other shell metacharacters.
71852f9793fSmrg	    # Many Bourne shells cannot handle close brackets correctly
71952f9793fSmrg	    # in scan sets, so we specify it separately.
72052f9793fSmrg	    case $arg in
72152f9793fSmrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
72252f9793fSmrg	      arg="\"$arg\""
72352f9793fSmrg	      ;;
72452f9793fSmrg	    esac
72552f9793fSmrg	    lastarg="$lastarg $arg"
72652f9793fSmrg	  done
72752f9793fSmrg	  IFS="$save_ifs"
72852f9793fSmrg	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
72952f9793fSmrg
73052f9793fSmrg	  # Add the arguments to base_compile.
73152f9793fSmrg	  base_compile="$base_compile $lastarg"
73252f9793fSmrg	  continue
73352f9793fSmrg	  ;;
73452f9793fSmrg
73552f9793fSmrg	* )
73652f9793fSmrg	  # Accept the current argument as the source file.
73752f9793fSmrg	  # The previous "srcfile" becomes the current argument.
73852f9793fSmrg	  #
73952f9793fSmrg	  lastarg="$srcfile"
74052f9793fSmrg	  srcfile="$arg"
74152f9793fSmrg	  ;;
74252f9793fSmrg	esac  #  case $arg
74352f9793fSmrg	;;
74452f9793fSmrg      esac    #  case $arg_mode
74552f9793fSmrg
74652f9793fSmrg      # Aesthetically quote the previous argument.
74752f9793fSmrg      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
74852f9793fSmrg
74952f9793fSmrg      case $lastarg in
75052f9793fSmrg      # Double-quote args containing other shell metacharacters.
75152f9793fSmrg      # Many Bourne shells cannot handle close brackets correctly
75252f9793fSmrg      # in scan sets, and some SunOS ksh mistreat backslash-escaping
75352f9793fSmrg      # in scan sets (worked around with variable expansion),
75452f9793fSmrg      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
75552f9793fSmrg      # at all, so we specify them separately.
75652f9793fSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
75752f9793fSmrg	lastarg="\"$lastarg\""
75852f9793fSmrg	;;
75952f9793fSmrg      esac
76052f9793fSmrg
76152f9793fSmrg      base_compile="$base_compile $lastarg"
76252f9793fSmrg    done # for arg
76352f9793fSmrg
76452f9793fSmrg    case $arg_mode in
76552f9793fSmrg    arg)
76652f9793fSmrg      $echo "$modename: you must specify an argument for -Xcompile"
76752f9793fSmrg      exit $EXIT_FAILURE
76852f9793fSmrg      ;;
76952f9793fSmrg    target)
77052f9793fSmrg      $echo "$modename: you must specify a target with \`-o'" 1>&2
77152f9793fSmrg      exit $EXIT_FAILURE
77252f9793fSmrg      ;;
77352f9793fSmrg    *)
77452f9793fSmrg      # Get the name of the library object.
77552f9793fSmrg      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
77652f9793fSmrg      ;;
77752f9793fSmrg    esac
77852f9793fSmrg
77952f9793fSmrg    # Recognize several different file suffixes.
78052f9793fSmrg    # If the user specifies -o file.o, it is replaced with file.lo
78152f9793fSmrg    xform='[cCFSifmso]'
78252f9793fSmrg    case $libobj in
78352f9793fSmrg    *.ada) xform=ada ;;
78452f9793fSmrg    *.adb) xform=adb ;;
78552f9793fSmrg    *.ads) xform=ads ;;
78652f9793fSmrg    *.asm) xform=asm ;;
78752f9793fSmrg    *.c++) xform=c++ ;;
78852f9793fSmrg    *.cc) xform=cc ;;
78952f9793fSmrg    *.ii) xform=ii ;;
79052f9793fSmrg    *.class) xform=class ;;
79152f9793fSmrg    *.cpp) xform=cpp ;;
79252f9793fSmrg    *.cxx) xform=cxx ;;
7932faa96e0Smrg    *.[fF][09]?) xform=[fF][09]. ;;
79452f9793fSmrg    *.for) xform=for ;;
79552f9793fSmrg    *.java) xform=java ;;
7962faa96e0Smrg    *.obj) xform=obj ;;
7972faa96e0Smrg    *.sx) xform=sx ;;
79852f9793fSmrg    esac
79952f9793fSmrg
80052f9793fSmrg    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
80152f9793fSmrg
80252f9793fSmrg    case $libobj in
80352f9793fSmrg    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
80452f9793fSmrg    *)
80552f9793fSmrg      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
80652f9793fSmrg      exit $EXIT_FAILURE
80752f9793fSmrg      ;;
80852f9793fSmrg    esac
80952f9793fSmrg
81052f9793fSmrg    func_infer_tag $base_compile
81152f9793fSmrg
81252f9793fSmrg    for arg in $later; do
81352f9793fSmrg      case $arg in
81452f9793fSmrg      -static)
81552f9793fSmrg	build_old_libs=yes
81652f9793fSmrg	continue
81752f9793fSmrg	;;
81852f9793fSmrg
81952f9793fSmrg      -prefer-pic)
82052f9793fSmrg	pic_mode=yes
82152f9793fSmrg	continue
82252f9793fSmrg	;;
82352f9793fSmrg
82452f9793fSmrg      -prefer-non-pic)
82552f9793fSmrg	pic_mode=no
82652f9793fSmrg	continue
82752f9793fSmrg	;;
82852f9793fSmrg      esac
82952f9793fSmrg    done
83052f9793fSmrg
83152f9793fSmrg    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
83252f9793fSmrg    case $qlibobj in
83352f9793fSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
83452f9793fSmrg	qlibobj="\"$qlibobj\"" ;;
83552f9793fSmrg    esac
83652f9793fSmrg    test "X$libobj" != "X$qlibobj" \
83752f9793fSmrg	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
83852f9793fSmrg	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
83952f9793fSmrg    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
84052f9793fSmrg    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
84152f9793fSmrg    if test "X$xdir" = "X$obj"; then
84252f9793fSmrg      xdir=
84352f9793fSmrg    else
84452f9793fSmrg      xdir=$xdir/
84552f9793fSmrg    fi
84652f9793fSmrg    lobj=${xdir}$objdir/$objname
84752f9793fSmrg
84852f9793fSmrg    if test -z "$base_compile"; then
84952f9793fSmrg      $echo "$modename: you must specify a compilation command" 1>&2
85052f9793fSmrg      $echo "$help" 1>&2
85152f9793fSmrg      exit $EXIT_FAILURE
85252f9793fSmrg    fi
85352f9793fSmrg
85452f9793fSmrg    # Delete any leftover library objects.
85552f9793fSmrg    if test "$build_old_libs" = yes; then
85652f9793fSmrg      removelist="$obj $lobj $libobj ${libobj}T"
85752f9793fSmrg    else
85852f9793fSmrg      removelist="$lobj $libobj ${libobj}T"
85952f9793fSmrg    fi
86052f9793fSmrg
86152f9793fSmrg    $run $rm $removelist
86252f9793fSmrg    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
86352f9793fSmrg
86452f9793fSmrg    # On Cygwin there's no "real" PIC flag so we must build both object types
86552f9793fSmrg    case $host_os in
86652f9793fSmrg    cygwin* | mingw* | pw32* | os2*)
86752f9793fSmrg      pic_mode=default
86852f9793fSmrg      ;;
86952f9793fSmrg    esac
87052f9793fSmrg    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
87152f9793fSmrg      # non-PIC code in shared libraries is not supported
87252f9793fSmrg      pic_mode=default
87352f9793fSmrg    fi
87452f9793fSmrg
87552f9793fSmrg    # Calculate the filename of the output object if compiler does
87652f9793fSmrg    # not support -o with -c
87752f9793fSmrg    if test "$compiler_c_o" = no; then
87852f9793fSmrg      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
87952f9793fSmrg      lockfile="$output_obj.lock"
88052f9793fSmrg      removelist="$removelist $output_obj $lockfile"
88152f9793fSmrg      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
88252f9793fSmrg    else
88352f9793fSmrg      output_obj=
88452f9793fSmrg      need_locks=no
88552f9793fSmrg      lockfile=
88652f9793fSmrg    fi
88752f9793fSmrg
88852f9793fSmrg    # Lock this critical section if it is needed
88952f9793fSmrg    # We use this script file to make the link, it avoids creating a new file
89052f9793fSmrg    if test "$need_locks" = yes; then
89152f9793fSmrg      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
89252f9793fSmrg	$show "Waiting for $lockfile to be removed"
89352f9793fSmrg	sleep 2
89452f9793fSmrg      done
89552f9793fSmrg    elif test "$need_locks" = warn; then
89652f9793fSmrg      if test -f "$lockfile"; then
89752f9793fSmrg	$echo "\
89852f9793fSmrg*** ERROR, $lockfile exists and contains:
89952f9793fSmrg`cat $lockfile 2>/dev/null`
90052f9793fSmrg
90152f9793fSmrgThis indicates that another process is trying to use the same
90252f9793fSmrgtemporary object file, and libtool could not work around it because
90352f9793fSmrgyour compiler does not support \`-c' and \`-o' together.  If you
90452f9793fSmrgrepeat this compilation, it may succeed, by chance, but you had better
90552f9793fSmrgavoid parallel builds (make -j) in this platform, or get a better
90652f9793fSmrgcompiler."
90752f9793fSmrg
90852f9793fSmrg	$run $rm $removelist
90952f9793fSmrg	exit $EXIT_FAILURE
91052f9793fSmrg      fi
91152f9793fSmrg      $echo "$srcfile" > "$lockfile"
91252f9793fSmrg    fi
91352f9793fSmrg
91452f9793fSmrg    if test -n "$fix_srcfile_path"; then
91552f9793fSmrg      eval srcfile=\"$fix_srcfile_path\"
91652f9793fSmrg    fi
91752f9793fSmrg    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
91852f9793fSmrg    case $qsrcfile in
91952f9793fSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
92052f9793fSmrg      qsrcfile="\"$qsrcfile\"" ;;
92152f9793fSmrg    esac
92252f9793fSmrg
92352f9793fSmrg    $run $rm "$libobj" "${libobj}T"
92452f9793fSmrg
92552f9793fSmrg    # Create a libtool object file (analogous to a ".la" file),
92652f9793fSmrg    # but don't create it if we're doing a dry run.
92752f9793fSmrg    test -z "$run" && cat > ${libobj}T <<EOF
92852f9793fSmrg# $libobj - a libtool object file
92952f9793fSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
93052f9793fSmrg#
93152f9793fSmrg# Please DO NOT delete this file!
93252f9793fSmrg# It is necessary for linking the library.
93352f9793fSmrg
93452f9793fSmrg# Name of the PIC object.
93552f9793fSmrgEOF
93652f9793fSmrg
93752f9793fSmrg    # Only build a PIC object if we are building libtool libraries.
93852f9793fSmrg    if test "$build_libtool_libs" = yes; then
93952f9793fSmrg      # Without this assignment, base_compile gets emptied.
94052f9793fSmrg      fbsd_hideous_sh_bug=$base_compile
94152f9793fSmrg
94252f9793fSmrg      if test "$pic_mode" != no; then
94352f9793fSmrg	command="$base_compile $qsrcfile $pic_flag"
94452f9793fSmrg      else
94552f9793fSmrg	# Don't build PIC code
94652f9793fSmrg	command="$base_compile $qsrcfile"
94752f9793fSmrg      fi
94852f9793fSmrg
94952f9793fSmrg      if test ! -d "${xdir}$objdir"; then
95052f9793fSmrg	$show "$mkdir ${xdir}$objdir"
95152f9793fSmrg	$run $mkdir ${xdir}$objdir
95252f9793fSmrg	exit_status=$?
95352f9793fSmrg	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
95452f9793fSmrg	  exit $exit_status
95552f9793fSmrg	fi
95652f9793fSmrg      fi
95752f9793fSmrg
95852f9793fSmrg      if test -z "$output_obj"; then
95952f9793fSmrg	# Place PIC objects in $objdir
96052f9793fSmrg	command="$command -o $lobj"
96152f9793fSmrg      fi
96252f9793fSmrg
96352f9793fSmrg      $run $rm "$lobj" "$output_obj"
96452f9793fSmrg
96552f9793fSmrg      $show "$command"
9662faa96e0Smrg      if $run eval $lt_env "$command"; then :
96752f9793fSmrg      else
96852f9793fSmrg	test -n "$output_obj" && $run $rm $removelist
96952f9793fSmrg	exit $EXIT_FAILURE
97052f9793fSmrg      fi
97152f9793fSmrg
97252f9793fSmrg      if test "$need_locks" = warn &&
97352f9793fSmrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
97452f9793fSmrg	$echo "\
97552f9793fSmrg*** ERROR, $lockfile contains:
97652f9793fSmrg`cat $lockfile 2>/dev/null`
97752f9793fSmrg
97852f9793fSmrgbut it should contain:
97952f9793fSmrg$srcfile
98052f9793fSmrg
98152f9793fSmrgThis indicates that another process is trying to use the same
98252f9793fSmrgtemporary object file, and libtool could not work around it because
98352f9793fSmrgyour compiler does not support \`-c' and \`-o' together.  If you
98452f9793fSmrgrepeat this compilation, it may succeed, by chance, but you had better
98552f9793fSmrgavoid parallel builds (make -j) in this platform, or get a better
98652f9793fSmrgcompiler."
98752f9793fSmrg
98852f9793fSmrg	$run $rm $removelist
98952f9793fSmrg	exit $EXIT_FAILURE
99052f9793fSmrg      fi
99152f9793fSmrg
99252f9793fSmrg      # Just move the object if needed, then go on to compile the next one
99352f9793fSmrg      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
99452f9793fSmrg	$show "$mv $output_obj $lobj"
99552f9793fSmrg	if $run $mv $output_obj $lobj; then :
99652f9793fSmrg	else
99752f9793fSmrg	  error=$?
99852f9793fSmrg	  $run $rm $removelist
99952f9793fSmrg	  exit $error
100052f9793fSmrg	fi
100152f9793fSmrg      fi
100252f9793fSmrg
100352f9793fSmrg      # Append the name of the PIC object to the libtool object file.
100452f9793fSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
100552f9793fSmrgpic_object='$objdir/$objname'
100652f9793fSmrg
100752f9793fSmrgEOF
100852f9793fSmrg
100952f9793fSmrg      # Allow error messages only from the first compilation.
101052f9793fSmrg      if test "$suppress_opt" = yes; then
101152f9793fSmrg        suppress_output=' >/dev/null 2>&1'
101252f9793fSmrg      fi
101352f9793fSmrg    else
101452f9793fSmrg      # No PIC object so indicate it doesn't exist in the libtool
101552f9793fSmrg      # object file.
101652f9793fSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
101752f9793fSmrgpic_object=none
101852f9793fSmrg
101952f9793fSmrgEOF
102052f9793fSmrg    fi
102152f9793fSmrg
102252f9793fSmrg    # Only build a position-dependent object if we build old libraries.
102352f9793fSmrg    if test "$build_old_libs" = yes; then
102452f9793fSmrg      if test "$pic_mode" != yes; then
102552f9793fSmrg	# Don't build PIC code
102652f9793fSmrg	command="$base_compile $qsrcfile"
102752f9793fSmrg      else
102852f9793fSmrg	command="$base_compile $qsrcfile $pic_flag"
102952f9793fSmrg      fi
103052f9793fSmrg      if test "$compiler_c_o" = yes; then
103152f9793fSmrg	command="$command -o $obj"
103252f9793fSmrg      fi
103352f9793fSmrg
103452f9793fSmrg      # Suppress compiler output if we already did a PIC compilation.
103552f9793fSmrg      command="$command$suppress_output"
103652f9793fSmrg      $run $rm "$obj" "$output_obj"
103752f9793fSmrg      $show "$command"
10382faa96e0Smrg      if $run eval $lt_env "$command"; then :
103952f9793fSmrg      else
104052f9793fSmrg	$run $rm $removelist
104152f9793fSmrg	exit $EXIT_FAILURE
104252f9793fSmrg      fi
104352f9793fSmrg
104452f9793fSmrg      if test "$need_locks" = warn &&
104552f9793fSmrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
104652f9793fSmrg	$echo "\
104752f9793fSmrg*** ERROR, $lockfile contains:
104852f9793fSmrg`cat $lockfile 2>/dev/null`
104952f9793fSmrg
105052f9793fSmrgbut it should contain:
105152f9793fSmrg$srcfile
105252f9793fSmrg
105352f9793fSmrgThis indicates that another process is trying to use the same
105452f9793fSmrgtemporary object file, and libtool could not work around it because
105552f9793fSmrgyour compiler does not support \`-c' and \`-o' together.  If you
105652f9793fSmrgrepeat this compilation, it may succeed, by chance, but you had better
105752f9793fSmrgavoid parallel builds (make -j) in this platform, or get a better
105852f9793fSmrgcompiler."
105952f9793fSmrg
106052f9793fSmrg	$run $rm $removelist
106152f9793fSmrg	exit $EXIT_FAILURE
106252f9793fSmrg      fi
106352f9793fSmrg
106452f9793fSmrg      # Just move the object if needed
106552f9793fSmrg      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
106652f9793fSmrg	$show "$mv $output_obj $obj"
106752f9793fSmrg	if $run $mv $output_obj $obj; then :
106852f9793fSmrg	else
106952f9793fSmrg	  error=$?
107052f9793fSmrg	  $run $rm $removelist
107152f9793fSmrg	  exit $error
107252f9793fSmrg	fi
107352f9793fSmrg      fi
107452f9793fSmrg
107552f9793fSmrg      # Append the name of the non-PIC object the libtool object file.
107652f9793fSmrg      # Only append if the libtool object file exists.
107752f9793fSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
107852f9793fSmrg# Name of the non-PIC object.
107952f9793fSmrgnon_pic_object='$objname'
108052f9793fSmrg
108152f9793fSmrgEOF
108252f9793fSmrg    else
108352f9793fSmrg      # Append the name of the non-PIC object the libtool object file.
108452f9793fSmrg      # Only append if the libtool object file exists.
108552f9793fSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
108652f9793fSmrg# Name of the non-PIC object.
108752f9793fSmrgnon_pic_object=none
108852f9793fSmrg
108952f9793fSmrgEOF
109052f9793fSmrg    fi
109152f9793fSmrg
109252f9793fSmrg    $run $mv "${libobj}T" "${libobj}"
109352f9793fSmrg
109452f9793fSmrg    # Unlock the critical section if it was locked
109552f9793fSmrg    if test "$need_locks" != no; then
109652f9793fSmrg      $run $rm "$lockfile"
109752f9793fSmrg    fi
109852f9793fSmrg
109952f9793fSmrg    exit $EXIT_SUCCESS
110052f9793fSmrg    ;;
110152f9793fSmrg
110252f9793fSmrg  # libtool link mode
110352f9793fSmrg  link | relink)
110452f9793fSmrg    modename="$modename: link"
110552f9793fSmrg    case $host in
110652f9793fSmrg    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
110752f9793fSmrg      # It is impossible to link a dll without this setting, and
110852f9793fSmrg      # we shouldn't force the makefile maintainer to figure out
110952f9793fSmrg      # which system we are compiling for in order to pass an extra
111052f9793fSmrg      # flag for every libtool invocation.
111152f9793fSmrg      # allow_undefined=no
111252f9793fSmrg
111352f9793fSmrg      # FIXME: Unfortunately, there are problems with the above when trying
111452f9793fSmrg      # to make a dll which has undefined symbols, in which case not
111552f9793fSmrg      # even a static library is built.  For now, we need to specify
111652f9793fSmrg      # -no-undefined on the libtool link line when we can be certain
111752f9793fSmrg      # that all symbols are satisfied, otherwise we get a static library.
111852f9793fSmrg      allow_undefined=yes
111952f9793fSmrg      ;;
112052f9793fSmrg    *)
112152f9793fSmrg      allow_undefined=yes
112252f9793fSmrg      ;;
112352f9793fSmrg    esac
112452f9793fSmrg    libtool_args="$nonopt"
112552f9793fSmrg    base_compile="$nonopt $@"
112652f9793fSmrg    compile_command="$nonopt"
112752f9793fSmrg    finalize_command="$nonopt"
112852f9793fSmrg
112952f9793fSmrg    compile_rpath=
113052f9793fSmrg    finalize_rpath=
113152f9793fSmrg    compile_shlibpath=
113252f9793fSmrg    finalize_shlibpath=
113352f9793fSmrg    convenience=
113452f9793fSmrg    old_convenience=
113552f9793fSmrg    deplibs=
113652f9793fSmrg    old_deplibs=
113752f9793fSmrg    compiler_flags=
113852f9793fSmrg    linker_flags=
113952f9793fSmrg    dllsearchpath=
114052f9793fSmrg    lib_search_path=`pwd`
114152f9793fSmrg    inst_prefix_dir=
114252f9793fSmrg
114352f9793fSmrg    avoid_version=no
114452f9793fSmrg    dlfiles=
114552f9793fSmrg    dlprefiles=
114652f9793fSmrg    dlself=no
114752f9793fSmrg    export_dynamic=no
114852f9793fSmrg    export_symbols=
114952f9793fSmrg    export_symbols_regex=
115052f9793fSmrg    generated=
115152f9793fSmrg    libobjs=
115252f9793fSmrg    ltlibs=
115352f9793fSmrg    module=no
115452f9793fSmrg    no_install=no
115552f9793fSmrg    objs=
115652f9793fSmrg    non_pic_objects=
115752f9793fSmrg    notinst_path= # paths that contain not-installed libtool libraries
115852f9793fSmrg    precious_files_regex=
115952f9793fSmrg    prefer_static_libs=no
116052f9793fSmrg    preload=no
116152f9793fSmrg    prev=
116252f9793fSmrg    prevarg=
116352f9793fSmrg    release=
116452f9793fSmrg    rpath=
116552f9793fSmrg    xrpath=
116652f9793fSmrg    perm_rpath=
116752f9793fSmrg    temp_rpath=
116852f9793fSmrg    thread_safe=no
116952f9793fSmrg    vinfo=
117052f9793fSmrg    vinfo_number=no
11712faa96e0Smrg    single_module="${wl}-single_module"
117252f9793fSmrg
117352f9793fSmrg    func_infer_tag $base_compile
117452f9793fSmrg
117552f9793fSmrg    # We need to know -static, to get the right output filenames.
117652f9793fSmrg    for arg
117752f9793fSmrg    do
117852f9793fSmrg      case $arg in
11792faa96e0Smrg      -all-static | -static | -static-libtool-libs)
11802faa96e0Smrg	case $arg in
11812faa96e0Smrg	-all-static)
118252f9793fSmrg	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
118352f9793fSmrg	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
118452f9793fSmrg	  fi
118552f9793fSmrg	  if test -n "$link_static_flag"; then
118652f9793fSmrg	    dlopen_self=$dlopen_self_static
118752f9793fSmrg	  fi
118852f9793fSmrg	  prefer_static_libs=yes
11892faa96e0Smrg	  ;;
11902faa96e0Smrg	-static)
119152f9793fSmrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
119252f9793fSmrg	    dlopen_self=$dlopen_self_static
119352f9793fSmrg	  fi
119452f9793fSmrg	  prefer_static_libs=built
11952faa96e0Smrg	  ;;
11962faa96e0Smrg	-static-libtool-libs)
11972faa96e0Smrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
11982faa96e0Smrg	    dlopen_self=$dlopen_self_static
11992faa96e0Smrg	  fi
12002faa96e0Smrg	  prefer_static_libs=yes
12012faa96e0Smrg	  ;;
12022faa96e0Smrg	esac
120352f9793fSmrg	build_libtool_libs=no
120452f9793fSmrg	build_old_libs=yes
120552f9793fSmrg	break
120652f9793fSmrg	;;
120752f9793fSmrg      esac
120852f9793fSmrg    done
120952f9793fSmrg
121052f9793fSmrg    # See if our shared archives depend on static archives.
121152f9793fSmrg    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
121252f9793fSmrg
121352f9793fSmrg    # Go through the arguments, transforming them on the way.
121452f9793fSmrg    while test "$#" -gt 0; do
121552f9793fSmrg      arg="$1"
121652f9793fSmrg      shift
121752f9793fSmrg      case $arg in
121852f9793fSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
121952f9793fSmrg	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
122052f9793fSmrg	;;
122152f9793fSmrg      *) qarg=$arg ;;
122252f9793fSmrg      esac
122352f9793fSmrg      libtool_args="$libtool_args $qarg"
122452f9793fSmrg
122552f9793fSmrg      # If the previous option needs an argument, assign it.
122652f9793fSmrg      if test -n "$prev"; then
122752f9793fSmrg	case $prev in
122852f9793fSmrg	output)
122952f9793fSmrg	  compile_command="$compile_command @OUTPUT@"
123052f9793fSmrg	  finalize_command="$finalize_command @OUTPUT@"
123152f9793fSmrg	  ;;
123252f9793fSmrg	esac
123352f9793fSmrg
123452f9793fSmrg	case $prev in
123552f9793fSmrg	dlfiles|dlprefiles)
123652f9793fSmrg	  if test "$preload" = no; then
123752f9793fSmrg	    # Add the symbol object into the linking commands.
123852f9793fSmrg	    compile_command="$compile_command @SYMFILE@"
123952f9793fSmrg	    finalize_command="$finalize_command @SYMFILE@"
124052f9793fSmrg	    preload=yes
124152f9793fSmrg	  fi
124252f9793fSmrg	  case $arg in
124352f9793fSmrg	  *.la | *.lo) ;;  # We handle these cases below.
124452f9793fSmrg	  force)
124552f9793fSmrg	    if test "$dlself" = no; then
124652f9793fSmrg	      dlself=needless
124752f9793fSmrg	      export_dynamic=yes
124852f9793fSmrg	    fi
124952f9793fSmrg	    prev=
125052f9793fSmrg	    continue
125152f9793fSmrg	    ;;
125252f9793fSmrg	  self)
125352f9793fSmrg	    if test "$prev" = dlprefiles; then
125452f9793fSmrg	      dlself=yes
125552f9793fSmrg	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
125652f9793fSmrg	      dlself=yes
125752f9793fSmrg	    else
125852f9793fSmrg	      dlself=needless
125952f9793fSmrg	      export_dynamic=yes
126052f9793fSmrg	    fi
126152f9793fSmrg	    prev=
126252f9793fSmrg	    continue
126352f9793fSmrg	    ;;
126452f9793fSmrg	  *)
126552f9793fSmrg	    if test "$prev" = dlfiles; then
126652f9793fSmrg	      dlfiles="$dlfiles $arg"
126752f9793fSmrg	    else
126852f9793fSmrg	      dlprefiles="$dlprefiles $arg"
126952f9793fSmrg	    fi
127052f9793fSmrg	    prev=
127152f9793fSmrg	    continue
127252f9793fSmrg	    ;;
127352f9793fSmrg	  esac
127452f9793fSmrg	  ;;
127552f9793fSmrg	expsyms)
127652f9793fSmrg	  export_symbols="$arg"
127752f9793fSmrg	  if test ! -f "$arg"; then
127852f9793fSmrg	    $echo "$modename: symbol file \`$arg' does not exist"
127952f9793fSmrg	    exit $EXIT_FAILURE
128052f9793fSmrg	  fi
128152f9793fSmrg	  prev=
128252f9793fSmrg	  continue
128352f9793fSmrg	  ;;
128452f9793fSmrg	expsyms_regex)
128552f9793fSmrg	  export_symbols_regex="$arg"
128652f9793fSmrg	  prev=
128752f9793fSmrg	  continue
128852f9793fSmrg	  ;;
128952f9793fSmrg	inst_prefix)
129052f9793fSmrg	  inst_prefix_dir="$arg"
129152f9793fSmrg	  prev=
129252f9793fSmrg	  continue
129352f9793fSmrg	  ;;
129452f9793fSmrg	precious_regex)
129552f9793fSmrg	  precious_files_regex="$arg"
129652f9793fSmrg	  prev=
129752f9793fSmrg	  continue
129852f9793fSmrg	  ;;
129952f9793fSmrg	release)
130052f9793fSmrg	  release="-$arg"
130152f9793fSmrg	  prev=
130252f9793fSmrg	  continue
130352f9793fSmrg	  ;;
130452f9793fSmrg	objectlist)
130552f9793fSmrg	  if test -f "$arg"; then
130652f9793fSmrg	    save_arg=$arg
130752f9793fSmrg	    moreargs=
130852f9793fSmrg	    for fil in `cat $save_arg`
130952f9793fSmrg	    do
131052f9793fSmrg#	      moreargs="$moreargs $fil"
131152f9793fSmrg	      arg=$fil
131252f9793fSmrg	      # A libtool-controlled object.
131352f9793fSmrg
131452f9793fSmrg	      # Check to see that this really is a libtool object.
131552f9793fSmrg	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
131652f9793fSmrg		pic_object=
131752f9793fSmrg		non_pic_object=
131852f9793fSmrg
131952f9793fSmrg		# Read the .lo file
132052f9793fSmrg		# If there is no directory component, then add one.
132152f9793fSmrg		case $arg in
132252f9793fSmrg		*/* | *\\*) . $arg ;;
132352f9793fSmrg		*) . ./$arg ;;
132452f9793fSmrg		esac
132552f9793fSmrg
132652f9793fSmrg		if test -z "$pic_object" || \
132752f9793fSmrg		   test -z "$non_pic_object" ||
132852f9793fSmrg		   test "$pic_object" = none && \
132952f9793fSmrg		   test "$non_pic_object" = none; then
133052f9793fSmrg		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
133152f9793fSmrg		  exit $EXIT_FAILURE
133252f9793fSmrg		fi
133352f9793fSmrg
133452f9793fSmrg		# Extract subdirectory from the argument.
133552f9793fSmrg		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
133652f9793fSmrg		if test "X$xdir" = "X$arg"; then
133752f9793fSmrg		  xdir=
133852f9793fSmrg		else
133952f9793fSmrg		  xdir="$xdir/"
134052f9793fSmrg		fi
134152f9793fSmrg
134252f9793fSmrg		if test "$pic_object" != none; then
134352f9793fSmrg		  # Prepend the subdirectory the object is found in.
134452f9793fSmrg		  pic_object="$xdir$pic_object"
134552f9793fSmrg
134652f9793fSmrg		  if test "$prev" = dlfiles; then
134752f9793fSmrg		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
134852f9793fSmrg		      dlfiles="$dlfiles $pic_object"
134952f9793fSmrg		      prev=
135052f9793fSmrg		      continue
135152f9793fSmrg		    else
135252f9793fSmrg		      # If libtool objects are unsupported, then we need to preload.
135352f9793fSmrg		      prev=dlprefiles
135452f9793fSmrg		    fi
135552f9793fSmrg		  fi
135652f9793fSmrg
135752f9793fSmrg		  # CHECK ME:  I think I busted this.  -Ossama
135852f9793fSmrg		  if test "$prev" = dlprefiles; then
135952f9793fSmrg		    # Preload the old-style object.
136052f9793fSmrg		    dlprefiles="$dlprefiles $pic_object"
136152f9793fSmrg		    prev=
136252f9793fSmrg		  fi
136352f9793fSmrg
136452f9793fSmrg		  # A PIC object.
136552f9793fSmrg		  libobjs="$libobjs $pic_object"
136652f9793fSmrg		  arg="$pic_object"
136752f9793fSmrg		fi
136852f9793fSmrg
136952f9793fSmrg		# Non-PIC object.
137052f9793fSmrg		if test "$non_pic_object" != none; then
137152f9793fSmrg		  # Prepend the subdirectory the object is found in.
137252f9793fSmrg		  non_pic_object="$xdir$non_pic_object"
137352f9793fSmrg
137452f9793fSmrg		  # A standard non-PIC object
137552f9793fSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
137652f9793fSmrg		  if test -z "$pic_object" || test "$pic_object" = none ; then
137752f9793fSmrg		    arg="$non_pic_object"
137852f9793fSmrg		  fi
137952f9793fSmrg		else
138052f9793fSmrg		  # If the PIC object exists, use it instead.
138152f9793fSmrg		  # $xdir was prepended to $pic_object above.
138252f9793fSmrg		  non_pic_object="$pic_object"
138352f9793fSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
138452f9793fSmrg		fi
138552f9793fSmrg	      else
138652f9793fSmrg		# Only an error if not doing a dry-run.
138752f9793fSmrg		if test -z "$run"; then
138852f9793fSmrg		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
138952f9793fSmrg		  exit $EXIT_FAILURE
139052f9793fSmrg		else
139152f9793fSmrg		  # Dry-run case.
139252f9793fSmrg
139352f9793fSmrg		  # Extract subdirectory from the argument.
139452f9793fSmrg		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
139552f9793fSmrg		  if test "X$xdir" = "X$arg"; then
139652f9793fSmrg		    xdir=
139752f9793fSmrg		  else
139852f9793fSmrg		    xdir="$xdir/"
139952f9793fSmrg		  fi
140052f9793fSmrg
140152f9793fSmrg		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
140252f9793fSmrg		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
140352f9793fSmrg		  libobjs="$libobjs $pic_object"
140452f9793fSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
140552f9793fSmrg		fi
140652f9793fSmrg	      fi
140752f9793fSmrg	    done
140852f9793fSmrg	  else
140952f9793fSmrg	    $echo "$modename: link input file \`$save_arg' does not exist"
141052f9793fSmrg	    exit $EXIT_FAILURE
141152f9793fSmrg	  fi
141252f9793fSmrg	  arg=$save_arg
141352f9793fSmrg	  prev=
141452f9793fSmrg	  continue
141552f9793fSmrg	  ;;
141652f9793fSmrg	rpath | xrpath)
141752f9793fSmrg	  # We need an absolute path.
141852f9793fSmrg	  case $arg in
141952f9793fSmrg	  [\\/]* | [A-Za-z]:[\\/]*) ;;
142052f9793fSmrg	  *)
142152f9793fSmrg	    $echo "$modename: only absolute run-paths are allowed" 1>&2
142252f9793fSmrg	    exit $EXIT_FAILURE
142352f9793fSmrg	    ;;
142452f9793fSmrg	  esac
142552f9793fSmrg	  if test "$prev" = rpath; then
142652f9793fSmrg	    case "$rpath " in
142752f9793fSmrg	    *" $arg "*) ;;
142852f9793fSmrg	    *) rpath="$rpath $arg" ;;
142952f9793fSmrg	    esac
143052f9793fSmrg	  else
143152f9793fSmrg	    case "$xrpath " in
143252f9793fSmrg	    *" $arg "*) ;;
143352f9793fSmrg	    *) xrpath="$xrpath $arg" ;;
143452f9793fSmrg	    esac
143552f9793fSmrg	  fi
143652f9793fSmrg	  prev=
143752f9793fSmrg	  continue
143852f9793fSmrg	  ;;
143952f9793fSmrg	xcompiler)
144052f9793fSmrg	  compiler_flags="$compiler_flags $qarg"
144152f9793fSmrg	  prev=
144252f9793fSmrg	  compile_command="$compile_command $qarg"
144352f9793fSmrg	  finalize_command="$finalize_command $qarg"
144452f9793fSmrg	  continue
144552f9793fSmrg	  ;;
144652f9793fSmrg	xlinker)
144752f9793fSmrg	  linker_flags="$linker_flags $qarg"
144852f9793fSmrg	  compiler_flags="$compiler_flags $wl$qarg"
144952f9793fSmrg	  prev=
145052f9793fSmrg	  compile_command="$compile_command $wl$qarg"
145152f9793fSmrg	  finalize_command="$finalize_command $wl$qarg"
145252f9793fSmrg	  continue
145352f9793fSmrg	  ;;
145452f9793fSmrg	xcclinker)
145552f9793fSmrg	  linker_flags="$linker_flags $qarg"
145652f9793fSmrg	  compiler_flags="$compiler_flags $qarg"
145752f9793fSmrg	  prev=
145852f9793fSmrg	  compile_command="$compile_command $qarg"
145952f9793fSmrg	  finalize_command="$finalize_command $qarg"
146052f9793fSmrg	  continue
146152f9793fSmrg	  ;;
146252f9793fSmrg	shrext)
146352f9793fSmrg  	  shrext_cmds="$arg"
146452f9793fSmrg	  prev=
146552f9793fSmrg	  continue
146652f9793fSmrg	  ;;
146752f9793fSmrg	darwin_framework|darwin_framework_skip)
146852f9793fSmrg	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
146952f9793fSmrg	  compile_command="$compile_command $arg"
147052f9793fSmrg	  finalize_command="$finalize_command $arg"
147152f9793fSmrg	  prev=
147252f9793fSmrg	  continue
147352f9793fSmrg	  ;;
147452f9793fSmrg	*)
147552f9793fSmrg	  eval "$prev=\"\$arg\""
147652f9793fSmrg	  prev=
147752f9793fSmrg	  continue
147852f9793fSmrg	  ;;
147952f9793fSmrg	esac
148052f9793fSmrg      fi # test -n "$prev"
148152f9793fSmrg
148252f9793fSmrg      prevarg="$arg"
148352f9793fSmrg
148452f9793fSmrg      case $arg in
148552f9793fSmrg      -all-static)
148652f9793fSmrg	if test -n "$link_static_flag"; then
148752f9793fSmrg	  compile_command="$compile_command $link_static_flag"
148852f9793fSmrg	  finalize_command="$finalize_command $link_static_flag"
148952f9793fSmrg	fi
149052f9793fSmrg	continue
149152f9793fSmrg	;;
149252f9793fSmrg
149352f9793fSmrg      -allow-undefined)
149452f9793fSmrg	# FIXME: remove this flag sometime in the future.
149552f9793fSmrg	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
149652f9793fSmrg	continue
149752f9793fSmrg	;;
149852f9793fSmrg
149952f9793fSmrg      -avoid-version)
150052f9793fSmrg	avoid_version=yes
150152f9793fSmrg	continue
150252f9793fSmrg	;;
150352f9793fSmrg
150452f9793fSmrg      -dlopen)
150552f9793fSmrg	prev=dlfiles
150652f9793fSmrg	continue
150752f9793fSmrg	;;
150852f9793fSmrg
150952f9793fSmrg      -dlpreopen)
151052f9793fSmrg	prev=dlprefiles
151152f9793fSmrg	continue
151252f9793fSmrg	;;
151352f9793fSmrg
151452f9793fSmrg      -export-dynamic)
151552f9793fSmrg	export_dynamic=yes
151652f9793fSmrg	continue
151752f9793fSmrg	;;
151852f9793fSmrg
151952f9793fSmrg      -export-symbols | -export-symbols-regex)
152052f9793fSmrg	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
152152f9793fSmrg	  $echo "$modename: more than one -exported-symbols argument is not allowed"
152252f9793fSmrg	  exit $EXIT_FAILURE
152352f9793fSmrg	fi
152452f9793fSmrg	if test "X$arg" = "X-export-symbols"; then
152552f9793fSmrg	  prev=expsyms
152652f9793fSmrg	else
152752f9793fSmrg	  prev=expsyms_regex
152852f9793fSmrg	fi
152952f9793fSmrg	continue
153052f9793fSmrg	;;
153152f9793fSmrg
153252f9793fSmrg      -framework|-arch|-isysroot)
153352f9793fSmrg	case " $CC " in
153452f9793fSmrg	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
153552f9793fSmrg		prev=darwin_framework_skip ;;
153652f9793fSmrg	  *) compiler_flags="$compiler_flags $arg"
153752f9793fSmrg	     prev=darwin_framework ;;
153852f9793fSmrg	esac
153952f9793fSmrg	compile_command="$compile_command $arg"
154052f9793fSmrg	finalize_command="$finalize_command $arg"
154152f9793fSmrg	continue
154252f9793fSmrg	;;
154352f9793fSmrg
154452f9793fSmrg      -inst-prefix-dir)
154552f9793fSmrg	prev=inst_prefix
154652f9793fSmrg	continue
154752f9793fSmrg	;;
154852f9793fSmrg
154952f9793fSmrg      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
155052f9793fSmrg      # so, if we see these flags be careful not to treat them like -L
155152f9793fSmrg      -L[A-Z][A-Z]*:*)
155252f9793fSmrg	case $with_gcc/$host in
155352f9793fSmrg	no/*-*-irix* | /*-*-irix*)
155452f9793fSmrg	  compile_command="$compile_command $arg"
155552f9793fSmrg	  finalize_command="$finalize_command $arg"
155652f9793fSmrg	  ;;
155752f9793fSmrg	esac
155852f9793fSmrg	continue
155952f9793fSmrg	;;
156052f9793fSmrg
156152f9793fSmrg      -L*)
156252f9793fSmrg	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
156352f9793fSmrg	# We need an absolute path.
156452f9793fSmrg	case $dir in
156552f9793fSmrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
156652f9793fSmrg	*)
156752f9793fSmrg	  absdir=`cd "$dir" && pwd`
156852f9793fSmrg	  if test -z "$absdir"; then
156952f9793fSmrg	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
157052f9793fSmrg	    absdir="$dir"
157152f9793fSmrg	    notinst_path="$notinst_path $dir"
157252f9793fSmrg	  fi
157352f9793fSmrg	  dir="$absdir"
157452f9793fSmrg	  ;;
157552f9793fSmrg	esac
157652f9793fSmrg	case "$deplibs " in
157752f9793fSmrg	*" -L$dir "*) ;;
157852f9793fSmrg	*)
157952f9793fSmrg	  deplibs="$deplibs -L$dir"
158052f9793fSmrg	  lib_search_path="$lib_search_path $dir"
158152f9793fSmrg	  ;;
158252f9793fSmrg	esac
158352f9793fSmrg	case $host in
158452f9793fSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
158552f9793fSmrg	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
158652f9793fSmrg	  case :$dllsearchpath: in
158752f9793fSmrg	  *":$dir:"*) ;;
158852f9793fSmrg	  *) dllsearchpath="$dllsearchpath:$dir";;
158952f9793fSmrg	  esac
159052f9793fSmrg	  case :$dllsearchpath: in
159152f9793fSmrg	  *":$testbindir:"*) ;;
159252f9793fSmrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
159352f9793fSmrg	  esac
159452f9793fSmrg	  ;;
159552f9793fSmrg	esac
159652f9793fSmrg	continue
159752f9793fSmrg	;;
159852f9793fSmrg
159952f9793fSmrg      -l*)
160052f9793fSmrg	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
160152f9793fSmrg	  case $host in
160252f9793fSmrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
160352f9793fSmrg	    # These systems don't actually have a C or math library (as such)
160452f9793fSmrg	    continue
160552f9793fSmrg	    ;;
160652f9793fSmrg	  *-*-os2*)
160752f9793fSmrg	    # These systems don't actually have a C library (as such)
160852f9793fSmrg	    test "X$arg" = "X-lc" && continue
160952f9793fSmrg	    ;;
161052f9793fSmrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
161152f9793fSmrg	    # Do not include libc due to us having libc/libc_r.
161252f9793fSmrg	    test "X$arg" = "X-lc" && continue
161352f9793fSmrg	    ;;
161452f9793fSmrg	  *-*-rhapsody* | *-*-darwin1.[012])
161552f9793fSmrg	    # Rhapsody C and math libraries are in the System framework
161652f9793fSmrg	    deplibs="$deplibs -framework System"
161752f9793fSmrg	    continue
161852f9793fSmrg	    ;;
161952f9793fSmrg	  *-*-sco3.2v5* | *-*-sco5v6*)
162052f9793fSmrg	    # Causes problems with __ctype
162152f9793fSmrg	    test "X$arg" = "X-lc" && continue
162252f9793fSmrg	    ;;
162352f9793fSmrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
162452f9793fSmrg	    # Compiler inserts libc in the correct place for threads to work
162552f9793fSmrg	    test "X$arg" = "X-lc" && continue
162652f9793fSmrg	    ;;
162752f9793fSmrg	  esac
162852f9793fSmrg	elif test "X$arg" = "X-lc_r"; then
162952f9793fSmrg	 case $host in
163052f9793fSmrg	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
163152f9793fSmrg	   # Do not include libc_r directly, use -pthread flag.
163252f9793fSmrg	   continue
163352f9793fSmrg	   ;;
163452f9793fSmrg	 esac
163552f9793fSmrg	fi
163652f9793fSmrg	deplibs="$deplibs $arg"
163752f9793fSmrg	continue
163852f9793fSmrg	;;
163952f9793fSmrg
164052f9793fSmrg      # Tru64 UNIX uses -model [arg] to determine the layout of C++
164152f9793fSmrg      # classes, name mangling, and exception handling.
164252f9793fSmrg      -model)
164352f9793fSmrg	compile_command="$compile_command $arg"
164452f9793fSmrg	compiler_flags="$compiler_flags $arg"
164552f9793fSmrg	finalize_command="$finalize_command $arg"
164652f9793fSmrg	prev=xcompiler
164752f9793fSmrg	continue
164852f9793fSmrg	;;
164952f9793fSmrg
16502faa96e0Smrg     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
165152f9793fSmrg	compiler_flags="$compiler_flags $arg"
165252f9793fSmrg	compile_command="$compile_command $arg"
165352f9793fSmrg	finalize_command="$finalize_command $arg"
165452f9793fSmrg	continue
165552f9793fSmrg	;;
165652f9793fSmrg
16572faa96e0Smrg      -multi_module)
16582faa96e0Smrg	single_module="${wl}-multi_module"
16592faa96e0Smrg	continue
16602faa96e0Smrg	;;
16612faa96e0Smrg
166252f9793fSmrg      -module)
166352f9793fSmrg	module=yes
166452f9793fSmrg	continue
166552f9793fSmrg	;;
166652f9793fSmrg
166752f9793fSmrg      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
166852f9793fSmrg      # -r[0-9][0-9]* specifies the processor on the SGI compiler
166952f9793fSmrg      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
167052f9793fSmrg      # +DA*, +DD* enable 64-bit mode on the HP compiler
167152f9793fSmrg      # -q* pass through compiler args for the IBM compiler
167252f9793fSmrg      # -m* pass through architecture-specific compiler args for GCC
167352f9793fSmrg      # -m*, -t[45]*, -txscale* pass through architecture-specific
167452f9793fSmrg      # compiler args for GCC
16752faa96e0Smrg      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
16762faa96e0Smrg      # -F/path gives path to uninstalled frameworks, gcc on darwin
167752f9793fSmrg      # @file GCC response files
16782faa96e0Smrg      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
16792faa96e0Smrg      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
168052f9793fSmrg
168152f9793fSmrg	# Unknown arguments in both finalize_command and compile_command need
168252f9793fSmrg	# to be aesthetically quoted because they are evaled later.
168352f9793fSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
168452f9793fSmrg	case $arg in
168552f9793fSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
168652f9793fSmrg	  arg="\"$arg\""
168752f9793fSmrg	  ;;
168852f9793fSmrg	esac
168952f9793fSmrg        compile_command="$compile_command $arg"
169052f9793fSmrg        finalize_command="$finalize_command $arg"
169152f9793fSmrg        compiler_flags="$compiler_flags $arg"
169252f9793fSmrg        continue
169352f9793fSmrg        ;;
169452f9793fSmrg
169552f9793fSmrg      -shrext)
169652f9793fSmrg	prev=shrext
169752f9793fSmrg	continue
169852f9793fSmrg	;;
169952f9793fSmrg
170052f9793fSmrg      -no-fast-install)
170152f9793fSmrg	fast_install=no
170252f9793fSmrg	continue
170352f9793fSmrg	;;
170452f9793fSmrg
170552f9793fSmrg      -no-install)
170652f9793fSmrg	case $host in
17072faa96e0Smrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
170852f9793fSmrg	  # The PATH hackery in wrapper scripts is required on Windows
17092faa96e0Smrg	  # and Darwin in order for the loader to find any dlls it needs.
171052f9793fSmrg	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
171152f9793fSmrg	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
171252f9793fSmrg	  fast_install=no
171352f9793fSmrg	  ;;
171452f9793fSmrg	*) no_install=yes ;;
171552f9793fSmrg	esac
171652f9793fSmrg	continue
171752f9793fSmrg	;;
171852f9793fSmrg
171952f9793fSmrg      -no-undefined)
172052f9793fSmrg	allow_undefined=no
172152f9793fSmrg	continue
172252f9793fSmrg	;;
172352f9793fSmrg
172452f9793fSmrg      -objectlist)
172552f9793fSmrg	prev=objectlist
172652f9793fSmrg	continue
172752f9793fSmrg	;;
172852f9793fSmrg
172952f9793fSmrg      -o) prev=output ;;
173052f9793fSmrg
173152f9793fSmrg      -precious-files-regex)
173252f9793fSmrg	prev=precious_regex
173352f9793fSmrg	continue
173452f9793fSmrg	;;
173552f9793fSmrg
173652f9793fSmrg      -release)
173752f9793fSmrg	prev=release
173852f9793fSmrg	continue
173952f9793fSmrg	;;
174052f9793fSmrg
174152f9793fSmrg      -rpath)
174252f9793fSmrg	prev=rpath
174352f9793fSmrg	continue
174452f9793fSmrg	;;
174552f9793fSmrg
174652f9793fSmrg      -R)
174752f9793fSmrg	prev=xrpath
174852f9793fSmrg	continue
174952f9793fSmrg	;;
175052f9793fSmrg
175152f9793fSmrg      -R*)
175252f9793fSmrg	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
175352f9793fSmrg	# We need an absolute path.
175452f9793fSmrg	case $dir in
175552f9793fSmrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
175652f9793fSmrg	*)
175752f9793fSmrg	  $echo "$modename: only absolute run-paths are allowed" 1>&2
175852f9793fSmrg	  exit $EXIT_FAILURE
175952f9793fSmrg	  ;;
176052f9793fSmrg	esac
176152f9793fSmrg	case "$xrpath " in
176252f9793fSmrg	*" $dir "*) ;;
176352f9793fSmrg	*) xrpath="$xrpath $dir" ;;
176452f9793fSmrg	esac
176552f9793fSmrg	continue
176652f9793fSmrg	;;
176752f9793fSmrg
17682faa96e0Smrg      -static | -static-libtool-libs)
176952f9793fSmrg	# The effects of -static are defined in a previous loop.
177052f9793fSmrg	# We used to do the same as -all-static on platforms that
177152f9793fSmrg	# didn't have a PIC flag, but the assumption that the effects
177252f9793fSmrg	# would be equivalent was wrong.  It would break on at least
177352f9793fSmrg	# Digital Unix and AIX.
177452f9793fSmrg	continue
177552f9793fSmrg	;;
177652f9793fSmrg
177752f9793fSmrg      -thread-safe)
177852f9793fSmrg	thread_safe=yes
177952f9793fSmrg	continue
178052f9793fSmrg	;;
178152f9793fSmrg
178252f9793fSmrg      -version-info)
178352f9793fSmrg	prev=vinfo
178452f9793fSmrg	continue
178552f9793fSmrg	;;
178652f9793fSmrg      -version-number)
178752f9793fSmrg	prev=vinfo
178852f9793fSmrg	vinfo_number=yes
178952f9793fSmrg	continue
179052f9793fSmrg	;;
179152f9793fSmrg
179252f9793fSmrg      -Wc,*)
179352f9793fSmrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
179452f9793fSmrg	arg=
179552f9793fSmrg	save_ifs="$IFS"; IFS=','
179652f9793fSmrg	for flag in $args; do
179752f9793fSmrg	  IFS="$save_ifs"
179852f9793fSmrg	  case $flag in
179952f9793fSmrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
180052f9793fSmrg	    flag="\"$flag\""
180152f9793fSmrg	    ;;
180252f9793fSmrg	  esac
180352f9793fSmrg	  arg="$arg $wl$flag"
180452f9793fSmrg	  compiler_flags="$compiler_flags $flag"
180552f9793fSmrg	done
180652f9793fSmrg	IFS="$save_ifs"
180752f9793fSmrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
180852f9793fSmrg	;;
180952f9793fSmrg
181052f9793fSmrg      -Wl,*)
181152f9793fSmrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
181252f9793fSmrg	arg=
181352f9793fSmrg	save_ifs="$IFS"; IFS=','
181452f9793fSmrg	for flag in $args; do
181552f9793fSmrg	  IFS="$save_ifs"
181652f9793fSmrg	  case $flag in
181752f9793fSmrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
181852f9793fSmrg	    flag="\"$flag\""
181952f9793fSmrg	    ;;
182052f9793fSmrg	  esac
182152f9793fSmrg	  arg="$arg $wl$flag"
182252f9793fSmrg	  compiler_flags="$compiler_flags $wl$flag"
182352f9793fSmrg	  linker_flags="$linker_flags $flag"
182452f9793fSmrg	done
182552f9793fSmrg	IFS="$save_ifs"
182652f9793fSmrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
182752f9793fSmrg	;;
182852f9793fSmrg
182952f9793fSmrg      -Xcompiler)
183052f9793fSmrg	prev=xcompiler
183152f9793fSmrg	continue
183252f9793fSmrg	;;
183352f9793fSmrg
183452f9793fSmrg      -Xlinker)
183552f9793fSmrg	prev=xlinker
183652f9793fSmrg	continue
183752f9793fSmrg	;;
183852f9793fSmrg
183952f9793fSmrg      -XCClinker)
184052f9793fSmrg	prev=xcclinker
184152f9793fSmrg	continue
184252f9793fSmrg	;;
184352f9793fSmrg
184452f9793fSmrg      # Some other compiler flag.
184552f9793fSmrg      -* | +*)
184652f9793fSmrg	# Unknown arguments in both finalize_command and compile_command need
184752f9793fSmrg	# to be aesthetically quoted because they are evaled later.
184852f9793fSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
184952f9793fSmrg	case $arg in
185052f9793fSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
185152f9793fSmrg	  arg="\"$arg\""
185252f9793fSmrg	  ;;
185352f9793fSmrg	esac
185452f9793fSmrg	;;
185552f9793fSmrg
185652f9793fSmrg      *.$objext)
185752f9793fSmrg	# A standard object.
185852f9793fSmrg	objs="$objs $arg"
185952f9793fSmrg	;;
186052f9793fSmrg
186152f9793fSmrg      *.lo)
186252f9793fSmrg	# A libtool-controlled object.
186352f9793fSmrg
186452f9793fSmrg	# Check to see that this really is a libtool object.
186552f9793fSmrg	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
186652f9793fSmrg	  pic_object=
186752f9793fSmrg	  non_pic_object=
186852f9793fSmrg
186952f9793fSmrg	  # Read the .lo file
187052f9793fSmrg	  # If there is no directory component, then add one.
187152f9793fSmrg	  case $arg in
187252f9793fSmrg	  */* | *\\*) . $arg ;;
187352f9793fSmrg	  *) . ./$arg ;;
187452f9793fSmrg	  esac
187552f9793fSmrg
187652f9793fSmrg	  if test -z "$pic_object" || \
187752f9793fSmrg	     test -z "$non_pic_object" ||
187852f9793fSmrg	     test "$pic_object" = none && \
187952f9793fSmrg	     test "$non_pic_object" = none; then
188052f9793fSmrg	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
188152f9793fSmrg	    exit $EXIT_FAILURE
188252f9793fSmrg	  fi
188352f9793fSmrg
188452f9793fSmrg	  # Extract subdirectory from the argument.
188552f9793fSmrg	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
188652f9793fSmrg	  if test "X$xdir" = "X$arg"; then
188752f9793fSmrg	    xdir=
188852f9793fSmrg 	  else
188952f9793fSmrg	    xdir="$xdir/"
189052f9793fSmrg	  fi
189152f9793fSmrg
189252f9793fSmrg	  if test "$pic_object" != none; then
189352f9793fSmrg	    # Prepend the subdirectory the object is found in.
189452f9793fSmrg	    pic_object="$xdir$pic_object"
189552f9793fSmrg
189652f9793fSmrg	    if test "$prev" = dlfiles; then
189752f9793fSmrg	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
189852f9793fSmrg		dlfiles="$dlfiles $pic_object"
189952f9793fSmrg		prev=
190052f9793fSmrg		continue
190152f9793fSmrg	      else
190252f9793fSmrg		# If libtool objects are unsupported, then we need to preload.
190352f9793fSmrg		prev=dlprefiles
190452f9793fSmrg	      fi
190552f9793fSmrg	    fi
190652f9793fSmrg
190752f9793fSmrg	    # CHECK ME:  I think I busted this.  -Ossama
190852f9793fSmrg	    if test "$prev" = dlprefiles; then
190952f9793fSmrg	      # Preload the old-style object.
191052f9793fSmrg	      dlprefiles="$dlprefiles $pic_object"
191152f9793fSmrg	      prev=
191252f9793fSmrg	    fi
191352f9793fSmrg
191452f9793fSmrg	    # A PIC object.
191552f9793fSmrg	    libobjs="$libobjs $pic_object"
191652f9793fSmrg	    arg="$pic_object"
191752f9793fSmrg	  fi
191852f9793fSmrg
191952f9793fSmrg	  # Non-PIC object.
192052f9793fSmrg	  if test "$non_pic_object" != none; then
192152f9793fSmrg	    # Prepend the subdirectory the object is found in.
192252f9793fSmrg	    non_pic_object="$xdir$non_pic_object"
192352f9793fSmrg
192452f9793fSmrg	    # A standard non-PIC object
192552f9793fSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
192652f9793fSmrg	    if test -z "$pic_object" || test "$pic_object" = none ; then
192752f9793fSmrg	      arg="$non_pic_object"
192852f9793fSmrg	    fi
192952f9793fSmrg	  else
193052f9793fSmrg	    # If the PIC object exists, use it instead.
193152f9793fSmrg	    # $xdir was prepended to $pic_object above.
193252f9793fSmrg	    non_pic_object="$pic_object"
193352f9793fSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
193452f9793fSmrg	  fi
193552f9793fSmrg	else
193652f9793fSmrg	  # Only an error if not doing a dry-run.
193752f9793fSmrg	  if test -z "$run"; then
193852f9793fSmrg	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
193952f9793fSmrg	    exit $EXIT_FAILURE
194052f9793fSmrg	  else
194152f9793fSmrg	    # Dry-run case.
194252f9793fSmrg
194352f9793fSmrg	    # Extract subdirectory from the argument.
194452f9793fSmrg	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
194552f9793fSmrg	    if test "X$xdir" = "X$arg"; then
194652f9793fSmrg	      xdir=
194752f9793fSmrg	    else
194852f9793fSmrg	      xdir="$xdir/"
194952f9793fSmrg	    fi
195052f9793fSmrg
195152f9793fSmrg	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
195252f9793fSmrg	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
195352f9793fSmrg	    libobjs="$libobjs $pic_object"
195452f9793fSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
195552f9793fSmrg	  fi
195652f9793fSmrg	fi
195752f9793fSmrg	;;
195852f9793fSmrg
195952f9793fSmrg      *.$libext)
196052f9793fSmrg	# An archive.
196152f9793fSmrg	deplibs="$deplibs $arg"
196252f9793fSmrg	old_deplibs="$old_deplibs $arg"
196352f9793fSmrg	continue
196452f9793fSmrg	;;
196552f9793fSmrg
196652f9793fSmrg      *.la)
196752f9793fSmrg	# A libtool-controlled library.
196852f9793fSmrg
196952f9793fSmrg	if test "$prev" = dlfiles; then
197052f9793fSmrg	  # This library was specified with -dlopen.
197152f9793fSmrg	  dlfiles="$dlfiles $arg"
197252f9793fSmrg	  prev=
197352f9793fSmrg	elif test "$prev" = dlprefiles; then
197452f9793fSmrg	  # The library was specified with -dlpreopen.
197552f9793fSmrg	  dlprefiles="$dlprefiles $arg"
197652f9793fSmrg	  prev=
197752f9793fSmrg	else
197852f9793fSmrg	  deplibs="$deplibs $arg"
197952f9793fSmrg	fi
198052f9793fSmrg	continue
198152f9793fSmrg	;;
198252f9793fSmrg
198352f9793fSmrg      # Some other compiler argument.
198452f9793fSmrg      *)
198552f9793fSmrg	# Unknown arguments in both finalize_command and compile_command need
198652f9793fSmrg	# to be aesthetically quoted because they are evaled later.
198752f9793fSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
198852f9793fSmrg	case $arg in
198952f9793fSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
199052f9793fSmrg	  arg="\"$arg\""
199152f9793fSmrg	  ;;
199252f9793fSmrg	esac
199352f9793fSmrg	;;
199452f9793fSmrg      esac # arg
199552f9793fSmrg
199652f9793fSmrg      # Now actually substitute the argument into the commands.
199752f9793fSmrg      if test -n "$arg"; then
199852f9793fSmrg	compile_command="$compile_command $arg"
199952f9793fSmrg	finalize_command="$finalize_command $arg"
200052f9793fSmrg      fi
200152f9793fSmrg    done # argument parsing loop
200252f9793fSmrg
200352f9793fSmrg    if test -n "$prev"; then
200452f9793fSmrg      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
200552f9793fSmrg      $echo "$help" 1>&2
200652f9793fSmrg      exit $EXIT_FAILURE
200752f9793fSmrg    fi
200852f9793fSmrg
200952f9793fSmrg    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
201052f9793fSmrg      eval arg=\"$export_dynamic_flag_spec\"
201152f9793fSmrg      compile_command="$compile_command $arg"
201252f9793fSmrg      finalize_command="$finalize_command $arg"
201352f9793fSmrg    fi
201452f9793fSmrg
201552f9793fSmrg    oldlibs=
201652f9793fSmrg    # calculate the name of the file, without its directory
201752f9793fSmrg    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
201852f9793fSmrg    libobjs_save="$libobjs"
201952f9793fSmrg
202052f9793fSmrg    if test -n "$shlibpath_var"; then
202152f9793fSmrg      # get the directories listed in $shlibpath_var
202252f9793fSmrg      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
202352f9793fSmrg    else
202452f9793fSmrg      shlib_search_path=
202552f9793fSmrg    fi
202652f9793fSmrg    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
202752f9793fSmrg    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
202852f9793fSmrg
202952f9793fSmrg    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
203052f9793fSmrg    if test "X$output_objdir" = "X$output"; then
203152f9793fSmrg      output_objdir="$objdir"
203252f9793fSmrg    else
203352f9793fSmrg      output_objdir="$output_objdir/$objdir"
203452f9793fSmrg    fi
203552f9793fSmrg    # Create the object directory.
203652f9793fSmrg    if test ! -d "$output_objdir"; then
203752f9793fSmrg      $show "$mkdir $output_objdir"
203852f9793fSmrg      $run $mkdir $output_objdir
203952f9793fSmrg      exit_status=$?
204052f9793fSmrg      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
204152f9793fSmrg	exit $exit_status
204252f9793fSmrg      fi
204352f9793fSmrg    fi
204452f9793fSmrg
204552f9793fSmrg    # Determine the type of output
204652f9793fSmrg    case $output in
204752f9793fSmrg    "")
204852f9793fSmrg      $echo "$modename: you must specify an output file" 1>&2
204952f9793fSmrg      $echo "$help" 1>&2
205052f9793fSmrg      exit $EXIT_FAILURE
205152f9793fSmrg      ;;
205252f9793fSmrg    *.$libext) linkmode=oldlib ;;
205352f9793fSmrg    *.lo | *.$objext) linkmode=obj ;;
205452f9793fSmrg    *.la) linkmode=lib ;;
205552f9793fSmrg    *) linkmode=prog ;; # Anything else should be a program.
205652f9793fSmrg    esac
205752f9793fSmrg
205852f9793fSmrg    case $host in
205952f9793fSmrg    *cygwin* | *mingw* | *pw32*)
206052f9793fSmrg      # don't eliminate duplications in $postdeps and $predeps
206152f9793fSmrg      duplicate_compiler_generated_deps=yes
206252f9793fSmrg      ;;
206352f9793fSmrg    *)
206452f9793fSmrg      duplicate_compiler_generated_deps=$duplicate_deps
206552f9793fSmrg      ;;
206652f9793fSmrg    esac
206752f9793fSmrg    specialdeplibs=
206852f9793fSmrg
206952f9793fSmrg    libs=
207052f9793fSmrg    # Find all interdependent deplibs by searching for libraries
207152f9793fSmrg    # that are linked more than once (e.g. -la -lb -la)
207252f9793fSmrg    for deplib in $deplibs; do
207352f9793fSmrg      if test "X$duplicate_deps" = "Xyes" ; then
207452f9793fSmrg	case "$libs " in
207552f9793fSmrg	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
207652f9793fSmrg	esac
207752f9793fSmrg      fi
207852f9793fSmrg      libs="$libs $deplib"
207952f9793fSmrg    done
208052f9793fSmrg
208152f9793fSmrg    if test "$linkmode" = lib; then
208252f9793fSmrg      libs="$predeps $libs $compiler_lib_search_path $postdeps"
208352f9793fSmrg
208452f9793fSmrg      # Compute libraries that are listed more than once in $predeps
208552f9793fSmrg      # $postdeps and mark them as special (i.e., whose duplicates are
208652f9793fSmrg      # not to be eliminated).
208752f9793fSmrg      pre_post_deps=
208852f9793fSmrg      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
208952f9793fSmrg	for pre_post_dep in $predeps $postdeps; do
209052f9793fSmrg	  case "$pre_post_deps " in
209152f9793fSmrg	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
209252f9793fSmrg	  esac
209352f9793fSmrg	  pre_post_deps="$pre_post_deps $pre_post_dep"
209452f9793fSmrg	done
209552f9793fSmrg      fi
209652f9793fSmrg      pre_post_deps=
209752f9793fSmrg    fi
209852f9793fSmrg
209952f9793fSmrg    deplibs=
210052f9793fSmrg    newdependency_libs=
210152f9793fSmrg    newlib_search_path=
210252f9793fSmrg    need_relink=no # whether we're linking any uninstalled libtool libraries
210352f9793fSmrg    notinst_deplibs= # not-installed libtool libraries
210452f9793fSmrg    case $linkmode in
210552f9793fSmrg    lib)
210652f9793fSmrg	passes="conv link"
210752f9793fSmrg	for file in $dlfiles $dlprefiles; do
210852f9793fSmrg	  case $file in
210952f9793fSmrg	  *.la) ;;
211052f9793fSmrg	  *)
211152f9793fSmrg	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
211252f9793fSmrg	    exit $EXIT_FAILURE
211352f9793fSmrg	    ;;
211452f9793fSmrg	  esac
211552f9793fSmrg	done
211652f9793fSmrg	;;
211752f9793fSmrg    prog)
211852f9793fSmrg	compile_deplibs=
211952f9793fSmrg	finalize_deplibs=
212052f9793fSmrg	alldeplibs=no
212152f9793fSmrg	newdlfiles=
212252f9793fSmrg	newdlprefiles=
212352f9793fSmrg	passes="conv scan dlopen dlpreopen link"
212452f9793fSmrg	;;
212552f9793fSmrg    *)  passes="conv"
212652f9793fSmrg	;;
212752f9793fSmrg    esac
212852f9793fSmrg    for pass in $passes; do
212952f9793fSmrg      if test "$linkmode,$pass" = "lib,link" ||
213052f9793fSmrg	 test "$linkmode,$pass" = "prog,scan"; then
213152f9793fSmrg	libs="$deplibs"
213252f9793fSmrg	deplibs=
213352f9793fSmrg      fi
213452f9793fSmrg      if test "$linkmode" = prog; then
213552f9793fSmrg	case $pass in
213652f9793fSmrg	dlopen) libs="$dlfiles" ;;
213752f9793fSmrg	dlpreopen) libs="$dlprefiles" ;;
21382faa96e0Smrg	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
213952f9793fSmrg	esac
214052f9793fSmrg      fi
214152f9793fSmrg      if test "$pass" = dlopen; then
214252f9793fSmrg	# Collect dlpreopened libraries
214352f9793fSmrg	save_deplibs="$deplibs"
214452f9793fSmrg	deplibs=
214552f9793fSmrg      fi
214652f9793fSmrg      for deplib in $libs; do
214752f9793fSmrg	lib=
214852f9793fSmrg	found=no
214952f9793fSmrg	case $deplib in
21502faa96e0Smrg	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
215152f9793fSmrg	  if test "$linkmode,$pass" = "prog,link"; then
215252f9793fSmrg	    compile_deplibs="$deplib $compile_deplibs"
215352f9793fSmrg	    finalize_deplibs="$deplib $finalize_deplibs"
215452f9793fSmrg	  else
215552f9793fSmrg	    compiler_flags="$compiler_flags $deplib"
215652f9793fSmrg	  fi
215752f9793fSmrg	  continue
215852f9793fSmrg	  ;;
215952f9793fSmrg	-l*)
216052f9793fSmrg	  if test "$linkmode" != lib && test "$linkmode" != prog; then
216152f9793fSmrg	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
216252f9793fSmrg	    continue
216352f9793fSmrg	  fi
216452f9793fSmrg	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
21652faa96e0Smrg	  if test "$linkmode" = lib; then
21662faa96e0Smrg	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
21672faa96e0Smrg	  else
21682faa96e0Smrg	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
21692faa96e0Smrg	  fi
21702faa96e0Smrg	  for searchdir in $searchdirs; do
217152f9793fSmrg	    for search_ext in .la $std_shrext .so .a; do
217252f9793fSmrg	      # Search the libtool library
217352f9793fSmrg	      lib="$searchdir/lib${name}${search_ext}"
217452f9793fSmrg	      if test -f "$lib"; then
217552f9793fSmrg		if test "$search_ext" = ".la"; then
217652f9793fSmrg		  found=yes
217752f9793fSmrg		else
217852f9793fSmrg		  found=no
217952f9793fSmrg		fi
218052f9793fSmrg		break 2
218152f9793fSmrg	      fi
218252f9793fSmrg	    done
218352f9793fSmrg	  done
218452f9793fSmrg	  if test "$found" != yes; then
218552f9793fSmrg	    # deplib doesn't seem to be a libtool library
218652f9793fSmrg	    if test "$linkmode,$pass" = "prog,link"; then
218752f9793fSmrg	      compile_deplibs="$deplib $compile_deplibs"
218852f9793fSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
218952f9793fSmrg	    else
219052f9793fSmrg	      deplibs="$deplib $deplibs"
219152f9793fSmrg	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
219252f9793fSmrg	    fi
219352f9793fSmrg	    continue
219452f9793fSmrg	  else # deplib is a libtool library
219552f9793fSmrg	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
219652f9793fSmrg	    # We need to do some special things here, and not later.
219752f9793fSmrg	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
219852f9793fSmrg	      case " $predeps $postdeps " in
219952f9793fSmrg	      *" $deplib "*)
220052f9793fSmrg		if (${SED} -e '2q' $lib |
220152f9793fSmrg                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
220252f9793fSmrg		  library_names=
220352f9793fSmrg		  old_library=
220452f9793fSmrg		  case $lib in
220552f9793fSmrg		  */* | *\\*) . $lib ;;
220652f9793fSmrg		  *) . ./$lib ;;
220752f9793fSmrg		  esac
220852f9793fSmrg		  for l in $old_library $library_names; do
220952f9793fSmrg		    ll="$l"
221052f9793fSmrg		  done
221152f9793fSmrg		  if test "X$ll" = "X$old_library" ; then # only static version available
221252f9793fSmrg		    found=no
221352f9793fSmrg		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
221452f9793fSmrg		    test "X$ladir" = "X$lib" && ladir="."
221552f9793fSmrg		    lib=$ladir/$old_library
221652f9793fSmrg		    if test "$linkmode,$pass" = "prog,link"; then
221752f9793fSmrg		      compile_deplibs="$deplib $compile_deplibs"
221852f9793fSmrg		      finalize_deplibs="$deplib $finalize_deplibs"
221952f9793fSmrg		    else
222052f9793fSmrg		      deplibs="$deplib $deplibs"
222152f9793fSmrg		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
222252f9793fSmrg		    fi
222352f9793fSmrg		    continue
222452f9793fSmrg		  fi
222552f9793fSmrg		fi
222652f9793fSmrg	        ;;
222752f9793fSmrg	      *) ;;
222852f9793fSmrg	      esac
222952f9793fSmrg	    fi
223052f9793fSmrg	  fi
223152f9793fSmrg	  ;; # -l
223252f9793fSmrg	-L*)
223352f9793fSmrg	  case $linkmode in
223452f9793fSmrg	  lib)
223552f9793fSmrg	    deplibs="$deplib $deplibs"
223652f9793fSmrg	    test "$pass" = conv && continue
223752f9793fSmrg	    newdependency_libs="$deplib $newdependency_libs"
223852f9793fSmrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
223952f9793fSmrg	    ;;
224052f9793fSmrg	  prog)
224152f9793fSmrg	    if test "$pass" = conv; then
224252f9793fSmrg	      deplibs="$deplib $deplibs"
224352f9793fSmrg	      continue
224452f9793fSmrg	    fi
224552f9793fSmrg	    if test "$pass" = scan; then
224652f9793fSmrg	      deplibs="$deplib $deplibs"
224752f9793fSmrg	    else
224852f9793fSmrg	      compile_deplibs="$deplib $compile_deplibs"
224952f9793fSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
225052f9793fSmrg	    fi
225152f9793fSmrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
225252f9793fSmrg	    ;;
225352f9793fSmrg	  *)
225452f9793fSmrg	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
225552f9793fSmrg	    ;;
225652f9793fSmrg	  esac # linkmode
225752f9793fSmrg	  continue
225852f9793fSmrg	  ;; # -L
225952f9793fSmrg	-R*)
226052f9793fSmrg	  if test "$pass" = link; then
226152f9793fSmrg	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
226252f9793fSmrg	    # Make sure the xrpath contains only unique directories.
226352f9793fSmrg	    case "$xrpath " in
226452f9793fSmrg	    *" $dir "*) ;;
226552f9793fSmrg	    *) xrpath="$xrpath $dir" ;;
226652f9793fSmrg	    esac
226752f9793fSmrg	  fi
226852f9793fSmrg	  deplibs="$deplib $deplibs"
226952f9793fSmrg	  continue
227052f9793fSmrg	  ;;
227152f9793fSmrg	*.la) lib="$deplib" ;;
227252f9793fSmrg	*.$libext)
227352f9793fSmrg	  if test "$pass" = conv; then
227452f9793fSmrg	    deplibs="$deplib $deplibs"
227552f9793fSmrg	    continue
227652f9793fSmrg	  fi
227752f9793fSmrg	  case $linkmode in
227852f9793fSmrg	  lib)
227952f9793fSmrg	    valid_a_lib=no
228052f9793fSmrg	    case $deplibs_check_method in
228152f9793fSmrg	      match_pattern*)
228252f9793fSmrg		set dummy $deplibs_check_method
228352f9793fSmrg	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
228452f9793fSmrg		if eval $echo \"$deplib\" 2>/dev/null \
228552f9793fSmrg		    | $SED 10q \
228652f9793fSmrg		    | $EGREP "$match_pattern_regex" > /dev/null; then
228752f9793fSmrg		  valid_a_lib=yes
228852f9793fSmrg		fi
228952f9793fSmrg		;;
229052f9793fSmrg	      pass_all)
229152f9793fSmrg		valid_a_lib=yes
229252f9793fSmrg		;;
229352f9793fSmrg            esac
229452f9793fSmrg	    if test "$valid_a_lib" != yes; then
229552f9793fSmrg	      $echo
229652f9793fSmrg	      $echo "*** Warning: Trying to link with static lib archive $deplib."
229752f9793fSmrg	      $echo "*** I have the capability to make that library automatically link in when"
229852f9793fSmrg	      $echo "*** you link to this library.  But I can only do this if you have a"
229952f9793fSmrg	      $echo "*** shared version of the library, which you do not appear to have"
230052f9793fSmrg	      $echo "*** because the file extensions .$libext of this argument makes me believe"
230152f9793fSmrg	      $echo "*** that it is just a static archive that I should not used here."
230252f9793fSmrg	    else
230352f9793fSmrg	      $echo
230452f9793fSmrg	      $echo "*** Warning: Linking the shared library $output against the"
230552f9793fSmrg	      $echo "*** static library $deplib is not portable!"
230652f9793fSmrg	      deplibs="$deplib $deplibs"
230752f9793fSmrg	    fi
230852f9793fSmrg	    continue
230952f9793fSmrg	    ;;
231052f9793fSmrg	  prog)
231152f9793fSmrg	    if test "$pass" != link; then
231252f9793fSmrg	      deplibs="$deplib $deplibs"
231352f9793fSmrg	    else
231452f9793fSmrg	      compile_deplibs="$deplib $compile_deplibs"
231552f9793fSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
231652f9793fSmrg	    fi
231752f9793fSmrg	    continue
231852f9793fSmrg	    ;;
231952f9793fSmrg	  esac # linkmode
232052f9793fSmrg	  ;; # *.$libext
232152f9793fSmrg	*.lo | *.$objext)
232252f9793fSmrg	  if test "$pass" = conv; then
232352f9793fSmrg	    deplibs="$deplib $deplibs"
232452f9793fSmrg	  elif test "$linkmode" = prog; then
232552f9793fSmrg	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
232652f9793fSmrg	      # If there is no dlopen support or we're linking statically,
232752f9793fSmrg	      # we need to preload.
232852f9793fSmrg	      newdlprefiles="$newdlprefiles $deplib"
232952f9793fSmrg	      compile_deplibs="$deplib $compile_deplibs"
233052f9793fSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
233152f9793fSmrg	    else
233252f9793fSmrg	      newdlfiles="$newdlfiles $deplib"
233352f9793fSmrg	    fi
233452f9793fSmrg	  fi
233552f9793fSmrg	  continue
233652f9793fSmrg	  ;;
233752f9793fSmrg	%DEPLIBS%)
233852f9793fSmrg	  alldeplibs=yes
233952f9793fSmrg	  continue
234052f9793fSmrg	  ;;
234152f9793fSmrg	esac # case $deplib
234252f9793fSmrg	if test "$found" = yes || test -f "$lib"; then :
234352f9793fSmrg	else
234452f9793fSmrg	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
234552f9793fSmrg	  exit $EXIT_FAILURE
234652f9793fSmrg	fi
234752f9793fSmrg
234852f9793fSmrg	# Check to see that this really is a libtool archive.
234952f9793fSmrg	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
235052f9793fSmrg	else
235152f9793fSmrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
235252f9793fSmrg	  exit $EXIT_FAILURE
235352f9793fSmrg	fi
235452f9793fSmrg
235552f9793fSmrg	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
235652f9793fSmrg	test "X$ladir" = "X$lib" && ladir="."
235752f9793fSmrg
235852f9793fSmrg	dlname=
235952f9793fSmrg	dlopen=
236052f9793fSmrg	dlpreopen=
236152f9793fSmrg	libdir=
236252f9793fSmrg	library_names=
236352f9793fSmrg	old_library=
236452f9793fSmrg	# If the library was installed with an old release of libtool,
236552f9793fSmrg	# it will not redefine variables installed, or shouldnotlink
236652f9793fSmrg	installed=yes
236752f9793fSmrg	shouldnotlink=no
236852f9793fSmrg	avoidtemprpath=
236952f9793fSmrg
237052f9793fSmrg
237152f9793fSmrg	# Read the .la file
237252f9793fSmrg	case $lib in
237352f9793fSmrg	*/* | *\\*) . $lib ;;
237452f9793fSmrg	*) . ./$lib ;;
237552f9793fSmrg	esac
237652f9793fSmrg
237752f9793fSmrg	if test "$linkmode,$pass" = "lib,link" ||
237852f9793fSmrg	   test "$linkmode,$pass" = "prog,scan" ||
237952f9793fSmrg	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
238052f9793fSmrg	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
238152f9793fSmrg	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
238252f9793fSmrg	fi
238352f9793fSmrg
238452f9793fSmrg	if test "$pass" = conv; then
238552f9793fSmrg	  # Only check for convenience libraries
238652f9793fSmrg	  deplibs="$lib $deplibs"
238752f9793fSmrg	  if test -z "$libdir"; then
238852f9793fSmrg	    if test -z "$old_library"; then
238952f9793fSmrg	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
239052f9793fSmrg	      exit $EXIT_FAILURE
239152f9793fSmrg	    fi
239252f9793fSmrg	    # It is a libtool convenience library, so add in its objects.
239352f9793fSmrg	    convenience="$convenience $ladir/$objdir/$old_library"
239452f9793fSmrg	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
239552f9793fSmrg	    tmp_libs=
239652f9793fSmrg	    for deplib in $dependency_libs; do
239752f9793fSmrg	      deplibs="$deplib $deplibs"
239852f9793fSmrg              if test "X$duplicate_deps" = "Xyes" ; then
239952f9793fSmrg	        case "$tmp_libs " in
240052f9793fSmrg	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
240152f9793fSmrg	        esac
240252f9793fSmrg              fi
240352f9793fSmrg	      tmp_libs="$tmp_libs $deplib"
240452f9793fSmrg	    done
240552f9793fSmrg	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
240652f9793fSmrg	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
240752f9793fSmrg	    exit $EXIT_FAILURE
240852f9793fSmrg	  fi
240952f9793fSmrg	  continue
241052f9793fSmrg	fi # $pass = conv
241152f9793fSmrg
241252f9793fSmrg
241352f9793fSmrg	# Get the name of the library we link against.
241452f9793fSmrg	linklib=
241552f9793fSmrg	for l in $old_library $library_names; do
241652f9793fSmrg	  linklib="$l"
241752f9793fSmrg	done
241852f9793fSmrg	if test -z "$linklib"; then
241952f9793fSmrg	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
242052f9793fSmrg	  exit $EXIT_FAILURE
242152f9793fSmrg	fi
242252f9793fSmrg
242352f9793fSmrg	# This library was specified with -dlopen.
242452f9793fSmrg	if test "$pass" = dlopen; then
242552f9793fSmrg	  if test -z "$libdir"; then
242652f9793fSmrg	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
242752f9793fSmrg	    exit $EXIT_FAILURE
242852f9793fSmrg	  fi
242952f9793fSmrg	  if test -z "$dlname" ||
243052f9793fSmrg	     test "$dlopen_support" != yes ||
243152f9793fSmrg	     test "$build_libtool_libs" = no; then
243252f9793fSmrg	    # If there is no dlname, no dlopen support or we're linking
243352f9793fSmrg	    # statically, we need to preload.  We also need to preload any
243452f9793fSmrg	    # dependent libraries so libltdl's deplib preloader doesn't
243552f9793fSmrg	    # bomb out in the load deplibs phase.
243652f9793fSmrg	    dlprefiles="$dlprefiles $lib $dependency_libs"
243752f9793fSmrg	  else
243852f9793fSmrg	    newdlfiles="$newdlfiles $lib"
243952f9793fSmrg	  fi
244052f9793fSmrg	  continue
244152f9793fSmrg	fi # $pass = dlopen
244252f9793fSmrg
244352f9793fSmrg	# We need an absolute path.
244452f9793fSmrg	case $ladir in
244552f9793fSmrg	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
244652f9793fSmrg	*)
244752f9793fSmrg	  abs_ladir=`cd "$ladir" && pwd`
244852f9793fSmrg	  if test -z "$abs_ladir"; then
244952f9793fSmrg	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
245052f9793fSmrg	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
245152f9793fSmrg	    abs_ladir="$ladir"
245252f9793fSmrg	  fi
245352f9793fSmrg	  ;;
245452f9793fSmrg	esac
245552f9793fSmrg	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
245652f9793fSmrg
245752f9793fSmrg	# Find the relevant object directory and library name.
245852f9793fSmrg	if test "X$installed" = Xyes; then
245952f9793fSmrg	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
246052f9793fSmrg	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
246152f9793fSmrg	    dir="$ladir"
246252f9793fSmrg	    absdir="$abs_ladir"
246352f9793fSmrg	    libdir="$abs_ladir"
246452f9793fSmrg	  else
246552f9793fSmrg	    dir="$libdir"
246652f9793fSmrg	    absdir="$libdir"
246752f9793fSmrg	  fi
246852f9793fSmrg	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
246952f9793fSmrg	else
247052f9793fSmrg	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
247152f9793fSmrg	    dir="$ladir"
247252f9793fSmrg	    absdir="$abs_ladir"
247352f9793fSmrg	    # Remove this search path later
247452f9793fSmrg	    notinst_path="$notinst_path $abs_ladir"
247552f9793fSmrg	  else
247652f9793fSmrg	    dir="$ladir/$objdir"
247752f9793fSmrg	    absdir="$abs_ladir/$objdir"
247852f9793fSmrg	    # Remove this search path later
247952f9793fSmrg	    notinst_path="$notinst_path $abs_ladir"
248052f9793fSmrg	  fi
248152f9793fSmrg	fi # $installed = yes
248252f9793fSmrg	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
248352f9793fSmrg
248452f9793fSmrg	# This library was specified with -dlpreopen.
248552f9793fSmrg	if test "$pass" = dlpreopen; then
248652f9793fSmrg	  if test -z "$libdir"; then
248752f9793fSmrg	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
248852f9793fSmrg	    exit $EXIT_FAILURE
248952f9793fSmrg	  fi
249052f9793fSmrg	  # Prefer using a static library (so that no silly _DYNAMIC symbols
249152f9793fSmrg	  # are required to link).
249252f9793fSmrg	  if test -n "$old_library"; then
249352f9793fSmrg	    newdlprefiles="$newdlprefiles $dir/$old_library"
249452f9793fSmrg	  # Otherwise, use the dlname, so that lt_dlopen finds it.
249552f9793fSmrg	  elif test -n "$dlname"; then
249652f9793fSmrg	    newdlprefiles="$newdlprefiles $dir/$dlname"
249752f9793fSmrg	  else
249852f9793fSmrg	    newdlprefiles="$newdlprefiles $dir/$linklib"
249952f9793fSmrg	  fi
250052f9793fSmrg	fi # $pass = dlpreopen
250152f9793fSmrg
250252f9793fSmrg	if test -z "$libdir"; then
250352f9793fSmrg	  # Link the convenience library
250452f9793fSmrg	  if test "$linkmode" = lib; then
250552f9793fSmrg	    deplibs="$dir/$old_library $deplibs"
250652f9793fSmrg	  elif test "$linkmode,$pass" = "prog,link"; then
250752f9793fSmrg	    compile_deplibs="$dir/$old_library $compile_deplibs"
250852f9793fSmrg	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
250952f9793fSmrg	  else
251052f9793fSmrg	    deplibs="$lib $deplibs" # used for prog,scan pass
251152f9793fSmrg	  fi
251252f9793fSmrg	  continue
251352f9793fSmrg	fi
251452f9793fSmrg
251552f9793fSmrg
251652f9793fSmrg	if test "$linkmode" = prog && test "$pass" != link; then
251752f9793fSmrg	  newlib_search_path="$newlib_search_path $ladir"
251852f9793fSmrg	  deplibs="$lib $deplibs"
251952f9793fSmrg
252052f9793fSmrg	  linkalldeplibs=no
252152f9793fSmrg	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
252252f9793fSmrg	     test "$build_libtool_libs" = no; then
252352f9793fSmrg	    linkalldeplibs=yes
252452f9793fSmrg	  fi
252552f9793fSmrg
252652f9793fSmrg	  tmp_libs=
252752f9793fSmrg	  for deplib in $dependency_libs; do
252852f9793fSmrg	    case $deplib in
252952f9793fSmrg	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
253052f9793fSmrg	    esac
253152f9793fSmrg	    # Need to link against all dependency_libs?
253252f9793fSmrg	    if test "$linkalldeplibs" = yes; then
253352f9793fSmrg	      deplibs="$deplib $deplibs"
253452f9793fSmrg	    else
253552f9793fSmrg	      # Need to hardcode shared library paths
253652f9793fSmrg	      # or/and link against static libraries
253752f9793fSmrg	      newdependency_libs="$deplib $newdependency_libs"
253852f9793fSmrg	    fi
253952f9793fSmrg	    if test "X$duplicate_deps" = "Xyes" ; then
254052f9793fSmrg	      case "$tmp_libs " in
254152f9793fSmrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
254252f9793fSmrg	      esac
254352f9793fSmrg	    fi
254452f9793fSmrg	    tmp_libs="$tmp_libs $deplib"
254552f9793fSmrg	  done # for deplib
254652f9793fSmrg	  continue
254752f9793fSmrg	fi # $linkmode = prog...
254852f9793fSmrg
254952f9793fSmrg	if test "$linkmode,$pass" = "prog,link"; then
255052f9793fSmrg	  if test -n "$library_names" &&
25512faa96e0Smrg	     { { test "$prefer_static_libs" = no ||
25522faa96e0Smrg		 test "$prefer_static_libs,$installed" = "built,yes"; } ||
25532faa96e0Smrg	       test -z "$old_library"; }; then
255452f9793fSmrg	    # We need to hardcode the library path
255552f9793fSmrg	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
255652f9793fSmrg	      # Make sure the rpath contains only unique directories.
255752f9793fSmrg	      case "$temp_rpath " in
255852f9793fSmrg	      *" $dir "*) ;;
255952f9793fSmrg	      *" $absdir "*) ;;
256052f9793fSmrg	      *) temp_rpath="$temp_rpath $absdir" ;;
256152f9793fSmrg	      esac
256252f9793fSmrg	    fi
256352f9793fSmrg
256452f9793fSmrg	    # Hardcode the library path.
256552f9793fSmrg	    # Skip directories that are in the system default run-time
256652f9793fSmrg	    # search path.
256752f9793fSmrg	    case " $sys_lib_dlsearch_path " in
256852f9793fSmrg	    *" $absdir "*) ;;
256952f9793fSmrg	    *)
257052f9793fSmrg	      case "$compile_rpath " in
257152f9793fSmrg	      *" $absdir "*) ;;
257252f9793fSmrg	      *) compile_rpath="$compile_rpath $absdir"
257352f9793fSmrg	      esac
257452f9793fSmrg	      ;;
257552f9793fSmrg	    esac
257652f9793fSmrg	    case " $sys_lib_dlsearch_path " in
257752f9793fSmrg	    *" $libdir "*) ;;
257852f9793fSmrg	    *)
257952f9793fSmrg	      case "$finalize_rpath " in
258052f9793fSmrg	      *" $libdir "*) ;;
258152f9793fSmrg	      *) finalize_rpath="$finalize_rpath $libdir"
258252f9793fSmrg	      esac
258352f9793fSmrg	      ;;
258452f9793fSmrg	    esac
258552f9793fSmrg	  fi # $linkmode,$pass = prog,link...
258652f9793fSmrg
258752f9793fSmrg	  if test "$alldeplibs" = yes &&
258852f9793fSmrg	     { test "$deplibs_check_method" = pass_all ||
258952f9793fSmrg	       { test "$build_libtool_libs" = yes &&
259052f9793fSmrg		 test -n "$library_names"; }; }; then
259152f9793fSmrg	    # We only need to search for static libraries
259252f9793fSmrg	    continue
259352f9793fSmrg	  fi
259452f9793fSmrg	fi
259552f9793fSmrg
259652f9793fSmrg	link_static=no # Whether the deplib will be linked statically
259752f9793fSmrg	use_static_libs=$prefer_static_libs
259852f9793fSmrg	if test "$use_static_libs" = built && test "$installed" = yes ; then
259952f9793fSmrg	  use_static_libs=no
260052f9793fSmrg	fi
260152f9793fSmrg	if test -n "$library_names" &&
260252f9793fSmrg	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
260352f9793fSmrg	  if test "$installed" = no; then
260452f9793fSmrg	    notinst_deplibs="$notinst_deplibs $lib"
260552f9793fSmrg	    need_relink=yes
260652f9793fSmrg	  fi
260752f9793fSmrg	  # This is a shared library
260852f9793fSmrg
260952f9793fSmrg	  # Warn about portability, can't link against -module's on
261052f9793fSmrg	  # some systems (darwin)
261152f9793fSmrg	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
261252f9793fSmrg	    $echo
261352f9793fSmrg	    if test "$linkmode" = prog; then
261452f9793fSmrg	      $echo "*** Warning: Linking the executable $output against the loadable module"
261552f9793fSmrg	    else
261652f9793fSmrg	      $echo "*** Warning: Linking the shared library $output against the loadable module"
261752f9793fSmrg	    fi
261852f9793fSmrg	    $echo "*** $linklib is not portable!"
261952f9793fSmrg	  fi
262052f9793fSmrg	  if test "$linkmode" = lib &&
262152f9793fSmrg	     test "$hardcode_into_libs" = yes; then
262252f9793fSmrg	    # Hardcode the library path.
262352f9793fSmrg	    # Skip directories that are in the system default run-time
262452f9793fSmrg	    # search path.
262552f9793fSmrg	    case " $sys_lib_dlsearch_path " in
262652f9793fSmrg	    *" $absdir "*) ;;
262752f9793fSmrg	    *)
262852f9793fSmrg	      case "$compile_rpath " in
262952f9793fSmrg	      *" $absdir "*) ;;
263052f9793fSmrg	      *) compile_rpath="$compile_rpath $absdir"
263152f9793fSmrg	      esac
263252f9793fSmrg	      ;;
263352f9793fSmrg	    esac
263452f9793fSmrg	    case " $sys_lib_dlsearch_path " in
263552f9793fSmrg	    *" $libdir "*) ;;
263652f9793fSmrg	    *)
263752f9793fSmrg	      case "$finalize_rpath " in
263852f9793fSmrg	      *" $libdir "*) ;;
263952f9793fSmrg	      *) finalize_rpath="$finalize_rpath $libdir"
264052f9793fSmrg	      esac
264152f9793fSmrg	      ;;
264252f9793fSmrg	    esac
264352f9793fSmrg	  fi
264452f9793fSmrg
264552f9793fSmrg	  if test -n "$old_archive_from_expsyms_cmds"; then
264652f9793fSmrg	    # figure out the soname
264752f9793fSmrg	    set dummy $library_names
264852f9793fSmrg	    realname="$2"
264952f9793fSmrg	    shift; shift
265052f9793fSmrg	    libname=`eval \\$echo \"$libname_spec\"`
265152f9793fSmrg	    # use dlname if we got it. it's perfectly good, no?
265252f9793fSmrg	    if test -n "$dlname"; then
265352f9793fSmrg	      soname="$dlname"
265452f9793fSmrg	    elif test -n "$soname_spec"; then
265552f9793fSmrg	      # bleh windows
265652f9793fSmrg	      case $host in
265752f9793fSmrg	      *cygwin* | mingw*)
265852f9793fSmrg		major=`expr $current - $age`
265952f9793fSmrg		versuffix="-$major"
266052f9793fSmrg		;;
266152f9793fSmrg	      esac
266252f9793fSmrg	      eval soname=\"$soname_spec\"
266352f9793fSmrg	    else
266452f9793fSmrg	      soname="$realname"
266552f9793fSmrg	    fi
266652f9793fSmrg
266752f9793fSmrg	    # Make a new name for the extract_expsyms_cmds to use
266852f9793fSmrg	    soroot="$soname"
266952f9793fSmrg	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
267052f9793fSmrg	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
267152f9793fSmrg
267252f9793fSmrg	    # If the library has no export list, then create one now
267352f9793fSmrg	    if test -f "$output_objdir/$soname-def"; then :
267452f9793fSmrg	    else
267552f9793fSmrg	      $show "extracting exported symbol list from \`$soname'"
267652f9793fSmrg	      save_ifs="$IFS"; IFS='~'
267752f9793fSmrg	      cmds=$extract_expsyms_cmds
267852f9793fSmrg	      for cmd in $cmds; do
267952f9793fSmrg		IFS="$save_ifs"
268052f9793fSmrg		eval cmd=\"$cmd\"
268152f9793fSmrg		$show "$cmd"
268252f9793fSmrg		$run eval "$cmd" || exit $?
268352f9793fSmrg	      done
268452f9793fSmrg	      IFS="$save_ifs"
268552f9793fSmrg	    fi
268652f9793fSmrg
268752f9793fSmrg	    # Create $newlib
268852f9793fSmrg	    if test -f "$output_objdir/$newlib"; then :; else
268952f9793fSmrg	      $show "generating import library for \`$soname'"
269052f9793fSmrg	      save_ifs="$IFS"; IFS='~'
269152f9793fSmrg	      cmds=$old_archive_from_expsyms_cmds
269252f9793fSmrg	      for cmd in $cmds; do
269352f9793fSmrg		IFS="$save_ifs"
269452f9793fSmrg		eval cmd=\"$cmd\"
269552f9793fSmrg		$show "$cmd"
269652f9793fSmrg		$run eval "$cmd" || exit $?
269752f9793fSmrg	      done
269852f9793fSmrg	      IFS="$save_ifs"
269952f9793fSmrg	    fi
270052f9793fSmrg	    # make sure the library variables are pointing to the new library
270152f9793fSmrg	    dir=$output_objdir
270252f9793fSmrg	    linklib=$newlib
270352f9793fSmrg	  fi # test -n "$old_archive_from_expsyms_cmds"
270452f9793fSmrg
270552f9793fSmrg	  if test "$linkmode" = prog || test "$mode" != relink; then
270652f9793fSmrg	    add_shlibpath=
270752f9793fSmrg	    add_dir=
270852f9793fSmrg	    add=
270952f9793fSmrg	    lib_linked=yes
271052f9793fSmrg	    case $hardcode_action in
271152f9793fSmrg	    immediate | unsupported)
271252f9793fSmrg	      if test "$hardcode_direct" = no; then
271352f9793fSmrg		add="$dir/$linklib"
271452f9793fSmrg		case $host in
271552f9793fSmrg		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
271652f9793fSmrg		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
271752f9793fSmrg		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
271852f9793fSmrg		    *-*-unixware7*) add_dir="-L$dir" ;;
271952f9793fSmrg		  *-*-darwin* )
272052f9793fSmrg		    # if the lib is a module then we can not link against
272152f9793fSmrg		    # it, someone is ignoring the new warnings I added
272252f9793fSmrg		    if /usr/bin/file -L $add 2> /dev/null |
272352f9793fSmrg                      $EGREP ": [^:]* bundle" >/dev/null ; then
272452f9793fSmrg		      $echo "** Warning, lib $linklib is a module, not a shared library"
272552f9793fSmrg		      if test -z "$old_library" ; then
272652f9793fSmrg		        $echo
272752f9793fSmrg		        $echo "** And there doesn't seem to be a static archive available"
272852f9793fSmrg		        $echo "** The link will probably fail, sorry"
272952f9793fSmrg		      else
273052f9793fSmrg		        add="$dir/$old_library"
273152f9793fSmrg		      fi
273252f9793fSmrg		    fi
273352f9793fSmrg		esac
273452f9793fSmrg	      elif test "$hardcode_minus_L" = no; then
273552f9793fSmrg		case $host in
273652f9793fSmrg		*-*-sunos*) add_shlibpath="$dir" ;;
273752f9793fSmrg		esac
273852f9793fSmrg		add_dir="-L$dir"
273952f9793fSmrg		add="-l$name"
274052f9793fSmrg	      elif test "$hardcode_shlibpath_var" = no; then
274152f9793fSmrg		add_shlibpath="$dir"
274252f9793fSmrg		add="-l$name"
274352f9793fSmrg	      else
274452f9793fSmrg		lib_linked=no
274552f9793fSmrg	      fi
274652f9793fSmrg	      ;;
274752f9793fSmrg	    relink)
274852f9793fSmrg	      if test "$hardcode_direct" = yes; then
274952f9793fSmrg		add="$dir/$linklib"
275052f9793fSmrg	      elif test "$hardcode_minus_L" = yes; then
275152f9793fSmrg		add_dir="-L$dir"
275252f9793fSmrg		# Try looking first in the location we're being installed to.
275352f9793fSmrg		if test -n "$inst_prefix_dir"; then
275452f9793fSmrg		  case $libdir in
275552f9793fSmrg		    [\\/]*)
275652f9793fSmrg		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
275752f9793fSmrg		      ;;
275852f9793fSmrg		  esac
275952f9793fSmrg		fi
276052f9793fSmrg		add="-l$name"
276152f9793fSmrg	      elif test "$hardcode_shlibpath_var" = yes; then
276252f9793fSmrg		add_shlibpath="$dir"
276352f9793fSmrg		add="-l$name"
276452f9793fSmrg	      else
276552f9793fSmrg		lib_linked=no
276652f9793fSmrg	      fi
276752f9793fSmrg	      ;;
276852f9793fSmrg	    *) lib_linked=no ;;
276952f9793fSmrg	    esac
277052f9793fSmrg
277152f9793fSmrg	    if test "$lib_linked" != yes; then
277252f9793fSmrg	      $echo "$modename: configuration error: unsupported hardcode properties"
277352f9793fSmrg	      exit $EXIT_FAILURE
277452f9793fSmrg	    fi
277552f9793fSmrg
277652f9793fSmrg	    if test -n "$add_shlibpath"; then
277752f9793fSmrg	      case :$compile_shlibpath: in
277852f9793fSmrg	      *":$add_shlibpath:"*) ;;
277952f9793fSmrg	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
278052f9793fSmrg	      esac
278152f9793fSmrg	    fi
278252f9793fSmrg	    if test "$linkmode" = prog; then
278352f9793fSmrg	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
278452f9793fSmrg	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
278552f9793fSmrg	    else
278652f9793fSmrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
278752f9793fSmrg	      test -n "$add" && deplibs="$add $deplibs"
278852f9793fSmrg	      if test "$hardcode_direct" != yes && \
278952f9793fSmrg		 test "$hardcode_minus_L" != yes && \
279052f9793fSmrg		 test "$hardcode_shlibpath_var" = yes; then
279152f9793fSmrg		case :$finalize_shlibpath: in
279252f9793fSmrg		*":$libdir:"*) ;;
279352f9793fSmrg		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
279452f9793fSmrg		esac
279552f9793fSmrg	      fi
279652f9793fSmrg	    fi
279752f9793fSmrg	  fi
279852f9793fSmrg
279952f9793fSmrg	  if test "$linkmode" = prog || test "$mode" = relink; then
280052f9793fSmrg	    add_shlibpath=
280152f9793fSmrg	    add_dir=
280252f9793fSmrg	    add=
280352f9793fSmrg	    # Finalize command for both is simple: just hardcode it.
280452f9793fSmrg	    if test "$hardcode_direct" = yes; then
280552f9793fSmrg	      add="$libdir/$linklib"
280652f9793fSmrg	    elif test "$hardcode_minus_L" = yes; then
280752f9793fSmrg	      add_dir="-L$libdir"
280852f9793fSmrg	      add="-l$name"
280952f9793fSmrg	    elif test "$hardcode_shlibpath_var" = yes; then
281052f9793fSmrg	      case :$finalize_shlibpath: in
281152f9793fSmrg	      *":$libdir:"*) ;;
281252f9793fSmrg	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
281352f9793fSmrg	      esac
281452f9793fSmrg	      add="-l$name"
281552f9793fSmrg	    elif test "$hardcode_automatic" = yes; then
281652f9793fSmrg	      if test -n "$inst_prefix_dir" &&
281752f9793fSmrg		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
281852f9793fSmrg	        add="$inst_prefix_dir$libdir/$linklib"
281952f9793fSmrg	      else
282052f9793fSmrg	        add="$libdir/$linklib"
282152f9793fSmrg	      fi
282252f9793fSmrg	    else
282352f9793fSmrg	      # We cannot seem to hardcode it, guess we'll fake it.
282452f9793fSmrg	      add_dir="-L$libdir"
282552f9793fSmrg	      # Try looking first in the location we're being installed to.
282652f9793fSmrg	      if test -n "$inst_prefix_dir"; then
282752f9793fSmrg		case $libdir in
282852f9793fSmrg		  [\\/]*)
282952f9793fSmrg		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
283052f9793fSmrg		    ;;
283152f9793fSmrg		esac
283252f9793fSmrg	      fi
283352f9793fSmrg	      add="-l$name"
283452f9793fSmrg	    fi
283552f9793fSmrg
283652f9793fSmrg	    if test "$linkmode" = prog; then
283752f9793fSmrg	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
283852f9793fSmrg	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
283952f9793fSmrg	    else
284052f9793fSmrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
284152f9793fSmrg	      test -n "$add" && deplibs="$add $deplibs"
284252f9793fSmrg	    fi
284352f9793fSmrg	  fi
284452f9793fSmrg	elif test "$linkmode" = prog; then
284552f9793fSmrg	  # Here we assume that one of hardcode_direct or hardcode_minus_L
284652f9793fSmrg	  # is not unsupported.  This is valid on all known static and
284752f9793fSmrg	  # shared platforms.
284852f9793fSmrg	  if test "$hardcode_direct" != unsupported; then
284952f9793fSmrg	    test -n "$old_library" && linklib="$old_library"
285052f9793fSmrg	    compile_deplibs="$dir/$linklib $compile_deplibs"
285152f9793fSmrg	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
285252f9793fSmrg	  else
285352f9793fSmrg	    compile_deplibs="-l$name -L$dir $compile_deplibs"
285452f9793fSmrg	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
285552f9793fSmrg	  fi
285652f9793fSmrg	elif test "$build_libtool_libs" = yes; then
285752f9793fSmrg	  # Not a shared library
285852f9793fSmrg	  if test "$deplibs_check_method" != pass_all; then
285952f9793fSmrg	    # We're trying link a shared library against a static one
286052f9793fSmrg	    # but the system doesn't support it.
286152f9793fSmrg
286252f9793fSmrg	    # Just print a warning and add the library to dependency_libs so
286352f9793fSmrg	    # that the program can be linked against the static library.
286452f9793fSmrg	    $echo
286552f9793fSmrg	    $echo "*** Warning: This system can not link to static lib archive $lib."
286652f9793fSmrg	    $echo "*** I have the capability to make that library automatically link in when"
286752f9793fSmrg	    $echo "*** you link to this library.  But I can only do this if you have a"
286852f9793fSmrg	    $echo "*** shared version of the library, which you do not appear to have."
286952f9793fSmrg	    if test "$module" = yes; then
287052f9793fSmrg	      $echo "*** But as you try to build a module library, libtool will still create "
287152f9793fSmrg	      $echo "*** a static module, that should work as long as the dlopening application"
287252f9793fSmrg	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
287352f9793fSmrg	      if test -z "$global_symbol_pipe"; then
287452f9793fSmrg		$echo
287552f9793fSmrg		$echo "*** However, this would only work if libtool was able to extract symbol"
287652f9793fSmrg		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
287752f9793fSmrg		$echo "*** not find such a program.  So, this module is probably useless."
287852f9793fSmrg		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
287952f9793fSmrg	      fi
288052f9793fSmrg	      if test "$build_old_libs" = no; then
288152f9793fSmrg		build_libtool_libs=module
288252f9793fSmrg		build_old_libs=yes
288352f9793fSmrg	      else
288452f9793fSmrg		build_libtool_libs=no
288552f9793fSmrg	      fi
288652f9793fSmrg	    fi
288752f9793fSmrg	  else
288852f9793fSmrg	    deplibs="$dir/$old_library $deplibs"
288952f9793fSmrg	    link_static=yes
289052f9793fSmrg	  fi
289152f9793fSmrg	fi # link shared/static library?
289252f9793fSmrg
289352f9793fSmrg	if test "$linkmode" = lib; then
289452f9793fSmrg	  if test -n "$dependency_libs" &&
289552f9793fSmrg	     { test "$hardcode_into_libs" != yes ||
289652f9793fSmrg	       test "$build_old_libs" = yes ||
289752f9793fSmrg	       test "$link_static" = yes; }; then
289852f9793fSmrg	    # Extract -R from dependency_libs
289952f9793fSmrg	    temp_deplibs=
290052f9793fSmrg	    for libdir in $dependency_libs; do
290152f9793fSmrg	      case $libdir in
290252f9793fSmrg	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
290352f9793fSmrg		   case " $xrpath " in
290452f9793fSmrg		   *" $temp_xrpath "*) ;;
290552f9793fSmrg		   *) xrpath="$xrpath $temp_xrpath";;
290652f9793fSmrg		   esac;;
290752f9793fSmrg	      *) temp_deplibs="$temp_deplibs $libdir";;
290852f9793fSmrg	      esac
290952f9793fSmrg	    done
291052f9793fSmrg	    dependency_libs="$temp_deplibs"
291152f9793fSmrg	  fi
291252f9793fSmrg
291352f9793fSmrg	  newlib_search_path="$newlib_search_path $absdir"
291452f9793fSmrg	  # Link against this library
291552f9793fSmrg	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
291652f9793fSmrg	  # ... and its dependency_libs
291752f9793fSmrg	  tmp_libs=
291852f9793fSmrg	  for deplib in $dependency_libs; do
291952f9793fSmrg	    newdependency_libs="$deplib $newdependency_libs"
292052f9793fSmrg	    if test "X$duplicate_deps" = "Xyes" ; then
292152f9793fSmrg	      case "$tmp_libs " in
292252f9793fSmrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
292352f9793fSmrg	      esac
292452f9793fSmrg	    fi
292552f9793fSmrg	    tmp_libs="$tmp_libs $deplib"
292652f9793fSmrg	  done
292752f9793fSmrg
292852f9793fSmrg	  if test "$link_all_deplibs" != no; then
292952f9793fSmrg	    # Add the search paths of all dependency libraries
293052f9793fSmrg	    for deplib in $dependency_libs; do
293152f9793fSmrg	      case $deplib in
293252f9793fSmrg	      -L*) path="$deplib" ;;
293352f9793fSmrg	      *.la)
293452f9793fSmrg		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
293552f9793fSmrg		test "X$dir" = "X$deplib" && dir="."
293652f9793fSmrg		# We need an absolute path.
293752f9793fSmrg		case $dir in
293852f9793fSmrg		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
293952f9793fSmrg		*)
294052f9793fSmrg		  absdir=`cd "$dir" && pwd`
294152f9793fSmrg		  if test -z "$absdir"; then
294252f9793fSmrg		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
294352f9793fSmrg		    absdir="$dir"
294452f9793fSmrg		  fi
294552f9793fSmrg		  ;;
294652f9793fSmrg		esac
294752f9793fSmrg		if grep "^installed=no" $deplib > /dev/null; then
294852f9793fSmrg		  path="$absdir/$objdir"
294952f9793fSmrg		else
295052f9793fSmrg		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
295152f9793fSmrg		  if test -z "$libdir"; then
295252f9793fSmrg		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
295352f9793fSmrg		    exit $EXIT_FAILURE
295452f9793fSmrg		  fi
295552f9793fSmrg		  if test "$absdir" != "$libdir"; then
295652f9793fSmrg		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
295752f9793fSmrg		  fi
295852f9793fSmrg		  path="$absdir"
295952f9793fSmrg		fi
296052f9793fSmrg		depdepl=
296152f9793fSmrg		case $host in
296252f9793fSmrg		*-*-darwin*)
296352f9793fSmrg		  # we do not want to link against static libs,
296452f9793fSmrg		  # but need to link against shared
296552f9793fSmrg		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
29662faa96e0Smrg		  eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
296752f9793fSmrg		  if test -n "$deplibrary_names" ; then
296852f9793fSmrg		    for tmp in $deplibrary_names ; do
296952f9793fSmrg		      depdepl=$tmp
297052f9793fSmrg		    done
29712faa96e0Smrg		    if test -f "$deplibdir/$depdepl" ; then
29722faa96e0Smrg		      depdepl="$deplibdir/$depdepl"
29732faa96e0Smrg	      	    elif test -f "$path/$depdepl" ; then
297452f9793fSmrg		      depdepl="$path/$depdepl"
29752faa96e0Smrg		    else
29762faa96e0Smrg		      # Can't find it, oh well...
29772faa96e0Smrg		      depdepl=
297852f9793fSmrg		    fi
297952f9793fSmrg		    # do not add paths which are already there
298052f9793fSmrg		    case " $newlib_search_path " in
298152f9793fSmrg		    *" $path "*) ;;
298252f9793fSmrg		    *) newlib_search_path="$newlib_search_path $path";;
298352f9793fSmrg		    esac
298452f9793fSmrg		  fi
298552f9793fSmrg		  path=""
298652f9793fSmrg		  ;;
298752f9793fSmrg		*)
298852f9793fSmrg		  path="-L$path"
298952f9793fSmrg		  ;;
299052f9793fSmrg		esac
299152f9793fSmrg		;;
299252f9793fSmrg	      -l*)
299352f9793fSmrg		case $host in
299452f9793fSmrg		*-*-darwin*)
299552f9793fSmrg		  # Again, we only want to link against shared libraries
299652f9793fSmrg		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
299752f9793fSmrg		  for tmp in $newlib_search_path ; do
299852f9793fSmrg		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
299952f9793fSmrg		      eval depdepl="$tmp/lib$tmp_libs.dylib"
300052f9793fSmrg		      break
300152f9793fSmrg		    fi
300252f9793fSmrg		  done
300352f9793fSmrg		  path=""
300452f9793fSmrg		  ;;
300552f9793fSmrg		*) continue ;;
300652f9793fSmrg		esac
300752f9793fSmrg		;;
300852f9793fSmrg	      *) continue ;;
300952f9793fSmrg	      esac
301052f9793fSmrg	      case " $deplibs " in
301152f9793fSmrg	      *" $path "*) ;;
301252f9793fSmrg	      *) deplibs="$path $deplibs" ;;
301352f9793fSmrg	      esac
301452f9793fSmrg	      case " $deplibs " in
301552f9793fSmrg	      *" $depdepl "*) ;;
301652f9793fSmrg	      *) deplibs="$depdepl $deplibs" ;;
301752f9793fSmrg	      esac
301852f9793fSmrg	    done
301952f9793fSmrg	  fi # link_all_deplibs != no
302052f9793fSmrg	fi # linkmode = lib
302152f9793fSmrg      done # for deplib in $libs
302252f9793fSmrg      dependency_libs="$newdependency_libs"
302352f9793fSmrg      if test "$pass" = dlpreopen; then
302452f9793fSmrg	# Link the dlpreopened libraries before other libraries
302552f9793fSmrg	for deplib in $save_deplibs; do
302652f9793fSmrg	  deplibs="$deplib $deplibs"
302752f9793fSmrg	done
302852f9793fSmrg      fi
302952f9793fSmrg      if test "$pass" != dlopen; then
303052f9793fSmrg	if test "$pass" != conv; then
303152f9793fSmrg	  # Make sure lib_search_path contains only unique directories.
303252f9793fSmrg	  lib_search_path=
303352f9793fSmrg	  for dir in $newlib_search_path; do
303452f9793fSmrg	    case "$lib_search_path " in
303552f9793fSmrg	    *" $dir "*) ;;
303652f9793fSmrg	    *) lib_search_path="$lib_search_path $dir" ;;
303752f9793fSmrg	    esac
303852f9793fSmrg	  done
303952f9793fSmrg	  newlib_search_path=
304052f9793fSmrg	fi
304152f9793fSmrg
304252f9793fSmrg	if test "$linkmode,$pass" != "prog,link"; then
304352f9793fSmrg	  vars="deplibs"
304452f9793fSmrg	else
304552f9793fSmrg	  vars="compile_deplibs finalize_deplibs"
304652f9793fSmrg	fi
304752f9793fSmrg	for var in $vars dependency_libs; do
304852f9793fSmrg	  # Add libraries to $var in reverse order
304952f9793fSmrg	  eval tmp_libs=\"\$$var\"
305052f9793fSmrg	  new_libs=
305152f9793fSmrg	  for deplib in $tmp_libs; do
305252f9793fSmrg	    # FIXME: Pedantically, this is the right thing to do, so
305352f9793fSmrg	    #        that some nasty dependency loop isn't accidentally
305452f9793fSmrg	    #        broken:
305552f9793fSmrg	    #new_libs="$deplib $new_libs"
305652f9793fSmrg	    # Pragmatically, this seems to cause very few problems in
305752f9793fSmrg	    # practice:
305852f9793fSmrg	    case $deplib in
305952f9793fSmrg	    -L*) new_libs="$deplib $new_libs" ;;
306052f9793fSmrg	    -R*) ;;
306152f9793fSmrg	    *)
306252f9793fSmrg	      # And here is the reason: when a library appears more
306352f9793fSmrg	      # than once as an explicit dependence of a library, or
306452f9793fSmrg	      # is implicitly linked in more than once by the
306552f9793fSmrg	      # compiler, it is considered special, and multiple
306652f9793fSmrg	      # occurrences thereof are not removed.  Compare this
306752f9793fSmrg	      # with having the same library being listed as a
306852f9793fSmrg	      # dependency of multiple other libraries: in this case,
306952f9793fSmrg	      # we know (pedantically, we assume) the library does not
307052f9793fSmrg	      # need to be listed more than once, so we keep only the
307152f9793fSmrg	      # last copy.  This is not always right, but it is rare
307252f9793fSmrg	      # enough that we require users that really mean to play
307352f9793fSmrg	      # such unportable linking tricks to link the library
307452f9793fSmrg	      # using -Wl,-lname, so that libtool does not consider it
307552f9793fSmrg	      # for duplicate removal.
307652f9793fSmrg	      case " $specialdeplibs " in
307752f9793fSmrg	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
307852f9793fSmrg	      *)
307952f9793fSmrg		case " $new_libs " in
308052f9793fSmrg		*" $deplib "*) ;;
308152f9793fSmrg		*) new_libs="$deplib $new_libs" ;;
308252f9793fSmrg		esac
308352f9793fSmrg		;;
308452f9793fSmrg	      esac
308552f9793fSmrg	      ;;
308652f9793fSmrg	    esac
308752f9793fSmrg	  done
308852f9793fSmrg	  tmp_libs=
308952f9793fSmrg	  for deplib in $new_libs; do
309052f9793fSmrg	    case $deplib in
309152f9793fSmrg	    -L*)
309252f9793fSmrg	      case " $tmp_libs " in
309352f9793fSmrg	      *" $deplib "*) ;;
309452f9793fSmrg	      *) tmp_libs="$tmp_libs $deplib" ;;
309552f9793fSmrg	      esac
309652f9793fSmrg	      ;;
309752f9793fSmrg	    *) tmp_libs="$tmp_libs $deplib" ;;
309852f9793fSmrg	    esac
309952f9793fSmrg	  done
310052f9793fSmrg	  eval $var=\"$tmp_libs\"
310152f9793fSmrg	done # for var
310252f9793fSmrg      fi
310352f9793fSmrg      # Last step: remove runtime libs from dependency_libs
310452f9793fSmrg      # (they stay in deplibs)
310552f9793fSmrg      tmp_libs=
310652f9793fSmrg      for i in $dependency_libs ; do
310752f9793fSmrg	case " $predeps $postdeps $compiler_lib_search_path " in
310852f9793fSmrg	*" $i "*)
310952f9793fSmrg	  i=""
311052f9793fSmrg	  ;;
311152f9793fSmrg	esac
311252f9793fSmrg	if test -n "$i" ; then
311352f9793fSmrg	  tmp_libs="$tmp_libs $i"
311452f9793fSmrg	fi
311552f9793fSmrg      done
311652f9793fSmrg      dependency_libs=$tmp_libs
311752f9793fSmrg    done # for pass
311852f9793fSmrg    if test "$linkmode" = prog; then
311952f9793fSmrg      dlfiles="$newdlfiles"
312052f9793fSmrg      dlprefiles="$newdlprefiles"
312152f9793fSmrg    fi
312252f9793fSmrg
312352f9793fSmrg    case $linkmode in
312452f9793fSmrg    oldlib)
31252faa96e0Smrg      case " $deplibs" in
31262faa96e0Smrg      *\ -l* | *\ -L*)
31272faa96e0Smrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
31282faa96e0Smrg      esac
312952f9793fSmrg
313052f9793fSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
313152f9793fSmrg	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
313252f9793fSmrg      fi
313352f9793fSmrg
313452f9793fSmrg      if test -n "$rpath"; then
313552f9793fSmrg	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
313652f9793fSmrg      fi
313752f9793fSmrg
313852f9793fSmrg      if test -n "$xrpath"; then
313952f9793fSmrg	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
314052f9793fSmrg      fi
314152f9793fSmrg
314252f9793fSmrg      if test -n "$vinfo"; then
314352f9793fSmrg	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
314452f9793fSmrg      fi
314552f9793fSmrg
314652f9793fSmrg      if test -n "$release"; then
314752f9793fSmrg	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
314852f9793fSmrg      fi
314952f9793fSmrg
315052f9793fSmrg      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
315152f9793fSmrg	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
315252f9793fSmrg      fi
315352f9793fSmrg
315452f9793fSmrg      # Now set the variables for building old libraries.
315552f9793fSmrg      build_libtool_libs=no
315652f9793fSmrg      oldlibs="$output"
315752f9793fSmrg      objs="$objs$old_deplibs"
315852f9793fSmrg      ;;
315952f9793fSmrg
316052f9793fSmrg    lib)
316152f9793fSmrg      # Make sure we only generate libraries of the form `libNAME.la'.
316252f9793fSmrg      case $outputname in
316352f9793fSmrg      lib*)
316452f9793fSmrg	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
316552f9793fSmrg	eval shared_ext=\"$shrext_cmds\"
316652f9793fSmrg	eval libname=\"$libname_spec\"
316752f9793fSmrg	;;
316852f9793fSmrg      *)
316952f9793fSmrg	if test "$module" = no; then
317052f9793fSmrg	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
317152f9793fSmrg	  $echo "$help" 1>&2
317252f9793fSmrg	  exit $EXIT_FAILURE
317352f9793fSmrg	fi
317452f9793fSmrg	if test "$need_lib_prefix" != no; then
317552f9793fSmrg	  # Add the "lib" prefix for modules if required
317652f9793fSmrg	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
317752f9793fSmrg	  eval shared_ext=\"$shrext_cmds\"
317852f9793fSmrg	  eval libname=\"$libname_spec\"
317952f9793fSmrg	else
318052f9793fSmrg	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
318152f9793fSmrg	fi
318252f9793fSmrg	;;
318352f9793fSmrg      esac
318452f9793fSmrg
318552f9793fSmrg      if test -n "$objs"; then
318652f9793fSmrg	if test "$deplibs_check_method" != pass_all; then
318752f9793fSmrg	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
318852f9793fSmrg	  exit $EXIT_FAILURE
318952f9793fSmrg	else
319052f9793fSmrg	  $echo
319152f9793fSmrg	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
319252f9793fSmrg	  $echo "*** objects $objs is not portable!"
319352f9793fSmrg	  libobjs="$libobjs $objs"
319452f9793fSmrg	fi
319552f9793fSmrg      fi
319652f9793fSmrg
319752f9793fSmrg      if test "$dlself" != no; then
319852f9793fSmrg	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
319952f9793fSmrg      fi
320052f9793fSmrg
320152f9793fSmrg      set dummy $rpath
320252f9793fSmrg      if test "$#" -gt 2; then
320352f9793fSmrg	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
320452f9793fSmrg      fi
320552f9793fSmrg      install_libdir="$2"
320652f9793fSmrg
320752f9793fSmrg      oldlibs=
320852f9793fSmrg      if test -z "$rpath"; then
320952f9793fSmrg	if test "$build_libtool_libs" = yes; then
321052f9793fSmrg	  # Building a libtool convenience library.
321152f9793fSmrg	  # Some compilers have problems with a `.al' extension so
321252f9793fSmrg	  # convenience libraries should have the same extension an
321352f9793fSmrg	  # archive normally would.
321452f9793fSmrg	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
321552f9793fSmrg	  build_libtool_libs=convenience
321652f9793fSmrg	  build_old_libs=yes
321752f9793fSmrg	fi
321852f9793fSmrg
321952f9793fSmrg	if test -n "$vinfo"; then
322052f9793fSmrg	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
322152f9793fSmrg	fi
322252f9793fSmrg
322352f9793fSmrg	if test -n "$release"; then
322452f9793fSmrg	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
322552f9793fSmrg	fi
322652f9793fSmrg      else
322752f9793fSmrg
322852f9793fSmrg	# Parse the version information argument.
322952f9793fSmrg	save_ifs="$IFS"; IFS=':'
323052f9793fSmrg	set dummy $vinfo 0 0 0
323152f9793fSmrg	IFS="$save_ifs"
323252f9793fSmrg
323352f9793fSmrg	if test -n "$8"; then
323452f9793fSmrg	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
323552f9793fSmrg	  $echo "$help" 1>&2
323652f9793fSmrg	  exit $EXIT_FAILURE
323752f9793fSmrg	fi
323852f9793fSmrg
323952f9793fSmrg	# convert absolute version numbers to libtool ages
324052f9793fSmrg	# this retains compatibility with .la files and attempts
324152f9793fSmrg	# to make the code below a bit more comprehensible
324252f9793fSmrg
324352f9793fSmrg	case $vinfo_number in
324452f9793fSmrg	yes)
324552f9793fSmrg	  number_major="$2"
324652f9793fSmrg	  number_minor="$3"
324752f9793fSmrg	  number_revision="$4"
324852f9793fSmrg	  #
324952f9793fSmrg	  # There are really only two kinds -- those that
325052f9793fSmrg	  # use the current revision as the major version
325152f9793fSmrg	  # and those that subtract age and use age as
325252f9793fSmrg	  # a minor version.  But, then there is irix
325352f9793fSmrg	  # which has an extra 1 added just for fun
325452f9793fSmrg	  #
325552f9793fSmrg	  case $version_type in
32562faa96e0Smrg	  darwin|linux|osf|windows|none)
325752f9793fSmrg	    current=`expr $number_major + $number_minor`
325852f9793fSmrg	    age="$number_minor"
325952f9793fSmrg	    revision="$number_revision"
326052f9793fSmrg	    ;;
326152f9793fSmrg	  freebsd-aout|freebsd-elf|sunos)
326252f9793fSmrg	    current="$number_major"
326352f9793fSmrg	    revision="$number_minor"
326452f9793fSmrg	    age="0"
326552f9793fSmrg	    ;;
326652f9793fSmrg	  irix|nonstopux)
32672faa96e0Smrg	    current=`expr $number_major + $number_minor`
326852f9793fSmrg	    age="$number_minor"
326952f9793fSmrg	    revision="$number_minor"
32702faa96e0Smrg	    lt_irix_increment=no
327152f9793fSmrg	    ;;
327252f9793fSmrg	  esac
327352f9793fSmrg	  ;;
327452f9793fSmrg	no)
327552f9793fSmrg	  current="$2"
327652f9793fSmrg	  revision="$3"
327752f9793fSmrg	  age="$4"
327852f9793fSmrg	  ;;
327952f9793fSmrg	esac
328052f9793fSmrg
328152f9793fSmrg	# Check that each of the things are valid numbers.
328252f9793fSmrg	case $current in
328352f9793fSmrg	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]) ;;
328452f9793fSmrg	*)
328552f9793fSmrg	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
328652f9793fSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
328752f9793fSmrg	  exit $EXIT_FAILURE
328852f9793fSmrg	  ;;
328952f9793fSmrg	esac
329052f9793fSmrg
329152f9793fSmrg	case $revision in
329252f9793fSmrg	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]) ;;
329352f9793fSmrg	*)
329452f9793fSmrg	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
329552f9793fSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
329652f9793fSmrg	  exit $EXIT_FAILURE
329752f9793fSmrg	  ;;
329852f9793fSmrg	esac
329952f9793fSmrg
330052f9793fSmrg	case $age in
330152f9793fSmrg	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]) ;;
330252f9793fSmrg	*)
330352f9793fSmrg	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
330452f9793fSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
330552f9793fSmrg	  exit $EXIT_FAILURE
330652f9793fSmrg	  ;;
330752f9793fSmrg	esac
330852f9793fSmrg
330952f9793fSmrg	if test "$age" -gt "$current"; then
331052f9793fSmrg	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
331152f9793fSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
331252f9793fSmrg	  exit $EXIT_FAILURE
331352f9793fSmrg	fi
331452f9793fSmrg
331552f9793fSmrg	# Calculate the version variables.
331652f9793fSmrg	major=
331752f9793fSmrg	versuffix=
331852f9793fSmrg	verstring=
331952f9793fSmrg	case $version_type in
332052f9793fSmrg	none) ;;
332152f9793fSmrg
332252f9793fSmrg	darwin)
332352f9793fSmrg	  # Like Linux, but with the current version available in
332452f9793fSmrg	  # verstring for coding it into the library header
332552f9793fSmrg	  major=.`expr $current - $age`
332652f9793fSmrg	  versuffix="$major.$age.$revision"
332752f9793fSmrg	  # Darwin ld doesn't like 0 for these options...
332852f9793fSmrg	  minor_current=`expr $current + 1`
33292faa96e0Smrg	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
33302faa96e0Smrg	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
333152f9793fSmrg	  ;;
333252f9793fSmrg
333352f9793fSmrg	freebsd-aout)
333452f9793fSmrg	  major=".$current"
333552f9793fSmrg	  versuffix=".$current.$revision";
333652f9793fSmrg	  ;;
333752f9793fSmrg
333852f9793fSmrg	freebsd-elf)
333952f9793fSmrg	  major=".$current"
334052f9793fSmrg	  versuffix=".$current";
334152f9793fSmrg	  ;;
334252f9793fSmrg
334352f9793fSmrg	irix | nonstopux)
33442faa96e0Smrg	  if test "X$lt_irix_increment" = "Xno"; then
33452faa96e0Smrg	    major=`expr $current - $age`
33462faa96e0Smrg	  else
33472faa96e0Smrg	    major=`expr $current - $age + 1`
33482faa96e0Smrg	  fi
334952f9793fSmrg	  case $version_type in
335052f9793fSmrg	    nonstopux) verstring_prefix=nonstopux ;;
335152f9793fSmrg	    *)         verstring_prefix=sgi ;;
335252f9793fSmrg	  esac
335352f9793fSmrg	  verstring="$verstring_prefix$major.$revision"
335452f9793fSmrg
335552f9793fSmrg	  # Add in all the interfaces that we are compatible with.
335652f9793fSmrg	  loop=$revision
335752f9793fSmrg	  while test "$loop" -ne 0; do
335852f9793fSmrg	    iface=`expr $revision - $loop`
335952f9793fSmrg	    loop=`expr $loop - 1`
336052f9793fSmrg	    verstring="$verstring_prefix$major.$iface:$verstring"
336152f9793fSmrg	  done
336252f9793fSmrg
336352f9793fSmrg	  # Before this point, $major must not contain `.'.
336452f9793fSmrg	  major=.$major
336552f9793fSmrg	  versuffix="$major.$revision"
336652f9793fSmrg	  ;;
336752f9793fSmrg
336852f9793fSmrg	linux)
336952f9793fSmrg	  major=.`expr $current - $age`
337052f9793fSmrg	  versuffix="$major.$age.$revision"
337152f9793fSmrg	  ;;
337252f9793fSmrg
337352f9793fSmrg	osf)
337452f9793fSmrg	  major=.`expr $current - $age`
337552f9793fSmrg	  versuffix=".$current.$age.$revision"
337652f9793fSmrg	  verstring="$current.$age.$revision"
337752f9793fSmrg
337852f9793fSmrg	  # Add in all the interfaces that we are compatible with.
337952f9793fSmrg	  loop=$age
338052f9793fSmrg	  while test "$loop" -ne 0; do
338152f9793fSmrg	    iface=`expr $current - $loop`
338252f9793fSmrg	    loop=`expr $loop - 1`
338352f9793fSmrg	    verstring="$verstring:${iface}.0"
338452f9793fSmrg	  done
338552f9793fSmrg
338652f9793fSmrg	  # Make executables depend on our current version.
338752f9793fSmrg	  verstring="$verstring:${current}.0"
338852f9793fSmrg	  ;;
338952f9793fSmrg
339052f9793fSmrg	sunos)
339152f9793fSmrg	  major=".$current"
339252f9793fSmrg	  versuffix=".$current.$revision"
339352f9793fSmrg	  ;;
339452f9793fSmrg
339552f9793fSmrg	windows)
339652f9793fSmrg	  # Use '-' rather than '.', since we only want one
339752f9793fSmrg	  # extension on DOS 8.3 filesystems.
339852f9793fSmrg	  major=`expr $current - $age`
339952f9793fSmrg	  versuffix="-$major"
340052f9793fSmrg	  ;;
340152f9793fSmrg
340252f9793fSmrg	*)
340352f9793fSmrg	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
340452f9793fSmrg	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
340552f9793fSmrg	  exit $EXIT_FAILURE
340652f9793fSmrg	  ;;
340752f9793fSmrg	esac
340852f9793fSmrg
340952f9793fSmrg	# Clear the version info if we defaulted, and they specified a release.
341052f9793fSmrg	if test -z "$vinfo" && test -n "$release"; then
341152f9793fSmrg	  major=
341252f9793fSmrg	  case $version_type in
341352f9793fSmrg	  darwin)
341452f9793fSmrg	    # we can't check for "0.0" in archive_cmds due to quoting
341552f9793fSmrg	    # problems, so we reset it completely
341652f9793fSmrg	    verstring=
341752f9793fSmrg	    ;;
341852f9793fSmrg	  *)
341952f9793fSmrg	    verstring="0.0"
342052f9793fSmrg	    ;;
342152f9793fSmrg	  esac
342252f9793fSmrg	  if test "$need_version" = no; then
342352f9793fSmrg	    versuffix=
342452f9793fSmrg	  else
342552f9793fSmrg	    versuffix=".0.0"
342652f9793fSmrg	  fi
342752f9793fSmrg	fi
342852f9793fSmrg
342952f9793fSmrg	# Remove version info from name if versioning should be avoided
343052f9793fSmrg	if test "$avoid_version" = yes && test "$need_version" = no; then
343152f9793fSmrg	  major=
343252f9793fSmrg	  versuffix=
343352f9793fSmrg	  verstring=""
343452f9793fSmrg	fi
343552f9793fSmrg
343652f9793fSmrg	# Check to see if the archive will have undefined symbols.
343752f9793fSmrg	if test "$allow_undefined" = yes; then
343852f9793fSmrg	  if test "$allow_undefined_flag" = unsupported; then
343952f9793fSmrg	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
344052f9793fSmrg	    build_libtool_libs=no
344152f9793fSmrg	    build_old_libs=yes
344252f9793fSmrg	  fi
344352f9793fSmrg	else
344452f9793fSmrg	  # Don't allow undefined symbols.
344552f9793fSmrg	  allow_undefined_flag="$no_undefined_flag"
344652f9793fSmrg	fi
344752f9793fSmrg      fi
344852f9793fSmrg
344952f9793fSmrg      if test "$mode" != relink; then
345052f9793fSmrg	# Remove our outputs, but don't remove object files since they
345152f9793fSmrg	# may have been created when compiling PIC objects.
345252f9793fSmrg	removelist=
345352f9793fSmrg	tempremovelist=`$echo "$output_objdir/*"`
345452f9793fSmrg	for p in $tempremovelist; do
345552f9793fSmrg	  case $p in
345652f9793fSmrg	    *.$objext)
345752f9793fSmrg	       ;;
345852f9793fSmrg	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
345952f9793fSmrg	       if test "X$precious_files_regex" != "X"; then
346052f9793fSmrg	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
346152f9793fSmrg	         then
346252f9793fSmrg		   continue
346352f9793fSmrg		 fi
346452f9793fSmrg	       fi
346552f9793fSmrg	       removelist="$removelist $p"
346652f9793fSmrg	       ;;
346752f9793fSmrg	    *) ;;
346852f9793fSmrg	  esac
346952f9793fSmrg	done
347052f9793fSmrg	if test -n "$removelist"; then
347152f9793fSmrg	  $show "${rm}r $removelist"
347252f9793fSmrg	  $run ${rm}r $removelist
347352f9793fSmrg	fi
347452f9793fSmrg      fi
347552f9793fSmrg
347652f9793fSmrg      # Now set the variables for building old libraries.
347752f9793fSmrg      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
347852f9793fSmrg	oldlibs="$oldlibs $output_objdir/$libname.$libext"
347952f9793fSmrg
348052f9793fSmrg	# Transform .lo files to .o files.
348152f9793fSmrg	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
348252f9793fSmrg      fi
348352f9793fSmrg
348452f9793fSmrg      # Eliminate all temporary directories.
34852faa96e0Smrg      #for path in $notinst_path; do
34862faa96e0Smrg      #	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
34872faa96e0Smrg      #	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
34882faa96e0Smrg      #	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
34892faa96e0Smrg      #done
349052f9793fSmrg
349152f9793fSmrg      if test -n "$xrpath"; then
349252f9793fSmrg	# If the user specified any rpath flags, then add them.
349352f9793fSmrg	temp_xrpath=
349452f9793fSmrg	for libdir in $xrpath; do
349552f9793fSmrg	  temp_xrpath="$temp_xrpath -R$libdir"
349652f9793fSmrg	  case "$finalize_rpath " in
349752f9793fSmrg	  *" $libdir "*) ;;
349852f9793fSmrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
349952f9793fSmrg	  esac
350052f9793fSmrg	done
350152f9793fSmrg	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
350252f9793fSmrg	  dependency_libs="$temp_xrpath $dependency_libs"
350352f9793fSmrg	fi
350452f9793fSmrg      fi
350552f9793fSmrg
350652f9793fSmrg      # Make sure dlfiles contains only unique files that won't be dlpreopened
350752f9793fSmrg      old_dlfiles="$dlfiles"
350852f9793fSmrg      dlfiles=
350952f9793fSmrg      for lib in $old_dlfiles; do
351052f9793fSmrg	case " $dlprefiles $dlfiles " in
351152f9793fSmrg	*" $lib "*) ;;
351252f9793fSmrg	*) dlfiles="$dlfiles $lib" ;;
351352f9793fSmrg	esac
351452f9793fSmrg      done
351552f9793fSmrg
351652f9793fSmrg      # Make sure dlprefiles contains only unique files
351752f9793fSmrg      old_dlprefiles="$dlprefiles"
351852f9793fSmrg      dlprefiles=
351952f9793fSmrg      for lib in $old_dlprefiles; do
352052f9793fSmrg	case "$dlprefiles " in
352152f9793fSmrg	*" $lib "*) ;;
352252f9793fSmrg	*) dlprefiles="$dlprefiles $lib" ;;
352352f9793fSmrg	esac
352452f9793fSmrg      done
352552f9793fSmrg
352652f9793fSmrg      if test "$build_libtool_libs" = yes; then
352752f9793fSmrg	if test -n "$rpath"; then
352852f9793fSmrg	  case $host in
352952f9793fSmrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
353052f9793fSmrg	    # these systems don't actually have a c library (as such)!
353152f9793fSmrg	    ;;
353252f9793fSmrg	  *-*-rhapsody* | *-*-darwin1.[012])
353352f9793fSmrg	    # Rhapsody C library is in the System framework
353452f9793fSmrg	    deplibs="$deplibs -framework System"
353552f9793fSmrg	    ;;
353652f9793fSmrg	  *-*-netbsd*)
353752f9793fSmrg	    # Don't link with libc until the a.out ld.so is fixed.
353852f9793fSmrg	    ;;
353952f9793fSmrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
354052f9793fSmrg	    # Do not include libc due to us having libc/libc_r.
354152f9793fSmrg	    ;;
354252f9793fSmrg	  *-*-sco3.2v5* | *-*-sco5v6*)
354352f9793fSmrg	    # Causes problems with __ctype
354452f9793fSmrg	    ;;
354552f9793fSmrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
354652f9793fSmrg	    # Compiler inserts libc in the correct place for threads to work
354752f9793fSmrg	    ;;
354852f9793fSmrg 	  *)
354952f9793fSmrg	    # Add libc to deplibs on all other systems if necessary.
355052f9793fSmrg	    if test "$build_libtool_need_lc" = "yes"; then
355152f9793fSmrg	      deplibs="$deplibs -lc"
355252f9793fSmrg	    fi
355352f9793fSmrg	    ;;
355452f9793fSmrg	  esac
355552f9793fSmrg	fi
355652f9793fSmrg
355752f9793fSmrg	# Transform deplibs into only deplibs that can be linked in shared.
355852f9793fSmrg	name_save=$name
355952f9793fSmrg	libname_save=$libname
356052f9793fSmrg	release_save=$release
356152f9793fSmrg	versuffix_save=$versuffix
356252f9793fSmrg	major_save=$major
356352f9793fSmrg	# I'm not sure if I'm treating the release correctly.  I think
356452f9793fSmrg	# release should show up in the -l (ie -lgmp5) so we don't want to
356552f9793fSmrg	# add it in twice.  Is that correct?
356652f9793fSmrg	release=""
356752f9793fSmrg	versuffix=""
356852f9793fSmrg	major=""
356952f9793fSmrg	newdeplibs=
357052f9793fSmrg	droppeddeps=no
357152f9793fSmrg	case $deplibs_check_method in
357252f9793fSmrg	pass_all)
357352f9793fSmrg	  # Don't check for shared/static.  Everything works.
357452f9793fSmrg	  # This might be a little naive.  We might want to check
357552f9793fSmrg	  # whether the library exists or not.  But this is on
357652f9793fSmrg	  # osf3 & osf4 and I'm not really sure... Just
357752f9793fSmrg	  # implementing what was already the behavior.
357852f9793fSmrg	  newdeplibs=$deplibs
357952f9793fSmrg	  ;;
358052f9793fSmrg	test_compile)
358152f9793fSmrg	  # This code stresses the "libraries are programs" paradigm to its
358252f9793fSmrg	  # limits. Maybe even breaks it.  We compile a program, linking it
358352f9793fSmrg	  # against the deplibs as a proxy for the library.  Then we can check
358452f9793fSmrg	  # whether they linked in statically or dynamically with ldd.
358552f9793fSmrg	  $rm conftest.c
358652f9793fSmrg	  cat > conftest.c <<EOF
358752f9793fSmrg	  int main() { return 0; }
358852f9793fSmrgEOF
358952f9793fSmrg	  $rm conftest
35902faa96e0Smrg	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
359152f9793fSmrg	    ldd_output=`ldd conftest`
359252f9793fSmrg	    for i in $deplibs; do
359352f9793fSmrg	      name=`expr $i : '-l\(.*\)'`
359452f9793fSmrg	      # If $name is empty we are operating on a -L argument.
35952faa96e0Smrg              if test "$name" != "" && test "$name" != "0"; then
359652f9793fSmrg		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
359752f9793fSmrg		  case " $predeps $postdeps " in
359852f9793fSmrg		  *" $i "*)
359952f9793fSmrg		    newdeplibs="$newdeplibs $i"
360052f9793fSmrg		    i=""
360152f9793fSmrg		    ;;
360252f9793fSmrg		  esac
360352f9793fSmrg	        fi
360452f9793fSmrg		if test -n "$i" ; then
360552f9793fSmrg		  libname=`eval \\$echo \"$libname_spec\"`
360652f9793fSmrg		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
360752f9793fSmrg		  set dummy $deplib_matches
360852f9793fSmrg		  deplib_match=$2
360952f9793fSmrg		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
361052f9793fSmrg		    newdeplibs="$newdeplibs $i"
361152f9793fSmrg		  else
361252f9793fSmrg		    droppeddeps=yes
361352f9793fSmrg		    $echo
361452f9793fSmrg		    $echo "*** Warning: dynamic linker does not accept needed library $i."
361552f9793fSmrg		    $echo "*** I have the capability to make that library automatically link in when"
361652f9793fSmrg		    $echo "*** you link to this library.  But I can only do this if you have a"
361752f9793fSmrg		    $echo "*** shared version of the library, which I believe you do not have"
361852f9793fSmrg		    $echo "*** because a test_compile did reveal that the linker did not use it for"
361952f9793fSmrg		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
362052f9793fSmrg		  fi
362152f9793fSmrg		fi
362252f9793fSmrg	      else
362352f9793fSmrg		newdeplibs="$newdeplibs $i"
362452f9793fSmrg	      fi
362552f9793fSmrg	    done
362652f9793fSmrg	  else
362752f9793fSmrg	    # Error occurred in the first compile.  Let's try to salvage
362852f9793fSmrg	    # the situation: Compile a separate program for each library.
362952f9793fSmrg	    for i in $deplibs; do
363052f9793fSmrg	      name=`expr $i : '-l\(.*\)'`
363152f9793fSmrg	      # If $name is empty we are operating on a -L argument.
363252f9793fSmrg              if test "$name" != "" && test "$name" != "0"; then
363352f9793fSmrg		$rm conftest
36342faa96e0Smrg		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
363552f9793fSmrg		  ldd_output=`ldd conftest`
363652f9793fSmrg		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
363752f9793fSmrg		    case " $predeps $postdeps " in
363852f9793fSmrg		    *" $i "*)
363952f9793fSmrg		      newdeplibs="$newdeplibs $i"
364052f9793fSmrg		      i=""
364152f9793fSmrg		      ;;
364252f9793fSmrg		    esac
364352f9793fSmrg		  fi
364452f9793fSmrg		  if test -n "$i" ; then
364552f9793fSmrg		    libname=`eval \\$echo \"$libname_spec\"`
364652f9793fSmrg		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
364752f9793fSmrg		    set dummy $deplib_matches
364852f9793fSmrg		    deplib_match=$2
364952f9793fSmrg		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
365052f9793fSmrg		      newdeplibs="$newdeplibs $i"
365152f9793fSmrg		    else
365252f9793fSmrg		      droppeddeps=yes
365352f9793fSmrg		      $echo
365452f9793fSmrg		      $echo "*** Warning: dynamic linker does not accept needed library $i."
365552f9793fSmrg		      $echo "*** I have the capability to make that library automatically link in when"
365652f9793fSmrg		      $echo "*** you link to this library.  But I can only do this if you have a"
365752f9793fSmrg		      $echo "*** shared version of the library, which you do not appear to have"
365852f9793fSmrg		      $echo "*** because a test_compile did reveal that the linker did not use this one"
365952f9793fSmrg		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
366052f9793fSmrg		    fi
366152f9793fSmrg		  fi
366252f9793fSmrg		else
366352f9793fSmrg		  droppeddeps=yes
366452f9793fSmrg		  $echo
366552f9793fSmrg		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
36662faa96e0Smrg		  $echo "*** make it link in!  You will probably need to install it or some"
366752f9793fSmrg		  $echo "*** library that it depends on before this library will be fully"
366852f9793fSmrg		  $echo "*** functional.  Installing it before continuing would be even better."
366952f9793fSmrg		fi
367052f9793fSmrg	      else
367152f9793fSmrg		newdeplibs="$newdeplibs $i"
367252f9793fSmrg	      fi
367352f9793fSmrg	    done
367452f9793fSmrg	  fi
367552f9793fSmrg	  ;;
367652f9793fSmrg	file_magic*)
367752f9793fSmrg	  set dummy $deplibs_check_method
367852f9793fSmrg	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
367952f9793fSmrg	  for a_deplib in $deplibs; do
368052f9793fSmrg	    name=`expr $a_deplib : '-l\(.*\)'`
368152f9793fSmrg	    # If $name is empty we are operating on a -L argument.
368252f9793fSmrg            if test "$name" != "" && test  "$name" != "0"; then
368352f9793fSmrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
368452f9793fSmrg		case " $predeps $postdeps " in
368552f9793fSmrg		*" $a_deplib "*)
368652f9793fSmrg		  newdeplibs="$newdeplibs $a_deplib"
368752f9793fSmrg		  a_deplib=""
368852f9793fSmrg		  ;;
368952f9793fSmrg		esac
369052f9793fSmrg	      fi
369152f9793fSmrg	      if test -n "$a_deplib" ; then
369252f9793fSmrg		libname=`eval \\$echo \"$libname_spec\"`
369352f9793fSmrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
369452f9793fSmrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
369552f9793fSmrg		  for potent_lib in $potential_libs; do
369652f9793fSmrg		      # Follow soft links.
369752f9793fSmrg		      if ls -lLd "$potent_lib" 2>/dev/null \
369852f9793fSmrg			 | grep " -> " >/dev/null; then
369952f9793fSmrg			continue
370052f9793fSmrg		      fi
370152f9793fSmrg		      # The statement above tries to avoid entering an
370252f9793fSmrg		      # endless loop below, in case of cyclic links.
370352f9793fSmrg		      # We might still enter an endless loop, since a link
370452f9793fSmrg		      # loop can be closed while we follow links,
370552f9793fSmrg		      # but so what?
370652f9793fSmrg		      potlib="$potent_lib"
370752f9793fSmrg		      while test -h "$potlib" 2>/dev/null; do
370852f9793fSmrg			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
370952f9793fSmrg			case $potliblink in
371052f9793fSmrg			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
371152f9793fSmrg			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
371252f9793fSmrg			esac
371352f9793fSmrg		      done
371452f9793fSmrg		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
371552f9793fSmrg			 | ${SED} 10q \
371652f9793fSmrg			 | $EGREP "$file_magic_regex" > /dev/null; then
371752f9793fSmrg			newdeplibs="$newdeplibs $a_deplib"
371852f9793fSmrg			a_deplib=""
371952f9793fSmrg			break 2
372052f9793fSmrg		      fi
372152f9793fSmrg		  done
372252f9793fSmrg		done
372352f9793fSmrg	      fi
372452f9793fSmrg	      if test -n "$a_deplib" ; then
372552f9793fSmrg		droppeddeps=yes
372652f9793fSmrg		$echo
372752f9793fSmrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
372852f9793fSmrg		$echo "*** I have the capability to make that library automatically link in when"
372952f9793fSmrg		$echo "*** you link to this library.  But I can only do this if you have a"
373052f9793fSmrg		$echo "*** shared version of the library, which you do not appear to have"
373152f9793fSmrg		$echo "*** because I did check the linker path looking for a file starting"
373252f9793fSmrg		if test -z "$potlib" ; then
373352f9793fSmrg		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
373452f9793fSmrg		else
373552f9793fSmrg		  $echo "*** with $libname and none of the candidates passed a file format test"
373652f9793fSmrg		  $echo "*** using a file magic. Last file checked: $potlib"
373752f9793fSmrg		fi
373852f9793fSmrg	      fi
373952f9793fSmrg	    else
374052f9793fSmrg	      # Add a -L argument.
374152f9793fSmrg	      newdeplibs="$newdeplibs $a_deplib"
374252f9793fSmrg	    fi
374352f9793fSmrg	  done # Gone through all deplibs.
374452f9793fSmrg	  ;;
374552f9793fSmrg	match_pattern*)
374652f9793fSmrg	  set dummy $deplibs_check_method
374752f9793fSmrg	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
374852f9793fSmrg	  for a_deplib in $deplibs; do
374952f9793fSmrg	    name=`expr $a_deplib : '-l\(.*\)'`
375052f9793fSmrg	    # If $name is empty we are operating on a -L argument.
375152f9793fSmrg	    if test -n "$name" && test "$name" != "0"; then
375252f9793fSmrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
375352f9793fSmrg		case " $predeps $postdeps " in
375452f9793fSmrg		*" $a_deplib "*)
375552f9793fSmrg		  newdeplibs="$newdeplibs $a_deplib"
375652f9793fSmrg		  a_deplib=""
375752f9793fSmrg		  ;;
375852f9793fSmrg		esac
375952f9793fSmrg	      fi
376052f9793fSmrg	      if test -n "$a_deplib" ; then
376152f9793fSmrg		libname=`eval \\$echo \"$libname_spec\"`
376252f9793fSmrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
376352f9793fSmrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
376452f9793fSmrg		  for potent_lib in $potential_libs; do
376552f9793fSmrg		    potlib="$potent_lib" # see symlink-check above in file_magic test
376652f9793fSmrg		    if eval $echo \"$potent_lib\" 2>/dev/null \
376752f9793fSmrg		        | ${SED} 10q \
376852f9793fSmrg		        | $EGREP "$match_pattern_regex" > /dev/null; then
376952f9793fSmrg		      newdeplibs="$newdeplibs $a_deplib"
377052f9793fSmrg		      a_deplib=""
377152f9793fSmrg		      break 2
377252f9793fSmrg		    fi
377352f9793fSmrg		  done
377452f9793fSmrg		done
377552f9793fSmrg	      fi
377652f9793fSmrg	      if test -n "$a_deplib" ; then
377752f9793fSmrg		droppeddeps=yes
377852f9793fSmrg		$echo
377952f9793fSmrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
378052f9793fSmrg		$echo "*** I have the capability to make that library automatically link in when"
378152f9793fSmrg		$echo "*** you link to this library.  But I can only do this if you have a"
378252f9793fSmrg		$echo "*** shared version of the library, which you do not appear to have"
378352f9793fSmrg		$echo "*** because I did check the linker path looking for a file starting"
378452f9793fSmrg		if test -z "$potlib" ; then
378552f9793fSmrg		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
378652f9793fSmrg		else
378752f9793fSmrg		  $echo "*** with $libname and none of the candidates passed a file format test"
378852f9793fSmrg		  $echo "*** using a regex pattern. Last file checked: $potlib"
378952f9793fSmrg		fi
379052f9793fSmrg	      fi
379152f9793fSmrg	    else
379252f9793fSmrg	      # Add a -L argument.
379352f9793fSmrg	      newdeplibs="$newdeplibs $a_deplib"
379452f9793fSmrg	    fi
379552f9793fSmrg	  done # Gone through all deplibs.
379652f9793fSmrg	  ;;
379752f9793fSmrg	none | unknown | *)
379852f9793fSmrg	  newdeplibs=""
379952f9793fSmrg	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
380052f9793fSmrg	    -e 's/ -[LR][^ ]*//g'`
380152f9793fSmrg	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
380252f9793fSmrg	    for i in $predeps $postdeps ; do
380352f9793fSmrg	      # can't use Xsed below, because $i might contain '/'
380452f9793fSmrg	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
380552f9793fSmrg	    done
380652f9793fSmrg	  fi
380752f9793fSmrg	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
380852f9793fSmrg	    | grep . >/dev/null; then
380952f9793fSmrg	    $echo
381052f9793fSmrg	    if test "X$deplibs_check_method" = "Xnone"; then
381152f9793fSmrg	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
381252f9793fSmrg	    else
381352f9793fSmrg	      $echo "*** Warning: inter-library dependencies are not known to be supported."
381452f9793fSmrg	    fi
381552f9793fSmrg	    $echo "*** All declared inter-library dependencies are being dropped."
381652f9793fSmrg	    droppeddeps=yes
381752f9793fSmrg	  fi
381852f9793fSmrg	  ;;
381952f9793fSmrg	esac
382052f9793fSmrg	versuffix=$versuffix_save
382152f9793fSmrg	major=$major_save
382252f9793fSmrg	release=$release_save
382352f9793fSmrg	libname=$libname_save
382452f9793fSmrg	name=$name_save
382552f9793fSmrg
382652f9793fSmrg	case $host in
382752f9793fSmrg	*-*-rhapsody* | *-*-darwin1.[012])
382852f9793fSmrg	  # On Rhapsody replace the C library is the System framework
382952f9793fSmrg	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
383052f9793fSmrg	  ;;
383152f9793fSmrg	esac
383252f9793fSmrg
383352f9793fSmrg	if test "$droppeddeps" = yes; then
383452f9793fSmrg	  if test "$module" = yes; then
383552f9793fSmrg	    $echo
383652f9793fSmrg	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
383752f9793fSmrg	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
383852f9793fSmrg	    $echo "*** a static module, that should work as long as the dlopening"
383952f9793fSmrg	    $echo "*** application is linked with the -dlopen flag."
384052f9793fSmrg	    if test -z "$global_symbol_pipe"; then
384152f9793fSmrg	      $echo
384252f9793fSmrg	      $echo "*** However, this would only work if libtool was able to extract symbol"
384352f9793fSmrg	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
384452f9793fSmrg	      $echo "*** not find such a program.  So, this module is probably useless."
384552f9793fSmrg	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
384652f9793fSmrg	    fi
384752f9793fSmrg	    if test "$build_old_libs" = no; then
384852f9793fSmrg	      oldlibs="$output_objdir/$libname.$libext"
384952f9793fSmrg	      build_libtool_libs=module
385052f9793fSmrg	      build_old_libs=yes
385152f9793fSmrg	    else
385252f9793fSmrg	      build_libtool_libs=no
385352f9793fSmrg	    fi
385452f9793fSmrg	  else
385552f9793fSmrg	    $echo "*** The inter-library dependencies that have been dropped here will be"
385652f9793fSmrg	    $echo "*** automatically added whenever a program is linked with this library"
385752f9793fSmrg	    $echo "*** or is declared to -dlopen it."
385852f9793fSmrg
385952f9793fSmrg	    if test "$allow_undefined" = no; then
386052f9793fSmrg	      $echo
386152f9793fSmrg	      $echo "*** Since this library must not contain undefined symbols,"
386252f9793fSmrg	      $echo "*** because either the platform does not support them or"
386352f9793fSmrg	      $echo "*** it was explicitly requested with -no-undefined,"
386452f9793fSmrg	      $echo "*** libtool will only create a static version of it."
386552f9793fSmrg	      if test "$build_old_libs" = no; then
386652f9793fSmrg		oldlibs="$output_objdir/$libname.$libext"
386752f9793fSmrg		build_libtool_libs=module
386852f9793fSmrg		build_old_libs=yes
386952f9793fSmrg	      else
387052f9793fSmrg		build_libtool_libs=no
387152f9793fSmrg	      fi
387252f9793fSmrg	    fi
387352f9793fSmrg	  fi
387452f9793fSmrg	fi
387552f9793fSmrg	# Done checking deplibs!
387652f9793fSmrg	deplibs=$newdeplibs
387752f9793fSmrg      fi
387852f9793fSmrg
387952f9793fSmrg
388052f9793fSmrg      # move library search paths that coincide with paths to not yet
388152f9793fSmrg      # installed libraries to the beginning of the library search list
388252f9793fSmrg      new_libs=
388352f9793fSmrg      for path in $notinst_path; do
388452f9793fSmrg	case " $new_libs " in
388552f9793fSmrg	*" -L$path/$objdir "*) ;;
388652f9793fSmrg	*)
388752f9793fSmrg	  case " $deplibs " in
388852f9793fSmrg	  *" -L$path/$objdir "*)
388952f9793fSmrg	    new_libs="$new_libs -L$path/$objdir" ;;
389052f9793fSmrg	  esac
389152f9793fSmrg	  ;;
389252f9793fSmrg	esac
389352f9793fSmrg      done
389452f9793fSmrg      for deplib in $deplibs; do
389552f9793fSmrg	case $deplib in
389652f9793fSmrg	-L*)
389752f9793fSmrg	  case " $new_libs " in
389852f9793fSmrg	  *" $deplib "*) ;;
389952f9793fSmrg	  *) new_libs="$new_libs $deplib" ;;
390052f9793fSmrg	  esac
390152f9793fSmrg	  ;;
390252f9793fSmrg	*) new_libs="$new_libs $deplib" ;;
390352f9793fSmrg	esac
390452f9793fSmrg      done
390552f9793fSmrg      deplibs="$new_libs"
390652f9793fSmrg
390752f9793fSmrg
390852f9793fSmrg      # All the library-specific variables (install_libdir is set above).
390952f9793fSmrg      library_names=
391052f9793fSmrg      old_library=
391152f9793fSmrg      dlname=
391252f9793fSmrg
391352f9793fSmrg      # Test again, we may have decided not to build it any more
391452f9793fSmrg      if test "$build_libtool_libs" = yes; then
391552f9793fSmrg	if test "$hardcode_into_libs" = yes; then
391652f9793fSmrg	  # Hardcode the library paths
391752f9793fSmrg	  hardcode_libdirs=
391852f9793fSmrg	  dep_rpath=
391952f9793fSmrg	  rpath="$finalize_rpath"
392052f9793fSmrg	  test "$mode" != relink && rpath="$compile_rpath$rpath"
392152f9793fSmrg	  for libdir in $rpath; do
392252f9793fSmrg	    if test -n "$hardcode_libdir_flag_spec"; then
392352f9793fSmrg	      if test -n "$hardcode_libdir_separator"; then
392452f9793fSmrg		if test -z "$hardcode_libdirs"; then
392552f9793fSmrg		  hardcode_libdirs="$libdir"
392652f9793fSmrg		else
392752f9793fSmrg		  # Just accumulate the unique libdirs.
392852f9793fSmrg		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
392952f9793fSmrg		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
393052f9793fSmrg		    ;;
393152f9793fSmrg		  *)
393252f9793fSmrg		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
393352f9793fSmrg		    ;;
393452f9793fSmrg		  esac
393552f9793fSmrg		fi
393652f9793fSmrg	      else
393752f9793fSmrg		eval flag=\"$hardcode_libdir_flag_spec\"
393852f9793fSmrg		dep_rpath="$dep_rpath $flag"
393952f9793fSmrg	      fi
394052f9793fSmrg	    elif test -n "$runpath_var"; then
394152f9793fSmrg	      case "$perm_rpath " in
394252f9793fSmrg	      *" $libdir "*) ;;
394352f9793fSmrg	      *) perm_rpath="$perm_rpath $libdir" ;;
394452f9793fSmrg	      esac
394552f9793fSmrg	    fi
394652f9793fSmrg	  done
394752f9793fSmrg	  # Substitute the hardcoded libdirs into the rpath.
394852f9793fSmrg	  if test -n "$hardcode_libdir_separator" &&
394952f9793fSmrg	     test -n "$hardcode_libdirs"; then
395052f9793fSmrg	    libdir="$hardcode_libdirs"
395152f9793fSmrg	    if test -n "$hardcode_libdir_flag_spec_ld"; then
39522faa96e0Smrg	      case $archive_cmds in
39532faa96e0Smrg	      *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
39542faa96e0Smrg	      *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
39552faa96e0Smrg	      esac
395652f9793fSmrg	    else
395752f9793fSmrg	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
395852f9793fSmrg	    fi
395952f9793fSmrg	  fi
396052f9793fSmrg	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
396152f9793fSmrg	    # We should set the runpath_var.
396252f9793fSmrg	    rpath=
396352f9793fSmrg	    for dir in $perm_rpath; do
396452f9793fSmrg	      rpath="$rpath$dir:"
396552f9793fSmrg	    done
396652f9793fSmrg	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
396752f9793fSmrg	  fi
396852f9793fSmrg	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
396952f9793fSmrg	fi
397052f9793fSmrg
397152f9793fSmrg	shlibpath="$finalize_shlibpath"
397252f9793fSmrg	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
397352f9793fSmrg	if test -n "$shlibpath"; then
397452f9793fSmrg	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
397552f9793fSmrg	fi
397652f9793fSmrg
397752f9793fSmrg	# Get the real and link names of the library.
397852f9793fSmrg	eval shared_ext=\"$shrext_cmds\"
397952f9793fSmrg	eval library_names=\"$library_names_spec\"
398052f9793fSmrg	set dummy $library_names
398152f9793fSmrg	realname="$2"
398252f9793fSmrg	shift; shift
398352f9793fSmrg
398452f9793fSmrg	if test -n "$soname_spec"; then
398552f9793fSmrg	  eval soname=\"$soname_spec\"
398652f9793fSmrg	else
398752f9793fSmrg	  soname="$realname"
398852f9793fSmrg	fi
398952f9793fSmrg	if test -z "$dlname"; then
399052f9793fSmrg	  dlname=$soname
399152f9793fSmrg	fi
399252f9793fSmrg
399352f9793fSmrg	lib="$output_objdir/$realname"
399452f9793fSmrg	linknames=
399552f9793fSmrg	for link
399652f9793fSmrg	do
399752f9793fSmrg	  linknames="$linknames $link"
399852f9793fSmrg	done
399952f9793fSmrg
400052f9793fSmrg	# Use standard objects if they are pic
400152f9793fSmrg	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
400252f9793fSmrg
400352f9793fSmrg	# Prepare the list of exported symbols
400452f9793fSmrg	if test -z "$export_symbols"; then
400552f9793fSmrg	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
400652f9793fSmrg	    $show "generating symbol list for \`$libname.la'"
400752f9793fSmrg	    export_symbols="$output_objdir/$libname.exp"
400852f9793fSmrg	    $run $rm $export_symbols
400952f9793fSmrg	    cmds=$export_symbols_cmds
401052f9793fSmrg	    save_ifs="$IFS"; IFS='~'
401152f9793fSmrg	    for cmd in $cmds; do
401252f9793fSmrg	      IFS="$save_ifs"
401352f9793fSmrg	      eval cmd=\"$cmd\"
401452f9793fSmrg	      if len=`expr "X$cmd" : ".*"` &&
401552f9793fSmrg	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
401652f9793fSmrg	        $show "$cmd"
401752f9793fSmrg	        $run eval "$cmd" || exit $?
401852f9793fSmrg	        skipped_export=false
401952f9793fSmrg	      else
402052f9793fSmrg	        # The command line is too long to execute in one step.
402152f9793fSmrg	        $show "using reloadable object file for export list..."
402252f9793fSmrg	        skipped_export=:
402352f9793fSmrg		# Break out early, otherwise skipped_export may be
402452f9793fSmrg		# set to false by a later but shorter cmd.
402552f9793fSmrg		break
402652f9793fSmrg	      fi
402752f9793fSmrg	    done
402852f9793fSmrg	    IFS="$save_ifs"
402952f9793fSmrg	    if test -n "$export_symbols_regex"; then
403052f9793fSmrg	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
403152f9793fSmrg	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
403252f9793fSmrg	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
403352f9793fSmrg	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
403452f9793fSmrg	    fi
403552f9793fSmrg	  fi
403652f9793fSmrg	fi
403752f9793fSmrg
403852f9793fSmrg	if test -n "$export_symbols" && test -n "$include_expsyms"; then
403952f9793fSmrg	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
404052f9793fSmrg	fi
404152f9793fSmrg
404252f9793fSmrg	tmp_deplibs=
404352f9793fSmrg	for test_deplib in $deplibs; do
404452f9793fSmrg		case " $convenience " in
404552f9793fSmrg		*" $test_deplib "*) ;;
404652f9793fSmrg		*)
404752f9793fSmrg			tmp_deplibs="$tmp_deplibs $test_deplib"
404852f9793fSmrg			;;
404952f9793fSmrg		esac
405052f9793fSmrg	done
405152f9793fSmrg	deplibs="$tmp_deplibs"
405252f9793fSmrg
405352f9793fSmrg	if test -n "$convenience"; then
405452f9793fSmrg	  if test -n "$whole_archive_flag_spec"; then
405552f9793fSmrg	    save_libobjs=$libobjs
405652f9793fSmrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
405752f9793fSmrg	  else
405852f9793fSmrg	    gentop="$output_objdir/${outputname}x"
405952f9793fSmrg	    generated="$generated $gentop"
406052f9793fSmrg
406152f9793fSmrg	    func_extract_archives $gentop $convenience
406252f9793fSmrg	    libobjs="$libobjs $func_extract_archives_result"
406352f9793fSmrg	  fi
406452f9793fSmrg	fi
406552f9793fSmrg	
406652f9793fSmrg	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
406752f9793fSmrg	  eval flag=\"$thread_safe_flag_spec\"
406852f9793fSmrg	  linker_flags="$linker_flags $flag"
406952f9793fSmrg	fi
407052f9793fSmrg
407152f9793fSmrg	# Make a backup of the uninstalled library when relinking
407252f9793fSmrg	if test "$mode" = relink; then
407352f9793fSmrg	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
407452f9793fSmrg	fi
407552f9793fSmrg
407652f9793fSmrg	# Do each of the archive commands.
407752f9793fSmrg	if test "$module" = yes && test -n "$module_cmds" ; then
407852f9793fSmrg	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
407952f9793fSmrg	    eval test_cmds=\"$module_expsym_cmds\"
408052f9793fSmrg	    cmds=$module_expsym_cmds
408152f9793fSmrg	  else
408252f9793fSmrg	    eval test_cmds=\"$module_cmds\"
408352f9793fSmrg	    cmds=$module_cmds
408452f9793fSmrg	  fi
408552f9793fSmrg	else
408652f9793fSmrg	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
408752f9793fSmrg	  eval test_cmds=\"$archive_expsym_cmds\"
408852f9793fSmrg	  cmds=$archive_expsym_cmds
408952f9793fSmrg	else
409052f9793fSmrg	  eval test_cmds=\"$archive_cmds\"
409152f9793fSmrg	  cmds=$archive_cmds
409252f9793fSmrg	  fi
409352f9793fSmrg	fi
409452f9793fSmrg
409552f9793fSmrg	if test "X$skipped_export" != "X:" &&
409652f9793fSmrg	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
409752f9793fSmrg	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
409852f9793fSmrg	  :
409952f9793fSmrg	else
410052f9793fSmrg	  # The command line is too long to link in one step, link piecewise.
410152f9793fSmrg	  $echo "creating reloadable object files..."
410252f9793fSmrg
410352f9793fSmrg	  # Save the value of $output and $libobjs because we want to
410452f9793fSmrg	  # use them later.  If we have whole_archive_flag_spec, we
410552f9793fSmrg	  # want to use save_libobjs as it was before
410652f9793fSmrg	  # whole_archive_flag_spec was expanded, because we can't
410752f9793fSmrg	  # assume the linker understands whole_archive_flag_spec.
410852f9793fSmrg	  # This may have to be revisited, in case too many
410952f9793fSmrg	  # convenience libraries get linked in and end up exceeding
411052f9793fSmrg	  # the spec.
411152f9793fSmrg	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
411252f9793fSmrg	    save_libobjs=$libobjs
411352f9793fSmrg	  fi
411452f9793fSmrg	  save_output=$output
411552f9793fSmrg	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
411652f9793fSmrg
411752f9793fSmrg	  # Clear the reloadable object creation command queue and
411852f9793fSmrg	  # initialize k to one.
411952f9793fSmrg	  test_cmds=
412052f9793fSmrg	  concat_cmds=
412152f9793fSmrg	  objlist=
412252f9793fSmrg	  delfiles=
412352f9793fSmrg	  last_robj=
412452f9793fSmrg	  k=1
412552f9793fSmrg	  output=$output_objdir/$output_la-${k}.$objext
412652f9793fSmrg	  # Loop over the list of objects to be linked.
412752f9793fSmrg	  for obj in $save_libobjs
412852f9793fSmrg	  do
412952f9793fSmrg	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
413052f9793fSmrg	    if test "X$objlist" = X ||
413152f9793fSmrg	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
413252f9793fSmrg		 test "$len" -le "$max_cmd_len"; }; then
413352f9793fSmrg	      objlist="$objlist $obj"
413452f9793fSmrg	    else
413552f9793fSmrg	      # The command $test_cmds is almost too long, add a
413652f9793fSmrg	      # command to the queue.
413752f9793fSmrg	      if test "$k" -eq 1 ; then
413852f9793fSmrg		# The first file doesn't have a previous command to add.
413952f9793fSmrg		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
414052f9793fSmrg	      else
414152f9793fSmrg		# All subsequent reloadable object files will link in
414252f9793fSmrg		# the last one created.
414352f9793fSmrg		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
414452f9793fSmrg	      fi
414552f9793fSmrg	      last_robj=$output_objdir/$output_la-${k}.$objext
414652f9793fSmrg	      k=`expr $k + 1`
414752f9793fSmrg	      output=$output_objdir/$output_la-${k}.$objext
414852f9793fSmrg	      objlist=$obj
414952f9793fSmrg	      len=1
415052f9793fSmrg	    fi
415152f9793fSmrg	  done
415252f9793fSmrg	  # Handle the remaining objects by creating one last
415352f9793fSmrg	  # reloadable object file.  All subsequent reloadable object
415452f9793fSmrg	  # files will link in the last one created.
415552f9793fSmrg	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
415652f9793fSmrg	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
415752f9793fSmrg
415852f9793fSmrg	  if ${skipped_export-false}; then
415952f9793fSmrg	    $show "generating symbol list for \`$libname.la'"
416052f9793fSmrg	    export_symbols="$output_objdir/$libname.exp"
416152f9793fSmrg	    $run $rm $export_symbols
416252f9793fSmrg	    libobjs=$output
416352f9793fSmrg	    # Append the command to create the export file.
416452f9793fSmrg	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
416552f9793fSmrg          fi
416652f9793fSmrg
416752f9793fSmrg	  # Set up a command to remove the reloadable object files
416852f9793fSmrg	  # after they are used.
416952f9793fSmrg	  i=0
417052f9793fSmrg	  while test "$i" -lt "$k"
417152f9793fSmrg	  do
417252f9793fSmrg	    i=`expr $i + 1`
417352f9793fSmrg	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
417452f9793fSmrg	  done
417552f9793fSmrg
417652f9793fSmrg	  $echo "creating a temporary reloadable object file: $output"
417752f9793fSmrg
417852f9793fSmrg	  # Loop through the commands generated above and execute them.
417952f9793fSmrg	  save_ifs="$IFS"; IFS='~'
418052f9793fSmrg	  for cmd in $concat_cmds; do
418152f9793fSmrg	    IFS="$save_ifs"
418252f9793fSmrg	    $show "$cmd"
418352f9793fSmrg	    $run eval "$cmd" || exit $?
418452f9793fSmrg	  done
418552f9793fSmrg	  IFS="$save_ifs"
418652f9793fSmrg
418752f9793fSmrg	  libobjs=$output
418852f9793fSmrg	  # Restore the value of output.
418952f9793fSmrg	  output=$save_output
419052f9793fSmrg
419152f9793fSmrg	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
419252f9793fSmrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
419352f9793fSmrg	  fi
419452f9793fSmrg	  # Expand the library linking commands again to reset the
419552f9793fSmrg	  # value of $libobjs for piecewise linking.
419652f9793fSmrg
419752f9793fSmrg	  # Do each of the archive commands.
419852f9793fSmrg	  if test "$module" = yes && test -n "$module_cmds" ; then
419952f9793fSmrg	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
420052f9793fSmrg	      cmds=$module_expsym_cmds
420152f9793fSmrg	    else
420252f9793fSmrg	      cmds=$module_cmds
420352f9793fSmrg	    fi
420452f9793fSmrg	  else
420552f9793fSmrg	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
420652f9793fSmrg	    cmds=$archive_expsym_cmds
420752f9793fSmrg	  else
420852f9793fSmrg	    cmds=$archive_cmds
420952f9793fSmrg	    fi
421052f9793fSmrg	  fi
421152f9793fSmrg
421252f9793fSmrg	  # Append the command to remove the reloadable object files
421352f9793fSmrg	  # to the just-reset $cmds.
421452f9793fSmrg	  eval cmds=\"\$cmds~\$rm $delfiles\"
421552f9793fSmrg	fi
421652f9793fSmrg	save_ifs="$IFS"; IFS='~'
421752f9793fSmrg	for cmd in $cmds; do
421852f9793fSmrg	  IFS="$save_ifs"
421952f9793fSmrg	  eval cmd=\"$cmd\"
422052f9793fSmrg	  $show "$cmd"
422152f9793fSmrg	  $run eval "$cmd" || {
422252f9793fSmrg	    lt_exit=$?
422352f9793fSmrg
422452f9793fSmrg	    # Restore the uninstalled library and exit
422552f9793fSmrg	    if test "$mode" = relink; then
422652f9793fSmrg	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
422752f9793fSmrg	    fi
422852f9793fSmrg
422952f9793fSmrg	    exit $lt_exit
423052f9793fSmrg	  }
423152f9793fSmrg	done
423252f9793fSmrg	IFS="$save_ifs"
423352f9793fSmrg
423452f9793fSmrg	# Restore the uninstalled library and exit
423552f9793fSmrg	if test "$mode" = relink; then
423652f9793fSmrg	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
423752f9793fSmrg
423852f9793fSmrg	  if test -n "$convenience"; then
423952f9793fSmrg	    if test -z "$whole_archive_flag_spec"; then
424052f9793fSmrg	      $show "${rm}r $gentop"
424152f9793fSmrg	      $run ${rm}r "$gentop"
424252f9793fSmrg	    fi
424352f9793fSmrg	  fi
424452f9793fSmrg
424552f9793fSmrg	  exit $EXIT_SUCCESS
424652f9793fSmrg	fi
424752f9793fSmrg
424852f9793fSmrg	# Create links to the real library.
424952f9793fSmrg	for linkname in $linknames; do
425052f9793fSmrg	  if test "$realname" != "$linkname"; then
425152f9793fSmrg	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
425252f9793fSmrg	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
425352f9793fSmrg	  fi
425452f9793fSmrg	done
425552f9793fSmrg
425652f9793fSmrg	# If -module or -export-dynamic was specified, set the dlname.
425752f9793fSmrg	if test "$module" = yes || test "$export_dynamic" = yes; then
425852f9793fSmrg	  # On all known operating systems, these are identical.
425952f9793fSmrg	  dlname="$soname"
426052f9793fSmrg	fi
426152f9793fSmrg      fi
426252f9793fSmrg      ;;
426352f9793fSmrg
426452f9793fSmrg    obj)
42652faa96e0Smrg      case " $deplibs" in
42662faa96e0Smrg      *\ -l* | *\ -L*)
42672faa96e0Smrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
42682faa96e0Smrg      esac
426952f9793fSmrg
427052f9793fSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
427152f9793fSmrg	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
427252f9793fSmrg      fi
427352f9793fSmrg
427452f9793fSmrg      if test -n "$rpath"; then
427552f9793fSmrg	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
427652f9793fSmrg      fi
427752f9793fSmrg
427852f9793fSmrg      if test -n "$xrpath"; then
427952f9793fSmrg	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
428052f9793fSmrg      fi
428152f9793fSmrg
428252f9793fSmrg      if test -n "$vinfo"; then
428352f9793fSmrg	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
428452f9793fSmrg      fi
428552f9793fSmrg
428652f9793fSmrg      if test -n "$release"; then
428752f9793fSmrg	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
428852f9793fSmrg      fi
428952f9793fSmrg
429052f9793fSmrg      case $output in
429152f9793fSmrg      *.lo)
429252f9793fSmrg	if test -n "$objs$old_deplibs"; then
429352f9793fSmrg	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
429452f9793fSmrg	  exit $EXIT_FAILURE
429552f9793fSmrg	fi
429652f9793fSmrg	libobj="$output"
429752f9793fSmrg	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
429852f9793fSmrg	;;
429952f9793fSmrg      *)
430052f9793fSmrg	libobj=
430152f9793fSmrg	obj="$output"
430252f9793fSmrg	;;
430352f9793fSmrg      esac
430452f9793fSmrg
430552f9793fSmrg      # Delete the old objects.
430652f9793fSmrg      $run $rm $obj $libobj
430752f9793fSmrg
430852f9793fSmrg      # Objects from convenience libraries.  This assumes
430952f9793fSmrg      # single-version convenience libraries.  Whenever we create
431052f9793fSmrg      # different ones for PIC/non-PIC, this we'll have to duplicate
431152f9793fSmrg      # the extraction.
431252f9793fSmrg      reload_conv_objs=
431352f9793fSmrg      gentop=
431452f9793fSmrg      # reload_cmds runs $LD directly, so let us get rid of
43152faa96e0Smrg      # -Wl from whole_archive_flag_spec and hope we can get by with
43162faa96e0Smrg      # turning comma into space..
431752f9793fSmrg      wl=
431852f9793fSmrg
431952f9793fSmrg      if test -n "$convenience"; then
432052f9793fSmrg	if test -n "$whole_archive_flag_spec"; then
43212faa96e0Smrg	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
43222faa96e0Smrg	  reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
432352f9793fSmrg	else
432452f9793fSmrg	  gentop="$output_objdir/${obj}x"
432552f9793fSmrg	  generated="$generated $gentop"
432652f9793fSmrg
432752f9793fSmrg	  func_extract_archives $gentop $convenience
432852f9793fSmrg	  reload_conv_objs="$reload_objs $func_extract_archives_result"
432952f9793fSmrg	fi
433052f9793fSmrg      fi
433152f9793fSmrg
433252f9793fSmrg      # Create the old-style object.
433352f9793fSmrg      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
433452f9793fSmrg
433552f9793fSmrg      output="$obj"
433652f9793fSmrg      cmds=$reload_cmds
433752f9793fSmrg      save_ifs="$IFS"; IFS='~'
433852f9793fSmrg      for cmd in $cmds; do
433952f9793fSmrg	IFS="$save_ifs"
434052f9793fSmrg	eval cmd=\"$cmd\"
434152f9793fSmrg	$show "$cmd"
434252f9793fSmrg	$run eval "$cmd" || exit $?
434352f9793fSmrg      done
434452f9793fSmrg      IFS="$save_ifs"
434552f9793fSmrg
434652f9793fSmrg      # Exit if we aren't doing a library object file.
434752f9793fSmrg      if test -z "$libobj"; then
434852f9793fSmrg	if test -n "$gentop"; then
434952f9793fSmrg	  $show "${rm}r $gentop"
435052f9793fSmrg	  $run ${rm}r $gentop
435152f9793fSmrg	fi
435252f9793fSmrg
435352f9793fSmrg	exit $EXIT_SUCCESS
435452f9793fSmrg      fi
435552f9793fSmrg
435652f9793fSmrg      if test "$build_libtool_libs" != yes; then
435752f9793fSmrg	if test -n "$gentop"; then
435852f9793fSmrg	  $show "${rm}r $gentop"
435952f9793fSmrg	  $run ${rm}r $gentop
436052f9793fSmrg	fi
436152f9793fSmrg
436252f9793fSmrg	# Create an invalid libtool object if no PIC, so that we don't
436352f9793fSmrg	# accidentally link it into a program.
436452f9793fSmrg	# $show "echo timestamp > $libobj"
436552f9793fSmrg	# $run eval "echo timestamp > $libobj" || exit $?
436652f9793fSmrg	exit $EXIT_SUCCESS
436752f9793fSmrg      fi
436852f9793fSmrg
436952f9793fSmrg      if test -n "$pic_flag" || test "$pic_mode" != default; then
437052f9793fSmrg	# Only do commands if we really have different PIC objects.
437152f9793fSmrg	reload_objs="$libobjs $reload_conv_objs"
437252f9793fSmrg	output="$libobj"
437352f9793fSmrg	cmds=$reload_cmds
437452f9793fSmrg	save_ifs="$IFS"; IFS='~'
437552f9793fSmrg	for cmd in $cmds; do
437652f9793fSmrg	  IFS="$save_ifs"
437752f9793fSmrg	  eval cmd=\"$cmd\"
437852f9793fSmrg	  $show "$cmd"
437952f9793fSmrg	  $run eval "$cmd" || exit $?
438052f9793fSmrg	done
438152f9793fSmrg	IFS="$save_ifs"
438252f9793fSmrg      fi
438352f9793fSmrg
438452f9793fSmrg      if test -n "$gentop"; then
438552f9793fSmrg	$show "${rm}r $gentop"
438652f9793fSmrg	$run ${rm}r $gentop
438752f9793fSmrg      fi
438852f9793fSmrg
438952f9793fSmrg      exit $EXIT_SUCCESS
439052f9793fSmrg      ;;
439152f9793fSmrg
439252f9793fSmrg    prog)
439352f9793fSmrg      case $host in
439452f9793fSmrg	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
439552f9793fSmrg      esac
439652f9793fSmrg      if test -n "$vinfo"; then
439752f9793fSmrg	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
439852f9793fSmrg      fi
439952f9793fSmrg
440052f9793fSmrg      if test -n "$release"; then
440152f9793fSmrg	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
440252f9793fSmrg      fi
440352f9793fSmrg
440452f9793fSmrg      if test "$preload" = yes; then
440552f9793fSmrg	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
440652f9793fSmrg	   test "$dlopen_self_static" = unknown; then
440752f9793fSmrg	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
440852f9793fSmrg	fi
440952f9793fSmrg      fi
441052f9793fSmrg
441152f9793fSmrg      case $host in
441252f9793fSmrg      *-*-rhapsody* | *-*-darwin1.[012])
441352f9793fSmrg	# On Rhapsody replace the C library is the System framework
441452f9793fSmrg	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
441552f9793fSmrg	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
441652f9793fSmrg	;;
441752f9793fSmrg      esac
441852f9793fSmrg
441952f9793fSmrg      case $host in
442052f9793fSmrg      *darwin*)
442152f9793fSmrg        # Don't allow lazy linking, it breaks C++ global constructors
442252f9793fSmrg        if test "$tagname" = CXX ; then
442352f9793fSmrg        compile_command="$compile_command ${wl}-bind_at_load"
442452f9793fSmrg        finalize_command="$finalize_command ${wl}-bind_at_load"
442552f9793fSmrg        fi
442652f9793fSmrg        ;;
442752f9793fSmrg      esac
442852f9793fSmrg
442952f9793fSmrg
443052f9793fSmrg      # move library search paths that coincide with paths to not yet
443152f9793fSmrg      # installed libraries to the beginning of the library search list
443252f9793fSmrg      new_libs=
443352f9793fSmrg      for path in $notinst_path; do
443452f9793fSmrg	case " $new_libs " in
443552f9793fSmrg	*" -L$path/$objdir "*) ;;
443652f9793fSmrg	*)
443752f9793fSmrg	  case " $compile_deplibs " in
443852f9793fSmrg	  *" -L$path/$objdir "*)
443952f9793fSmrg	    new_libs="$new_libs -L$path/$objdir" ;;
444052f9793fSmrg	  esac
444152f9793fSmrg	  ;;
444252f9793fSmrg	esac
444352f9793fSmrg      done
444452f9793fSmrg      for deplib in $compile_deplibs; do
444552f9793fSmrg	case $deplib in
444652f9793fSmrg	-L*)
444752f9793fSmrg	  case " $new_libs " in
444852f9793fSmrg	  *" $deplib "*) ;;
444952f9793fSmrg	  *) new_libs="$new_libs $deplib" ;;
445052f9793fSmrg	  esac
445152f9793fSmrg	  ;;
445252f9793fSmrg	*) new_libs="$new_libs $deplib" ;;
445352f9793fSmrg	esac
445452f9793fSmrg      done
445552f9793fSmrg      compile_deplibs="$new_libs"
445652f9793fSmrg
445752f9793fSmrg
445852f9793fSmrg      compile_command="$compile_command $compile_deplibs"
445952f9793fSmrg      finalize_command="$finalize_command $finalize_deplibs"
446052f9793fSmrg
446152f9793fSmrg      if test -n "$rpath$xrpath"; then
446252f9793fSmrg	# If the user specified any rpath flags, then add them.
446352f9793fSmrg	for libdir in $rpath $xrpath; do
446452f9793fSmrg	  # This is the magic to use -rpath.
446552f9793fSmrg	  case "$finalize_rpath " in
446652f9793fSmrg	  *" $libdir "*) ;;
446752f9793fSmrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
446852f9793fSmrg	  esac
446952f9793fSmrg	done
447052f9793fSmrg      fi
447152f9793fSmrg
447252f9793fSmrg      # Now hardcode the library paths
447352f9793fSmrg      rpath=
447452f9793fSmrg      hardcode_libdirs=
447552f9793fSmrg      for libdir in $compile_rpath $finalize_rpath; do
447652f9793fSmrg	if test -n "$hardcode_libdir_flag_spec"; then
447752f9793fSmrg	  if test -n "$hardcode_libdir_separator"; then
447852f9793fSmrg	    if test -z "$hardcode_libdirs"; then
447952f9793fSmrg	      hardcode_libdirs="$libdir"
448052f9793fSmrg	    else
448152f9793fSmrg	      # Just accumulate the unique libdirs.
448252f9793fSmrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
448352f9793fSmrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
448452f9793fSmrg		;;
448552f9793fSmrg	      *)
448652f9793fSmrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
448752f9793fSmrg		;;
448852f9793fSmrg	      esac
448952f9793fSmrg	    fi
449052f9793fSmrg	  else
449152f9793fSmrg	    eval flag=\"$hardcode_libdir_flag_spec\"
449252f9793fSmrg	    rpath="$rpath $flag"
449352f9793fSmrg	  fi
449452f9793fSmrg	elif test -n "$runpath_var"; then
449552f9793fSmrg	  case "$perm_rpath " in
449652f9793fSmrg	  *" $libdir "*) ;;
449752f9793fSmrg	  *) perm_rpath="$perm_rpath $libdir" ;;
449852f9793fSmrg	  esac
449952f9793fSmrg	fi
450052f9793fSmrg	case $host in
450152f9793fSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
450252f9793fSmrg	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
450352f9793fSmrg	  case :$dllsearchpath: in
450452f9793fSmrg	  *":$libdir:"*) ;;
450552f9793fSmrg	  *) dllsearchpath="$dllsearchpath:$libdir";;
450652f9793fSmrg	  esac
450752f9793fSmrg	  case :$dllsearchpath: in
450852f9793fSmrg	  *":$testbindir:"*) ;;
450952f9793fSmrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
451052f9793fSmrg	  esac
451152f9793fSmrg	  ;;
451252f9793fSmrg	esac
451352f9793fSmrg      done
451452f9793fSmrg      # Substitute the hardcoded libdirs into the rpath.
451552f9793fSmrg      if test -n "$hardcode_libdir_separator" &&
451652f9793fSmrg	 test -n "$hardcode_libdirs"; then
451752f9793fSmrg	libdir="$hardcode_libdirs"
451852f9793fSmrg	eval rpath=\" $hardcode_libdir_flag_spec\"
451952f9793fSmrg      fi
452052f9793fSmrg      compile_rpath="$rpath"
452152f9793fSmrg
452252f9793fSmrg      rpath=
452352f9793fSmrg      hardcode_libdirs=
452452f9793fSmrg      for libdir in $finalize_rpath; do
452552f9793fSmrg	if test -n "$hardcode_libdir_flag_spec"; then
452652f9793fSmrg	  if test -n "$hardcode_libdir_separator"; then
452752f9793fSmrg	    if test -z "$hardcode_libdirs"; then
452852f9793fSmrg	      hardcode_libdirs="$libdir"
452952f9793fSmrg	    else
453052f9793fSmrg	      # Just accumulate the unique libdirs.
453152f9793fSmrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
453252f9793fSmrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
453352f9793fSmrg		;;
453452f9793fSmrg	      *)
453552f9793fSmrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
453652f9793fSmrg		;;
453752f9793fSmrg	      esac
453852f9793fSmrg	    fi
453952f9793fSmrg	  else
454052f9793fSmrg	    eval flag=\"$hardcode_libdir_flag_spec\"
454152f9793fSmrg	    rpath="$rpath $flag"
454252f9793fSmrg	  fi
454352f9793fSmrg	elif test -n "$runpath_var"; then
454452f9793fSmrg	  case "$finalize_perm_rpath " in
454552f9793fSmrg	  *" $libdir "*) ;;
454652f9793fSmrg	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
454752f9793fSmrg	  esac
454852f9793fSmrg	fi
454952f9793fSmrg      done
455052f9793fSmrg      # Substitute the hardcoded libdirs into the rpath.
455152f9793fSmrg      if test -n "$hardcode_libdir_separator" &&
455252f9793fSmrg	 test -n "$hardcode_libdirs"; then
455352f9793fSmrg	libdir="$hardcode_libdirs"
455452f9793fSmrg	eval rpath=\" $hardcode_libdir_flag_spec\"
455552f9793fSmrg      fi
455652f9793fSmrg      finalize_rpath="$rpath"
455752f9793fSmrg
455852f9793fSmrg      if test -n "$libobjs" && test "$build_old_libs" = yes; then
455952f9793fSmrg	# Transform all the library objects into standard objects.
456052f9793fSmrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
456152f9793fSmrg	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
456252f9793fSmrg      fi
456352f9793fSmrg
456452f9793fSmrg      dlsyms=
456552f9793fSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
456652f9793fSmrg	if test -n "$NM" && test -n "$global_symbol_pipe"; then
456752f9793fSmrg	  dlsyms="${outputname}S.c"
456852f9793fSmrg	else
456952f9793fSmrg	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
457052f9793fSmrg	fi
457152f9793fSmrg      fi
457252f9793fSmrg
457352f9793fSmrg      if test -n "$dlsyms"; then
457452f9793fSmrg	case $dlsyms in
457552f9793fSmrg	"") ;;
457652f9793fSmrg	*.c)
457752f9793fSmrg	  # Discover the nlist of each of the dlfiles.
457852f9793fSmrg	  nlist="$output_objdir/${outputname}.nm"
457952f9793fSmrg
458052f9793fSmrg	  $show "$rm $nlist ${nlist}S ${nlist}T"
458152f9793fSmrg	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
458252f9793fSmrg
458352f9793fSmrg	  # Parse the name list into a source file.
458452f9793fSmrg	  $show "creating $output_objdir/$dlsyms"
458552f9793fSmrg
458652f9793fSmrg	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
458752f9793fSmrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
458852f9793fSmrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
458952f9793fSmrg
459052f9793fSmrg#ifdef __cplusplus
459152f9793fSmrgextern \"C\" {
459252f9793fSmrg#endif
459352f9793fSmrg
459452f9793fSmrg/* Prevent the only kind of declaration conflicts we can make. */
459552f9793fSmrg#define lt_preloaded_symbols some_other_symbol
459652f9793fSmrg
459752f9793fSmrg/* External symbol declarations for the compiler. */\
459852f9793fSmrg"
459952f9793fSmrg
460052f9793fSmrg	  if test "$dlself" = yes; then
460152f9793fSmrg	    $show "generating symbol list for \`$output'"
460252f9793fSmrg
460352f9793fSmrg	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
460452f9793fSmrg
460552f9793fSmrg	    # Add our own program objects to the symbol list.
460652f9793fSmrg	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
460752f9793fSmrg	    for arg in $progfiles; do
460852f9793fSmrg	      $show "extracting global C symbols from \`$arg'"
460952f9793fSmrg	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
461052f9793fSmrg	    done
461152f9793fSmrg
461252f9793fSmrg	    if test -n "$exclude_expsyms"; then
461352f9793fSmrg	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
461452f9793fSmrg	      $run eval '$mv "$nlist"T "$nlist"'
461552f9793fSmrg	    fi
461652f9793fSmrg
461752f9793fSmrg	    if test -n "$export_symbols_regex"; then
461852f9793fSmrg	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
461952f9793fSmrg	      $run eval '$mv "$nlist"T "$nlist"'
462052f9793fSmrg	    fi
462152f9793fSmrg
462252f9793fSmrg	    # Prepare the list of exported symbols
462352f9793fSmrg	    if test -z "$export_symbols"; then
462452f9793fSmrg	      export_symbols="$output_objdir/$outputname.exp"
462552f9793fSmrg	      $run $rm $export_symbols
462652f9793fSmrg	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
462752f9793fSmrg              case $host in
462852f9793fSmrg              *cygwin* | *mingw* )
462952f9793fSmrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
463052f9793fSmrg		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
463152f9793fSmrg                ;;
463252f9793fSmrg              esac
463352f9793fSmrg	    else
463452f9793fSmrg	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
463552f9793fSmrg	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
463652f9793fSmrg	      $run eval 'mv "$nlist"T "$nlist"'
463752f9793fSmrg              case $host in
463852f9793fSmrg              *cygwin* | *mingw* )
463952f9793fSmrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
464052f9793fSmrg		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
464152f9793fSmrg                ;;
464252f9793fSmrg              esac
464352f9793fSmrg	    fi
464452f9793fSmrg	  fi
464552f9793fSmrg
464652f9793fSmrg	  for arg in $dlprefiles; do
464752f9793fSmrg	    $show "extracting global C symbols from \`$arg'"
464852f9793fSmrg	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
464952f9793fSmrg	    $run eval '$echo ": $name " >> "$nlist"'
465052f9793fSmrg	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
465152f9793fSmrg	  done
465252f9793fSmrg
465352f9793fSmrg	  if test -z "$run"; then
465452f9793fSmrg	    # Make sure we have at least an empty file.
465552f9793fSmrg	    test -f "$nlist" || : > "$nlist"
465652f9793fSmrg
465752f9793fSmrg	    if test -n "$exclude_expsyms"; then
465852f9793fSmrg	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
465952f9793fSmrg	      $mv "$nlist"T "$nlist"
466052f9793fSmrg	    fi
466152f9793fSmrg
466252f9793fSmrg	    # Try sorting and uniquifying the output.
466352f9793fSmrg	    if grep -v "^: " < "$nlist" |
466452f9793fSmrg		if sort -k 3 </dev/null >/dev/null 2>&1; then
466552f9793fSmrg		  sort -k 3
466652f9793fSmrg		else
466752f9793fSmrg		  sort +2
466852f9793fSmrg		fi |
466952f9793fSmrg		uniq > "$nlist"S; then
467052f9793fSmrg	      :
467152f9793fSmrg	    else
467252f9793fSmrg	      grep -v "^: " < "$nlist" > "$nlist"S
467352f9793fSmrg	    fi
467452f9793fSmrg
467552f9793fSmrg	    if test -f "$nlist"S; then
467652f9793fSmrg	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
467752f9793fSmrg	    else
467852f9793fSmrg	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
467952f9793fSmrg	    fi
468052f9793fSmrg
468152f9793fSmrg	    $echo >> "$output_objdir/$dlsyms" "\
468252f9793fSmrg
468352f9793fSmrg#undef lt_preloaded_symbols
468452f9793fSmrg
468552f9793fSmrg#if defined (__STDC__) && __STDC__
468652f9793fSmrg# define lt_ptr void *
468752f9793fSmrg#else
468852f9793fSmrg# define lt_ptr char *
468952f9793fSmrg# define const
469052f9793fSmrg#endif
469152f9793fSmrg
469252f9793fSmrg/* The mapping between symbol names and symbols. */
469352f9793fSmrg"
469452f9793fSmrg
469552f9793fSmrg	    case $host in
469652f9793fSmrg	    *cygwin* | *mingw* )
469752f9793fSmrg	  $echo >> "$output_objdir/$dlsyms" "\
469852f9793fSmrg/* DATA imports from DLLs on WIN32 can't be const, because
469952f9793fSmrg   runtime relocations are performed -- see ld's documentation
470052f9793fSmrg   on pseudo-relocs */
470152f9793fSmrgstruct {
470252f9793fSmrg"
470352f9793fSmrg	      ;;
470452f9793fSmrg	    * )
470552f9793fSmrg	  $echo >> "$output_objdir/$dlsyms" "\
470652f9793fSmrgconst struct {
470752f9793fSmrg"
470852f9793fSmrg	      ;;
470952f9793fSmrg	    esac
471052f9793fSmrg
471152f9793fSmrg
471252f9793fSmrg	  $echo >> "$output_objdir/$dlsyms" "\
471352f9793fSmrg  const char *name;
471452f9793fSmrg  lt_ptr address;
471552f9793fSmrg}
471652f9793fSmrglt_preloaded_symbols[] =
471752f9793fSmrg{\
471852f9793fSmrg"
471952f9793fSmrg
472052f9793fSmrg	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
472152f9793fSmrg
472252f9793fSmrg	    $echo >> "$output_objdir/$dlsyms" "\
472352f9793fSmrg  {0, (lt_ptr) 0}
472452f9793fSmrg};
472552f9793fSmrg
472652f9793fSmrg/* This works around a problem in FreeBSD linker */
472752f9793fSmrg#ifdef FREEBSD_WORKAROUND
472852f9793fSmrgstatic const void *lt_preloaded_setup() {
472952f9793fSmrg  return lt_preloaded_symbols;
473052f9793fSmrg}
473152f9793fSmrg#endif
473252f9793fSmrg
473352f9793fSmrg#ifdef __cplusplus
473452f9793fSmrg}
473552f9793fSmrg#endif\
473652f9793fSmrg"
473752f9793fSmrg	  fi
473852f9793fSmrg
473952f9793fSmrg	  pic_flag_for_symtable=
474052f9793fSmrg	  case $host in
474152f9793fSmrg	  # compiling the symbol table file with pic_flag works around
474252f9793fSmrg	  # a FreeBSD bug that causes programs to crash when -lm is
474352f9793fSmrg	  # linked before any other PIC object.  But we must not use
474452f9793fSmrg	  # pic_flag when linking with -static.  The problem exists in
474552f9793fSmrg	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
474652f9793fSmrg	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
474752f9793fSmrg	    case "$compile_command " in
474852f9793fSmrg	    *" -static "*) ;;
474952f9793fSmrg	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
475052f9793fSmrg	    esac;;
475152f9793fSmrg	  *-*-hpux*)
475252f9793fSmrg	    case "$compile_command " in
475352f9793fSmrg	    *" -static "*) ;;
475452f9793fSmrg	    *) pic_flag_for_symtable=" $pic_flag";;
475552f9793fSmrg	    esac
475652f9793fSmrg	  esac
475752f9793fSmrg
475852f9793fSmrg	  # Now compile the dynamic symbol file.
475952f9793fSmrg	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
476052f9793fSmrg	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
476152f9793fSmrg
476252f9793fSmrg	  # Clean up the generated files.
476352f9793fSmrg	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
476452f9793fSmrg	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
476552f9793fSmrg
476652f9793fSmrg	  # Transform the symbol file into the correct name.
476752f9793fSmrg          case $host in
476852f9793fSmrg          *cygwin* | *mingw* )
476952f9793fSmrg            if test -f "$output_objdir/${outputname}.def" ; then
47702faa96e0Smrg              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
47712faa96e0Smrg              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
477252f9793fSmrg            else
47732faa96e0Smrg              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
47742faa96e0Smrg              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
477552f9793fSmrg             fi
477652f9793fSmrg            ;;
477752f9793fSmrg          * )
47782faa96e0Smrg            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
47792faa96e0Smrg            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
478052f9793fSmrg            ;;
478152f9793fSmrg          esac
478252f9793fSmrg	  ;;
478352f9793fSmrg	*)
478452f9793fSmrg	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
478552f9793fSmrg	  exit $EXIT_FAILURE
478652f9793fSmrg	  ;;
478752f9793fSmrg	esac
478852f9793fSmrg      else
478952f9793fSmrg	# We keep going just in case the user didn't refer to
479052f9793fSmrg	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
479152f9793fSmrg	# really was required.
479252f9793fSmrg
479352f9793fSmrg	# Nullify the symbol file.
47942faa96e0Smrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
47952faa96e0Smrg	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
479652f9793fSmrg      fi
479752f9793fSmrg
479852f9793fSmrg      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
479952f9793fSmrg	# Replace the output file specification.
48002faa96e0Smrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
480152f9793fSmrg	link_command="$compile_command$compile_rpath"
480252f9793fSmrg
480352f9793fSmrg	# We have no uninstalled library dependencies, so finalize right now.
480452f9793fSmrg	$show "$link_command"
480552f9793fSmrg	$run eval "$link_command"
480652f9793fSmrg	exit_status=$?
480752f9793fSmrg
480852f9793fSmrg	# Delete the generated files.
480952f9793fSmrg	if test -n "$dlsyms"; then
481052f9793fSmrg	  $show "$rm $output_objdir/${outputname}S.${objext}"
481152f9793fSmrg	  $run $rm "$output_objdir/${outputname}S.${objext}"
481252f9793fSmrg	fi
481352f9793fSmrg
481452f9793fSmrg	exit $exit_status
481552f9793fSmrg      fi
481652f9793fSmrg
481752f9793fSmrg      if test -n "$shlibpath_var"; then
481852f9793fSmrg	# We should set the shlibpath_var
481952f9793fSmrg	rpath=
482052f9793fSmrg	for dir in $temp_rpath; do
482152f9793fSmrg	  case $dir in
482252f9793fSmrg	  [\\/]* | [A-Za-z]:[\\/]*)
482352f9793fSmrg	    # Absolute path.
482452f9793fSmrg	    rpath="$rpath$dir:"
482552f9793fSmrg	    ;;
482652f9793fSmrg	  *)
482752f9793fSmrg	    # Relative path: add a thisdir entry.
482852f9793fSmrg	    rpath="$rpath\$thisdir/$dir:"
482952f9793fSmrg	    ;;
483052f9793fSmrg	  esac
483152f9793fSmrg	done
483252f9793fSmrg	temp_rpath="$rpath"
483352f9793fSmrg      fi
483452f9793fSmrg
483552f9793fSmrg      if test -n "$compile_shlibpath$finalize_shlibpath"; then
483652f9793fSmrg	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
483752f9793fSmrg      fi
483852f9793fSmrg      if test -n "$finalize_shlibpath"; then
483952f9793fSmrg	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
484052f9793fSmrg      fi
484152f9793fSmrg
484252f9793fSmrg      compile_var=
484352f9793fSmrg      finalize_var=
484452f9793fSmrg      if test -n "$runpath_var"; then
484552f9793fSmrg	if test -n "$perm_rpath"; then
484652f9793fSmrg	  # We should set the runpath_var.
484752f9793fSmrg	  rpath=
484852f9793fSmrg	  for dir in $perm_rpath; do
484952f9793fSmrg	    rpath="$rpath$dir:"
485052f9793fSmrg	  done
485152f9793fSmrg	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
485252f9793fSmrg	fi
485352f9793fSmrg	if test -n "$finalize_perm_rpath"; then
485452f9793fSmrg	  # We should set the runpath_var.
485552f9793fSmrg	  rpath=
485652f9793fSmrg	  for dir in $finalize_perm_rpath; do
485752f9793fSmrg	    rpath="$rpath$dir:"
485852f9793fSmrg	  done
485952f9793fSmrg	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
486052f9793fSmrg	fi
486152f9793fSmrg      fi
486252f9793fSmrg
486352f9793fSmrg      if test "$no_install" = yes; then
486452f9793fSmrg	# We don't need to create a wrapper script.
486552f9793fSmrg	link_command="$compile_var$compile_command$compile_rpath"
486652f9793fSmrg	# Replace the output file specification.
486752f9793fSmrg	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
486852f9793fSmrg	# Delete the old output file.
486952f9793fSmrg	$run $rm $output
487052f9793fSmrg	# Link the executable and exit
487152f9793fSmrg	$show "$link_command"
487252f9793fSmrg	$run eval "$link_command" || exit $?
487352f9793fSmrg	exit $EXIT_SUCCESS
487452f9793fSmrg      fi
487552f9793fSmrg
487652f9793fSmrg      if test "$hardcode_action" = relink; then
487752f9793fSmrg	# Fast installation is not supported
487852f9793fSmrg	link_command="$compile_var$compile_command$compile_rpath"
487952f9793fSmrg	relink_command="$finalize_var$finalize_command$finalize_rpath"
488052f9793fSmrg
488152f9793fSmrg	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
488252f9793fSmrg	$echo "$modename: \`$output' will be relinked during installation" 1>&2
488352f9793fSmrg      else
488452f9793fSmrg	if test "$fast_install" != no; then
488552f9793fSmrg	  link_command="$finalize_var$compile_command$finalize_rpath"
488652f9793fSmrg	  if test "$fast_install" = yes; then
48872faa96e0Smrg	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
488852f9793fSmrg	  else
488952f9793fSmrg	    # fast_install is set to needless
489052f9793fSmrg	    relink_command=
489152f9793fSmrg	  fi
489252f9793fSmrg	else
489352f9793fSmrg	  link_command="$compile_var$compile_command$compile_rpath"
489452f9793fSmrg	  relink_command="$finalize_var$finalize_command$finalize_rpath"
489552f9793fSmrg	fi
489652f9793fSmrg      fi
489752f9793fSmrg
489852f9793fSmrg      # Replace the output file specification.
489952f9793fSmrg      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
490052f9793fSmrg
490152f9793fSmrg      # Delete the old output files.
490252f9793fSmrg      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
490352f9793fSmrg
490452f9793fSmrg      $show "$link_command"
490552f9793fSmrg      $run eval "$link_command" || exit $?
490652f9793fSmrg
490752f9793fSmrg      # Now create the wrapper script.
490852f9793fSmrg      $show "creating $output"
490952f9793fSmrg
491052f9793fSmrg      # Quote the relink command for shipping.
491152f9793fSmrg      if test -n "$relink_command"; then
491252f9793fSmrg	# Preserve any variables that may affect compiler behavior
491352f9793fSmrg	for var in $variables_saved_for_relink; do
491452f9793fSmrg	  if eval test -z \"\${$var+set}\"; then
491552f9793fSmrg	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
491652f9793fSmrg	  elif eval var_value=\$$var; test -z "$var_value"; then
491752f9793fSmrg	    relink_command="$var=; export $var; $relink_command"
491852f9793fSmrg	  else
491952f9793fSmrg	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
492052f9793fSmrg	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
492152f9793fSmrg	  fi
492252f9793fSmrg	done
492352f9793fSmrg	relink_command="(cd `pwd`; $relink_command)"
49242faa96e0Smrg	relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
492552f9793fSmrg      fi
492652f9793fSmrg
492752f9793fSmrg      # Quote $echo for shipping.
492852f9793fSmrg      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
492952f9793fSmrg	case $progpath in
493052f9793fSmrg	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
493152f9793fSmrg	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
493252f9793fSmrg	esac
493352f9793fSmrg	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
493452f9793fSmrg      else
493552f9793fSmrg	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
493652f9793fSmrg      fi
493752f9793fSmrg
493852f9793fSmrg      # Only actually do things if our run command is non-null.
493952f9793fSmrg      if test -z "$run"; then
494052f9793fSmrg	# win32 will think the script is a binary if it has
494152f9793fSmrg	# a .exe suffix, so we strip it off here.
494252f9793fSmrg	case $output in
494352f9793fSmrg	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
494452f9793fSmrg	esac
494552f9793fSmrg	# test for cygwin because mv fails w/o .exe extensions
494652f9793fSmrg	case $host in
494752f9793fSmrg	  *cygwin*)
494852f9793fSmrg	    exeext=.exe
494952f9793fSmrg	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
495052f9793fSmrg	  *) exeext= ;;
495152f9793fSmrg	esac
495252f9793fSmrg	case $host in
495352f9793fSmrg	  *cygwin* | *mingw* )
495452f9793fSmrg            output_name=`basename $output`
495552f9793fSmrg            output_path=`dirname $output`
495652f9793fSmrg            cwrappersource="$output_path/$objdir/lt-$output_name.c"
495752f9793fSmrg            cwrapper="$output_path/$output_name.exe"
495852f9793fSmrg            $rm $cwrappersource $cwrapper
495952f9793fSmrg            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
496052f9793fSmrg
496152f9793fSmrg	    cat > $cwrappersource <<EOF
496252f9793fSmrg
496352f9793fSmrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
496452f9793fSmrg   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
496552f9793fSmrg
496652f9793fSmrg   The $output program cannot be directly executed until all the libtool
496752f9793fSmrg   libraries that it depends on are installed.
496852f9793fSmrg
496952f9793fSmrg   This wrapper executable should never be moved out of the build directory.
497052f9793fSmrg   If it is, it will not operate correctly.
497152f9793fSmrg
497252f9793fSmrg   Currently, it simply execs the wrapper *script* "/bin/sh $output",
497352f9793fSmrg   but could eventually absorb all of the scripts functionality and
497452f9793fSmrg   exec $objdir/$outputname directly.
497552f9793fSmrg*/
497652f9793fSmrgEOF
497752f9793fSmrg	    cat >> $cwrappersource<<"EOF"
497852f9793fSmrg#include <stdio.h>
497952f9793fSmrg#include <stdlib.h>
498052f9793fSmrg#include <unistd.h>
498152f9793fSmrg#include <malloc.h>
498252f9793fSmrg#include <stdarg.h>
498352f9793fSmrg#include <assert.h>
498452f9793fSmrg#include <string.h>
498552f9793fSmrg#include <ctype.h>
498652f9793fSmrg#include <sys/stat.h>
498752f9793fSmrg
498852f9793fSmrg#if defined(PATH_MAX)
498952f9793fSmrg# define LT_PATHMAX PATH_MAX
499052f9793fSmrg#elif defined(MAXPATHLEN)
499152f9793fSmrg# define LT_PATHMAX MAXPATHLEN
499252f9793fSmrg#else
499352f9793fSmrg# define LT_PATHMAX 1024
499452f9793fSmrg#endif
499552f9793fSmrg
499652f9793fSmrg#ifndef DIR_SEPARATOR
499752f9793fSmrg# define DIR_SEPARATOR '/'
499852f9793fSmrg# define PATH_SEPARATOR ':'
499952f9793fSmrg#endif
500052f9793fSmrg
500152f9793fSmrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
500252f9793fSmrg  defined (__OS2__)
500352f9793fSmrg# define HAVE_DOS_BASED_FILE_SYSTEM
500452f9793fSmrg# ifndef DIR_SEPARATOR_2
500552f9793fSmrg#  define DIR_SEPARATOR_2 '\\'
500652f9793fSmrg# endif
500752f9793fSmrg# ifndef PATH_SEPARATOR_2
500852f9793fSmrg#  define PATH_SEPARATOR_2 ';'
500952f9793fSmrg# endif
501052f9793fSmrg#endif
501152f9793fSmrg
501252f9793fSmrg#ifndef DIR_SEPARATOR_2
501352f9793fSmrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
501452f9793fSmrg#else /* DIR_SEPARATOR_2 */
501552f9793fSmrg# define IS_DIR_SEPARATOR(ch) \
501652f9793fSmrg        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
501752f9793fSmrg#endif /* DIR_SEPARATOR_2 */
501852f9793fSmrg
501952f9793fSmrg#ifndef PATH_SEPARATOR_2
502052f9793fSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
502152f9793fSmrg#else /* PATH_SEPARATOR_2 */
502252f9793fSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
502352f9793fSmrg#endif /* PATH_SEPARATOR_2 */
502452f9793fSmrg
502552f9793fSmrg#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
502652f9793fSmrg#define XFREE(stale) do { \
502752f9793fSmrg  if (stale) { free ((void *) stale); stale = 0; } \
502852f9793fSmrg} while (0)
502952f9793fSmrg
503052f9793fSmrg/* -DDEBUG is fairly common in CFLAGS.  */
503152f9793fSmrg#undef DEBUG
503252f9793fSmrg#if defined DEBUGWRAPPER
503352f9793fSmrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
503452f9793fSmrg#else
503552f9793fSmrg# define DEBUG(format, ...)
503652f9793fSmrg#endif
503752f9793fSmrg
503852f9793fSmrgconst char *program_name = NULL;
503952f9793fSmrg
504052f9793fSmrgvoid * xmalloc (size_t num);
504152f9793fSmrgchar * xstrdup (const char *string);
504252f9793fSmrgconst char * base_name (const char *name);
504352f9793fSmrgchar * find_executable(const char *wrapper);
504452f9793fSmrgint    check_executable(const char *path);
504552f9793fSmrgchar * strendzap(char *str, const char *pat);
504652f9793fSmrgvoid lt_fatal (const char *message, ...);
504752f9793fSmrg
504852f9793fSmrgint
504952f9793fSmrgmain (int argc, char *argv[])
505052f9793fSmrg{
505152f9793fSmrg  char **newargz;
505252f9793fSmrg  int i;
505352f9793fSmrg
505452f9793fSmrg  program_name = (char *) xstrdup (base_name (argv[0]));
505552f9793fSmrg  DEBUG("(main) argv[0]      : %s\n",argv[0]);
505652f9793fSmrg  DEBUG("(main) program_name : %s\n",program_name);
505752f9793fSmrg  newargz = XMALLOC(char *, argc+2);
505852f9793fSmrgEOF
505952f9793fSmrg
506052f9793fSmrg            cat >> $cwrappersource <<EOF
506152f9793fSmrg  newargz[0] = (char *) xstrdup("$SHELL");
506252f9793fSmrgEOF
506352f9793fSmrg
506452f9793fSmrg            cat >> $cwrappersource <<"EOF"
506552f9793fSmrg  newargz[1] = find_executable(argv[0]);
506652f9793fSmrg  if (newargz[1] == NULL)
506752f9793fSmrg    lt_fatal("Couldn't find %s", argv[0]);
506852f9793fSmrg  DEBUG("(main) found exe at : %s\n",newargz[1]);
506952f9793fSmrg  /* we know the script has the same name, without the .exe */
507052f9793fSmrg  /* so make sure newargz[1] doesn't end in .exe */
507152f9793fSmrg  strendzap(newargz[1],".exe");
507252f9793fSmrg  for (i = 1; i < argc; i++)
507352f9793fSmrg    newargz[i+1] = xstrdup(argv[i]);
507452f9793fSmrg  newargz[argc+1] = NULL;
507552f9793fSmrg
507652f9793fSmrg  for (i=0; i<argc+1; i++)
507752f9793fSmrg  {
507852f9793fSmrg    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
507952f9793fSmrg    ;
508052f9793fSmrg  }
508152f9793fSmrg
508252f9793fSmrgEOF
508352f9793fSmrg
508452f9793fSmrg            case $host_os in
508552f9793fSmrg              mingw*)
508652f9793fSmrg                cat >> $cwrappersource <<EOF
508752f9793fSmrg  execv("$SHELL",(char const **)newargz);
508852f9793fSmrgEOF
508952f9793fSmrg              ;;
509052f9793fSmrg              *)
509152f9793fSmrg                cat >> $cwrappersource <<EOF
509252f9793fSmrg  execv("$SHELL",newargz);
509352f9793fSmrgEOF
509452f9793fSmrg              ;;
509552f9793fSmrg            esac
509652f9793fSmrg
509752f9793fSmrg            cat >> $cwrappersource <<"EOF"
509852f9793fSmrg  return 127;
509952f9793fSmrg}
510052f9793fSmrg
510152f9793fSmrgvoid *
510252f9793fSmrgxmalloc (size_t num)
510352f9793fSmrg{
510452f9793fSmrg  void * p = (void *) malloc (num);
510552f9793fSmrg  if (!p)
510652f9793fSmrg    lt_fatal ("Memory exhausted");
510752f9793fSmrg
510852f9793fSmrg  return p;
510952f9793fSmrg}
511052f9793fSmrg
511152f9793fSmrgchar *
511252f9793fSmrgxstrdup (const char *string)
511352f9793fSmrg{
511452f9793fSmrg  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
511552f9793fSmrg;
511652f9793fSmrg}
511752f9793fSmrg
511852f9793fSmrgconst char *
511952f9793fSmrgbase_name (const char *name)
512052f9793fSmrg{
512152f9793fSmrg  const char *base;
512252f9793fSmrg
512352f9793fSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
512452f9793fSmrg  /* Skip over the disk name in MSDOS pathnames. */
512552f9793fSmrg  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
512652f9793fSmrg    name += 2;
512752f9793fSmrg#endif
512852f9793fSmrg
512952f9793fSmrg  for (base = name; *name; name++)
513052f9793fSmrg    if (IS_DIR_SEPARATOR (*name))
513152f9793fSmrg      base = name + 1;
513252f9793fSmrg  return base;
513352f9793fSmrg}
513452f9793fSmrg
513552f9793fSmrgint
513652f9793fSmrgcheck_executable(const char * path)
513752f9793fSmrg{
513852f9793fSmrg  struct stat st;
513952f9793fSmrg
514052f9793fSmrg  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
514152f9793fSmrg  if ((!path) || (!*path))
514252f9793fSmrg    return 0;
514352f9793fSmrg
514452f9793fSmrg  if ((stat (path, &st) >= 0) &&
514552f9793fSmrg      (
514652f9793fSmrg        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
514752f9793fSmrg#if defined (S_IXOTH)
514852f9793fSmrg       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
514952f9793fSmrg#endif
515052f9793fSmrg#if defined (S_IXGRP)
515152f9793fSmrg       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
515252f9793fSmrg#endif
515352f9793fSmrg       ((st.st_mode & S_IXUSR) == S_IXUSR))
515452f9793fSmrg      )
515552f9793fSmrg    return 1;
515652f9793fSmrg  else
515752f9793fSmrg    return 0;
515852f9793fSmrg}
515952f9793fSmrg
516052f9793fSmrg/* Searches for the full path of the wrapper.  Returns
516152f9793fSmrg   newly allocated full path name if found, NULL otherwise */
516252f9793fSmrgchar *
516352f9793fSmrgfind_executable (const char* wrapper)
516452f9793fSmrg{
516552f9793fSmrg  int has_slash = 0;
516652f9793fSmrg  const char* p;
516752f9793fSmrg  const char* p_next;
516852f9793fSmrg  /* static buffer for getcwd */
516952f9793fSmrg  char tmp[LT_PATHMAX + 1];
517052f9793fSmrg  int tmp_len;
517152f9793fSmrg  char* concat_name;
517252f9793fSmrg
517352f9793fSmrg  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
517452f9793fSmrg
517552f9793fSmrg  if ((wrapper == NULL) || (*wrapper == '\0'))
517652f9793fSmrg    return NULL;
517752f9793fSmrg
517852f9793fSmrg  /* Absolute path? */
517952f9793fSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
518052f9793fSmrg  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
518152f9793fSmrg  {
518252f9793fSmrg    concat_name = xstrdup (wrapper);
518352f9793fSmrg    if (check_executable(concat_name))
518452f9793fSmrg      return concat_name;
518552f9793fSmrg    XFREE(concat_name);
518652f9793fSmrg  }
518752f9793fSmrg  else
518852f9793fSmrg  {
518952f9793fSmrg#endif
519052f9793fSmrg    if (IS_DIR_SEPARATOR (wrapper[0]))
519152f9793fSmrg    {
519252f9793fSmrg      concat_name = xstrdup (wrapper);
519352f9793fSmrg      if (check_executable(concat_name))
519452f9793fSmrg        return concat_name;
519552f9793fSmrg      XFREE(concat_name);
519652f9793fSmrg    }
519752f9793fSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
519852f9793fSmrg  }
519952f9793fSmrg#endif
520052f9793fSmrg
520152f9793fSmrg  for (p = wrapper; *p; p++)
520252f9793fSmrg    if (*p == '/')
520352f9793fSmrg    {
520452f9793fSmrg      has_slash = 1;
520552f9793fSmrg      break;
520652f9793fSmrg    }
520752f9793fSmrg  if (!has_slash)
520852f9793fSmrg  {
520952f9793fSmrg    /* no slashes; search PATH */
521052f9793fSmrg    const char* path = getenv ("PATH");
521152f9793fSmrg    if (path != NULL)
521252f9793fSmrg    {
521352f9793fSmrg      for (p = path; *p; p = p_next)
521452f9793fSmrg      {
521552f9793fSmrg        const char* q;
521652f9793fSmrg        size_t p_len;
521752f9793fSmrg        for (q = p; *q; q++)
521852f9793fSmrg          if (IS_PATH_SEPARATOR(*q))
521952f9793fSmrg            break;
522052f9793fSmrg        p_len = q - p;
522152f9793fSmrg        p_next = (*q == '\0' ? q : q + 1);
522252f9793fSmrg        if (p_len == 0)
522352f9793fSmrg        {
522452f9793fSmrg          /* empty path: current directory */
522552f9793fSmrg          if (getcwd (tmp, LT_PATHMAX) == NULL)
522652f9793fSmrg            lt_fatal ("getcwd failed");
522752f9793fSmrg          tmp_len = strlen(tmp);
522852f9793fSmrg          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
522952f9793fSmrg          memcpy (concat_name, tmp, tmp_len);
523052f9793fSmrg          concat_name[tmp_len] = '/';
523152f9793fSmrg          strcpy (concat_name + tmp_len + 1, wrapper);
523252f9793fSmrg        }
523352f9793fSmrg        else
523452f9793fSmrg        {
523552f9793fSmrg          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
523652f9793fSmrg          memcpy (concat_name, p, p_len);
523752f9793fSmrg          concat_name[p_len] = '/';
523852f9793fSmrg          strcpy (concat_name + p_len + 1, wrapper);
523952f9793fSmrg        }
524052f9793fSmrg        if (check_executable(concat_name))
524152f9793fSmrg          return concat_name;
524252f9793fSmrg        XFREE(concat_name);
524352f9793fSmrg      }
524452f9793fSmrg    }
524552f9793fSmrg    /* not found in PATH; assume curdir */
524652f9793fSmrg  }
524752f9793fSmrg  /* Relative path | not found in path: prepend cwd */
524852f9793fSmrg  if (getcwd (tmp, LT_PATHMAX) == NULL)
524952f9793fSmrg    lt_fatal ("getcwd failed");
525052f9793fSmrg  tmp_len = strlen(tmp);
525152f9793fSmrg  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
525252f9793fSmrg  memcpy (concat_name, tmp, tmp_len);
525352f9793fSmrg  concat_name[tmp_len] = '/';
525452f9793fSmrg  strcpy (concat_name + tmp_len + 1, wrapper);
525552f9793fSmrg
525652f9793fSmrg  if (check_executable(concat_name))
525752f9793fSmrg    return concat_name;
525852f9793fSmrg  XFREE(concat_name);
525952f9793fSmrg  return NULL;
526052f9793fSmrg}
526152f9793fSmrg
526252f9793fSmrgchar *
526352f9793fSmrgstrendzap(char *str, const char *pat)
526452f9793fSmrg{
526552f9793fSmrg  size_t len, patlen;
526652f9793fSmrg
526752f9793fSmrg  assert(str != NULL);
526852f9793fSmrg  assert(pat != NULL);
526952f9793fSmrg
527052f9793fSmrg  len = strlen(str);
527152f9793fSmrg  patlen = strlen(pat);
527252f9793fSmrg
527352f9793fSmrg  if (patlen <= len)
527452f9793fSmrg  {
527552f9793fSmrg    str += len - patlen;
527652f9793fSmrg    if (strcmp(str, pat) == 0)
527752f9793fSmrg      *str = '\0';
527852f9793fSmrg  }
527952f9793fSmrg  return str;
528052f9793fSmrg}
528152f9793fSmrg
528252f9793fSmrgstatic void
528352f9793fSmrglt_error_core (int exit_status, const char * mode,
528452f9793fSmrg          const char * message, va_list ap)
528552f9793fSmrg{
528652f9793fSmrg  fprintf (stderr, "%s: %s: ", program_name, mode);
528752f9793fSmrg  vfprintf (stderr, message, ap);
528852f9793fSmrg  fprintf (stderr, ".\n");
528952f9793fSmrg
529052f9793fSmrg  if (exit_status >= 0)
529152f9793fSmrg    exit (exit_status);
529252f9793fSmrg}
529352f9793fSmrg
529452f9793fSmrgvoid
529552f9793fSmrglt_fatal (const char *message, ...)
529652f9793fSmrg{
529752f9793fSmrg  va_list ap;
529852f9793fSmrg  va_start (ap, message);
529952f9793fSmrg  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
530052f9793fSmrg  va_end (ap);
530152f9793fSmrg}
530252f9793fSmrgEOF
530352f9793fSmrg          # we should really use a build-platform specific compiler
530452f9793fSmrg          # here, but OTOH, the wrappers (shell script and this C one)
530552f9793fSmrg          # are only useful if you want to execute the "real" binary.
530652f9793fSmrg          # Since the "real" binary is built for $host, then this
530752f9793fSmrg          # wrapper might as well be built for $host, too.
530852f9793fSmrg          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
530952f9793fSmrg          ;;
531052f9793fSmrg        esac
531152f9793fSmrg        $rm $output
531252f9793fSmrg        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
531352f9793fSmrg
531452f9793fSmrg	$echo > $output "\
531552f9793fSmrg#! $SHELL
531652f9793fSmrg
531752f9793fSmrg# $output - temporary wrapper script for $objdir/$outputname
531852f9793fSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
531952f9793fSmrg#
532052f9793fSmrg# The $output program cannot be directly executed until all the libtool
532152f9793fSmrg# libraries that it depends on are installed.
532252f9793fSmrg#
532352f9793fSmrg# This wrapper script should never be moved out of the build directory.
532452f9793fSmrg# If it is, it will not operate correctly.
532552f9793fSmrg
532652f9793fSmrg# Sed substitution that helps us do robust quoting.  It backslashifies
532752f9793fSmrg# metacharacters that are still active within double-quoted strings.
532852f9793fSmrgXsed='${SED} -e 1s/^X//'
532952f9793fSmrgsed_quote_subst='$sed_quote_subst'
533052f9793fSmrg
53312faa96e0Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
53322faa96e0Smrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
53332faa96e0Smrg  emulate sh
53342faa96e0Smrg  NULLCMD=:
53352faa96e0Smrg  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
53362faa96e0Smrg  # is contrary to our usage.  Disable this feature.
53372faa96e0Smrg  alias -g '\${1+\"\$@\"}'='\"\$@\"'
53382faa96e0Smrg  setopt NO_GLOB_SUBST
53392faa96e0Smrgelse
53402faa96e0Smrg  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
53412faa96e0Smrgfi
53422faa96e0SmrgBIN_SH=xpg4; export BIN_SH # for Tru64
53432faa96e0SmrgDUALCASE=1; export DUALCASE # for MKS sh
53442faa96e0Smrg
534552f9793fSmrg# The HP-UX ksh and POSIX shell print the target directory to stdout
534652f9793fSmrg# if CDPATH is set.
534752f9793fSmrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
534852f9793fSmrg
534952f9793fSmrgrelink_command=\"$relink_command\"
535052f9793fSmrg
535152f9793fSmrg# This environment variable determines our operation mode.
535252f9793fSmrgif test \"\$libtool_install_magic\" = \"$magic\"; then
535352f9793fSmrg  # install mode needs the following variable:
535452f9793fSmrg  notinst_deplibs='$notinst_deplibs'
535552f9793fSmrgelse
535652f9793fSmrg  # When we are sourced in execute mode, \$file and \$echo are already set.
535752f9793fSmrg  if test \"\$libtool_execute_magic\" != \"$magic\"; then
535852f9793fSmrg    echo=\"$qecho\"
535952f9793fSmrg    file=\"\$0\"
536052f9793fSmrg    # Make sure echo works.
536152f9793fSmrg    if test \"X\$1\" = X--no-reexec; then
536252f9793fSmrg      # Discard the --no-reexec flag, and continue.
536352f9793fSmrg      shift
536452f9793fSmrg    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
536552f9793fSmrg      # Yippee, \$echo works!
536652f9793fSmrg      :
536752f9793fSmrg    else
536852f9793fSmrg      # Restart under the correct shell, and then maybe \$echo will work.
536952f9793fSmrg      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
537052f9793fSmrg    fi
537152f9793fSmrg  fi\
537252f9793fSmrg"
537352f9793fSmrg	$echo >> $output "\
537452f9793fSmrg
537552f9793fSmrg  # Find the directory that this script lives in.
537652f9793fSmrg  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
537752f9793fSmrg  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
537852f9793fSmrg
537952f9793fSmrg  # Follow symbolic links until we get to the real thisdir.
538052f9793fSmrg  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
538152f9793fSmrg  while test -n \"\$file\"; do
538252f9793fSmrg    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
538352f9793fSmrg
538452f9793fSmrg    # If there was a directory component, then change thisdir.
538552f9793fSmrg    if test \"x\$destdir\" != \"x\$file\"; then
538652f9793fSmrg      case \"\$destdir\" in
538752f9793fSmrg      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
538852f9793fSmrg      *) thisdir=\"\$thisdir/\$destdir\" ;;
538952f9793fSmrg      esac
539052f9793fSmrg    fi
539152f9793fSmrg
539252f9793fSmrg    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
539352f9793fSmrg    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
539452f9793fSmrg  done
539552f9793fSmrg
539652f9793fSmrg  # Try to get the absolute directory name.
539752f9793fSmrg  absdir=\`cd \"\$thisdir\" && pwd\`
539852f9793fSmrg  test -n \"\$absdir\" && thisdir=\"\$absdir\"
539952f9793fSmrg"
540052f9793fSmrg
540152f9793fSmrg	if test "$fast_install" = yes; then
540252f9793fSmrg	  $echo >> $output "\
540352f9793fSmrg  program=lt-'$outputname'$exeext
540452f9793fSmrg  progdir=\"\$thisdir/$objdir\"
540552f9793fSmrg
540652f9793fSmrg  if test ! -f \"\$progdir/\$program\" || \\
540752f9793fSmrg     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
540852f9793fSmrg       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
540952f9793fSmrg
541052f9793fSmrg    file=\"\$\$-\$program\"
541152f9793fSmrg
541252f9793fSmrg    if test ! -d \"\$progdir\"; then
541352f9793fSmrg      $mkdir \"\$progdir\"
541452f9793fSmrg    else
541552f9793fSmrg      $rm \"\$progdir/\$file\"
541652f9793fSmrg    fi"
541752f9793fSmrg
541852f9793fSmrg	  $echo >> $output "\
541952f9793fSmrg
542052f9793fSmrg    # relink executable if necessary
542152f9793fSmrg    if test -n \"\$relink_command\"; then
542252f9793fSmrg      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
542352f9793fSmrg      else
542452f9793fSmrg	$echo \"\$relink_command_output\" >&2
542552f9793fSmrg	$rm \"\$progdir/\$file\"
542652f9793fSmrg	exit $EXIT_FAILURE
542752f9793fSmrg      fi
542852f9793fSmrg    fi
542952f9793fSmrg
543052f9793fSmrg    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
543152f9793fSmrg    { $rm \"\$progdir/\$program\";
543252f9793fSmrg      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
543352f9793fSmrg    $rm \"\$progdir/\$file\"
543452f9793fSmrg  fi"
543552f9793fSmrg	else
543652f9793fSmrg	  $echo >> $output "\
543752f9793fSmrg  program='$outputname'
543852f9793fSmrg  progdir=\"\$thisdir/$objdir\"
543952f9793fSmrg"
544052f9793fSmrg	fi
544152f9793fSmrg
544252f9793fSmrg	$echo >> $output "\
544352f9793fSmrg
544452f9793fSmrg  if test -f \"\$progdir/\$program\"; then"
544552f9793fSmrg
544652f9793fSmrg	# Export our shlibpath_var if we have one.
544752f9793fSmrg	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
544852f9793fSmrg	  $echo >> $output "\
544952f9793fSmrg    # Add our own library path to $shlibpath_var
545052f9793fSmrg    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
545152f9793fSmrg
545252f9793fSmrg    # Some systems cannot cope with colon-terminated $shlibpath_var
545352f9793fSmrg    # The second colon is a workaround for a bug in BeOS R4 sed
545452f9793fSmrg    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
545552f9793fSmrg
545652f9793fSmrg    export $shlibpath_var
545752f9793fSmrg"
545852f9793fSmrg	fi
545952f9793fSmrg
546052f9793fSmrg	# fixup the dll searchpath if we need to.
546152f9793fSmrg	if test -n "$dllsearchpath"; then
546252f9793fSmrg	  $echo >> $output "\
546352f9793fSmrg    # Add the dll search path components to the executable PATH
546452f9793fSmrg    PATH=$dllsearchpath:\$PATH
546552f9793fSmrg"
546652f9793fSmrg	fi
546752f9793fSmrg
546852f9793fSmrg	$echo >> $output "\
546952f9793fSmrg    if test \"\$libtool_execute_magic\" != \"$magic\"; then
547052f9793fSmrg      # Run the actual program with our arguments.
547152f9793fSmrg"
547252f9793fSmrg	case $host in
547352f9793fSmrg	# Backslashes separate directories on plain windows
547452f9793fSmrg	*-*-mingw | *-*-os2*)
547552f9793fSmrg	  $echo >> $output "\
547652f9793fSmrg      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
547752f9793fSmrg"
547852f9793fSmrg	  ;;
547952f9793fSmrg
548052f9793fSmrg	*)
548152f9793fSmrg	  $echo >> $output "\
548252f9793fSmrg      exec \"\$progdir/\$program\" \${1+\"\$@\"}
548352f9793fSmrg"
548452f9793fSmrg	  ;;
548552f9793fSmrg	esac
548652f9793fSmrg	$echo >> $output "\
54872faa96e0Smrg      \$echo \"\$0: cannot exec \$program \$*\"
548852f9793fSmrg      exit $EXIT_FAILURE
548952f9793fSmrg    fi
549052f9793fSmrg  else
549152f9793fSmrg    # The program doesn't exist.
549252f9793fSmrg    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
549352f9793fSmrg    \$echo \"This script is just a wrapper for \$program.\" 1>&2
549452f9793fSmrg    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
549552f9793fSmrg    exit $EXIT_FAILURE
549652f9793fSmrg  fi
549752f9793fSmrgfi\
549852f9793fSmrg"
549952f9793fSmrg	chmod +x $output
550052f9793fSmrg      fi
550152f9793fSmrg      exit $EXIT_SUCCESS
550252f9793fSmrg      ;;
550352f9793fSmrg    esac
550452f9793fSmrg
550552f9793fSmrg    # See if we need to build an old-fashioned archive.
550652f9793fSmrg    for oldlib in $oldlibs; do
550752f9793fSmrg
550852f9793fSmrg      if test "$build_libtool_libs" = convenience; then
550952f9793fSmrg	oldobjs="$libobjs_save"
551052f9793fSmrg	addlibs="$convenience"
551152f9793fSmrg	build_libtool_libs=no
551252f9793fSmrg      else
551352f9793fSmrg	if test "$build_libtool_libs" = module; then
551452f9793fSmrg	  oldobjs="$libobjs_save"
551552f9793fSmrg	  build_libtool_libs=no
551652f9793fSmrg	else
551752f9793fSmrg	  oldobjs="$old_deplibs $non_pic_objects"
551852f9793fSmrg	fi
551952f9793fSmrg	addlibs="$old_convenience"
552052f9793fSmrg      fi
552152f9793fSmrg
552252f9793fSmrg      if test -n "$addlibs"; then
552352f9793fSmrg	gentop="$output_objdir/${outputname}x"
552452f9793fSmrg	generated="$generated $gentop"
552552f9793fSmrg
552652f9793fSmrg	func_extract_archives $gentop $addlibs
552752f9793fSmrg	oldobjs="$oldobjs $func_extract_archives_result"
552852f9793fSmrg      fi
552952f9793fSmrg
553052f9793fSmrg      # Do each command in the archive commands.
553152f9793fSmrg      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
553252f9793fSmrg       cmds=$old_archive_from_new_cmds
553352f9793fSmrg      else
553452f9793fSmrg	# POSIX demands no paths to be encoded in archives.  We have
553552f9793fSmrg	# to avoid creating archives with duplicate basenames if we
553652f9793fSmrg	# might have to extract them afterwards, e.g., when creating a
553752f9793fSmrg	# static archive out of a convenience library, or when linking
553852f9793fSmrg	# the entirety of a libtool archive into another (currently
553952f9793fSmrg	# not supported by libtool).
554052f9793fSmrg	if (for obj in $oldobjs
554152f9793fSmrg	    do
554252f9793fSmrg	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
554352f9793fSmrg	    done | sort | sort -uc >/dev/null 2>&1); then
554452f9793fSmrg	  :
554552f9793fSmrg	else
554652f9793fSmrg	  $echo "copying selected object files to avoid basename conflicts..."
554752f9793fSmrg
554852f9793fSmrg	  if test -z "$gentop"; then
554952f9793fSmrg	    gentop="$output_objdir/${outputname}x"
555052f9793fSmrg	    generated="$generated $gentop"
555152f9793fSmrg
555252f9793fSmrg	    $show "${rm}r $gentop"
555352f9793fSmrg	    $run ${rm}r "$gentop"
555452f9793fSmrg	    $show "$mkdir $gentop"
555552f9793fSmrg	    $run $mkdir "$gentop"
555652f9793fSmrg	    exit_status=$?
555752f9793fSmrg	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
555852f9793fSmrg	      exit $exit_status
555952f9793fSmrg	    fi
556052f9793fSmrg	  fi
556152f9793fSmrg
556252f9793fSmrg	  save_oldobjs=$oldobjs
556352f9793fSmrg	  oldobjs=
556452f9793fSmrg	  counter=1
556552f9793fSmrg	  for obj in $save_oldobjs
556652f9793fSmrg	  do
556752f9793fSmrg	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
556852f9793fSmrg	    case " $oldobjs " in
556952f9793fSmrg	    " ") oldobjs=$obj ;;
557052f9793fSmrg	    *[\ /]"$objbase "*)
557152f9793fSmrg	      while :; do
557252f9793fSmrg		# Make sure we don't pick an alternate name that also
557352f9793fSmrg		# overlaps.
557452f9793fSmrg		newobj=lt$counter-$objbase
557552f9793fSmrg		counter=`expr $counter + 1`
557652f9793fSmrg		case " $oldobjs " in
557752f9793fSmrg		*[\ /]"$newobj "*) ;;
557852f9793fSmrg		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
557952f9793fSmrg		esac
558052f9793fSmrg	      done
558152f9793fSmrg	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
558252f9793fSmrg	      $run ln "$obj" "$gentop/$newobj" ||
558352f9793fSmrg	      $run cp "$obj" "$gentop/$newobj"
558452f9793fSmrg	      oldobjs="$oldobjs $gentop/$newobj"
558552f9793fSmrg	      ;;
558652f9793fSmrg	    *) oldobjs="$oldobjs $obj" ;;
558752f9793fSmrg	    esac
558852f9793fSmrg	  done
558952f9793fSmrg	fi
559052f9793fSmrg
559152f9793fSmrg	eval cmds=\"$old_archive_cmds\"
559252f9793fSmrg
559352f9793fSmrg	if len=`expr "X$cmds" : ".*"` &&
559452f9793fSmrg	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
559552f9793fSmrg	  cmds=$old_archive_cmds
559652f9793fSmrg	else
559752f9793fSmrg	  # the command line is too long to link in one step, link in parts
559852f9793fSmrg	  $echo "using piecewise archive linking..."
559952f9793fSmrg	  save_RANLIB=$RANLIB
560052f9793fSmrg	  RANLIB=:
560152f9793fSmrg	  objlist=
560252f9793fSmrg	  concat_cmds=
560352f9793fSmrg	  save_oldobjs=$oldobjs
560452f9793fSmrg
560552f9793fSmrg	  # Is there a better way of finding the last object in the list?
560652f9793fSmrg	  for obj in $save_oldobjs
560752f9793fSmrg	  do
560852f9793fSmrg	    last_oldobj=$obj
560952f9793fSmrg	  done
561052f9793fSmrg	  for obj in $save_oldobjs
561152f9793fSmrg	  do
561252f9793fSmrg	    oldobjs="$objlist $obj"
561352f9793fSmrg	    objlist="$objlist $obj"
561452f9793fSmrg	    eval test_cmds=\"$old_archive_cmds\"
561552f9793fSmrg	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
561652f9793fSmrg	       test "$len" -le "$max_cmd_len"; then
561752f9793fSmrg	      :
561852f9793fSmrg	    else
561952f9793fSmrg	      # the above command should be used before it gets too long
562052f9793fSmrg	      oldobjs=$objlist
562152f9793fSmrg	      if test "$obj" = "$last_oldobj" ; then
562252f9793fSmrg	        RANLIB=$save_RANLIB
562352f9793fSmrg	      fi
562452f9793fSmrg	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
562552f9793fSmrg	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
562652f9793fSmrg	      objlist=
562752f9793fSmrg	    fi
562852f9793fSmrg	  done
562952f9793fSmrg	  RANLIB=$save_RANLIB
563052f9793fSmrg	  oldobjs=$objlist
563152f9793fSmrg	  if test "X$oldobjs" = "X" ; then
563252f9793fSmrg	    eval cmds=\"\$concat_cmds\"
563352f9793fSmrg	  else
563452f9793fSmrg	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
563552f9793fSmrg	  fi
563652f9793fSmrg	fi
563752f9793fSmrg      fi
563852f9793fSmrg      save_ifs="$IFS"; IFS='~'
563952f9793fSmrg      for cmd in $cmds; do
564052f9793fSmrg        eval cmd=\"$cmd\"
564152f9793fSmrg	IFS="$save_ifs"
564252f9793fSmrg	$show "$cmd"
564352f9793fSmrg	$run eval "$cmd" || exit $?
564452f9793fSmrg      done
564552f9793fSmrg      IFS="$save_ifs"
564652f9793fSmrg    done
564752f9793fSmrg
564852f9793fSmrg    if test -n "$generated"; then
564952f9793fSmrg      $show "${rm}r$generated"
565052f9793fSmrg      $run ${rm}r$generated
565152f9793fSmrg    fi
565252f9793fSmrg
565352f9793fSmrg    # Now create the libtool archive.
565452f9793fSmrg    case $output in
565552f9793fSmrg    *.la)
565652f9793fSmrg      old_library=
565752f9793fSmrg      test "$build_old_libs" = yes && old_library="$libname.$libext"
565852f9793fSmrg      $show "creating $output"
565952f9793fSmrg
566052f9793fSmrg      # Preserve any variables that may affect compiler behavior
566152f9793fSmrg      for var in $variables_saved_for_relink; do
566252f9793fSmrg	if eval test -z \"\${$var+set}\"; then
566352f9793fSmrg	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
566452f9793fSmrg	elif eval var_value=\$$var; test -z "$var_value"; then
566552f9793fSmrg	  relink_command="$var=; export $var; $relink_command"
566652f9793fSmrg	else
566752f9793fSmrg	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
566852f9793fSmrg	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
566952f9793fSmrg	fi
567052f9793fSmrg      done
567152f9793fSmrg      # Quote the link command for shipping.
567252f9793fSmrg      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
56732faa96e0Smrg      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
567452f9793fSmrg      if test "$hardcode_automatic" = yes ; then
567552f9793fSmrg	relink_command=
567652f9793fSmrg      fi
567752f9793fSmrg
567852f9793fSmrg
567952f9793fSmrg      # Only create the output if not a dry run.
568052f9793fSmrg      if test -z "$run"; then
568152f9793fSmrg	for installed in no yes; do
568252f9793fSmrg	  if test "$installed" = yes; then
568352f9793fSmrg	    if test -z "$install_libdir"; then
568452f9793fSmrg	      break
568552f9793fSmrg	    fi
568652f9793fSmrg	    output="$output_objdir/$outputname"i
568752f9793fSmrg	    # Replace all uninstalled libtool libraries with the installed ones
568852f9793fSmrg	    newdependency_libs=
568952f9793fSmrg	    for deplib in $dependency_libs; do
569052f9793fSmrg	      case $deplib in
569152f9793fSmrg	      *.la)
569252f9793fSmrg		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
569352f9793fSmrg		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
569452f9793fSmrg		if test -z "$libdir"; then
569552f9793fSmrg		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
569652f9793fSmrg		  exit $EXIT_FAILURE
569752f9793fSmrg		fi
569852f9793fSmrg		newdependency_libs="$newdependency_libs $libdir/$name"
569952f9793fSmrg		;;
570052f9793fSmrg	      *) newdependency_libs="$newdependency_libs $deplib" ;;
570152f9793fSmrg	      esac
570252f9793fSmrg	    done
570352f9793fSmrg	    dependency_libs="$newdependency_libs"
570452f9793fSmrg	    newdlfiles=
570552f9793fSmrg	    for lib in $dlfiles; do
570652f9793fSmrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
570752f9793fSmrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
570852f9793fSmrg	      if test -z "$libdir"; then
570952f9793fSmrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
571052f9793fSmrg		exit $EXIT_FAILURE
571152f9793fSmrg	      fi
571252f9793fSmrg	      newdlfiles="$newdlfiles $libdir/$name"
571352f9793fSmrg	    done
571452f9793fSmrg	    dlfiles="$newdlfiles"
571552f9793fSmrg	    newdlprefiles=
571652f9793fSmrg	    for lib in $dlprefiles; do
571752f9793fSmrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
571852f9793fSmrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
571952f9793fSmrg	      if test -z "$libdir"; then
572052f9793fSmrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
572152f9793fSmrg		exit $EXIT_FAILURE
572252f9793fSmrg	      fi
572352f9793fSmrg	      newdlprefiles="$newdlprefiles $libdir/$name"
572452f9793fSmrg	    done
572552f9793fSmrg	    dlprefiles="$newdlprefiles"
572652f9793fSmrg	  else
572752f9793fSmrg	    newdlfiles=
572852f9793fSmrg	    for lib in $dlfiles; do
572952f9793fSmrg	      case $lib in
573052f9793fSmrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
573152f9793fSmrg		*) abs=`pwd`"/$lib" ;;
573252f9793fSmrg	      esac
573352f9793fSmrg	      newdlfiles="$newdlfiles $abs"
573452f9793fSmrg	    done
573552f9793fSmrg	    dlfiles="$newdlfiles"
573652f9793fSmrg	    newdlprefiles=
573752f9793fSmrg	    for lib in $dlprefiles; do
573852f9793fSmrg	      case $lib in
573952f9793fSmrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
574052f9793fSmrg		*) abs=`pwd`"/$lib" ;;
574152f9793fSmrg	      esac
574252f9793fSmrg	      newdlprefiles="$newdlprefiles $abs"
574352f9793fSmrg	    done
574452f9793fSmrg	    dlprefiles="$newdlprefiles"
574552f9793fSmrg	  fi
574652f9793fSmrg	  $rm $output
574752f9793fSmrg	  # place dlname in correct position for cygwin
574852f9793fSmrg	  tdlname=$dlname
574952f9793fSmrg	  case $host,$output,$installed,$module,$dlname in
575052f9793fSmrg	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
575152f9793fSmrg	  esac
575252f9793fSmrg	  $echo > $output "\
575352f9793fSmrg# $outputname - a libtool library file
575452f9793fSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
575552f9793fSmrg#
575652f9793fSmrg# Please DO NOT delete this file!
575752f9793fSmrg# It is necessary for linking the library.
575852f9793fSmrg
575952f9793fSmrg# The name that we can dlopen(3).
576052f9793fSmrgdlname='$tdlname'
576152f9793fSmrg
576252f9793fSmrg# Names of this library.
576352f9793fSmrglibrary_names='$library_names'
576452f9793fSmrg
576552f9793fSmrg# The name of the static archive.
576652f9793fSmrgold_library='$old_library'
576752f9793fSmrg
576852f9793fSmrg# Libraries that this one depends upon.
576952f9793fSmrgdependency_libs='$dependency_libs'
577052f9793fSmrg
577152f9793fSmrg# Version information for $libname.
577252f9793fSmrgcurrent=$current
577352f9793fSmrgage=$age
577452f9793fSmrgrevision=$revision
577552f9793fSmrg
577652f9793fSmrg# Is this an already installed library?
577752f9793fSmrginstalled=$installed
577852f9793fSmrg
577952f9793fSmrg# Should we warn about portability when linking against -modules?
578052f9793fSmrgshouldnotlink=$module
578152f9793fSmrg
578252f9793fSmrg# Files to dlopen/dlpreopen
578352f9793fSmrgdlopen='$dlfiles'
578452f9793fSmrgdlpreopen='$dlprefiles'
578552f9793fSmrg
578652f9793fSmrg# Directory that this library needs to be installed in:
578752f9793fSmrglibdir='$install_libdir'"
578852f9793fSmrg	  if test "$installed" = no && test "$need_relink" = yes; then
578952f9793fSmrg	    $echo >> $output "\
579052f9793fSmrgrelink_command=\"$relink_command\""
579152f9793fSmrg	  fi
579252f9793fSmrg	done
579352f9793fSmrg      fi
579452f9793fSmrg
579552f9793fSmrg      # Do a symbolic link so that the libtool archive can be found in
579652f9793fSmrg      # LD_LIBRARY_PATH before the program is installed.
579752f9793fSmrg      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
579852f9793fSmrg      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
579952f9793fSmrg      ;;
580052f9793fSmrg    esac
580152f9793fSmrg    exit $EXIT_SUCCESS
580252f9793fSmrg    ;;
580352f9793fSmrg
580452f9793fSmrg  # libtool install mode
580552f9793fSmrg  install)
580652f9793fSmrg    modename="$modename: install"
580752f9793fSmrg
580852f9793fSmrg    # There may be an optional sh(1) argument at the beginning of
580952f9793fSmrg    # install_prog (especially on Windows NT).
581052f9793fSmrg    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
581152f9793fSmrg       # Allow the use of GNU shtool's install command.
581252f9793fSmrg       $echo "X$nonopt" | grep shtool > /dev/null; then
581352f9793fSmrg      # Aesthetically quote it.
581452f9793fSmrg      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
581552f9793fSmrg      case $arg in
581652f9793fSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
581752f9793fSmrg	arg="\"$arg\""
581852f9793fSmrg	;;
581952f9793fSmrg      esac
582052f9793fSmrg      install_prog="$arg "
582152f9793fSmrg      arg="$1"
582252f9793fSmrg      shift
582352f9793fSmrg    else
582452f9793fSmrg      install_prog=
582552f9793fSmrg      arg=$nonopt
582652f9793fSmrg    fi
582752f9793fSmrg
582852f9793fSmrg    # The real first argument should be the name of the installation program.
582952f9793fSmrg    # Aesthetically quote it.
583052f9793fSmrg    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
583152f9793fSmrg    case $arg in
583252f9793fSmrg    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
583352f9793fSmrg      arg="\"$arg\""
583452f9793fSmrg      ;;
583552f9793fSmrg    esac
583652f9793fSmrg    install_prog="$install_prog$arg"
583752f9793fSmrg
583852f9793fSmrg    # We need to accept at least all the BSD install flags.
583952f9793fSmrg    dest=
584052f9793fSmrg    files=
584152f9793fSmrg    opts=
584252f9793fSmrg    prev=
584352f9793fSmrg    install_type=
584452f9793fSmrg    isdir=no
584552f9793fSmrg    stripme=
584652f9793fSmrg    for arg
584752f9793fSmrg    do
584852f9793fSmrg      if test -n "$dest"; then
584952f9793fSmrg	files="$files $dest"
585052f9793fSmrg	dest=$arg
585152f9793fSmrg	continue
585252f9793fSmrg      fi
585352f9793fSmrg
585452f9793fSmrg      case $arg in
585552f9793fSmrg      -d) isdir=yes ;;
585652f9793fSmrg      -f) 
585752f9793fSmrg      	case " $install_prog " in
585852f9793fSmrg	*[\\\ /]cp\ *) ;;
585952f9793fSmrg	*) prev=$arg ;;
586052f9793fSmrg	esac
586152f9793fSmrg	;;
586252f9793fSmrg      -g | -m | -o) prev=$arg ;;
586352f9793fSmrg      -s)
586452f9793fSmrg	stripme=" -s"
586552f9793fSmrg	continue
586652f9793fSmrg	;;
586752f9793fSmrg      -*)
586852f9793fSmrg	;;
586952f9793fSmrg      *)
587052f9793fSmrg	# If the previous option needed an argument, then skip it.
587152f9793fSmrg	if test -n "$prev"; then
587252f9793fSmrg	  prev=
587352f9793fSmrg	else
587452f9793fSmrg	  dest=$arg
587552f9793fSmrg	  continue
587652f9793fSmrg	fi
587752f9793fSmrg	;;
587852f9793fSmrg      esac
587952f9793fSmrg
588052f9793fSmrg      # Aesthetically quote the argument.
588152f9793fSmrg      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
588252f9793fSmrg      case $arg in
588352f9793fSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
588452f9793fSmrg	arg="\"$arg\""
588552f9793fSmrg	;;
588652f9793fSmrg      esac
588752f9793fSmrg      install_prog="$install_prog $arg"
588852f9793fSmrg    done
588952f9793fSmrg
589052f9793fSmrg    if test -z "$install_prog"; then
589152f9793fSmrg      $echo "$modename: you must specify an install program" 1>&2
589252f9793fSmrg      $echo "$help" 1>&2
589352f9793fSmrg      exit $EXIT_FAILURE
589452f9793fSmrg    fi
589552f9793fSmrg
589652f9793fSmrg    if test -n "$prev"; then
589752f9793fSmrg      $echo "$modename: the \`$prev' option requires an argument" 1>&2
589852f9793fSmrg      $echo "$help" 1>&2
589952f9793fSmrg      exit $EXIT_FAILURE
590052f9793fSmrg    fi
590152f9793fSmrg
590252f9793fSmrg    if test -z "$files"; then
590352f9793fSmrg      if test -z "$dest"; then
590452f9793fSmrg	$echo "$modename: no file or destination specified" 1>&2
590552f9793fSmrg      else
590652f9793fSmrg	$echo "$modename: you must specify a destination" 1>&2
590752f9793fSmrg      fi
590852f9793fSmrg      $echo "$help" 1>&2
590952f9793fSmrg      exit $EXIT_FAILURE
591052f9793fSmrg    fi
591152f9793fSmrg
591252f9793fSmrg    # Strip any trailing slash from the destination.
591352f9793fSmrg    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
591452f9793fSmrg
591552f9793fSmrg    # Check to see that the destination is a directory.
591652f9793fSmrg    test -d "$dest" && isdir=yes
591752f9793fSmrg    if test "$isdir" = yes; then
591852f9793fSmrg      destdir="$dest"
591952f9793fSmrg      destname=
592052f9793fSmrg    else
592152f9793fSmrg      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
592252f9793fSmrg      test "X$destdir" = "X$dest" && destdir=.
592352f9793fSmrg      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
592452f9793fSmrg
592552f9793fSmrg      # Not a directory, so check to see that there is only one file specified.
592652f9793fSmrg      set dummy $files
592752f9793fSmrg      if test "$#" -gt 2; then
592852f9793fSmrg	$echo "$modename: \`$dest' is not a directory" 1>&2
592952f9793fSmrg	$echo "$help" 1>&2
593052f9793fSmrg	exit $EXIT_FAILURE
593152f9793fSmrg      fi
593252f9793fSmrg    fi
593352f9793fSmrg    case $destdir in
593452f9793fSmrg    [\\/]* | [A-Za-z]:[\\/]*) ;;
593552f9793fSmrg    *)
593652f9793fSmrg      for file in $files; do
593752f9793fSmrg	case $file in
593852f9793fSmrg	*.lo) ;;
593952f9793fSmrg	*)
594052f9793fSmrg	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
594152f9793fSmrg	  $echo "$help" 1>&2
594252f9793fSmrg	  exit $EXIT_FAILURE
594352f9793fSmrg	  ;;
594452f9793fSmrg	esac
594552f9793fSmrg      done
594652f9793fSmrg      ;;
594752f9793fSmrg    esac
594852f9793fSmrg
594952f9793fSmrg    # This variable tells wrapper scripts just to set variables rather
595052f9793fSmrg    # than running their programs.
595152f9793fSmrg    libtool_install_magic="$magic"
595252f9793fSmrg
595352f9793fSmrg    staticlibs=
595452f9793fSmrg    future_libdirs=
595552f9793fSmrg    current_libdirs=
595652f9793fSmrg    for file in $files; do
595752f9793fSmrg
595852f9793fSmrg      # Do each installation.
595952f9793fSmrg      case $file in
596052f9793fSmrg      *.$libext)
596152f9793fSmrg	# Do the static libraries later.
596252f9793fSmrg	staticlibs="$staticlibs $file"
596352f9793fSmrg	;;
596452f9793fSmrg
596552f9793fSmrg      *.la)
596652f9793fSmrg	# Check to see that this really is a libtool archive.
596752f9793fSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
596852f9793fSmrg	else
596952f9793fSmrg	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
597052f9793fSmrg	  $echo "$help" 1>&2
597152f9793fSmrg	  exit $EXIT_FAILURE
597252f9793fSmrg	fi
597352f9793fSmrg
597452f9793fSmrg	library_names=
597552f9793fSmrg	old_library=
597652f9793fSmrg	relink_command=
597752f9793fSmrg	# If there is no directory component, then add one.
597852f9793fSmrg	case $file in
597952f9793fSmrg	*/* | *\\*) . $file ;;
598052f9793fSmrg	*) . ./$file ;;
598152f9793fSmrg	esac
598252f9793fSmrg
598352f9793fSmrg	# Add the libdir to current_libdirs if it is the destination.
598452f9793fSmrg	if test "X$destdir" = "X$libdir"; then
598552f9793fSmrg	  case "$current_libdirs " in
598652f9793fSmrg	  *" $libdir "*) ;;
598752f9793fSmrg	  *) current_libdirs="$current_libdirs $libdir" ;;
598852f9793fSmrg	  esac
598952f9793fSmrg	else
599052f9793fSmrg	  # Note the libdir as a future libdir.
599152f9793fSmrg	  case "$future_libdirs " in
599252f9793fSmrg	  *" $libdir "*) ;;
599352f9793fSmrg	  *) future_libdirs="$future_libdirs $libdir" ;;
599452f9793fSmrg	  esac
599552f9793fSmrg	fi
599652f9793fSmrg
599752f9793fSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
599852f9793fSmrg	test "X$dir" = "X$file/" && dir=
599952f9793fSmrg	dir="$dir$objdir"
600052f9793fSmrg
600152f9793fSmrg	if test -n "$relink_command"; then
600252f9793fSmrg	  # Determine the prefix the user has applied to our future dir.
600352f9793fSmrg	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
600452f9793fSmrg
600552f9793fSmrg	  # Don't allow the user to place us outside of our expected
600652f9793fSmrg	  # location b/c this prevents finding dependent libraries that
600752f9793fSmrg	  # are installed to the same prefix.
600852f9793fSmrg	  # At present, this check doesn't affect windows .dll's that
600952f9793fSmrg	  # are installed into $libdir/../bin (currently, that works fine)
601052f9793fSmrg	  # but it's something to keep an eye on.
601152f9793fSmrg	  if test "$inst_prefix_dir" = "$destdir"; then
601252f9793fSmrg	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
601352f9793fSmrg	    exit $EXIT_FAILURE
601452f9793fSmrg	  fi
601552f9793fSmrg
601652f9793fSmrg	  if test -n "$inst_prefix_dir"; then
601752f9793fSmrg	    # Stick the inst_prefix_dir data into the link command.
60182faa96e0Smrg	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
601952f9793fSmrg	  else
60202faa96e0Smrg	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
602152f9793fSmrg	  fi
602252f9793fSmrg
602352f9793fSmrg	  $echo "$modename: warning: relinking \`$file'" 1>&2
602452f9793fSmrg	  $show "$relink_command"
602552f9793fSmrg	  if $run eval "$relink_command"; then :
602652f9793fSmrg	  else
602752f9793fSmrg	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
602852f9793fSmrg	    exit $EXIT_FAILURE
602952f9793fSmrg	  fi
603052f9793fSmrg	fi
603152f9793fSmrg
603252f9793fSmrg	# See the names of the shared library.
603352f9793fSmrg	set dummy $library_names
603452f9793fSmrg	if test -n "$2"; then
603552f9793fSmrg	  realname="$2"
603652f9793fSmrg	  shift
603752f9793fSmrg	  shift
603852f9793fSmrg
603952f9793fSmrg	  srcname="$realname"
604052f9793fSmrg	  test -n "$relink_command" && srcname="$realname"T
604152f9793fSmrg
604252f9793fSmrg	  # Install the shared library and build the symlinks.
604352f9793fSmrg	  $show "$install_prog $dir/$srcname $destdir/$realname"
604452f9793fSmrg	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
604552f9793fSmrg	  if test -n "$stripme" && test -n "$striplib"; then
604652f9793fSmrg	    $show "$striplib $destdir/$realname"
604752f9793fSmrg	    $run eval "$striplib $destdir/$realname" || exit $?
604852f9793fSmrg	  fi
604952f9793fSmrg
605052f9793fSmrg	  if test "$#" -gt 0; then
605152f9793fSmrg	    # Delete the old symlinks, and create new ones.
605252f9793fSmrg	    # Try `ln -sf' first, because the `ln' binary might depend on
605352f9793fSmrg	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
605452f9793fSmrg	    # so we also need to try rm && ln -s.
605552f9793fSmrg	    for linkname
605652f9793fSmrg	    do
605752f9793fSmrg	      if test "$linkname" != "$realname"; then
605852f9793fSmrg                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
605952f9793fSmrg                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
606052f9793fSmrg	      fi
606152f9793fSmrg	    done
606252f9793fSmrg	  fi
606352f9793fSmrg
606452f9793fSmrg	  # Do each command in the postinstall commands.
606552f9793fSmrg	  lib="$destdir/$realname"
606652f9793fSmrg	  cmds=$postinstall_cmds
606752f9793fSmrg	  save_ifs="$IFS"; IFS='~'
606852f9793fSmrg	  for cmd in $cmds; do
606952f9793fSmrg	    IFS="$save_ifs"
607052f9793fSmrg	    eval cmd=\"$cmd\"
607152f9793fSmrg	    $show "$cmd"
607252f9793fSmrg	    $run eval "$cmd" || {
607352f9793fSmrg	      lt_exit=$?
607452f9793fSmrg
607552f9793fSmrg	      # Restore the uninstalled library and exit
607652f9793fSmrg	      if test "$mode" = relink; then
607752f9793fSmrg		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
607852f9793fSmrg	      fi
607952f9793fSmrg
608052f9793fSmrg	      exit $lt_exit
608152f9793fSmrg	    }
608252f9793fSmrg	  done
608352f9793fSmrg	  IFS="$save_ifs"
608452f9793fSmrg	fi
608552f9793fSmrg
608652f9793fSmrg	# Install the pseudo-library for information purposes.
608752f9793fSmrg	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
608852f9793fSmrg	instname="$dir/$name"i
608952f9793fSmrg	$show "$install_prog $instname $destdir/$name"
609052f9793fSmrg	$run eval "$install_prog $instname $destdir/$name" || exit $?
609152f9793fSmrg
609252f9793fSmrg	# Maybe install the static library, too.
609352f9793fSmrg	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
609452f9793fSmrg	;;
609552f9793fSmrg
609652f9793fSmrg      *.lo)
609752f9793fSmrg	# Install (i.e. copy) a libtool object.
609852f9793fSmrg
609952f9793fSmrg	# Figure out destination file name, if it wasn't already specified.
610052f9793fSmrg	if test -n "$destname"; then
610152f9793fSmrg	  destfile="$destdir/$destname"
610252f9793fSmrg	else
610352f9793fSmrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
610452f9793fSmrg	  destfile="$destdir/$destfile"
610552f9793fSmrg	fi
610652f9793fSmrg
610752f9793fSmrg	# Deduce the name of the destination old-style object file.
610852f9793fSmrg	case $destfile in
610952f9793fSmrg	*.lo)
611052f9793fSmrg	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
611152f9793fSmrg	  ;;
611252f9793fSmrg	*.$objext)
611352f9793fSmrg	  staticdest="$destfile"
611452f9793fSmrg	  destfile=
611552f9793fSmrg	  ;;
611652f9793fSmrg	*)
611752f9793fSmrg	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
611852f9793fSmrg	  $echo "$help" 1>&2
611952f9793fSmrg	  exit $EXIT_FAILURE
612052f9793fSmrg	  ;;
612152f9793fSmrg	esac
612252f9793fSmrg
612352f9793fSmrg	# Install the libtool object if requested.
612452f9793fSmrg	if test -n "$destfile"; then
612552f9793fSmrg	  $show "$install_prog $file $destfile"
612652f9793fSmrg	  $run eval "$install_prog $file $destfile" || exit $?
612752f9793fSmrg	fi
612852f9793fSmrg
612952f9793fSmrg	# Install the old object if enabled.
613052f9793fSmrg	if test "$build_old_libs" = yes; then
613152f9793fSmrg	  # Deduce the name of the old-style object file.
613252f9793fSmrg	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
613352f9793fSmrg
613452f9793fSmrg	  $show "$install_prog $staticobj $staticdest"
613552f9793fSmrg	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
613652f9793fSmrg	fi
613752f9793fSmrg	exit $EXIT_SUCCESS
613852f9793fSmrg	;;
613952f9793fSmrg
614052f9793fSmrg      *)
614152f9793fSmrg	# Figure out destination file name, if it wasn't already specified.
614252f9793fSmrg	if test -n "$destname"; then
614352f9793fSmrg	  destfile="$destdir/$destname"
614452f9793fSmrg	else
614552f9793fSmrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
614652f9793fSmrg	  destfile="$destdir/$destfile"
614752f9793fSmrg	fi
614852f9793fSmrg
614952f9793fSmrg	# If the file is missing, and there is a .exe on the end, strip it
615052f9793fSmrg	# because it is most likely a libtool script we actually want to
615152f9793fSmrg	# install
615252f9793fSmrg	stripped_ext=""
615352f9793fSmrg	case $file in
615452f9793fSmrg	  *.exe)
615552f9793fSmrg	    if test ! -f "$file"; then
615652f9793fSmrg	      file=`$echo $file|${SED} 's,.exe$,,'`
615752f9793fSmrg	      stripped_ext=".exe"
615852f9793fSmrg	    fi
615952f9793fSmrg	    ;;
616052f9793fSmrg	esac
616152f9793fSmrg
616252f9793fSmrg	# Do a test to see if this is really a libtool program.
616352f9793fSmrg	case $host in
616452f9793fSmrg	*cygwin*|*mingw*)
616552f9793fSmrg	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
616652f9793fSmrg	    ;;
616752f9793fSmrg	*)
616852f9793fSmrg	    wrapper=$file
616952f9793fSmrg	    ;;
617052f9793fSmrg	esac
617152f9793fSmrg	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
617252f9793fSmrg	  notinst_deplibs=
617352f9793fSmrg	  relink_command=
617452f9793fSmrg
617552f9793fSmrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
617652f9793fSmrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
617752f9793fSmrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
617852f9793fSmrg	  # `FILE.' does not work on cygwin managed mounts.
617952f9793fSmrg	  #
618052f9793fSmrg	  # If there is no directory component, then add one.
618152f9793fSmrg	  case $wrapper in
618252f9793fSmrg	  */* | *\\*) . ${wrapper} ;;
618352f9793fSmrg	  *) . ./${wrapper} ;;
618452f9793fSmrg	  esac
618552f9793fSmrg
618652f9793fSmrg	  # Check the variables that should have been set.
618752f9793fSmrg	  if test -z "$notinst_deplibs"; then
618852f9793fSmrg	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
618952f9793fSmrg	    exit $EXIT_FAILURE
619052f9793fSmrg	  fi
619152f9793fSmrg
619252f9793fSmrg	  finalize=yes
619352f9793fSmrg	  for lib in $notinst_deplibs; do
619452f9793fSmrg	    # Check to see that each library is installed.
619552f9793fSmrg	    libdir=
619652f9793fSmrg	    if test -f "$lib"; then
619752f9793fSmrg	      # If there is no directory component, then add one.
619852f9793fSmrg	      case $lib in
619952f9793fSmrg	      */* | *\\*) . $lib ;;
620052f9793fSmrg	      *) . ./$lib ;;
620152f9793fSmrg	      esac
620252f9793fSmrg	    fi
620352f9793fSmrg	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
620452f9793fSmrg	    if test -n "$libdir" && test ! -f "$libfile"; then
620552f9793fSmrg	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
620652f9793fSmrg	      finalize=no
620752f9793fSmrg	    fi
620852f9793fSmrg	  done
620952f9793fSmrg
621052f9793fSmrg	  relink_command=
621152f9793fSmrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
621252f9793fSmrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
621352f9793fSmrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
621452f9793fSmrg	  # `FILE.' does not work on cygwin managed mounts.
621552f9793fSmrg	  #
621652f9793fSmrg	  # If there is no directory component, then add one.
621752f9793fSmrg	  case $wrapper in
621852f9793fSmrg	  */* | *\\*) . ${wrapper} ;;
621952f9793fSmrg	  *) . ./${wrapper} ;;
622052f9793fSmrg	  esac
622152f9793fSmrg
622252f9793fSmrg	  outputname=
622352f9793fSmrg	  if test "$fast_install" = no && test -n "$relink_command"; then
622452f9793fSmrg	    if test "$finalize" = yes && test -z "$run"; then
622552f9793fSmrg	      tmpdir=`func_mktempdir`
622652f9793fSmrg	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
622752f9793fSmrg	      outputname="$tmpdir/$file"
622852f9793fSmrg	      # Replace the output file specification.
62292faa96e0Smrg	      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
623052f9793fSmrg
623152f9793fSmrg	      $show "$relink_command"
623252f9793fSmrg	      if $run eval "$relink_command"; then :
623352f9793fSmrg	      else
623452f9793fSmrg		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
623552f9793fSmrg		${rm}r "$tmpdir"
623652f9793fSmrg		continue
623752f9793fSmrg	      fi
623852f9793fSmrg	      file="$outputname"
623952f9793fSmrg	    else
624052f9793fSmrg	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
624152f9793fSmrg	    fi
624252f9793fSmrg	  else
624352f9793fSmrg	    # Install the binary that we compiled earlier.
624452f9793fSmrg	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
624552f9793fSmrg	  fi
624652f9793fSmrg	fi
624752f9793fSmrg
624852f9793fSmrg	# remove .exe since cygwin /usr/bin/install will append another
624952f9793fSmrg	# one anyway 
625052f9793fSmrg	case $install_prog,$host in
625152f9793fSmrg	*/usr/bin/install*,*cygwin*)
625252f9793fSmrg	  case $file:$destfile in
625352f9793fSmrg	  *.exe:*.exe)
625452f9793fSmrg	    # this is ok
625552f9793fSmrg	    ;;
625652f9793fSmrg	  *.exe:*)
625752f9793fSmrg	    destfile=$destfile.exe
625852f9793fSmrg	    ;;
625952f9793fSmrg	  *:*.exe)
626052f9793fSmrg	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
626152f9793fSmrg	    ;;
626252f9793fSmrg	  esac
626352f9793fSmrg	  ;;
626452f9793fSmrg	esac
626552f9793fSmrg	$show "$install_prog$stripme $file $destfile"
626652f9793fSmrg	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
626752f9793fSmrg	test -n "$outputname" && ${rm}r "$tmpdir"
626852f9793fSmrg	;;
626952f9793fSmrg      esac
627052f9793fSmrg    done
627152f9793fSmrg
627252f9793fSmrg    for file in $staticlibs; do
627352f9793fSmrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
627452f9793fSmrg
627552f9793fSmrg      # Set up the ranlib parameters.
627652f9793fSmrg      oldlib="$destdir/$name"
627752f9793fSmrg
627852f9793fSmrg      $show "$install_prog $file $oldlib"
627952f9793fSmrg      $run eval "$install_prog \$file \$oldlib" || exit $?
628052f9793fSmrg
628152f9793fSmrg      if test -n "$stripme" && test -n "$old_striplib"; then
628252f9793fSmrg	$show "$old_striplib $oldlib"
628352f9793fSmrg	$run eval "$old_striplib $oldlib" || exit $?
628452f9793fSmrg      fi
628552f9793fSmrg
628652f9793fSmrg      # Do each command in the postinstall commands.
628752f9793fSmrg      cmds=$old_postinstall_cmds
628852f9793fSmrg      save_ifs="$IFS"; IFS='~'
628952f9793fSmrg      for cmd in $cmds; do
629052f9793fSmrg	IFS="$save_ifs"
629152f9793fSmrg	eval cmd=\"$cmd\"
629252f9793fSmrg	$show "$cmd"
629352f9793fSmrg	$run eval "$cmd" || exit $?
629452f9793fSmrg      done
629552f9793fSmrg      IFS="$save_ifs"
629652f9793fSmrg    done
629752f9793fSmrg
629852f9793fSmrg    if test -n "$future_libdirs"; then
629952f9793fSmrg      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
630052f9793fSmrg    fi
630152f9793fSmrg
630252f9793fSmrg    if test -n "$current_libdirs"; then
630352f9793fSmrg      # Maybe just do a dry run.
630452f9793fSmrg      test -n "$run" && current_libdirs=" -n$current_libdirs"
630552f9793fSmrg      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
630652f9793fSmrg    else
630752f9793fSmrg      exit $EXIT_SUCCESS
630852f9793fSmrg    fi
630952f9793fSmrg    ;;
631052f9793fSmrg
631152f9793fSmrg  # libtool finish mode
631252f9793fSmrg  finish)
631352f9793fSmrg    modename="$modename: finish"
631452f9793fSmrg    libdirs="$nonopt"
631552f9793fSmrg    admincmds=
631652f9793fSmrg
631752f9793fSmrg    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
631852f9793fSmrg      for dir
631952f9793fSmrg      do
632052f9793fSmrg	libdirs="$libdirs $dir"
632152f9793fSmrg      done
632252f9793fSmrg
632352f9793fSmrg      for libdir in $libdirs; do
632452f9793fSmrg	if test -n "$finish_cmds"; then
632552f9793fSmrg	  # Do each command in the finish commands.
632652f9793fSmrg	  cmds=$finish_cmds
632752f9793fSmrg	  save_ifs="$IFS"; IFS='~'
632852f9793fSmrg	  for cmd in $cmds; do
632952f9793fSmrg	    IFS="$save_ifs"
633052f9793fSmrg	    eval cmd=\"$cmd\"
633152f9793fSmrg	    $show "$cmd"
633252f9793fSmrg	    $run eval "$cmd" || admincmds="$admincmds
633352f9793fSmrg       $cmd"
633452f9793fSmrg	  done
633552f9793fSmrg	  IFS="$save_ifs"
633652f9793fSmrg	fi
633752f9793fSmrg	if test -n "$finish_eval"; then
633852f9793fSmrg	  # Do the single finish_eval.
633952f9793fSmrg	  eval cmds=\"$finish_eval\"
634052f9793fSmrg	  $run eval "$cmds" || admincmds="$admincmds
634152f9793fSmrg       $cmds"
634252f9793fSmrg	fi
634352f9793fSmrg      done
634452f9793fSmrg    fi
634552f9793fSmrg
634652f9793fSmrg    # Exit here if they wanted silent mode.
634752f9793fSmrg    test "$show" = : && exit $EXIT_SUCCESS
634852f9793fSmrg
634952f9793fSmrg    $echo "X----------------------------------------------------------------------" | $Xsed
635052f9793fSmrg    $echo "Libraries have been installed in:"
635152f9793fSmrg    for libdir in $libdirs; do
635252f9793fSmrg      $echo "   $libdir"
635352f9793fSmrg    done
635452f9793fSmrg    $echo
635552f9793fSmrg    $echo "If you ever happen to want to link against installed libraries"
635652f9793fSmrg    $echo "in a given directory, LIBDIR, you must either use libtool, and"
635752f9793fSmrg    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
635852f9793fSmrg    $echo "flag during linking and do at least one of the following:"
635952f9793fSmrg    if test -n "$shlibpath_var"; then
636052f9793fSmrg      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
636152f9793fSmrg      $echo "     during execution"
636252f9793fSmrg    fi
636352f9793fSmrg    if test -n "$runpath_var"; then
636452f9793fSmrg      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
636552f9793fSmrg      $echo "     during linking"
636652f9793fSmrg    fi
636752f9793fSmrg    if test -n "$hardcode_libdir_flag_spec"; then
636852f9793fSmrg      libdir=LIBDIR
636952f9793fSmrg      eval flag=\"$hardcode_libdir_flag_spec\"
637052f9793fSmrg
637152f9793fSmrg      $echo "   - use the \`$flag' linker flag"
637252f9793fSmrg    fi
637352f9793fSmrg    if test -n "$admincmds"; then
637452f9793fSmrg      $echo "   - have your system administrator run these commands:$admincmds"
637552f9793fSmrg    fi
637652f9793fSmrg    if test -f /etc/ld.so.conf; then
637752f9793fSmrg      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
637852f9793fSmrg    fi
637952f9793fSmrg    $echo
638052f9793fSmrg    $echo "See any operating system documentation about shared libraries for"
638152f9793fSmrg    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
638252f9793fSmrg    $echo "X----------------------------------------------------------------------" | $Xsed
638352f9793fSmrg    exit $EXIT_SUCCESS
638452f9793fSmrg    ;;
638552f9793fSmrg
638652f9793fSmrg  # libtool execute mode
638752f9793fSmrg  execute)
638852f9793fSmrg    modename="$modename: execute"
638952f9793fSmrg
639052f9793fSmrg    # The first argument is the command name.
639152f9793fSmrg    cmd="$nonopt"
639252f9793fSmrg    if test -z "$cmd"; then
639352f9793fSmrg      $echo "$modename: you must specify a COMMAND" 1>&2
639452f9793fSmrg      $echo "$help"
639552f9793fSmrg      exit $EXIT_FAILURE
639652f9793fSmrg    fi
639752f9793fSmrg
639852f9793fSmrg    # Handle -dlopen flags immediately.
639952f9793fSmrg    for file in $execute_dlfiles; do
640052f9793fSmrg      if test ! -f "$file"; then
640152f9793fSmrg	$echo "$modename: \`$file' is not a file" 1>&2
640252f9793fSmrg	$echo "$help" 1>&2
640352f9793fSmrg	exit $EXIT_FAILURE
640452f9793fSmrg      fi
640552f9793fSmrg
640652f9793fSmrg      dir=
640752f9793fSmrg      case $file in
640852f9793fSmrg      *.la)
640952f9793fSmrg	# Check to see that this really is a libtool archive.
641052f9793fSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
641152f9793fSmrg	else
641252f9793fSmrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
641352f9793fSmrg	  $echo "$help" 1>&2
641452f9793fSmrg	  exit $EXIT_FAILURE
641552f9793fSmrg	fi
641652f9793fSmrg
641752f9793fSmrg	# Read the libtool library.
641852f9793fSmrg	dlname=
641952f9793fSmrg	library_names=
642052f9793fSmrg
642152f9793fSmrg	# If there is no directory component, then add one.
642252f9793fSmrg	case $file in
642352f9793fSmrg	*/* | *\\*) . $file ;;
642452f9793fSmrg	*) . ./$file ;;
642552f9793fSmrg	esac
642652f9793fSmrg
642752f9793fSmrg	# Skip this library if it cannot be dlopened.
642852f9793fSmrg	if test -z "$dlname"; then
642952f9793fSmrg	  # Warn if it was a shared library.
643052f9793fSmrg	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
643152f9793fSmrg	  continue
643252f9793fSmrg	fi
643352f9793fSmrg
643452f9793fSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
643552f9793fSmrg	test "X$dir" = "X$file" && dir=.
643652f9793fSmrg
643752f9793fSmrg	if test -f "$dir/$objdir/$dlname"; then
643852f9793fSmrg	  dir="$dir/$objdir"
643952f9793fSmrg	else
64402faa96e0Smrg	  if test ! -f "$dir/$dlname"; then
64412faa96e0Smrg	    $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
64422faa96e0Smrg	    exit $EXIT_FAILURE
64432faa96e0Smrg	  fi
644452f9793fSmrg	fi
644552f9793fSmrg	;;
644652f9793fSmrg
644752f9793fSmrg      *.lo)
644852f9793fSmrg	# Just add the directory containing the .lo file.
644952f9793fSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
645052f9793fSmrg	test "X$dir" = "X$file" && dir=.
645152f9793fSmrg	;;
645252f9793fSmrg
645352f9793fSmrg      *)
645452f9793fSmrg	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
645552f9793fSmrg	continue
645652f9793fSmrg	;;
645752f9793fSmrg      esac
645852f9793fSmrg
645952f9793fSmrg      # Get the absolute pathname.
646052f9793fSmrg      absdir=`cd "$dir" && pwd`
646152f9793fSmrg      test -n "$absdir" && dir="$absdir"
646252f9793fSmrg
646352f9793fSmrg      # Now add the directory to shlibpath_var.
646452f9793fSmrg      if eval "test -z \"\$$shlibpath_var\""; then
646552f9793fSmrg	eval "$shlibpath_var=\"\$dir\""
646652f9793fSmrg      else
646752f9793fSmrg	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
646852f9793fSmrg      fi
646952f9793fSmrg    done
647052f9793fSmrg
647152f9793fSmrg    # This variable tells wrapper scripts just to set shlibpath_var
647252f9793fSmrg    # rather than running their programs.
647352f9793fSmrg    libtool_execute_magic="$magic"
647452f9793fSmrg
647552f9793fSmrg    # Check if any of the arguments is a wrapper script.
647652f9793fSmrg    args=
647752f9793fSmrg    for file
647852f9793fSmrg    do
647952f9793fSmrg      case $file in
648052f9793fSmrg      -*) ;;
648152f9793fSmrg      *)
648252f9793fSmrg	# Do a test to see if this is really a libtool program.
648352f9793fSmrg	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
648452f9793fSmrg	  # If there is no directory component, then add one.
648552f9793fSmrg	  case $file in
648652f9793fSmrg	  */* | *\\*) . $file ;;
648752f9793fSmrg	  *) . ./$file ;;
648852f9793fSmrg	  esac
648952f9793fSmrg
649052f9793fSmrg	  # Transform arg to wrapped name.
649152f9793fSmrg	  file="$progdir/$program"
649252f9793fSmrg	fi
649352f9793fSmrg	;;
649452f9793fSmrg      esac
649552f9793fSmrg      # Quote arguments (to preserve shell metacharacters).
649652f9793fSmrg      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
649752f9793fSmrg      args="$args \"$file\""
649852f9793fSmrg    done
649952f9793fSmrg
650052f9793fSmrg    if test -z "$run"; then
650152f9793fSmrg      if test -n "$shlibpath_var"; then
650252f9793fSmrg	# Export the shlibpath_var.
650352f9793fSmrg	eval "export $shlibpath_var"
650452f9793fSmrg      fi
650552f9793fSmrg
650652f9793fSmrg      # Restore saved environment variables
65072faa96e0Smrg      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
65082faa96e0Smrg      do
65092faa96e0Smrg	eval "if test \"\${save_$lt_var+set}\" = set; then
65102faa96e0Smrg		$lt_var=\$save_$lt_var; export $lt_var
65112faa96e0Smrg	      fi"
65122faa96e0Smrg      done
651352f9793fSmrg
651452f9793fSmrg      # Now prepare to actually exec the command.
651552f9793fSmrg      exec_cmd="\$cmd$args"
651652f9793fSmrg    else
651752f9793fSmrg      # Display what would be done.
651852f9793fSmrg      if test -n "$shlibpath_var"; then
651952f9793fSmrg	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
652052f9793fSmrg	$echo "export $shlibpath_var"
652152f9793fSmrg      fi
652252f9793fSmrg      $echo "$cmd$args"
652352f9793fSmrg      exit $EXIT_SUCCESS
652452f9793fSmrg    fi
652552f9793fSmrg    ;;
652652f9793fSmrg
652752f9793fSmrg  # libtool clean and uninstall mode
652852f9793fSmrg  clean | uninstall)
652952f9793fSmrg    modename="$modename: $mode"
653052f9793fSmrg    rm="$nonopt"
653152f9793fSmrg    files=
653252f9793fSmrg    rmforce=
653352f9793fSmrg    exit_status=0
653452f9793fSmrg
653552f9793fSmrg    # This variable tells wrapper scripts just to set variables rather
653652f9793fSmrg    # than running their programs.
653752f9793fSmrg    libtool_install_magic="$magic"
653852f9793fSmrg
653952f9793fSmrg    for arg
654052f9793fSmrg    do
654152f9793fSmrg      case $arg in
654252f9793fSmrg      -f) rm="$rm $arg"; rmforce=yes ;;
654352f9793fSmrg      -*) rm="$rm $arg" ;;
654452f9793fSmrg      *) files="$files $arg" ;;
654552f9793fSmrg      esac
654652f9793fSmrg    done
654752f9793fSmrg
654852f9793fSmrg    if test -z "$rm"; then
654952f9793fSmrg      $echo "$modename: you must specify an RM program" 1>&2
655052f9793fSmrg      $echo "$help" 1>&2
655152f9793fSmrg      exit $EXIT_FAILURE
655252f9793fSmrg    fi
655352f9793fSmrg
655452f9793fSmrg    rmdirs=
655552f9793fSmrg
655652f9793fSmrg    origobjdir="$objdir"
655752f9793fSmrg    for file in $files; do
655852f9793fSmrg      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
655952f9793fSmrg      if test "X$dir" = "X$file"; then
656052f9793fSmrg	dir=.
656152f9793fSmrg	objdir="$origobjdir"
656252f9793fSmrg      else
656352f9793fSmrg	objdir="$dir/$origobjdir"
656452f9793fSmrg      fi
656552f9793fSmrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
656652f9793fSmrg      test "$mode" = uninstall && objdir="$dir"
656752f9793fSmrg
656852f9793fSmrg      # Remember objdir for removal later, being careful to avoid duplicates
656952f9793fSmrg      if test "$mode" = clean; then
657052f9793fSmrg	case " $rmdirs " in
657152f9793fSmrg	  *" $objdir "*) ;;
657252f9793fSmrg	  *) rmdirs="$rmdirs $objdir" ;;
657352f9793fSmrg	esac
657452f9793fSmrg      fi
657552f9793fSmrg
657652f9793fSmrg      # Don't error if the file doesn't exist and rm -f was used.
657752f9793fSmrg      if (test -L "$file") >/dev/null 2>&1 \
657852f9793fSmrg	|| (test -h "$file") >/dev/null 2>&1 \
657952f9793fSmrg	|| test -f "$file"; then
658052f9793fSmrg	:
658152f9793fSmrg      elif test -d "$file"; then
658252f9793fSmrg	exit_status=1
658352f9793fSmrg	continue
658452f9793fSmrg      elif test "$rmforce" = yes; then
658552f9793fSmrg	continue
658652f9793fSmrg      fi
658752f9793fSmrg
658852f9793fSmrg      rmfiles="$file"
658952f9793fSmrg
659052f9793fSmrg      case $name in
659152f9793fSmrg      *.la)
659252f9793fSmrg	# Possibly a libtool archive, so verify it.
659352f9793fSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
659452f9793fSmrg	  . $dir/$name
659552f9793fSmrg
659652f9793fSmrg	  # Delete the libtool libraries and symlinks.
659752f9793fSmrg	  for n in $library_names; do
659852f9793fSmrg	    rmfiles="$rmfiles $objdir/$n"
659952f9793fSmrg	  done
660052f9793fSmrg	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
660152f9793fSmrg
660252f9793fSmrg	  case "$mode" in
660352f9793fSmrg	  clean)
660452f9793fSmrg	    case "  $library_names " in
660552f9793fSmrg	    # "  " in the beginning catches empty $dlname
660652f9793fSmrg	    *" $dlname "*) ;;
660752f9793fSmrg	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
660852f9793fSmrg	    esac
660952f9793fSmrg	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
661052f9793fSmrg	    ;;
661152f9793fSmrg	  uninstall)
661252f9793fSmrg	    if test -n "$library_names"; then
661352f9793fSmrg	      # Do each command in the postuninstall commands.
661452f9793fSmrg	      cmds=$postuninstall_cmds
661552f9793fSmrg	      save_ifs="$IFS"; IFS='~'
661652f9793fSmrg	      for cmd in $cmds; do
661752f9793fSmrg		IFS="$save_ifs"
661852f9793fSmrg		eval cmd=\"$cmd\"
661952f9793fSmrg		$show "$cmd"
662052f9793fSmrg		$run eval "$cmd"
662152f9793fSmrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
662252f9793fSmrg		  exit_status=1
662352f9793fSmrg		fi
662452f9793fSmrg	      done
662552f9793fSmrg	      IFS="$save_ifs"
662652f9793fSmrg	    fi
662752f9793fSmrg
662852f9793fSmrg	    if test -n "$old_library"; then
662952f9793fSmrg	      # Do each command in the old_postuninstall commands.
663052f9793fSmrg	      cmds=$old_postuninstall_cmds
663152f9793fSmrg	      save_ifs="$IFS"; IFS='~'
663252f9793fSmrg	      for cmd in $cmds; do
663352f9793fSmrg		IFS="$save_ifs"
663452f9793fSmrg		eval cmd=\"$cmd\"
663552f9793fSmrg		$show "$cmd"
663652f9793fSmrg		$run eval "$cmd"
663752f9793fSmrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
663852f9793fSmrg		  exit_status=1
663952f9793fSmrg		fi
664052f9793fSmrg	      done
664152f9793fSmrg	      IFS="$save_ifs"
664252f9793fSmrg	    fi
664352f9793fSmrg	    # FIXME: should reinstall the best remaining shared library.
664452f9793fSmrg	    ;;
664552f9793fSmrg	  esac
664652f9793fSmrg	fi
664752f9793fSmrg	;;
664852f9793fSmrg
664952f9793fSmrg      *.lo)
665052f9793fSmrg	# Possibly a libtool object, so verify it.
665152f9793fSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
665252f9793fSmrg
665352f9793fSmrg	  # Read the .lo file
665452f9793fSmrg	  . $dir/$name
665552f9793fSmrg
665652f9793fSmrg	  # Add PIC object to the list of files to remove.
665752f9793fSmrg	  if test -n "$pic_object" \
665852f9793fSmrg	     && test "$pic_object" != none; then
665952f9793fSmrg	    rmfiles="$rmfiles $dir/$pic_object"
666052f9793fSmrg	  fi
666152f9793fSmrg
666252f9793fSmrg	  # Add non-PIC object to the list of files to remove.
666352f9793fSmrg	  if test -n "$non_pic_object" \
666452f9793fSmrg	     && test "$non_pic_object" != none; then
666552f9793fSmrg	    rmfiles="$rmfiles $dir/$non_pic_object"
666652f9793fSmrg	  fi
666752f9793fSmrg	fi
666852f9793fSmrg	;;
666952f9793fSmrg
667052f9793fSmrg      *)
667152f9793fSmrg	if test "$mode" = clean ; then
667252f9793fSmrg	  noexename=$name
667352f9793fSmrg	  case $file in
667452f9793fSmrg	  *.exe)
667552f9793fSmrg	    file=`$echo $file|${SED} 's,.exe$,,'`
667652f9793fSmrg	    noexename=`$echo $name|${SED} 's,.exe$,,'`
667752f9793fSmrg	    # $file with .exe has already been added to rmfiles,
667852f9793fSmrg	    # add $file without .exe
667952f9793fSmrg	    rmfiles="$rmfiles $file"
668052f9793fSmrg	    ;;
668152f9793fSmrg	  esac
668252f9793fSmrg	  # Do a test to see if this is a libtool program.
668352f9793fSmrg	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
668452f9793fSmrg	    relink_command=
668552f9793fSmrg	    . $dir/$noexename
668652f9793fSmrg
668752f9793fSmrg	    # note $name still contains .exe if it was in $file originally
668852f9793fSmrg	    # as does the version of $file that was added into $rmfiles
668952f9793fSmrg	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
669052f9793fSmrg	    if test "$fast_install" = yes && test -n "$relink_command"; then
669152f9793fSmrg	      rmfiles="$rmfiles $objdir/lt-$name"
669252f9793fSmrg	    fi
669352f9793fSmrg	    if test "X$noexename" != "X$name" ; then
669452f9793fSmrg	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
669552f9793fSmrg	    fi
669652f9793fSmrg	  fi
669752f9793fSmrg	fi
669852f9793fSmrg	;;
669952f9793fSmrg      esac
670052f9793fSmrg      $show "$rm $rmfiles"
670152f9793fSmrg      $run $rm $rmfiles || exit_status=1
670252f9793fSmrg    done
670352f9793fSmrg    objdir="$origobjdir"
670452f9793fSmrg
670552f9793fSmrg    # Try to remove the ${objdir}s in the directories where we deleted files
670652f9793fSmrg    for dir in $rmdirs; do
670752f9793fSmrg      if test -d "$dir"; then
670852f9793fSmrg	$show "rmdir $dir"
670952f9793fSmrg	$run rmdir $dir >/dev/null 2>&1
671052f9793fSmrg      fi
671152f9793fSmrg    done
671252f9793fSmrg
671352f9793fSmrg    exit $exit_status
671452f9793fSmrg    ;;
671552f9793fSmrg
671652f9793fSmrg  "")
671752f9793fSmrg    $echo "$modename: you must specify a MODE" 1>&2
671852f9793fSmrg    $echo "$generic_help" 1>&2
671952f9793fSmrg    exit $EXIT_FAILURE
672052f9793fSmrg    ;;
672152f9793fSmrg  esac
672252f9793fSmrg
672352f9793fSmrg  if test -z "$exec_cmd"; then
672452f9793fSmrg    $echo "$modename: invalid operation mode \`$mode'" 1>&2
672552f9793fSmrg    $echo "$generic_help" 1>&2
672652f9793fSmrg    exit $EXIT_FAILURE
672752f9793fSmrg  fi
672852f9793fSmrgfi # test -z "$show_help"
672952f9793fSmrg
673052f9793fSmrgif test -n "$exec_cmd"; then
673152f9793fSmrg  eval exec $exec_cmd
673252f9793fSmrg  exit $EXIT_FAILURE
673352f9793fSmrgfi
673452f9793fSmrg
673552f9793fSmrg# We need to display help for each of the modes.
673652f9793fSmrgcase $mode in
673752f9793fSmrg"") $echo \
673852f9793fSmrg"Usage: $modename [OPTION]... [MODE-ARG]...
673952f9793fSmrg
674052f9793fSmrgProvide generalized library-building support services.
674152f9793fSmrg
674252f9793fSmrg    --config          show all configuration variables
674352f9793fSmrg    --debug           enable verbose shell tracing
674452f9793fSmrg-n, --dry-run         display commands without modifying any files
674552f9793fSmrg    --features        display basic configuration information and exit
674652f9793fSmrg    --finish          same as \`--mode=finish'
674752f9793fSmrg    --help            display this help message and exit
674852f9793fSmrg    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
674952f9793fSmrg    --quiet           same as \`--silent'
675052f9793fSmrg    --silent          don't print informational messages
675152f9793fSmrg    --tag=TAG         use configuration variables from tag TAG
675252f9793fSmrg    --version         print version information
675352f9793fSmrg
675452f9793fSmrgMODE must be one of the following:
675552f9793fSmrg
675652f9793fSmrg      clean           remove files from the build directory
675752f9793fSmrg      compile         compile a source file into a libtool object
675852f9793fSmrg      execute         automatically set library path, then run a program
675952f9793fSmrg      finish          complete the installation of libtool libraries
676052f9793fSmrg      install         install libraries or executables
676152f9793fSmrg      link            create a library or an executable
676252f9793fSmrg      uninstall       remove libraries from an installed directory
676352f9793fSmrg
676452f9793fSmrgMODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
676552f9793fSmrga more detailed description of MODE.
676652f9793fSmrg
676752f9793fSmrgReport bugs to <bug-libtool@gnu.org>."
676852f9793fSmrg  exit $EXIT_SUCCESS
676952f9793fSmrg  ;;
677052f9793fSmrg
677152f9793fSmrgclean)
677252f9793fSmrg  $echo \
677352f9793fSmrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
677452f9793fSmrg
677552f9793fSmrgRemove files from the build directory.
677652f9793fSmrg
677752f9793fSmrgRM is the name of the program to use to delete files associated with each FILE
677852f9793fSmrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
677952f9793fSmrgto RM.
678052f9793fSmrg
678152f9793fSmrgIf FILE is a libtool library, object or program, all the files associated
678252f9793fSmrgwith it are deleted. Otherwise, only FILE itself is deleted using RM."
678352f9793fSmrg  ;;
678452f9793fSmrg
678552f9793fSmrgcompile)
678652f9793fSmrg  $echo \
678752f9793fSmrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
678852f9793fSmrg
678952f9793fSmrgCompile a source file into a libtool library object.
679052f9793fSmrg
679152f9793fSmrgThis mode accepts the following additional options:
679252f9793fSmrg
679352f9793fSmrg  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
679452f9793fSmrg  -prefer-pic       try to building PIC objects only
679552f9793fSmrg  -prefer-non-pic   try to building non-PIC objects only
679652f9793fSmrg  -static           always build a \`.o' file suitable for static linking
679752f9793fSmrg
679852f9793fSmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file
679952f9793fSmrgfrom the given SOURCEFILE.
680052f9793fSmrg
680152f9793fSmrgThe output file name is determined by removing the directory component from
680252f9793fSmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the
680352f9793fSmrglibrary object suffix, \`.lo'."
680452f9793fSmrg  ;;
680552f9793fSmrg
680652f9793fSmrgexecute)
680752f9793fSmrg  $echo \
680852f9793fSmrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
680952f9793fSmrg
681052f9793fSmrgAutomatically set library path, then run a program.
681152f9793fSmrg
681252f9793fSmrgThis mode accepts the following additional options:
681352f9793fSmrg
681452f9793fSmrg  -dlopen FILE      add the directory containing FILE to the library path
681552f9793fSmrg
681652f9793fSmrgThis mode sets the library path environment variable according to \`-dlopen'
681752f9793fSmrgflags.
681852f9793fSmrg
681952f9793fSmrgIf any of the ARGS are libtool executable wrappers, then they are translated
682052f9793fSmrginto their corresponding uninstalled binary, and any of their required library
682152f9793fSmrgdirectories are added to the library path.
682252f9793fSmrg
682352f9793fSmrgThen, COMMAND is executed, with ARGS as arguments."
682452f9793fSmrg  ;;
682552f9793fSmrg
682652f9793fSmrgfinish)
682752f9793fSmrg  $echo \
682852f9793fSmrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
682952f9793fSmrg
683052f9793fSmrgComplete the installation of libtool libraries.
683152f9793fSmrg
683252f9793fSmrgEach LIBDIR is a directory that contains libtool libraries.
683352f9793fSmrg
683452f9793fSmrgThe commands that this mode executes may require superuser privileges.  Use
683552f9793fSmrgthe \`--dry-run' option if you just want to see what would be executed."
683652f9793fSmrg  ;;
683752f9793fSmrg
683852f9793fSmrginstall)
683952f9793fSmrg  $echo \
684052f9793fSmrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
684152f9793fSmrg
684252f9793fSmrgInstall executables or libraries.
684352f9793fSmrg
684452f9793fSmrgINSTALL-COMMAND is the installation command.  The first component should be
684552f9793fSmrgeither the \`install' or \`cp' program.
684652f9793fSmrg
684752f9793fSmrgThe rest of the components are interpreted as arguments to that command (only
684852f9793fSmrgBSD-compatible install options are recognized)."
684952f9793fSmrg  ;;
685052f9793fSmrg
685152f9793fSmrglink)
685252f9793fSmrg  $echo \
685352f9793fSmrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
685452f9793fSmrg
685552f9793fSmrgLink object files or libraries together to form another library, or to
685652f9793fSmrgcreate an executable program.
685752f9793fSmrg
685852f9793fSmrgLINK-COMMAND is a command using the C compiler that you would use to create
685952f9793fSmrga program from several object files.
686052f9793fSmrg
686152f9793fSmrgThe following components of LINK-COMMAND are treated specially:
686252f9793fSmrg
686352f9793fSmrg  -all-static       do not do any dynamic linking at all
686452f9793fSmrg  -avoid-version    do not add a version suffix if possible
686552f9793fSmrg  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
686652f9793fSmrg  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
686752f9793fSmrg  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
686852f9793fSmrg  -export-symbols SYMFILE
68692faa96e0Smrg                    try to export only the symbols listed in SYMFILE
687052f9793fSmrg  -export-symbols-regex REGEX
68712faa96e0Smrg                    try to export only the symbols matching REGEX
687252f9793fSmrg  -LLIBDIR          search LIBDIR for required installed libraries
687352f9793fSmrg  -lNAME            OUTPUT-FILE requires the installed library libNAME
687452f9793fSmrg  -module           build a library that can dlopened
687552f9793fSmrg  -no-fast-install  disable the fast-install mode
687652f9793fSmrg  -no-install       link a not-installable executable
687752f9793fSmrg  -no-undefined     declare that a library does not refer to external symbols
687852f9793fSmrg  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
687952f9793fSmrg  -objectlist FILE  Use a list of object files found in FILE to specify objects
688052f9793fSmrg  -precious-files-regex REGEX
688152f9793fSmrg                    don't remove output files matching REGEX
688252f9793fSmrg  -release RELEASE  specify package release information
688352f9793fSmrg  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
688452f9793fSmrg  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
68852faa96e0Smrg  -static           do not do any dynamic linking of uninstalled libtool libraries
68862faa96e0Smrg  -static-libtool-libs
68872faa96e0Smrg                    do not do any dynamic linking of libtool libraries
688852f9793fSmrg  -version-info CURRENT[:REVISION[:AGE]]
68892faa96e0Smrg                    specify library version info [each variable defaults to 0]
689052f9793fSmrg
689152f9793fSmrgAll other options (arguments beginning with \`-') are ignored.
689252f9793fSmrg
689352f9793fSmrgEvery other argument is treated as a filename.  Files ending in \`.la' are
689452f9793fSmrgtreated as uninstalled libtool libraries, other files are standard or library
689552f9793fSmrgobject files.
689652f9793fSmrg
689752f9793fSmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created,
689852f9793fSmrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is
689952f9793fSmrgrequired, except when creating a convenience library.
690052f9793fSmrg
690152f9793fSmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
690252f9793fSmrgusing \`ar' and \`ranlib', or on Windows using \`lib'.
690352f9793fSmrg
690452f9793fSmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
690552f9793fSmrgis created, otherwise an executable program is created."
690652f9793fSmrg  ;;
690752f9793fSmrg
690852f9793fSmrguninstall)
690952f9793fSmrg  $echo \
691052f9793fSmrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
691152f9793fSmrg
691252f9793fSmrgRemove libraries from an installation directory.
691352f9793fSmrg
691452f9793fSmrgRM is the name of the program to use to delete files associated with each FILE
691552f9793fSmrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
691652f9793fSmrgto RM.
691752f9793fSmrg
691852f9793fSmrgIf FILE is a libtool library, all the files associated with it are deleted.
691952f9793fSmrgOtherwise, only FILE itself is deleted using RM."
692052f9793fSmrg  ;;
692152f9793fSmrg
692252f9793fSmrg*)
692352f9793fSmrg  $echo "$modename: invalid operation mode \`$mode'" 1>&2
692452f9793fSmrg  $echo "$help" 1>&2
692552f9793fSmrg  exit $EXIT_FAILURE
692652f9793fSmrg  ;;
692752f9793fSmrgesac
692852f9793fSmrg
692952f9793fSmrg$echo
693052f9793fSmrg$echo "Try \`$modename --help' for more information about other modes."
693152f9793fSmrg
693252f9793fSmrgexit $?
693352f9793fSmrg
693452f9793fSmrg# The TAGs below are defined such that we never get into a situation
693552f9793fSmrg# in which we disable both kinds of libraries.  Given conflicting
693652f9793fSmrg# choices, we go for a static library, that is the most portable,
693752f9793fSmrg# since we can't tell whether shared libraries were disabled because
693852f9793fSmrg# the user asked for that or because the platform doesn't support
693952f9793fSmrg# them.  This is particularly important on AIX, because we don't
694052f9793fSmrg# support having both static and shared libraries enabled at the same
694152f9793fSmrg# time on that platform, so we default to a shared-only configuration.
694252f9793fSmrg# If a disable-shared tag is given, we'll fallback to a static-only
694352f9793fSmrg# configuration.  But we'll never go from static-only to shared-only.
694452f9793fSmrg
694552f9793fSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
694652f9793fSmrgdisable_libs=shared
694752f9793fSmrg# ### END LIBTOOL TAG CONFIG: disable-shared
694852f9793fSmrg
694952f9793fSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static
695052f9793fSmrgdisable_libs=static
695152f9793fSmrg# ### END LIBTOOL TAG CONFIG: disable-static
695252f9793fSmrg
695352f9793fSmrg# Local Variables:
695452f9793fSmrg# mode:shell-script
695552f9793fSmrg# sh-indentation:2
695652f9793fSmrg# End:
6957