ltmain.sh revision 8e0ed500
117a48c7cSmrg# ltmain.sh - Provide generalized library-building support services.
217a48c7cSmrg# NOTE: Changing this file will not affect anything until you rerun configure.
317a48c7cSmrg#
417a48c7cSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
517a48c7cSmrg# Free Software Foundation, Inc.
617a48c7cSmrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
717a48c7cSmrg#
817a48c7cSmrg# This program is free software; you can redistribute it and/or modify
917a48c7cSmrg# it under the terms of the GNU General Public License as published by
1017a48c7cSmrg# the Free Software Foundation; either version 2 of the License, or
1117a48c7cSmrg# (at your option) any later version.
1217a48c7cSmrg#
1317a48c7cSmrg# This program is distributed in the hope that it will be useful, but
1417a48c7cSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1517a48c7cSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1617a48c7cSmrg# General Public License for more details.
1717a48c7cSmrg#
1817a48c7cSmrg# You should have received a copy of the GNU General Public License
1917a48c7cSmrg# along with this program; if not, write to the Free Software
2017a48c7cSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2117a48c7cSmrg#
2217a48c7cSmrg# As a special exception to the GNU General Public License, if you
2317a48c7cSmrg# distribute this file as part of a program that contains a
2417a48c7cSmrg# configuration script generated by Autoconf, you may include it under
2517a48c7cSmrg# the same distribution terms that you use for the rest of that program.
2617a48c7cSmrg
2717a48c7cSmrgbasename="s,^.*/,,g"
2817a48c7cSmrg
2917a48c7cSmrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
3017a48c7cSmrg# is ksh but when the shell is invoked as "sh" and the current value of
3117a48c7cSmrg# the _XPG environment variable is not equal to 1 (one), the special
3217a48c7cSmrg# positional parameter $0, within a function call, is the name of the
3317a48c7cSmrg# function.
3417a48c7cSmrgprogpath="$0"
3517a48c7cSmrg
3617a48c7cSmrg# The name of this program:
3717a48c7cSmrgprogname=`echo "$progpath" | $SED $basename`
3817a48c7cSmrgmodename="$progname"
3917a48c7cSmrg
4017a48c7cSmrg# Global variables:
4117a48c7cSmrgEXIT_SUCCESS=0
4217a48c7cSmrgEXIT_FAILURE=1
4317a48c7cSmrg
4417a48c7cSmrgPROGRAM=ltmain.sh
4517a48c7cSmrgPACKAGE=libtool
4617a48c7cSmrgVERSION=1.5.22
4717a48c7cSmrgTIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
4817a48c7cSmrg
498e0ed500Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
508e0ed500Smrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
518e0ed500Smrg  emulate sh
528e0ed500Smrg  NULLCMD=:
538e0ed500Smrg  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
548e0ed500Smrg  # is contrary to our usage.  Disable this feature.
558e0ed500Smrg  alias -g '${1+"$@"}'='"$@"'
5617a48c7cSmrg  setopt NO_GLOB_SUBST
578e0ed500Smrgelse
588e0ed500Smrg  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
5917a48c7cSmrgfi
6017a48c7cSmrg
6117a48c7cSmrg# Check that we have a working $echo.
6217a48c7cSmrgif test "X$1" = X--no-reexec; then
6317a48c7cSmrg  # Discard the --no-reexec flag, and continue.
6417a48c7cSmrg  shift
6517a48c7cSmrgelif test "X$1" = X--fallback-echo; then
6617a48c7cSmrg  # Avoid inline document here, it may be left over
6717a48c7cSmrg  :
6817a48c7cSmrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
6917a48c7cSmrg  # Yippee, $echo works!
7017a48c7cSmrg  :
7117a48c7cSmrgelse
7217a48c7cSmrg  # Restart under the correct shell, and then maybe $echo will work.
7317a48c7cSmrg  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
7417a48c7cSmrgfi
7517a48c7cSmrg
7617a48c7cSmrgif test "X$1" = X--fallback-echo; then
7717a48c7cSmrg  # used as fallback echo
7817a48c7cSmrg  shift
7917a48c7cSmrg  cat <<EOF
8017a48c7cSmrg$*
8117a48c7cSmrgEOF
8217a48c7cSmrg  exit $EXIT_SUCCESS
8317a48c7cSmrgfi
8417a48c7cSmrg
8517a48c7cSmrgdefault_mode=
8617a48c7cSmrghelp="Try \`$progname --help' for more information."
8717a48c7cSmrgmagic="%%%MAGIC variable%%%"
8817a48c7cSmrgmkdir="mkdir"
8917a48c7cSmrgmv="mv -f"
9017a48c7cSmrgrm="rm -f"
9117a48c7cSmrg
9217a48c7cSmrg# Sed substitution that helps us do robust quoting.  It backslashifies
9317a48c7cSmrg# metacharacters that are still active within double-quoted strings.
9417a48c7cSmrgXsed="${SED}"' -e 1s/^X//'
9517a48c7cSmrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
9617a48c7cSmrg# test EBCDIC or ASCII
9717a48c7cSmrgcase `echo X|tr X '\101'` in
9817a48c7cSmrg A) # ASCII based system
9917a48c7cSmrg    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
10017a48c7cSmrg  SP2NL='tr \040 \012'
10117a48c7cSmrg  NL2SP='tr \015\012 \040\040'
10217a48c7cSmrg  ;;
10317a48c7cSmrg *) # EBCDIC based system
10417a48c7cSmrg  SP2NL='tr \100 \n'
10517a48c7cSmrg  NL2SP='tr \r\n \100\100'
10617a48c7cSmrg  ;;
10717a48c7cSmrgesac
10817a48c7cSmrg
10917a48c7cSmrg# NLS nuisances.
11017a48c7cSmrg# Only set LANG and LC_ALL to C if already set.
11117a48c7cSmrg# These must not be set unconditionally because not all systems understand
11217a48c7cSmrg# e.g. LANG=C (notably SCO).
11317a48c7cSmrg# We save the old values to restore during execute mode.
1148e0ed500Smrgfor lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1158e0ed500Smrgdo
1168e0ed500Smrg  eval "if test \"\${$lt_var+set}\" = set; then
1178e0ed500Smrg         save_$lt_var=\$$lt_var
1188e0ed500Smrg         $lt_var=C
1198e0ed500Smrg         export $lt_var
1208e0ed500Smrg       fi"
1218e0ed500Smrgdone
12217a48c7cSmrg
12317a48c7cSmrg# Make sure IFS has a sensible default
12417a48c7cSmrglt_nl='
12517a48c7cSmrg'
12617a48c7cSmrgIFS=" 	$lt_nl"
12717a48c7cSmrg
12817a48c7cSmrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
12917a48c7cSmrg  $echo "$modename: not configured to build any kind of library" 1>&2
13017a48c7cSmrg  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
13117a48c7cSmrg  exit $EXIT_FAILURE
13217a48c7cSmrgfi
13317a48c7cSmrg
13417a48c7cSmrg# Global variables.
13517a48c7cSmrgmode=$default_mode
13617a48c7cSmrgnonopt=
13717a48c7cSmrgprev=
13817a48c7cSmrgprevopt=
13917a48c7cSmrgrun=
14017a48c7cSmrgshow="$echo"
14117a48c7cSmrgshow_help=
14217a48c7cSmrgexecute_dlfiles=
14317a48c7cSmrgduplicate_deps=no
14417a48c7cSmrgpreserve_args=
14517a48c7cSmrglo2o="s/\\.lo\$/.${objext}/"
14617a48c7cSmrgo2lo="s/\\.${objext}\$/.lo/"
1478e0ed500Smrgextracted_archives=
1488e0ed500Smrgextracted_serial=0
14917a48c7cSmrg
15017a48c7cSmrg#####################################
15117a48c7cSmrg# Shell function definitions:
15217a48c7cSmrg# This seems to be the best place for them
15317a48c7cSmrg
15417a48c7cSmrg# func_mktempdir [string]
15517a48c7cSmrg# Make a temporary directory that won't clash with other running
15617a48c7cSmrg# libtool processes, and avoids race conditions if possible.  If
15717a48c7cSmrg# given, STRING is the basename for that directory.
15817a48c7cSmrgfunc_mktempdir ()
15917a48c7cSmrg{
16017a48c7cSmrg    my_template="${TMPDIR-/tmp}/${1-$progname}"
16117a48c7cSmrg
16217a48c7cSmrg    if test "$run" = ":"; then
16317a48c7cSmrg      # Return a directory name, but don't create it in dry-run mode
16417a48c7cSmrg      my_tmpdir="${my_template}-$$"
16517a48c7cSmrg    else
16617a48c7cSmrg
16717a48c7cSmrg      # If mktemp works, use that first and foremost
16817a48c7cSmrg      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
16917a48c7cSmrg
17017a48c7cSmrg      if test ! -d "$my_tmpdir"; then
17117a48c7cSmrg	# Failing that, at least try and use $RANDOM to avoid a race
17217a48c7cSmrg	my_tmpdir="${my_template}-${RANDOM-0}$$"
17317a48c7cSmrg
17417a48c7cSmrg	save_mktempdir_umask=`umask`
17517a48c7cSmrg	umask 0077
17617a48c7cSmrg	$mkdir "$my_tmpdir"
17717a48c7cSmrg	umask $save_mktempdir_umask
17817a48c7cSmrg      fi
17917a48c7cSmrg
18017a48c7cSmrg      # If we're not in dry-run mode, bomb out on failure
18117a48c7cSmrg      test -d "$my_tmpdir" || {
18217a48c7cSmrg        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
18317a48c7cSmrg	exit $EXIT_FAILURE
18417a48c7cSmrg      }
18517a48c7cSmrg    fi
18617a48c7cSmrg
18717a48c7cSmrg    $echo "X$my_tmpdir" | $Xsed
18817a48c7cSmrg}
18917a48c7cSmrg
19017a48c7cSmrg
19117a48c7cSmrg# func_win32_libid arg
19217a48c7cSmrg# return the library type of file 'arg'
19317a48c7cSmrg#
19417a48c7cSmrg# Need a lot of goo to handle *both* DLLs and import libs
19517a48c7cSmrg# Has to be a shell function in order to 'eat' the argument
19617a48c7cSmrg# that is supplied when $file_magic_command is called.
19717a48c7cSmrgfunc_win32_libid ()
19817a48c7cSmrg{
19917a48c7cSmrg  win32_libid_type="unknown"
20017a48c7cSmrg  win32_fileres=`file -L $1 2>/dev/null`
20117a48c7cSmrg  case $win32_fileres in
20217a48c7cSmrg  *ar\ archive\ import\ library*) # definitely import
20317a48c7cSmrg    win32_libid_type="x86 archive import"
20417a48c7cSmrg    ;;
20517a48c7cSmrg  *ar\ archive*) # could be an import, or static
20617a48c7cSmrg    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
20717a48c7cSmrg      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
20817a48c7cSmrg      win32_nmres=`eval $NM -f posix -A $1 | \
20917a48c7cSmrg	$SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
21017a48c7cSmrg      case $win32_nmres in
21117a48c7cSmrg      import*)  win32_libid_type="x86 archive import";;
21217a48c7cSmrg      *)        win32_libid_type="x86 archive static";;
21317a48c7cSmrg      esac
21417a48c7cSmrg    fi
21517a48c7cSmrg    ;;
21617a48c7cSmrg  *DLL*)
21717a48c7cSmrg    win32_libid_type="x86 DLL"
21817a48c7cSmrg    ;;
21917a48c7cSmrg  *executable*) # but shell scripts are "executable" too...
22017a48c7cSmrg    case $win32_fileres in
22117a48c7cSmrg    *MS\ Windows\ PE\ Intel*)
22217a48c7cSmrg      win32_libid_type="x86 DLL"
22317a48c7cSmrg      ;;
22417a48c7cSmrg    esac
22517a48c7cSmrg    ;;
22617a48c7cSmrg  esac
22717a48c7cSmrg  $echo $win32_libid_type
22817a48c7cSmrg}
22917a48c7cSmrg
23017a48c7cSmrg
23117a48c7cSmrg# func_infer_tag arg
23217a48c7cSmrg# Infer tagged configuration to use if any are available and
23317a48c7cSmrg# if one wasn't chosen via the "--tag" command line option.
23417a48c7cSmrg# Only attempt this if the compiler in the base compile
23517a48c7cSmrg# command doesn't match the default compiler.
23617a48c7cSmrg# arg is usually of the form 'gcc ...'
23717a48c7cSmrgfunc_infer_tag ()
23817a48c7cSmrg{
23917a48c7cSmrg    if test -n "$available_tags" && test -z "$tagname"; then
24017a48c7cSmrg      CC_quoted=
24117a48c7cSmrg      for arg in $CC; do
24217a48c7cSmrg	case $arg in
24317a48c7cSmrg	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
24417a48c7cSmrg	  arg="\"$arg\""
24517a48c7cSmrg	  ;;
24617a48c7cSmrg	esac
24717a48c7cSmrg	CC_quoted="$CC_quoted $arg"
24817a48c7cSmrg      done
24917a48c7cSmrg      case $@ in
25017a48c7cSmrg      # Blanks in the command may have been stripped by the calling shell,
25117a48c7cSmrg      # but not from the CC environment variable when configure was run.
25217a48c7cSmrg      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
25317a48c7cSmrg      # Blanks at the start of $base_compile will cause this to fail
25417a48c7cSmrg      # if we don't check for them as well.
25517a48c7cSmrg      *)
25617a48c7cSmrg	for z in $available_tags; do
25717a48c7cSmrg	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
25817a48c7cSmrg	    # Evaluate the configuration.
25917a48c7cSmrg	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
26017a48c7cSmrg	    CC_quoted=
26117a48c7cSmrg	    for arg in $CC; do
26217a48c7cSmrg	    # Double-quote args containing other shell metacharacters.
26317a48c7cSmrg	    case $arg in
26417a48c7cSmrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
26517a48c7cSmrg	      arg="\"$arg\""
26617a48c7cSmrg	      ;;
26717a48c7cSmrg	    esac
26817a48c7cSmrg	    CC_quoted="$CC_quoted $arg"
26917a48c7cSmrg	  done
27017a48c7cSmrg	    case "$@ " in
27117a48c7cSmrg	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
27217a48c7cSmrg	      # The compiler in the base compile command matches
27317a48c7cSmrg	      # the one in the tagged configuration.
27417a48c7cSmrg	      # Assume this is the tagged configuration we want.
27517a48c7cSmrg	      tagname=$z
27617a48c7cSmrg	      break
27717a48c7cSmrg	      ;;
27817a48c7cSmrg	    esac
27917a48c7cSmrg	  fi
28017a48c7cSmrg	done
28117a48c7cSmrg	# If $tagname still isn't set, then no tagged configuration
28217a48c7cSmrg	# was found and let the user know that the "--tag" command
28317a48c7cSmrg	# line option must be used.
28417a48c7cSmrg	if test -z "$tagname"; then
28517a48c7cSmrg	  $echo "$modename: unable to infer tagged configuration"
28617a48c7cSmrg	  $echo "$modename: specify a tag with \`--tag'" 1>&2
28717a48c7cSmrg	  exit $EXIT_FAILURE
28817a48c7cSmrg#        else
28917a48c7cSmrg#          $echo "$modename: using $tagname tagged configuration"
29017a48c7cSmrg	fi
29117a48c7cSmrg	;;
29217a48c7cSmrg      esac
29317a48c7cSmrg    fi
29417a48c7cSmrg}
29517a48c7cSmrg
29617a48c7cSmrg
29717a48c7cSmrg# func_extract_an_archive dir oldlib
29817a48c7cSmrgfunc_extract_an_archive ()
29917a48c7cSmrg{
30017a48c7cSmrg    f_ex_an_ar_dir="$1"; shift
30117a48c7cSmrg    f_ex_an_ar_oldlib="$1"
30217a48c7cSmrg
30317a48c7cSmrg    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
30417a48c7cSmrg    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
30517a48c7cSmrg    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
30617a48c7cSmrg     :
30717a48c7cSmrg    else
30817a48c7cSmrg      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
30917a48c7cSmrg      exit $EXIT_FAILURE
31017a48c7cSmrg    fi
31117a48c7cSmrg}
31217a48c7cSmrg
31317a48c7cSmrg# func_extract_archives gentop oldlib ...
31417a48c7cSmrgfunc_extract_archives ()
31517a48c7cSmrg{
31617a48c7cSmrg    my_gentop="$1"; shift
31717a48c7cSmrg    my_oldlibs=${1+"$@"}
31817a48c7cSmrg    my_oldobjs=""
31917a48c7cSmrg    my_xlib=""
32017a48c7cSmrg    my_xabs=""
32117a48c7cSmrg    my_xdir=""
32217a48c7cSmrg    my_status=""
32317a48c7cSmrg
32417a48c7cSmrg    $show "${rm}r $my_gentop"
32517a48c7cSmrg    $run ${rm}r "$my_gentop"
32617a48c7cSmrg    $show "$mkdir $my_gentop"
32717a48c7cSmrg    $run $mkdir "$my_gentop"
32817a48c7cSmrg    my_status=$?
32917a48c7cSmrg    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
33017a48c7cSmrg      exit $my_status
33117a48c7cSmrg    fi
33217a48c7cSmrg
33317a48c7cSmrg    for my_xlib in $my_oldlibs; do
33417a48c7cSmrg      # Extract the objects.
33517a48c7cSmrg      case $my_xlib in
33617a48c7cSmrg	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
33717a48c7cSmrg	*) my_xabs=`pwd`"/$my_xlib" ;;
33817a48c7cSmrg      esac
33917a48c7cSmrg      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
3408e0ed500Smrg      my_xlib_u=$my_xlib
3418e0ed500Smrg      while :; do
3428e0ed500Smrg        case " $extracted_archives " in
3438e0ed500Smrg       *" $my_xlib_u "*)
3448e0ed500Smrg         extracted_serial=`expr $extracted_serial + 1`
3458e0ed500Smrg         my_xlib_u=lt$extracted_serial-$my_xlib ;;
3468e0ed500Smrg       *) break ;;
3478e0ed500Smrg       esac
3488e0ed500Smrg      done
3498e0ed500Smrg      extracted_archives="$extracted_archives $my_xlib_u"
3508e0ed500Smrg      my_xdir="$my_gentop/$my_xlib_u"
35117a48c7cSmrg
35217a48c7cSmrg      $show "${rm}r $my_xdir"
35317a48c7cSmrg      $run ${rm}r "$my_xdir"
35417a48c7cSmrg      $show "$mkdir $my_xdir"
35517a48c7cSmrg      $run $mkdir "$my_xdir"
35617a48c7cSmrg      exit_status=$?
35717a48c7cSmrg      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
35817a48c7cSmrg	exit $exit_status
35917a48c7cSmrg      fi
36017a48c7cSmrg      case $host in
36117a48c7cSmrg      *-darwin*)
36217a48c7cSmrg	$show "Extracting $my_xabs"
36317a48c7cSmrg	# Do not bother doing anything if just a dry run
36417a48c7cSmrg	if test -z "$run"; then
36517a48c7cSmrg	  darwin_orig_dir=`pwd`
36617a48c7cSmrg	  cd $my_xdir || exit $?
36717a48c7cSmrg	  darwin_archive=$my_xabs
36817a48c7cSmrg	  darwin_curdir=`pwd`
36917a48c7cSmrg	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
37017a48c7cSmrg	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
37117a48c7cSmrg	  if test -n "$darwin_arches"; then 
37217a48c7cSmrg	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
37317a48c7cSmrg	    darwin_arch=
37417a48c7cSmrg	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
37517a48c7cSmrg	    for darwin_arch in  $darwin_arches ; do
37617a48c7cSmrg	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
37717a48c7cSmrg	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
37817a48c7cSmrg	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
37917a48c7cSmrg	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
38017a48c7cSmrg	      cd "$darwin_curdir"
38117a48c7cSmrg	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
38217a48c7cSmrg	    done # $darwin_arches
38317a48c7cSmrg      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
38417a48c7cSmrg	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
38517a48c7cSmrg	    darwin_file=
38617a48c7cSmrg	    darwin_files=
38717a48c7cSmrg	    for darwin_file in $darwin_filelist; do
38817a48c7cSmrg	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
38917a48c7cSmrg	      lipo -create -output "$darwin_file" $darwin_files
39017a48c7cSmrg	    done # $darwin_filelist
39117a48c7cSmrg	    ${rm}r unfat-$$
39217a48c7cSmrg	    cd "$darwin_orig_dir"
39317a48c7cSmrg	  else
39417a48c7cSmrg	    cd "$darwin_orig_dir"
39517a48c7cSmrg 	    func_extract_an_archive "$my_xdir" "$my_xabs"
39617a48c7cSmrg	  fi # $darwin_arches
39717a48c7cSmrg	fi # $run
39817a48c7cSmrg	;;
39917a48c7cSmrg      *)
40017a48c7cSmrg        func_extract_an_archive "$my_xdir" "$my_xabs"
40117a48c7cSmrg        ;;
40217a48c7cSmrg      esac
40317a48c7cSmrg      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
40417a48c7cSmrg    done
40517a48c7cSmrg    func_extract_archives_result="$my_oldobjs"
40617a48c7cSmrg}
40717a48c7cSmrg# End of Shell function definitions
40817a48c7cSmrg#####################################
40917a48c7cSmrg
41017a48c7cSmrg# Darwin sucks
41117a48c7cSmrgeval std_shrext=\"$shrext_cmds\"
41217a48c7cSmrg
41317a48c7cSmrgdisable_libs=no
41417a48c7cSmrg
41517a48c7cSmrg# Parse our command line options once, thoroughly.
41617a48c7cSmrgwhile test "$#" -gt 0
41717a48c7cSmrgdo
41817a48c7cSmrg  arg="$1"
41917a48c7cSmrg  shift
42017a48c7cSmrg
42117a48c7cSmrg  case $arg in
42217a48c7cSmrg  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
42317a48c7cSmrg  *) optarg= ;;
42417a48c7cSmrg  esac
42517a48c7cSmrg
42617a48c7cSmrg  # If the previous option needs an argument, assign it.
42717a48c7cSmrg  if test -n "$prev"; then
42817a48c7cSmrg    case $prev in
42917a48c7cSmrg    execute_dlfiles)
43017a48c7cSmrg      execute_dlfiles="$execute_dlfiles $arg"
43117a48c7cSmrg      ;;
43217a48c7cSmrg    tag)
43317a48c7cSmrg      tagname="$arg"
43417a48c7cSmrg      preserve_args="${preserve_args}=$arg"
43517a48c7cSmrg
43617a48c7cSmrg      # Check whether tagname contains only valid characters
43717a48c7cSmrg      case $tagname in
43817a48c7cSmrg      *[!-_A-Za-z0-9,/]*)
43917a48c7cSmrg	$echo "$progname: invalid tag name: $tagname" 1>&2
44017a48c7cSmrg	exit $EXIT_FAILURE
44117a48c7cSmrg	;;
44217a48c7cSmrg      esac
44317a48c7cSmrg
44417a48c7cSmrg      case $tagname in
44517a48c7cSmrg      CC)
44617a48c7cSmrg	# Don't test for the "default" C tag, as we know, it's there, but
44717a48c7cSmrg	# not specially marked.
44817a48c7cSmrg	;;
44917a48c7cSmrg      *)
45017a48c7cSmrg	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
45117a48c7cSmrg	  taglist="$taglist $tagname"
45217a48c7cSmrg	  # Evaluate the configuration.
45317a48c7cSmrg	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
45417a48c7cSmrg	else
45517a48c7cSmrg	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
45617a48c7cSmrg	fi
45717a48c7cSmrg	;;
45817a48c7cSmrg      esac
45917a48c7cSmrg      ;;
46017a48c7cSmrg    *)
46117a48c7cSmrg      eval "$prev=\$arg"
46217a48c7cSmrg      ;;
46317a48c7cSmrg    esac
46417a48c7cSmrg
46517a48c7cSmrg    prev=
46617a48c7cSmrg    prevopt=
46717a48c7cSmrg    continue
46817a48c7cSmrg  fi
46917a48c7cSmrg
47017a48c7cSmrg  # Have we seen a non-optional argument yet?
47117a48c7cSmrg  case $arg in
47217a48c7cSmrg  --help)
47317a48c7cSmrg    show_help=yes
47417a48c7cSmrg    ;;
47517a48c7cSmrg
47617a48c7cSmrg  --version)
47717a48c7cSmrg    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
47817a48c7cSmrg    $echo
47917a48c7cSmrg    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
48017a48c7cSmrg    $echo "This is free software; see the source for copying conditions.  There is NO"
48117a48c7cSmrg    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
48217a48c7cSmrg    exit $?
48317a48c7cSmrg    ;;
48417a48c7cSmrg
48517a48c7cSmrg  --config)
48617a48c7cSmrg    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
48717a48c7cSmrg    # Now print the configurations for the tags.
48817a48c7cSmrg    for tagname in $taglist; do
48917a48c7cSmrg      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
49017a48c7cSmrg    done
49117a48c7cSmrg    exit $?
49217a48c7cSmrg    ;;
49317a48c7cSmrg
49417a48c7cSmrg  --debug)
49517a48c7cSmrg    $echo "$progname: enabling shell trace mode"
49617a48c7cSmrg    set -x
49717a48c7cSmrg    preserve_args="$preserve_args $arg"
49817a48c7cSmrg    ;;
49917a48c7cSmrg
50017a48c7cSmrg  --dry-run | -n)
50117a48c7cSmrg    run=:
50217a48c7cSmrg    ;;
50317a48c7cSmrg
50417a48c7cSmrg  --features)
50517a48c7cSmrg    $echo "host: $host"
50617a48c7cSmrg    if test "$build_libtool_libs" = yes; then
50717a48c7cSmrg      $echo "enable shared libraries"
50817a48c7cSmrg    else
50917a48c7cSmrg      $echo "disable shared libraries"
51017a48c7cSmrg    fi
51117a48c7cSmrg    if test "$build_old_libs" = yes; then
51217a48c7cSmrg      $echo "enable static libraries"
51317a48c7cSmrg    else
51417a48c7cSmrg      $echo "disable static libraries"
51517a48c7cSmrg    fi
51617a48c7cSmrg    exit $?
51717a48c7cSmrg    ;;
51817a48c7cSmrg
51917a48c7cSmrg  --finish) mode="finish" ;;
52017a48c7cSmrg
52117a48c7cSmrg  --mode) prevopt="--mode" prev=mode ;;
52217a48c7cSmrg  --mode=*) mode="$optarg" ;;
52317a48c7cSmrg
52417a48c7cSmrg  --preserve-dup-deps) duplicate_deps="yes" ;;
52517a48c7cSmrg
52617a48c7cSmrg  --quiet | --silent)
52717a48c7cSmrg    show=:
52817a48c7cSmrg    preserve_args="$preserve_args $arg"
52917a48c7cSmrg    ;;
53017a48c7cSmrg
53117a48c7cSmrg  --tag)
53217a48c7cSmrg    prevopt="--tag"
53317a48c7cSmrg    prev=tag
53417a48c7cSmrg    preserve_args="$preserve_args --tag"
53517a48c7cSmrg    ;;
53617a48c7cSmrg  --tag=*)
53717a48c7cSmrg    set tag "$optarg" ${1+"$@"}
53817a48c7cSmrg    shift
53917a48c7cSmrg    prev=tag
54017a48c7cSmrg    preserve_args="$preserve_args --tag"
54117a48c7cSmrg    ;;
54217a48c7cSmrg
54317a48c7cSmrg  -dlopen)
54417a48c7cSmrg    prevopt="-dlopen"
54517a48c7cSmrg    prev=execute_dlfiles
54617a48c7cSmrg    ;;
54717a48c7cSmrg
54817a48c7cSmrg  -*)
54917a48c7cSmrg    $echo "$modename: unrecognized option \`$arg'" 1>&2
55017a48c7cSmrg    $echo "$help" 1>&2
55117a48c7cSmrg    exit $EXIT_FAILURE
55217a48c7cSmrg    ;;
55317a48c7cSmrg
55417a48c7cSmrg  *)
55517a48c7cSmrg    nonopt="$arg"
55617a48c7cSmrg    break
55717a48c7cSmrg    ;;
55817a48c7cSmrg  esac
55917a48c7cSmrgdone
56017a48c7cSmrg
56117a48c7cSmrgif test -n "$prevopt"; then
56217a48c7cSmrg  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
56317a48c7cSmrg  $echo "$help" 1>&2
56417a48c7cSmrg  exit $EXIT_FAILURE
56517a48c7cSmrgfi
56617a48c7cSmrg
56717a48c7cSmrgcase $disable_libs in
56817a48c7cSmrgno) 
56917a48c7cSmrg  ;;
57017a48c7cSmrgshared)
57117a48c7cSmrg  build_libtool_libs=no
57217a48c7cSmrg  build_old_libs=yes
57317a48c7cSmrg  ;;
57417a48c7cSmrgstatic)
57517a48c7cSmrg  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
57617a48c7cSmrg  ;;
57717a48c7cSmrgesac
57817a48c7cSmrg
57917a48c7cSmrg# If this variable is set in any of the actions, the command in it
58017a48c7cSmrg# will be execed at the end.  This prevents here-documents from being
58117a48c7cSmrg# left over by shells.
58217a48c7cSmrgexec_cmd=
58317a48c7cSmrg
58417a48c7cSmrgif test -z "$show_help"; then
58517a48c7cSmrg
58617a48c7cSmrg  # Infer the operation mode.
58717a48c7cSmrg  if test -z "$mode"; then
58817a48c7cSmrg    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
58917a48c7cSmrg    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
59017a48c7cSmrg    case $nonopt in
59117a48c7cSmrg    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
59217a48c7cSmrg      mode=link
59317a48c7cSmrg      for arg
59417a48c7cSmrg      do
59517a48c7cSmrg	case $arg in
59617a48c7cSmrg	-c)
59717a48c7cSmrg	   mode=compile
59817a48c7cSmrg	   break
59917a48c7cSmrg	   ;;
60017a48c7cSmrg	esac
60117a48c7cSmrg      done
60217a48c7cSmrg      ;;
60317a48c7cSmrg    *db | *dbx | *strace | *truss)
60417a48c7cSmrg      mode=execute
60517a48c7cSmrg      ;;
60617a48c7cSmrg    *install*|cp|mv)
60717a48c7cSmrg      mode=install
60817a48c7cSmrg      ;;
60917a48c7cSmrg    *rm)
61017a48c7cSmrg      mode=uninstall
61117a48c7cSmrg      ;;
61217a48c7cSmrg    *)
61317a48c7cSmrg      # If we have no mode, but dlfiles were specified, then do execute mode.
61417a48c7cSmrg      test -n "$execute_dlfiles" && mode=execute
61517a48c7cSmrg
61617a48c7cSmrg      # Just use the default operation mode.
61717a48c7cSmrg      if test -z "$mode"; then
61817a48c7cSmrg	if test -n "$nonopt"; then
61917a48c7cSmrg	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
62017a48c7cSmrg	else
62117a48c7cSmrg	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
62217a48c7cSmrg	fi
62317a48c7cSmrg      fi
62417a48c7cSmrg      ;;
62517a48c7cSmrg    esac
62617a48c7cSmrg  fi
62717a48c7cSmrg
62817a48c7cSmrg  # Only execute mode is allowed to have -dlopen flags.
62917a48c7cSmrg  if test -n "$execute_dlfiles" && test "$mode" != execute; then
63017a48c7cSmrg    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
63117a48c7cSmrg    $echo "$help" 1>&2
63217a48c7cSmrg    exit $EXIT_FAILURE
63317a48c7cSmrg  fi
63417a48c7cSmrg
63517a48c7cSmrg  # Change the help message to a mode-specific one.
63617a48c7cSmrg  generic_help="$help"
63717a48c7cSmrg  help="Try \`$modename --help --mode=$mode' for more information."
63817a48c7cSmrg
63917a48c7cSmrg  # These modes are in order of execution frequency so that they run quickly.
64017a48c7cSmrg  case $mode in
64117a48c7cSmrg  # libtool compile mode
64217a48c7cSmrg  compile)
64317a48c7cSmrg    modename="$modename: compile"
64417a48c7cSmrg    # Get the compilation command and the source file.
64517a48c7cSmrg    base_compile=
64617a48c7cSmrg    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
64717a48c7cSmrg    suppress_opt=yes
64817a48c7cSmrg    suppress_output=
64917a48c7cSmrg    arg_mode=normal
65017a48c7cSmrg    libobj=
65117a48c7cSmrg    later=
65217a48c7cSmrg
65317a48c7cSmrg    for arg
65417a48c7cSmrg    do
65517a48c7cSmrg      case $arg_mode in
65617a48c7cSmrg      arg  )
65717a48c7cSmrg	# do not "continue".  Instead, add this to base_compile
65817a48c7cSmrg	lastarg="$arg"
65917a48c7cSmrg	arg_mode=normal
66017a48c7cSmrg	;;
66117a48c7cSmrg
66217a48c7cSmrg      target )
66317a48c7cSmrg	libobj="$arg"
66417a48c7cSmrg	arg_mode=normal
66517a48c7cSmrg	continue
66617a48c7cSmrg	;;
66717a48c7cSmrg
66817a48c7cSmrg      normal )
66917a48c7cSmrg	# Accept any command-line options.
67017a48c7cSmrg	case $arg in
67117a48c7cSmrg	-o)
67217a48c7cSmrg	  if test -n "$libobj" ; then
67317a48c7cSmrg	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
67417a48c7cSmrg	    exit $EXIT_FAILURE
67517a48c7cSmrg	  fi
67617a48c7cSmrg	  arg_mode=target
67717a48c7cSmrg	  continue
67817a48c7cSmrg	  ;;
67917a48c7cSmrg
68017a48c7cSmrg	-static | -prefer-pic | -prefer-non-pic)
68117a48c7cSmrg	  later="$later $arg"
68217a48c7cSmrg	  continue
68317a48c7cSmrg	  ;;
68417a48c7cSmrg
68517a48c7cSmrg	-no-suppress)
68617a48c7cSmrg	  suppress_opt=no
68717a48c7cSmrg	  continue
68817a48c7cSmrg	  ;;
68917a48c7cSmrg
69017a48c7cSmrg	-Xcompiler)
69117a48c7cSmrg	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
69217a48c7cSmrg	  continue      #  The current "srcfile" will either be retained or
69317a48c7cSmrg	  ;;            #  replaced later.  I would guess that would be a bug.
69417a48c7cSmrg
69517a48c7cSmrg	-Wc,*)
69617a48c7cSmrg	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
69717a48c7cSmrg	  lastarg=
69817a48c7cSmrg	  save_ifs="$IFS"; IFS=','
69917a48c7cSmrg 	  for arg in $args; do
70017a48c7cSmrg	    IFS="$save_ifs"
70117a48c7cSmrg
70217a48c7cSmrg	    # Double-quote args containing other shell metacharacters.
70317a48c7cSmrg	    # Many Bourne shells cannot handle close brackets correctly
70417a48c7cSmrg	    # in scan sets, so we specify it separately.
70517a48c7cSmrg	    case $arg in
70617a48c7cSmrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
70717a48c7cSmrg	      arg="\"$arg\""
70817a48c7cSmrg	      ;;
70917a48c7cSmrg	    esac
71017a48c7cSmrg	    lastarg="$lastarg $arg"
71117a48c7cSmrg	  done
71217a48c7cSmrg	  IFS="$save_ifs"
71317a48c7cSmrg	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
71417a48c7cSmrg
71517a48c7cSmrg	  # Add the arguments to base_compile.
71617a48c7cSmrg	  base_compile="$base_compile $lastarg"
71717a48c7cSmrg	  continue
71817a48c7cSmrg	  ;;
71917a48c7cSmrg
72017a48c7cSmrg	* )
72117a48c7cSmrg	  # Accept the current argument as the source file.
72217a48c7cSmrg	  # The previous "srcfile" becomes the current argument.
72317a48c7cSmrg	  #
72417a48c7cSmrg	  lastarg="$srcfile"
72517a48c7cSmrg	  srcfile="$arg"
72617a48c7cSmrg	  ;;
72717a48c7cSmrg	esac  #  case $arg
72817a48c7cSmrg	;;
72917a48c7cSmrg      esac    #  case $arg_mode
73017a48c7cSmrg
73117a48c7cSmrg      # Aesthetically quote the previous argument.
73217a48c7cSmrg      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
73317a48c7cSmrg
73417a48c7cSmrg      case $lastarg in
73517a48c7cSmrg      # Double-quote args containing other shell metacharacters.
73617a48c7cSmrg      # Many Bourne shells cannot handle close brackets correctly
73717a48c7cSmrg      # in scan sets, and some SunOS ksh mistreat backslash-escaping
73817a48c7cSmrg      # in scan sets (worked around with variable expansion),
73917a48c7cSmrg      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
74017a48c7cSmrg      # at all, so we specify them separately.
74117a48c7cSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
74217a48c7cSmrg	lastarg="\"$lastarg\""
74317a48c7cSmrg	;;
74417a48c7cSmrg      esac
74517a48c7cSmrg
74617a48c7cSmrg      base_compile="$base_compile $lastarg"
74717a48c7cSmrg    done # for arg
74817a48c7cSmrg
74917a48c7cSmrg    case $arg_mode in
75017a48c7cSmrg    arg)
75117a48c7cSmrg      $echo "$modename: you must specify an argument for -Xcompile"
75217a48c7cSmrg      exit $EXIT_FAILURE
75317a48c7cSmrg      ;;
75417a48c7cSmrg    target)
75517a48c7cSmrg      $echo "$modename: you must specify a target with \`-o'" 1>&2
75617a48c7cSmrg      exit $EXIT_FAILURE
75717a48c7cSmrg      ;;
75817a48c7cSmrg    *)
75917a48c7cSmrg      # Get the name of the library object.
76017a48c7cSmrg      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
76117a48c7cSmrg      ;;
76217a48c7cSmrg    esac
76317a48c7cSmrg
76417a48c7cSmrg    # Recognize several different file suffixes.
76517a48c7cSmrg    # If the user specifies -o file.o, it is replaced with file.lo
76617a48c7cSmrg    xform='[cCFSifmso]'
76717a48c7cSmrg    case $libobj in
76817a48c7cSmrg    *.ada) xform=ada ;;
76917a48c7cSmrg    *.adb) xform=adb ;;
77017a48c7cSmrg    *.ads) xform=ads ;;
77117a48c7cSmrg    *.asm) xform=asm ;;
77217a48c7cSmrg    *.c++) xform=c++ ;;
77317a48c7cSmrg    *.cc) xform=cc ;;
77417a48c7cSmrg    *.ii) xform=ii ;;
77517a48c7cSmrg    *.class) xform=class ;;
77617a48c7cSmrg    *.cpp) xform=cpp ;;
77717a48c7cSmrg    *.cxx) xform=cxx ;;
77817a48c7cSmrg    *.f90) xform=f90 ;;
77917a48c7cSmrg    *.for) xform=for ;;
78017a48c7cSmrg    *.java) xform=java ;;
7818e0ed500Smrg    *.obj) xform=obj ;;
78217a48c7cSmrg    esac
78317a48c7cSmrg
78417a48c7cSmrg    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
78517a48c7cSmrg
78617a48c7cSmrg    case $libobj in
78717a48c7cSmrg    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
78817a48c7cSmrg    *)
78917a48c7cSmrg      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
79017a48c7cSmrg      exit $EXIT_FAILURE
79117a48c7cSmrg      ;;
79217a48c7cSmrg    esac
79317a48c7cSmrg
79417a48c7cSmrg    func_infer_tag $base_compile
79517a48c7cSmrg
79617a48c7cSmrg    for arg in $later; do
79717a48c7cSmrg      case $arg in
79817a48c7cSmrg      -static)
79917a48c7cSmrg	build_old_libs=yes
80017a48c7cSmrg	continue
80117a48c7cSmrg	;;
80217a48c7cSmrg
80317a48c7cSmrg      -prefer-pic)
80417a48c7cSmrg	pic_mode=yes
80517a48c7cSmrg	continue
80617a48c7cSmrg	;;
80717a48c7cSmrg
80817a48c7cSmrg      -prefer-non-pic)
80917a48c7cSmrg	pic_mode=no
81017a48c7cSmrg	continue
81117a48c7cSmrg	;;
81217a48c7cSmrg      esac
81317a48c7cSmrg    done
81417a48c7cSmrg
81517a48c7cSmrg    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
81617a48c7cSmrg    case $qlibobj in
81717a48c7cSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
81817a48c7cSmrg	qlibobj="\"$qlibobj\"" ;;
81917a48c7cSmrg    esac
82017a48c7cSmrg    test "X$libobj" != "X$qlibobj" \
82117a48c7cSmrg	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
82217a48c7cSmrg	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
82317a48c7cSmrg    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
82417a48c7cSmrg    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
82517a48c7cSmrg    if test "X$xdir" = "X$obj"; then
82617a48c7cSmrg      xdir=
82717a48c7cSmrg    else
82817a48c7cSmrg      xdir=$xdir/
82917a48c7cSmrg    fi
83017a48c7cSmrg    lobj=${xdir}$objdir/$objname
83117a48c7cSmrg
83217a48c7cSmrg    if test -z "$base_compile"; then
83317a48c7cSmrg      $echo "$modename: you must specify a compilation command" 1>&2
83417a48c7cSmrg      $echo "$help" 1>&2
83517a48c7cSmrg      exit $EXIT_FAILURE
83617a48c7cSmrg    fi
83717a48c7cSmrg
83817a48c7cSmrg    # Delete any leftover library objects.
83917a48c7cSmrg    if test "$build_old_libs" = yes; then
84017a48c7cSmrg      removelist="$obj $lobj $libobj ${libobj}T"
84117a48c7cSmrg    else
84217a48c7cSmrg      removelist="$lobj $libobj ${libobj}T"
84317a48c7cSmrg    fi
84417a48c7cSmrg
84517a48c7cSmrg    $run $rm $removelist
84617a48c7cSmrg    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
84717a48c7cSmrg
84817a48c7cSmrg    # On Cygwin there's no "real" PIC flag so we must build both object types
84917a48c7cSmrg    case $host_os in
85017a48c7cSmrg    cygwin* | mingw* | pw32* | os2*)
85117a48c7cSmrg      pic_mode=default
85217a48c7cSmrg      ;;
85317a48c7cSmrg    esac
85417a48c7cSmrg    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
85517a48c7cSmrg      # non-PIC code in shared libraries is not supported
85617a48c7cSmrg      pic_mode=default
85717a48c7cSmrg    fi
85817a48c7cSmrg
85917a48c7cSmrg    # Calculate the filename of the output object if compiler does
86017a48c7cSmrg    # not support -o with -c
86117a48c7cSmrg    if test "$compiler_c_o" = no; then
86217a48c7cSmrg      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
86317a48c7cSmrg      lockfile="$output_obj.lock"
86417a48c7cSmrg      removelist="$removelist $output_obj $lockfile"
86517a48c7cSmrg      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
86617a48c7cSmrg    else
86717a48c7cSmrg      output_obj=
86817a48c7cSmrg      need_locks=no
86917a48c7cSmrg      lockfile=
87017a48c7cSmrg    fi
87117a48c7cSmrg
87217a48c7cSmrg    # Lock this critical section if it is needed
87317a48c7cSmrg    # We use this script file to make the link, it avoids creating a new file
87417a48c7cSmrg    if test "$need_locks" = yes; then
87517a48c7cSmrg      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
87617a48c7cSmrg	$show "Waiting for $lockfile to be removed"
87717a48c7cSmrg	sleep 2
87817a48c7cSmrg      done
87917a48c7cSmrg    elif test "$need_locks" = warn; then
88017a48c7cSmrg      if test -f "$lockfile"; then
88117a48c7cSmrg	$echo "\
88217a48c7cSmrg*** ERROR, $lockfile exists and contains:
88317a48c7cSmrg`cat $lockfile 2>/dev/null`
88417a48c7cSmrg
88517a48c7cSmrgThis indicates that another process is trying to use the same
88617a48c7cSmrgtemporary object file, and libtool could not work around it because
88717a48c7cSmrgyour compiler does not support \`-c' and \`-o' together.  If you
88817a48c7cSmrgrepeat this compilation, it may succeed, by chance, but you had better
88917a48c7cSmrgavoid parallel builds (make -j) in this platform, or get a better
89017a48c7cSmrgcompiler."
89117a48c7cSmrg
89217a48c7cSmrg	$run $rm $removelist
89317a48c7cSmrg	exit $EXIT_FAILURE
89417a48c7cSmrg      fi
89517a48c7cSmrg      $echo "$srcfile" > "$lockfile"
89617a48c7cSmrg    fi
89717a48c7cSmrg
89817a48c7cSmrg    if test -n "$fix_srcfile_path"; then
89917a48c7cSmrg      eval srcfile=\"$fix_srcfile_path\"
90017a48c7cSmrg    fi
90117a48c7cSmrg    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
90217a48c7cSmrg    case $qsrcfile in
90317a48c7cSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
90417a48c7cSmrg      qsrcfile="\"$qsrcfile\"" ;;
90517a48c7cSmrg    esac
90617a48c7cSmrg
90717a48c7cSmrg    $run $rm "$libobj" "${libobj}T"
90817a48c7cSmrg
90917a48c7cSmrg    # Create a libtool object file (analogous to a ".la" file),
91017a48c7cSmrg    # but don't create it if we're doing a dry run.
91117a48c7cSmrg    test -z "$run" && cat > ${libobj}T <<EOF
91217a48c7cSmrg# $libobj - a libtool object file
91317a48c7cSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
91417a48c7cSmrg#
91517a48c7cSmrg# Please DO NOT delete this file!
91617a48c7cSmrg# It is necessary for linking the library.
91717a48c7cSmrg
91817a48c7cSmrg# Name of the PIC object.
91917a48c7cSmrgEOF
92017a48c7cSmrg
92117a48c7cSmrg    # Only build a PIC object if we are building libtool libraries.
92217a48c7cSmrg    if test "$build_libtool_libs" = yes; then
92317a48c7cSmrg      # Without this assignment, base_compile gets emptied.
92417a48c7cSmrg      fbsd_hideous_sh_bug=$base_compile
92517a48c7cSmrg
92617a48c7cSmrg      if test "$pic_mode" != no; then
92717a48c7cSmrg	command="$base_compile $qsrcfile $pic_flag"
92817a48c7cSmrg      else
92917a48c7cSmrg	# Don't build PIC code
93017a48c7cSmrg	command="$base_compile $qsrcfile"
93117a48c7cSmrg      fi
93217a48c7cSmrg
93317a48c7cSmrg      if test ! -d "${xdir}$objdir"; then
93417a48c7cSmrg	$show "$mkdir ${xdir}$objdir"
93517a48c7cSmrg	$run $mkdir ${xdir}$objdir
93617a48c7cSmrg	exit_status=$?
93717a48c7cSmrg	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
93817a48c7cSmrg	  exit $exit_status
93917a48c7cSmrg	fi
94017a48c7cSmrg      fi
94117a48c7cSmrg
94217a48c7cSmrg      if test -z "$output_obj"; then
94317a48c7cSmrg	# Place PIC objects in $objdir
94417a48c7cSmrg	command="$command -o $lobj"
94517a48c7cSmrg      fi
94617a48c7cSmrg
94717a48c7cSmrg      $run $rm "$lobj" "$output_obj"
94817a48c7cSmrg
94917a48c7cSmrg      $show "$command"
95017a48c7cSmrg      if $run eval "$command"; then :
95117a48c7cSmrg      else
95217a48c7cSmrg	test -n "$output_obj" && $run $rm $removelist
95317a48c7cSmrg	exit $EXIT_FAILURE
95417a48c7cSmrg      fi
95517a48c7cSmrg
95617a48c7cSmrg      if test "$need_locks" = warn &&
95717a48c7cSmrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
95817a48c7cSmrg	$echo "\
95917a48c7cSmrg*** ERROR, $lockfile contains:
96017a48c7cSmrg`cat $lockfile 2>/dev/null`
96117a48c7cSmrg
96217a48c7cSmrgbut it should contain:
96317a48c7cSmrg$srcfile
96417a48c7cSmrg
96517a48c7cSmrgThis indicates that another process is trying to use the same
96617a48c7cSmrgtemporary object file, and libtool could not work around it because
96717a48c7cSmrgyour compiler does not support \`-c' and \`-o' together.  If you
96817a48c7cSmrgrepeat this compilation, it may succeed, by chance, but you had better
96917a48c7cSmrgavoid parallel builds (make -j) in this platform, or get a better
97017a48c7cSmrgcompiler."
97117a48c7cSmrg
97217a48c7cSmrg	$run $rm $removelist
97317a48c7cSmrg	exit $EXIT_FAILURE
97417a48c7cSmrg      fi
97517a48c7cSmrg
97617a48c7cSmrg      # Just move the object if needed, then go on to compile the next one
97717a48c7cSmrg      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
97817a48c7cSmrg	$show "$mv $output_obj $lobj"
97917a48c7cSmrg	if $run $mv $output_obj $lobj; then :
98017a48c7cSmrg	else
98117a48c7cSmrg	  error=$?
98217a48c7cSmrg	  $run $rm $removelist
98317a48c7cSmrg	  exit $error
98417a48c7cSmrg	fi
98517a48c7cSmrg      fi
98617a48c7cSmrg
98717a48c7cSmrg      # Append the name of the PIC object to the libtool object file.
98817a48c7cSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
98917a48c7cSmrgpic_object='$objdir/$objname'
99017a48c7cSmrg
99117a48c7cSmrgEOF
99217a48c7cSmrg
99317a48c7cSmrg      # Allow error messages only from the first compilation.
99417a48c7cSmrg      if test "$suppress_opt" = yes; then
99517a48c7cSmrg        suppress_output=' >/dev/null 2>&1'
99617a48c7cSmrg      fi
99717a48c7cSmrg    else
99817a48c7cSmrg      # No PIC object so indicate it doesn't exist in the libtool
99917a48c7cSmrg      # object file.
100017a48c7cSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
100117a48c7cSmrgpic_object=none
100217a48c7cSmrg
100317a48c7cSmrgEOF
100417a48c7cSmrg    fi
100517a48c7cSmrg
100617a48c7cSmrg    # Only build a position-dependent object if we build old libraries.
100717a48c7cSmrg    if test "$build_old_libs" = yes; then
100817a48c7cSmrg      if test "$pic_mode" != yes; then
100917a48c7cSmrg	# Don't build PIC code
101017a48c7cSmrg	command="$base_compile $qsrcfile"
101117a48c7cSmrg      else
101217a48c7cSmrg	command="$base_compile $qsrcfile $pic_flag"
101317a48c7cSmrg      fi
101417a48c7cSmrg      if test "$compiler_c_o" = yes; then
101517a48c7cSmrg	command="$command -o $obj"
101617a48c7cSmrg      fi
101717a48c7cSmrg
101817a48c7cSmrg      # Suppress compiler output if we already did a PIC compilation.
101917a48c7cSmrg      command="$command$suppress_output"
102017a48c7cSmrg      $run $rm "$obj" "$output_obj"
102117a48c7cSmrg      $show "$command"
102217a48c7cSmrg      if $run eval "$command"; then :
102317a48c7cSmrg      else
102417a48c7cSmrg	$run $rm $removelist
102517a48c7cSmrg	exit $EXIT_FAILURE
102617a48c7cSmrg      fi
102717a48c7cSmrg
102817a48c7cSmrg      if test "$need_locks" = warn &&
102917a48c7cSmrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
103017a48c7cSmrg	$echo "\
103117a48c7cSmrg*** ERROR, $lockfile contains:
103217a48c7cSmrg`cat $lockfile 2>/dev/null`
103317a48c7cSmrg
103417a48c7cSmrgbut it should contain:
103517a48c7cSmrg$srcfile
103617a48c7cSmrg
103717a48c7cSmrgThis indicates that another process is trying to use the same
103817a48c7cSmrgtemporary object file, and libtool could not work around it because
103917a48c7cSmrgyour compiler does not support \`-c' and \`-o' together.  If you
104017a48c7cSmrgrepeat this compilation, it may succeed, by chance, but you had better
104117a48c7cSmrgavoid parallel builds (make -j) in this platform, or get a better
104217a48c7cSmrgcompiler."
104317a48c7cSmrg
104417a48c7cSmrg	$run $rm $removelist
104517a48c7cSmrg	exit $EXIT_FAILURE
104617a48c7cSmrg      fi
104717a48c7cSmrg
104817a48c7cSmrg      # Just move the object if needed
104917a48c7cSmrg      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
105017a48c7cSmrg	$show "$mv $output_obj $obj"
105117a48c7cSmrg	if $run $mv $output_obj $obj; then :
105217a48c7cSmrg	else
105317a48c7cSmrg	  error=$?
105417a48c7cSmrg	  $run $rm $removelist
105517a48c7cSmrg	  exit $error
105617a48c7cSmrg	fi
105717a48c7cSmrg      fi
105817a48c7cSmrg
105917a48c7cSmrg      # Append the name of the non-PIC object the libtool object file.
106017a48c7cSmrg      # Only append if the libtool object file exists.
106117a48c7cSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
106217a48c7cSmrg# Name of the non-PIC object.
106317a48c7cSmrgnon_pic_object='$objname'
106417a48c7cSmrg
106517a48c7cSmrgEOF
106617a48c7cSmrg    else
106717a48c7cSmrg      # Append the name of the non-PIC object the libtool object file.
106817a48c7cSmrg      # Only append if the libtool object file exists.
106917a48c7cSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
107017a48c7cSmrg# Name of the non-PIC object.
107117a48c7cSmrgnon_pic_object=none
107217a48c7cSmrg
107317a48c7cSmrgEOF
107417a48c7cSmrg    fi
107517a48c7cSmrg
107617a48c7cSmrg    $run $mv "${libobj}T" "${libobj}"
107717a48c7cSmrg
107817a48c7cSmrg    # Unlock the critical section if it was locked
107917a48c7cSmrg    if test "$need_locks" != no; then
108017a48c7cSmrg      $run $rm "$lockfile"
108117a48c7cSmrg    fi
108217a48c7cSmrg
108317a48c7cSmrg    exit $EXIT_SUCCESS
108417a48c7cSmrg    ;;
108517a48c7cSmrg
108617a48c7cSmrg  # libtool link mode
108717a48c7cSmrg  link | relink)
108817a48c7cSmrg    modename="$modename: link"
108917a48c7cSmrg    case $host in
109017a48c7cSmrg    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
109117a48c7cSmrg      # It is impossible to link a dll without this setting, and
109217a48c7cSmrg      # we shouldn't force the makefile maintainer to figure out
109317a48c7cSmrg      # which system we are compiling for in order to pass an extra
109417a48c7cSmrg      # flag for every libtool invocation.
109517a48c7cSmrg      # allow_undefined=no
109617a48c7cSmrg
109717a48c7cSmrg      # FIXME: Unfortunately, there are problems with the above when trying
109817a48c7cSmrg      # to make a dll which has undefined symbols, in which case not
109917a48c7cSmrg      # even a static library is built.  For now, we need to specify
110017a48c7cSmrg      # -no-undefined on the libtool link line when we can be certain
110117a48c7cSmrg      # that all symbols are satisfied, otherwise we get a static library.
110217a48c7cSmrg      allow_undefined=yes
110317a48c7cSmrg      ;;
110417a48c7cSmrg    *)
110517a48c7cSmrg      allow_undefined=yes
110617a48c7cSmrg      ;;
110717a48c7cSmrg    esac
110817a48c7cSmrg    libtool_args="$nonopt"
110917a48c7cSmrg    base_compile="$nonopt $@"
111017a48c7cSmrg    compile_command="$nonopt"
111117a48c7cSmrg    finalize_command="$nonopt"
111217a48c7cSmrg
111317a48c7cSmrg    compile_rpath=
111417a48c7cSmrg    finalize_rpath=
111517a48c7cSmrg    compile_shlibpath=
111617a48c7cSmrg    finalize_shlibpath=
111717a48c7cSmrg    convenience=
111817a48c7cSmrg    old_convenience=
111917a48c7cSmrg    deplibs=
112017a48c7cSmrg    old_deplibs=
112117a48c7cSmrg    compiler_flags=
112217a48c7cSmrg    linker_flags=
112317a48c7cSmrg    dllsearchpath=
112417a48c7cSmrg    lib_search_path=`pwd`
112517a48c7cSmrg    inst_prefix_dir=
112617a48c7cSmrg
112717a48c7cSmrg    avoid_version=no
112817a48c7cSmrg    dlfiles=
112917a48c7cSmrg    dlprefiles=
113017a48c7cSmrg    dlself=no
113117a48c7cSmrg    export_dynamic=no
113217a48c7cSmrg    export_symbols=
113317a48c7cSmrg    export_symbols_regex=
113417a48c7cSmrg    generated=
113517a48c7cSmrg    libobjs=
113617a48c7cSmrg    ltlibs=
113717a48c7cSmrg    module=no
113817a48c7cSmrg    no_install=no
113917a48c7cSmrg    objs=
114017a48c7cSmrg    non_pic_objects=
114117a48c7cSmrg    notinst_path= # paths that contain not-installed libtool libraries
114217a48c7cSmrg    precious_files_regex=
114317a48c7cSmrg    prefer_static_libs=no
114417a48c7cSmrg    preload=no
114517a48c7cSmrg    prev=
114617a48c7cSmrg    prevarg=
114717a48c7cSmrg    release=
114817a48c7cSmrg    rpath=
114917a48c7cSmrg    xrpath=
115017a48c7cSmrg    perm_rpath=
115117a48c7cSmrg    temp_rpath=
115217a48c7cSmrg    thread_safe=no
115317a48c7cSmrg    vinfo=
115417a48c7cSmrg    vinfo_number=no
115517a48c7cSmrg
115617a48c7cSmrg    func_infer_tag $base_compile
115717a48c7cSmrg
115817a48c7cSmrg    # We need to know -static, to get the right output filenames.
115917a48c7cSmrg    for arg
116017a48c7cSmrg    do
116117a48c7cSmrg      case $arg in
11628e0ed500Smrg      -all-static | -static | -static-libtool-libs)
11638e0ed500Smrg    case $arg in
11648e0ed500Smrg    -all-static)
116517a48c7cSmrg	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
116617a48c7cSmrg	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
116717a48c7cSmrg	  fi
116817a48c7cSmrg	  if test -n "$link_static_flag"; then
116917a48c7cSmrg	    dlopen_self=$dlopen_self_static
117017a48c7cSmrg	  fi
117117a48c7cSmrg	  prefer_static_libs=yes
11728e0ed500Smrg	  ;;
11738e0ed500Smrg    -static)
117417a48c7cSmrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
117517a48c7cSmrg	    dlopen_self=$dlopen_self_static
117617a48c7cSmrg	  fi
117717a48c7cSmrg	  prefer_static_libs=built
11788e0ed500Smrg	  ;;
11798e0ed500Smrg    -static-libtool-libs)
11808e0ed500Smrg      if test -z "$pic_flag" && test -n "$link_static_flag"; then
11818e0ed500Smrg        dlopen_self=$dlopen_self_static
11828e0ed500Smrg      fi
11838e0ed500Smrg      prefer_static_libs=yes
11848e0ed500Smrg      ;;
11858e0ed500Smrg    esac
118617a48c7cSmrg	build_libtool_libs=no
118717a48c7cSmrg	build_old_libs=yes
118817a48c7cSmrg	break
118917a48c7cSmrg	;;
119017a48c7cSmrg      esac
119117a48c7cSmrg    done
119217a48c7cSmrg
119317a48c7cSmrg    # See if our shared archives depend on static archives.
119417a48c7cSmrg    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
119517a48c7cSmrg
119617a48c7cSmrg    # Go through the arguments, transforming them on the way.
119717a48c7cSmrg    while test "$#" -gt 0; do
119817a48c7cSmrg      arg="$1"
119917a48c7cSmrg      shift
120017a48c7cSmrg      case $arg in
120117a48c7cSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
120217a48c7cSmrg	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
120317a48c7cSmrg	;;
120417a48c7cSmrg      *) qarg=$arg ;;
120517a48c7cSmrg      esac
120617a48c7cSmrg      libtool_args="$libtool_args $qarg"
120717a48c7cSmrg
120817a48c7cSmrg      # If the previous option needs an argument, assign it.
120917a48c7cSmrg      if test -n "$prev"; then
121017a48c7cSmrg	case $prev in
121117a48c7cSmrg	output)
121217a48c7cSmrg	  compile_command="$compile_command @OUTPUT@"
121317a48c7cSmrg	  finalize_command="$finalize_command @OUTPUT@"
121417a48c7cSmrg	  ;;
121517a48c7cSmrg	esac
121617a48c7cSmrg
121717a48c7cSmrg	case $prev in
121817a48c7cSmrg	dlfiles|dlprefiles)
121917a48c7cSmrg	  if test "$preload" = no; then
122017a48c7cSmrg	    # Add the symbol object into the linking commands.
122117a48c7cSmrg	    compile_command="$compile_command @SYMFILE@"
122217a48c7cSmrg	    finalize_command="$finalize_command @SYMFILE@"
122317a48c7cSmrg	    preload=yes
122417a48c7cSmrg	  fi
122517a48c7cSmrg	  case $arg in
122617a48c7cSmrg	  *.la | *.lo) ;;  # We handle these cases below.
122717a48c7cSmrg	  force)
122817a48c7cSmrg	    if test "$dlself" = no; then
122917a48c7cSmrg	      dlself=needless
123017a48c7cSmrg	      export_dynamic=yes
123117a48c7cSmrg	    fi
123217a48c7cSmrg	    prev=
123317a48c7cSmrg	    continue
123417a48c7cSmrg	    ;;
123517a48c7cSmrg	  self)
123617a48c7cSmrg	    if test "$prev" = dlprefiles; then
123717a48c7cSmrg	      dlself=yes
123817a48c7cSmrg	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
123917a48c7cSmrg	      dlself=yes
124017a48c7cSmrg	    else
124117a48c7cSmrg	      dlself=needless
124217a48c7cSmrg	      export_dynamic=yes
124317a48c7cSmrg	    fi
124417a48c7cSmrg	    prev=
124517a48c7cSmrg	    continue
124617a48c7cSmrg	    ;;
124717a48c7cSmrg	  *)
124817a48c7cSmrg	    if test "$prev" = dlfiles; then
124917a48c7cSmrg	      dlfiles="$dlfiles $arg"
125017a48c7cSmrg	    else
125117a48c7cSmrg	      dlprefiles="$dlprefiles $arg"
125217a48c7cSmrg	    fi
125317a48c7cSmrg	    prev=
125417a48c7cSmrg	    continue
125517a48c7cSmrg	    ;;
125617a48c7cSmrg	  esac
125717a48c7cSmrg	  ;;
125817a48c7cSmrg	expsyms)
125917a48c7cSmrg	  export_symbols="$arg"
126017a48c7cSmrg	  if test ! -f "$arg"; then
126117a48c7cSmrg	    $echo "$modename: symbol file \`$arg' does not exist"
126217a48c7cSmrg	    exit $EXIT_FAILURE
126317a48c7cSmrg	  fi
126417a48c7cSmrg	  prev=
126517a48c7cSmrg	  continue
126617a48c7cSmrg	  ;;
126717a48c7cSmrg	expsyms_regex)
126817a48c7cSmrg	  export_symbols_regex="$arg"
126917a48c7cSmrg	  prev=
127017a48c7cSmrg	  continue
127117a48c7cSmrg	  ;;
127217a48c7cSmrg	inst_prefix)
127317a48c7cSmrg	  inst_prefix_dir="$arg"
127417a48c7cSmrg	  prev=
127517a48c7cSmrg	  continue
127617a48c7cSmrg	  ;;
127717a48c7cSmrg	precious_regex)
127817a48c7cSmrg	  precious_files_regex="$arg"
127917a48c7cSmrg	  prev=
128017a48c7cSmrg	  continue
128117a48c7cSmrg	  ;;
128217a48c7cSmrg	release)
128317a48c7cSmrg	  release="-$arg"
128417a48c7cSmrg	  prev=
128517a48c7cSmrg	  continue
128617a48c7cSmrg	  ;;
128717a48c7cSmrg	objectlist)
128817a48c7cSmrg	  if test -f "$arg"; then
128917a48c7cSmrg	    save_arg=$arg
129017a48c7cSmrg	    moreargs=
129117a48c7cSmrg	    for fil in `cat $save_arg`
129217a48c7cSmrg	    do
129317a48c7cSmrg#	      moreargs="$moreargs $fil"
129417a48c7cSmrg	      arg=$fil
129517a48c7cSmrg	      # A libtool-controlled object.
129617a48c7cSmrg
129717a48c7cSmrg	      # Check to see that this really is a libtool object.
129817a48c7cSmrg	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
129917a48c7cSmrg		pic_object=
130017a48c7cSmrg		non_pic_object=
130117a48c7cSmrg
130217a48c7cSmrg		# Read the .lo file
130317a48c7cSmrg		# If there is no directory component, then add one.
130417a48c7cSmrg		case $arg in
130517a48c7cSmrg		*/* | *\\*) . $arg ;;
130617a48c7cSmrg		*) . ./$arg ;;
130717a48c7cSmrg		esac
130817a48c7cSmrg
130917a48c7cSmrg		if test -z "$pic_object" || \
131017a48c7cSmrg		   test -z "$non_pic_object" ||
131117a48c7cSmrg		   test "$pic_object" = none && \
131217a48c7cSmrg		   test "$non_pic_object" = none; then
131317a48c7cSmrg		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
131417a48c7cSmrg		  exit $EXIT_FAILURE
131517a48c7cSmrg		fi
131617a48c7cSmrg
131717a48c7cSmrg		# Extract subdirectory from the argument.
131817a48c7cSmrg		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
131917a48c7cSmrg		if test "X$xdir" = "X$arg"; then
132017a48c7cSmrg		  xdir=
132117a48c7cSmrg		else
132217a48c7cSmrg		  xdir="$xdir/"
132317a48c7cSmrg		fi
132417a48c7cSmrg
132517a48c7cSmrg		if test "$pic_object" != none; then
132617a48c7cSmrg		  # Prepend the subdirectory the object is found in.
132717a48c7cSmrg		  pic_object="$xdir$pic_object"
132817a48c7cSmrg
132917a48c7cSmrg		  if test "$prev" = dlfiles; then
133017a48c7cSmrg		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
133117a48c7cSmrg		      dlfiles="$dlfiles $pic_object"
133217a48c7cSmrg		      prev=
133317a48c7cSmrg		      continue
133417a48c7cSmrg		    else
133517a48c7cSmrg		      # If libtool objects are unsupported, then we need to preload.
133617a48c7cSmrg		      prev=dlprefiles
133717a48c7cSmrg		    fi
133817a48c7cSmrg		  fi
133917a48c7cSmrg
134017a48c7cSmrg		  # CHECK ME:  I think I busted this.  -Ossama
134117a48c7cSmrg		  if test "$prev" = dlprefiles; then
134217a48c7cSmrg		    # Preload the old-style object.
134317a48c7cSmrg		    dlprefiles="$dlprefiles $pic_object"
134417a48c7cSmrg		    prev=
134517a48c7cSmrg		  fi
134617a48c7cSmrg
134717a48c7cSmrg		  # A PIC object.
134817a48c7cSmrg		  libobjs="$libobjs $pic_object"
134917a48c7cSmrg		  arg="$pic_object"
135017a48c7cSmrg		fi
135117a48c7cSmrg
135217a48c7cSmrg		# Non-PIC object.
135317a48c7cSmrg		if test "$non_pic_object" != none; then
135417a48c7cSmrg		  # Prepend the subdirectory the object is found in.
135517a48c7cSmrg		  non_pic_object="$xdir$non_pic_object"
135617a48c7cSmrg
135717a48c7cSmrg		  # A standard non-PIC object
135817a48c7cSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
135917a48c7cSmrg		  if test -z "$pic_object" || test "$pic_object" = none ; then
136017a48c7cSmrg		    arg="$non_pic_object"
136117a48c7cSmrg		  fi
136217a48c7cSmrg		else
136317a48c7cSmrg		  # If the PIC object exists, use it instead.
136417a48c7cSmrg		  # $xdir was prepended to $pic_object above.
136517a48c7cSmrg		  non_pic_object="$pic_object"
136617a48c7cSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
136717a48c7cSmrg		fi
136817a48c7cSmrg	      else
136917a48c7cSmrg		# Only an error if not doing a dry-run.
137017a48c7cSmrg		if test -z "$run"; then
137117a48c7cSmrg		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
137217a48c7cSmrg		  exit $EXIT_FAILURE
137317a48c7cSmrg		else
137417a48c7cSmrg		  # Dry-run case.
137517a48c7cSmrg
137617a48c7cSmrg		  # Extract subdirectory from the argument.
137717a48c7cSmrg		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
137817a48c7cSmrg		  if test "X$xdir" = "X$arg"; then
137917a48c7cSmrg		    xdir=
138017a48c7cSmrg		  else
138117a48c7cSmrg		    xdir="$xdir/"
138217a48c7cSmrg		  fi
138317a48c7cSmrg
138417a48c7cSmrg		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
138517a48c7cSmrg		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
138617a48c7cSmrg		  libobjs="$libobjs $pic_object"
138717a48c7cSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
138817a48c7cSmrg		fi
138917a48c7cSmrg	      fi
139017a48c7cSmrg	    done
139117a48c7cSmrg	  else
139217a48c7cSmrg	    $echo "$modename: link input file \`$save_arg' does not exist"
139317a48c7cSmrg	    exit $EXIT_FAILURE
139417a48c7cSmrg	  fi
139517a48c7cSmrg	  arg=$save_arg
139617a48c7cSmrg	  prev=
139717a48c7cSmrg	  continue
139817a48c7cSmrg	  ;;
139917a48c7cSmrg	rpath | xrpath)
140017a48c7cSmrg	  # We need an absolute path.
140117a48c7cSmrg	  case $arg in
140217a48c7cSmrg	  [\\/]* | [A-Za-z]:[\\/]*) ;;
140317a48c7cSmrg	  *)
140417a48c7cSmrg	    $echo "$modename: only absolute run-paths are allowed" 1>&2
140517a48c7cSmrg	    exit $EXIT_FAILURE
140617a48c7cSmrg	    ;;
140717a48c7cSmrg	  esac
140817a48c7cSmrg	  if test "$prev" = rpath; then
140917a48c7cSmrg	    case "$rpath " in
141017a48c7cSmrg	    *" $arg "*) ;;
141117a48c7cSmrg	    *) rpath="$rpath $arg" ;;
141217a48c7cSmrg	    esac
141317a48c7cSmrg	  else
141417a48c7cSmrg	    case "$xrpath " in
141517a48c7cSmrg	    *" $arg "*) ;;
141617a48c7cSmrg	    *) xrpath="$xrpath $arg" ;;
141717a48c7cSmrg	    esac
141817a48c7cSmrg	  fi
141917a48c7cSmrg	  prev=
142017a48c7cSmrg	  continue
142117a48c7cSmrg	  ;;
142217a48c7cSmrg	xcompiler)
142317a48c7cSmrg	  compiler_flags="$compiler_flags $qarg"
142417a48c7cSmrg	  prev=
142517a48c7cSmrg	  compile_command="$compile_command $qarg"
142617a48c7cSmrg	  finalize_command="$finalize_command $qarg"
142717a48c7cSmrg	  continue
142817a48c7cSmrg	  ;;
142917a48c7cSmrg	xlinker)
143017a48c7cSmrg	  linker_flags="$linker_flags $qarg"
143117a48c7cSmrg	  compiler_flags="$compiler_flags $wl$qarg"
143217a48c7cSmrg	  prev=
143317a48c7cSmrg	  compile_command="$compile_command $wl$qarg"
143417a48c7cSmrg	  finalize_command="$finalize_command $wl$qarg"
143517a48c7cSmrg	  continue
143617a48c7cSmrg	  ;;
143717a48c7cSmrg	xcclinker)
143817a48c7cSmrg	  linker_flags="$linker_flags $qarg"
143917a48c7cSmrg	  compiler_flags="$compiler_flags $qarg"
144017a48c7cSmrg	  prev=
144117a48c7cSmrg	  compile_command="$compile_command $qarg"
144217a48c7cSmrg	  finalize_command="$finalize_command $qarg"
144317a48c7cSmrg	  continue
144417a48c7cSmrg	  ;;
144517a48c7cSmrg	shrext)
144617a48c7cSmrg  	  shrext_cmds="$arg"
144717a48c7cSmrg	  prev=
144817a48c7cSmrg	  continue
144917a48c7cSmrg	  ;;
145017a48c7cSmrg	darwin_framework|darwin_framework_skip)
145117a48c7cSmrg	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
145217a48c7cSmrg	  compile_command="$compile_command $arg"
145317a48c7cSmrg	  finalize_command="$finalize_command $arg"
145417a48c7cSmrg	  prev=
145517a48c7cSmrg	  continue
145617a48c7cSmrg	  ;;
145717a48c7cSmrg	*)
145817a48c7cSmrg	  eval "$prev=\"\$arg\""
145917a48c7cSmrg	  prev=
146017a48c7cSmrg	  continue
146117a48c7cSmrg	  ;;
146217a48c7cSmrg	esac
146317a48c7cSmrg      fi # test -n "$prev"
146417a48c7cSmrg
146517a48c7cSmrg      prevarg="$arg"
146617a48c7cSmrg
146717a48c7cSmrg      case $arg in
146817a48c7cSmrg      -all-static)
146917a48c7cSmrg	if test -n "$link_static_flag"; then
147017a48c7cSmrg	  compile_command="$compile_command $link_static_flag"
147117a48c7cSmrg	  finalize_command="$finalize_command $link_static_flag"
147217a48c7cSmrg	fi
147317a48c7cSmrg	continue
147417a48c7cSmrg	;;
147517a48c7cSmrg
147617a48c7cSmrg      -allow-undefined)
147717a48c7cSmrg	# FIXME: remove this flag sometime in the future.
147817a48c7cSmrg	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
147917a48c7cSmrg	continue
148017a48c7cSmrg	;;
148117a48c7cSmrg
148217a48c7cSmrg      -avoid-version)
148317a48c7cSmrg	avoid_version=yes
148417a48c7cSmrg	continue
148517a48c7cSmrg	;;
148617a48c7cSmrg
148717a48c7cSmrg      -dlopen)
148817a48c7cSmrg	prev=dlfiles
148917a48c7cSmrg	continue
149017a48c7cSmrg	;;
149117a48c7cSmrg
149217a48c7cSmrg      -dlpreopen)
149317a48c7cSmrg	prev=dlprefiles
149417a48c7cSmrg	continue
149517a48c7cSmrg	;;
149617a48c7cSmrg
149717a48c7cSmrg      -export-dynamic)
149817a48c7cSmrg	export_dynamic=yes
149917a48c7cSmrg	continue
150017a48c7cSmrg	;;
150117a48c7cSmrg
150217a48c7cSmrg      -export-symbols | -export-symbols-regex)
150317a48c7cSmrg	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
150417a48c7cSmrg	  $echo "$modename: more than one -exported-symbols argument is not allowed"
150517a48c7cSmrg	  exit $EXIT_FAILURE
150617a48c7cSmrg	fi
150717a48c7cSmrg	if test "X$arg" = "X-export-symbols"; then
150817a48c7cSmrg	  prev=expsyms
150917a48c7cSmrg	else
151017a48c7cSmrg	  prev=expsyms_regex
151117a48c7cSmrg	fi
151217a48c7cSmrg	continue
151317a48c7cSmrg	;;
151417a48c7cSmrg
151517a48c7cSmrg      -framework|-arch|-isysroot)
151617a48c7cSmrg	case " $CC " in
151717a48c7cSmrg	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
151817a48c7cSmrg		prev=darwin_framework_skip ;;
151917a48c7cSmrg	  *) compiler_flags="$compiler_flags $arg"
152017a48c7cSmrg	     prev=darwin_framework ;;
152117a48c7cSmrg	esac
152217a48c7cSmrg	compile_command="$compile_command $arg"
152317a48c7cSmrg	finalize_command="$finalize_command $arg"
152417a48c7cSmrg	continue
152517a48c7cSmrg	;;
152617a48c7cSmrg
152717a48c7cSmrg      -inst-prefix-dir)
152817a48c7cSmrg	prev=inst_prefix
152917a48c7cSmrg	continue
153017a48c7cSmrg	;;
153117a48c7cSmrg
153217a48c7cSmrg      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
153317a48c7cSmrg      # so, if we see these flags be careful not to treat them like -L
153417a48c7cSmrg      -L[A-Z][A-Z]*:*)
153517a48c7cSmrg	case $with_gcc/$host in
153617a48c7cSmrg	no/*-*-irix* | /*-*-irix*)
153717a48c7cSmrg	  compile_command="$compile_command $arg"
153817a48c7cSmrg	  finalize_command="$finalize_command $arg"
153917a48c7cSmrg	  ;;
154017a48c7cSmrg	esac
154117a48c7cSmrg	continue
154217a48c7cSmrg	;;
154317a48c7cSmrg
154417a48c7cSmrg      -L*)
154517a48c7cSmrg	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
154617a48c7cSmrg	# We need an absolute path.
154717a48c7cSmrg	case $dir in
154817a48c7cSmrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
154917a48c7cSmrg	*)
155017a48c7cSmrg	  absdir=`cd "$dir" && pwd`
155117a48c7cSmrg	  if test -z "$absdir"; then
155217a48c7cSmrg	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
155317a48c7cSmrg	    absdir="$dir"
155417a48c7cSmrg	    notinst_path="$notinst_path $dir"
155517a48c7cSmrg	  fi
155617a48c7cSmrg	  dir="$absdir"
155717a48c7cSmrg	  ;;
155817a48c7cSmrg	esac
155917a48c7cSmrg	case "$deplibs " in
156017a48c7cSmrg	*" -L$dir "*) ;;
156117a48c7cSmrg	*)
156217a48c7cSmrg	  deplibs="$deplibs -L$dir"
156317a48c7cSmrg	  lib_search_path="$lib_search_path $dir"
156417a48c7cSmrg	  ;;
156517a48c7cSmrg	esac
156617a48c7cSmrg	case $host in
156717a48c7cSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
156817a48c7cSmrg	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
156917a48c7cSmrg	  case :$dllsearchpath: in
157017a48c7cSmrg	  *":$dir:"*) ;;
157117a48c7cSmrg	  *) dllsearchpath="$dllsearchpath:$dir";;
157217a48c7cSmrg	  esac
157317a48c7cSmrg	  case :$dllsearchpath: in
157417a48c7cSmrg	  *":$testbindir:"*) ;;
157517a48c7cSmrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
157617a48c7cSmrg	  esac
157717a48c7cSmrg	  ;;
157817a48c7cSmrg	esac
157917a48c7cSmrg	continue
158017a48c7cSmrg	;;
158117a48c7cSmrg
158217a48c7cSmrg      -l*)
158317a48c7cSmrg	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
158417a48c7cSmrg	  case $host in
158517a48c7cSmrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
158617a48c7cSmrg	    # These systems don't actually have a C or math library (as such)
158717a48c7cSmrg	    continue
158817a48c7cSmrg	    ;;
158917a48c7cSmrg	  *-*-os2*)
159017a48c7cSmrg	    # These systems don't actually have a C library (as such)
159117a48c7cSmrg	    test "X$arg" = "X-lc" && continue
159217a48c7cSmrg	    ;;
159317a48c7cSmrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
159417a48c7cSmrg	    # Do not include libc due to us having libc/libc_r.
159517a48c7cSmrg	    test "X$arg" = "X-lc" && continue
159617a48c7cSmrg	    ;;
159717a48c7cSmrg	  *-*-rhapsody* | *-*-darwin1.[012])
159817a48c7cSmrg	    # Rhapsody C and math libraries are in the System framework
159917a48c7cSmrg	    deplibs="$deplibs -framework System"
160017a48c7cSmrg	    continue
160117a48c7cSmrg	    ;;
160217a48c7cSmrg	  *-*-sco3.2v5* | *-*-sco5v6*)
160317a48c7cSmrg	    # Causes problems with __ctype
160417a48c7cSmrg	    test "X$arg" = "X-lc" && continue
160517a48c7cSmrg	    ;;
160617a48c7cSmrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
160717a48c7cSmrg	    # Compiler inserts libc in the correct place for threads to work
160817a48c7cSmrg	    test "X$arg" = "X-lc" && continue
160917a48c7cSmrg	    ;;
161017a48c7cSmrg	  esac
161117a48c7cSmrg	elif test "X$arg" = "X-lc_r"; then
161217a48c7cSmrg	 case $host in
161317a48c7cSmrg	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
161417a48c7cSmrg	   # Do not include libc_r directly, use -pthread flag.
161517a48c7cSmrg	   continue
161617a48c7cSmrg	   ;;
161717a48c7cSmrg	 esac
161817a48c7cSmrg	fi
161917a48c7cSmrg	deplibs="$deplibs $arg"
162017a48c7cSmrg	continue
162117a48c7cSmrg	;;
162217a48c7cSmrg
162317a48c7cSmrg      # Tru64 UNIX uses -model [arg] to determine the layout of C++
162417a48c7cSmrg      # classes, name mangling, and exception handling.
162517a48c7cSmrg      -model)
162617a48c7cSmrg	compile_command="$compile_command $arg"
162717a48c7cSmrg	compiler_flags="$compiler_flags $arg"
162817a48c7cSmrg	finalize_command="$finalize_command $arg"
162917a48c7cSmrg	prev=xcompiler
163017a48c7cSmrg	continue
163117a48c7cSmrg	;;
163217a48c7cSmrg
163317a48c7cSmrg     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
163417a48c7cSmrg	compiler_flags="$compiler_flags $arg"
163517a48c7cSmrg	compile_command="$compile_command $arg"
163617a48c7cSmrg	finalize_command="$finalize_command $arg"
163717a48c7cSmrg	continue
163817a48c7cSmrg	;;
163917a48c7cSmrg
164017a48c7cSmrg      -module)
164117a48c7cSmrg	module=yes
164217a48c7cSmrg	continue
164317a48c7cSmrg	;;
164417a48c7cSmrg
164517a48c7cSmrg      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
164617a48c7cSmrg      # -r[0-9][0-9]* specifies the processor on the SGI compiler
164717a48c7cSmrg      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
164817a48c7cSmrg      # +DA*, +DD* enable 64-bit mode on the HP compiler
164917a48c7cSmrg      # -q* pass through compiler args for the IBM compiler
165017a48c7cSmrg      # -m* pass through architecture-specific compiler args for GCC
165117a48c7cSmrg      # -m*, -t[45]*, -txscale* pass through architecture-specific
165217a48c7cSmrg      # compiler args for GCC
165317a48c7cSmrg      # -pg pass through profiling flag for GCC
165417a48c7cSmrg      # @file GCC response files
165517a48c7cSmrg      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
165617a48c7cSmrg      -t[45]*|-txscale*|@*)
165717a48c7cSmrg
165817a48c7cSmrg	# Unknown arguments in both finalize_command and compile_command need
165917a48c7cSmrg	# to be aesthetically quoted because they are evaled later.
166017a48c7cSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
166117a48c7cSmrg	case $arg in
166217a48c7cSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
166317a48c7cSmrg	  arg="\"$arg\""
166417a48c7cSmrg	  ;;
166517a48c7cSmrg	esac
166617a48c7cSmrg        compile_command="$compile_command $arg"
166717a48c7cSmrg        finalize_command="$finalize_command $arg"
166817a48c7cSmrg        compiler_flags="$compiler_flags $arg"
166917a48c7cSmrg        continue
167017a48c7cSmrg        ;;
167117a48c7cSmrg
167217a48c7cSmrg      -shrext)
167317a48c7cSmrg	prev=shrext
167417a48c7cSmrg	continue
167517a48c7cSmrg	;;
167617a48c7cSmrg
167717a48c7cSmrg      -no-fast-install)
167817a48c7cSmrg	fast_install=no
167917a48c7cSmrg	continue
168017a48c7cSmrg	;;
168117a48c7cSmrg
168217a48c7cSmrg      -no-install)
168317a48c7cSmrg	case $host in
168417a48c7cSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
168517a48c7cSmrg	  # The PATH hackery in wrapper scripts is required on Windows
168617a48c7cSmrg	  # in order for the loader to find any dlls it needs.
168717a48c7cSmrg	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
168817a48c7cSmrg	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
168917a48c7cSmrg	  fast_install=no
169017a48c7cSmrg	  ;;
169117a48c7cSmrg	*) no_install=yes ;;
169217a48c7cSmrg	esac
169317a48c7cSmrg	continue
169417a48c7cSmrg	;;
169517a48c7cSmrg
169617a48c7cSmrg      -no-undefined)
169717a48c7cSmrg	allow_undefined=no
169817a48c7cSmrg	continue
169917a48c7cSmrg	;;
170017a48c7cSmrg
170117a48c7cSmrg      -objectlist)
170217a48c7cSmrg	prev=objectlist
170317a48c7cSmrg	continue
170417a48c7cSmrg	;;
170517a48c7cSmrg
170617a48c7cSmrg      -o) prev=output ;;
170717a48c7cSmrg
170817a48c7cSmrg      -precious-files-regex)
170917a48c7cSmrg	prev=precious_regex
171017a48c7cSmrg	continue
171117a48c7cSmrg	;;
171217a48c7cSmrg
171317a48c7cSmrg      -release)
171417a48c7cSmrg	prev=release
171517a48c7cSmrg	continue
171617a48c7cSmrg	;;
171717a48c7cSmrg
171817a48c7cSmrg      -rpath)
171917a48c7cSmrg	prev=rpath
172017a48c7cSmrg	continue
172117a48c7cSmrg	;;
172217a48c7cSmrg
172317a48c7cSmrg      -R)
172417a48c7cSmrg	prev=xrpath
172517a48c7cSmrg	continue
172617a48c7cSmrg	;;
172717a48c7cSmrg
172817a48c7cSmrg      -R*)
172917a48c7cSmrg	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
173017a48c7cSmrg	# We need an absolute path.
173117a48c7cSmrg	case $dir in
173217a48c7cSmrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
173317a48c7cSmrg	*)
173417a48c7cSmrg	  $echo "$modename: only absolute run-paths are allowed" 1>&2
173517a48c7cSmrg	  exit $EXIT_FAILURE
173617a48c7cSmrg	  ;;
173717a48c7cSmrg	esac
173817a48c7cSmrg	case "$xrpath " in
173917a48c7cSmrg	*" $dir "*) ;;
174017a48c7cSmrg	*) xrpath="$xrpath $dir" ;;
174117a48c7cSmrg	esac
174217a48c7cSmrg	continue
174317a48c7cSmrg	;;
174417a48c7cSmrg
17458e0ed500Smrg      -static | -static-libtool-libs)
174617a48c7cSmrg	# The effects of -static are defined in a previous loop.
174717a48c7cSmrg	# We used to do the same as -all-static on platforms that
174817a48c7cSmrg	# didn't have a PIC flag, but the assumption that the effects
174917a48c7cSmrg	# would be equivalent was wrong.  It would break on at least
175017a48c7cSmrg	# Digital Unix and AIX.
175117a48c7cSmrg	continue
175217a48c7cSmrg	;;
175317a48c7cSmrg
175417a48c7cSmrg      -thread-safe)
175517a48c7cSmrg	thread_safe=yes
175617a48c7cSmrg	continue
175717a48c7cSmrg	;;
175817a48c7cSmrg
175917a48c7cSmrg      -version-info)
176017a48c7cSmrg	prev=vinfo
176117a48c7cSmrg	continue
176217a48c7cSmrg	;;
176317a48c7cSmrg      -version-number)
176417a48c7cSmrg	prev=vinfo
176517a48c7cSmrg	vinfo_number=yes
176617a48c7cSmrg	continue
176717a48c7cSmrg	;;
176817a48c7cSmrg
176917a48c7cSmrg      -Wc,*)
177017a48c7cSmrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
177117a48c7cSmrg	arg=
177217a48c7cSmrg	save_ifs="$IFS"; IFS=','
177317a48c7cSmrg	for flag in $args; do
177417a48c7cSmrg	  IFS="$save_ifs"
177517a48c7cSmrg	  case $flag in
177617a48c7cSmrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
177717a48c7cSmrg	    flag="\"$flag\""
177817a48c7cSmrg	    ;;
177917a48c7cSmrg	  esac
178017a48c7cSmrg	  arg="$arg $wl$flag"
178117a48c7cSmrg	  compiler_flags="$compiler_flags $flag"
178217a48c7cSmrg	done
178317a48c7cSmrg	IFS="$save_ifs"
178417a48c7cSmrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
178517a48c7cSmrg	;;
178617a48c7cSmrg
178717a48c7cSmrg      -Wl,*)
178817a48c7cSmrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
178917a48c7cSmrg	arg=
179017a48c7cSmrg	save_ifs="$IFS"; IFS=','
179117a48c7cSmrg	for flag in $args; do
179217a48c7cSmrg	  IFS="$save_ifs"
179317a48c7cSmrg	  case $flag in
179417a48c7cSmrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
179517a48c7cSmrg	    flag="\"$flag\""
179617a48c7cSmrg	    ;;
179717a48c7cSmrg	  esac
179817a48c7cSmrg	  arg="$arg $wl$flag"
179917a48c7cSmrg	  compiler_flags="$compiler_flags $wl$flag"
180017a48c7cSmrg	  linker_flags="$linker_flags $flag"
180117a48c7cSmrg	done
180217a48c7cSmrg	IFS="$save_ifs"
180317a48c7cSmrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
180417a48c7cSmrg	;;
180517a48c7cSmrg
180617a48c7cSmrg      -Xcompiler)
180717a48c7cSmrg	prev=xcompiler
180817a48c7cSmrg	continue
180917a48c7cSmrg	;;
181017a48c7cSmrg
181117a48c7cSmrg      -Xlinker)
181217a48c7cSmrg	prev=xlinker
181317a48c7cSmrg	continue
181417a48c7cSmrg	;;
181517a48c7cSmrg
181617a48c7cSmrg      -XCClinker)
181717a48c7cSmrg	prev=xcclinker
181817a48c7cSmrg	continue
181917a48c7cSmrg	;;
182017a48c7cSmrg
182117a48c7cSmrg      # Some other compiler flag.
182217a48c7cSmrg      -* | +*)
182317a48c7cSmrg	# Unknown arguments in both finalize_command and compile_command need
182417a48c7cSmrg	# to be aesthetically quoted because they are evaled later.
182517a48c7cSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
182617a48c7cSmrg	case $arg in
182717a48c7cSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
182817a48c7cSmrg	  arg="\"$arg\""
182917a48c7cSmrg	  ;;
183017a48c7cSmrg	esac
183117a48c7cSmrg	;;
183217a48c7cSmrg
183317a48c7cSmrg      *.$objext)
183417a48c7cSmrg	# A standard object.
183517a48c7cSmrg	objs="$objs $arg"
183617a48c7cSmrg	;;
183717a48c7cSmrg
183817a48c7cSmrg      *.lo)
183917a48c7cSmrg	# A libtool-controlled object.
184017a48c7cSmrg
184117a48c7cSmrg	# Check to see that this really is a libtool object.
184217a48c7cSmrg	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
184317a48c7cSmrg	  pic_object=
184417a48c7cSmrg	  non_pic_object=
184517a48c7cSmrg
184617a48c7cSmrg	  # Read the .lo file
184717a48c7cSmrg	  # If there is no directory component, then add one.
184817a48c7cSmrg	  case $arg in
184917a48c7cSmrg	  */* | *\\*) . $arg ;;
185017a48c7cSmrg	  *) . ./$arg ;;
185117a48c7cSmrg	  esac
185217a48c7cSmrg
185317a48c7cSmrg	  if test -z "$pic_object" || \
185417a48c7cSmrg	     test -z "$non_pic_object" ||
185517a48c7cSmrg	     test "$pic_object" = none && \
185617a48c7cSmrg	     test "$non_pic_object" = none; then
185717a48c7cSmrg	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
185817a48c7cSmrg	    exit $EXIT_FAILURE
185917a48c7cSmrg	  fi
186017a48c7cSmrg
186117a48c7cSmrg	  # Extract subdirectory from the argument.
186217a48c7cSmrg	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
186317a48c7cSmrg	  if test "X$xdir" = "X$arg"; then
186417a48c7cSmrg	    xdir=
186517a48c7cSmrg 	  else
186617a48c7cSmrg	    xdir="$xdir/"
186717a48c7cSmrg	  fi
186817a48c7cSmrg
186917a48c7cSmrg	  if test "$pic_object" != none; then
187017a48c7cSmrg	    # Prepend the subdirectory the object is found in.
187117a48c7cSmrg	    pic_object="$xdir$pic_object"
187217a48c7cSmrg
187317a48c7cSmrg	    if test "$prev" = dlfiles; then
187417a48c7cSmrg	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
187517a48c7cSmrg		dlfiles="$dlfiles $pic_object"
187617a48c7cSmrg		prev=
187717a48c7cSmrg		continue
187817a48c7cSmrg	      else
187917a48c7cSmrg		# If libtool objects are unsupported, then we need to preload.
188017a48c7cSmrg		prev=dlprefiles
188117a48c7cSmrg	      fi
188217a48c7cSmrg	    fi
188317a48c7cSmrg
188417a48c7cSmrg	    # CHECK ME:  I think I busted this.  -Ossama
188517a48c7cSmrg	    if test "$prev" = dlprefiles; then
188617a48c7cSmrg	      # Preload the old-style object.
188717a48c7cSmrg	      dlprefiles="$dlprefiles $pic_object"
188817a48c7cSmrg	      prev=
188917a48c7cSmrg	    fi
189017a48c7cSmrg
189117a48c7cSmrg	    # A PIC object.
189217a48c7cSmrg	    libobjs="$libobjs $pic_object"
189317a48c7cSmrg	    arg="$pic_object"
189417a48c7cSmrg	  fi
189517a48c7cSmrg
189617a48c7cSmrg	  # Non-PIC object.
189717a48c7cSmrg	  if test "$non_pic_object" != none; then
189817a48c7cSmrg	    # Prepend the subdirectory the object is found in.
189917a48c7cSmrg	    non_pic_object="$xdir$non_pic_object"
190017a48c7cSmrg
190117a48c7cSmrg	    # A standard non-PIC object
190217a48c7cSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
190317a48c7cSmrg	    if test -z "$pic_object" || test "$pic_object" = none ; then
190417a48c7cSmrg	      arg="$non_pic_object"
190517a48c7cSmrg	    fi
190617a48c7cSmrg	  else
190717a48c7cSmrg	    # If the PIC object exists, use it instead.
190817a48c7cSmrg	    # $xdir was prepended to $pic_object above.
190917a48c7cSmrg	    non_pic_object="$pic_object"
191017a48c7cSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
191117a48c7cSmrg	  fi
191217a48c7cSmrg	else
191317a48c7cSmrg	  # Only an error if not doing a dry-run.
191417a48c7cSmrg	  if test -z "$run"; then
191517a48c7cSmrg	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
191617a48c7cSmrg	    exit $EXIT_FAILURE
191717a48c7cSmrg	  else
191817a48c7cSmrg	    # Dry-run case.
191917a48c7cSmrg
192017a48c7cSmrg	    # Extract subdirectory from the argument.
192117a48c7cSmrg	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
192217a48c7cSmrg	    if test "X$xdir" = "X$arg"; then
192317a48c7cSmrg	      xdir=
192417a48c7cSmrg	    else
192517a48c7cSmrg	      xdir="$xdir/"
192617a48c7cSmrg	    fi
192717a48c7cSmrg
192817a48c7cSmrg	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
192917a48c7cSmrg	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
193017a48c7cSmrg	    libobjs="$libobjs $pic_object"
193117a48c7cSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
193217a48c7cSmrg	  fi
193317a48c7cSmrg	fi
193417a48c7cSmrg	;;
193517a48c7cSmrg
193617a48c7cSmrg      *.$libext)
193717a48c7cSmrg	# An archive.
193817a48c7cSmrg	deplibs="$deplibs $arg"
193917a48c7cSmrg	old_deplibs="$old_deplibs $arg"
194017a48c7cSmrg	continue
194117a48c7cSmrg	;;
194217a48c7cSmrg
194317a48c7cSmrg      *.la)
194417a48c7cSmrg	# A libtool-controlled library.
194517a48c7cSmrg
194617a48c7cSmrg	if test "$prev" = dlfiles; then
194717a48c7cSmrg	  # This library was specified with -dlopen.
194817a48c7cSmrg	  dlfiles="$dlfiles $arg"
194917a48c7cSmrg	  prev=
195017a48c7cSmrg	elif test "$prev" = dlprefiles; then
195117a48c7cSmrg	  # The library was specified with -dlpreopen.
195217a48c7cSmrg	  dlprefiles="$dlprefiles $arg"
195317a48c7cSmrg	  prev=
195417a48c7cSmrg	else
195517a48c7cSmrg	  deplibs="$deplibs $arg"
195617a48c7cSmrg	fi
195717a48c7cSmrg	continue
195817a48c7cSmrg	;;
195917a48c7cSmrg
196017a48c7cSmrg      # Some other compiler argument.
196117a48c7cSmrg      *)
196217a48c7cSmrg	# Unknown arguments in both finalize_command and compile_command need
196317a48c7cSmrg	# to be aesthetically quoted because they are evaled later.
196417a48c7cSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
196517a48c7cSmrg	case $arg in
196617a48c7cSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
196717a48c7cSmrg	  arg="\"$arg\""
196817a48c7cSmrg	  ;;
196917a48c7cSmrg	esac
197017a48c7cSmrg	;;
197117a48c7cSmrg      esac # arg
197217a48c7cSmrg
197317a48c7cSmrg      # Now actually substitute the argument into the commands.
197417a48c7cSmrg      if test -n "$arg"; then
197517a48c7cSmrg	compile_command="$compile_command $arg"
197617a48c7cSmrg	finalize_command="$finalize_command $arg"
197717a48c7cSmrg      fi
197817a48c7cSmrg    done # argument parsing loop
197917a48c7cSmrg
198017a48c7cSmrg    if test -n "$prev"; then
198117a48c7cSmrg      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
198217a48c7cSmrg      $echo "$help" 1>&2
198317a48c7cSmrg      exit $EXIT_FAILURE
198417a48c7cSmrg    fi
198517a48c7cSmrg
198617a48c7cSmrg    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
198717a48c7cSmrg      eval arg=\"$export_dynamic_flag_spec\"
198817a48c7cSmrg      compile_command="$compile_command $arg"
198917a48c7cSmrg      finalize_command="$finalize_command $arg"
199017a48c7cSmrg    fi
199117a48c7cSmrg
199217a48c7cSmrg    oldlibs=
199317a48c7cSmrg    # calculate the name of the file, without its directory
199417a48c7cSmrg    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
199517a48c7cSmrg    libobjs_save="$libobjs"
199617a48c7cSmrg
199717a48c7cSmrg    if test -n "$shlibpath_var"; then
199817a48c7cSmrg      # get the directories listed in $shlibpath_var
199917a48c7cSmrg      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
200017a48c7cSmrg    else
200117a48c7cSmrg      shlib_search_path=
200217a48c7cSmrg    fi
200317a48c7cSmrg    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
200417a48c7cSmrg    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
200517a48c7cSmrg
200617a48c7cSmrg    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
200717a48c7cSmrg    if test "X$output_objdir" = "X$output"; then
200817a48c7cSmrg      output_objdir="$objdir"
200917a48c7cSmrg    else
201017a48c7cSmrg      output_objdir="$output_objdir/$objdir"
201117a48c7cSmrg    fi
201217a48c7cSmrg    # Create the object directory.
201317a48c7cSmrg    if test ! -d "$output_objdir"; then
201417a48c7cSmrg      $show "$mkdir $output_objdir"
201517a48c7cSmrg      $run $mkdir $output_objdir
201617a48c7cSmrg      exit_status=$?
201717a48c7cSmrg      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
201817a48c7cSmrg	exit $exit_status
201917a48c7cSmrg      fi
202017a48c7cSmrg    fi
202117a48c7cSmrg
202217a48c7cSmrg    # Determine the type of output
202317a48c7cSmrg    case $output in
202417a48c7cSmrg    "")
202517a48c7cSmrg      $echo "$modename: you must specify an output file" 1>&2
202617a48c7cSmrg      $echo "$help" 1>&2
202717a48c7cSmrg      exit $EXIT_FAILURE
202817a48c7cSmrg      ;;
202917a48c7cSmrg    *.$libext) linkmode=oldlib ;;
203017a48c7cSmrg    *.lo | *.$objext) linkmode=obj ;;
203117a48c7cSmrg    *.la) linkmode=lib ;;
203217a48c7cSmrg    *) linkmode=prog ;; # Anything else should be a program.
203317a48c7cSmrg    esac
203417a48c7cSmrg
203517a48c7cSmrg    case $host in
203617a48c7cSmrg    *cygwin* | *mingw* | *pw32*)
203717a48c7cSmrg      # don't eliminate duplications in $postdeps and $predeps
203817a48c7cSmrg      duplicate_compiler_generated_deps=yes
203917a48c7cSmrg      ;;
204017a48c7cSmrg    *)
204117a48c7cSmrg      duplicate_compiler_generated_deps=$duplicate_deps
204217a48c7cSmrg      ;;
204317a48c7cSmrg    esac
204417a48c7cSmrg    specialdeplibs=
204517a48c7cSmrg
204617a48c7cSmrg    libs=
204717a48c7cSmrg    # Find all interdependent deplibs by searching for libraries
204817a48c7cSmrg    # that are linked more than once (e.g. -la -lb -la)
204917a48c7cSmrg    for deplib in $deplibs; do
205017a48c7cSmrg      if test "X$duplicate_deps" = "Xyes" ; then
205117a48c7cSmrg	case "$libs " in
205217a48c7cSmrg	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
205317a48c7cSmrg	esac
205417a48c7cSmrg      fi
205517a48c7cSmrg      libs="$libs $deplib"
205617a48c7cSmrg    done
205717a48c7cSmrg
205817a48c7cSmrg    if test "$linkmode" = lib; then
205917a48c7cSmrg      libs="$predeps $libs $compiler_lib_search_path $postdeps"
206017a48c7cSmrg
206117a48c7cSmrg      # Compute libraries that are listed more than once in $predeps
206217a48c7cSmrg      # $postdeps and mark them as special (i.e., whose duplicates are
206317a48c7cSmrg      # not to be eliminated).
206417a48c7cSmrg      pre_post_deps=
206517a48c7cSmrg      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
206617a48c7cSmrg	for pre_post_dep in $predeps $postdeps; do
206717a48c7cSmrg	  case "$pre_post_deps " in
206817a48c7cSmrg	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
206917a48c7cSmrg	  esac
207017a48c7cSmrg	  pre_post_deps="$pre_post_deps $pre_post_dep"
207117a48c7cSmrg	done
207217a48c7cSmrg      fi
207317a48c7cSmrg      pre_post_deps=
207417a48c7cSmrg    fi
207517a48c7cSmrg
207617a48c7cSmrg    deplibs=
207717a48c7cSmrg    newdependency_libs=
207817a48c7cSmrg    newlib_search_path=
207917a48c7cSmrg    need_relink=no # whether we're linking any uninstalled libtool libraries
208017a48c7cSmrg    notinst_deplibs= # not-installed libtool libraries
208117a48c7cSmrg    case $linkmode in
208217a48c7cSmrg    lib)
208317a48c7cSmrg	passes="conv link"
208417a48c7cSmrg	for file in $dlfiles $dlprefiles; do
208517a48c7cSmrg	  case $file in
208617a48c7cSmrg	  *.la) ;;
208717a48c7cSmrg	  *)
208817a48c7cSmrg	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
208917a48c7cSmrg	    exit $EXIT_FAILURE
209017a48c7cSmrg	    ;;
209117a48c7cSmrg	  esac
209217a48c7cSmrg	done
209317a48c7cSmrg	;;
209417a48c7cSmrg    prog)
209517a48c7cSmrg	compile_deplibs=
209617a48c7cSmrg	finalize_deplibs=
209717a48c7cSmrg	alldeplibs=no
209817a48c7cSmrg	newdlfiles=
209917a48c7cSmrg	newdlprefiles=
210017a48c7cSmrg	passes="conv scan dlopen dlpreopen link"
210117a48c7cSmrg	;;
210217a48c7cSmrg    *)  passes="conv"
210317a48c7cSmrg	;;
210417a48c7cSmrg    esac
210517a48c7cSmrg    for pass in $passes; do
210617a48c7cSmrg      if test "$linkmode,$pass" = "lib,link" ||
210717a48c7cSmrg	 test "$linkmode,$pass" = "prog,scan"; then
210817a48c7cSmrg	libs="$deplibs"
210917a48c7cSmrg	deplibs=
211017a48c7cSmrg      fi
211117a48c7cSmrg      if test "$linkmode" = prog; then
211217a48c7cSmrg	case $pass in
211317a48c7cSmrg	dlopen) libs="$dlfiles" ;;
211417a48c7cSmrg	dlpreopen) libs="$dlprefiles" ;;
211517a48c7cSmrg	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
211617a48c7cSmrg	esac
211717a48c7cSmrg      fi
211817a48c7cSmrg      if test "$pass" = dlopen; then
211917a48c7cSmrg	# Collect dlpreopened libraries
212017a48c7cSmrg	save_deplibs="$deplibs"
212117a48c7cSmrg	deplibs=
212217a48c7cSmrg      fi
212317a48c7cSmrg      for deplib in $libs; do
212417a48c7cSmrg	lib=
212517a48c7cSmrg	found=no
212617a48c7cSmrg	case $deplib in
212717a48c7cSmrg	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
212817a48c7cSmrg	  if test "$linkmode,$pass" = "prog,link"; then
212917a48c7cSmrg	    compile_deplibs="$deplib $compile_deplibs"
213017a48c7cSmrg	    finalize_deplibs="$deplib $finalize_deplibs"
213117a48c7cSmrg	  else
213217a48c7cSmrg	    compiler_flags="$compiler_flags $deplib"
213317a48c7cSmrg	  fi
213417a48c7cSmrg	  continue
213517a48c7cSmrg	  ;;
213617a48c7cSmrg	-l*)
213717a48c7cSmrg	  if test "$linkmode" != lib && test "$linkmode" != prog; then
213817a48c7cSmrg	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
213917a48c7cSmrg	    continue
214017a48c7cSmrg	  fi
214117a48c7cSmrg	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
214217a48c7cSmrg	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
214317a48c7cSmrg	    for search_ext in .la $std_shrext .so .a; do
214417a48c7cSmrg	      # Search the libtool library
214517a48c7cSmrg	      lib="$searchdir/lib${name}${search_ext}"
214617a48c7cSmrg	      if test -f "$lib"; then
214717a48c7cSmrg		if test "$search_ext" = ".la"; then
214817a48c7cSmrg		  found=yes
214917a48c7cSmrg		else
215017a48c7cSmrg		  found=no
215117a48c7cSmrg		fi
215217a48c7cSmrg		break 2
215317a48c7cSmrg	      fi
215417a48c7cSmrg	    done
215517a48c7cSmrg	  done
215617a48c7cSmrg	  if test "$found" != yes; then
215717a48c7cSmrg	    # deplib doesn't seem to be a libtool library
215817a48c7cSmrg	    if test "$linkmode,$pass" = "prog,link"; then
215917a48c7cSmrg	      compile_deplibs="$deplib $compile_deplibs"
216017a48c7cSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
216117a48c7cSmrg	    else
216217a48c7cSmrg	      deplibs="$deplib $deplibs"
216317a48c7cSmrg	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
216417a48c7cSmrg	    fi
216517a48c7cSmrg	    continue
216617a48c7cSmrg	  else # deplib is a libtool library
216717a48c7cSmrg	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
216817a48c7cSmrg	    # We need to do some special things here, and not later.
216917a48c7cSmrg	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
217017a48c7cSmrg	      case " $predeps $postdeps " in
217117a48c7cSmrg	      *" $deplib "*)
217217a48c7cSmrg		if (${SED} -e '2q' $lib |
217317a48c7cSmrg                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
217417a48c7cSmrg		  library_names=
217517a48c7cSmrg		  old_library=
217617a48c7cSmrg		  case $lib in
217717a48c7cSmrg		  */* | *\\*) . $lib ;;
217817a48c7cSmrg		  *) . ./$lib ;;
217917a48c7cSmrg		  esac
218017a48c7cSmrg		  for l in $old_library $library_names; do
218117a48c7cSmrg		    ll="$l"
218217a48c7cSmrg		  done
218317a48c7cSmrg		  if test "X$ll" = "X$old_library" ; then # only static version available
218417a48c7cSmrg		    found=no
218517a48c7cSmrg		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
218617a48c7cSmrg		    test "X$ladir" = "X$lib" && ladir="."
218717a48c7cSmrg		    lib=$ladir/$old_library
218817a48c7cSmrg		    if test "$linkmode,$pass" = "prog,link"; then
218917a48c7cSmrg		      compile_deplibs="$deplib $compile_deplibs"
219017a48c7cSmrg		      finalize_deplibs="$deplib $finalize_deplibs"
219117a48c7cSmrg		    else
219217a48c7cSmrg		      deplibs="$deplib $deplibs"
219317a48c7cSmrg		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
219417a48c7cSmrg		    fi
219517a48c7cSmrg		    continue
219617a48c7cSmrg		  fi
219717a48c7cSmrg		fi
219817a48c7cSmrg	        ;;
219917a48c7cSmrg	      *) ;;
220017a48c7cSmrg	      esac
220117a48c7cSmrg	    fi
220217a48c7cSmrg	  fi
220317a48c7cSmrg	  ;; # -l
220417a48c7cSmrg	-L*)
220517a48c7cSmrg	  case $linkmode in
220617a48c7cSmrg	  lib)
220717a48c7cSmrg	    deplibs="$deplib $deplibs"
220817a48c7cSmrg	    test "$pass" = conv && continue
220917a48c7cSmrg	    newdependency_libs="$deplib $newdependency_libs"
221017a48c7cSmrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
221117a48c7cSmrg	    ;;
221217a48c7cSmrg	  prog)
221317a48c7cSmrg	    if test "$pass" = conv; then
221417a48c7cSmrg	      deplibs="$deplib $deplibs"
221517a48c7cSmrg	      continue
221617a48c7cSmrg	    fi
221717a48c7cSmrg	    if test "$pass" = scan; then
221817a48c7cSmrg	      deplibs="$deplib $deplibs"
221917a48c7cSmrg	    else
222017a48c7cSmrg	      compile_deplibs="$deplib $compile_deplibs"
222117a48c7cSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
222217a48c7cSmrg	    fi
222317a48c7cSmrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
222417a48c7cSmrg	    ;;
222517a48c7cSmrg	  *)
222617a48c7cSmrg	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
222717a48c7cSmrg	    ;;
222817a48c7cSmrg	  esac # linkmode
222917a48c7cSmrg	  continue
223017a48c7cSmrg	  ;; # -L
223117a48c7cSmrg	-R*)
223217a48c7cSmrg	  if test "$pass" = link; then
223317a48c7cSmrg	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
223417a48c7cSmrg	    # Make sure the xrpath contains only unique directories.
223517a48c7cSmrg	    case "$xrpath " in
223617a48c7cSmrg	    *" $dir "*) ;;
223717a48c7cSmrg	    *) xrpath="$xrpath $dir" ;;
223817a48c7cSmrg	    esac
223917a48c7cSmrg	  fi
224017a48c7cSmrg	  deplibs="$deplib $deplibs"
224117a48c7cSmrg	  continue
224217a48c7cSmrg	  ;;
224317a48c7cSmrg	*.la) lib="$deplib" ;;
224417a48c7cSmrg	*.$libext)
224517a48c7cSmrg	  if test "$pass" = conv; then
224617a48c7cSmrg	    deplibs="$deplib $deplibs"
224717a48c7cSmrg	    continue
224817a48c7cSmrg	  fi
224917a48c7cSmrg	  case $linkmode in
225017a48c7cSmrg	  lib)
225117a48c7cSmrg	    valid_a_lib=no
225217a48c7cSmrg	    case $deplibs_check_method in
225317a48c7cSmrg	      match_pattern*)
225417a48c7cSmrg		set dummy $deplibs_check_method
225517a48c7cSmrg	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
225617a48c7cSmrg		if eval $echo \"$deplib\" 2>/dev/null \
225717a48c7cSmrg		    | $SED 10q \
225817a48c7cSmrg		    | $EGREP "$match_pattern_regex" > /dev/null; then
225917a48c7cSmrg		  valid_a_lib=yes
226017a48c7cSmrg		fi
226117a48c7cSmrg		;;
226217a48c7cSmrg	      pass_all)
226317a48c7cSmrg		valid_a_lib=yes
226417a48c7cSmrg		;;
226517a48c7cSmrg            esac
226617a48c7cSmrg	    if test "$valid_a_lib" != yes; then
226717a48c7cSmrg	      $echo
226817a48c7cSmrg	      $echo "*** Warning: Trying to link with static lib archive $deplib."
226917a48c7cSmrg	      $echo "*** I have the capability to make that library automatically link in when"
227017a48c7cSmrg	      $echo "*** you link to this library.  But I can only do this if you have a"
227117a48c7cSmrg	      $echo "*** shared version of the library, which you do not appear to have"
227217a48c7cSmrg	      $echo "*** because the file extensions .$libext of this argument makes me believe"
227317a48c7cSmrg	      $echo "*** that it is just a static archive that I should not used here."
227417a48c7cSmrg	    else
227517a48c7cSmrg	      $echo
227617a48c7cSmrg	      $echo "*** Warning: Linking the shared library $output against the"
227717a48c7cSmrg	      $echo "*** static library $deplib is not portable!"
227817a48c7cSmrg	      deplibs="$deplib $deplibs"
227917a48c7cSmrg	    fi
228017a48c7cSmrg	    continue
228117a48c7cSmrg	    ;;
228217a48c7cSmrg	  prog)
228317a48c7cSmrg	    if test "$pass" != link; then
228417a48c7cSmrg	      deplibs="$deplib $deplibs"
228517a48c7cSmrg	    else
228617a48c7cSmrg	      compile_deplibs="$deplib $compile_deplibs"
228717a48c7cSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
228817a48c7cSmrg	    fi
228917a48c7cSmrg	    continue
229017a48c7cSmrg	    ;;
229117a48c7cSmrg	  esac # linkmode
229217a48c7cSmrg	  ;; # *.$libext
229317a48c7cSmrg	*.lo | *.$objext)
229417a48c7cSmrg	  if test "$pass" = conv; then
229517a48c7cSmrg	    deplibs="$deplib $deplibs"
229617a48c7cSmrg	  elif test "$linkmode" = prog; then
229717a48c7cSmrg	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
229817a48c7cSmrg	      # If there is no dlopen support or we're linking statically,
229917a48c7cSmrg	      # we need to preload.
230017a48c7cSmrg	      newdlprefiles="$newdlprefiles $deplib"
230117a48c7cSmrg	      compile_deplibs="$deplib $compile_deplibs"
230217a48c7cSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
230317a48c7cSmrg	    else
230417a48c7cSmrg	      newdlfiles="$newdlfiles $deplib"
230517a48c7cSmrg	    fi
230617a48c7cSmrg	  fi
230717a48c7cSmrg	  continue
230817a48c7cSmrg	  ;;
230917a48c7cSmrg	%DEPLIBS%)
231017a48c7cSmrg	  alldeplibs=yes
231117a48c7cSmrg	  continue
231217a48c7cSmrg	  ;;
231317a48c7cSmrg	esac # case $deplib
231417a48c7cSmrg	if test "$found" = yes || test -f "$lib"; then :
231517a48c7cSmrg	else
231617a48c7cSmrg	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
231717a48c7cSmrg	  exit $EXIT_FAILURE
231817a48c7cSmrg	fi
231917a48c7cSmrg
232017a48c7cSmrg	# Check to see that this really is a libtool archive.
232117a48c7cSmrg	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
232217a48c7cSmrg	else
232317a48c7cSmrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
232417a48c7cSmrg	  exit $EXIT_FAILURE
232517a48c7cSmrg	fi
232617a48c7cSmrg
232717a48c7cSmrg	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
232817a48c7cSmrg	test "X$ladir" = "X$lib" && ladir="."
232917a48c7cSmrg
233017a48c7cSmrg	dlname=
233117a48c7cSmrg	dlopen=
233217a48c7cSmrg	dlpreopen=
233317a48c7cSmrg	libdir=
233417a48c7cSmrg	library_names=
233517a48c7cSmrg	old_library=
233617a48c7cSmrg	# If the library was installed with an old release of libtool,
233717a48c7cSmrg	# it will not redefine variables installed, or shouldnotlink
233817a48c7cSmrg	installed=yes
233917a48c7cSmrg	shouldnotlink=no
234017a48c7cSmrg	avoidtemprpath=
234117a48c7cSmrg
234217a48c7cSmrg
234317a48c7cSmrg	# Read the .la file
234417a48c7cSmrg	case $lib in
234517a48c7cSmrg	*/* | *\\*) . $lib ;;
234617a48c7cSmrg	*) . ./$lib ;;
234717a48c7cSmrg	esac
234817a48c7cSmrg
234917a48c7cSmrg	if test "$linkmode,$pass" = "lib,link" ||
235017a48c7cSmrg	   test "$linkmode,$pass" = "prog,scan" ||
235117a48c7cSmrg	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
235217a48c7cSmrg	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
235317a48c7cSmrg	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
235417a48c7cSmrg	fi
235517a48c7cSmrg
235617a48c7cSmrg	if test "$pass" = conv; then
235717a48c7cSmrg	  # Only check for convenience libraries
235817a48c7cSmrg	  deplibs="$lib $deplibs"
235917a48c7cSmrg	  if test -z "$libdir"; then
236017a48c7cSmrg	    if test -z "$old_library"; then
236117a48c7cSmrg	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
236217a48c7cSmrg	      exit $EXIT_FAILURE
236317a48c7cSmrg	    fi
236417a48c7cSmrg	    # It is a libtool convenience library, so add in its objects.
236517a48c7cSmrg	    convenience="$convenience $ladir/$objdir/$old_library"
236617a48c7cSmrg	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
236717a48c7cSmrg	    tmp_libs=
236817a48c7cSmrg	    for deplib in $dependency_libs; do
236917a48c7cSmrg	      deplibs="$deplib $deplibs"
237017a48c7cSmrg              if test "X$duplicate_deps" = "Xyes" ; then
237117a48c7cSmrg	        case "$tmp_libs " in
237217a48c7cSmrg	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
237317a48c7cSmrg	        esac
237417a48c7cSmrg              fi
237517a48c7cSmrg	      tmp_libs="$tmp_libs $deplib"
237617a48c7cSmrg	    done
237717a48c7cSmrg	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
237817a48c7cSmrg	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
237917a48c7cSmrg	    exit $EXIT_FAILURE
238017a48c7cSmrg	  fi
238117a48c7cSmrg	  continue
238217a48c7cSmrg	fi # $pass = conv
238317a48c7cSmrg
238417a48c7cSmrg
238517a48c7cSmrg	# Get the name of the library we link against.
238617a48c7cSmrg	linklib=
238717a48c7cSmrg	for l in $old_library $library_names; do
238817a48c7cSmrg	  linklib="$l"
238917a48c7cSmrg	done
239017a48c7cSmrg	if test -z "$linklib"; then
239117a48c7cSmrg	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
239217a48c7cSmrg	  exit $EXIT_FAILURE
239317a48c7cSmrg	fi
239417a48c7cSmrg
239517a48c7cSmrg	# This library was specified with -dlopen.
239617a48c7cSmrg	if test "$pass" = dlopen; then
239717a48c7cSmrg	  if test -z "$libdir"; then
239817a48c7cSmrg	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
239917a48c7cSmrg	    exit $EXIT_FAILURE
240017a48c7cSmrg	  fi
240117a48c7cSmrg	  if test -z "$dlname" ||
240217a48c7cSmrg	     test "$dlopen_support" != yes ||
240317a48c7cSmrg	     test "$build_libtool_libs" = no; then
240417a48c7cSmrg	    # If there is no dlname, no dlopen support or we're linking
240517a48c7cSmrg	    # statically, we need to preload.  We also need to preload any
240617a48c7cSmrg	    # dependent libraries so libltdl's deplib preloader doesn't
240717a48c7cSmrg	    # bomb out in the load deplibs phase.
240817a48c7cSmrg	    dlprefiles="$dlprefiles $lib $dependency_libs"
240917a48c7cSmrg	  else
241017a48c7cSmrg	    newdlfiles="$newdlfiles $lib"
241117a48c7cSmrg	  fi
241217a48c7cSmrg	  continue
241317a48c7cSmrg	fi # $pass = dlopen
241417a48c7cSmrg
241517a48c7cSmrg	# We need an absolute path.
241617a48c7cSmrg	case $ladir in
241717a48c7cSmrg	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
241817a48c7cSmrg	*)
241917a48c7cSmrg	  abs_ladir=`cd "$ladir" && pwd`
242017a48c7cSmrg	  if test -z "$abs_ladir"; then
242117a48c7cSmrg	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
242217a48c7cSmrg	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
242317a48c7cSmrg	    abs_ladir="$ladir"
242417a48c7cSmrg	  fi
242517a48c7cSmrg	  ;;
242617a48c7cSmrg	esac
242717a48c7cSmrg	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
242817a48c7cSmrg
242917a48c7cSmrg	# Find the relevant object directory and library name.
243017a48c7cSmrg	if test "X$installed" = Xyes; then
243117a48c7cSmrg	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
243217a48c7cSmrg	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
243317a48c7cSmrg	    dir="$ladir"
243417a48c7cSmrg	    absdir="$abs_ladir"
243517a48c7cSmrg	    libdir="$abs_ladir"
243617a48c7cSmrg	  else
243717a48c7cSmrg	    dir="$libdir"
243817a48c7cSmrg	    absdir="$libdir"
243917a48c7cSmrg	  fi
244017a48c7cSmrg	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
244117a48c7cSmrg	else
244217a48c7cSmrg	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
244317a48c7cSmrg	    dir="$ladir"
244417a48c7cSmrg	    absdir="$abs_ladir"
244517a48c7cSmrg	    # Remove this search path later
244617a48c7cSmrg	    notinst_path="$notinst_path $abs_ladir"
244717a48c7cSmrg	  else
244817a48c7cSmrg	    dir="$ladir/$objdir"
244917a48c7cSmrg	    absdir="$abs_ladir/$objdir"
245017a48c7cSmrg	    # Remove this search path later
245117a48c7cSmrg	    notinst_path="$notinst_path $abs_ladir"
245217a48c7cSmrg	  fi
245317a48c7cSmrg	fi # $installed = yes
245417a48c7cSmrg	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
245517a48c7cSmrg
245617a48c7cSmrg	# This library was specified with -dlpreopen.
245717a48c7cSmrg	if test "$pass" = dlpreopen; then
245817a48c7cSmrg	  if test -z "$libdir"; then
245917a48c7cSmrg	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
246017a48c7cSmrg	    exit $EXIT_FAILURE
246117a48c7cSmrg	  fi
246217a48c7cSmrg	  # Prefer using a static library (so that no silly _DYNAMIC symbols
246317a48c7cSmrg	  # are required to link).
246417a48c7cSmrg	  if test -n "$old_library"; then
246517a48c7cSmrg	    newdlprefiles="$newdlprefiles $dir/$old_library"
246617a48c7cSmrg	  # Otherwise, use the dlname, so that lt_dlopen finds it.
246717a48c7cSmrg	  elif test -n "$dlname"; then
246817a48c7cSmrg	    newdlprefiles="$newdlprefiles $dir/$dlname"
246917a48c7cSmrg	  else
247017a48c7cSmrg	    newdlprefiles="$newdlprefiles $dir/$linklib"
247117a48c7cSmrg	  fi
247217a48c7cSmrg	fi # $pass = dlpreopen
247317a48c7cSmrg
247417a48c7cSmrg	if test -z "$libdir"; then
247517a48c7cSmrg	  # Link the convenience library
247617a48c7cSmrg	  if test "$linkmode" = lib; then
247717a48c7cSmrg	    deplibs="$dir/$old_library $deplibs"
247817a48c7cSmrg	  elif test "$linkmode,$pass" = "prog,link"; then
247917a48c7cSmrg	    compile_deplibs="$dir/$old_library $compile_deplibs"
248017a48c7cSmrg	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
248117a48c7cSmrg	  else
248217a48c7cSmrg	    deplibs="$lib $deplibs" # used for prog,scan pass
248317a48c7cSmrg	  fi
248417a48c7cSmrg	  continue
248517a48c7cSmrg	fi
248617a48c7cSmrg
248717a48c7cSmrg
248817a48c7cSmrg	if test "$linkmode" = prog && test "$pass" != link; then
248917a48c7cSmrg	  newlib_search_path="$newlib_search_path $ladir"
249017a48c7cSmrg	  deplibs="$lib $deplibs"
249117a48c7cSmrg
249217a48c7cSmrg	  linkalldeplibs=no
249317a48c7cSmrg	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
249417a48c7cSmrg	     test "$build_libtool_libs" = no; then
249517a48c7cSmrg	    linkalldeplibs=yes
249617a48c7cSmrg	  fi
249717a48c7cSmrg
249817a48c7cSmrg	  tmp_libs=
249917a48c7cSmrg	  for deplib in $dependency_libs; do
250017a48c7cSmrg	    case $deplib in
250117a48c7cSmrg	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
250217a48c7cSmrg	    esac
250317a48c7cSmrg	    # Need to link against all dependency_libs?
250417a48c7cSmrg	    if test "$linkalldeplibs" = yes; then
250517a48c7cSmrg	      deplibs="$deplib $deplibs"
250617a48c7cSmrg	    else
250717a48c7cSmrg	      # Need to hardcode shared library paths
250817a48c7cSmrg	      # or/and link against static libraries
250917a48c7cSmrg	      newdependency_libs="$deplib $newdependency_libs"
251017a48c7cSmrg	    fi
251117a48c7cSmrg	    if test "X$duplicate_deps" = "Xyes" ; then
251217a48c7cSmrg	      case "$tmp_libs " in
251317a48c7cSmrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
251417a48c7cSmrg	      esac
251517a48c7cSmrg	    fi
251617a48c7cSmrg	    tmp_libs="$tmp_libs $deplib"
251717a48c7cSmrg	  done # for deplib
251817a48c7cSmrg	  continue
251917a48c7cSmrg	fi # $linkmode = prog...
252017a48c7cSmrg
252117a48c7cSmrg	if test "$linkmode,$pass" = "prog,link"; then
252217a48c7cSmrg	  if test -n "$library_names" &&
25238e0ed500Smrg         { { test "$prefer_static_libs" = no ||
25248e0ed500Smrg             test "$prefer_static_libs,$installed" = "built,yes"; } ||
25258e0ed500Smrg           test -z "$old_library"; }; then
252617a48c7cSmrg	    # We need to hardcode the library path
252717a48c7cSmrg	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
252817a48c7cSmrg	      # Make sure the rpath contains only unique directories.
252917a48c7cSmrg	      case "$temp_rpath " in
253017a48c7cSmrg	      *" $dir "*) ;;
253117a48c7cSmrg	      *" $absdir "*) ;;
253217a48c7cSmrg	      *) temp_rpath="$temp_rpath $absdir" ;;
253317a48c7cSmrg	      esac
253417a48c7cSmrg	    fi
253517a48c7cSmrg
253617a48c7cSmrg	    # Hardcode the library path.
253717a48c7cSmrg	    # Skip directories that are in the system default run-time
253817a48c7cSmrg	    # search path.
253917a48c7cSmrg	    case " $sys_lib_dlsearch_path " in
254017a48c7cSmrg	    *" $absdir "*) ;;
254117a48c7cSmrg	    *)
254217a48c7cSmrg	      case "$compile_rpath " in
254317a48c7cSmrg	      *" $absdir "*) ;;
254417a48c7cSmrg	      *) compile_rpath="$compile_rpath $absdir"
254517a48c7cSmrg	      esac
254617a48c7cSmrg	      ;;
254717a48c7cSmrg	    esac
254817a48c7cSmrg	    case " $sys_lib_dlsearch_path " in
254917a48c7cSmrg	    *" $libdir "*) ;;
255017a48c7cSmrg	    *)
255117a48c7cSmrg	      case "$finalize_rpath " in
255217a48c7cSmrg	      *" $libdir "*) ;;
255317a48c7cSmrg	      *) finalize_rpath="$finalize_rpath $libdir"
255417a48c7cSmrg	      esac
255517a48c7cSmrg	      ;;
255617a48c7cSmrg	    esac
255717a48c7cSmrg	  fi # $linkmode,$pass = prog,link...
255817a48c7cSmrg
255917a48c7cSmrg	  if test "$alldeplibs" = yes &&
256017a48c7cSmrg	     { test "$deplibs_check_method" = pass_all ||
256117a48c7cSmrg	       { test "$build_libtool_libs" = yes &&
256217a48c7cSmrg		 test -n "$library_names"; }; }; then
256317a48c7cSmrg	    # We only need to search for static libraries
256417a48c7cSmrg	    continue
256517a48c7cSmrg	  fi
256617a48c7cSmrg	fi
256717a48c7cSmrg
256817a48c7cSmrg	link_static=no # Whether the deplib will be linked statically
256917a48c7cSmrg	use_static_libs=$prefer_static_libs
257017a48c7cSmrg	if test "$use_static_libs" = built && test "$installed" = yes ; then
257117a48c7cSmrg	  use_static_libs=no
257217a48c7cSmrg	fi
257317a48c7cSmrg	if test -n "$library_names" &&
257417a48c7cSmrg	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
257517a48c7cSmrg	  if test "$installed" = no; then
257617a48c7cSmrg	    notinst_deplibs="$notinst_deplibs $lib"
257717a48c7cSmrg	    need_relink=yes
257817a48c7cSmrg	  fi
257917a48c7cSmrg	  # This is a shared library
258017a48c7cSmrg
258117a48c7cSmrg	  # Warn about portability, can't link against -module's on
258217a48c7cSmrg	  # some systems (darwin)
258317a48c7cSmrg	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
258417a48c7cSmrg	    $echo
258517a48c7cSmrg	    if test "$linkmode" = prog; then
258617a48c7cSmrg	      $echo "*** Warning: Linking the executable $output against the loadable module"
258717a48c7cSmrg	    else
258817a48c7cSmrg	      $echo "*** Warning: Linking the shared library $output against the loadable module"
258917a48c7cSmrg	    fi
259017a48c7cSmrg	    $echo "*** $linklib is not portable!"
259117a48c7cSmrg	  fi
259217a48c7cSmrg	  if test "$linkmode" = lib &&
259317a48c7cSmrg	     test "$hardcode_into_libs" = yes; then
259417a48c7cSmrg	    # Hardcode the library path.
259517a48c7cSmrg	    # Skip directories that are in the system default run-time
259617a48c7cSmrg	    # search path.
259717a48c7cSmrg	    case " $sys_lib_dlsearch_path " in
259817a48c7cSmrg	    *" $absdir "*) ;;
259917a48c7cSmrg	    *)
260017a48c7cSmrg	      case "$compile_rpath " in
260117a48c7cSmrg	      *" $absdir "*) ;;
260217a48c7cSmrg	      *) compile_rpath="$compile_rpath $absdir"
260317a48c7cSmrg	      esac
260417a48c7cSmrg	      ;;
260517a48c7cSmrg	    esac
260617a48c7cSmrg	    case " $sys_lib_dlsearch_path " in
260717a48c7cSmrg	    *" $libdir "*) ;;
260817a48c7cSmrg	    *)
260917a48c7cSmrg	      case "$finalize_rpath " in
261017a48c7cSmrg	      *" $libdir "*) ;;
261117a48c7cSmrg	      *) finalize_rpath="$finalize_rpath $libdir"
261217a48c7cSmrg	      esac
261317a48c7cSmrg	      ;;
261417a48c7cSmrg	    esac
261517a48c7cSmrg	  fi
261617a48c7cSmrg
261717a48c7cSmrg	  if test -n "$old_archive_from_expsyms_cmds"; then
261817a48c7cSmrg	    # figure out the soname
261917a48c7cSmrg	    set dummy $library_names
262017a48c7cSmrg	    realname="$2"
262117a48c7cSmrg	    shift; shift
262217a48c7cSmrg	    libname=`eval \\$echo \"$libname_spec\"`
262317a48c7cSmrg	    # use dlname if we got it. it's perfectly good, no?
262417a48c7cSmrg	    if test -n "$dlname"; then
262517a48c7cSmrg	      soname="$dlname"
262617a48c7cSmrg	    elif test -n "$soname_spec"; then
262717a48c7cSmrg	      # bleh windows
262817a48c7cSmrg	      case $host in
262917a48c7cSmrg	      *cygwin* | mingw*)
263017a48c7cSmrg		major=`expr $current - $age`
263117a48c7cSmrg		versuffix="-$major"
263217a48c7cSmrg		;;
263317a48c7cSmrg	      esac
263417a48c7cSmrg	      eval soname=\"$soname_spec\"
263517a48c7cSmrg	    else
263617a48c7cSmrg	      soname="$realname"
263717a48c7cSmrg	    fi
263817a48c7cSmrg
263917a48c7cSmrg	    # Make a new name for the extract_expsyms_cmds to use
264017a48c7cSmrg	    soroot="$soname"
264117a48c7cSmrg	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
264217a48c7cSmrg	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
264317a48c7cSmrg
264417a48c7cSmrg	    # If the library has no export list, then create one now
264517a48c7cSmrg	    if test -f "$output_objdir/$soname-def"; then :
264617a48c7cSmrg	    else
264717a48c7cSmrg	      $show "extracting exported symbol list from \`$soname'"
264817a48c7cSmrg	      save_ifs="$IFS"; IFS='~'
264917a48c7cSmrg	      cmds=$extract_expsyms_cmds
265017a48c7cSmrg	      for cmd in $cmds; do
265117a48c7cSmrg		IFS="$save_ifs"
265217a48c7cSmrg		eval cmd=\"$cmd\"
265317a48c7cSmrg		$show "$cmd"
265417a48c7cSmrg		$run eval "$cmd" || exit $?
265517a48c7cSmrg	      done
265617a48c7cSmrg	      IFS="$save_ifs"
265717a48c7cSmrg	    fi
265817a48c7cSmrg
265917a48c7cSmrg	    # Create $newlib
266017a48c7cSmrg	    if test -f "$output_objdir/$newlib"; then :; else
266117a48c7cSmrg	      $show "generating import library for \`$soname'"
266217a48c7cSmrg	      save_ifs="$IFS"; IFS='~'
266317a48c7cSmrg	      cmds=$old_archive_from_expsyms_cmds
266417a48c7cSmrg	      for cmd in $cmds; do
266517a48c7cSmrg		IFS="$save_ifs"
266617a48c7cSmrg		eval cmd=\"$cmd\"
266717a48c7cSmrg		$show "$cmd"
266817a48c7cSmrg		$run eval "$cmd" || exit $?
266917a48c7cSmrg	      done
267017a48c7cSmrg	      IFS="$save_ifs"
267117a48c7cSmrg	    fi
267217a48c7cSmrg	    # make sure the library variables are pointing to the new library
267317a48c7cSmrg	    dir=$output_objdir
267417a48c7cSmrg	    linklib=$newlib
267517a48c7cSmrg	  fi # test -n "$old_archive_from_expsyms_cmds"
267617a48c7cSmrg
267717a48c7cSmrg	  if test "$linkmode" = prog || test "$mode" != relink; then
267817a48c7cSmrg	    add_shlibpath=
267917a48c7cSmrg	    add_dir=
268017a48c7cSmrg	    add=
268117a48c7cSmrg	    lib_linked=yes
268217a48c7cSmrg	    case $hardcode_action in
268317a48c7cSmrg	    immediate | unsupported)
268417a48c7cSmrg	      if test "$hardcode_direct" = no; then
268517a48c7cSmrg		add="$dir/$linklib"
268617a48c7cSmrg		case $host in
268717a48c7cSmrg		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
268817a48c7cSmrg		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
268917a48c7cSmrg		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
269017a48c7cSmrg		    *-*-unixware7*) add_dir="-L$dir" ;;
269117a48c7cSmrg		  *-*-darwin* )
269217a48c7cSmrg		    # if the lib is a module then we can not link against
269317a48c7cSmrg		    # it, someone is ignoring the new warnings I added
269417a48c7cSmrg		    if /usr/bin/file -L $add 2> /dev/null |
269517a48c7cSmrg                      $EGREP ": [^:]* bundle" >/dev/null ; then
269617a48c7cSmrg		      $echo "** Warning, lib $linklib is a module, not a shared library"
269717a48c7cSmrg		      if test -z "$old_library" ; then
269817a48c7cSmrg		        $echo
269917a48c7cSmrg		        $echo "** And there doesn't seem to be a static archive available"
270017a48c7cSmrg		        $echo "** The link will probably fail, sorry"
270117a48c7cSmrg		      else
270217a48c7cSmrg		        add="$dir/$old_library"
270317a48c7cSmrg		      fi
270417a48c7cSmrg		    fi
270517a48c7cSmrg		esac
270617a48c7cSmrg	      elif test "$hardcode_minus_L" = no; then
270717a48c7cSmrg		case $host in
270817a48c7cSmrg		*-*-sunos*) add_shlibpath="$dir" ;;
270917a48c7cSmrg		esac
271017a48c7cSmrg		add_dir="-L$dir"
271117a48c7cSmrg		add="-l$name"
271217a48c7cSmrg	      elif test "$hardcode_shlibpath_var" = no; then
271317a48c7cSmrg		add_shlibpath="$dir"
271417a48c7cSmrg		add="-l$name"
271517a48c7cSmrg	      else
271617a48c7cSmrg		lib_linked=no
271717a48c7cSmrg	      fi
271817a48c7cSmrg	      ;;
271917a48c7cSmrg	    relink)
272017a48c7cSmrg	      if test "$hardcode_direct" = yes; then
272117a48c7cSmrg		add="$dir/$linklib"
272217a48c7cSmrg	      elif test "$hardcode_minus_L" = yes; then
272317a48c7cSmrg		add_dir="-L$dir"
272417a48c7cSmrg		# Try looking first in the location we're being installed to.
272517a48c7cSmrg		if test -n "$inst_prefix_dir"; then
272617a48c7cSmrg		  case $libdir in
272717a48c7cSmrg		    [\\/]*)
272817a48c7cSmrg		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
272917a48c7cSmrg		      ;;
273017a48c7cSmrg		  esac
273117a48c7cSmrg		fi
273217a48c7cSmrg		add="-l$name"
273317a48c7cSmrg	      elif test "$hardcode_shlibpath_var" = yes; then
273417a48c7cSmrg		add_shlibpath="$dir"
273517a48c7cSmrg		add="-l$name"
273617a48c7cSmrg	      else
273717a48c7cSmrg		lib_linked=no
273817a48c7cSmrg	      fi
273917a48c7cSmrg	      ;;
274017a48c7cSmrg	    *) lib_linked=no ;;
274117a48c7cSmrg	    esac
274217a48c7cSmrg
274317a48c7cSmrg	    if test "$lib_linked" != yes; then
274417a48c7cSmrg	      $echo "$modename: configuration error: unsupported hardcode properties"
274517a48c7cSmrg	      exit $EXIT_FAILURE
274617a48c7cSmrg	    fi
274717a48c7cSmrg
274817a48c7cSmrg	    if test -n "$add_shlibpath"; then
274917a48c7cSmrg	      case :$compile_shlibpath: in
275017a48c7cSmrg	      *":$add_shlibpath:"*) ;;
275117a48c7cSmrg	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
275217a48c7cSmrg	      esac
275317a48c7cSmrg	    fi
275417a48c7cSmrg	    if test "$linkmode" = prog; then
275517a48c7cSmrg	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
275617a48c7cSmrg	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
275717a48c7cSmrg	    else
275817a48c7cSmrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
275917a48c7cSmrg	      test -n "$add" && deplibs="$add $deplibs"
276017a48c7cSmrg	      if test "$hardcode_direct" != yes && \
276117a48c7cSmrg		 test "$hardcode_minus_L" != yes && \
276217a48c7cSmrg		 test "$hardcode_shlibpath_var" = yes; then
276317a48c7cSmrg		case :$finalize_shlibpath: in
276417a48c7cSmrg		*":$libdir:"*) ;;
276517a48c7cSmrg		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
276617a48c7cSmrg		esac
276717a48c7cSmrg	      fi
276817a48c7cSmrg	    fi
276917a48c7cSmrg	  fi
277017a48c7cSmrg
277117a48c7cSmrg	  if test "$linkmode" = prog || test "$mode" = relink; then
277217a48c7cSmrg	    add_shlibpath=
277317a48c7cSmrg	    add_dir=
277417a48c7cSmrg	    add=
277517a48c7cSmrg	    # Finalize command for both is simple: just hardcode it.
277617a48c7cSmrg	    if test "$hardcode_direct" = yes; then
277717a48c7cSmrg	      add="$libdir/$linklib"
277817a48c7cSmrg	    elif test "$hardcode_minus_L" = yes; then
277917a48c7cSmrg	      add_dir="-L$libdir"
278017a48c7cSmrg	      add="-l$name"
278117a48c7cSmrg	    elif test "$hardcode_shlibpath_var" = yes; then
278217a48c7cSmrg	      case :$finalize_shlibpath: in
278317a48c7cSmrg	      *":$libdir:"*) ;;
278417a48c7cSmrg	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
278517a48c7cSmrg	      esac
278617a48c7cSmrg	      add="-l$name"
278717a48c7cSmrg	    elif test "$hardcode_automatic" = yes; then
278817a48c7cSmrg	      if test -n "$inst_prefix_dir" &&
278917a48c7cSmrg		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
279017a48c7cSmrg	        add="$inst_prefix_dir$libdir/$linklib"
279117a48c7cSmrg	      else
279217a48c7cSmrg	        add="$libdir/$linklib"
279317a48c7cSmrg	      fi
279417a48c7cSmrg	    else
279517a48c7cSmrg	      # We cannot seem to hardcode it, guess we'll fake it.
279617a48c7cSmrg	      add_dir="-L$libdir"
279717a48c7cSmrg	      # Try looking first in the location we're being installed to.
279817a48c7cSmrg	      if test -n "$inst_prefix_dir"; then
279917a48c7cSmrg		case $libdir in
280017a48c7cSmrg		  [\\/]*)
280117a48c7cSmrg		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
280217a48c7cSmrg		    ;;
280317a48c7cSmrg		esac
280417a48c7cSmrg	      fi
280517a48c7cSmrg	      add="-l$name"
280617a48c7cSmrg	    fi
280717a48c7cSmrg
280817a48c7cSmrg	    if test "$linkmode" = prog; then
280917a48c7cSmrg	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
281017a48c7cSmrg	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
281117a48c7cSmrg	    else
281217a48c7cSmrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
281317a48c7cSmrg	      test -n "$add" && deplibs="$add $deplibs"
281417a48c7cSmrg	    fi
281517a48c7cSmrg	  fi
281617a48c7cSmrg	elif test "$linkmode" = prog; then
281717a48c7cSmrg	  # Here we assume that one of hardcode_direct or hardcode_minus_L
281817a48c7cSmrg	  # is not unsupported.  This is valid on all known static and
281917a48c7cSmrg	  # shared platforms.
282017a48c7cSmrg	  if test "$hardcode_direct" != unsupported; then
282117a48c7cSmrg	    test -n "$old_library" && linklib="$old_library"
282217a48c7cSmrg	    compile_deplibs="$dir/$linklib $compile_deplibs"
282317a48c7cSmrg	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
282417a48c7cSmrg	  else
282517a48c7cSmrg	    compile_deplibs="-l$name -L$dir $compile_deplibs"
282617a48c7cSmrg	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
282717a48c7cSmrg	  fi
282817a48c7cSmrg	elif test "$build_libtool_libs" = yes; then
282917a48c7cSmrg	  # Not a shared library
283017a48c7cSmrg	  if test "$deplibs_check_method" != pass_all; then
283117a48c7cSmrg	    # We're trying link a shared library against a static one
283217a48c7cSmrg	    # but the system doesn't support it.
283317a48c7cSmrg
283417a48c7cSmrg	    # Just print a warning and add the library to dependency_libs so
283517a48c7cSmrg	    # that the program can be linked against the static library.
283617a48c7cSmrg	    $echo
283717a48c7cSmrg	    $echo "*** Warning: This system can not link to static lib archive $lib."
283817a48c7cSmrg	    $echo "*** I have the capability to make that library automatically link in when"
283917a48c7cSmrg	    $echo "*** you link to this library.  But I can only do this if you have a"
284017a48c7cSmrg	    $echo "*** shared version of the library, which you do not appear to have."
284117a48c7cSmrg	    if test "$module" = yes; then
284217a48c7cSmrg	      $echo "*** But as you try to build a module library, libtool will still create "
284317a48c7cSmrg	      $echo "*** a static module, that should work as long as the dlopening application"
284417a48c7cSmrg	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
284517a48c7cSmrg	      if test -z "$global_symbol_pipe"; then
284617a48c7cSmrg		$echo
284717a48c7cSmrg		$echo "*** However, this would only work if libtool was able to extract symbol"
284817a48c7cSmrg		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
284917a48c7cSmrg		$echo "*** not find such a program.  So, this module is probably useless."
285017a48c7cSmrg		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
285117a48c7cSmrg	      fi
285217a48c7cSmrg	      if test "$build_old_libs" = no; then
285317a48c7cSmrg		build_libtool_libs=module
285417a48c7cSmrg		build_old_libs=yes
285517a48c7cSmrg	      else
285617a48c7cSmrg		build_libtool_libs=no
285717a48c7cSmrg	      fi
285817a48c7cSmrg	    fi
285917a48c7cSmrg	  else
286017a48c7cSmrg	    deplibs="$dir/$old_library $deplibs"
286117a48c7cSmrg	    link_static=yes
286217a48c7cSmrg	  fi
286317a48c7cSmrg	fi # link shared/static library?
286417a48c7cSmrg
286517a48c7cSmrg	if test "$linkmode" = lib; then
286617a48c7cSmrg	  if test -n "$dependency_libs" &&
286717a48c7cSmrg	     { test "$hardcode_into_libs" != yes ||
286817a48c7cSmrg	       test "$build_old_libs" = yes ||
286917a48c7cSmrg	       test "$link_static" = yes; }; then
287017a48c7cSmrg	    # Extract -R from dependency_libs
287117a48c7cSmrg	    temp_deplibs=
287217a48c7cSmrg	    for libdir in $dependency_libs; do
287317a48c7cSmrg	      case $libdir in
287417a48c7cSmrg	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
287517a48c7cSmrg		   case " $xrpath " in
287617a48c7cSmrg		   *" $temp_xrpath "*) ;;
287717a48c7cSmrg		   *) xrpath="$xrpath $temp_xrpath";;
287817a48c7cSmrg		   esac;;
287917a48c7cSmrg	      *) temp_deplibs="$temp_deplibs $libdir";;
288017a48c7cSmrg	      esac
288117a48c7cSmrg	    done
288217a48c7cSmrg	    dependency_libs="$temp_deplibs"
288317a48c7cSmrg	  fi
288417a48c7cSmrg
288517a48c7cSmrg	  newlib_search_path="$newlib_search_path $absdir"
288617a48c7cSmrg	  # Link against this library
288717a48c7cSmrg	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
288817a48c7cSmrg	  # ... and its dependency_libs
288917a48c7cSmrg	  tmp_libs=
289017a48c7cSmrg	  for deplib in $dependency_libs; do
289117a48c7cSmrg	    newdependency_libs="$deplib $newdependency_libs"
289217a48c7cSmrg	    if test "X$duplicate_deps" = "Xyes" ; then
289317a48c7cSmrg	      case "$tmp_libs " in
289417a48c7cSmrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
289517a48c7cSmrg	      esac
289617a48c7cSmrg	    fi
289717a48c7cSmrg	    tmp_libs="$tmp_libs $deplib"
289817a48c7cSmrg	  done
289917a48c7cSmrg
290017a48c7cSmrg	  if test "$link_all_deplibs" != no; then
290117a48c7cSmrg	    # Add the search paths of all dependency libraries
290217a48c7cSmrg	    for deplib in $dependency_libs; do
290317a48c7cSmrg	      case $deplib in
290417a48c7cSmrg	      -L*) path="$deplib" ;;
290517a48c7cSmrg	      *.la)
290617a48c7cSmrg		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
290717a48c7cSmrg		test "X$dir" = "X$deplib" && dir="."
290817a48c7cSmrg		# We need an absolute path.
290917a48c7cSmrg		case $dir in
291017a48c7cSmrg		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
291117a48c7cSmrg		*)
291217a48c7cSmrg		  absdir=`cd "$dir" && pwd`
291317a48c7cSmrg		  if test -z "$absdir"; then
291417a48c7cSmrg		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
291517a48c7cSmrg		    absdir="$dir"
291617a48c7cSmrg		  fi
291717a48c7cSmrg		  ;;
291817a48c7cSmrg		esac
291917a48c7cSmrg		if grep "^installed=no" $deplib > /dev/null; then
292017a48c7cSmrg		  path="$absdir/$objdir"
292117a48c7cSmrg		else
292217a48c7cSmrg		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
292317a48c7cSmrg		  if test -z "$libdir"; then
292417a48c7cSmrg		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
292517a48c7cSmrg		    exit $EXIT_FAILURE
292617a48c7cSmrg		  fi
292717a48c7cSmrg		  if test "$absdir" != "$libdir"; then
292817a48c7cSmrg		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
292917a48c7cSmrg		  fi
293017a48c7cSmrg		  path="$absdir"
293117a48c7cSmrg		fi
293217a48c7cSmrg		depdepl=
293317a48c7cSmrg		case $host in
293417a48c7cSmrg		*-*-darwin*)
293517a48c7cSmrg		  # we do not want to link against static libs,
293617a48c7cSmrg		  # but need to link against shared
293717a48c7cSmrg		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
293817a48c7cSmrg		  if test -n "$deplibrary_names" ; then
293917a48c7cSmrg		    for tmp in $deplibrary_names ; do
294017a48c7cSmrg		      depdepl=$tmp
294117a48c7cSmrg		    done
294217a48c7cSmrg		    if test -f "$path/$depdepl" ; then
294317a48c7cSmrg		      depdepl="$path/$depdepl"
294417a48c7cSmrg		    fi
294517a48c7cSmrg		    # do not add paths which are already there
294617a48c7cSmrg		    case " $newlib_search_path " in
294717a48c7cSmrg		    *" $path "*) ;;
294817a48c7cSmrg		    *) newlib_search_path="$newlib_search_path $path";;
294917a48c7cSmrg		    esac
295017a48c7cSmrg		  fi
295117a48c7cSmrg		  path=""
295217a48c7cSmrg		  ;;
295317a48c7cSmrg		*)
295417a48c7cSmrg		  path="-L$path"
295517a48c7cSmrg		  ;;
295617a48c7cSmrg		esac
295717a48c7cSmrg		;;
295817a48c7cSmrg	      -l*)
295917a48c7cSmrg		case $host in
296017a48c7cSmrg		*-*-darwin*)
296117a48c7cSmrg		  # Again, we only want to link against shared libraries
296217a48c7cSmrg		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
296317a48c7cSmrg		  for tmp in $newlib_search_path ; do
296417a48c7cSmrg		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
296517a48c7cSmrg		      eval depdepl="$tmp/lib$tmp_libs.dylib"
296617a48c7cSmrg		      break
296717a48c7cSmrg		    fi
296817a48c7cSmrg		  done
296917a48c7cSmrg		  path=""
297017a48c7cSmrg		  ;;
297117a48c7cSmrg		*) continue ;;
297217a48c7cSmrg		esac
297317a48c7cSmrg		;;
297417a48c7cSmrg	      *) continue ;;
297517a48c7cSmrg	      esac
297617a48c7cSmrg	      case " $deplibs " in
297717a48c7cSmrg	      *" $path "*) ;;
297817a48c7cSmrg	      *) deplibs="$path $deplibs" ;;
297917a48c7cSmrg	      esac
298017a48c7cSmrg	      case " $deplibs " in
298117a48c7cSmrg	      *" $depdepl "*) ;;
298217a48c7cSmrg	      *) deplibs="$depdepl $deplibs" ;;
298317a48c7cSmrg	      esac
298417a48c7cSmrg	    done
298517a48c7cSmrg	  fi # link_all_deplibs != no
298617a48c7cSmrg	fi # linkmode = lib
298717a48c7cSmrg      done # for deplib in $libs
298817a48c7cSmrg      dependency_libs="$newdependency_libs"
298917a48c7cSmrg      if test "$pass" = dlpreopen; then
299017a48c7cSmrg	# Link the dlpreopened libraries before other libraries
299117a48c7cSmrg	for deplib in $save_deplibs; do
299217a48c7cSmrg	  deplibs="$deplib $deplibs"
299317a48c7cSmrg	done
299417a48c7cSmrg      fi
299517a48c7cSmrg      if test "$pass" != dlopen; then
299617a48c7cSmrg	if test "$pass" != conv; then
299717a48c7cSmrg	  # Make sure lib_search_path contains only unique directories.
299817a48c7cSmrg	  lib_search_path=
299917a48c7cSmrg	  for dir in $newlib_search_path; do
300017a48c7cSmrg	    case "$lib_search_path " in
300117a48c7cSmrg	    *" $dir "*) ;;
300217a48c7cSmrg	    *) lib_search_path="$lib_search_path $dir" ;;
300317a48c7cSmrg	    esac
300417a48c7cSmrg	  done
300517a48c7cSmrg	  newlib_search_path=
300617a48c7cSmrg	fi
300717a48c7cSmrg
300817a48c7cSmrg	if test "$linkmode,$pass" != "prog,link"; then
300917a48c7cSmrg	  vars="deplibs"
301017a48c7cSmrg	else
301117a48c7cSmrg	  vars="compile_deplibs finalize_deplibs"
301217a48c7cSmrg	fi
301317a48c7cSmrg	for var in $vars dependency_libs; do
301417a48c7cSmrg	  # Add libraries to $var in reverse order
301517a48c7cSmrg	  eval tmp_libs=\"\$$var\"
301617a48c7cSmrg	  new_libs=
301717a48c7cSmrg	  for deplib in $tmp_libs; do
301817a48c7cSmrg	    # FIXME: Pedantically, this is the right thing to do, so
301917a48c7cSmrg	    #        that some nasty dependency loop isn't accidentally
302017a48c7cSmrg	    #        broken:
302117a48c7cSmrg	    #new_libs="$deplib $new_libs"
302217a48c7cSmrg	    # Pragmatically, this seems to cause very few problems in
302317a48c7cSmrg	    # practice:
302417a48c7cSmrg	    case $deplib in
302517a48c7cSmrg	    -L*) new_libs="$deplib $new_libs" ;;
302617a48c7cSmrg	    -R*) ;;
302717a48c7cSmrg	    *)
302817a48c7cSmrg	      # And here is the reason: when a library appears more
302917a48c7cSmrg	      # than once as an explicit dependence of a library, or
303017a48c7cSmrg	      # is implicitly linked in more than once by the
303117a48c7cSmrg	      # compiler, it is considered special, and multiple
303217a48c7cSmrg	      # occurrences thereof are not removed.  Compare this
303317a48c7cSmrg	      # with having the same library being listed as a
303417a48c7cSmrg	      # dependency of multiple other libraries: in this case,
303517a48c7cSmrg	      # we know (pedantically, we assume) the library does not
303617a48c7cSmrg	      # need to be listed more than once, so we keep only the
303717a48c7cSmrg	      # last copy.  This is not always right, but it is rare
303817a48c7cSmrg	      # enough that we require users that really mean to play
303917a48c7cSmrg	      # such unportable linking tricks to link the library
304017a48c7cSmrg	      # using -Wl,-lname, so that libtool does not consider it
304117a48c7cSmrg	      # for duplicate removal.
304217a48c7cSmrg	      case " $specialdeplibs " in
304317a48c7cSmrg	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
304417a48c7cSmrg	      *)
304517a48c7cSmrg		case " $new_libs " in
304617a48c7cSmrg		*" $deplib "*) ;;
304717a48c7cSmrg		*) new_libs="$deplib $new_libs" ;;
304817a48c7cSmrg		esac
304917a48c7cSmrg		;;
305017a48c7cSmrg	      esac
305117a48c7cSmrg	      ;;
305217a48c7cSmrg	    esac
305317a48c7cSmrg	  done
305417a48c7cSmrg	  tmp_libs=
305517a48c7cSmrg	  for deplib in $new_libs; do
305617a48c7cSmrg	    case $deplib in
305717a48c7cSmrg	    -L*)
305817a48c7cSmrg	      case " $tmp_libs " in
305917a48c7cSmrg	      *" $deplib "*) ;;
306017a48c7cSmrg	      *) tmp_libs="$tmp_libs $deplib" ;;
306117a48c7cSmrg	      esac
306217a48c7cSmrg	      ;;
306317a48c7cSmrg	    *) tmp_libs="$tmp_libs $deplib" ;;
306417a48c7cSmrg	    esac
306517a48c7cSmrg	  done
306617a48c7cSmrg	  eval $var=\"$tmp_libs\"
306717a48c7cSmrg	done # for var
306817a48c7cSmrg      fi
306917a48c7cSmrg      # Last step: remove runtime libs from dependency_libs
307017a48c7cSmrg      # (they stay in deplibs)
307117a48c7cSmrg      tmp_libs=
307217a48c7cSmrg      for i in $dependency_libs ; do
307317a48c7cSmrg	case " $predeps $postdeps $compiler_lib_search_path " in
307417a48c7cSmrg	*" $i "*)
307517a48c7cSmrg	  i=""
307617a48c7cSmrg	  ;;
307717a48c7cSmrg	esac
307817a48c7cSmrg	if test -n "$i" ; then
307917a48c7cSmrg	  tmp_libs="$tmp_libs $i"
308017a48c7cSmrg	fi
308117a48c7cSmrg      done
308217a48c7cSmrg      dependency_libs=$tmp_libs
308317a48c7cSmrg    done # for pass
308417a48c7cSmrg    if test "$linkmode" = prog; then
308517a48c7cSmrg      dlfiles="$newdlfiles"
308617a48c7cSmrg      dlprefiles="$newdlprefiles"
308717a48c7cSmrg    fi
308817a48c7cSmrg
308917a48c7cSmrg    case $linkmode in
309017a48c7cSmrg    oldlib)
309117a48c7cSmrg      if test -n "$deplibs"; then
309217a48c7cSmrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
309317a48c7cSmrg      fi
309417a48c7cSmrg
309517a48c7cSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
309617a48c7cSmrg	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
309717a48c7cSmrg      fi
309817a48c7cSmrg
309917a48c7cSmrg      if test -n "$rpath"; then
310017a48c7cSmrg	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
310117a48c7cSmrg      fi
310217a48c7cSmrg
310317a48c7cSmrg      if test -n "$xrpath"; then
310417a48c7cSmrg	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
310517a48c7cSmrg      fi
310617a48c7cSmrg
310717a48c7cSmrg      if test -n "$vinfo"; then
310817a48c7cSmrg	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
310917a48c7cSmrg      fi
311017a48c7cSmrg
311117a48c7cSmrg      if test -n "$release"; then
311217a48c7cSmrg	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
311317a48c7cSmrg      fi
311417a48c7cSmrg
311517a48c7cSmrg      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
311617a48c7cSmrg	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
311717a48c7cSmrg      fi
311817a48c7cSmrg
311917a48c7cSmrg      # Now set the variables for building old libraries.
312017a48c7cSmrg      build_libtool_libs=no
312117a48c7cSmrg      oldlibs="$output"
312217a48c7cSmrg      objs="$objs$old_deplibs"
312317a48c7cSmrg      ;;
312417a48c7cSmrg
312517a48c7cSmrg    lib)
312617a48c7cSmrg      # Make sure we only generate libraries of the form `libNAME.la'.
312717a48c7cSmrg      case $outputname in
312817a48c7cSmrg      lib*)
312917a48c7cSmrg	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
313017a48c7cSmrg	eval shared_ext=\"$shrext_cmds\"
313117a48c7cSmrg	eval libname=\"$libname_spec\"
313217a48c7cSmrg	;;
313317a48c7cSmrg      *)
313417a48c7cSmrg	if test "$module" = no; then
313517a48c7cSmrg	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
313617a48c7cSmrg	  $echo "$help" 1>&2
313717a48c7cSmrg	  exit $EXIT_FAILURE
313817a48c7cSmrg	fi
313917a48c7cSmrg	if test "$need_lib_prefix" != no; then
314017a48c7cSmrg	  # Add the "lib" prefix for modules if required
314117a48c7cSmrg	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
314217a48c7cSmrg	  eval shared_ext=\"$shrext_cmds\"
314317a48c7cSmrg	  eval libname=\"$libname_spec\"
314417a48c7cSmrg	else
314517a48c7cSmrg	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
314617a48c7cSmrg	fi
314717a48c7cSmrg	;;
314817a48c7cSmrg      esac
314917a48c7cSmrg
315017a48c7cSmrg      if test -n "$objs"; then
315117a48c7cSmrg	if test "$deplibs_check_method" != pass_all; then
315217a48c7cSmrg	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
315317a48c7cSmrg	  exit $EXIT_FAILURE
315417a48c7cSmrg	else
315517a48c7cSmrg	  $echo
315617a48c7cSmrg	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
315717a48c7cSmrg	  $echo "*** objects $objs is not portable!"
315817a48c7cSmrg	  libobjs="$libobjs $objs"
315917a48c7cSmrg	fi
316017a48c7cSmrg      fi
316117a48c7cSmrg
316217a48c7cSmrg      if test "$dlself" != no; then
316317a48c7cSmrg	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
316417a48c7cSmrg      fi
316517a48c7cSmrg
316617a48c7cSmrg      set dummy $rpath
316717a48c7cSmrg      if test "$#" -gt 2; then
316817a48c7cSmrg	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
316917a48c7cSmrg      fi
317017a48c7cSmrg      install_libdir="$2"
317117a48c7cSmrg
317217a48c7cSmrg      oldlibs=
317317a48c7cSmrg      if test -z "$rpath"; then
317417a48c7cSmrg	if test "$build_libtool_libs" = yes; then
317517a48c7cSmrg	  # Building a libtool convenience library.
317617a48c7cSmrg	  # Some compilers have problems with a `.al' extension so
317717a48c7cSmrg	  # convenience libraries should have the same extension an
317817a48c7cSmrg	  # archive normally would.
317917a48c7cSmrg	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
318017a48c7cSmrg	  build_libtool_libs=convenience
318117a48c7cSmrg	  build_old_libs=yes
318217a48c7cSmrg	fi
318317a48c7cSmrg
318417a48c7cSmrg	if test -n "$vinfo"; then
318517a48c7cSmrg	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
318617a48c7cSmrg	fi
318717a48c7cSmrg
318817a48c7cSmrg	if test -n "$release"; then
318917a48c7cSmrg	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
319017a48c7cSmrg	fi
319117a48c7cSmrg      else
319217a48c7cSmrg
319317a48c7cSmrg	# Parse the version information argument.
319417a48c7cSmrg	save_ifs="$IFS"; IFS=':'
319517a48c7cSmrg	set dummy $vinfo 0 0 0
319617a48c7cSmrg	IFS="$save_ifs"
319717a48c7cSmrg
319817a48c7cSmrg	if test -n "$8"; then
319917a48c7cSmrg	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
320017a48c7cSmrg	  $echo "$help" 1>&2
320117a48c7cSmrg	  exit $EXIT_FAILURE
320217a48c7cSmrg	fi
320317a48c7cSmrg
320417a48c7cSmrg	# convert absolute version numbers to libtool ages
320517a48c7cSmrg	# this retains compatibility with .la files and attempts
320617a48c7cSmrg	# to make the code below a bit more comprehensible
320717a48c7cSmrg
320817a48c7cSmrg	case $vinfo_number in
320917a48c7cSmrg	yes)
321017a48c7cSmrg	  number_major="$2"
321117a48c7cSmrg	  number_minor="$3"
321217a48c7cSmrg	  number_revision="$4"
321317a48c7cSmrg	  #
321417a48c7cSmrg	  # There are really only two kinds -- those that
321517a48c7cSmrg	  # use the current revision as the major version
321617a48c7cSmrg	  # and those that subtract age and use age as
321717a48c7cSmrg	  # a minor version.  But, then there is irix
321817a48c7cSmrg	  # which has an extra 1 added just for fun
321917a48c7cSmrg	  #
322017a48c7cSmrg	  case $version_type in
32218e0ed500Smrg	  darwin|linux|osf|windows|none)
322217a48c7cSmrg	    current=`expr $number_major + $number_minor`
322317a48c7cSmrg	    age="$number_minor"
322417a48c7cSmrg	    revision="$number_revision"
322517a48c7cSmrg	    ;;
322617a48c7cSmrg	  freebsd-aout|freebsd-elf|sunos)
322717a48c7cSmrg	    current="$number_major"
322817a48c7cSmrg	    revision="$number_minor"
322917a48c7cSmrg	    age="0"
323017a48c7cSmrg	    ;;
323117a48c7cSmrg	  irix|nonstopux)
323217a48c7cSmrg	    current=`expr $number_major + $number_minor - 1`
323317a48c7cSmrg	    age="$number_minor"
323417a48c7cSmrg	    revision="$number_minor"
323517a48c7cSmrg	    ;;
323617a48c7cSmrg	  esac
323717a48c7cSmrg	  ;;
323817a48c7cSmrg	no)
323917a48c7cSmrg	  current="$2"
324017a48c7cSmrg	  revision="$3"
324117a48c7cSmrg	  age="$4"
324217a48c7cSmrg	  ;;
324317a48c7cSmrg	esac
324417a48c7cSmrg
324517a48c7cSmrg	# Check that each of the things are valid numbers.
324617a48c7cSmrg	case $current in
324717a48c7cSmrg	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]) ;;
324817a48c7cSmrg	*)
324917a48c7cSmrg	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
325017a48c7cSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
325117a48c7cSmrg	  exit $EXIT_FAILURE
325217a48c7cSmrg	  ;;
325317a48c7cSmrg	esac
325417a48c7cSmrg
325517a48c7cSmrg	case $revision in
325617a48c7cSmrg	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]) ;;
325717a48c7cSmrg	*)
325817a48c7cSmrg	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
325917a48c7cSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
326017a48c7cSmrg	  exit $EXIT_FAILURE
326117a48c7cSmrg	  ;;
326217a48c7cSmrg	esac
326317a48c7cSmrg
326417a48c7cSmrg	case $age in
326517a48c7cSmrg	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]) ;;
326617a48c7cSmrg	*)
326717a48c7cSmrg	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
326817a48c7cSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
326917a48c7cSmrg	  exit $EXIT_FAILURE
327017a48c7cSmrg	  ;;
327117a48c7cSmrg	esac
327217a48c7cSmrg
327317a48c7cSmrg	if test "$age" -gt "$current"; then
327417a48c7cSmrg	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
327517a48c7cSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
327617a48c7cSmrg	  exit $EXIT_FAILURE
327717a48c7cSmrg	fi
327817a48c7cSmrg
327917a48c7cSmrg	# Calculate the version variables.
328017a48c7cSmrg	major=
328117a48c7cSmrg	versuffix=
328217a48c7cSmrg	verstring=
328317a48c7cSmrg	case $version_type in
328417a48c7cSmrg	none) ;;
328517a48c7cSmrg
328617a48c7cSmrg	darwin)
328717a48c7cSmrg	  # Like Linux, but with the current version available in
328817a48c7cSmrg	  # verstring for coding it into the library header
328917a48c7cSmrg	  major=.`expr $current - $age`
329017a48c7cSmrg	  versuffix="$major.$age.$revision"
329117a48c7cSmrg	  # Darwin ld doesn't like 0 for these options...
329217a48c7cSmrg	  minor_current=`expr $current + 1`
329317a48c7cSmrg	  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
329417a48c7cSmrg	  ;;
329517a48c7cSmrg
329617a48c7cSmrg	freebsd-aout)
329717a48c7cSmrg	  major=".$current"
329817a48c7cSmrg	  versuffix=".$current.$revision";
329917a48c7cSmrg	  ;;
330017a48c7cSmrg
330117a48c7cSmrg	freebsd-elf)
330217a48c7cSmrg	  major=".$current"
330317a48c7cSmrg	  versuffix=".$current";
330417a48c7cSmrg	  ;;
330517a48c7cSmrg
330617a48c7cSmrg	irix | nonstopux)
330717a48c7cSmrg	  major=`expr $current - $age + 1`
330817a48c7cSmrg
330917a48c7cSmrg	  case $version_type in
331017a48c7cSmrg	    nonstopux) verstring_prefix=nonstopux ;;
331117a48c7cSmrg	    *)         verstring_prefix=sgi ;;
331217a48c7cSmrg	  esac
331317a48c7cSmrg	  verstring="$verstring_prefix$major.$revision"
331417a48c7cSmrg
331517a48c7cSmrg	  # Add in all the interfaces that we are compatible with.
331617a48c7cSmrg	  loop=$revision
331717a48c7cSmrg	  while test "$loop" -ne 0; do
331817a48c7cSmrg	    iface=`expr $revision - $loop`
331917a48c7cSmrg	    loop=`expr $loop - 1`
332017a48c7cSmrg	    verstring="$verstring_prefix$major.$iface:$verstring"
332117a48c7cSmrg	  done
332217a48c7cSmrg
332317a48c7cSmrg	  # Before this point, $major must not contain `.'.
332417a48c7cSmrg	  major=.$major
332517a48c7cSmrg	  versuffix="$major.$revision"
332617a48c7cSmrg	  ;;
332717a48c7cSmrg
332817a48c7cSmrg	linux)
332917a48c7cSmrg	  major=.`expr $current - $age`
333017a48c7cSmrg	  versuffix="$major.$age.$revision"
333117a48c7cSmrg	  ;;
333217a48c7cSmrg
333317a48c7cSmrg	osf)
333417a48c7cSmrg	  major=.`expr $current - $age`
333517a48c7cSmrg	  versuffix=".$current.$age.$revision"
333617a48c7cSmrg	  verstring="$current.$age.$revision"
333717a48c7cSmrg
333817a48c7cSmrg	  # Add in all the interfaces that we are compatible with.
333917a48c7cSmrg	  loop=$age
334017a48c7cSmrg	  while test "$loop" -ne 0; do
334117a48c7cSmrg	    iface=`expr $current - $loop`
334217a48c7cSmrg	    loop=`expr $loop - 1`
334317a48c7cSmrg	    verstring="$verstring:${iface}.0"
334417a48c7cSmrg	  done
334517a48c7cSmrg
334617a48c7cSmrg	  # Make executables depend on our current version.
334717a48c7cSmrg	  verstring="$verstring:${current}.0"
334817a48c7cSmrg	  ;;
334917a48c7cSmrg
335017a48c7cSmrg	sunos)
335117a48c7cSmrg	  major=".$current"
335217a48c7cSmrg	  versuffix=".$current.$revision"
335317a48c7cSmrg	  ;;
335417a48c7cSmrg
335517a48c7cSmrg	windows)
335617a48c7cSmrg	  # Use '-' rather than '.', since we only want one
335717a48c7cSmrg	  # extension on DOS 8.3 filesystems.
335817a48c7cSmrg	  major=`expr $current - $age`
335917a48c7cSmrg	  versuffix="-$major"
336017a48c7cSmrg	  ;;
336117a48c7cSmrg
336217a48c7cSmrg	*)
336317a48c7cSmrg	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
336417a48c7cSmrg	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
336517a48c7cSmrg	  exit $EXIT_FAILURE
336617a48c7cSmrg	  ;;
336717a48c7cSmrg	esac
336817a48c7cSmrg
336917a48c7cSmrg	# Clear the version info if we defaulted, and they specified a release.
337017a48c7cSmrg	if test -z "$vinfo" && test -n "$release"; then
337117a48c7cSmrg	  major=
337217a48c7cSmrg	  case $version_type in
337317a48c7cSmrg	  darwin)
337417a48c7cSmrg	    # we can't check for "0.0" in archive_cmds due to quoting
337517a48c7cSmrg	    # problems, so we reset it completely
337617a48c7cSmrg	    verstring=
337717a48c7cSmrg	    ;;
337817a48c7cSmrg	  *)
337917a48c7cSmrg	    verstring="0.0"
338017a48c7cSmrg	    ;;
338117a48c7cSmrg	  esac
338217a48c7cSmrg	  if test "$need_version" = no; then
338317a48c7cSmrg	    versuffix=
338417a48c7cSmrg	  else
338517a48c7cSmrg	    versuffix=".0.0"
338617a48c7cSmrg	  fi
338717a48c7cSmrg	fi
338817a48c7cSmrg
338917a48c7cSmrg	# Remove version info from name if versioning should be avoided
339017a48c7cSmrg	if test "$avoid_version" = yes && test "$need_version" = no; then
339117a48c7cSmrg	  major=
339217a48c7cSmrg	  versuffix=
339317a48c7cSmrg	  verstring=""
339417a48c7cSmrg	fi
339517a48c7cSmrg
339617a48c7cSmrg	# Check to see if the archive will have undefined symbols.
339717a48c7cSmrg	if test "$allow_undefined" = yes; then
339817a48c7cSmrg	  if test "$allow_undefined_flag" = unsupported; then
339917a48c7cSmrg	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
340017a48c7cSmrg	    build_libtool_libs=no
340117a48c7cSmrg	    build_old_libs=yes
340217a48c7cSmrg	  fi
340317a48c7cSmrg	else
340417a48c7cSmrg	  # Don't allow undefined symbols.
340517a48c7cSmrg	  allow_undefined_flag="$no_undefined_flag"
340617a48c7cSmrg	fi
340717a48c7cSmrg      fi
340817a48c7cSmrg
340917a48c7cSmrg      if test "$mode" != relink; then
341017a48c7cSmrg	# Remove our outputs, but don't remove object files since they
341117a48c7cSmrg	# may have been created when compiling PIC objects.
341217a48c7cSmrg	removelist=
341317a48c7cSmrg	tempremovelist=`$echo "$output_objdir/*"`
341417a48c7cSmrg	for p in $tempremovelist; do
341517a48c7cSmrg	  case $p in
341617a48c7cSmrg	    *.$objext)
341717a48c7cSmrg	       ;;
341817a48c7cSmrg	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
341917a48c7cSmrg	       if test "X$precious_files_regex" != "X"; then
342017a48c7cSmrg	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
342117a48c7cSmrg	         then
342217a48c7cSmrg		   continue
342317a48c7cSmrg		 fi
342417a48c7cSmrg	       fi
342517a48c7cSmrg	       removelist="$removelist $p"
342617a48c7cSmrg	       ;;
342717a48c7cSmrg	    *) ;;
342817a48c7cSmrg	  esac
342917a48c7cSmrg	done
343017a48c7cSmrg	if test -n "$removelist"; then
343117a48c7cSmrg	  $show "${rm}r $removelist"
343217a48c7cSmrg	  $run ${rm}r $removelist
343317a48c7cSmrg	fi
343417a48c7cSmrg      fi
343517a48c7cSmrg
343617a48c7cSmrg      # Now set the variables for building old libraries.
343717a48c7cSmrg      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
343817a48c7cSmrg	oldlibs="$oldlibs $output_objdir/$libname.$libext"
343917a48c7cSmrg
344017a48c7cSmrg	# Transform .lo files to .o files.
344117a48c7cSmrg	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
344217a48c7cSmrg      fi
344317a48c7cSmrg
344417a48c7cSmrg      # Eliminate all temporary directories.
34458e0ed500Smrg#      for path in $notinst_path; do
34468e0ed500Smrg#	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
34478e0ed500Smrg#	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
34488e0ed500Smrg#	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
34498e0ed500Smrg#      done
345017a48c7cSmrg
345117a48c7cSmrg      if test -n "$xrpath"; then
345217a48c7cSmrg	# If the user specified any rpath flags, then add them.
345317a48c7cSmrg	temp_xrpath=
345417a48c7cSmrg	for libdir in $xrpath; do
345517a48c7cSmrg	  temp_xrpath="$temp_xrpath -R$libdir"
345617a48c7cSmrg	  case "$finalize_rpath " in
345717a48c7cSmrg	  *" $libdir "*) ;;
345817a48c7cSmrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
345917a48c7cSmrg	  esac
346017a48c7cSmrg	done
346117a48c7cSmrg	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
346217a48c7cSmrg	  dependency_libs="$temp_xrpath $dependency_libs"
346317a48c7cSmrg	fi
346417a48c7cSmrg      fi
346517a48c7cSmrg
346617a48c7cSmrg      # Make sure dlfiles contains only unique files that won't be dlpreopened
346717a48c7cSmrg      old_dlfiles="$dlfiles"
346817a48c7cSmrg      dlfiles=
346917a48c7cSmrg      for lib in $old_dlfiles; do
347017a48c7cSmrg	case " $dlprefiles $dlfiles " in
347117a48c7cSmrg	*" $lib "*) ;;
347217a48c7cSmrg	*) dlfiles="$dlfiles $lib" ;;
347317a48c7cSmrg	esac
347417a48c7cSmrg      done
347517a48c7cSmrg
347617a48c7cSmrg      # Make sure dlprefiles contains only unique files
347717a48c7cSmrg      old_dlprefiles="$dlprefiles"
347817a48c7cSmrg      dlprefiles=
347917a48c7cSmrg      for lib in $old_dlprefiles; do
348017a48c7cSmrg	case "$dlprefiles " in
348117a48c7cSmrg	*" $lib "*) ;;
348217a48c7cSmrg	*) dlprefiles="$dlprefiles $lib" ;;
348317a48c7cSmrg	esac
348417a48c7cSmrg      done
348517a48c7cSmrg
348617a48c7cSmrg      if test "$build_libtool_libs" = yes; then
348717a48c7cSmrg	if test -n "$rpath"; then
348817a48c7cSmrg	  case $host in
348917a48c7cSmrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
349017a48c7cSmrg	    # these systems don't actually have a c library (as such)!
349117a48c7cSmrg	    ;;
349217a48c7cSmrg	  *-*-rhapsody* | *-*-darwin1.[012])
349317a48c7cSmrg	    # Rhapsody C library is in the System framework
349417a48c7cSmrg	    deplibs="$deplibs -framework System"
349517a48c7cSmrg	    ;;
349617a48c7cSmrg	  *-*-netbsd*)
349717a48c7cSmrg	    # Don't link with libc until the a.out ld.so is fixed.
349817a48c7cSmrg	    ;;
349917a48c7cSmrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
350017a48c7cSmrg	    # Do not include libc due to us having libc/libc_r.
350117a48c7cSmrg	    ;;
350217a48c7cSmrg	  *-*-sco3.2v5* | *-*-sco5v6*)
350317a48c7cSmrg	    # Causes problems with __ctype
350417a48c7cSmrg	    ;;
350517a48c7cSmrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
350617a48c7cSmrg	    # Compiler inserts libc in the correct place for threads to work
350717a48c7cSmrg	    ;;
350817a48c7cSmrg 	  *)
350917a48c7cSmrg	    # Add libc to deplibs on all other systems if necessary.
351017a48c7cSmrg	    if test "$build_libtool_need_lc" = "yes"; then
351117a48c7cSmrg	      deplibs="$deplibs -lc"
351217a48c7cSmrg	    fi
351317a48c7cSmrg	    ;;
351417a48c7cSmrg	  esac
351517a48c7cSmrg	fi
351617a48c7cSmrg
351717a48c7cSmrg	# Transform deplibs into only deplibs that can be linked in shared.
351817a48c7cSmrg	name_save=$name
351917a48c7cSmrg	libname_save=$libname
352017a48c7cSmrg	release_save=$release
352117a48c7cSmrg	versuffix_save=$versuffix
352217a48c7cSmrg	major_save=$major
352317a48c7cSmrg	# I'm not sure if I'm treating the release correctly.  I think
352417a48c7cSmrg	# release should show up in the -l (ie -lgmp5) so we don't want to
352517a48c7cSmrg	# add it in twice.  Is that correct?
352617a48c7cSmrg	release=""
352717a48c7cSmrg	versuffix=""
352817a48c7cSmrg	major=""
352917a48c7cSmrg	newdeplibs=
353017a48c7cSmrg	droppeddeps=no
353117a48c7cSmrg	case $deplibs_check_method in
353217a48c7cSmrg	pass_all)
353317a48c7cSmrg	  # Don't check for shared/static.  Everything works.
353417a48c7cSmrg	  # This might be a little naive.  We might want to check
353517a48c7cSmrg	  # whether the library exists or not.  But this is on
353617a48c7cSmrg	  # osf3 & osf4 and I'm not really sure... Just
353717a48c7cSmrg	  # implementing what was already the behavior.
353817a48c7cSmrg	  newdeplibs=$deplibs
353917a48c7cSmrg	  ;;
354017a48c7cSmrg	test_compile)
354117a48c7cSmrg	  # This code stresses the "libraries are programs" paradigm to its
354217a48c7cSmrg	  # limits. Maybe even breaks it.  We compile a program, linking it
354317a48c7cSmrg	  # against the deplibs as a proxy for the library.  Then we can check
354417a48c7cSmrg	  # whether they linked in statically or dynamically with ldd.
354517a48c7cSmrg	  $rm conftest.c
354617a48c7cSmrg	  cat > conftest.c <<EOF
354717a48c7cSmrg	  int main() { return 0; }
354817a48c7cSmrgEOF
354917a48c7cSmrg	  $rm conftest
35508e0ed500Smrg      if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
355117a48c7cSmrg	    ldd_output=`ldd conftest`
355217a48c7cSmrg	    for i in $deplibs; do
355317a48c7cSmrg	      name=`expr $i : '-l\(.*\)'`
355417a48c7cSmrg	      # If $name is empty we are operating on a -L argument.
35558e0ed500Smrg              if test "$name" != "" && test "$name" != "0"; then
355617a48c7cSmrg		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
355717a48c7cSmrg		  case " $predeps $postdeps " in
355817a48c7cSmrg		  *" $i "*)
355917a48c7cSmrg		    newdeplibs="$newdeplibs $i"
356017a48c7cSmrg		    i=""
356117a48c7cSmrg		    ;;
356217a48c7cSmrg		  esac
356317a48c7cSmrg	        fi
356417a48c7cSmrg		if test -n "$i" ; then
356517a48c7cSmrg		  libname=`eval \\$echo \"$libname_spec\"`
356617a48c7cSmrg		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
356717a48c7cSmrg		  set dummy $deplib_matches
356817a48c7cSmrg		  deplib_match=$2
356917a48c7cSmrg		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
357017a48c7cSmrg		    newdeplibs="$newdeplibs $i"
357117a48c7cSmrg		  else
357217a48c7cSmrg		    droppeddeps=yes
357317a48c7cSmrg		    $echo
357417a48c7cSmrg		    $echo "*** Warning: dynamic linker does not accept needed library $i."
357517a48c7cSmrg		    $echo "*** I have the capability to make that library automatically link in when"
357617a48c7cSmrg		    $echo "*** you link to this library.  But I can only do this if you have a"
357717a48c7cSmrg		    $echo "*** shared version of the library, which I believe you do not have"
357817a48c7cSmrg		    $echo "*** because a test_compile did reveal that the linker did not use it for"
357917a48c7cSmrg		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
358017a48c7cSmrg		  fi
358117a48c7cSmrg		fi
358217a48c7cSmrg	      else
358317a48c7cSmrg		newdeplibs="$newdeplibs $i"
358417a48c7cSmrg	      fi
358517a48c7cSmrg	    done
358617a48c7cSmrg	  else
358717a48c7cSmrg	    # Error occurred in the first compile.  Let's try to salvage
358817a48c7cSmrg	    # the situation: Compile a separate program for each library.
358917a48c7cSmrg	    for i in $deplibs; do
359017a48c7cSmrg	      name=`expr $i : '-l\(.*\)'`
359117a48c7cSmrg	      # If $name is empty we are operating on a -L argument.
359217a48c7cSmrg              if test "$name" != "" && test "$name" != "0"; then
359317a48c7cSmrg		$rm conftest
35948e0ed500Smrg		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
359517a48c7cSmrg		  ldd_output=`ldd conftest`
359617a48c7cSmrg		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
359717a48c7cSmrg		    case " $predeps $postdeps " in
359817a48c7cSmrg		    *" $i "*)
359917a48c7cSmrg		      newdeplibs="$newdeplibs $i"
360017a48c7cSmrg		      i=""
360117a48c7cSmrg		      ;;
360217a48c7cSmrg		    esac
360317a48c7cSmrg		  fi
360417a48c7cSmrg		  if test -n "$i" ; then
360517a48c7cSmrg		    libname=`eval \\$echo \"$libname_spec\"`
360617a48c7cSmrg		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
360717a48c7cSmrg		    set dummy $deplib_matches
360817a48c7cSmrg		    deplib_match=$2
360917a48c7cSmrg		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
361017a48c7cSmrg		      newdeplibs="$newdeplibs $i"
361117a48c7cSmrg		    else
361217a48c7cSmrg		      droppeddeps=yes
361317a48c7cSmrg		      $echo
361417a48c7cSmrg		      $echo "*** Warning: dynamic linker does not accept needed library $i."
361517a48c7cSmrg		      $echo "*** I have the capability to make that library automatically link in when"
361617a48c7cSmrg		      $echo "*** you link to this library.  But I can only do this if you have a"
361717a48c7cSmrg		      $echo "*** shared version of the library, which you do not appear to have"
361817a48c7cSmrg		      $echo "*** because a test_compile did reveal that the linker did not use this one"
361917a48c7cSmrg		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
362017a48c7cSmrg		    fi
362117a48c7cSmrg		  fi
362217a48c7cSmrg		else
362317a48c7cSmrg		  droppeddeps=yes
362417a48c7cSmrg		  $echo
362517a48c7cSmrg		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
36268e0ed500Smrg		  $echo "*** make it link in!  You will probably need to install it or some"
362717a48c7cSmrg		  $echo "*** library that it depends on before this library will be fully"
362817a48c7cSmrg		  $echo "*** functional.  Installing it before continuing would be even better."
362917a48c7cSmrg		fi
363017a48c7cSmrg	      else
363117a48c7cSmrg		newdeplibs="$newdeplibs $i"
363217a48c7cSmrg	      fi
363317a48c7cSmrg	    done
363417a48c7cSmrg	  fi
363517a48c7cSmrg	  ;;
363617a48c7cSmrg	file_magic*)
363717a48c7cSmrg	  set dummy $deplibs_check_method
363817a48c7cSmrg	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
363917a48c7cSmrg	  for a_deplib in $deplibs; do
364017a48c7cSmrg	    name=`expr $a_deplib : '-l\(.*\)'`
364117a48c7cSmrg	    # If $name is empty we are operating on a -L argument.
364217a48c7cSmrg            if test "$name" != "" && test  "$name" != "0"; then
364317a48c7cSmrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
364417a48c7cSmrg		case " $predeps $postdeps " in
364517a48c7cSmrg		*" $a_deplib "*)
364617a48c7cSmrg		  newdeplibs="$newdeplibs $a_deplib"
364717a48c7cSmrg		  a_deplib=""
364817a48c7cSmrg		  ;;
364917a48c7cSmrg		esac
365017a48c7cSmrg	      fi
365117a48c7cSmrg	      if test -n "$a_deplib" ; then
365217a48c7cSmrg		libname=`eval \\$echo \"$libname_spec\"`
365317a48c7cSmrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
365417a48c7cSmrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
365517a48c7cSmrg		  for potent_lib in $potential_libs; do
365617a48c7cSmrg		      # Follow soft links.
365717a48c7cSmrg		      if ls -lLd "$potent_lib" 2>/dev/null \
365817a48c7cSmrg			 | grep " -> " >/dev/null; then
365917a48c7cSmrg			continue
366017a48c7cSmrg		      fi
366117a48c7cSmrg		      # The statement above tries to avoid entering an
366217a48c7cSmrg		      # endless loop below, in case of cyclic links.
366317a48c7cSmrg		      # We might still enter an endless loop, since a link
366417a48c7cSmrg		      # loop can be closed while we follow links,
366517a48c7cSmrg		      # but so what?
366617a48c7cSmrg		      potlib="$potent_lib"
366717a48c7cSmrg		      while test -h "$potlib" 2>/dev/null; do
366817a48c7cSmrg			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
366917a48c7cSmrg			case $potliblink in
367017a48c7cSmrg			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
367117a48c7cSmrg			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
367217a48c7cSmrg			esac
367317a48c7cSmrg		      done
367417a48c7cSmrg		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
367517a48c7cSmrg			 | ${SED} 10q \
367617a48c7cSmrg			 | $EGREP "$file_magic_regex" > /dev/null; then
367717a48c7cSmrg			newdeplibs="$newdeplibs $a_deplib"
367817a48c7cSmrg			a_deplib=""
367917a48c7cSmrg			break 2
368017a48c7cSmrg		      fi
368117a48c7cSmrg		  done
368217a48c7cSmrg		done
368317a48c7cSmrg	      fi
368417a48c7cSmrg	      if test -n "$a_deplib" ; then
368517a48c7cSmrg		droppeddeps=yes
368617a48c7cSmrg		$echo
368717a48c7cSmrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
368817a48c7cSmrg		$echo "*** I have the capability to make that library automatically link in when"
368917a48c7cSmrg		$echo "*** you link to this library.  But I can only do this if you have a"
369017a48c7cSmrg		$echo "*** shared version of the library, which you do not appear to have"
369117a48c7cSmrg		$echo "*** because I did check the linker path looking for a file starting"
369217a48c7cSmrg		if test -z "$potlib" ; then
369317a48c7cSmrg		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
369417a48c7cSmrg		else
369517a48c7cSmrg		  $echo "*** with $libname and none of the candidates passed a file format test"
369617a48c7cSmrg		  $echo "*** using a file magic. Last file checked: $potlib"
369717a48c7cSmrg		fi
369817a48c7cSmrg	      fi
369917a48c7cSmrg	    else
370017a48c7cSmrg	      # Add a -L argument.
370117a48c7cSmrg	      newdeplibs="$newdeplibs $a_deplib"
370217a48c7cSmrg	    fi
370317a48c7cSmrg	  done # Gone through all deplibs.
370417a48c7cSmrg	  ;;
370517a48c7cSmrg	match_pattern*)
370617a48c7cSmrg	  set dummy $deplibs_check_method
370717a48c7cSmrg	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
370817a48c7cSmrg	  for a_deplib in $deplibs; do
370917a48c7cSmrg	    name=`expr $a_deplib : '-l\(.*\)'`
371017a48c7cSmrg	    # If $name is empty we are operating on a -L argument.
371117a48c7cSmrg	    if test -n "$name" && test "$name" != "0"; then
371217a48c7cSmrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
371317a48c7cSmrg		case " $predeps $postdeps " in
371417a48c7cSmrg		*" $a_deplib "*)
371517a48c7cSmrg		  newdeplibs="$newdeplibs $a_deplib"
371617a48c7cSmrg		  a_deplib=""
371717a48c7cSmrg		  ;;
371817a48c7cSmrg		esac
371917a48c7cSmrg	      fi
372017a48c7cSmrg	      if test -n "$a_deplib" ; then
372117a48c7cSmrg		libname=`eval \\$echo \"$libname_spec\"`
372217a48c7cSmrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
372317a48c7cSmrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
372417a48c7cSmrg		  for potent_lib in $potential_libs; do
372517a48c7cSmrg		    potlib="$potent_lib" # see symlink-check above in file_magic test
372617a48c7cSmrg		    if eval $echo \"$potent_lib\" 2>/dev/null \
372717a48c7cSmrg		        | ${SED} 10q \
372817a48c7cSmrg		        | $EGREP "$match_pattern_regex" > /dev/null; then
372917a48c7cSmrg		      newdeplibs="$newdeplibs $a_deplib"
373017a48c7cSmrg		      a_deplib=""
373117a48c7cSmrg		      break 2
373217a48c7cSmrg		    fi
373317a48c7cSmrg		  done
373417a48c7cSmrg		done
373517a48c7cSmrg	      fi
373617a48c7cSmrg	      if test -n "$a_deplib" ; then
373717a48c7cSmrg		droppeddeps=yes
373817a48c7cSmrg		$echo
373917a48c7cSmrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
374017a48c7cSmrg		$echo "*** I have the capability to make that library automatically link in when"
374117a48c7cSmrg		$echo "*** you link to this library.  But I can only do this if you have a"
374217a48c7cSmrg		$echo "*** shared version of the library, which you do not appear to have"
374317a48c7cSmrg		$echo "*** because I did check the linker path looking for a file starting"
374417a48c7cSmrg		if test -z "$potlib" ; then
374517a48c7cSmrg		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
374617a48c7cSmrg		else
374717a48c7cSmrg		  $echo "*** with $libname and none of the candidates passed a file format test"
374817a48c7cSmrg		  $echo "*** using a regex pattern. Last file checked: $potlib"
374917a48c7cSmrg		fi
375017a48c7cSmrg	      fi
375117a48c7cSmrg	    else
375217a48c7cSmrg	      # Add a -L argument.
375317a48c7cSmrg	      newdeplibs="$newdeplibs $a_deplib"
375417a48c7cSmrg	    fi
375517a48c7cSmrg	  done # Gone through all deplibs.
375617a48c7cSmrg	  ;;
375717a48c7cSmrg	none | unknown | *)
375817a48c7cSmrg	  newdeplibs=""
375917a48c7cSmrg	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
376017a48c7cSmrg	    -e 's/ -[LR][^ ]*//g'`
376117a48c7cSmrg	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
376217a48c7cSmrg	    for i in $predeps $postdeps ; do
376317a48c7cSmrg	      # can't use Xsed below, because $i might contain '/'
376417a48c7cSmrg	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
376517a48c7cSmrg	    done
376617a48c7cSmrg	  fi
376717a48c7cSmrg	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
376817a48c7cSmrg	    | grep . >/dev/null; then
376917a48c7cSmrg	    $echo
377017a48c7cSmrg	    if test "X$deplibs_check_method" = "Xnone"; then
377117a48c7cSmrg	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
377217a48c7cSmrg	    else
377317a48c7cSmrg	      $echo "*** Warning: inter-library dependencies are not known to be supported."
377417a48c7cSmrg	    fi
377517a48c7cSmrg	    $echo "*** All declared inter-library dependencies are being dropped."
377617a48c7cSmrg	    droppeddeps=yes
377717a48c7cSmrg	  fi
377817a48c7cSmrg	  ;;
377917a48c7cSmrg	esac
378017a48c7cSmrg	versuffix=$versuffix_save
378117a48c7cSmrg	major=$major_save
378217a48c7cSmrg	release=$release_save
378317a48c7cSmrg	libname=$libname_save
378417a48c7cSmrg	name=$name_save
378517a48c7cSmrg
378617a48c7cSmrg	case $host in
378717a48c7cSmrg	*-*-rhapsody* | *-*-darwin1.[012])
378817a48c7cSmrg	  # On Rhapsody replace the C library is the System framework
378917a48c7cSmrg	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
379017a48c7cSmrg	  ;;
379117a48c7cSmrg	esac
379217a48c7cSmrg
379317a48c7cSmrg	if test "$droppeddeps" = yes; then
379417a48c7cSmrg	  if test "$module" = yes; then
379517a48c7cSmrg	    $echo
379617a48c7cSmrg	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
379717a48c7cSmrg	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
379817a48c7cSmrg	    $echo "*** a static module, that should work as long as the dlopening"
379917a48c7cSmrg	    $echo "*** application is linked with the -dlopen flag."
380017a48c7cSmrg	    if test -z "$global_symbol_pipe"; then
380117a48c7cSmrg	      $echo
380217a48c7cSmrg	      $echo "*** However, this would only work if libtool was able to extract symbol"
380317a48c7cSmrg	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
380417a48c7cSmrg	      $echo "*** not find such a program.  So, this module is probably useless."
380517a48c7cSmrg	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
380617a48c7cSmrg	    fi
380717a48c7cSmrg	    if test "$build_old_libs" = no; then
380817a48c7cSmrg	      oldlibs="$output_objdir/$libname.$libext"
380917a48c7cSmrg	      build_libtool_libs=module
381017a48c7cSmrg	      build_old_libs=yes
381117a48c7cSmrg	    else
381217a48c7cSmrg	      build_libtool_libs=no
381317a48c7cSmrg	    fi
381417a48c7cSmrg	  else
381517a48c7cSmrg	    $echo "*** The inter-library dependencies that have been dropped here will be"
381617a48c7cSmrg	    $echo "*** automatically added whenever a program is linked with this library"
381717a48c7cSmrg	    $echo "*** or is declared to -dlopen it."
381817a48c7cSmrg
381917a48c7cSmrg	    if test "$allow_undefined" = no; then
382017a48c7cSmrg	      $echo
382117a48c7cSmrg	      $echo "*** Since this library must not contain undefined symbols,"
382217a48c7cSmrg	      $echo "*** because either the platform does not support them or"
382317a48c7cSmrg	      $echo "*** it was explicitly requested with -no-undefined,"
382417a48c7cSmrg	      $echo "*** libtool will only create a static version of it."
382517a48c7cSmrg	      if test "$build_old_libs" = no; then
382617a48c7cSmrg		oldlibs="$output_objdir/$libname.$libext"
382717a48c7cSmrg		build_libtool_libs=module
382817a48c7cSmrg		build_old_libs=yes
382917a48c7cSmrg	      else
383017a48c7cSmrg		build_libtool_libs=no
383117a48c7cSmrg	      fi
383217a48c7cSmrg	    fi
383317a48c7cSmrg	  fi
383417a48c7cSmrg	fi
383517a48c7cSmrg	# Done checking deplibs!
383617a48c7cSmrg	deplibs=$newdeplibs
383717a48c7cSmrg      fi
383817a48c7cSmrg
383917a48c7cSmrg
384017a48c7cSmrg      # move library search paths that coincide with paths to not yet
384117a48c7cSmrg      # installed libraries to the beginning of the library search list
384217a48c7cSmrg      new_libs=
384317a48c7cSmrg      for path in $notinst_path; do
384417a48c7cSmrg	case " $new_libs " in
384517a48c7cSmrg	*" -L$path/$objdir "*) ;;
384617a48c7cSmrg	*)
384717a48c7cSmrg	  case " $deplibs " in
384817a48c7cSmrg	  *" -L$path/$objdir "*)
384917a48c7cSmrg	    new_libs="$new_libs -L$path/$objdir" ;;
385017a48c7cSmrg	  esac
385117a48c7cSmrg	  ;;
385217a48c7cSmrg	esac
385317a48c7cSmrg      done
385417a48c7cSmrg      for deplib in $deplibs; do
385517a48c7cSmrg	case $deplib in
385617a48c7cSmrg	-L*)
385717a48c7cSmrg	  case " $new_libs " in
385817a48c7cSmrg	  *" $deplib "*) ;;
385917a48c7cSmrg	  *) new_libs="$new_libs $deplib" ;;
386017a48c7cSmrg	  esac
386117a48c7cSmrg	  ;;
386217a48c7cSmrg	*) new_libs="$new_libs $deplib" ;;
386317a48c7cSmrg	esac
386417a48c7cSmrg      done
386517a48c7cSmrg      deplibs="$new_libs"
386617a48c7cSmrg
386717a48c7cSmrg
386817a48c7cSmrg      # All the library-specific variables (install_libdir is set above).
386917a48c7cSmrg      library_names=
387017a48c7cSmrg      old_library=
387117a48c7cSmrg      dlname=
387217a48c7cSmrg
387317a48c7cSmrg      # Test again, we may have decided not to build it any more
387417a48c7cSmrg      if test "$build_libtool_libs" = yes; then
387517a48c7cSmrg	if test "$hardcode_into_libs" = yes; then
387617a48c7cSmrg	  # Hardcode the library paths
387717a48c7cSmrg	  hardcode_libdirs=
387817a48c7cSmrg	  dep_rpath=
387917a48c7cSmrg	  rpath="$finalize_rpath"
388017a48c7cSmrg	  test "$mode" != relink && rpath="$compile_rpath$rpath"
388117a48c7cSmrg	  for libdir in $rpath; do
388217a48c7cSmrg	    if test -n "$hardcode_libdir_flag_spec"; then
388317a48c7cSmrg	      if test -n "$hardcode_libdir_separator"; then
388417a48c7cSmrg		if test -z "$hardcode_libdirs"; then
388517a48c7cSmrg		  hardcode_libdirs="$libdir"
388617a48c7cSmrg		else
388717a48c7cSmrg		  # Just accumulate the unique libdirs.
388817a48c7cSmrg		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
388917a48c7cSmrg		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
389017a48c7cSmrg		    ;;
389117a48c7cSmrg		  *)
389217a48c7cSmrg		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
389317a48c7cSmrg		    ;;
389417a48c7cSmrg		  esac
389517a48c7cSmrg		fi
389617a48c7cSmrg	      else
389717a48c7cSmrg		eval flag=\"$hardcode_libdir_flag_spec\"
389817a48c7cSmrg		dep_rpath="$dep_rpath $flag"
389917a48c7cSmrg	      fi
390017a48c7cSmrg	    elif test -n "$runpath_var"; then
390117a48c7cSmrg	      case "$perm_rpath " in
390217a48c7cSmrg	      *" $libdir "*) ;;
390317a48c7cSmrg	      *) perm_rpath="$perm_rpath $libdir" ;;
390417a48c7cSmrg	      esac
390517a48c7cSmrg	    fi
390617a48c7cSmrg	  done
390717a48c7cSmrg	  # Substitute the hardcoded libdirs into the rpath.
390817a48c7cSmrg	  if test -n "$hardcode_libdir_separator" &&
390917a48c7cSmrg	     test -n "$hardcode_libdirs"; then
391017a48c7cSmrg	    libdir="$hardcode_libdirs"
391117a48c7cSmrg	    if test -n "$hardcode_libdir_flag_spec_ld"; then
391217a48c7cSmrg	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
391317a48c7cSmrg	    else
391417a48c7cSmrg	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
391517a48c7cSmrg	    fi
391617a48c7cSmrg	  fi
391717a48c7cSmrg	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
391817a48c7cSmrg	    # We should set the runpath_var.
391917a48c7cSmrg	    rpath=
392017a48c7cSmrg	    for dir in $perm_rpath; do
392117a48c7cSmrg	      rpath="$rpath$dir:"
392217a48c7cSmrg	    done
392317a48c7cSmrg	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
392417a48c7cSmrg	  fi
392517a48c7cSmrg	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
392617a48c7cSmrg	fi
392717a48c7cSmrg
392817a48c7cSmrg	shlibpath="$finalize_shlibpath"
392917a48c7cSmrg	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
393017a48c7cSmrg	if test -n "$shlibpath"; then
393117a48c7cSmrg	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
393217a48c7cSmrg	fi
393317a48c7cSmrg
393417a48c7cSmrg	# Get the real and link names of the library.
393517a48c7cSmrg	eval shared_ext=\"$shrext_cmds\"
393617a48c7cSmrg	eval library_names=\"$library_names_spec\"
393717a48c7cSmrg	set dummy $library_names
393817a48c7cSmrg	realname="$2"
393917a48c7cSmrg	shift; shift
394017a48c7cSmrg
394117a48c7cSmrg	if test -n "$soname_spec"; then
394217a48c7cSmrg	  eval soname=\"$soname_spec\"
394317a48c7cSmrg	else
394417a48c7cSmrg	  soname="$realname"
394517a48c7cSmrg	fi
394617a48c7cSmrg	if test -z "$dlname"; then
394717a48c7cSmrg	  dlname=$soname
394817a48c7cSmrg	fi
394917a48c7cSmrg
395017a48c7cSmrg	lib="$output_objdir/$realname"
395117a48c7cSmrg	linknames=
395217a48c7cSmrg	for link
395317a48c7cSmrg	do
395417a48c7cSmrg	  linknames="$linknames $link"
395517a48c7cSmrg	done
395617a48c7cSmrg
395717a48c7cSmrg	# Use standard objects if they are pic
395817a48c7cSmrg	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
395917a48c7cSmrg
396017a48c7cSmrg	# Prepare the list of exported symbols
396117a48c7cSmrg	if test -z "$export_symbols"; then
396217a48c7cSmrg	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
396317a48c7cSmrg	    $show "generating symbol list for \`$libname.la'"
396417a48c7cSmrg	    export_symbols="$output_objdir/$libname.exp"
396517a48c7cSmrg	    $run $rm $export_symbols
396617a48c7cSmrg	    cmds=$export_symbols_cmds
396717a48c7cSmrg	    save_ifs="$IFS"; IFS='~'
396817a48c7cSmrg	    for cmd in $cmds; do
396917a48c7cSmrg	      IFS="$save_ifs"
397017a48c7cSmrg	      eval cmd=\"$cmd\"
397117a48c7cSmrg	      if len=`expr "X$cmd" : ".*"` &&
397217a48c7cSmrg	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
397317a48c7cSmrg	        $show "$cmd"
397417a48c7cSmrg	        $run eval "$cmd" || exit $?
397517a48c7cSmrg	        skipped_export=false
397617a48c7cSmrg	      else
397717a48c7cSmrg	        # The command line is too long to execute in one step.
397817a48c7cSmrg	        $show "using reloadable object file for export list..."
397917a48c7cSmrg	        skipped_export=:
398017a48c7cSmrg		# Break out early, otherwise skipped_export may be
398117a48c7cSmrg		# set to false by a later but shorter cmd.
398217a48c7cSmrg		break
398317a48c7cSmrg	      fi
398417a48c7cSmrg	    done
398517a48c7cSmrg	    IFS="$save_ifs"
398617a48c7cSmrg	    if test -n "$export_symbols_regex"; then
398717a48c7cSmrg	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
398817a48c7cSmrg	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
398917a48c7cSmrg	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
399017a48c7cSmrg	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
399117a48c7cSmrg	    fi
399217a48c7cSmrg	  fi
399317a48c7cSmrg	fi
399417a48c7cSmrg
399517a48c7cSmrg	if test -n "$export_symbols" && test -n "$include_expsyms"; then
399617a48c7cSmrg	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
399717a48c7cSmrg	fi
399817a48c7cSmrg
399917a48c7cSmrg	tmp_deplibs=
400017a48c7cSmrg	for test_deplib in $deplibs; do
400117a48c7cSmrg		case " $convenience " in
400217a48c7cSmrg		*" $test_deplib "*) ;;
400317a48c7cSmrg		*)
400417a48c7cSmrg			tmp_deplibs="$tmp_deplibs $test_deplib"
400517a48c7cSmrg			;;
400617a48c7cSmrg		esac
400717a48c7cSmrg	done
400817a48c7cSmrg	deplibs="$tmp_deplibs"
400917a48c7cSmrg
401017a48c7cSmrg	if test -n "$convenience"; then
401117a48c7cSmrg	  if test -n "$whole_archive_flag_spec"; then
401217a48c7cSmrg	    save_libobjs=$libobjs
401317a48c7cSmrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
401417a48c7cSmrg	  else
401517a48c7cSmrg	    gentop="$output_objdir/${outputname}x"
401617a48c7cSmrg	    generated="$generated $gentop"
401717a48c7cSmrg
401817a48c7cSmrg	    func_extract_archives $gentop $convenience
401917a48c7cSmrg	    libobjs="$libobjs $func_extract_archives_result"
402017a48c7cSmrg	  fi
402117a48c7cSmrg	fi
402217a48c7cSmrg	
402317a48c7cSmrg	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
402417a48c7cSmrg	  eval flag=\"$thread_safe_flag_spec\"
402517a48c7cSmrg	  linker_flags="$linker_flags $flag"
402617a48c7cSmrg	fi
402717a48c7cSmrg
402817a48c7cSmrg	# Make a backup of the uninstalled library when relinking
402917a48c7cSmrg	if test "$mode" = relink; then
403017a48c7cSmrg	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
403117a48c7cSmrg	fi
403217a48c7cSmrg
403317a48c7cSmrg	# Do each of the archive commands.
403417a48c7cSmrg	if test "$module" = yes && test -n "$module_cmds" ; then
403517a48c7cSmrg	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
403617a48c7cSmrg	    eval test_cmds=\"$module_expsym_cmds\"
403717a48c7cSmrg	    cmds=$module_expsym_cmds
403817a48c7cSmrg	  else
403917a48c7cSmrg	    eval test_cmds=\"$module_cmds\"
404017a48c7cSmrg	    cmds=$module_cmds
404117a48c7cSmrg	  fi
404217a48c7cSmrg	else
404317a48c7cSmrg	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
404417a48c7cSmrg	  eval test_cmds=\"$archive_expsym_cmds\"
404517a48c7cSmrg	  cmds=$archive_expsym_cmds
404617a48c7cSmrg	else
404717a48c7cSmrg	  eval test_cmds=\"$archive_cmds\"
404817a48c7cSmrg	  cmds=$archive_cmds
404917a48c7cSmrg	  fi
405017a48c7cSmrg	fi
405117a48c7cSmrg
405217a48c7cSmrg	if test "X$skipped_export" != "X:" &&
405317a48c7cSmrg	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
405417a48c7cSmrg	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
405517a48c7cSmrg	  :
405617a48c7cSmrg	else
405717a48c7cSmrg	  # The command line is too long to link in one step, link piecewise.
405817a48c7cSmrg	  $echo "creating reloadable object files..."
405917a48c7cSmrg
406017a48c7cSmrg	  # Save the value of $output and $libobjs because we want to
406117a48c7cSmrg	  # use them later.  If we have whole_archive_flag_spec, we
406217a48c7cSmrg	  # want to use save_libobjs as it was before
406317a48c7cSmrg	  # whole_archive_flag_spec was expanded, because we can't
406417a48c7cSmrg	  # assume the linker understands whole_archive_flag_spec.
406517a48c7cSmrg	  # This may have to be revisited, in case too many
406617a48c7cSmrg	  # convenience libraries get linked in and end up exceeding
406717a48c7cSmrg	  # the spec.
406817a48c7cSmrg	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
406917a48c7cSmrg	    save_libobjs=$libobjs
407017a48c7cSmrg	  fi
407117a48c7cSmrg	  save_output=$output
407217a48c7cSmrg	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
407317a48c7cSmrg
407417a48c7cSmrg	  # Clear the reloadable object creation command queue and
407517a48c7cSmrg	  # initialize k to one.
407617a48c7cSmrg	  test_cmds=
407717a48c7cSmrg	  concat_cmds=
407817a48c7cSmrg	  objlist=
407917a48c7cSmrg	  delfiles=
408017a48c7cSmrg	  last_robj=
408117a48c7cSmrg	  k=1
408217a48c7cSmrg	  output=$output_objdir/$output_la-${k}.$objext
408317a48c7cSmrg	  # Loop over the list of objects to be linked.
408417a48c7cSmrg	  for obj in $save_libobjs
408517a48c7cSmrg	  do
408617a48c7cSmrg	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
408717a48c7cSmrg	    if test "X$objlist" = X ||
408817a48c7cSmrg	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
408917a48c7cSmrg		 test "$len" -le "$max_cmd_len"; }; then
409017a48c7cSmrg	      objlist="$objlist $obj"
409117a48c7cSmrg	    else
409217a48c7cSmrg	      # The command $test_cmds is almost too long, add a
409317a48c7cSmrg	      # command to the queue.
409417a48c7cSmrg	      if test "$k" -eq 1 ; then
409517a48c7cSmrg		# The first file doesn't have a previous command to add.
409617a48c7cSmrg		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
409717a48c7cSmrg	      else
409817a48c7cSmrg		# All subsequent reloadable object files will link in
409917a48c7cSmrg		# the last one created.
410017a48c7cSmrg		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
410117a48c7cSmrg	      fi
410217a48c7cSmrg	      last_robj=$output_objdir/$output_la-${k}.$objext
410317a48c7cSmrg	      k=`expr $k + 1`
410417a48c7cSmrg	      output=$output_objdir/$output_la-${k}.$objext
410517a48c7cSmrg	      objlist=$obj
410617a48c7cSmrg	      len=1
410717a48c7cSmrg	    fi
410817a48c7cSmrg	  done
410917a48c7cSmrg	  # Handle the remaining objects by creating one last
411017a48c7cSmrg	  # reloadable object file.  All subsequent reloadable object
411117a48c7cSmrg	  # files will link in the last one created.
411217a48c7cSmrg	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
411317a48c7cSmrg	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
411417a48c7cSmrg
411517a48c7cSmrg	  if ${skipped_export-false}; then
411617a48c7cSmrg	    $show "generating symbol list for \`$libname.la'"
411717a48c7cSmrg	    export_symbols="$output_objdir/$libname.exp"
411817a48c7cSmrg	    $run $rm $export_symbols
411917a48c7cSmrg	    libobjs=$output
412017a48c7cSmrg	    # Append the command to create the export file.
412117a48c7cSmrg	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
412217a48c7cSmrg          fi
412317a48c7cSmrg
412417a48c7cSmrg	  # Set up a command to remove the reloadable object files
412517a48c7cSmrg	  # after they are used.
412617a48c7cSmrg	  i=0
412717a48c7cSmrg	  while test "$i" -lt "$k"
412817a48c7cSmrg	  do
412917a48c7cSmrg	    i=`expr $i + 1`
413017a48c7cSmrg	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
413117a48c7cSmrg	  done
413217a48c7cSmrg
413317a48c7cSmrg	  $echo "creating a temporary reloadable object file: $output"
413417a48c7cSmrg
413517a48c7cSmrg	  # Loop through the commands generated above and execute them.
413617a48c7cSmrg	  save_ifs="$IFS"; IFS='~'
413717a48c7cSmrg	  for cmd in $concat_cmds; do
413817a48c7cSmrg	    IFS="$save_ifs"
413917a48c7cSmrg	    $show "$cmd"
414017a48c7cSmrg	    $run eval "$cmd" || exit $?
414117a48c7cSmrg	  done
414217a48c7cSmrg	  IFS="$save_ifs"
414317a48c7cSmrg
414417a48c7cSmrg	  libobjs=$output
414517a48c7cSmrg	  # Restore the value of output.
414617a48c7cSmrg	  output=$save_output
414717a48c7cSmrg
414817a48c7cSmrg	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
414917a48c7cSmrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
415017a48c7cSmrg	  fi
415117a48c7cSmrg	  # Expand the library linking commands again to reset the
415217a48c7cSmrg	  # value of $libobjs for piecewise linking.
415317a48c7cSmrg
415417a48c7cSmrg	  # Do each of the archive commands.
415517a48c7cSmrg	  if test "$module" = yes && test -n "$module_cmds" ; then
415617a48c7cSmrg	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
415717a48c7cSmrg	      cmds=$module_expsym_cmds
415817a48c7cSmrg	    else
415917a48c7cSmrg	      cmds=$module_cmds
416017a48c7cSmrg	    fi
416117a48c7cSmrg	  else
416217a48c7cSmrg	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
416317a48c7cSmrg	    cmds=$archive_expsym_cmds
416417a48c7cSmrg	  else
416517a48c7cSmrg	    cmds=$archive_cmds
416617a48c7cSmrg	    fi
416717a48c7cSmrg	  fi
416817a48c7cSmrg
416917a48c7cSmrg	  # Append the command to remove the reloadable object files
417017a48c7cSmrg	  # to the just-reset $cmds.
417117a48c7cSmrg	  eval cmds=\"\$cmds~\$rm $delfiles\"
417217a48c7cSmrg	fi
417317a48c7cSmrg	save_ifs="$IFS"; IFS='~'
417417a48c7cSmrg	for cmd in $cmds; do
417517a48c7cSmrg	  IFS="$save_ifs"
417617a48c7cSmrg	  eval cmd=\"$cmd\"
417717a48c7cSmrg	  $show "$cmd"
417817a48c7cSmrg	  $run eval "$cmd" || {
417917a48c7cSmrg	    lt_exit=$?
418017a48c7cSmrg
418117a48c7cSmrg	    # Restore the uninstalled library and exit
418217a48c7cSmrg	    if test "$mode" = relink; then
418317a48c7cSmrg	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
418417a48c7cSmrg	    fi
418517a48c7cSmrg
418617a48c7cSmrg	    exit $lt_exit
418717a48c7cSmrg	  }
418817a48c7cSmrg	done
418917a48c7cSmrg	IFS="$save_ifs"
419017a48c7cSmrg
419117a48c7cSmrg	# Restore the uninstalled library and exit
419217a48c7cSmrg	if test "$mode" = relink; then
419317a48c7cSmrg	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
419417a48c7cSmrg
419517a48c7cSmrg	  if test -n "$convenience"; then
419617a48c7cSmrg	    if test -z "$whole_archive_flag_spec"; then
419717a48c7cSmrg	      $show "${rm}r $gentop"
419817a48c7cSmrg	      $run ${rm}r "$gentop"
419917a48c7cSmrg	    fi
420017a48c7cSmrg	  fi
420117a48c7cSmrg
420217a48c7cSmrg	  exit $EXIT_SUCCESS
420317a48c7cSmrg	fi
420417a48c7cSmrg
420517a48c7cSmrg	# Create links to the real library.
420617a48c7cSmrg	for linkname in $linknames; do
420717a48c7cSmrg	  if test "$realname" != "$linkname"; then
420817a48c7cSmrg	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
420917a48c7cSmrg	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
421017a48c7cSmrg	  fi
421117a48c7cSmrg	done
421217a48c7cSmrg
421317a48c7cSmrg	# If -module or -export-dynamic was specified, set the dlname.
421417a48c7cSmrg	if test "$module" = yes || test "$export_dynamic" = yes; then
421517a48c7cSmrg	  # On all known operating systems, these are identical.
421617a48c7cSmrg	  dlname="$soname"
421717a48c7cSmrg	fi
421817a48c7cSmrg      fi
421917a48c7cSmrg      ;;
422017a48c7cSmrg
422117a48c7cSmrg    obj)
422217a48c7cSmrg      if test -n "$deplibs"; then
422317a48c7cSmrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
422417a48c7cSmrg      fi
422517a48c7cSmrg
422617a48c7cSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
422717a48c7cSmrg	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
422817a48c7cSmrg      fi
422917a48c7cSmrg
423017a48c7cSmrg      if test -n "$rpath"; then
423117a48c7cSmrg	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
423217a48c7cSmrg      fi
423317a48c7cSmrg
423417a48c7cSmrg      if test -n "$xrpath"; then
423517a48c7cSmrg	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
423617a48c7cSmrg      fi
423717a48c7cSmrg
423817a48c7cSmrg      if test -n "$vinfo"; then
423917a48c7cSmrg	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
424017a48c7cSmrg      fi
424117a48c7cSmrg
424217a48c7cSmrg      if test -n "$release"; then
424317a48c7cSmrg	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
424417a48c7cSmrg      fi
424517a48c7cSmrg
424617a48c7cSmrg      case $output in
424717a48c7cSmrg      *.lo)
424817a48c7cSmrg	if test -n "$objs$old_deplibs"; then
424917a48c7cSmrg	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
425017a48c7cSmrg	  exit $EXIT_FAILURE
425117a48c7cSmrg	fi
425217a48c7cSmrg	libobj="$output"
425317a48c7cSmrg	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
425417a48c7cSmrg	;;
425517a48c7cSmrg      *)
425617a48c7cSmrg	libobj=
425717a48c7cSmrg	obj="$output"
425817a48c7cSmrg	;;
425917a48c7cSmrg      esac
426017a48c7cSmrg
426117a48c7cSmrg      # Delete the old objects.
426217a48c7cSmrg      $run $rm $obj $libobj
426317a48c7cSmrg
426417a48c7cSmrg      # Objects from convenience libraries.  This assumes
426517a48c7cSmrg      # single-version convenience libraries.  Whenever we create
426617a48c7cSmrg      # different ones for PIC/non-PIC, this we'll have to duplicate
426717a48c7cSmrg      # the extraction.
426817a48c7cSmrg      reload_conv_objs=
426917a48c7cSmrg      gentop=
427017a48c7cSmrg      # reload_cmds runs $LD directly, so let us get rid of
42718e0ed500Smrg      # -Wl from whole_archive_flag_spec and hope we can get by with
42728e0ed500Smrg      # turning comma into space..
427317a48c7cSmrg      wl=
427417a48c7cSmrg
427517a48c7cSmrg      if test -n "$convenience"; then
427617a48c7cSmrg	if test -n "$whole_archive_flag_spec"; then
42778e0ed500Smrg	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
42788e0ed500Smrg      reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
427917a48c7cSmrg	else
428017a48c7cSmrg	  gentop="$output_objdir/${obj}x"
428117a48c7cSmrg	  generated="$generated $gentop"
428217a48c7cSmrg
428317a48c7cSmrg	  func_extract_archives $gentop $convenience
428417a48c7cSmrg	  reload_conv_objs="$reload_objs $func_extract_archives_result"
428517a48c7cSmrg	fi
428617a48c7cSmrg      fi
428717a48c7cSmrg
428817a48c7cSmrg      # Create the old-style object.
428917a48c7cSmrg      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
429017a48c7cSmrg
429117a48c7cSmrg      output="$obj"
429217a48c7cSmrg      cmds=$reload_cmds
429317a48c7cSmrg      save_ifs="$IFS"; IFS='~'
429417a48c7cSmrg      for cmd in $cmds; do
429517a48c7cSmrg	IFS="$save_ifs"
429617a48c7cSmrg	eval cmd=\"$cmd\"
429717a48c7cSmrg	$show "$cmd"
429817a48c7cSmrg	$run eval "$cmd" || exit $?
429917a48c7cSmrg      done
430017a48c7cSmrg      IFS="$save_ifs"
430117a48c7cSmrg
430217a48c7cSmrg      # Exit if we aren't doing a library object file.
430317a48c7cSmrg      if test -z "$libobj"; then
430417a48c7cSmrg	if test -n "$gentop"; then
430517a48c7cSmrg	  $show "${rm}r $gentop"
430617a48c7cSmrg	  $run ${rm}r $gentop
430717a48c7cSmrg	fi
430817a48c7cSmrg
430917a48c7cSmrg	exit $EXIT_SUCCESS
431017a48c7cSmrg      fi
431117a48c7cSmrg
431217a48c7cSmrg      if test "$build_libtool_libs" != yes; then
431317a48c7cSmrg	if test -n "$gentop"; then
431417a48c7cSmrg	  $show "${rm}r $gentop"
431517a48c7cSmrg	  $run ${rm}r $gentop
431617a48c7cSmrg	fi
431717a48c7cSmrg
431817a48c7cSmrg	# Create an invalid libtool object if no PIC, so that we don't
431917a48c7cSmrg	# accidentally link it into a program.
432017a48c7cSmrg	# $show "echo timestamp > $libobj"
432117a48c7cSmrg	# $run eval "echo timestamp > $libobj" || exit $?
432217a48c7cSmrg	exit $EXIT_SUCCESS
432317a48c7cSmrg      fi
432417a48c7cSmrg
432517a48c7cSmrg      if test -n "$pic_flag" || test "$pic_mode" != default; then
432617a48c7cSmrg	# Only do commands if we really have different PIC objects.
432717a48c7cSmrg	reload_objs="$libobjs $reload_conv_objs"
432817a48c7cSmrg	output="$libobj"
432917a48c7cSmrg	cmds=$reload_cmds
433017a48c7cSmrg	save_ifs="$IFS"; IFS='~'
433117a48c7cSmrg	for cmd in $cmds; do
433217a48c7cSmrg	  IFS="$save_ifs"
433317a48c7cSmrg	  eval cmd=\"$cmd\"
433417a48c7cSmrg	  $show "$cmd"
433517a48c7cSmrg	  $run eval "$cmd" || exit $?
433617a48c7cSmrg	done
433717a48c7cSmrg	IFS="$save_ifs"
433817a48c7cSmrg      fi
433917a48c7cSmrg
434017a48c7cSmrg      if test -n "$gentop"; then
434117a48c7cSmrg	$show "${rm}r $gentop"
434217a48c7cSmrg	$run ${rm}r $gentop
434317a48c7cSmrg      fi
434417a48c7cSmrg
434517a48c7cSmrg      exit $EXIT_SUCCESS
434617a48c7cSmrg      ;;
434717a48c7cSmrg
434817a48c7cSmrg    prog)
434917a48c7cSmrg      case $host in
435017a48c7cSmrg	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
435117a48c7cSmrg      esac
435217a48c7cSmrg      if test -n "$vinfo"; then
435317a48c7cSmrg	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
435417a48c7cSmrg      fi
435517a48c7cSmrg
435617a48c7cSmrg      if test -n "$release"; then
435717a48c7cSmrg	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
435817a48c7cSmrg      fi
435917a48c7cSmrg
436017a48c7cSmrg      if test "$preload" = yes; then
436117a48c7cSmrg	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
436217a48c7cSmrg	   test "$dlopen_self_static" = unknown; then
436317a48c7cSmrg	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
436417a48c7cSmrg	fi
436517a48c7cSmrg      fi
436617a48c7cSmrg
436717a48c7cSmrg      case $host in
436817a48c7cSmrg      *-*-rhapsody* | *-*-darwin1.[012])
436917a48c7cSmrg	# On Rhapsody replace the C library is the System framework
437017a48c7cSmrg	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
437117a48c7cSmrg	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
437217a48c7cSmrg	;;
437317a48c7cSmrg      esac
437417a48c7cSmrg
437517a48c7cSmrg      case $host in
437617a48c7cSmrg      *darwin*)
437717a48c7cSmrg        # Don't allow lazy linking, it breaks C++ global constructors
437817a48c7cSmrg        if test "$tagname" = CXX ; then
437917a48c7cSmrg        compile_command="$compile_command ${wl}-bind_at_load"
438017a48c7cSmrg        finalize_command="$finalize_command ${wl}-bind_at_load"
438117a48c7cSmrg        fi
438217a48c7cSmrg        ;;
438317a48c7cSmrg      esac
438417a48c7cSmrg
438517a48c7cSmrg
438617a48c7cSmrg      # move library search paths that coincide with paths to not yet
438717a48c7cSmrg      # installed libraries to the beginning of the library search list
438817a48c7cSmrg      new_libs=
438917a48c7cSmrg      for path in $notinst_path; do
439017a48c7cSmrg	case " $new_libs " in
439117a48c7cSmrg	*" -L$path/$objdir "*) ;;
439217a48c7cSmrg	*)
439317a48c7cSmrg	  case " $compile_deplibs " in
439417a48c7cSmrg	  *" -L$path/$objdir "*)
439517a48c7cSmrg	    new_libs="$new_libs -L$path/$objdir" ;;
439617a48c7cSmrg	  esac
439717a48c7cSmrg	  ;;
439817a48c7cSmrg	esac
439917a48c7cSmrg      done
440017a48c7cSmrg      for deplib in $compile_deplibs; do
440117a48c7cSmrg	case $deplib in
440217a48c7cSmrg	-L*)
440317a48c7cSmrg	  case " $new_libs " in
440417a48c7cSmrg	  *" $deplib "*) ;;
440517a48c7cSmrg	  *) new_libs="$new_libs $deplib" ;;
440617a48c7cSmrg	  esac
440717a48c7cSmrg	  ;;
440817a48c7cSmrg	*) new_libs="$new_libs $deplib" ;;
440917a48c7cSmrg	esac
441017a48c7cSmrg      done
441117a48c7cSmrg      compile_deplibs="$new_libs"
441217a48c7cSmrg
441317a48c7cSmrg
441417a48c7cSmrg      compile_command="$compile_command $compile_deplibs"
441517a48c7cSmrg      finalize_command="$finalize_command $finalize_deplibs"
441617a48c7cSmrg
441717a48c7cSmrg      if test -n "$rpath$xrpath"; then
441817a48c7cSmrg	# If the user specified any rpath flags, then add them.
441917a48c7cSmrg	for libdir in $rpath $xrpath; do
442017a48c7cSmrg	  # This is the magic to use -rpath.
442117a48c7cSmrg	  case "$finalize_rpath " in
442217a48c7cSmrg	  *" $libdir "*) ;;
442317a48c7cSmrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
442417a48c7cSmrg	  esac
442517a48c7cSmrg	done
442617a48c7cSmrg      fi
442717a48c7cSmrg
442817a48c7cSmrg      # Now hardcode the library paths
442917a48c7cSmrg      rpath=
443017a48c7cSmrg      hardcode_libdirs=
443117a48c7cSmrg      for libdir in $compile_rpath $finalize_rpath; do
443217a48c7cSmrg	if test -n "$hardcode_libdir_flag_spec"; then
443317a48c7cSmrg	  if test -n "$hardcode_libdir_separator"; then
443417a48c7cSmrg	    if test -z "$hardcode_libdirs"; then
443517a48c7cSmrg	      hardcode_libdirs="$libdir"
443617a48c7cSmrg	    else
443717a48c7cSmrg	      # Just accumulate the unique libdirs.
443817a48c7cSmrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
443917a48c7cSmrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
444017a48c7cSmrg		;;
444117a48c7cSmrg	      *)
444217a48c7cSmrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
444317a48c7cSmrg		;;
444417a48c7cSmrg	      esac
444517a48c7cSmrg	    fi
444617a48c7cSmrg	  else
444717a48c7cSmrg	    eval flag=\"$hardcode_libdir_flag_spec\"
444817a48c7cSmrg	    rpath="$rpath $flag"
444917a48c7cSmrg	  fi
445017a48c7cSmrg	elif test -n "$runpath_var"; then
445117a48c7cSmrg	  case "$perm_rpath " in
445217a48c7cSmrg	  *" $libdir "*) ;;
445317a48c7cSmrg	  *) perm_rpath="$perm_rpath $libdir" ;;
445417a48c7cSmrg	  esac
445517a48c7cSmrg	fi
445617a48c7cSmrg	case $host in
445717a48c7cSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
445817a48c7cSmrg	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
445917a48c7cSmrg	  case :$dllsearchpath: in
446017a48c7cSmrg	  *":$libdir:"*) ;;
446117a48c7cSmrg	  *) dllsearchpath="$dllsearchpath:$libdir";;
446217a48c7cSmrg	  esac
446317a48c7cSmrg	  case :$dllsearchpath: in
446417a48c7cSmrg	  *":$testbindir:"*) ;;
446517a48c7cSmrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
446617a48c7cSmrg	  esac
446717a48c7cSmrg	  ;;
446817a48c7cSmrg	esac
446917a48c7cSmrg      done
447017a48c7cSmrg      # Substitute the hardcoded libdirs into the rpath.
447117a48c7cSmrg      if test -n "$hardcode_libdir_separator" &&
447217a48c7cSmrg	 test -n "$hardcode_libdirs"; then
447317a48c7cSmrg	libdir="$hardcode_libdirs"
447417a48c7cSmrg	eval rpath=\" $hardcode_libdir_flag_spec\"
447517a48c7cSmrg      fi
447617a48c7cSmrg      compile_rpath="$rpath"
447717a48c7cSmrg
447817a48c7cSmrg      rpath=
447917a48c7cSmrg      hardcode_libdirs=
448017a48c7cSmrg      for libdir in $finalize_rpath; do
448117a48c7cSmrg	if test -n "$hardcode_libdir_flag_spec"; then
448217a48c7cSmrg	  if test -n "$hardcode_libdir_separator"; then
448317a48c7cSmrg	    if test -z "$hardcode_libdirs"; then
448417a48c7cSmrg	      hardcode_libdirs="$libdir"
448517a48c7cSmrg	    else
448617a48c7cSmrg	      # Just accumulate the unique libdirs.
448717a48c7cSmrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
448817a48c7cSmrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
448917a48c7cSmrg		;;
449017a48c7cSmrg	      *)
449117a48c7cSmrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
449217a48c7cSmrg		;;
449317a48c7cSmrg	      esac
449417a48c7cSmrg	    fi
449517a48c7cSmrg	  else
449617a48c7cSmrg	    eval flag=\"$hardcode_libdir_flag_spec\"
449717a48c7cSmrg	    rpath="$rpath $flag"
449817a48c7cSmrg	  fi
449917a48c7cSmrg	elif test -n "$runpath_var"; then
450017a48c7cSmrg	  case "$finalize_perm_rpath " in
450117a48c7cSmrg	  *" $libdir "*) ;;
450217a48c7cSmrg	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
450317a48c7cSmrg	  esac
450417a48c7cSmrg	fi
450517a48c7cSmrg      done
450617a48c7cSmrg      # Substitute the hardcoded libdirs into the rpath.
450717a48c7cSmrg      if test -n "$hardcode_libdir_separator" &&
450817a48c7cSmrg	 test -n "$hardcode_libdirs"; then
450917a48c7cSmrg	libdir="$hardcode_libdirs"
451017a48c7cSmrg	eval rpath=\" $hardcode_libdir_flag_spec\"
451117a48c7cSmrg      fi
451217a48c7cSmrg      finalize_rpath="$rpath"
451317a48c7cSmrg
451417a48c7cSmrg      if test -n "$libobjs" && test "$build_old_libs" = yes; then
451517a48c7cSmrg	# Transform all the library objects into standard objects.
451617a48c7cSmrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
451717a48c7cSmrg	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
451817a48c7cSmrg      fi
451917a48c7cSmrg
452017a48c7cSmrg      dlsyms=
452117a48c7cSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
452217a48c7cSmrg	if test -n "$NM" && test -n "$global_symbol_pipe"; then
452317a48c7cSmrg	  dlsyms="${outputname}S.c"
452417a48c7cSmrg	else
452517a48c7cSmrg	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
452617a48c7cSmrg	fi
452717a48c7cSmrg      fi
452817a48c7cSmrg
452917a48c7cSmrg      if test -n "$dlsyms"; then
453017a48c7cSmrg	case $dlsyms in
453117a48c7cSmrg	"") ;;
453217a48c7cSmrg	*.c)
453317a48c7cSmrg	  # Discover the nlist of each of the dlfiles.
453417a48c7cSmrg	  nlist="$output_objdir/${outputname}.nm"
453517a48c7cSmrg
453617a48c7cSmrg	  $show "$rm $nlist ${nlist}S ${nlist}T"
453717a48c7cSmrg	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
453817a48c7cSmrg
453917a48c7cSmrg	  # Parse the name list into a source file.
454017a48c7cSmrg	  $show "creating $output_objdir/$dlsyms"
454117a48c7cSmrg
454217a48c7cSmrg	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
454317a48c7cSmrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
454417a48c7cSmrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
454517a48c7cSmrg
454617a48c7cSmrg#ifdef __cplusplus
454717a48c7cSmrgextern \"C\" {
454817a48c7cSmrg#endif
454917a48c7cSmrg
455017a48c7cSmrg/* Prevent the only kind of declaration conflicts we can make. */
455117a48c7cSmrg#define lt_preloaded_symbols some_other_symbol
455217a48c7cSmrg
455317a48c7cSmrg/* External symbol declarations for the compiler. */\
455417a48c7cSmrg"
455517a48c7cSmrg
455617a48c7cSmrg	  if test "$dlself" = yes; then
455717a48c7cSmrg	    $show "generating symbol list for \`$output'"
455817a48c7cSmrg
455917a48c7cSmrg	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
456017a48c7cSmrg
456117a48c7cSmrg	    # Add our own program objects to the symbol list.
456217a48c7cSmrg	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
456317a48c7cSmrg	    for arg in $progfiles; do
456417a48c7cSmrg	      $show "extracting global C symbols from \`$arg'"
456517a48c7cSmrg	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
456617a48c7cSmrg	    done
456717a48c7cSmrg
456817a48c7cSmrg	    if test -n "$exclude_expsyms"; then
456917a48c7cSmrg	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
457017a48c7cSmrg	      $run eval '$mv "$nlist"T "$nlist"'
457117a48c7cSmrg	    fi
457217a48c7cSmrg
457317a48c7cSmrg	    if test -n "$export_symbols_regex"; then
457417a48c7cSmrg	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
457517a48c7cSmrg	      $run eval '$mv "$nlist"T "$nlist"'
457617a48c7cSmrg	    fi
457717a48c7cSmrg
457817a48c7cSmrg	    # Prepare the list of exported symbols
457917a48c7cSmrg	    if test -z "$export_symbols"; then
458017a48c7cSmrg	      export_symbols="$output_objdir/$outputname.exp"
458117a48c7cSmrg	      $run $rm $export_symbols
458217a48c7cSmrg	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
458317a48c7cSmrg              case $host in
458417a48c7cSmrg              *cygwin* | *mingw* )
458517a48c7cSmrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
458617a48c7cSmrg		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
458717a48c7cSmrg                ;;
458817a48c7cSmrg              esac
458917a48c7cSmrg	    else
459017a48c7cSmrg	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
459117a48c7cSmrg	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
459217a48c7cSmrg	      $run eval 'mv "$nlist"T "$nlist"'
459317a48c7cSmrg              case $host in
459417a48c7cSmrg              *cygwin* | *mingw* )
459517a48c7cSmrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
459617a48c7cSmrg		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
459717a48c7cSmrg                ;;
459817a48c7cSmrg              esac
459917a48c7cSmrg	    fi
460017a48c7cSmrg	  fi
460117a48c7cSmrg
460217a48c7cSmrg	  for arg in $dlprefiles; do
460317a48c7cSmrg	    $show "extracting global C symbols from \`$arg'"
460417a48c7cSmrg	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
460517a48c7cSmrg	    $run eval '$echo ": $name " >> "$nlist"'
460617a48c7cSmrg	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
460717a48c7cSmrg	  done
460817a48c7cSmrg
460917a48c7cSmrg	  if test -z "$run"; then
461017a48c7cSmrg	    # Make sure we have at least an empty file.
461117a48c7cSmrg	    test -f "$nlist" || : > "$nlist"
461217a48c7cSmrg
461317a48c7cSmrg	    if test -n "$exclude_expsyms"; then
461417a48c7cSmrg	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
461517a48c7cSmrg	      $mv "$nlist"T "$nlist"
461617a48c7cSmrg	    fi
461717a48c7cSmrg
461817a48c7cSmrg	    # Try sorting and uniquifying the output.
461917a48c7cSmrg	    if grep -v "^: " < "$nlist" |
462017a48c7cSmrg		if sort -k 3 </dev/null >/dev/null 2>&1; then
462117a48c7cSmrg		  sort -k 3
462217a48c7cSmrg		else
462317a48c7cSmrg		  sort +2
462417a48c7cSmrg		fi |
462517a48c7cSmrg		uniq > "$nlist"S; then
462617a48c7cSmrg	      :
462717a48c7cSmrg	    else
462817a48c7cSmrg	      grep -v "^: " < "$nlist" > "$nlist"S
462917a48c7cSmrg	    fi
463017a48c7cSmrg
463117a48c7cSmrg	    if test -f "$nlist"S; then
463217a48c7cSmrg	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
463317a48c7cSmrg	    else
463417a48c7cSmrg	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
463517a48c7cSmrg	    fi
463617a48c7cSmrg
463717a48c7cSmrg	    $echo >> "$output_objdir/$dlsyms" "\
463817a48c7cSmrg
463917a48c7cSmrg#undef lt_preloaded_symbols
464017a48c7cSmrg
464117a48c7cSmrg#if defined (__STDC__) && __STDC__
464217a48c7cSmrg# define lt_ptr void *
464317a48c7cSmrg#else
464417a48c7cSmrg# define lt_ptr char *
464517a48c7cSmrg# define const
464617a48c7cSmrg#endif
464717a48c7cSmrg
464817a48c7cSmrg/* The mapping between symbol names and symbols. */
464917a48c7cSmrg"
465017a48c7cSmrg
465117a48c7cSmrg	    case $host in
465217a48c7cSmrg	    *cygwin* | *mingw* )
465317a48c7cSmrg	  $echo >> "$output_objdir/$dlsyms" "\
465417a48c7cSmrg/* DATA imports from DLLs on WIN32 can't be const, because
465517a48c7cSmrg   runtime relocations are performed -- see ld's documentation
465617a48c7cSmrg   on pseudo-relocs */
465717a48c7cSmrgstruct {
465817a48c7cSmrg"
465917a48c7cSmrg	      ;;
466017a48c7cSmrg	    * )
466117a48c7cSmrg	  $echo >> "$output_objdir/$dlsyms" "\
466217a48c7cSmrgconst struct {
466317a48c7cSmrg"
466417a48c7cSmrg	      ;;
466517a48c7cSmrg	    esac
466617a48c7cSmrg
466717a48c7cSmrg
466817a48c7cSmrg	  $echo >> "$output_objdir/$dlsyms" "\
466917a48c7cSmrg  const char *name;
467017a48c7cSmrg  lt_ptr address;
467117a48c7cSmrg}
467217a48c7cSmrglt_preloaded_symbols[] =
467317a48c7cSmrg{\
467417a48c7cSmrg"
467517a48c7cSmrg
467617a48c7cSmrg	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
467717a48c7cSmrg
467817a48c7cSmrg	    $echo >> "$output_objdir/$dlsyms" "\
467917a48c7cSmrg  {0, (lt_ptr) 0}
468017a48c7cSmrg};
468117a48c7cSmrg
468217a48c7cSmrg/* This works around a problem in FreeBSD linker */
468317a48c7cSmrg#ifdef FREEBSD_WORKAROUND
468417a48c7cSmrgstatic const void *lt_preloaded_setup() {
468517a48c7cSmrg  return lt_preloaded_symbols;
468617a48c7cSmrg}
468717a48c7cSmrg#endif
468817a48c7cSmrg
468917a48c7cSmrg#ifdef __cplusplus
469017a48c7cSmrg}
469117a48c7cSmrg#endif\
469217a48c7cSmrg"
469317a48c7cSmrg	  fi
469417a48c7cSmrg
469517a48c7cSmrg	  pic_flag_for_symtable=
469617a48c7cSmrg	  case $host in
469717a48c7cSmrg	  # compiling the symbol table file with pic_flag works around
469817a48c7cSmrg	  # a FreeBSD bug that causes programs to crash when -lm is
469917a48c7cSmrg	  # linked before any other PIC object.  But we must not use
470017a48c7cSmrg	  # pic_flag when linking with -static.  The problem exists in
470117a48c7cSmrg	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
470217a48c7cSmrg	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
470317a48c7cSmrg	    case "$compile_command " in
470417a48c7cSmrg	    *" -static "*) ;;
470517a48c7cSmrg	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
470617a48c7cSmrg	    esac;;
470717a48c7cSmrg	  *-*-hpux*)
470817a48c7cSmrg	    case "$compile_command " in
470917a48c7cSmrg	    *" -static "*) ;;
471017a48c7cSmrg	    *) pic_flag_for_symtable=" $pic_flag";;
471117a48c7cSmrg	    esac
471217a48c7cSmrg	  esac
471317a48c7cSmrg
471417a48c7cSmrg	  # Now compile the dynamic symbol file.
471517a48c7cSmrg	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
471617a48c7cSmrg	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
471717a48c7cSmrg
471817a48c7cSmrg	  # Clean up the generated files.
471917a48c7cSmrg	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
472017a48c7cSmrg	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
472117a48c7cSmrg
472217a48c7cSmrg	  # Transform the symbol file into the correct name.
472317a48c7cSmrg          case $host in
472417a48c7cSmrg          *cygwin* | *mingw* )
472517a48c7cSmrg            if test -f "$output_objdir/${outputname}.def" ; then
47268e0ed500Smrg              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
47278e0ed500Smrg              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
472817a48c7cSmrg            else
47298e0ed500Smrg              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
47308e0ed500Smrg              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
473117a48c7cSmrg             fi
473217a48c7cSmrg            ;;
473317a48c7cSmrg          * )
47348e0ed500Smrg            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
47358e0ed500Smrg            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
473617a48c7cSmrg            ;;
473717a48c7cSmrg          esac
473817a48c7cSmrg	  ;;
473917a48c7cSmrg	*)
474017a48c7cSmrg	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
474117a48c7cSmrg	  exit $EXIT_FAILURE
474217a48c7cSmrg	  ;;
474317a48c7cSmrg	esac
474417a48c7cSmrg      else
474517a48c7cSmrg	# We keep going just in case the user didn't refer to
474617a48c7cSmrg	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
474717a48c7cSmrg	# really was required.
474817a48c7cSmrg
474917a48c7cSmrg	# Nullify the symbol file.
47508e0ed500Smrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
47518e0ed500Smrg	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
475217a48c7cSmrg      fi
475317a48c7cSmrg
475417a48c7cSmrg      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
475517a48c7cSmrg	# Replace the output file specification.
47568e0ed500Smrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
475717a48c7cSmrg	link_command="$compile_command$compile_rpath"
475817a48c7cSmrg
475917a48c7cSmrg	# We have no uninstalled library dependencies, so finalize right now.
476017a48c7cSmrg	$show "$link_command"
476117a48c7cSmrg	$run eval "$link_command"
476217a48c7cSmrg	exit_status=$?
476317a48c7cSmrg
476417a48c7cSmrg	# Delete the generated files.
476517a48c7cSmrg	if test -n "$dlsyms"; then
476617a48c7cSmrg	  $show "$rm $output_objdir/${outputname}S.${objext}"
476717a48c7cSmrg	  $run $rm "$output_objdir/${outputname}S.${objext}"
476817a48c7cSmrg	fi
476917a48c7cSmrg
477017a48c7cSmrg	exit $exit_status
477117a48c7cSmrg      fi
477217a48c7cSmrg
477317a48c7cSmrg      if test -n "$shlibpath_var"; then
477417a48c7cSmrg	# We should set the shlibpath_var
477517a48c7cSmrg	rpath=
477617a48c7cSmrg	for dir in $temp_rpath; do
477717a48c7cSmrg	  case $dir in
477817a48c7cSmrg	  [\\/]* | [A-Za-z]:[\\/]*)
477917a48c7cSmrg	    # Absolute path.
478017a48c7cSmrg	    rpath="$rpath$dir:"
478117a48c7cSmrg	    ;;
478217a48c7cSmrg	  *)
478317a48c7cSmrg	    # Relative path: add a thisdir entry.
478417a48c7cSmrg	    rpath="$rpath\$thisdir/$dir:"
478517a48c7cSmrg	    ;;
478617a48c7cSmrg	  esac
478717a48c7cSmrg	done
478817a48c7cSmrg	temp_rpath="$rpath"
478917a48c7cSmrg      fi
479017a48c7cSmrg
479117a48c7cSmrg      if test -n "$compile_shlibpath$finalize_shlibpath"; then
479217a48c7cSmrg	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
479317a48c7cSmrg      fi
479417a48c7cSmrg      if test -n "$finalize_shlibpath"; then
479517a48c7cSmrg	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
479617a48c7cSmrg      fi
479717a48c7cSmrg
479817a48c7cSmrg      compile_var=
479917a48c7cSmrg      finalize_var=
480017a48c7cSmrg      if test -n "$runpath_var"; then
480117a48c7cSmrg	if test -n "$perm_rpath"; then
480217a48c7cSmrg	  # We should set the runpath_var.
480317a48c7cSmrg	  rpath=
480417a48c7cSmrg	  for dir in $perm_rpath; do
480517a48c7cSmrg	    rpath="$rpath$dir:"
480617a48c7cSmrg	  done
480717a48c7cSmrg	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
480817a48c7cSmrg	fi
480917a48c7cSmrg	if test -n "$finalize_perm_rpath"; then
481017a48c7cSmrg	  # We should set the runpath_var.
481117a48c7cSmrg	  rpath=
481217a48c7cSmrg	  for dir in $finalize_perm_rpath; do
481317a48c7cSmrg	    rpath="$rpath$dir:"
481417a48c7cSmrg	  done
481517a48c7cSmrg	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
481617a48c7cSmrg	fi
481717a48c7cSmrg      fi
481817a48c7cSmrg
481917a48c7cSmrg      if test "$no_install" = yes; then
482017a48c7cSmrg	# We don't need to create a wrapper script.
482117a48c7cSmrg	link_command="$compile_var$compile_command$compile_rpath"
482217a48c7cSmrg	# Replace the output file specification.
482317a48c7cSmrg	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
482417a48c7cSmrg	# Delete the old output file.
482517a48c7cSmrg	$run $rm $output
482617a48c7cSmrg	# Link the executable and exit
482717a48c7cSmrg	$show "$link_command"
482817a48c7cSmrg	$run eval "$link_command" || exit $?
482917a48c7cSmrg	exit $EXIT_SUCCESS
483017a48c7cSmrg      fi
483117a48c7cSmrg
483217a48c7cSmrg      if test "$hardcode_action" = relink; then
483317a48c7cSmrg	# Fast installation is not supported
483417a48c7cSmrg	link_command="$compile_var$compile_command$compile_rpath"
483517a48c7cSmrg	relink_command="$finalize_var$finalize_command$finalize_rpath"
483617a48c7cSmrg
483717a48c7cSmrg	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
483817a48c7cSmrg	$echo "$modename: \`$output' will be relinked during installation" 1>&2
483917a48c7cSmrg      else
484017a48c7cSmrg	if test "$fast_install" != no; then
484117a48c7cSmrg	  link_command="$finalize_var$compile_command$finalize_rpath"
484217a48c7cSmrg	  if test "$fast_install" = yes; then
48438e0ed500Smrg	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
484417a48c7cSmrg	  else
484517a48c7cSmrg	    # fast_install is set to needless
484617a48c7cSmrg	    relink_command=
484717a48c7cSmrg	  fi
484817a48c7cSmrg	else
484917a48c7cSmrg	  link_command="$compile_var$compile_command$compile_rpath"
485017a48c7cSmrg	  relink_command="$finalize_var$finalize_command$finalize_rpath"
485117a48c7cSmrg	fi
485217a48c7cSmrg      fi
485317a48c7cSmrg
485417a48c7cSmrg      # Replace the output file specification.
485517a48c7cSmrg      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
485617a48c7cSmrg
485717a48c7cSmrg      # Delete the old output files.
485817a48c7cSmrg      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
485917a48c7cSmrg
486017a48c7cSmrg      $show "$link_command"
486117a48c7cSmrg      $run eval "$link_command" || exit $?
486217a48c7cSmrg
486317a48c7cSmrg      # Now create the wrapper script.
486417a48c7cSmrg      $show "creating $output"
486517a48c7cSmrg
486617a48c7cSmrg      # Quote the relink command for shipping.
486717a48c7cSmrg      if test -n "$relink_command"; then
486817a48c7cSmrg	# Preserve any variables that may affect compiler behavior
486917a48c7cSmrg	for var in $variables_saved_for_relink; do
487017a48c7cSmrg	  if eval test -z \"\${$var+set}\"; then
487117a48c7cSmrg	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
487217a48c7cSmrg	  elif eval var_value=\$$var; test -z "$var_value"; then
487317a48c7cSmrg	    relink_command="$var=; export $var; $relink_command"
487417a48c7cSmrg	  else
487517a48c7cSmrg	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
487617a48c7cSmrg	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
487717a48c7cSmrg	  fi
487817a48c7cSmrg	done
487917a48c7cSmrg	relink_command="(cd `pwd`; $relink_command)"
48808e0ed500Smrg	relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
488117a48c7cSmrg      fi
488217a48c7cSmrg
488317a48c7cSmrg      # Quote $echo for shipping.
488417a48c7cSmrg      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
488517a48c7cSmrg	case $progpath in
488617a48c7cSmrg	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
488717a48c7cSmrg	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
488817a48c7cSmrg	esac
488917a48c7cSmrg	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
489017a48c7cSmrg      else
489117a48c7cSmrg	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
489217a48c7cSmrg      fi
489317a48c7cSmrg
489417a48c7cSmrg      # Only actually do things if our run command is non-null.
489517a48c7cSmrg      if test -z "$run"; then
489617a48c7cSmrg	# win32 will think the script is a binary if it has
489717a48c7cSmrg	# a .exe suffix, so we strip it off here.
489817a48c7cSmrg	case $output in
489917a48c7cSmrg	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
490017a48c7cSmrg	esac
490117a48c7cSmrg	# test for cygwin because mv fails w/o .exe extensions
490217a48c7cSmrg	case $host in
490317a48c7cSmrg	  *cygwin*)
490417a48c7cSmrg	    exeext=.exe
490517a48c7cSmrg	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
490617a48c7cSmrg	  *) exeext= ;;
490717a48c7cSmrg	esac
490817a48c7cSmrg	case $host in
490917a48c7cSmrg	  *cygwin* | *mingw* )
491017a48c7cSmrg            output_name=`basename $output`
491117a48c7cSmrg            output_path=`dirname $output`
491217a48c7cSmrg            cwrappersource="$output_path/$objdir/lt-$output_name.c"
491317a48c7cSmrg            cwrapper="$output_path/$output_name.exe"
491417a48c7cSmrg            $rm $cwrappersource $cwrapper
491517a48c7cSmrg            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
491617a48c7cSmrg
491717a48c7cSmrg	    cat > $cwrappersource <<EOF
491817a48c7cSmrg
491917a48c7cSmrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
492017a48c7cSmrg   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
492117a48c7cSmrg
492217a48c7cSmrg   The $output program cannot be directly executed until all the libtool
492317a48c7cSmrg   libraries that it depends on are installed.
492417a48c7cSmrg
492517a48c7cSmrg   This wrapper executable should never be moved out of the build directory.
492617a48c7cSmrg   If it is, it will not operate correctly.
492717a48c7cSmrg
492817a48c7cSmrg   Currently, it simply execs the wrapper *script* "/bin/sh $output",
492917a48c7cSmrg   but could eventually absorb all of the scripts functionality and
493017a48c7cSmrg   exec $objdir/$outputname directly.
493117a48c7cSmrg*/
493217a48c7cSmrgEOF
493317a48c7cSmrg	    cat >> $cwrappersource<<"EOF"
493417a48c7cSmrg#include <stdio.h>
493517a48c7cSmrg#include <stdlib.h>
493617a48c7cSmrg#include <unistd.h>
493717a48c7cSmrg#include <malloc.h>
493817a48c7cSmrg#include <stdarg.h>
493917a48c7cSmrg#include <assert.h>
494017a48c7cSmrg#include <string.h>
494117a48c7cSmrg#include <ctype.h>
494217a48c7cSmrg#include <sys/stat.h>
494317a48c7cSmrg
494417a48c7cSmrg#if defined(PATH_MAX)
494517a48c7cSmrg# define LT_PATHMAX PATH_MAX
494617a48c7cSmrg#elif defined(MAXPATHLEN)
494717a48c7cSmrg# define LT_PATHMAX MAXPATHLEN
494817a48c7cSmrg#else
494917a48c7cSmrg# define LT_PATHMAX 1024
495017a48c7cSmrg#endif
495117a48c7cSmrg
495217a48c7cSmrg#ifndef DIR_SEPARATOR
495317a48c7cSmrg# define DIR_SEPARATOR '/'
495417a48c7cSmrg# define PATH_SEPARATOR ':'
495517a48c7cSmrg#endif
495617a48c7cSmrg
495717a48c7cSmrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
495817a48c7cSmrg  defined (__OS2__)
495917a48c7cSmrg# define HAVE_DOS_BASED_FILE_SYSTEM
496017a48c7cSmrg# ifndef DIR_SEPARATOR_2
496117a48c7cSmrg#  define DIR_SEPARATOR_2 '\\'
496217a48c7cSmrg# endif
496317a48c7cSmrg# ifndef PATH_SEPARATOR_2
496417a48c7cSmrg#  define PATH_SEPARATOR_2 ';'
496517a48c7cSmrg# endif
496617a48c7cSmrg#endif
496717a48c7cSmrg
496817a48c7cSmrg#ifndef DIR_SEPARATOR_2
496917a48c7cSmrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
497017a48c7cSmrg#else /* DIR_SEPARATOR_2 */
497117a48c7cSmrg# define IS_DIR_SEPARATOR(ch) \
497217a48c7cSmrg        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
497317a48c7cSmrg#endif /* DIR_SEPARATOR_2 */
497417a48c7cSmrg
497517a48c7cSmrg#ifndef PATH_SEPARATOR_2
497617a48c7cSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
497717a48c7cSmrg#else /* PATH_SEPARATOR_2 */
497817a48c7cSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
497917a48c7cSmrg#endif /* PATH_SEPARATOR_2 */
498017a48c7cSmrg
498117a48c7cSmrg#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
498217a48c7cSmrg#define XFREE(stale) do { \
498317a48c7cSmrg  if (stale) { free ((void *) stale); stale = 0; } \
498417a48c7cSmrg} while (0)
498517a48c7cSmrg
498617a48c7cSmrg/* -DDEBUG is fairly common in CFLAGS.  */
498717a48c7cSmrg#undef DEBUG
498817a48c7cSmrg#if defined DEBUGWRAPPER
498917a48c7cSmrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
499017a48c7cSmrg#else
499117a48c7cSmrg# define DEBUG(format, ...)
499217a48c7cSmrg#endif
499317a48c7cSmrg
499417a48c7cSmrgconst char *program_name = NULL;
499517a48c7cSmrg
499617a48c7cSmrgvoid * xmalloc (size_t num);
499717a48c7cSmrgchar * xstrdup (const char *string);
499817a48c7cSmrgconst char * base_name (const char *name);
499917a48c7cSmrgchar * find_executable(const char *wrapper);
500017a48c7cSmrgint    check_executable(const char *path);
500117a48c7cSmrgchar * strendzap(char *str, const char *pat);
500217a48c7cSmrgvoid lt_fatal (const char *message, ...);
500317a48c7cSmrg
500417a48c7cSmrgint
500517a48c7cSmrgmain (int argc, char *argv[])
500617a48c7cSmrg{
500717a48c7cSmrg  char **newargz;
500817a48c7cSmrg  int i;
500917a48c7cSmrg
501017a48c7cSmrg  program_name = (char *) xstrdup (base_name (argv[0]));
501117a48c7cSmrg  DEBUG("(main) argv[0]      : %s\n",argv[0]);
501217a48c7cSmrg  DEBUG("(main) program_name : %s\n",program_name);
501317a48c7cSmrg  newargz = XMALLOC(char *, argc+2);
501417a48c7cSmrgEOF
501517a48c7cSmrg
501617a48c7cSmrg            cat >> $cwrappersource <<EOF
501717a48c7cSmrg  newargz[0] = (char *) xstrdup("$SHELL");
501817a48c7cSmrgEOF
501917a48c7cSmrg
502017a48c7cSmrg            cat >> $cwrappersource <<"EOF"
502117a48c7cSmrg  newargz[1] = find_executable(argv[0]);
502217a48c7cSmrg  if (newargz[1] == NULL)
502317a48c7cSmrg    lt_fatal("Couldn't find %s", argv[0]);
502417a48c7cSmrg  DEBUG("(main) found exe at : %s\n",newargz[1]);
502517a48c7cSmrg  /* we know the script has the same name, without the .exe */
502617a48c7cSmrg  /* so make sure newargz[1] doesn't end in .exe */
502717a48c7cSmrg  strendzap(newargz[1],".exe");
502817a48c7cSmrg  for (i = 1; i < argc; i++)
502917a48c7cSmrg    newargz[i+1] = xstrdup(argv[i]);
503017a48c7cSmrg  newargz[argc+1] = NULL;
503117a48c7cSmrg
503217a48c7cSmrg  for (i=0; i<argc+1; i++)
503317a48c7cSmrg  {
503417a48c7cSmrg    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
503517a48c7cSmrg    ;
503617a48c7cSmrg  }
503717a48c7cSmrg
503817a48c7cSmrgEOF
503917a48c7cSmrg
504017a48c7cSmrg            case $host_os in
504117a48c7cSmrg              mingw*)
504217a48c7cSmrg                cat >> $cwrappersource <<EOF
504317a48c7cSmrg  execv("$SHELL",(char const **)newargz);
504417a48c7cSmrgEOF
504517a48c7cSmrg              ;;
504617a48c7cSmrg              *)
504717a48c7cSmrg                cat >> $cwrappersource <<EOF
504817a48c7cSmrg  execv("$SHELL",newargz);
504917a48c7cSmrgEOF
505017a48c7cSmrg              ;;
505117a48c7cSmrg            esac
505217a48c7cSmrg
505317a48c7cSmrg            cat >> $cwrappersource <<"EOF"
505417a48c7cSmrg  return 127;
505517a48c7cSmrg}
505617a48c7cSmrg
505717a48c7cSmrgvoid *
505817a48c7cSmrgxmalloc (size_t num)
505917a48c7cSmrg{
506017a48c7cSmrg  void * p = (void *) malloc (num);
506117a48c7cSmrg  if (!p)
506217a48c7cSmrg    lt_fatal ("Memory exhausted");
506317a48c7cSmrg
506417a48c7cSmrg  return p;
506517a48c7cSmrg}
506617a48c7cSmrg
506717a48c7cSmrgchar *
506817a48c7cSmrgxstrdup (const char *string)
506917a48c7cSmrg{
507017a48c7cSmrg  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
507117a48c7cSmrg;
507217a48c7cSmrg}
507317a48c7cSmrg
507417a48c7cSmrgconst char *
507517a48c7cSmrgbase_name (const char *name)
507617a48c7cSmrg{
507717a48c7cSmrg  const char *base;
507817a48c7cSmrg
507917a48c7cSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
508017a48c7cSmrg  /* Skip over the disk name in MSDOS pathnames. */
508117a48c7cSmrg  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
508217a48c7cSmrg    name += 2;
508317a48c7cSmrg#endif
508417a48c7cSmrg
508517a48c7cSmrg  for (base = name; *name; name++)
508617a48c7cSmrg    if (IS_DIR_SEPARATOR (*name))
508717a48c7cSmrg      base = name + 1;
508817a48c7cSmrg  return base;
508917a48c7cSmrg}
509017a48c7cSmrg
509117a48c7cSmrgint
509217a48c7cSmrgcheck_executable(const char * path)
509317a48c7cSmrg{
509417a48c7cSmrg  struct stat st;
509517a48c7cSmrg
509617a48c7cSmrg  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
509717a48c7cSmrg  if ((!path) || (!*path))
509817a48c7cSmrg    return 0;
509917a48c7cSmrg
510017a48c7cSmrg  if ((stat (path, &st) >= 0) &&
510117a48c7cSmrg      (
510217a48c7cSmrg        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
510317a48c7cSmrg#if defined (S_IXOTH)
510417a48c7cSmrg       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
510517a48c7cSmrg#endif
510617a48c7cSmrg#if defined (S_IXGRP)
510717a48c7cSmrg       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
510817a48c7cSmrg#endif
510917a48c7cSmrg       ((st.st_mode & S_IXUSR) == S_IXUSR))
511017a48c7cSmrg      )
511117a48c7cSmrg    return 1;
511217a48c7cSmrg  else
511317a48c7cSmrg    return 0;
511417a48c7cSmrg}
511517a48c7cSmrg
511617a48c7cSmrg/* Searches for the full path of the wrapper.  Returns
511717a48c7cSmrg   newly allocated full path name if found, NULL otherwise */
511817a48c7cSmrgchar *
511917a48c7cSmrgfind_executable (const char* wrapper)
512017a48c7cSmrg{
512117a48c7cSmrg  int has_slash = 0;
512217a48c7cSmrg  const char* p;
512317a48c7cSmrg  const char* p_next;
512417a48c7cSmrg  /* static buffer for getcwd */
512517a48c7cSmrg  char tmp[LT_PATHMAX + 1];
512617a48c7cSmrg  int tmp_len;
512717a48c7cSmrg  char* concat_name;
512817a48c7cSmrg
512917a48c7cSmrg  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
513017a48c7cSmrg
513117a48c7cSmrg  if ((wrapper == NULL) || (*wrapper == '\0'))
513217a48c7cSmrg    return NULL;
513317a48c7cSmrg
513417a48c7cSmrg  /* Absolute path? */
513517a48c7cSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
513617a48c7cSmrg  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
513717a48c7cSmrg  {
513817a48c7cSmrg    concat_name = xstrdup (wrapper);
513917a48c7cSmrg    if (check_executable(concat_name))
514017a48c7cSmrg      return concat_name;
514117a48c7cSmrg    XFREE(concat_name);
514217a48c7cSmrg  }
514317a48c7cSmrg  else
514417a48c7cSmrg  {
514517a48c7cSmrg#endif
514617a48c7cSmrg    if (IS_DIR_SEPARATOR (wrapper[0]))
514717a48c7cSmrg    {
514817a48c7cSmrg      concat_name = xstrdup (wrapper);
514917a48c7cSmrg      if (check_executable(concat_name))
515017a48c7cSmrg        return concat_name;
515117a48c7cSmrg      XFREE(concat_name);
515217a48c7cSmrg    }
515317a48c7cSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
515417a48c7cSmrg  }
515517a48c7cSmrg#endif
515617a48c7cSmrg
515717a48c7cSmrg  for (p = wrapper; *p; p++)
515817a48c7cSmrg    if (*p == '/')
515917a48c7cSmrg    {
516017a48c7cSmrg      has_slash = 1;
516117a48c7cSmrg      break;
516217a48c7cSmrg    }
516317a48c7cSmrg  if (!has_slash)
516417a48c7cSmrg  {
516517a48c7cSmrg    /* no slashes; search PATH */
516617a48c7cSmrg    const char* path = getenv ("PATH");
516717a48c7cSmrg    if (path != NULL)
516817a48c7cSmrg    {
516917a48c7cSmrg      for (p = path; *p; p = p_next)
517017a48c7cSmrg      {
517117a48c7cSmrg        const char* q;
517217a48c7cSmrg        size_t p_len;
517317a48c7cSmrg        for (q = p; *q; q++)
517417a48c7cSmrg          if (IS_PATH_SEPARATOR(*q))
517517a48c7cSmrg            break;
517617a48c7cSmrg        p_len = q - p;
517717a48c7cSmrg        p_next = (*q == '\0' ? q : q + 1);
517817a48c7cSmrg        if (p_len == 0)
517917a48c7cSmrg        {
518017a48c7cSmrg          /* empty path: current directory */
518117a48c7cSmrg          if (getcwd (tmp, LT_PATHMAX) == NULL)
518217a48c7cSmrg            lt_fatal ("getcwd failed");
518317a48c7cSmrg          tmp_len = strlen(tmp);
518417a48c7cSmrg          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
518517a48c7cSmrg          memcpy (concat_name, tmp, tmp_len);
518617a48c7cSmrg          concat_name[tmp_len] = '/';
518717a48c7cSmrg          strcpy (concat_name + tmp_len + 1, wrapper);
518817a48c7cSmrg        }
518917a48c7cSmrg        else
519017a48c7cSmrg        {
519117a48c7cSmrg          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
519217a48c7cSmrg          memcpy (concat_name, p, p_len);
519317a48c7cSmrg          concat_name[p_len] = '/';
519417a48c7cSmrg          strcpy (concat_name + p_len + 1, wrapper);
519517a48c7cSmrg        }
519617a48c7cSmrg        if (check_executable(concat_name))
519717a48c7cSmrg          return concat_name;
519817a48c7cSmrg        XFREE(concat_name);
519917a48c7cSmrg      }
520017a48c7cSmrg    }
520117a48c7cSmrg    /* not found in PATH; assume curdir */
520217a48c7cSmrg  }
520317a48c7cSmrg  /* Relative path | not found in path: prepend cwd */
520417a48c7cSmrg  if (getcwd (tmp, LT_PATHMAX) == NULL)
520517a48c7cSmrg    lt_fatal ("getcwd failed");
520617a48c7cSmrg  tmp_len = strlen(tmp);
520717a48c7cSmrg  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
520817a48c7cSmrg  memcpy (concat_name, tmp, tmp_len);
520917a48c7cSmrg  concat_name[tmp_len] = '/';
521017a48c7cSmrg  strcpy (concat_name + tmp_len + 1, wrapper);
521117a48c7cSmrg
521217a48c7cSmrg  if (check_executable(concat_name))
521317a48c7cSmrg    return concat_name;
521417a48c7cSmrg  XFREE(concat_name);
521517a48c7cSmrg  return NULL;
521617a48c7cSmrg}
521717a48c7cSmrg
521817a48c7cSmrgchar *
521917a48c7cSmrgstrendzap(char *str, const char *pat)
522017a48c7cSmrg{
522117a48c7cSmrg  size_t len, patlen;
522217a48c7cSmrg
522317a48c7cSmrg  assert(str != NULL);
522417a48c7cSmrg  assert(pat != NULL);
522517a48c7cSmrg
522617a48c7cSmrg  len = strlen(str);
522717a48c7cSmrg  patlen = strlen(pat);
522817a48c7cSmrg
522917a48c7cSmrg  if (patlen <= len)
523017a48c7cSmrg  {
523117a48c7cSmrg    str += len - patlen;
523217a48c7cSmrg    if (strcmp(str, pat) == 0)
523317a48c7cSmrg      *str = '\0';
523417a48c7cSmrg  }
523517a48c7cSmrg  return str;
523617a48c7cSmrg}
523717a48c7cSmrg
523817a48c7cSmrgstatic void
523917a48c7cSmrglt_error_core (int exit_status, const char * mode,
524017a48c7cSmrg          const char * message, va_list ap)
524117a48c7cSmrg{
524217a48c7cSmrg  fprintf (stderr, "%s: %s: ", program_name, mode);
524317a48c7cSmrg  vfprintf (stderr, message, ap);
524417a48c7cSmrg  fprintf (stderr, ".\n");
524517a48c7cSmrg
524617a48c7cSmrg  if (exit_status >= 0)
524717a48c7cSmrg    exit (exit_status);
524817a48c7cSmrg}
524917a48c7cSmrg
525017a48c7cSmrgvoid
525117a48c7cSmrglt_fatal (const char *message, ...)
525217a48c7cSmrg{
525317a48c7cSmrg  va_list ap;
525417a48c7cSmrg  va_start (ap, message);
525517a48c7cSmrg  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
525617a48c7cSmrg  va_end (ap);
525717a48c7cSmrg}
525817a48c7cSmrgEOF
525917a48c7cSmrg          # we should really use a build-platform specific compiler
526017a48c7cSmrg          # here, but OTOH, the wrappers (shell script and this C one)
526117a48c7cSmrg          # are only useful if you want to execute the "real" binary.
526217a48c7cSmrg          # Since the "real" binary is built for $host, then this
526317a48c7cSmrg          # wrapper might as well be built for $host, too.
526417a48c7cSmrg          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
526517a48c7cSmrg          ;;
526617a48c7cSmrg        esac
526717a48c7cSmrg        $rm $output
526817a48c7cSmrg        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
526917a48c7cSmrg
527017a48c7cSmrg	$echo > $output "\
527117a48c7cSmrg#! $SHELL
527217a48c7cSmrg
527317a48c7cSmrg# $output - temporary wrapper script for $objdir/$outputname
527417a48c7cSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
527517a48c7cSmrg#
527617a48c7cSmrg# The $output program cannot be directly executed until all the libtool
527717a48c7cSmrg# libraries that it depends on are installed.
527817a48c7cSmrg#
527917a48c7cSmrg# This wrapper script should never be moved out of the build directory.
528017a48c7cSmrg# If it is, it will not operate correctly.
528117a48c7cSmrg
528217a48c7cSmrg# Sed substitution that helps us do robust quoting.  It backslashifies
528317a48c7cSmrg# metacharacters that are still active within double-quoted strings.
528417a48c7cSmrgXsed='${SED} -e 1s/^X//'
528517a48c7cSmrgsed_quote_subst='$sed_quote_subst'
528617a48c7cSmrg
52878e0ed500Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
52888e0ed500Smrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
52898e0ed500Smrg  emulate sh
52908e0ed500Smrg  NULLCMD=:
52918e0ed500Smrg  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
52928e0ed500Smrg  # is contrary to our usage.  Disable this feature.
52938e0ed500Smrg  alias -g '\${1+\"\$@\"}'='\"\$@\"'
52948e0ed500Smrg  setopt NO_GLOB_SUBST
52958e0ed500Smrgelse
52968e0ed500Smrg  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
52978e0ed500Smrgfi
52988e0ed500Smrg
529917a48c7cSmrg# The HP-UX ksh and POSIX shell print the target directory to stdout
530017a48c7cSmrg# if CDPATH is set.
530117a48c7cSmrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
530217a48c7cSmrg
530317a48c7cSmrgrelink_command=\"$relink_command\"
530417a48c7cSmrg
530517a48c7cSmrg# This environment variable determines our operation mode.
530617a48c7cSmrgif test \"\$libtool_install_magic\" = \"$magic\"; then
530717a48c7cSmrg  # install mode needs the following variable:
530817a48c7cSmrg  notinst_deplibs='$notinst_deplibs'
530917a48c7cSmrgelse
531017a48c7cSmrg  # When we are sourced in execute mode, \$file and \$echo are already set.
531117a48c7cSmrg  if test \"\$libtool_execute_magic\" != \"$magic\"; then
531217a48c7cSmrg    echo=\"$qecho\"
531317a48c7cSmrg    file=\"\$0\"
531417a48c7cSmrg    # Make sure echo works.
531517a48c7cSmrg    if test \"X\$1\" = X--no-reexec; then
531617a48c7cSmrg      # Discard the --no-reexec flag, and continue.
531717a48c7cSmrg      shift
531817a48c7cSmrg    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
531917a48c7cSmrg      # Yippee, \$echo works!
532017a48c7cSmrg      :
532117a48c7cSmrg    else
532217a48c7cSmrg      # Restart under the correct shell, and then maybe \$echo will work.
532317a48c7cSmrg      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
532417a48c7cSmrg    fi
532517a48c7cSmrg  fi\
532617a48c7cSmrg"
532717a48c7cSmrg	$echo >> $output "\
532817a48c7cSmrg
532917a48c7cSmrg  # Find the directory that this script lives in.
533017a48c7cSmrg  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
533117a48c7cSmrg  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
533217a48c7cSmrg
533317a48c7cSmrg  # Follow symbolic links until we get to the real thisdir.
533417a48c7cSmrg  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
533517a48c7cSmrg  while test -n \"\$file\"; do
533617a48c7cSmrg    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
533717a48c7cSmrg
533817a48c7cSmrg    # If there was a directory component, then change thisdir.
533917a48c7cSmrg    if test \"x\$destdir\" != \"x\$file\"; then
534017a48c7cSmrg      case \"\$destdir\" in
534117a48c7cSmrg      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
534217a48c7cSmrg      *) thisdir=\"\$thisdir/\$destdir\" ;;
534317a48c7cSmrg      esac
534417a48c7cSmrg    fi
534517a48c7cSmrg
534617a48c7cSmrg    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
534717a48c7cSmrg    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
534817a48c7cSmrg  done
534917a48c7cSmrg
535017a48c7cSmrg  # Try to get the absolute directory name.
535117a48c7cSmrg  absdir=\`cd \"\$thisdir\" && pwd\`
535217a48c7cSmrg  test -n \"\$absdir\" && thisdir=\"\$absdir\"
535317a48c7cSmrg"
535417a48c7cSmrg
535517a48c7cSmrg	if test "$fast_install" = yes; then
535617a48c7cSmrg	  $echo >> $output "\
535717a48c7cSmrg  program=lt-'$outputname'$exeext
535817a48c7cSmrg  progdir=\"\$thisdir/$objdir\"
535917a48c7cSmrg
536017a48c7cSmrg  if test ! -f \"\$progdir/\$program\" || \\
536117a48c7cSmrg     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
536217a48c7cSmrg       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
536317a48c7cSmrg
536417a48c7cSmrg    file=\"\$\$-\$program\"
536517a48c7cSmrg
536617a48c7cSmrg    if test ! -d \"\$progdir\"; then
536717a48c7cSmrg      $mkdir \"\$progdir\"
536817a48c7cSmrg    else
536917a48c7cSmrg      $rm \"\$progdir/\$file\"
537017a48c7cSmrg    fi"
537117a48c7cSmrg
537217a48c7cSmrg	  $echo >> $output "\
537317a48c7cSmrg
537417a48c7cSmrg    # relink executable if necessary
537517a48c7cSmrg    if test -n \"\$relink_command\"; then
537617a48c7cSmrg      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
537717a48c7cSmrg      else
537817a48c7cSmrg	$echo \"\$relink_command_output\" >&2
537917a48c7cSmrg	$rm \"\$progdir/\$file\"
538017a48c7cSmrg	exit $EXIT_FAILURE
538117a48c7cSmrg      fi
538217a48c7cSmrg    fi
538317a48c7cSmrg
538417a48c7cSmrg    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
538517a48c7cSmrg    { $rm \"\$progdir/\$program\";
538617a48c7cSmrg      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
538717a48c7cSmrg    $rm \"\$progdir/\$file\"
538817a48c7cSmrg  fi"
538917a48c7cSmrg	else
539017a48c7cSmrg	  $echo >> $output "\
539117a48c7cSmrg  program='$outputname'
539217a48c7cSmrg  progdir=\"\$thisdir/$objdir\"
539317a48c7cSmrg"
539417a48c7cSmrg	fi
539517a48c7cSmrg
539617a48c7cSmrg	$echo >> $output "\
539717a48c7cSmrg
539817a48c7cSmrg  if test -f \"\$progdir/\$program\"; then"
539917a48c7cSmrg
540017a48c7cSmrg	# Export our shlibpath_var if we have one.
540117a48c7cSmrg	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
540217a48c7cSmrg	  $echo >> $output "\
540317a48c7cSmrg    # Add our own library path to $shlibpath_var
540417a48c7cSmrg    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
540517a48c7cSmrg
540617a48c7cSmrg    # Some systems cannot cope with colon-terminated $shlibpath_var
540717a48c7cSmrg    # The second colon is a workaround for a bug in BeOS R4 sed
540817a48c7cSmrg    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
540917a48c7cSmrg
541017a48c7cSmrg    export $shlibpath_var
541117a48c7cSmrg"
541217a48c7cSmrg	fi
541317a48c7cSmrg
541417a48c7cSmrg	# fixup the dll searchpath if we need to.
541517a48c7cSmrg	if test -n "$dllsearchpath"; then
541617a48c7cSmrg	  $echo >> $output "\
541717a48c7cSmrg    # Add the dll search path components to the executable PATH
541817a48c7cSmrg    PATH=$dllsearchpath:\$PATH
541917a48c7cSmrg"
542017a48c7cSmrg	fi
542117a48c7cSmrg
542217a48c7cSmrg	$echo >> $output "\
542317a48c7cSmrg    if test \"\$libtool_execute_magic\" != \"$magic\"; then
542417a48c7cSmrg      # Run the actual program with our arguments.
542517a48c7cSmrg"
542617a48c7cSmrg	case $host in
542717a48c7cSmrg	# Backslashes separate directories on plain windows
542817a48c7cSmrg	*-*-mingw | *-*-os2*)
542917a48c7cSmrg	  $echo >> $output "\
543017a48c7cSmrg      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
543117a48c7cSmrg"
543217a48c7cSmrg	  ;;
543317a48c7cSmrg
543417a48c7cSmrg	*)
543517a48c7cSmrg	  $echo >> $output "\
543617a48c7cSmrg      exec \"\$progdir/\$program\" \${1+\"\$@\"}
543717a48c7cSmrg"
543817a48c7cSmrg	  ;;
543917a48c7cSmrg	esac
544017a48c7cSmrg	$echo >> $output "\
54418e0ed500Smrg      \$echo \"\$0: cannot exec \$program \$*\"
544217a48c7cSmrg      exit $EXIT_FAILURE
544317a48c7cSmrg    fi
544417a48c7cSmrg  else
544517a48c7cSmrg    # The program doesn't exist.
544617a48c7cSmrg    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
544717a48c7cSmrg    \$echo \"This script is just a wrapper for \$program.\" 1>&2
544817a48c7cSmrg    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
544917a48c7cSmrg    exit $EXIT_FAILURE
545017a48c7cSmrg  fi
545117a48c7cSmrgfi\
545217a48c7cSmrg"
545317a48c7cSmrg	chmod +x $output
545417a48c7cSmrg      fi
545517a48c7cSmrg      exit $EXIT_SUCCESS
545617a48c7cSmrg      ;;
545717a48c7cSmrg    esac
545817a48c7cSmrg
545917a48c7cSmrg    # See if we need to build an old-fashioned archive.
546017a48c7cSmrg    for oldlib in $oldlibs; do
546117a48c7cSmrg
546217a48c7cSmrg      if test "$build_libtool_libs" = convenience; then
546317a48c7cSmrg	oldobjs="$libobjs_save"
546417a48c7cSmrg	addlibs="$convenience"
546517a48c7cSmrg	build_libtool_libs=no
546617a48c7cSmrg      else
546717a48c7cSmrg	if test "$build_libtool_libs" = module; then
546817a48c7cSmrg	  oldobjs="$libobjs_save"
546917a48c7cSmrg	  build_libtool_libs=no
547017a48c7cSmrg	else
547117a48c7cSmrg	  oldobjs="$old_deplibs $non_pic_objects"
547217a48c7cSmrg	fi
547317a48c7cSmrg	addlibs="$old_convenience"
547417a48c7cSmrg      fi
547517a48c7cSmrg
547617a48c7cSmrg      if test -n "$addlibs"; then
547717a48c7cSmrg	gentop="$output_objdir/${outputname}x"
547817a48c7cSmrg	generated="$generated $gentop"
547917a48c7cSmrg
548017a48c7cSmrg	func_extract_archives $gentop $addlibs
548117a48c7cSmrg	oldobjs="$oldobjs $func_extract_archives_result"
548217a48c7cSmrg      fi
548317a48c7cSmrg
548417a48c7cSmrg      # Do each command in the archive commands.
548517a48c7cSmrg      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
548617a48c7cSmrg       cmds=$old_archive_from_new_cmds
548717a48c7cSmrg      else
548817a48c7cSmrg	# POSIX demands no paths to be encoded in archives.  We have
548917a48c7cSmrg	# to avoid creating archives with duplicate basenames if we
549017a48c7cSmrg	# might have to extract them afterwards, e.g., when creating a
549117a48c7cSmrg	# static archive out of a convenience library, or when linking
549217a48c7cSmrg	# the entirety of a libtool archive into another (currently
549317a48c7cSmrg	# not supported by libtool).
549417a48c7cSmrg	if (for obj in $oldobjs
549517a48c7cSmrg	    do
549617a48c7cSmrg	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
549717a48c7cSmrg	    done | sort | sort -uc >/dev/null 2>&1); then
549817a48c7cSmrg	  :
549917a48c7cSmrg	else
550017a48c7cSmrg	  $echo "copying selected object files to avoid basename conflicts..."
550117a48c7cSmrg
550217a48c7cSmrg	  if test -z "$gentop"; then
550317a48c7cSmrg	    gentop="$output_objdir/${outputname}x"
550417a48c7cSmrg	    generated="$generated $gentop"
550517a48c7cSmrg
550617a48c7cSmrg	    $show "${rm}r $gentop"
550717a48c7cSmrg	    $run ${rm}r "$gentop"
550817a48c7cSmrg	    $show "$mkdir $gentop"
550917a48c7cSmrg	    $run $mkdir "$gentop"
551017a48c7cSmrg	    exit_status=$?
551117a48c7cSmrg	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
551217a48c7cSmrg	      exit $exit_status
551317a48c7cSmrg	    fi
551417a48c7cSmrg	  fi
551517a48c7cSmrg
551617a48c7cSmrg	  save_oldobjs=$oldobjs
551717a48c7cSmrg	  oldobjs=
551817a48c7cSmrg	  counter=1
551917a48c7cSmrg	  for obj in $save_oldobjs
552017a48c7cSmrg	  do
552117a48c7cSmrg	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
552217a48c7cSmrg	    case " $oldobjs " in
552317a48c7cSmrg	    " ") oldobjs=$obj ;;
552417a48c7cSmrg	    *[\ /]"$objbase "*)
552517a48c7cSmrg	      while :; do
552617a48c7cSmrg		# Make sure we don't pick an alternate name that also
552717a48c7cSmrg		# overlaps.
552817a48c7cSmrg		newobj=lt$counter-$objbase
552917a48c7cSmrg		counter=`expr $counter + 1`
553017a48c7cSmrg		case " $oldobjs " in
553117a48c7cSmrg		*[\ /]"$newobj "*) ;;
553217a48c7cSmrg		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
553317a48c7cSmrg		esac
553417a48c7cSmrg	      done
553517a48c7cSmrg	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
553617a48c7cSmrg	      $run ln "$obj" "$gentop/$newobj" ||
553717a48c7cSmrg	      $run cp "$obj" "$gentop/$newobj"
553817a48c7cSmrg	      oldobjs="$oldobjs $gentop/$newobj"
553917a48c7cSmrg	      ;;
554017a48c7cSmrg	    *) oldobjs="$oldobjs $obj" ;;
554117a48c7cSmrg	    esac
554217a48c7cSmrg	  done
554317a48c7cSmrg	fi
554417a48c7cSmrg
554517a48c7cSmrg	eval cmds=\"$old_archive_cmds\"
554617a48c7cSmrg
554717a48c7cSmrg	if len=`expr "X$cmds" : ".*"` &&
554817a48c7cSmrg	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
554917a48c7cSmrg	  cmds=$old_archive_cmds
555017a48c7cSmrg	else
555117a48c7cSmrg	  # the command line is too long to link in one step, link in parts
555217a48c7cSmrg	  $echo "using piecewise archive linking..."
555317a48c7cSmrg	  save_RANLIB=$RANLIB
555417a48c7cSmrg	  RANLIB=:
555517a48c7cSmrg	  objlist=
555617a48c7cSmrg	  concat_cmds=
555717a48c7cSmrg	  save_oldobjs=$oldobjs
555817a48c7cSmrg
555917a48c7cSmrg	  # Is there a better way of finding the last object in the list?
556017a48c7cSmrg	  for obj in $save_oldobjs
556117a48c7cSmrg	  do
556217a48c7cSmrg	    last_oldobj=$obj
556317a48c7cSmrg	  done
556417a48c7cSmrg	  for obj in $save_oldobjs
556517a48c7cSmrg	  do
556617a48c7cSmrg	    oldobjs="$objlist $obj"
556717a48c7cSmrg	    objlist="$objlist $obj"
556817a48c7cSmrg	    eval test_cmds=\"$old_archive_cmds\"
556917a48c7cSmrg	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
557017a48c7cSmrg	       test "$len" -le "$max_cmd_len"; then
557117a48c7cSmrg	      :
557217a48c7cSmrg	    else
557317a48c7cSmrg	      # the above command should be used before it gets too long
557417a48c7cSmrg	      oldobjs=$objlist
557517a48c7cSmrg	      if test "$obj" = "$last_oldobj" ; then
557617a48c7cSmrg	        RANLIB=$save_RANLIB
557717a48c7cSmrg	      fi
557817a48c7cSmrg	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
557917a48c7cSmrg	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
558017a48c7cSmrg	      objlist=
558117a48c7cSmrg	    fi
558217a48c7cSmrg	  done
558317a48c7cSmrg	  RANLIB=$save_RANLIB
558417a48c7cSmrg	  oldobjs=$objlist
558517a48c7cSmrg	  if test "X$oldobjs" = "X" ; then
558617a48c7cSmrg	    eval cmds=\"\$concat_cmds\"
558717a48c7cSmrg	  else
558817a48c7cSmrg	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
558917a48c7cSmrg	  fi
559017a48c7cSmrg	fi
559117a48c7cSmrg      fi
559217a48c7cSmrg      save_ifs="$IFS"; IFS='~'
559317a48c7cSmrg      for cmd in $cmds; do
559417a48c7cSmrg        eval cmd=\"$cmd\"
559517a48c7cSmrg	IFS="$save_ifs"
559617a48c7cSmrg	$show "$cmd"
559717a48c7cSmrg	$run eval "$cmd" || exit $?
559817a48c7cSmrg      done
559917a48c7cSmrg      IFS="$save_ifs"
560017a48c7cSmrg    done
560117a48c7cSmrg
560217a48c7cSmrg    if test -n "$generated"; then
560317a48c7cSmrg      $show "${rm}r$generated"
560417a48c7cSmrg      $run ${rm}r$generated
560517a48c7cSmrg    fi
560617a48c7cSmrg
560717a48c7cSmrg    # Now create the libtool archive.
560817a48c7cSmrg    case $output in
560917a48c7cSmrg    *.la)
561017a48c7cSmrg      old_library=
561117a48c7cSmrg      test "$build_old_libs" = yes && old_library="$libname.$libext"
561217a48c7cSmrg      $show "creating $output"
561317a48c7cSmrg
561417a48c7cSmrg      # Preserve any variables that may affect compiler behavior
561517a48c7cSmrg      for var in $variables_saved_for_relink; do
561617a48c7cSmrg	if eval test -z \"\${$var+set}\"; then
561717a48c7cSmrg	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
561817a48c7cSmrg	elif eval var_value=\$$var; test -z "$var_value"; then
561917a48c7cSmrg	  relink_command="$var=; export $var; $relink_command"
562017a48c7cSmrg	else
562117a48c7cSmrg	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
562217a48c7cSmrg	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
562317a48c7cSmrg	fi
562417a48c7cSmrg      done
562517a48c7cSmrg      # Quote the link command for shipping.
562617a48c7cSmrg      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
56278e0ed500Smrg      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
562817a48c7cSmrg      if test "$hardcode_automatic" = yes ; then
562917a48c7cSmrg	relink_command=
563017a48c7cSmrg      fi
563117a48c7cSmrg
563217a48c7cSmrg
563317a48c7cSmrg      # Only create the output if not a dry run.
563417a48c7cSmrg      if test -z "$run"; then
563517a48c7cSmrg	for installed in no yes; do
563617a48c7cSmrg	  if test "$installed" = yes; then
563717a48c7cSmrg	    if test -z "$install_libdir"; then
563817a48c7cSmrg	      break
563917a48c7cSmrg	    fi
564017a48c7cSmrg	    output="$output_objdir/$outputname"i
564117a48c7cSmrg	    # Replace all uninstalled libtool libraries with the installed ones
564217a48c7cSmrg	    newdependency_libs=
564317a48c7cSmrg	    for deplib in $dependency_libs; do
564417a48c7cSmrg	      case $deplib in
564517a48c7cSmrg	      *.la)
564617a48c7cSmrg		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
564717a48c7cSmrg		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
564817a48c7cSmrg		if test -z "$libdir"; then
564917a48c7cSmrg		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
565017a48c7cSmrg		  exit $EXIT_FAILURE
565117a48c7cSmrg		fi
565217a48c7cSmrg		newdependency_libs="$newdependency_libs $libdir/$name"
565317a48c7cSmrg		;;
565417a48c7cSmrg	      *) newdependency_libs="$newdependency_libs $deplib" ;;
565517a48c7cSmrg	      esac
565617a48c7cSmrg	    done
565717a48c7cSmrg	    dependency_libs="$newdependency_libs"
565817a48c7cSmrg	    newdlfiles=
565917a48c7cSmrg	    for lib in $dlfiles; do
566017a48c7cSmrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
566117a48c7cSmrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
566217a48c7cSmrg	      if test -z "$libdir"; then
566317a48c7cSmrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
566417a48c7cSmrg		exit $EXIT_FAILURE
566517a48c7cSmrg	      fi
566617a48c7cSmrg	      newdlfiles="$newdlfiles $libdir/$name"
566717a48c7cSmrg	    done
566817a48c7cSmrg	    dlfiles="$newdlfiles"
566917a48c7cSmrg	    newdlprefiles=
567017a48c7cSmrg	    for lib in $dlprefiles; do
567117a48c7cSmrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
567217a48c7cSmrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
567317a48c7cSmrg	      if test -z "$libdir"; then
567417a48c7cSmrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
567517a48c7cSmrg		exit $EXIT_FAILURE
567617a48c7cSmrg	      fi
567717a48c7cSmrg	      newdlprefiles="$newdlprefiles $libdir/$name"
567817a48c7cSmrg	    done
567917a48c7cSmrg	    dlprefiles="$newdlprefiles"
568017a48c7cSmrg	  else
568117a48c7cSmrg	    newdlfiles=
568217a48c7cSmrg	    for lib in $dlfiles; do
568317a48c7cSmrg	      case $lib in
568417a48c7cSmrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
568517a48c7cSmrg		*) abs=`pwd`"/$lib" ;;
568617a48c7cSmrg	      esac
568717a48c7cSmrg	      newdlfiles="$newdlfiles $abs"
568817a48c7cSmrg	    done
568917a48c7cSmrg	    dlfiles="$newdlfiles"
569017a48c7cSmrg	    newdlprefiles=
569117a48c7cSmrg	    for lib in $dlprefiles; do
569217a48c7cSmrg	      case $lib in
569317a48c7cSmrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
569417a48c7cSmrg		*) abs=`pwd`"/$lib" ;;
569517a48c7cSmrg	      esac
569617a48c7cSmrg	      newdlprefiles="$newdlprefiles $abs"
569717a48c7cSmrg	    done
569817a48c7cSmrg	    dlprefiles="$newdlprefiles"
569917a48c7cSmrg	  fi
570017a48c7cSmrg	  $rm $output
570117a48c7cSmrg	  # place dlname in correct position for cygwin
570217a48c7cSmrg	  tdlname=$dlname
570317a48c7cSmrg	  case $host,$output,$installed,$module,$dlname in
570417a48c7cSmrg	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
570517a48c7cSmrg	  esac
570617a48c7cSmrg	  $echo > $output "\
570717a48c7cSmrg# $outputname - a libtool library file
570817a48c7cSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
570917a48c7cSmrg#
571017a48c7cSmrg# Please DO NOT delete this file!
571117a48c7cSmrg# It is necessary for linking the library.
571217a48c7cSmrg
571317a48c7cSmrg# The name that we can dlopen(3).
571417a48c7cSmrgdlname='$tdlname'
571517a48c7cSmrg
571617a48c7cSmrg# Names of this library.
571717a48c7cSmrglibrary_names='$library_names'
571817a48c7cSmrg
571917a48c7cSmrg# The name of the static archive.
572017a48c7cSmrgold_library='$old_library'
572117a48c7cSmrg
572217a48c7cSmrg# Libraries that this one depends upon.
572317a48c7cSmrgdependency_libs='$dependency_libs'
572417a48c7cSmrg
572517a48c7cSmrg# Version information for $libname.
572617a48c7cSmrgcurrent=$current
572717a48c7cSmrgage=$age
572817a48c7cSmrgrevision=$revision
572917a48c7cSmrg
573017a48c7cSmrg# Is this an already installed library?
573117a48c7cSmrginstalled=$installed
573217a48c7cSmrg
573317a48c7cSmrg# Should we warn about portability when linking against -modules?
573417a48c7cSmrgshouldnotlink=$module
573517a48c7cSmrg
573617a48c7cSmrg# Files to dlopen/dlpreopen
573717a48c7cSmrgdlopen='$dlfiles'
573817a48c7cSmrgdlpreopen='$dlprefiles'
573917a48c7cSmrg
574017a48c7cSmrg# Directory that this library needs to be installed in:
574117a48c7cSmrglibdir='$install_libdir'"
574217a48c7cSmrg	  if test "$installed" = no && test "$need_relink" = yes; then
574317a48c7cSmrg	    $echo >> $output "\
574417a48c7cSmrgrelink_command=\"$relink_command\""
574517a48c7cSmrg	  fi
574617a48c7cSmrg	done
574717a48c7cSmrg      fi
574817a48c7cSmrg
574917a48c7cSmrg      # Do a symbolic link so that the libtool archive can be found in
575017a48c7cSmrg      # LD_LIBRARY_PATH before the program is installed.
575117a48c7cSmrg      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
575217a48c7cSmrg      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
575317a48c7cSmrg      ;;
575417a48c7cSmrg    esac
575517a48c7cSmrg    exit $EXIT_SUCCESS
575617a48c7cSmrg    ;;
575717a48c7cSmrg
575817a48c7cSmrg  # libtool install mode
575917a48c7cSmrg  install)
576017a48c7cSmrg    modename="$modename: install"
576117a48c7cSmrg
576217a48c7cSmrg    # There may be an optional sh(1) argument at the beginning of
576317a48c7cSmrg    # install_prog (especially on Windows NT).
576417a48c7cSmrg    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
576517a48c7cSmrg       # Allow the use of GNU shtool's install command.
576617a48c7cSmrg       $echo "X$nonopt" | grep shtool > /dev/null; then
576717a48c7cSmrg      # Aesthetically quote it.
576817a48c7cSmrg      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
576917a48c7cSmrg      case $arg in
577017a48c7cSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
577117a48c7cSmrg	arg="\"$arg\""
577217a48c7cSmrg	;;
577317a48c7cSmrg      esac
577417a48c7cSmrg      install_prog="$arg "
577517a48c7cSmrg      arg="$1"
577617a48c7cSmrg      shift
577717a48c7cSmrg    else
577817a48c7cSmrg      install_prog=
577917a48c7cSmrg      arg=$nonopt
578017a48c7cSmrg    fi
578117a48c7cSmrg
578217a48c7cSmrg    # The real first argument should be the name of the installation program.
578317a48c7cSmrg    # Aesthetically quote it.
578417a48c7cSmrg    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
578517a48c7cSmrg    case $arg in
578617a48c7cSmrg    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
578717a48c7cSmrg      arg="\"$arg\""
578817a48c7cSmrg      ;;
578917a48c7cSmrg    esac
579017a48c7cSmrg    install_prog="$install_prog$arg"
579117a48c7cSmrg
579217a48c7cSmrg    # We need to accept at least all the BSD install flags.
579317a48c7cSmrg    dest=
579417a48c7cSmrg    files=
579517a48c7cSmrg    opts=
579617a48c7cSmrg    prev=
579717a48c7cSmrg    install_type=
579817a48c7cSmrg    isdir=no
579917a48c7cSmrg    stripme=
580017a48c7cSmrg    for arg
580117a48c7cSmrg    do
580217a48c7cSmrg      if test -n "$dest"; then
580317a48c7cSmrg	files="$files $dest"
580417a48c7cSmrg	dest=$arg
580517a48c7cSmrg	continue
580617a48c7cSmrg      fi
580717a48c7cSmrg
580817a48c7cSmrg      case $arg in
580917a48c7cSmrg      -d) isdir=yes ;;
581017a48c7cSmrg      -f) 
581117a48c7cSmrg      	case " $install_prog " in
581217a48c7cSmrg	*[\\\ /]cp\ *) ;;
581317a48c7cSmrg	*) prev=$arg ;;
581417a48c7cSmrg	esac
581517a48c7cSmrg	;;
581617a48c7cSmrg      -g | -m | -o) prev=$arg ;;
581717a48c7cSmrg      -s)
581817a48c7cSmrg	stripme=" -s"
581917a48c7cSmrg	continue
582017a48c7cSmrg	;;
582117a48c7cSmrg      -*)
582217a48c7cSmrg	;;
582317a48c7cSmrg      *)
582417a48c7cSmrg	# If the previous option needed an argument, then skip it.
582517a48c7cSmrg	if test -n "$prev"; then
582617a48c7cSmrg	  prev=
582717a48c7cSmrg	else
582817a48c7cSmrg	  dest=$arg
582917a48c7cSmrg	  continue
583017a48c7cSmrg	fi
583117a48c7cSmrg	;;
583217a48c7cSmrg      esac
583317a48c7cSmrg
583417a48c7cSmrg      # Aesthetically quote the argument.
583517a48c7cSmrg      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
583617a48c7cSmrg      case $arg in
583717a48c7cSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
583817a48c7cSmrg	arg="\"$arg\""
583917a48c7cSmrg	;;
584017a48c7cSmrg      esac
584117a48c7cSmrg      install_prog="$install_prog $arg"
584217a48c7cSmrg    done
584317a48c7cSmrg
584417a48c7cSmrg    if test -z "$install_prog"; then
584517a48c7cSmrg      $echo "$modename: you must specify an install program" 1>&2
584617a48c7cSmrg      $echo "$help" 1>&2
584717a48c7cSmrg      exit $EXIT_FAILURE
584817a48c7cSmrg    fi
584917a48c7cSmrg
585017a48c7cSmrg    if test -n "$prev"; then
585117a48c7cSmrg      $echo "$modename: the \`$prev' option requires an argument" 1>&2
585217a48c7cSmrg      $echo "$help" 1>&2
585317a48c7cSmrg      exit $EXIT_FAILURE
585417a48c7cSmrg    fi
585517a48c7cSmrg
585617a48c7cSmrg    if test -z "$files"; then
585717a48c7cSmrg      if test -z "$dest"; then
585817a48c7cSmrg	$echo "$modename: no file or destination specified" 1>&2
585917a48c7cSmrg      else
586017a48c7cSmrg	$echo "$modename: you must specify a destination" 1>&2
586117a48c7cSmrg      fi
586217a48c7cSmrg      $echo "$help" 1>&2
586317a48c7cSmrg      exit $EXIT_FAILURE
586417a48c7cSmrg    fi
586517a48c7cSmrg
586617a48c7cSmrg    # Strip any trailing slash from the destination.
586717a48c7cSmrg    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
586817a48c7cSmrg
586917a48c7cSmrg    # Check to see that the destination is a directory.
587017a48c7cSmrg    test -d "$dest" && isdir=yes
587117a48c7cSmrg    if test "$isdir" = yes; then
587217a48c7cSmrg      destdir="$dest"
587317a48c7cSmrg      destname=
587417a48c7cSmrg    else
587517a48c7cSmrg      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
587617a48c7cSmrg      test "X$destdir" = "X$dest" && destdir=.
587717a48c7cSmrg      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
587817a48c7cSmrg
587917a48c7cSmrg      # Not a directory, so check to see that there is only one file specified.
588017a48c7cSmrg      set dummy $files
588117a48c7cSmrg      if test "$#" -gt 2; then
588217a48c7cSmrg	$echo "$modename: \`$dest' is not a directory" 1>&2
588317a48c7cSmrg	$echo "$help" 1>&2
588417a48c7cSmrg	exit $EXIT_FAILURE
588517a48c7cSmrg      fi
588617a48c7cSmrg    fi
588717a48c7cSmrg    case $destdir in
588817a48c7cSmrg    [\\/]* | [A-Za-z]:[\\/]*) ;;
588917a48c7cSmrg    *)
589017a48c7cSmrg      for file in $files; do
589117a48c7cSmrg	case $file in
589217a48c7cSmrg	*.lo) ;;
589317a48c7cSmrg	*)
589417a48c7cSmrg	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
589517a48c7cSmrg	  $echo "$help" 1>&2
589617a48c7cSmrg	  exit $EXIT_FAILURE
589717a48c7cSmrg	  ;;
589817a48c7cSmrg	esac
589917a48c7cSmrg      done
590017a48c7cSmrg      ;;
590117a48c7cSmrg    esac
590217a48c7cSmrg
590317a48c7cSmrg    # This variable tells wrapper scripts just to set variables rather
590417a48c7cSmrg    # than running their programs.
590517a48c7cSmrg    libtool_install_magic="$magic"
590617a48c7cSmrg
590717a48c7cSmrg    staticlibs=
590817a48c7cSmrg    future_libdirs=
590917a48c7cSmrg    current_libdirs=
591017a48c7cSmrg    for file in $files; do
591117a48c7cSmrg
591217a48c7cSmrg      # Do each installation.
591317a48c7cSmrg      case $file in
591417a48c7cSmrg      *.$libext)
591517a48c7cSmrg	# Do the static libraries later.
591617a48c7cSmrg	staticlibs="$staticlibs $file"
591717a48c7cSmrg	;;
591817a48c7cSmrg
591917a48c7cSmrg      *.la)
592017a48c7cSmrg	# Check to see that this really is a libtool archive.
592117a48c7cSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
592217a48c7cSmrg	else
592317a48c7cSmrg	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
592417a48c7cSmrg	  $echo "$help" 1>&2
592517a48c7cSmrg	  exit $EXIT_FAILURE
592617a48c7cSmrg	fi
592717a48c7cSmrg
592817a48c7cSmrg	library_names=
592917a48c7cSmrg	old_library=
593017a48c7cSmrg	relink_command=
593117a48c7cSmrg	# If there is no directory component, then add one.
593217a48c7cSmrg	case $file in
593317a48c7cSmrg	*/* | *\\*) . $file ;;
593417a48c7cSmrg	*) . ./$file ;;
593517a48c7cSmrg	esac
593617a48c7cSmrg
593717a48c7cSmrg	# Add the libdir to current_libdirs if it is the destination.
593817a48c7cSmrg	if test "X$destdir" = "X$libdir"; then
593917a48c7cSmrg	  case "$current_libdirs " in
594017a48c7cSmrg	  *" $libdir "*) ;;
594117a48c7cSmrg	  *) current_libdirs="$current_libdirs $libdir" ;;
594217a48c7cSmrg	  esac
594317a48c7cSmrg	else
594417a48c7cSmrg	  # Note the libdir as a future libdir.
594517a48c7cSmrg	  case "$future_libdirs " in
594617a48c7cSmrg	  *" $libdir "*) ;;
594717a48c7cSmrg	  *) future_libdirs="$future_libdirs $libdir" ;;
594817a48c7cSmrg	  esac
594917a48c7cSmrg	fi
595017a48c7cSmrg
595117a48c7cSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
595217a48c7cSmrg	test "X$dir" = "X$file/" && dir=
595317a48c7cSmrg	dir="$dir$objdir"
595417a48c7cSmrg
595517a48c7cSmrg	if test -n "$relink_command"; then
595617a48c7cSmrg	  # Determine the prefix the user has applied to our future dir.
595717a48c7cSmrg	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
595817a48c7cSmrg
595917a48c7cSmrg	  # Don't allow the user to place us outside of our expected
596017a48c7cSmrg	  # location b/c this prevents finding dependent libraries that
596117a48c7cSmrg	  # are installed to the same prefix.
596217a48c7cSmrg	  # At present, this check doesn't affect windows .dll's that
596317a48c7cSmrg	  # are installed into $libdir/../bin (currently, that works fine)
596417a48c7cSmrg	  # but it's something to keep an eye on.
596517a48c7cSmrg	  if test "$inst_prefix_dir" = "$destdir"; then
596617a48c7cSmrg	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
596717a48c7cSmrg	    exit $EXIT_FAILURE
596817a48c7cSmrg	  fi
596917a48c7cSmrg
597017a48c7cSmrg	  if test -n "$inst_prefix_dir"; then
597117a48c7cSmrg	    # Stick the inst_prefix_dir data into the link command.
59728e0ed500Smrg	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
597317a48c7cSmrg	  else
59748e0ed500Smrg	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
597517a48c7cSmrg	  fi
597617a48c7cSmrg
597717a48c7cSmrg	  $echo "$modename: warning: relinking \`$file'" 1>&2
597817a48c7cSmrg	  $show "$relink_command"
597917a48c7cSmrg	  if $run eval "$relink_command"; then :
598017a48c7cSmrg	  else
598117a48c7cSmrg	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
598217a48c7cSmrg	    exit $EXIT_FAILURE
598317a48c7cSmrg	  fi
598417a48c7cSmrg	fi
598517a48c7cSmrg
598617a48c7cSmrg	# See the names of the shared library.
598717a48c7cSmrg	set dummy $library_names
598817a48c7cSmrg	if test -n "$2"; then
598917a48c7cSmrg	  realname="$2"
599017a48c7cSmrg	  shift
599117a48c7cSmrg	  shift
599217a48c7cSmrg
599317a48c7cSmrg	  srcname="$realname"
599417a48c7cSmrg	  test -n "$relink_command" && srcname="$realname"T
599517a48c7cSmrg
599617a48c7cSmrg	  # Install the shared library and build the symlinks.
599717a48c7cSmrg	  $show "$install_prog $dir/$srcname $destdir/$realname"
599817a48c7cSmrg	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
599917a48c7cSmrg	  if test -n "$stripme" && test -n "$striplib"; then
600017a48c7cSmrg	    $show "$striplib $destdir/$realname"
600117a48c7cSmrg	    $run eval "$striplib $destdir/$realname" || exit $?
600217a48c7cSmrg	  fi
600317a48c7cSmrg
600417a48c7cSmrg	  if test "$#" -gt 0; then
600517a48c7cSmrg	    # Delete the old symlinks, and create new ones.
600617a48c7cSmrg	    # Try `ln -sf' first, because the `ln' binary might depend on
600717a48c7cSmrg	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
600817a48c7cSmrg	    # so we also need to try rm && ln -s.
600917a48c7cSmrg	    for linkname
601017a48c7cSmrg	    do
601117a48c7cSmrg	      if test "$linkname" != "$realname"; then
601217a48c7cSmrg                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
601317a48c7cSmrg                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
601417a48c7cSmrg	      fi
601517a48c7cSmrg	    done
601617a48c7cSmrg	  fi
601717a48c7cSmrg
601817a48c7cSmrg	  # Do each command in the postinstall commands.
601917a48c7cSmrg	  lib="$destdir/$realname"
602017a48c7cSmrg	  cmds=$postinstall_cmds
602117a48c7cSmrg	  save_ifs="$IFS"; IFS='~'
602217a48c7cSmrg	  for cmd in $cmds; do
602317a48c7cSmrg	    IFS="$save_ifs"
602417a48c7cSmrg	    eval cmd=\"$cmd\"
602517a48c7cSmrg	    $show "$cmd"
602617a48c7cSmrg	    $run eval "$cmd" || {
602717a48c7cSmrg	      lt_exit=$?
602817a48c7cSmrg
602917a48c7cSmrg	      # Restore the uninstalled library and exit
603017a48c7cSmrg	      if test "$mode" = relink; then
603117a48c7cSmrg		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
603217a48c7cSmrg	      fi
603317a48c7cSmrg
603417a48c7cSmrg	      exit $lt_exit
603517a48c7cSmrg	    }
603617a48c7cSmrg	  done
603717a48c7cSmrg	  IFS="$save_ifs"
603817a48c7cSmrg	fi
603917a48c7cSmrg
604017a48c7cSmrg	# Install the pseudo-library for information purposes.
604117a48c7cSmrg	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
604217a48c7cSmrg	instname="$dir/$name"i
604317a48c7cSmrg	$show "$install_prog $instname $destdir/$name"
604417a48c7cSmrg	$run eval "$install_prog $instname $destdir/$name" || exit $?
604517a48c7cSmrg
604617a48c7cSmrg	# Maybe install the static library, too.
604717a48c7cSmrg	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
604817a48c7cSmrg	;;
604917a48c7cSmrg
605017a48c7cSmrg      *.lo)
605117a48c7cSmrg	# Install (i.e. copy) a libtool object.
605217a48c7cSmrg
605317a48c7cSmrg	# Figure out destination file name, if it wasn't already specified.
605417a48c7cSmrg	if test -n "$destname"; then
605517a48c7cSmrg	  destfile="$destdir/$destname"
605617a48c7cSmrg	else
605717a48c7cSmrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
605817a48c7cSmrg	  destfile="$destdir/$destfile"
605917a48c7cSmrg	fi
606017a48c7cSmrg
606117a48c7cSmrg	# Deduce the name of the destination old-style object file.
606217a48c7cSmrg	case $destfile in
606317a48c7cSmrg	*.lo)
606417a48c7cSmrg	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
606517a48c7cSmrg	  ;;
606617a48c7cSmrg	*.$objext)
606717a48c7cSmrg	  staticdest="$destfile"
606817a48c7cSmrg	  destfile=
606917a48c7cSmrg	  ;;
607017a48c7cSmrg	*)
607117a48c7cSmrg	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
607217a48c7cSmrg	  $echo "$help" 1>&2
607317a48c7cSmrg	  exit $EXIT_FAILURE
607417a48c7cSmrg	  ;;
607517a48c7cSmrg	esac
607617a48c7cSmrg
607717a48c7cSmrg	# Install the libtool object if requested.
607817a48c7cSmrg	if test -n "$destfile"; then
607917a48c7cSmrg	  $show "$install_prog $file $destfile"
608017a48c7cSmrg	  $run eval "$install_prog $file $destfile" || exit $?
608117a48c7cSmrg	fi
608217a48c7cSmrg
608317a48c7cSmrg	# Install the old object if enabled.
608417a48c7cSmrg	if test "$build_old_libs" = yes; then
608517a48c7cSmrg	  # Deduce the name of the old-style object file.
608617a48c7cSmrg	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
608717a48c7cSmrg
608817a48c7cSmrg	  $show "$install_prog $staticobj $staticdest"
608917a48c7cSmrg	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
609017a48c7cSmrg	fi
609117a48c7cSmrg	exit $EXIT_SUCCESS
609217a48c7cSmrg	;;
609317a48c7cSmrg
609417a48c7cSmrg      *)
609517a48c7cSmrg	# Figure out destination file name, if it wasn't already specified.
609617a48c7cSmrg	if test -n "$destname"; then
609717a48c7cSmrg	  destfile="$destdir/$destname"
609817a48c7cSmrg	else
609917a48c7cSmrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
610017a48c7cSmrg	  destfile="$destdir/$destfile"
610117a48c7cSmrg	fi
610217a48c7cSmrg
610317a48c7cSmrg	# If the file is missing, and there is a .exe on the end, strip it
610417a48c7cSmrg	# because it is most likely a libtool script we actually want to
610517a48c7cSmrg	# install
610617a48c7cSmrg	stripped_ext=""
610717a48c7cSmrg	case $file in
610817a48c7cSmrg	  *.exe)
610917a48c7cSmrg	    if test ! -f "$file"; then
611017a48c7cSmrg	      file=`$echo $file|${SED} 's,.exe$,,'`
611117a48c7cSmrg	      stripped_ext=".exe"
611217a48c7cSmrg	    fi
611317a48c7cSmrg	    ;;
611417a48c7cSmrg	esac
611517a48c7cSmrg
611617a48c7cSmrg	# Do a test to see if this is really a libtool program.
611717a48c7cSmrg	case $host in
611817a48c7cSmrg	*cygwin*|*mingw*)
611917a48c7cSmrg	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
612017a48c7cSmrg	    ;;
612117a48c7cSmrg	*)
612217a48c7cSmrg	    wrapper=$file
612317a48c7cSmrg	    ;;
612417a48c7cSmrg	esac
612517a48c7cSmrg	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
612617a48c7cSmrg	  notinst_deplibs=
612717a48c7cSmrg	  relink_command=
612817a48c7cSmrg
612917a48c7cSmrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
613017a48c7cSmrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
613117a48c7cSmrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
613217a48c7cSmrg	  # `FILE.' does not work on cygwin managed mounts.
613317a48c7cSmrg	  #
613417a48c7cSmrg	  # If there is no directory component, then add one.
613517a48c7cSmrg	  case $wrapper in
613617a48c7cSmrg	  */* | *\\*) . ${wrapper} ;;
613717a48c7cSmrg	  *) . ./${wrapper} ;;
613817a48c7cSmrg	  esac
613917a48c7cSmrg
614017a48c7cSmrg	  # Check the variables that should have been set.
614117a48c7cSmrg	  if test -z "$notinst_deplibs"; then
614217a48c7cSmrg	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
614317a48c7cSmrg	    exit $EXIT_FAILURE
614417a48c7cSmrg	  fi
614517a48c7cSmrg
614617a48c7cSmrg	  finalize=yes
614717a48c7cSmrg	  for lib in $notinst_deplibs; do
614817a48c7cSmrg	    # Check to see that each library is installed.
614917a48c7cSmrg	    libdir=
615017a48c7cSmrg	    if test -f "$lib"; then
615117a48c7cSmrg	      # If there is no directory component, then add one.
615217a48c7cSmrg	      case $lib in
615317a48c7cSmrg	      */* | *\\*) . $lib ;;
615417a48c7cSmrg	      *) . ./$lib ;;
615517a48c7cSmrg	      esac
615617a48c7cSmrg	    fi
615717a48c7cSmrg	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
615817a48c7cSmrg	    if test -n "$libdir" && test ! -f "$libfile"; then
615917a48c7cSmrg	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
616017a48c7cSmrg	      finalize=no
616117a48c7cSmrg	    fi
616217a48c7cSmrg	  done
616317a48c7cSmrg
616417a48c7cSmrg	  relink_command=
616517a48c7cSmrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
616617a48c7cSmrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
616717a48c7cSmrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
616817a48c7cSmrg	  # `FILE.' does not work on cygwin managed mounts.
616917a48c7cSmrg	  #
617017a48c7cSmrg	  # If there is no directory component, then add one.
617117a48c7cSmrg	  case $wrapper in
617217a48c7cSmrg	  */* | *\\*) . ${wrapper} ;;
617317a48c7cSmrg	  *) . ./${wrapper} ;;
617417a48c7cSmrg	  esac
617517a48c7cSmrg
617617a48c7cSmrg	  outputname=
617717a48c7cSmrg	  if test "$fast_install" = no && test -n "$relink_command"; then
617817a48c7cSmrg	    if test "$finalize" = yes && test -z "$run"; then
617917a48c7cSmrg	      tmpdir=`func_mktempdir`
618017a48c7cSmrg	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
618117a48c7cSmrg	      outputname="$tmpdir/$file"
618217a48c7cSmrg	      # Replace the output file specification.
61838e0ed500Smrg	      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
618417a48c7cSmrg
618517a48c7cSmrg	      $show "$relink_command"
618617a48c7cSmrg	      if $run eval "$relink_command"; then :
618717a48c7cSmrg	      else
618817a48c7cSmrg		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
618917a48c7cSmrg		${rm}r "$tmpdir"
619017a48c7cSmrg		continue
619117a48c7cSmrg	      fi
619217a48c7cSmrg	      file="$outputname"
619317a48c7cSmrg	    else
619417a48c7cSmrg	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
619517a48c7cSmrg	    fi
619617a48c7cSmrg	  else
619717a48c7cSmrg	    # Install the binary that we compiled earlier.
619817a48c7cSmrg	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
619917a48c7cSmrg	  fi
620017a48c7cSmrg	fi
620117a48c7cSmrg
620217a48c7cSmrg	# remove .exe since cygwin /usr/bin/install will append another
620317a48c7cSmrg	# one anyway 
620417a48c7cSmrg	case $install_prog,$host in
620517a48c7cSmrg	*/usr/bin/install*,*cygwin*)
620617a48c7cSmrg	  case $file:$destfile in
620717a48c7cSmrg	  *.exe:*.exe)
620817a48c7cSmrg	    # this is ok
620917a48c7cSmrg	    ;;
621017a48c7cSmrg	  *.exe:*)
621117a48c7cSmrg	    destfile=$destfile.exe
621217a48c7cSmrg	    ;;
621317a48c7cSmrg	  *:*.exe)
621417a48c7cSmrg	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
621517a48c7cSmrg	    ;;
621617a48c7cSmrg	  esac
621717a48c7cSmrg	  ;;
621817a48c7cSmrg	esac
621917a48c7cSmrg	$show "$install_prog$stripme $file $destfile"
622017a48c7cSmrg	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
622117a48c7cSmrg	test -n "$outputname" && ${rm}r "$tmpdir"
622217a48c7cSmrg	;;
622317a48c7cSmrg      esac
622417a48c7cSmrg    done
622517a48c7cSmrg
622617a48c7cSmrg    for file in $staticlibs; do
622717a48c7cSmrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
622817a48c7cSmrg
622917a48c7cSmrg      # Set up the ranlib parameters.
623017a48c7cSmrg      oldlib="$destdir/$name"
623117a48c7cSmrg
623217a48c7cSmrg      $show "$install_prog $file $oldlib"
623317a48c7cSmrg      $run eval "$install_prog \$file \$oldlib" || exit $?
623417a48c7cSmrg
623517a48c7cSmrg      if test -n "$stripme" && test -n "$old_striplib"; then
623617a48c7cSmrg	$show "$old_striplib $oldlib"
623717a48c7cSmrg	$run eval "$old_striplib $oldlib" || exit $?
623817a48c7cSmrg      fi
623917a48c7cSmrg
624017a48c7cSmrg      # Do each command in the postinstall commands.
624117a48c7cSmrg      cmds=$old_postinstall_cmds
624217a48c7cSmrg      save_ifs="$IFS"; IFS='~'
624317a48c7cSmrg      for cmd in $cmds; do
624417a48c7cSmrg	IFS="$save_ifs"
624517a48c7cSmrg	eval cmd=\"$cmd\"
624617a48c7cSmrg	$show "$cmd"
624717a48c7cSmrg	$run eval "$cmd" || exit $?
624817a48c7cSmrg      done
624917a48c7cSmrg      IFS="$save_ifs"
625017a48c7cSmrg    done
625117a48c7cSmrg
625217a48c7cSmrg    if test -n "$future_libdirs"; then
625317a48c7cSmrg      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
625417a48c7cSmrg    fi
625517a48c7cSmrg
625617a48c7cSmrg    if test -n "$current_libdirs"; then
625717a48c7cSmrg      # Maybe just do a dry run.
625817a48c7cSmrg      test -n "$run" && current_libdirs=" -n$current_libdirs"
625917a48c7cSmrg      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
626017a48c7cSmrg    else
626117a48c7cSmrg      exit $EXIT_SUCCESS
626217a48c7cSmrg    fi
626317a48c7cSmrg    ;;
626417a48c7cSmrg
626517a48c7cSmrg  # libtool finish mode
626617a48c7cSmrg  finish)
626717a48c7cSmrg    modename="$modename: finish"
626817a48c7cSmrg    libdirs="$nonopt"
626917a48c7cSmrg    admincmds=
627017a48c7cSmrg
627117a48c7cSmrg    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
627217a48c7cSmrg      for dir
627317a48c7cSmrg      do
627417a48c7cSmrg	libdirs="$libdirs $dir"
627517a48c7cSmrg      done
627617a48c7cSmrg
627717a48c7cSmrg      for libdir in $libdirs; do
627817a48c7cSmrg	if test -n "$finish_cmds"; then
627917a48c7cSmrg	  # Do each command in the finish commands.
628017a48c7cSmrg	  cmds=$finish_cmds
628117a48c7cSmrg	  save_ifs="$IFS"; IFS='~'
628217a48c7cSmrg	  for cmd in $cmds; do
628317a48c7cSmrg	    IFS="$save_ifs"
628417a48c7cSmrg	    eval cmd=\"$cmd\"
628517a48c7cSmrg	    $show "$cmd"
628617a48c7cSmrg	    $run eval "$cmd" || admincmds="$admincmds
628717a48c7cSmrg       $cmd"
628817a48c7cSmrg	  done
628917a48c7cSmrg	  IFS="$save_ifs"
629017a48c7cSmrg	fi
629117a48c7cSmrg	if test -n "$finish_eval"; then
629217a48c7cSmrg	  # Do the single finish_eval.
629317a48c7cSmrg	  eval cmds=\"$finish_eval\"
629417a48c7cSmrg	  $run eval "$cmds" || admincmds="$admincmds
629517a48c7cSmrg       $cmds"
629617a48c7cSmrg	fi
629717a48c7cSmrg      done
629817a48c7cSmrg    fi
629917a48c7cSmrg
630017a48c7cSmrg    # Exit here if they wanted silent mode.
630117a48c7cSmrg    test "$show" = : && exit $EXIT_SUCCESS
630217a48c7cSmrg
630317a48c7cSmrg    $echo "X----------------------------------------------------------------------" | $Xsed
630417a48c7cSmrg    $echo "Libraries have been installed in:"
630517a48c7cSmrg    for libdir in $libdirs; do
630617a48c7cSmrg      $echo "   $libdir"
630717a48c7cSmrg    done
630817a48c7cSmrg    $echo
630917a48c7cSmrg    $echo "If you ever happen to want to link against installed libraries"
631017a48c7cSmrg    $echo "in a given directory, LIBDIR, you must either use libtool, and"
631117a48c7cSmrg    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
631217a48c7cSmrg    $echo "flag during linking and do at least one of the following:"
631317a48c7cSmrg    if test -n "$shlibpath_var"; then
631417a48c7cSmrg      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
631517a48c7cSmrg      $echo "     during execution"
631617a48c7cSmrg    fi
631717a48c7cSmrg    if test -n "$runpath_var"; then
631817a48c7cSmrg      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
631917a48c7cSmrg      $echo "     during linking"
632017a48c7cSmrg    fi
632117a48c7cSmrg    if test -n "$hardcode_libdir_flag_spec"; then
632217a48c7cSmrg      libdir=LIBDIR
632317a48c7cSmrg      eval flag=\"$hardcode_libdir_flag_spec\"
632417a48c7cSmrg
632517a48c7cSmrg      $echo "   - use the \`$flag' linker flag"
632617a48c7cSmrg    fi
632717a48c7cSmrg    if test -n "$admincmds"; then
632817a48c7cSmrg      $echo "   - have your system administrator run these commands:$admincmds"
632917a48c7cSmrg    fi
633017a48c7cSmrg    if test -f /etc/ld.so.conf; then
633117a48c7cSmrg      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
633217a48c7cSmrg    fi
633317a48c7cSmrg    $echo
633417a48c7cSmrg    $echo "See any operating system documentation about shared libraries for"
633517a48c7cSmrg    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
633617a48c7cSmrg    $echo "X----------------------------------------------------------------------" | $Xsed
633717a48c7cSmrg    exit $EXIT_SUCCESS
633817a48c7cSmrg    ;;
633917a48c7cSmrg
634017a48c7cSmrg  # libtool execute mode
634117a48c7cSmrg  execute)
634217a48c7cSmrg    modename="$modename: execute"
634317a48c7cSmrg
634417a48c7cSmrg    # The first argument is the command name.
634517a48c7cSmrg    cmd="$nonopt"
634617a48c7cSmrg    if test -z "$cmd"; then
634717a48c7cSmrg      $echo "$modename: you must specify a COMMAND" 1>&2
634817a48c7cSmrg      $echo "$help"
634917a48c7cSmrg      exit $EXIT_FAILURE
635017a48c7cSmrg    fi
635117a48c7cSmrg
635217a48c7cSmrg    # Handle -dlopen flags immediately.
635317a48c7cSmrg    for file in $execute_dlfiles; do
635417a48c7cSmrg      if test ! -f "$file"; then
635517a48c7cSmrg	$echo "$modename: \`$file' is not a file" 1>&2
635617a48c7cSmrg	$echo "$help" 1>&2
635717a48c7cSmrg	exit $EXIT_FAILURE
635817a48c7cSmrg      fi
635917a48c7cSmrg
636017a48c7cSmrg      dir=
636117a48c7cSmrg      case $file in
636217a48c7cSmrg      *.la)
636317a48c7cSmrg	# Check to see that this really is a libtool archive.
636417a48c7cSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
636517a48c7cSmrg	else
636617a48c7cSmrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
636717a48c7cSmrg	  $echo "$help" 1>&2
636817a48c7cSmrg	  exit $EXIT_FAILURE
636917a48c7cSmrg	fi
637017a48c7cSmrg
637117a48c7cSmrg	# Read the libtool library.
637217a48c7cSmrg	dlname=
637317a48c7cSmrg	library_names=
637417a48c7cSmrg
637517a48c7cSmrg	# If there is no directory component, then add one.
637617a48c7cSmrg	case $file in
637717a48c7cSmrg	*/* | *\\*) . $file ;;
637817a48c7cSmrg	*) . ./$file ;;
637917a48c7cSmrg	esac
638017a48c7cSmrg
638117a48c7cSmrg	# Skip this library if it cannot be dlopened.
638217a48c7cSmrg	if test -z "$dlname"; then
638317a48c7cSmrg	  # Warn if it was a shared library.
638417a48c7cSmrg	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
638517a48c7cSmrg	  continue
638617a48c7cSmrg	fi
638717a48c7cSmrg
638817a48c7cSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
638917a48c7cSmrg	test "X$dir" = "X$file" && dir=.
639017a48c7cSmrg
639117a48c7cSmrg	if test -f "$dir/$objdir/$dlname"; then
639217a48c7cSmrg	  dir="$dir/$objdir"
639317a48c7cSmrg	else
639417a48c7cSmrg	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
639517a48c7cSmrg	  exit $EXIT_FAILURE
639617a48c7cSmrg	fi
639717a48c7cSmrg	;;
639817a48c7cSmrg
639917a48c7cSmrg      *.lo)
640017a48c7cSmrg	# Just add the directory containing the .lo file.
640117a48c7cSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
640217a48c7cSmrg	test "X$dir" = "X$file" && dir=.
640317a48c7cSmrg	;;
640417a48c7cSmrg
640517a48c7cSmrg      *)
640617a48c7cSmrg	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
640717a48c7cSmrg	continue
640817a48c7cSmrg	;;
640917a48c7cSmrg      esac
641017a48c7cSmrg
641117a48c7cSmrg      # Get the absolute pathname.
641217a48c7cSmrg      absdir=`cd "$dir" && pwd`
641317a48c7cSmrg      test -n "$absdir" && dir="$absdir"
641417a48c7cSmrg
641517a48c7cSmrg      # Now add the directory to shlibpath_var.
641617a48c7cSmrg      if eval "test -z \"\$$shlibpath_var\""; then
641717a48c7cSmrg	eval "$shlibpath_var=\"\$dir\""
641817a48c7cSmrg      else
641917a48c7cSmrg	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
642017a48c7cSmrg      fi
642117a48c7cSmrg    done
642217a48c7cSmrg
642317a48c7cSmrg    # This variable tells wrapper scripts just to set shlibpath_var
642417a48c7cSmrg    # rather than running their programs.
642517a48c7cSmrg    libtool_execute_magic="$magic"
642617a48c7cSmrg
642717a48c7cSmrg    # Check if any of the arguments is a wrapper script.
642817a48c7cSmrg    args=
642917a48c7cSmrg    for file
643017a48c7cSmrg    do
643117a48c7cSmrg      case $file in
643217a48c7cSmrg      -*) ;;
643317a48c7cSmrg      *)
643417a48c7cSmrg	# Do a test to see if this is really a libtool program.
643517a48c7cSmrg	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
643617a48c7cSmrg	  # If there is no directory component, then add one.
643717a48c7cSmrg	  case $file in
643817a48c7cSmrg	  */* | *\\*) . $file ;;
643917a48c7cSmrg	  *) . ./$file ;;
644017a48c7cSmrg	  esac
644117a48c7cSmrg
644217a48c7cSmrg	  # Transform arg to wrapped name.
644317a48c7cSmrg	  file="$progdir/$program"
644417a48c7cSmrg	fi
644517a48c7cSmrg	;;
644617a48c7cSmrg      esac
644717a48c7cSmrg      # Quote arguments (to preserve shell metacharacters).
644817a48c7cSmrg      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
644917a48c7cSmrg      args="$args \"$file\""
645017a48c7cSmrg    done
645117a48c7cSmrg
645217a48c7cSmrg    if test -z "$run"; then
645317a48c7cSmrg      if test -n "$shlibpath_var"; then
645417a48c7cSmrg	# Export the shlibpath_var.
645517a48c7cSmrg	eval "export $shlibpath_var"
645617a48c7cSmrg      fi
645717a48c7cSmrg
645817a48c7cSmrg      # Restore saved environment variables
64598e0ed500Smrg      for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
64608e0ed500Smrg      do
64618e0ed500Smrg       eval "if test \"\${save_$lt_var+set}\" = set; then
64628e0ed500Smrg               $lt_var=\$save_$lt_var; export $lt_var
64638e0ed500Smrg             fi"
64648e0ed500Smrg      done
64658e0ed500Smrg
646617a48c7cSmrg
646717a48c7cSmrg      # Now prepare to actually exec the command.
646817a48c7cSmrg      exec_cmd="\$cmd$args"
646917a48c7cSmrg    else
647017a48c7cSmrg      # Display what would be done.
647117a48c7cSmrg      if test -n "$shlibpath_var"; then
647217a48c7cSmrg	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
647317a48c7cSmrg	$echo "export $shlibpath_var"
647417a48c7cSmrg      fi
647517a48c7cSmrg      $echo "$cmd$args"
647617a48c7cSmrg      exit $EXIT_SUCCESS
647717a48c7cSmrg    fi
647817a48c7cSmrg    ;;
647917a48c7cSmrg
648017a48c7cSmrg  # libtool clean and uninstall mode
648117a48c7cSmrg  clean | uninstall)
648217a48c7cSmrg    modename="$modename: $mode"
648317a48c7cSmrg    rm="$nonopt"
648417a48c7cSmrg    files=
648517a48c7cSmrg    rmforce=
648617a48c7cSmrg    exit_status=0
648717a48c7cSmrg
648817a48c7cSmrg    # This variable tells wrapper scripts just to set variables rather
648917a48c7cSmrg    # than running their programs.
649017a48c7cSmrg    libtool_install_magic="$magic"
649117a48c7cSmrg
649217a48c7cSmrg    for arg
649317a48c7cSmrg    do
649417a48c7cSmrg      case $arg in
649517a48c7cSmrg      -f) rm="$rm $arg"; rmforce=yes ;;
649617a48c7cSmrg      -*) rm="$rm $arg" ;;
649717a48c7cSmrg      *) files="$files $arg" ;;
649817a48c7cSmrg      esac
649917a48c7cSmrg    done
650017a48c7cSmrg
650117a48c7cSmrg    if test -z "$rm"; then
650217a48c7cSmrg      $echo "$modename: you must specify an RM program" 1>&2
650317a48c7cSmrg      $echo "$help" 1>&2
650417a48c7cSmrg      exit $EXIT_FAILURE
650517a48c7cSmrg    fi
650617a48c7cSmrg
650717a48c7cSmrg    rmdirs=
650817a48c7cSmrg
650917a48c7cSmrg    origobjdir="$objdir"
651017a48c7cSmrg    for file in $files; do
651117a48c7cSmrg      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
651217a48c7cSmrg      if test "X$dir" = "X$file"; then
651317a48c7cSmrg	dir=.
651417a48c7cSmrg	objdir="$origobjdir"
651517a48c7cSmrg      else
651617a48c7cSmrg	objdir="$dir/$origobjdir"
651717a48c7cSmrg      fi
651817a48c7cSmrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
651917a48c7cSmrg      test "$mode" = uninstall && objdir="$dir"
652017a48c7cSmrg
652117a48c7cSmrg      # Remember objdir for removal later, being careful to avoid duplicates
652217a48c7cSmrg      if test "$mode" = clean; then
652317a48c7cSmrg	case " $rmdirs " in
652417a48c7cSmrg	  *" $objdir "*) ;;
652517a48c7cSmrg	  *) rmdirs="$rmdirs $objdir" ;;
652617a48c7cSmrg	esac
652717a48c7cSmrg      fi
652817a48c7cSmrg
652917a48c7cSmrg      # Don't error if the file doesn't exist and rm -f was used.
653017a48c7cSmrg      if (test -L "$file") >/dev/null 2>&1 \
653117a48c7cSmrg	|| (test -h "$file") >/dev/null 2>&1 \
653217a48c7cSmrg	|| test -f "$file"; then
653317a48c7cSmrg	:
653417a48c7cSmrg      elif test -d "$file"; then
653517a48c7cSmrg	exit_status=1
653617a48c7cSmrg	continue
653717a48c7cSmrg      elif test "$rmforce" = yes; then
653817a48c7cSmrg	continue
653917a48c7cSmrg      fi
654017a48c7cSmrg
654117a48c7cSmrg      rmfiles="$file"
654217a48c7cSmrg
654317a48c7cSmrg      case $name in
654417a48c7cSmrg      *.la)
654517a48c7cSmrg	# Possibly a libtool archive, so verify it.
654617a48c7cSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
654717a48c7cSmrg	  . $dir/$name
654817a48c7cSmrg
654917a48c7cSmrg	  # Delete the libtool libraries and symlinks.
655017a48c7cSmrg	  for n in $library_names; do
655117a48c7cSmrg	    rmfiles="$rmfiles $objdir/$n"
655217a48c7cSmrg	  done
655317a48c7cSmrg	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
655417a48c7cSmrg
655517a48c7cSmrg	  case "$mode" in
655617a48c7cSmrg	  clean)
655717a48c7cSmrg	    case "  $library_names " in
655817a48c7cSmrg	    # "  " in the beginning catches empty $dlname
655917a48c7cSmrg	    *" $dlname "*) ;;
656017a48c7cSmrg	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
656117a48c7cSmrg	    esac
656217a48c7cSmrg	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
656317a48c7cSmrg	    ;;
656417a48c7cSmrg	  uninstall)
656517a48c7cSmrg	    if test -n "$library_names"; then
656617a48c7cSmrg	      # Do each command in the postuninstall commands.
656717a48c7cSmrg	      cmds=$postuninstall_cmds
656817a48c7cSmrg	      save_ifs="$IFS"; IFS='~'
656917a48c7cSmrg	      for cmd in $cmds; do
657017a48c7cSmrg		IFS="$save_ifs"
657117a48c7cSmrg		eval cmd=\"$cmd\"
657217a48c7cSmrg		$show "$cmd"
657317a48c7cSmrg		$run eval "$cmd"
657417a48c7cSmrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
657517a48c7cSmrg		  exit_status=1
657617a48c7cSmrg		fi
657717a48c7cSmrg	      done
657817a48c7cSmrg	      IFS="$save_ifs"
657917a48c7cSmrg	    fi
658017a48c7cSmrg
658117a48c7cSmrg	    if test -n "$old_library"; then
658217a48c7cSmrg	      # Do each command in the old_postuninstall commands.
658317a48c7cSmrg	      cmds=$old_postuninstall_cmds
658417a48c7cSmrg	      save_ifs="$IFS"; IFS='~'
658517a48c7cSmrg	      for cmd in $cmds; do
658617a48c7cSmrg		IFS="$save_ifs"
658717a48c7cSmrg		eval cmd=\"$cmd\"
658817a48c7cSmrg		$show "$cmd"
658917a48c7cSmrg		$run eval "$cmd"
659017a48c7cSmrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
659117a48c7cSmrg		  exit_status=1
659217a48c7cSmrg		fi
659317a48c7cSmrg	      done
659417a48c7cSmrg	      IFS="$save_ifs"
659517a48c7cSmrg	    fi
659617a48c7cSmrg	    # FIXME: should reinstall the best remaining shared library.
659717a48c7cSmrg	    ;;
659817a48c7cSmrg	  esac
659917a48c7cSmrg	fi
660017a48c7cSmrg	;;
660117a48c7cSmrg
660217a48c7cSmrg      *.lo)
660317a48c7cSmrg	# Possibly a libtool object, so verify it.
660417a48c7cSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
660517a48c7cSmrg
660617a48c7cSmrg	  # Read the .lo file
660717a48c7cSmrg	  . $dir/$name
660817a48c7cSmrg
660917a48c7cSmrg	  # Add PIC object to the list of files to remove.
661017a48c7cSmrg	  if test -n "$pic_object" \
661117a48c7cSmrg	     && test "$pic_object" != none; then
661217a48c7cSmrg	    rmfiles="$rmfiles $dir/$pic_object"
661317a48c7cSmrg	  fi
661417a48c7cSmrg
661517a48c7cSmrg	  # Add non-PIC object to the list of files to remove.
661617a48c7cSmrg	  if test -n "$non_pic_object" \
661717a48c7cSmrg	     && test "$non_pic_object" != none; then
661817a48c7cSmrg	    rmfiles="$rmfiles $dir/$non_pic_object"
661917a48c7cSmrg	  fi
662017a48c7cSmrg	fi
662117a48c7cSmrg	;;
662217a48c7cSmrg
662317a48c7cSmrg      *)
662417a48c7cSmrg	if test "$mode" = clean ; then
662517a48c7cSmrg	  noexename=$name
662617a48c7cSmrg	  case $file in
662717a48c7cSmrg	  *.exe)
662817a48c7cSmrg	    file=`$echo $file|${SED} 's,.exe$,,'`
662917a48c7cSmrg	    noexename=`$echo $name|${SED} 's,.exe$,,'`
663017a48c7cSmrg	    # $file with .exe has already been added to rmfiles,
663117a48c7cSmrg	    # add $file without .exe
663217a48c7cSmrg	    rmfiles="$rmfiles $file"
663317a48c7cSmrg	    ;;
663417a48c7cSmrg	  esac
663517a48c7cSmrg	  # Do a test to see if this is a libtool program.
663617a48c7cSmrg	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
663717a48c7cSmrg	    relink_command=
663817a48c7cSmrg	    . $dir/$noexename
663917a48c7cSmrg
664017a48c7cSmrg	    # note $name still contains .exe if it was in $file originally
664117a48c7cSmrg	    # as does the version of $file that was added into $rmfiles
664217a48c7cSmrg	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
664317a48c7cSmrg	    if test "$fast_install" = yes && test -n "$relink_command"; then
664417a48c7cSmrg	      rmfiles="$rmfiles $objdir/lt-$name"
664517a48c7cSmrg	    fi
664617a48c7cSmrg	    if test "X$noexename" != "X$name" ; then
664717a48c7cSmrg	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
664817a48c7cSmrg	    fi
664917a48c7cSmrg	  fi
665017a48c7cSmrg	fi
665117a48c7cSmrg	;;
665217a48c7cSmrg      esac
665317a48c7cSmrg      $show "$rm $rmfiles"
665417a48c7cSmrg      $run $rm $rmfiles || exit_status=1
665517a48c7cSmrg    done
665617a48c7cSmrg    objdir="$origobjdir"
665717a48c7cSmrg
665817a48c7cSmrg    # Try to remove the ${objdir}s in the directories where we deleted files
665917a48c7cSmrg    for dir in $rmdirs; do
666017a48c7cSmrg      if test -d "$dir"; then
666117a48c7cSmrg	$show "rmdir $dir"
666217a48c7cSmrg	$run rmdir $dir >/dev/null 2>&1
666317a48c7cSmrg      fi
666417a48c7cSmrg    done
666517a48c7cSmrg
666617a48c7cSmrg    exit $exit_status
666717a48c7cSmrg    ;;
666817a48c7cSmrg
666917a48c7cSmrg  "")
667017a48c7cSmrg    $echo "$modename: you must specify a MODE" 1>&2
667117a48c7cSmrg    $echo "$generic_help" 1>&2
667217a48c7cSmrg    exit $EXIT_FAILURE
667317a48c7cSmrg    ;;
667417a48c7cSmrg  esac
667517a48c7cSmrg
667617a48c7cSmrg  if test -z "$exec_cmd"; then
667717a48c7cSmrg    $echo "$modename: invalid operation mode \`$mode'" 1>&2
667817a48c7cSmrg    $echo "$generic_help" 1>&2
667917a48c7cSmrg    exit $EXIT_FAILURE
668017a48c7cSmrg  fi
668117a48c7cSmrgfi # test -z "$show_help"
668217a48c7cSmrg
668317a48c7cSmrgif test -n "$exec_cmd"; then
668417a48c7cSmrg  eval exec $exec_cmd
668517a48c7cSmrg  exit $EXIT_FAILURE
668617a48c7cSmrgfi
668717a48c7cSmrg
668817a48c7cSmrg# We need to display help for each of the modes.
668917a48c7cSmrgcase $mode in
669017a48c7cSmrg"") $echo \
669117a48c7cSmrg"Usage: $modename [OPTION]... [MODE-ARG]...
669217a48c7cSmrg
669317a48c7cSmrgProvide generalized library-building support services.
669417a48c7cSmrg
669517a48c7cSmrg    --config          show all configuration variables
669617a48c7cSmrg    --debug           enable verbose shell tracing
669717a48c7cSmrg-n, --dry-run         display commands without modifying any files
669817a48c7cSmrg    --features        display basic configuration information and exit
669917a48c7cSmrg    --finish          same as \`--mode=finish'
670017a48c7cSmrg    --help            display this help message and exit
670117a48c7cSmrg    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
670217a48c7cSmrg    --quiet           same as \`--silent'
670317a48c7cSmrg    --silent          don't print informational messages
670417a48c7cSmrg    --tag=TAG         use configuration variables from tag TAG
670517a48c7cSmrg    --version         print version information
670617a48c7cSmrg
670717a48c7cSmrgMODE must be one of the following:
670817a48c7cSmrg
670917a48c7cSmrg      clean           remove files from the build directory
671017a48c7cSmrg      compile         compile a source file into a libtool object
671117a48c7cSmrg      execute         automatically set library path, then run a program
671217a48c7cSmrg      finish          complete the installation of libtool libraries
671317a48c7cSmrg      install         install libraries or executables
671417a48c7cSmrg      link            create a library or an executable
671517a48c7cSmrg      uninstall       remove libraries from an installed directory
671617a48c7cSmrg
671717a48c7cSmrgMODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
671817a48c7cSmrga more detailed description of MODE.
671917a48c7cSmrg
672017a48c7cSmrgReport bugs to <bug-libtool@gnu.org>."
672117a48c7cSmrg  exit $EXIT_SUCCESS
672217a48c7cSmrg  ;;
672317a48c7cSmrg
672417a48c7cSmrgclean)
672517a48c7cSmrg  $echo \
672617a48c7cSmrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
672717a48c7cSmrg
672817a48c7cSmrgRemove files from the build directory.
672917a48c7cSmrg
673017a48c7cSmrgRM is the name of the program to use to delete files associated with each FILE
673117a48c7cSmrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
673217a48c7cSmrgto RM.
673317a48c7cSmrg
673417a48c7cSmrgIf FILE is a libtool library, object or program, all the files associated
673517a48c7cSmrgwith it are deleted. Otherwise, only FILE itself is deleted using RM."
673617a48c7cSmrg  ;;
673717a48c7cSmrg
673817a48c7cSmrgcompile)
673917a48c7cSmrg  $echo \
674017a48c7cSmrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
674117a48c7cSmrg
674217a48c7cSmrgCompile a source file into a libtool library object.
674317a48c7cSmrg
674417a48c7cSmrgThis mode accepts the following additional options:
674517a48c7cSmrg
674617a48c7cSmrg  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
674717a48c7cSmrg  -prefer-pic       try to building PIC objects only
674817a48c7cSmrg  -prefer-non-pic   try to building non-PIC objects only
674917a48c7cSmrg  -static           always build a \`.o' file suitable for static linking
675017a48c7cSmrg
675117a48c7cSmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file
675217a48c7cSmrgfrom the given SOURCEFILE.
675317a48c7cSmrg
675417a48c7cSmrgThe output file name is determined by removing the directory component from
675517a48c7cSmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the
675617a48c7cSmrglibrary object suffix, \`.lo'."
675717a48c7cSmrg  ;;
675817a48c7cSmrg
675917a48c7cSmrgexecute)
676017a48c7cSmrg  $echo \
676117a48c7cSmrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
676217a48c7cSmrg
676317a48c7cSmrgAutomatically set library path, then run a program.
676417a48c7cSmrg
676517a48c7cSmrgThis mode accepts the following additional options:
676617a48c7cSmrg
676717a48c7cSmrg  -dlopen FILE      add the directory containing FILE to the library path
676817a48c7cSmrg
676917a48c7cSmrgThis mode sets the library path environment variable according to \`-dlopen'
677017a48c7cSmrgflags.
677117a48c7cSmrg
677217a48c7cSmrgIf any of the ARGS are libtool executable wrappers, then they are translated
677317a48c7cSmrginto their corresponding uninstalled binary, and any of their required library
677417a48c7cSmrgdirectories are added to the library path.
677517a48c7cSmrg
677617a48c7cSmrgThen, COMMAND is executed, with ARGS as arguments."
677717a48c7cSmrg  ;;
677817a48c7cSmrg
677917a48c7cSmrgfinish)
678017a48c7cSmrg  $echo \
678117a48c7cSmrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
678217a48c7cSmrg
678317a48c7cSmrgComplete the installation of libtool libraries.
678417a48c7cSmrg
678517a48c7cSmrgEach LIBDIR is a directory that contains libtool libraries.
678617a48c7cSmrg
678717a48c7cSmrgThe commands that this mode executes may require superuser privileges.  Use
678817a48c7cSmrgthe \`--dry-run' option if you just want to see what would be executed."
678917a48c7cSmrg  ;;
679017a48c7cSmrg
679117a48c7cSmrginstall)
679217a48c7cSmrg  $echo \
679317a48c7cSmrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
679417a48c7cSmrg
679517a48c7cSmrgInstall executables or libraries.
679617a48c7cSmrg
679717a48c7cSmrgINSTALL-COMMAND is the installation command.  The first component should be
679817a48c7cSmrgeither the \`install' or \`cp' program.
679917a48c7cSmrg
680017a48c7cSmrgThe rest of the components are interpreted as arguments to that command (only
680117a48c7cSmrgBSD-compatible install options are recognized)."
680217a48c7cSmrg  ;;
680317a48c7cSmrg
680417a48c7cSmrglink)
680517a48c7cSmrg  $echo \
680617a48c7cSmrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
680717a48c7cSmrg
680817a48c7cSmrgLink object files or libraries together to form another library, or to
680917a48c7cSmrgcreate an executable program.
681017a48c7cSmrg
681117a48c7cSmrgLINK-COMMAND is a command using the C compiler that you would use to create
681217a48c7cSmrga program from several object files.
681317a48c7cSmrg
681417a48c7cSmrgThe following components of LINK-COMMAND are treated specially:
681517a48c7cSmrg
681617a48c7cSmrg  -all-static       do not do any dynamic linking at all
681717a48c7cSmrg  -avoid-version    do not add a version suffix if possible
681817a48c7cSmrg  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
681917a48c7cSmrg  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
682017a48c7cSmrg  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
682117a48c7cSmrg  -export-symbols SYMFILE
68228e0ed500Smrg                    try to export only the symbols listed in SYMFILE
682317a48c7cSmrg  -export-symbols-regex REGEX
68248e0ed500Smrg                    try to export only the symbols matching REGEX
682517a48c7cSmrg  -LLIBDIR          search LIBDIR for required installed libraries
682617a48c7cSmrg  -lNAME            OUTPUT-FILE requires the installed library libNAME
682717a48c7cSmrg  -module           build a library that can dlopened
682817a48c7cSmrg  -no-fast-install  disable the fast-install mode
682917a48c7cSmrg  -no-install       link a not-installable executable
683017a48c7cSmrg  -no-undefined     declare that a library does not refer to external symbols
683117a48c7cSmrg  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
683217a48c7cSmrg  -objectlist FILE  Use a list of object files found in FILE to specify objects
683317a48c7cSmrg  -precious-files-regex REGEX
683417a48c7cSmrg                    don't remove output files matching REGEX
683517a48c7cSmrg  -release RELEASE  specify package release information
683617a48c7cSmrg  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
683717a48c7cSmrg  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
68388e0ed500Smrg  -static           do not do any dynamic linking of uninstalled libtool libraries
68398e0ed500Smrg  -static-libtool-libs
68408e0ed500Smrg                    do not do any dynamic linking of libtool libraries
684117a48c7cSmrg  -version-info CURRENT[:REVISION[:AGE]]
68428e0ed500Smrg                    specify library version info [each variable defaults to 0]
684317a48c7cSmrg
684417a48c7cSmrgAll other options (arguments beginning with \`-') are ignored.
684517a48c7cSmrg
684617a48c7cSmrgEvery other argument is treated as a filename.  Files ending in \`.la' are
684717a48c7cSmrgtreated as uninstalled libtool libraries, other files are standard or library
684817a48c7cSmrgobject files.
684917a48c7cSmrg
685017a48c7cSmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created,
685117a48c7cSmrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is
685217a48c7cSmrgrequired, except when creating a convenience library.
685317a48c7cSmrg
685417a48c7cSmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
685517a48c7cSmrgusing \`ar' and \`ranlib', or on Windows using \`lib'.
685617a48c7cSmrg
685717a48c7cSmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
685817a48c7cSmrgis created, otherwise an executable program is created."
685917a48c7cSmrg  ;;
686017a48c7cSmrg
686117a48c7cSmrguninstall)
686217a48c7cSmrg  $echo \
686317a48c7cSmrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
686417a48c7cSmrg
686517a48c7cSmrgRemove libraries from an installation directory.
686617a48c7cSmrg
686717a48c7cSmrgRM is the name of the program to use to delete files associated with each FILE
686817a48c7cSmrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
686917a48c7cSmrgto RM.
687017a48c7cSmrg
687117a48c7cSmrgIf FILE is a libtool library, all the files associated with it are deleted.
687217a48c7cSmrgOtherwise, only FILE itself is deleted using RM."
687317a48c7cSmrg  ;;
687417a48c7cSmrg
687517a48c7cSmrg*)
687617a48c7cSmrg  $echo "$modename: invalid operation mode \`$mode'" 1>&2
687717a48c7cSmrg  $echo "$help" 1>&2
687817a48c7cSmrg  exit $EXIT_FAILURE
687917a48c7cSmrg  ;;
688017a48c7cSmrgesac
688117a48c7cSmrg
688217a48c7cSmrg$echo
688317a48c7cSmrg$echo "Try \`$modename --help' for more information about other modes."
688417a48c7cSmrg
688517a48c7cSmrgexit $?
688617a48c7cSmrg
688717a48c7cSmrg# The TAGs below are defined such that we never get into a situation
688817a48c7cSmrg# in which we disable both kinds of libraries.  Given conflicting
688917a48c7cSmrg# choices, we go for a static library, that is the most portable,
689017a48c7cSmrg# since we can't tell whether shared libraries were disabled because
689117a48c7cSmrg# the user asked for that or because the platform doesn't support
689217a48c7cSmrg# them.  This is particularly important on AIX, because we don't
689317a48c7cSmrg# support having both static and shared libraries enabled at the same
689417a48c7cSmrg# time on that platform, so we default to a shared-only configuration.
689517a48c7cSmrg# If a disable-shared tag is given, we'll fallback to a static-only
689617a48c7cSmrg# configuration.  But we'll never go from static-only to shared-only.
689717a48c7cSmrg
689817a48c7cSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
689917a48c7cSmrgdisable_libs=shared
690017a48c7cSmrg# ### END LIBTOOL TAG CONFIG: disable-shared
690117a48c7cSmrg
690217a48c7cSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static
690317a48c7cSmrgdisable_libs=static
690417a48c7cSmrg# ### END LIBTOOL TAG CONFIG: disable-static
690517a48c7cSmrg
690617a48c7cSmrg# Local Variables:
690717a48c7cSmrg# mode:shell-script
690817a48c7cSmrg# sh-indentation:2
690917a48c7cSmrg# End:
6910