ltmain.sh revision 11245024
141b2f0bdSmrg# ltmain.sh - Provide generalized library-building support services.
241b2f0bdSmrg# NOTE: Changing this file will not affect anything until you rerun configure.
341b2f0bdSmrg#
411245024Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
511245024Smrg# 2007, 2008  Free Software Foundation, Inc.
641b2f0bdSmrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
741b2f0bdSmrg#
841b2f0bdSmrg# This program is free software; you can redistribute it and/or modify
941b2f0bdSmrg# it under the terms of the GNU General Public License as published by
1041b2f0bdSmrg# the Free Software Foundation; either version 2 of the License, or
1141b2f0bdSmrg# (at your option) any later version.
1241b2f0bdSmrg#
1341b2f0bdSmrg# This program is distributed in the hope that it will be useful, but
1441b2f0bdSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
1541b2f0bdSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
1641b2f0bdSmrg# General Public License for more details.
1741b2f0bdSmrg#
1841b2f0bdSmrg# You should have received a copy of the GNU General Public License
1941b2f0bdSmrg# along with this program; if not, write to the Free Software
2041b2f0bdSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
2141b2f0bdSmrg#
2241b2f0bdSmrg# As a special exception to the GNU General Public License, if you
2341b2f0bdSmrg# distribute this file as part of a program that contains a
2441b2f0bdSmrg# configuration script generated by Autoconf, you may include it under
2541b2f0bdSmrg# the same distribution terms that you use for the rest of that program.
2641b2f0bdSmrg
2741b2f0bdSmrgbasename="s,^.*/,,g"
2841b2f0bdSmrg
2941b2f0bdSmrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
3041b2f0bdSmrg# is ksh but when the shell is invoked as "sh" and the current value of
3141b2f0bdSmrg# the _XPG environment variable is not equal to 1 (one), the special
3241b2f0bdSmrg# positional parameter $0, within a function call, is the name of the
3341b2f0bdSmrg# function.
3441b2f0bdSmrgprogpath="$0"
3541b2f0bdSmrg
3641b2f0bdSmrg# The name of this program:
3741b2f0bdSmrgprogname=`echo "$progpath" | $SED $basename`
3841b2f0bdSmrgmodename="$progname"
3941b2f0bdSmrg
4041b2f0bdSmrg# Global variables:
4141b2f0bdSmrgEXIT_SUCCESS=0
4241b2f0bdSmrgEXIT_FAILURE=1
4341b2f0bdSmrg
4441b2f0bdSmrgPROGRAM=ltmain.sh
4541b2f0bdSmrgPACKAGE=libtool
4611245024SmrgVERSION=1.5.26
4711245024SmrgTIMESTAMP=" (1.1220.2.492 2008/01/30 06:40:56)"
4811245024Smrg
4911245024Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
5011245024Smrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
5111245024Smrg  emulate sh
5211245024Smrg  NULLCMD=:
5311245024Smrg  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
5411245024Smrg  # is contrary to our usage.  Disable this feature.
5511245024Smrg  alias -g '${1+"$@"}'='"$@"'
5641b2f0bdSmrg  setopt NO_GLOB_SUBST
5711245024Smrgelse
5811245024Smrg  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
5941b2f0bdSmrgfi
6011245024SmrgBIN_SH=xpg4; export BIN_SH # for Tru64
6111245024SmrgDUALCASE=1; export DUALCASE # for MKS sh
6241b2f0bdSmrg
6341b2f0bdSmrg# Check that we have a working $echo.
6441b2f0bdSmrgif test "X$1" = X--no-reexec; then
6541b2f0bdSmrg  # Discard the --no-reexec flag, and continue.
6641b2f0bdSmrg  shift
6741b2f0bdSmrgelif test "X$1" = X--fallback-echo; then
6841b2f0bdSmrg  # Avoid inline document here, it may be left over
6941b2f0bdSmrg  :
7041b2f0bdSmrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
7141b2f0bdSmrg  # Yippee, $echo works!
7241b2f0bdSmrg  :
7341b2f0bdSmrgelse
7441b2f0bdSmrg  # Restart under the correct shell, and then maybe $echo will work.
7541b2f0bdSmrg  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
7641b2f0bdSmrgfi
7741b2f0bdSmrg
7841b2f0bdSmrgif test "X$1" = X--fallback-echo; then
7941b2f0bdSmrg  # used as fallback echo
8041b2f0bdSmrg  shift
8141b2f0bdSmrg  cat <<EOF
8241b2f0bdSmrg$*
8341b2f0bdSmrgEOF
8441b2f0bdSmrg  exit $EXIT_SUCCESS
8541b2f0bdSmrgfi
8641b2f0bdSmrg
8741b2f0bdSmrgdefault_mode=
8841b2f0bdSmrghelp="Try \`$progname --help' for more information."
8941b2f0bdSmrgmagic="%%%MAGIC variable%%%"
9041b2f0bdSmrgmkdir="mkdir"
9141b2f0bdSmrgmv="mv -f"
9241b2f0bdSmrgrm="rm -f"
9341b2f0bdSmrg
9441b2f0bdSmrg# Sed substitution that helps us do robust quoting.  It backslashifies
9541b2f0bdSmrg# metacharacters that are still active within double-quoted strings.
9641b2f0bdSmrgXsed="${SED}"' -e 1s/^X//'
9741b2f0bdSmrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
9841b2f0bdSmrg# test EBCDIC or ASCII
9941b2f0bdSmrgcase `echo X|tr X '\101'` in
10041b2f0bdSmrg A) # ASCII based system
10141b2f0bdSmrg    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
10241b2f0bdSmrg  SP2NL='tr \040 \012'
10341b2f0bdSmrg  NL2SP='tr \015\012 \040\040'
10441b2f0bdSmrg  ;;
10541b2f0bdSmrg *) # EBCDIC based system
10641b2f0bdSmrg  SP2NL='tr \100 \n'
10741b2f0bdSmrg  NL2SP='tr \r\n \100\100'
10841b2f0bdSmrg  ;;
10941b2f0bdSmrgesac
11041b2f0bdSmrg
11141b2f0bdSmrg# NLS nuisances.
11241b2f0bdSmrg# Only set LANG and LC_ALL to C if already set.
11341b2f0bdSmrg# These must not be set unconditionally because not all systems understand
11441b2f0bdSmrg# e.g. LANG=C (notably SCO).
11541b2f0bdSmrg# We save the old values to restore during execute mode.
11611245024Smrglt_env=
11711245024Smrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
11811245024Smrgdo
11911245024Smrg  eval "if test \"\${$lt_var+set}\" = set; then
12011245024Smrg	  save_$lt_var=\$$lt_var
12111245024Smrg	  lt_env=\"$lt_var=\$$lt_var \$lt_env\"
12211245024Smrg	  $lt_var=C
12311245024Smrg	  export $lt_var
12411245024Smrg	fi"
12511245024Smrgdone
12611245024Smrg
12711245024Smrgif test -n "$lt_env"; then
12811245024Smrg  lt_env="env $lt_env"
12941b2f0bdSmrgfi
13041b2f0bdSmrg
13141b2f0bdSmrg# Make sure IFS has a sensible default
13241b2f0bdSmrglt_nl='
13341b2f0bdSmrg'
13441b2f0bdSmrgIFS=" 	$lt_nl"
13541b2f0bdSmrg
13641b2f0bdSmrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
13741b2f0bdSmrg  $echo "$modename: not configured to build any kind of library" 1>&2
13841b2f0bdSmrg  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
13941b2f0bdSmrg  exit $EXIT_FAILURE
14041b2f0bdSmrgfi
14141b2f0bdSmrg
14241b2f0bdSmrg# Global variables.
14341b2f0bdSmrgmode=$default_mode
14441b2f0bdSmrgnonopt=
14541b2f0bdSmrgprev=
14641b2f0bdSmrgprevopt=
14741b2f0bdSmrgrun=
14841b2f0bdSmrgshow="$echo"
14941b2f0bdSmrgshow_help=
15041b2f0bdSmrgexecute_dlfiles=
15141b2f0bdSmrgduplicate_deps=no
15241b2f0bdSmrgpreserve_args=
15341b2f0bdSmrglo2o="s/\\.lo\$/.${objext}/"
15441b2f0bdSmrgo2lo="s/\\.${objext}\$/.lo/"
15511245024Smrgextracted_archives=
15611245024Smrgextracted_serial=0
15741b2f0bdSmrg
15841b2f0bdSmrg#####################################
15941b2f0bdSmrg# Shell function definitions:
16041b2f0bdSmrg# This seems to be the best place for them
16141b2f0bdSmrg
16241b2f0bdSmrg# func_mktempdir [string]
16341b2f0bdSmrg# Make a temporary directory that won't clash with other running
16441b2f0bdSmrg# libtool processes, and avoids race conditions if possible.  If
16541b2f0bdSmrg# given, STRING is the basename for that directory.
16641b2f0bdSmrgfunc_mktempdir ()
16741b2f0bdSmrg{
16841b2f0bdSmrg    my_template="${TMPDIR-/tmp}/${1-$progname}"
16941b2f0bdSmrg
17041b2f0bdSmrg    if test "$run" = ":"; then
17141b2f0bdSmrg      # Return a directory name, but don't create it in dry-run mode
17241b2f0bdSmrg      my_tmpdir="${my_template}-$$"
17341b2f0bdSmrg    else
17441b2f0bdSmrg
17541b2f0bdSmrg      # If mktemp works, use that first and foremost
17641b2f0bdSmrg      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
17741b2f0bdSmrg
17841b2f0bdSmrg      if test ! -d "$my_tmpdir"; then
17941b2f0bdSmrg	# Failing that, at least try and use $RANDOM to avoid a race
18041b2f0bdSmrg	my_tmpdir="${my_template}-${RANDOM-0}$$"
18141b2f0bdSmrg
18241b2f0bdSmrg	save_mktempdir_umask=`umask`
18341b2f0bdSmrg	umask 0077
18441b2f0bdSmrg	$mkdir "$my_tmpdir"
18541b2f0bdSmrg	umask $save_mktempdir_umask
18641b2f0bdSmrg      fi
18741b2f0bdSmrg
18841b2f0bdSmrg      # If we're not in dry-run mode, bomb out on failure
18941b2f0bdSmrg      test -d "$my_tmpdir" || {
19041b2f0bdSmrg        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
19141b2f0bdSmrg	exit $EXIT_FAILURE
19241b2f0bdSmrg      }
19341b2f0bdSmrg    fi
19441b2f0bdSmrg
19541b2f0bdSmrg    $echo "X$my_tmpdir" | $Xsed
19641b2f0bdSmrg}
19741b2f0bdSmrg
19841b2f0bdSmrg
19941b2f0bdSmrg# func_win32_libid arg
20041b2f0bdSmrg# return the library type of file 'arg'
20141b2f0bdSmrg#
20241b2f0bdSmrg# Need a lot of goo to handle *both* DLLs and import libs
20341b2f0bdSmrg# Has to be a shell function in order to 'eat' the argument
20441b2f0bdSmrg# that is supplied when $file_magic_command is called.
20541b2f0bdSmrgfunc_win32_libid ()
20641b2f0bdSmrg{
20741b2f0bdSmrg  win32_libid_type="unknown"
20841b2f0bdSmrg  win32_fileres=`file -L $1 2>/dev/null`
20941b2f0bdSmrg  case $win32_fileres in
21041b2f0bdSmrg  *ar\ archive\ import\ library*) # definitely import
21141b2f0bdSmrg    win32_libid_type="x86 archive import"
21241b2f0bdSmrg    ;;
21341b2f0bdSmrg  *ar\ archive*) # could be an import, or static
21441b2f0bdSmrg    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
21541b2f0bdSmrg      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
21641b2f0bdSmrg      win32_nmres=`eval $NM -f posix -A $1 | \
21711245024Smrg	$SED -n -e '1,100{
21811245024Smrg		/ I /{
21911245024Smrg			s,.*,import,
22011245024Smrg			p
22111245024Smrg			q
22211245024Smrg			}
22311245024Smrg		}'`
22441b2f0bdSmrg      case $win32_nmres in
22541b2f0bdSmrg      import*)  win32_libid_type="x86 archive import";;
22641b2f0bdSmrg      *)        win32_libid_type="x86 archive static";;
22741b2f0bdSmrg      esac
22841b2f0bdSmrg    fi
22941b2f0bdSmrg    ;;
23041b2f0bdSmrg  *DLL*)
23141b2f0bdSmrg    win32_libid_type="x86 DLL"
23241b2f0bdSmrg    ;;
23341b2f0bdSmrg  *executable*) # but shell scripts are "executable" too...
23441b2f0bdSmrg    case $win32_fileres in
23541b2f0bdSmrg    *MS\ Windows\ PE\ Intel*)
23641b2f0bdSmrg      win32_libid_type="x86 DLL"
23741b2f0bdSmrg      ;;
23841b2f0bdSmrg    esac
23941b2f0bdSmrg    ;;
24041b2f0bdSmrg  esac
24141b2f0bdSmrg  $echo $win32_libid_type
24241b2f0bdSmrg}
24341b2f0bdSmrg
24441b2f0bdSmrg
24541b2f0bdSmrg# func_infer_tag arg
24641b2f0bdSmrg# Infer tagged configuration to use if any are available and
24741b2f0bdSmrg# if one wasn't chosen via the "--tag" command line option.
24841b2f0bdSmrg# Only attempt this if the compiler in the base compile
24941b2f0bdSmrg# command doesn't match the default compiler.
25041b2f0bdSmrg# arg is usually of the form 'gcc ...'
25141b2f0bdSmrgfunc_infer_tag ()
25241b2f0bdSmrg{
25341b2f0bdSmrg    if test -n "$available_tags" && test -z "$tagname"; then
25441b2f0bdSmrg      CC_quoted=
25541b2f0bdSmrg      for arg in $CC; do
25641b2f0bdSmrg	case $arg in
25741b2f0bdSmrg	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
25841b2f0bdSmrg	  arg="\"$arg\""
25941b2f0bdSmrg	  ;;
26041b2f0bdSmrg	esac
26141b2f0bdSmrg	CC_quoted="$CC_quoted $arg"
26241b2f0bdSmrg      done
26341b2f0bdSmrg      case $@ in
26441b2f0bdSmrg      # Blanks in the command may have been stripped by the calling shell,
26541b2f0bdSmrg      # but not from the CC environment variable when configure was run.
26641b2f0bdSmrg      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
26741b2f0bdSmrg      # Blanks at the start of $base_compile will cause this to fail
26841b2f0bdSmrg      # if we don't check for them as well.
26941b2f0bdSmrg      *)
27041b2f0bdSmrg	for z in $available_tags; do
27141b2f0bdSmrg	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
27241b2f0bdSmrg	    # Evaluate the configuration.
27341b2f0bdSmrg	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
27441b2f0bdSmrg	    CC_quoted=
27541b2f0bdSmrg	    for arg in $CC; do
27641b2f0bdSmrg	    # Double-quote args containing other shell metacharacters.
27741b2f0bdSmrg	    case $arg in
27841b2f0bdSmrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
27941b2f0bdSmrg	      arg="\"$arg\""
28041b2f0bdSmrg	      ;;
28141b2f0bdSmrg	    esac
28241b2f0bdSmrg	    CC_quoted="$CC_quoted $arg"
28341b2f0bdSmrg	  done
28441b2f0bdSmrg	    case "$@ " in
28541b2f0bdSmrg	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
28641b2f0bdSmrg	      # The compiler in the base compile command matches
28741b2f0bdSmrg	      # the one in the tagged configuration.
28841b2f0bdSmrg	      # Assume this is the tagged configuration we want.
28941b2f0bdSmrg	      tagname=$z
29041b2f0bdSmrg	      break
29141b2f0bdSmrg	      ;;
29241b2f0bdSmrg	    esac
29341b2f0bdSmrg	  fi
29441b2f0bdSmrg	done
29541b2f0bdSmrg	# If $tagname still isn't set, then no tagged configuration
29641b2f0bdSmrg	# was found and let the user know that the "--tag" command
29741b2f0bdSmrg	# line option must be used.
29841b2f0bdSmrg	if test -z "$tagname"; then
29941b2f0bdSmrg	  $echo "$modename: unable to infer tagged configuration"
30041b2f0bdSmrg	  $echo "$modename: specify a tag with \`--tag'" 1>&2
30141b2f0bdSmrg	  exit $EXIT_FAILURE
30241b2f0bdSmrg#        else
30341b2f0bdSmrg#          $echo "$modename: using $tagname tagged configuration"
30441b2f0bdSmrg	fi
30541b2f0bdSmrg	;;
30641b2f0bdSmrg      esac
30741b2f0bdSmrg    fi
30841b2f0bdSmrg}
30941b2f0bdSmrg
31041b2f0bdSmrg
31141b2f0bdSmrg# func_extract_an_archive dir oldlib
31241b2f0bdSmrgfunc_extract_an_archive ()
31341b2f0bdSmrg{
31441b2f0bdSmrg    f_ex_an_ar_dir="$1"; shift
31541b2f0bdSmrg    f_ex_an_ar_oldlib="$1"
31641b2f0bdSmrg
31741b2f0bdSmrg    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
31841b2f0bdSmrg    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
31941b2f0bdSmrg    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
32041b2f0bdSmrg     :
32141b2f0bdSmrg    else
32241b2f0bdSmrg      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
32341b2f0bdSmrg      exit $EXIT_FAILURE
32441b2f0bdSmrg    fi
32541b2f0bdSmrg}
32641b2f0bdSmrg
32741b2f0bdSmrg# func_extract_archives gentop oldlib ...
32841b2f0bdSmrgfunc_extract_archives ()
32941b2f0bdSmrg{
33041b2f0bdSmrg    my_gentop="$1"; shift
33141b2f0bdSmrg    my_oldlibs=${1+"$@"}
33241b2f0bdSmrg    my_oldobjs=""
33341b2f0bdSmrg    my_xlib=""
33441b2f0bdSmrg    my_xabs=""
33541b2f0bdSmrg    my_xdir=""
33641b2f0bdSmrg    my_status=""
33741b2f0bdSmrg
33841b2f0bdSmrg    $show "${rm}r $my_gentop"
33941b2f0bdSmrg    $run ${rm}r "$my_gentop"
34041b2f0bdSmrg    $show "$mkdir $my_gentop"
34141b2f0bdSmrg    $run $mkdir "$my_gentop"
34241b2f0bdSmrg    my_status=$?
34341b2f0bdSmrg    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
34441b2f0bdSmrg      exit $my_status
34541b2f0bdSmrg    fi
34641b2f0bdSmrg
34741b2f0bdSmrg    for my_xlib in $my_oldlibs; do
34841b2f0bdSmrg      # Extract the objects.
34941b2f0bdSmrg      case $my_xlib in
35041b2f0bdSmrg	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
35141b2f0bdSmrg	*) my_xabs=`pwd`"/$my_xlib" ;;
35241b2f0bdSmrg      esac
35341b2f0bdSmrg      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
35411245024Smrg      my_xlib_u=$my_xlib
35511245024Smrg      while :; do
35611245024Smrg        case " $extracted_archives " in
35711245024Smrg	*" $my_xlib_u "*)
35811245024Smrg	  extracted_serial=`expr $extracted_serial + 1`
35911245024Smrg	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
36011245024Smrg	*) break ;;
36111245024Smrg	esac
36211245024Smrg      done
36311245024Smrg      extracted_archives="$extracted_archives $my_xlib_u"
36411245024Smrg      my_xdir="$my_gentop/$my_xlib_u"
36541b2f0bdSmrg
36641b2f0bdSmrg      $show "${rm}r $my_xdir"
36741b2f0bdSmrg      $run ${rm}r "$my_xdir"
36841b2f0bdSmrg      $show "$mkdir $my_xdir"
36941b2f0bdSmrg      $run $mkdir "$my_xdir"
37041b2f0bdSmrg      exit_status=$?
37141b2f0bdSmrg      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
37241b2f0bdSmrg	exit $exit_status
37341b2f0bdSmrg      fi
37441b2f0bdSmrg      case $host in
37541b2f0bdSmrg      *-darwin*)
37641b2f0bdSmrg	$show "Extracting $my_xabs"
37741b2f0bdSmrg	# Do not bother doing anything if just a dry run
37841b2f0bdSmrg	if test -z "$run"; then
37941b2f0bdSmrg	  darwin_orig_dir=`pwd`
38041b2f0bdSmrg	  cd $my_xdir || exit $?
38141b2f0bdSmrg	  darwin_archive=$my_xabs
38241b2f0bdSmrg	  darwin_curdir=`pwd`
38341b2f0bdSmrg	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
38441b2f0bdSmrg	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
38541b2f0bdSmrg	  if test -n "$darwin_arches"; then 
38641b2f0bdSmrg	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
38741b2f0bdSmrg	    darwin_arch=
38841b2f0bdSmrg	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
38941b2f0bdSmrg	    for darwin_arch in  $darwin_arches ; do
39041b2f0bdSmrg	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
39141b2f0bdSmrg	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
39241b2f0bdSmrg	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
39341b2f0bdSmrg	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
39441b2f0bdSmrg	      cd "$darwin_curdir"
39541b2f0bdSmrg	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
39641b2f0bdSmrg	    done # $darwin_arches
39741b2f0bdSmrg      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
39841b2f0bdSmrg	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
39941b2f0bdSmrg	    darwin_file=
40041b2f0bdSmrg	    darwin_files=
40141b2f0bdSmrg	    for darwin_file in $darwin_filelist; do
40241b2f0bdSmrg	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
40341b2f0bdSmrg	      lipo -create -output "$darwin_file" $darwin_files
40441b2f0bdSmrg	    done # $darwin_filelist
40541b2f0bdSmrg	    ${rm}r unfat-$$
40641b2f0bdSmrg	    cd "$darwin_orig_dir"
40741b2f0bdSmrg	  else
40841b2f0bdSmrg	    cd "$darwin_orig_dir"
40941b2f0bdSmrg 	    func_extract_an_archive "$my_xdir" "$my_xabs"
41041b2f0bdSmrg	  fi # $darwin_arches
41141b2f0bdSmrg	fi # $run
41241b2f0bdSmrg	;;
41341b2f0bdSmrg      *)
41441b2f0bdSmrg        func_extract_an_archive "$my_xdir" "$my_xabs"
41541b2f0bdSmrg        ;;
41641b2f0bdSmrg      esac
41741b2f0bdSmrg      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
41841b2f0bdSmrg    done
41941b2f0bdSmrg    func_extract_archives_result="$my_oldobjs"
42041b2f0bdSmrg}
42141b2f0bdSmrg# End of Shell function definitions
42241b2f0bdSmrg#####################################
42341b2f0bdSmrg
42441b2f0bdSmrg# Darwin sucks
42541b2f0bdSmrgeval std_shrext=\"$shrext_cmds\"
42641b2f0bdSmrg
42741b2f0bdSmrgdisable_libs=no
42841b2f0bdSmrg
42941b2f0bdSmrg# Parse our command line options once, thoroughly.
43041b2f0bdSmrgwhile test "$#" -gt 0
43141b2f0bdSmrgdo
43241b2f0bdSmrg  arg="$1"
43341b2f0bdSmrg  shift
43441b2f0bdSmrg
43541b2f0bdSmrg  case $arg in
43641b2f0bdSmrg  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
43741b2f0bdSmrg  *) optarg= ;;
43841b2f0bdSmrg  esac
43941b2f0bdSmrg
44041b2f0bdSmrg  # If the previous option needs an argument, assign it.
44141b2f0bdSmrg  if test -n "$prev"; then
44241b2f0bdSmrg    case $prev in
44341b2f0bdSmrg    execute_dlfiles)
44441b2f0bdSmrg      execute_dlfiles="$execute_dlfiles $arg"
44541b2f0bdSmrg      ;;
44641b2f0bdSmrg    tag)
44741b2f0bdSmrg      tagname="$arg"
44841b2f0bdSmrg      preserve_args="${preserve_args}=$arg"
44941b2f0bdSmrg
45041b2f0bdSmrg      # Check whether tagname contains only valid characters
45141b2f0bdSmrg      case $tagname in
45241b2f0bdSmrg      *[!-_A-Za-z0-9,/]*)
45341b2f0bdSmrg	$echo "$progname: invalid tag name: $tagname" 1>&2
45441b2f0bdSmrg	exit $EXIT_FAILURE
45541b2f0bdSmrg	;;
45641b2f0bdSmrg      esac
45741b2f0bdSmrg
45841b2f0bdSmrg      case $tagname in
45941b2f0bdSmrg      CC)
46041b2f0bdSmrg	# Don't test for the "default" C tag, as we know, it's there, but
46141b2f0bdSmrg	# not specially marked.
46241b2f0bdSmrg	;;
46341b2f0bdSmrg      *)
46441b2f0bdSmrg	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
46541b2f0bdSmrg	  taglist="$taglist $tagname"
46641b2f0bdSmrg	  # Evaluate the configuration.
46741b2f0bdSmrg	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
46841b2f0bdSmrg	else
46941b2f0bdSmrg	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
47041b2f0bdSmrg	fi
47141b2f0bdSmrg	;;
47241b2f0bdSmrg      esac
47341b2f0bdSmrg      ;;
47441b2f0bdSmrg    *)
47541b2f0bdSmrg      eval "$prev=\$arg"
47641b2f0bdSmrg      ;;
47741b2f0bdSmrg    esac
47841b2f0bdSmrg
47941b2f0bdSmrg    prev=
48041b2f0bdSmrg    prevopt=
48141b2f0bdSmrg    continue
48241b2f0bdSmrg  fi
48341b2f0bdSmrg
48441b2f0bdSmrg  # Have we seen a non-optional argument yet?
48541b2f0bdSmrg  case $arg in
48641b2f0bdSmrg  --help)
48741b2f0bdSmrg    show_help=yes
48841b2f0bdSmrg    ;;
48941b2f0bdSmrg
49041b2f0bdSmrg  --version)
49111245024Smrg    echo "\
49211245024Smrg$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
49311245024Smrg
49411245024SmrgCopyright (C) 2008  Free Software Foundation, Inc.
49511245024SmrgThis is free software; see the source for copying conditions.  There is NO
49611245024Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
49741b2f0bdSmrg    exit $?
49841b2f0bdSmrg    ;;
49941b2f0bdSmrg
50041b2f0bdSmrg  --config)
50141b2f0bdSmrg    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
50241b2f0bdSmrg    # Now print the configurations for the tags.
50341b2f0bdSmrg    for tagname in $taglist; do
50441b2f0bdSmrg      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
50541b2f0bdSmrg    done
50641b2f0bdSmrg    exit $?
50741b2f0bdSmrg    ;;
50841b2f0bdSmrg
50941b2f0bdSmrg  --debug)
51041b2f0bdSmrg    $echo "$progname: enabling shell trace mode"
51141b2f0bdSmrg    set -x
51241b2f0bdSmrg    preserve_args="$preserve_args $arg"
51341b2f0bdSmrg    ;;
51441b2f0bdSmrg
51541b2f0bdSmrg  --dry-run | -n)
51641b2f0bdSmrg    run=:
51741b2f0bdSmrg    ;;
51841b2f0bdSmrg
51941b2f0bdSmrg  --features)
52041b2f0bdSmrg    $echo "host: $host"
52141b2f0bdSmrg    if test "$build_libtool_libs" = yes; then
52241b2f0bdSmrg      $echo "enable shared libraries"
52341b2f0bdSmrg    else
52441b2f0bdSmrg      $echo "disable shared libraries"
52541b2f0bdSmrg    fi
52641b2f0bdSmrg    if test "$build_old_libs" = yes; then
52741b2f0bdSmrg      $echo "enable static libraries"
52841b2f0bdSmrg    else
52941b2f0bdSmrg      $echo "disable static libraries"
53041b2f0bdSmrg    fi
53141b2f0bdSmrg    exit $?
53241b2f0bdSmrg    ;;
53341b2f0bdSmrg
53441b2f0bdSmrg  --finish) mode="finish" ;;
53541b2f0bdSmrg
53641b2f0bdSmrg  --mode) prevopt="--mode" prev=mode ;;
53741b2f0bdSmrg  --mode=*) mode="$optarg" ;;
53841b2f0bdSmrg
53941b2f0bdSmrg  --preserve-dup-deps) duplicate_deps="yes" ;;
54041b2f0bdSmrg
54141b2f0bdSmrg  --quiet | --silent)
54241b2f0bdSmrg    show=:
54341b2f0bdSmrg    preserve_args="$preserve_args $arg"
54441b2f0bdSmrg    ;;
54541b2f0bdSmrg
54641b2f0bdSmrg  --tag)
54741b2f0bdSmrg    prevopt="--tag"
54841b2f0bdSmrg    prev=tag
54941b2f0bdSmrg    preserve_args="$preserve_args --tag"
55041b2f0bdSmrg    ;;
55141b2f0bdSmrg  --tag=*)
55241b2f0bdSmrg    set tag "$optarg" ${1+"$@"}
55341b2f0bdSmrg    shift
55441b2f0bdSmrg    prev=tag
55541b2f0bdSmrg    preserve_args="$preserve_args --tag"
55641b2f0bdSmrg    ;;
55741b2f0bdSmrg
55841b2f0bdSmrg  -dlopen)
55941b2f0bdSmrg    prevopt="-dlopen"
56041b2f0bdSmrg    prev=execute_dlfiles
56141b2f0bdSmrg    ;;
56241b2f0bdSmrg
56341b2f0bdSmrg  -*)
56441b2f0bdSmrg    $echo "$modename: unrecognized option \`$arg'" 1>&2
56541b2f0bdSmrg    $echo "$help" 1>&2
56641b2f0bdSmrg    exit $EXIT_FAILURE
56741b2f0bdSmrg    ;;
56841b2f0bdSmrg
56941b2f0bdSmrg  *)
57041b2f0bdSmrg    nonopt="$arg"
57141b2f0bdSmrg    break
57241b2f0bdSmrg    ;;
57341b2f0bdSmrg  esac
57441b2f0bdSmrgdone
57541b2f0bdSmrg
57641b2f0bdSmrgif test -n "$prevopt"; then
57741b2f0bdSmrg  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
57841b2f0bdSmrg  $echo "$help" 1>&2
57941b2f0bdSmrg  exit $EXIT_FAILURE
58041b2f0bdSmrgfi
58141b2f0bdSmrg
58241b2f0bdSmrgcase $disable_libs in
58341b2f0bdSmrgno) 
58441b2f0bdSmrg  ;;
58541b2f0bdSmrgshared)
58641b2f0bdSmrg  build_libtool_libs=no
58741b2f0bdSmrg  build_old_libs=yes
58841b2f0bdSmrg  ;;
58941b2f0bdSmrgstatic)
59041b2f0bdSmrg  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
59141b2f0bdSmrg  ;;
59241b2f0bdSmrgesac
59341b2f0bdSmrg
59441b2f0bdSmrg# If this variable is set in any of the actions, the command in it
59541b2f0bdSmrg# will be execed at the end.  This prevents here-documents from being
59641b2f0bdSmrg# left over by shells.
59741b2f0bdSmrgexec_cmd=
59841b2f0bdSmrg
59941b2f0bdSmrgif test -z "$show_help"; then
60041b2f0bdSmrg
60141b2f0bdSmrg  # Infer the operation mode.
60241b2f0bdSmrg  if test -z "$mode"; then
60341b2f0bdSmrg    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
60441b2f0bdSmrg    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
60541b2f0bdSmrg    case $nonopt in
60641b2f0bdSmrg    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
60741b2f0bdSmrg      mode=link
60841b2f0bdSmrg      for arg
60941b2f0bdSmrg      do
61041b2f0bdSmrg	case $arg in
61141b2f0bdSmrg	-c)
61241b2f0bdSmrg	   mode=compile
61341b2f0bdSmrg	   break
61441b2f0bdSmrg	   ;;
61541b2f0bdSmrg	esac
61641b2f0bdSmrg      done
61741b2f0bdSmrg      ;;
61841b2f0bdSmrg    *db | *dbx | *strace | *truss)
61941b2f0bdSmrg      mode=execute
62041b2f0bdSmrg      ;;
62141b2f0bdSmrg    *install*|cp|mv)
62241b2f0bdSmrg      mode=install
62341b2f0bdSmrg      ;;
62441b2f0bdSmrg    *rm)
62541b2f0bdSmrg      mode=uninstall
62641b2f0bdSmrg      ;;
62741b2f0bdSmrg    *)
62841b2f0bdSmrg      # If we have no mode, but dlfiles were specified, then do execute mode.
62941b2f0bdSmrg      test -n "$execute_dlfiles" && mode=execute
63041b2f0bdSmrg
63141b2f0bdSmrg      # Just use the default operation mode.
63241b2f0bdSmrg      if test -z "$mode"; then
63341b2f0bdSmrg	if test -n "$nonopt"; then
63441b2f0bdSmrg	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
63541b2f0bdSmrg	else
63641b2f0bdSmrg	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
63741b2f0bdSmrg	fi
63841b2f0bdSmrg      fi
63941b2f0bdSmrg      ;;
64041b2f0bdSmrg    esac
64141b2f0bdSmrg  fi
64241b2f0bdSmrg
64341b2f0bdSmrg  # Only execute mode is allowed to have -dlopen flags.
64441b2f0bdSmrg  if test -n "$execute_dlfiles" && test "$mode" != execute; then
64541b2f0bdSmrg    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
64641b2f0bdSmrg    $echo "$help" 1>&2
64741b2f0bdSmrg    exit $EXIT_FAILURE
64841b2f0bdSmrg  fi
64941b2f0bdSmrg
65041b2f0bdSmrg  # Change the help message to a mode-specific one.
65141b2f0bdSmrg  generic_help="$help"
65241b2f0bdSmrg  help="Try \`$modename --help --mode=$mode' for more information."
65341b2f0bdSmrg
65441b2f0bdSmrg  # These modes are in order of execution frequency so that they run quickly.
65541b2f0bdSmrg  case $mode in
65641b2f0bdSmrg  # libtool compile mode
65741b2f0bdSmrg  compile)
65841b2f0bdSmrg    modename="$modename: compile"
65941b2f0bdSmrg    # Get the compilation command and the source file.
66041b2f0bdSmrg    base_compile=
66141b2f0bdSmrg    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
66241b2f0bdSmrg    suppress_opt=yes
66341b2f0bdSmrg    suppress_output=
66441b2f0bdSmrg    arg_mode=normal
66541b2f0bdSmrg    libobj=
66641b2f0bdSmrg    later=
66741b2f0bdSmrg
66841b2f0bdSmrg    for arg
66941b2f0bdSmrg    do
67041b2f0bdSmrg      case $arg_mode in
67141b2f0bdSmrg      arg  )
67241b2f0bdSmrg	# do not "continue".  Instead, add this to base_compile
67341b2f0bdSmrg	lastarg="$arg"
67441b2f0bdSmrg	arg_mode=normal
67541b2f0bdSmrg	;;
67641b2f0bdSmrg
67741b2f0bdSmrg      target )
67841b2f0bdSmrg	libobj="$arg"
67941b2f0bdSmrg	arg_mode=normal
68041b2f0bdSmrg	continue
68141b2f0bdSmrg	;;
68241b2f0bdSmrg
68341b2f0bdSmrg      normal )
68441b2f0bdSmrg	# Accept any command-line options.
68541b2f0bdSmrg	case $arg in
68641b2f0bdSmrg	-o)
68741b2f0bdSmrg	  if test -n "$libobj" ; then
68841b2f0bdSmrg	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
68941b2f0bdSmrg	    exit $EXIT_FAILURE
69041b2f0bdSmrg	  fi
69141b2f0bdSmrg	  arg_mode=target
69241b2f0bdSmrg	  continue
69341b2f0bdSmrg	  ;;
69441b2f0bdSmrg
69541b2f0bdSmrg	-static | -prefer-pic | -prefer-non-pic)
69641b2f0bdSmrg	  later="$later $arg"
69741b2f0bdSmrg	  continue
69841b2f0bdSmrg	  ;;
69941b2f0bdSmrg
70041b2f0bdSmrg	-no-suppress)
70141b2f0bdSmrg	  suppress_opt=no
70241b2f0bdSmrg	  continue
70341b2f0bdSmrg	  ;;
70441b2f0bdSmrg
70541b2f0bdSmrg	-Xcompiler)
70641b2f0bdSmrg	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
70741b2f0bdSmrg	  continue      #  The current "srcfile" will either be retained or
70841b2f0bdSmrg	  ;;            #  replaced later.  I would guess that would be a bug.
70941b2f0bdSmrg
71041b2f0bdSmrg	-Wc,*)
71141b2f0bdSmrg	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
71241b2f0bdSmrg	  lastarg=
71341b2f0bdSmrg	  save_ifs="$IFS"; IFS=','
71441b2f0bdSmrg 	  for arg in $args; do
71541b2f0bdSmrg	    IFS="$save_ifs"
71641b2f0bdSmrg
71741b2f0bdSmrg	    # Double-quote args containing other shell metacharacters.
71841b2f0bdSmrg	    # Many Bourne shells cannot handle close brackets correctly
71941b2f0bdSmrg	    # in scan sets, so we specify it separately.
72041b2f0bdSmrg	    case $arg in
72141b2f0bdSmrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
72241b2f0bdSmrg	      arg="\"$arg\""
72341b2f0bdSmrg	      ;;
72441b2f0bdSmrg	    esac
72541b2f0bdSmrg	    lastarg="$lastarg $arg"
72641b2f0bdSmrg	  done
72741b2f0bdSmrg	  IFS="$save_ifs"
72841b2f0bdSmrg	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
72941b2f0bdSmrg
73041b2f0bdSmrg	  # Add the arguments to base_compile.
73141b2f0bdSmrg	  base_compile="$base_compile $lastarg"
73241b2f0bdSmrg	  continue
73341b2f0bdSmrg	  ;;
73441b2f0bdSmrg
73541b2f0bdSmrg	* )
73641b2f0bdSmrg	  # Accept the current argument as the source file.
73741b2f0bdSmrg	  # The previous "srcfile" becomes the current argument.
73841b2f0bdSmrg	  #
73941b2f0bdSmrg	  lastarg="$srcfile"
74041b2f0bdSmrg	  srcfile="$arg"
74141b2f0bdSmrg	  ;;
74241b2f0bdSmrg	esac  #  case $arg
74341b2f0bdSmrg	;;
74441b2f0bdSmrg      esac    #  case $arg_mode
74541b2f0bdSmrg
74641b2f0bdSmrg      # Aesthetically quote the previous argument.
74741b2f0bdSmrg      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
74841b2f0bdSmrg
74941b2f0bdSmrg      case $lastarg in
75041b2f0bdSmrg      # Double-quote args containing other shell metacharacters.
75141b2f0bdSmrg      # Many Bourne shells cannot handle close brackets correctly
75241b2f0bdSmrg      # in scan sets, and some SunOS ksh mistreat backslash-escaping
75341b2f0bdSmrg      # in scan sets (worked around with variable expansion),
75441b2f0bdSmrg      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
75541b2f0bdSmrg      # at all, so we specify them separately.
75641b2f0bdSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
75741b2f0bdSmrg	lastarg="\"$lastarg\""
75841b2f0bdSmrg	;;
75941b2f0bdSmrg      esac
76041b2f0bdSmrg
76141b2f0bdSmrg      base_compile="$base_compile $lastarg"
76241b2f0bdSmrg    done # for arg
76341b2f0bdSmrg
76441b2f0bdSmrg    case $arg_mode in
76541b2f0bdSmrg    arg)
76641b2f0bdSmrg      $echo "$modename: you must specify an argument for -Xcompile"
76741b2f0bdSmrg      exit $EXIT_FAILURE
76841b2f0bdSmrg      ;;
76941b2f0bdSmrg    target)
77041b2f0bdSmrg      $echo "$modename: you must specify a target with \`-o'" 1>&2
77141b2f0bdSmrg      exit $EXIT_FAILURE
77241b2f0bdSmrg      ;;
77341b2f0bdSmrg    *)
77441b2f0bdSmrg      # Get the name of the library object.
77541b2f0bdSmrg      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
77641b2f0bdSmrg      ;;
77741b2f0bdSmrg    esac
77841b2f0bdSmrg
77941b2f0bdSmrg    # Recognize several different file suffixes.
78041b2f0bdSmrg    # If the user specifies -o file.o, it is replaced with file.lo
78141b2f0bdSmrg    xform='[cCFSifmso]'
78241b2f0bdSmrg    case $libobj in
78341b2f0bdSmrg    *.ada) xform=ada ;;
78441b2f0bdSmrg    *.adb) xform=adb ;;
78541b2f0bdSmrg    *.ads) xform=ads ;;
78641b2f0bdSmrg    *.asm) xform=asm ;;
78741b2f0bdSmrg    *.c++) xform=c++ ;;
78841b2f0bdSmrg    *.cc) xform=cc ;;
78941b2f0bdSmrg    *.ii) xform=ii ;;
79041b2f0bdSmrg    *.class) xform=class ;;
79141b2f0bdSmrg    *.cpp) xform=cpp ;;
79241b2f0bdSmrg    *.cxx) xform=cxx ;;
79311245024Smrg    *.[fF][09]?) xform=[fF][09]. ;;
79441b2f0bdSmrg    *.for) xform=for ;;
79541b2f0bdSmrg    *.java) xform=java ;;
79611245024Smrg    *.obj) xform=obj ;;
79711245024Smrg    *.sx) xform=sx ;;
79841b2f0bdSmrg    esac
79941b2f0bdSmrg
80041b2f0bdSmrg    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
80141b2f0bdSmrg
80241b2f0bdSmrg    case $libobj in
80341b2f0bdSmrg    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
80441b2f0bdSmrg    *)
80541b2f0bdSmrg      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
80641b2f0bdSmrg      exit $EXIT_FAILURE
80741b2f0bdSmrg      ;;
80841b2f0bdSmrg    esac
80941b2f0bdSmrg
81041b2f0bdSmrg    func_infer_tag $base_compile
81141b2f0bdSmrg
81241b2f0bdSmrg    for arg in $later; do
81341b2f0bdSmrg      case $arg in
81441b2f0bdSmrg      -static)
81541b2f0bdSmrg	build_old_libs=yes
81641b2f0bdSmrg	continue
81741b2f0bdSmrg	;;
81841b2f0bdSmrg
81941b2f0bdSmrg      -prefer-pic)
82041b2f0bdSmrg	pic_mode=yes
82141b2f0bdSmrg	continue
82241b2f0bdSmrg	;;
82341b2f0bdSmrg
82441b2f0bdSmrg      -prefer-non-pic)
82541b2f0bdSmrg	pic_mode=no
82641b2f0bdSmrg	continue
82741b2f0bdSmrg	;;
82841b2f0bdSmrg      esac
82941b2f0bdSmrg    done
83041b2f0bdSmrg
83141b2f0bdSmrg    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
83241b2f0bdSmrg    case $qlibobj in
83341b2f0bdSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
83441b2f0bdSmrg	qlibobj="\"$qlibobj\"" ;;
83541b2f0bdSmrg    esac
83641b2f0bdSmrg    test "X$libobj" != "X$qlibobj" \
83741b2f0bdSmrg	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
83841b2f0bdSmrg	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
83941b2f0bdSmrg    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
84041b2f0bdSmrg    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
84141b2f0bdSmrg    if test "X$xdir" = "X$obj"; then
84241b2f0bdSmrg      xdir=
84341b2f0bdSmrg    else
84441b2f0bdSmrg      xdir=$xdir/
84541b2f0bdSmrg    fi
84641b2f0bdSmrg    lobj=${xdir}$objdir/$objname
84741b2f0bdSmrg
84841b2f0bdSmrg    if test -z "$base_compile"; then
84941b2f0bdSmrg      $echo "$modename: you must specify a compilation command" 1>&2
85041b2f0bdSmrg      $echo "$help" 1>&2
85141b2f0bdSmrg      exit $EXIT_FAILURE
85241b2f0bdSmrg    fi
85341b2f0bdSmrg
85441b2f0bdSmrg    # Delete any leftover library objects.
85541b2f0bdSmrg    if test "$build_old_libs" = yes; then
85641b2f0bdSmrg      removelist="$obj $lobj $libobj ${libobj}T"
85741b2f0bdSmrg    else
85841b2f0bdSmrg      removelist="$lobj $libobj ${libobj}T"
85941b2f0bdSmrg    fi
86041b2f0bdSmrg
86141b2f0bdSmrg    $run $rm $removelist
86241b2f0bdSmrg    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
86341b2f0bdSmrg
86441b2f0bdSmrg    # On Cygwin there's no "real" PIC flag so we must build both object types
86541b2f0bdSmrg    case $host_os in
86641b2f0bdSmrg    cygwin* | mingw* | pw32* | os2*)
86741b2f0bdSmrg      pic_mode=default
86841b2f0bdSmrg      ;;
86941b2f0bdSmrg    esac
87041b2f0bdSmrg    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
87141b2f0bdSmrg      # non-PIC code in shared libraries is not supported
87241b2f0bdSmrg      pic_mode=default
87341b2f0bdSmrg    fi
87441b2f0bdSmrg
87541b2f0bdSmrg    # Calculate the filename of the output object if compiler does
87641b2f0bdSmrg    # not support -o with -c
87741b2f0bdSmrg    if test "$compiler_c_o" = no; then
87841b2f0bdSmrg      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
87941b2f0bdSmrg      lockfile="$output_obj.lock"
88041b2f0bdSmrg      removelist="$removelist $output_obj $lockfile"
88141b2f0bdSmrg      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
88241b2f0bdSmrg    else
88341b2f0bdSmrg      output_obj=
88441b2f0bdSmrg      need_locks=no
88541b2f0bdSmrg      lockfile=
88641b2f0bdSmrg    fi
88741b2f0bdSmrg
88841b2f0bdSmrg    # Lock this critical section if it is needed
88941b2f0bdSmrg    # We use this script file to make the link, it avoids creating a new file
89041b2f0bdSmrg    if test "$need_locks" = yes; then
89141b2f0bdSmrg      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
89241b2f0bdSmrg	$show "Waiting for $lockfile to be removed"
89341b2f0bdSmrg	sleep 2
89441b2f0bdSmrg      done
89541b2f0bdSmrg    elif test "$need_locks" = warn; then
89641b2f0bdSmrg      if test -f "$lockfile"; then
89741b2f0bdSmrg	$echo "\
89841b2f0bdSmrg*** ERROR, $lockfile exists and contains:
89941b2f0bdSmrg`cat $lockfile 2>/dev/null`
90041b2f0bdSmrg
90141b2f0bdSmrgThis indicates that another process is trying to use the same
90241b2f0bdSmrgtemporary object file, and libtool could not work around it because
90341b2f0bdSmrgyour compiler does not support \`-c' and \`-o' together.  If you
90441b2f0bdSmrgrepeat this compilation, it may succeed, by chance, but you had better
90541b2f0bdSmrgavoid parallel builds (make -j) in this platform, or get a better
90641b2f0bdSmrgcompiler."
90741b2f0bdSmrg
90841b2f0bdSmrg	$run $rm $removelist
90941b2f0bdSmrg	exit $EXIT_FAILURE
91041b2f0bdSmrg      fi
91141b2f0bdSmrg      $echo "$srcfile" > "$lockfile"
91241b2f0bdSmrg    fi
91341b2f0bdSmrg
91441b2f0bdSmrg    if test -n "$fix_srcfile_path"; then
91541b2f0bdSmrg      eval srcfile=\"$fix_srcfile_path\"
91641b2f0bdSmrg    fi
91741b2f0bdSmrg    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
91841b2f0bdSmrg    case $qsrcfile in
91941b2f0bdSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
92041b2f0bdSmrg      qsrcfile="\"$qsrcfile\"" ;;
92141b2f0bdSmrg    esac
92241b2f0bdSmrg
92341b2f0bdSmrg    $run $rm "$libobj" "${libobj}T"
92441b2f0bdSmrg
92541b2f0bdSmrg    # Create a libtool object file (analogous to a ".la" file),
92641b2f0bdSmrg    # but don't create it if we're doing a dry run.
92741b2f0bdSmrg    test -z "$run" && cat > ${libobj}T <<EOF
92841b2f0bdSmrg# $libobj - a libtool object file
92941b2f0bdSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
93041b2f0bdSmrg#
93141b2f0bdSmrg# Please DO NOT delete this file!
93241b2f0bdSmrg# It is necessary for linking the library.
93341b2f0bdSmrg
93441b2f0bdSmrg# Name of the PIC object.
93541b2f0bdSmrgEOF
93641b2f0bdSmrg
93741b2f0bdSmrg    # Only build a PIC object if we are building libtool libraries.
93841b2f0bdSmrg    if test "$build_libtool_libs" = yes; then
93941b2f0bdSmrg      # Without this assignment, base_compile gets emptied.
94041b2f0bdSmrg      fbsd_hideous_sh_bug=$base_compile
94141b2f0bdSmrg
94241b2f0bdSmrg      if test "$pic_mode" != no; then
94341b2f0bdSmrg	command="$base_compile $qsrcfile $pic_flag"
94441b2f0bdSmrg      else
94541b2f0bdSmrg	# Don't build PIC code
94641b2f0bdSmrg	command="$base_compile $qsrcfile"
94741b2f0bdSmrg      fi
94841b2f0bdSmrg
94941b2f0bdSmrg      if test ! -d "${xdir}$objdir"; then
95041b2f0bdSmrg	$show "$mkdir ${xdir}$objdir"
95141b2f0bdSmrg	$run $mkdir ${xdir}$objdir
95241b2f0bdSmrg	exit_status=$?
95341b2f0bdSmrg	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
95441b2f0bdSmrg	  exit $exit_status
95541b2f0bdSmrg	fi
95641b2f0bdSmrg      fi
95741b2f0bdSmrg
95841b2f0bdSmrg      if test -z "$output_obj"; then
95941b2f0bdSmrg	# Place PIC objects in $objdir
96041b2f0bdSmrg	command="$command -o $lobj"
96141b2f0bdSmrg      fi
96241b2f0bdSmrg
96341b2f0bdSmrg      $run $rm "$lobj" "$output_obj"
96441b2f0bdSmrg
96541b2f0bdSmrg      $show "$command"
96611245024Smrg      if $run eval $lt_env "$command"; then :
96741b2f0bdSmrg      else
96841b2f0bdSmrg	test -n "$output_obj" && $run $rm $removelist
96941b2f0bdSmrg	exit $EXIT_FAILURE
97041b2f0bdSmrg      fi
97141b2f0bdSmrg
97241b2f0bdSmrg      if test "$need_locks" = warn &&
97341b2f0bdSmrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
97441b2f0bdSmrg	$echo "\
97541b2f0bdSmrg*** ERROR, $lockfile contains:
97641b2f0bdSmrg`cat $lockfile 2>/dev/null`
97741b2f0bdSmrg
97841b2f0bdSmrgbut it should contain:
97941b2f0bdSmrg$srcfile
98041b2f0bdSmrg
98141b2f0bdSmrgThis indicates that another process is trying to use the same
98241b2f0bdSmrgtemporary object file, and libtool could not work around it because
98341b2f0bdSmrgyour compiler does not support \`-c' and \`-o' together.  If you
98441b2f0bdSmrgrepeat this compilation, it may succeed, by chance, but you had better
98541b2f0bdSmrgavoid parallel builds (make -j) in this platform, or get a better
98641b2f0bdSmrgcompiler."
98741b2f0bdSmrg
98841b2f0bdSmrg	$run $rm $removelist
98941b2f0bdSmrg	exit $EXIT_FAILURE
99041b2f0bdSmrg      fi
99141b2f0bdSmrg
99241b2f0bdSmrg      # Just move the object if needed, then go on to compile the next one
99341b2f0bdSmrg      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
99441b2f0bdSmrg	$show "$mv $output_obj $lobj"
99541b2f0bdSmrg	if $run $mv $output_obj $lobj; then :
99641b2f0bdSmrg	else
99741b2f0bdSmrg	  error=$?
99841b2f0bdSmrg	  $run $rm $removelist
99941b2f0bdSmrg	  exit $error
100041b2f0bdSmrg	fi
100141b2f0bdSmrg      fi
100241b2f0bdSmrg
100341b2f0bdSmrg      # Append the name of the PIC object to the libtool object file.
100441b2f0bdSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
100541b2f0bdSmrgpic_object='$objdir/$objname'
100641b2f0bdSmrg
100741b2f0bdSmrgEOF
100841b2f0bdSmrg
100941b2f0bdSmrg      # Allow error messages only from the first compilation.
101041b2f0bdSmrg      if test "$suppress_opt" = yes; then
101141b2f0bdSmrg        suppress_output=' >/dev/null 2>&1'
101241b2f0bdSmrg      fi
101341b2f0bdSmrg    else
101441b2f0bdSmrg      # No PIC object so indicate it doesn't exist in the libtool
101541b2f0bdSmrg      # object file.
101641b2f0bdSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
101741b2f0bdSmrgpic_object=none
101841b2f0bdSmrg
101941b2f0bdSmrgEOF
102041b2f0bdSmrg    fi
102141b2f0bdSmrg
102241b2f0bdSmrg    # Only build a position-dependent object if we build old libraries.
102341b2f0bdSmrg    if test "$build_old_libs" = yes; then
102441b2f0bdSmrg      if test "$pic_mode" != yes; then
102541b2f0bdSmrg	# Don't build PIC code
102641b2f0bdSmrg	command="$base_compile $qsrcfile"
102741b2f0bdSmrg      else
102841b2f0bdSmrg	command="$base_compile $qsrcfile $pic_flag"
102941b2f0bdSmrg      fi
103041b2f0bdSmrg      if test "$compiler_c_o" = yes; then
103141b2f0bdSmrg	command="$command -o $obj"
103241b2f0bdSmrg      fi
103341b2f0bdSmrg
103441b2f0bdSmrg      # Suppress compiler output if we already did a PIC compilation.
103541b2f0bdSmrg      command="$command$suppress_output"
103641b2f0bdSmrg      $run $rm "$obj" "$output_obj"
103741b2f0bdSmrg      $show "$command"
103811245024Smrg      if $run eval $lt_env "$command"; then :
103941b2f0bdSmrg      else
104041b2f0bdSmrg	$run $rm $removelist
104141b2f0bdSmrg	exit $EXIT_FAILURE
104241b2f0bdSmrg      fi
104341b2f0bdSmrg
104441b2f0bdSmrg      if test "$need_locks" = warn &&
104541b2f0bdSmrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
104641b2f0bdSmrg	$echo "\
104741b2f0bdSmrg*** ERROR, $lockfile contains:
104841b2f0bdSmrg`cat $lockfile 2>/dev/null`
104941b2f0bdSmrg
105041b2f0bdSmrgbut it should contain:
105141b2f0bdSmrg$srcfile
105241b2f0bdSmrg
105341b2f0bdSmrgThis indicates that another process is trying to use the same
105441b2f0bdSmrgtemporary object file, and libtool could not work around it because
105541b2f0bdSmrgyour compiler does not support \`-c' and \`-o' together.  If you
105641b2f0bdSmrgrepeat this compilation, it may succeed, by chance, but you had better
105741b2f0bdSmrgavoid parallel builds (make -j) in this platform, or get a better
105841b2f0bdSmrgcompiler."
105941b2f0bdSmrg
106041b2f0bdSmrg	$run $rm $removelist
106141b2f0bdSmrg	exit $EXIT_FAILURE
106241b2f0bdSmrg      fi
106341b2f0bdSmrg
106441b2f0bdSmrg      # Just move the object if needed
106541b2f0bdSmrg      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
106641b2f0bdSmrg	$show "$mv $output_obj $obj"
106741b2f0bdSmrg	if $run $mv $output_obj $obj; then :
106841b2f0bdSmrg	else
106941b2f0bdSmrg	  error=$?
107041b2f0bdSmrg	  $run $rm $removelist
107141b2f0bdSmrg	  exit $error
107241b2f0bdSmrg	fi
107341b2f0bdSmrg      fi
107441b2f0bdSmrg
107541b2f0bdSmrg      # Append the name of the non-PIC object the libtool object file.
107641b2f0bdSmrg      # Only append if the libtool object file exists.
107741b2f0bdSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
107841b2f0bdSmrg# Name of the non-PIC object.
107941b2f0bdSmrgnon_pic_object='$objname'
108041b2f0bdSmrg
108141b2f0bdSmrgEOF
108241b2f0bdSmrg    else
108341b2f0bdSmrg      # Append the name of the non-PIC object the libtool object file.
108441b2f0bdSmrg      # Only append if the libtool object file exists.
108541b2f0bdSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
108641b2f0bdSmrg# Name of the non-PIC object.
108741b2f0bdSmrgnon_pic_object=none
108841b2f0bdSmrg
108941b2f0bdSmrgEOF
109041b2f0bdSmrg    fi
109141b2f0bdSmrg
109241b2f0bdSmrg    $run $mv "${libobj}T" "${libobj}"
109341b2f0bdSmrg
109441b2f0bdSmrg    # Unlock the critical section if it was locked
109541b2f0bdSmrg    if test "$need_locks" != no; then
109641b2f0bdSmrg      $run $rm "$lockfile"
109741b2f0bdSmrg    fi
109841b2f0bdSmrg
109941b2f0bdSmrg    exit $EXIT_SUCCESS
110041b2f0bdSmrg    ;;
110141b2f0bdSmrg
110241b2f0bdSmrg  # libtool link mode
110341b2f0bdSmrg  link | relink)
110441b2f0bdSmrg    modename="$modename: link"
110541b2f0bdSmrg    case $host in
110641b2f0bdSmrg    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
110741b2f0bdSmrg      # It is impossible to link a dll without this setting, and
110841b2f0bdSmrg      # we shouldn't force the makefile maintainer to figure out
110941b2f0bdSmrg      # which system we are compiling for in order to pass an extra
111041b2f0bdSmrg      # flag for every libtool invocation.
111141b2f0bdSmrg      # allow_undefined=no
111241b2f0bdSmrg
111341b2f0bdSmrg      # FIXME: Unfortunately, there are problems with the above when trying
111441b2f0bdSmrg      # to make a dll which has undefined symbols, in which case not
111541b2f0bdSmrg      # even a static library is built.  For now, we need to specify
111641b2f0bdSmrg      # -no-undefined on the libtool link line when we can be certain
111741b2f0bdSmrg      # that all symbols are satisfied, otherwise we get a static library.
111841b2f0bdSmrg      allow_undefined=yes
111941b2f0bdSmrg      ;;
112041b2f0bdSmrg    *)
112141b2f0bdSmrg      allow_undefined=yes
112241b2f0bdSmrg      ;;
112341b2f0bdSmrg    esac
112441b2f0bdSmrg    libtool_args="$nonopt"
112541b2f0bdSmrg    base_compile="$nonopt $@"
112641b2f0bdSmrg    compile_command="$nonopt"
112741b2f0bdSmrg    finalize_command="$nonopt"
112841b2f0bdSmrg
112941b2f0bdSmrg    compile_rpath=
113041b2f0bdSmrg    finalize_rpath=
113141b2f0bdSmrg    compile_shlibpath=
113241b2f0bdSmrg    finalize_shlibpath=
113341b2f0bdSmrg    convenience=
113441b2f0bdSmrg    old_convenience=
113541b2f0bdSmrg    deplibs=
113641b2f0bdSmrg    old_deplibs=
113741b2f0bdSmrg    compiler_flags=
113841b2f0bdSmrg    linker_flags=
113941b2f0bdSmrg    dllsearchpath=
114041b2f0bdSmrg    lib_search_path=`pwd`
114141b2f0bdSmrg    inst_prefix_dir=
114241b2f0bdSmrg
114341b2f0bdSmrg    avoid_version=no
114441b2f0bdSmrg    dlfiles=
114541b2f0bdSmrg    dlprefiles=
114641b2f0bdSmrg    dlself=no
114741b2f0bdSmrg    export_dynamic=no
114841b2f0bdSmrg    export_symbols=
114941b2f0bdSmrg    export_symbols_regex=
115041b2f0bdSmrg    generated=
115141b2f0bdSmrg    libobjs=
115241b2f0bdSmrg    ltlibs=
115341b2f0bdSmrg    module=no
115441b2f0bdSmrg    no_install=no
115541b2f0bdSmrg    objs=
115641b2f0bdSmrg    non_pic_objects=
115741b2f0bdSmrg    notinst_path= # paths that contain not-installed libtool libraries
115841b2f0bdSmrg    precious_files_regex=
115941b2f0bdSmrg    prefer_static_libs=no
116041b2f0bdSmrg    preload=no
116141b2f0bdSmrg    prev=
116241b2f0bdSmrg    prevarg=
116341b2f0bdSmrg    release=
116441b2f0bdSmrg    rpath=
116541b2f0bdSmrg    xrpath=
116641b2f0bdSmrg    perm_rpath=
116741b2f0bdSmrg    temp_rpath=
116841b2f0bdSmrg    thread_safe=no
116941b2f0bdSmrg    vinfo=
117041b2f0bdSmrg    vinfo_number=no
117111245024Smrg    single_module="${wl}-single_module"
117241b2f0bdSmrg
117341b2f0bdSmrg    func_infer_tag $base_compile
117441b2f0bdSmrg
117541b2f0bdSmrg    # We need to know -static, to get the right output filenames.
117641b2f0bdSmrg    for arg
117741b2f0bdSmrg    do
117841b2f0bdSmrg      case $arg in
117911245024Smrg      -all-static | -static | -static-libtool-libs)
118011245024Smrg	case $arg in
118111245024Smrg	-all-static)
118241b2f0bdSmrg	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
118341b2f0bdSmrg	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
118441b2f0bdSmrg	  fi
118541b2f0bdSmrg	  if test -n "$link_static_flag"; then
118641b2f0bdSmrg	    dlopen_self=$dlopen_self_static
118741b2f0bdSmrg	  fi
118841b2f0bdSmrg	  prefer_static_libs=yes
118911245024Smrg	  ;;
119011245024Smrg	-static)
119141b2f0bdSmrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
119241b2f0bdSmrg	    dlopen_self=$dlopen_self_static
119341b2f0bdSmrg	  fi
119441b2f0bdSmrg	  prefer_static_libs=built
119511245024Smrg	  ;;
119611245024Smrg	-static-libtool-libs)
119711245024Smrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
119811245024Smrg	    dlopen_self=$dlopen_self_static
119911245024Smrg	  fi
120011245024Smrg	  prefer_static_libs=yes
120111245024Smrg	  ;;
120211245024Smrg	esac
120341b2f0bdSmrg	build_libtool_libs=no
120441b2f0bdSmrg	build_old_libs=yes
120541b2f0bdSmrg	break
120641b2f0bdSmrg	;;
120741b2f0bdSmrg      esac
120841b2f0bdSmrg    done
120941b2f0bdSmrg
121041b2f0bdSmrg    # See if our shared archives depend on static archives.
121141b2f0bdSmrg    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
121241b2f0bdSmrg
121341b2f0bdSmrg    # Go through the arguments, transforming them on the way.
121441b2f0bdSmrg    while test "$#" -gt 0; do
121541b2f0bdSmrg      arg="$1"
121641b2f0bdSmrg      shift
121741b2f0bdSmrg      case $arg in
121841b2f0bdSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
121941b2f0bdSmrg	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
122041b2f0bdSmrg	;;
122141b2f0bdSmrg      *) qarg=$arg ;;
122241b2f0bdSmrg      esac
122341b2f0bdSmrg      libtool_args="$libtool_args $qarg"
122441b2f0bdSmrg
122541b2f0bdSmrg      # If the previous option needs an argument, assign it.
122641b2f0bdSmrg      if test -n "$prev"; then
122741b2f0bdSmrg	case $prev in
122841b2f0bdSmrg	output)
122941b2f0bdSmrg	  compile_command="$compile_command @OUTPUT@"
123041b2f0bdSmrg	  finalize_command="$finalize_command @OUTPUT@"
123141b2f0bdSmrg	  ;;
123241b2f0bdSmrg	esac
123341b2f0bdSmrg
123441b2f0bdSmrg	case $prev in
123541b2f0bdSmrg	dlfiles|dlprefiles)
123641b2f0bdSmrg	  if test "$preload" = no; then
123741b2f0bdSmrg	    # Add the symbol object into the linking commands.
123841b2f0bdSmrg	    compile_command="$compile_command @SYMFILE@"
123941b2f0bdSmrg	    finalize_command="$finalize_command @SYMFILE@"
124041b2f0bdSmrg	    preload=yes
124141b2f0bdSmrg	  fi
124241b2f0bdSmrg	  case $arg in
124341b2f0bdSmrg	  *.la | *.lo) ;;  # We handle these cases below.
124441b2f0bdSmrg	  force)
124541b2f0bdSmrg	    if test "$dlself" = no; then
124641b2f0bdSmrg	      dlself=needless
124741b2f0bdSmrg	      export_dynamic=yes
124841b2f0bdSmrg	    fi
124941b2f0bdSmrg	    prev=
125041b2f0bdSmrg	    continue
125141b2f0bdSmrg	    ;;
125241b2f0bdSmrg	  self)
125341b2f0bdSmrg	    if test "$prev" = dlprefiles; then
125441b2f0bdSmrg	      dlself=yes
125541b2f0bdSmrg	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
125641b2f0bdSmrg	      dlself=yes
125741b2f0bdSmrg	    else
125841b2f0bdSmrg	      dlself=needless
125941b2f0bdSmrg	      export_dynamic=yes
126041b2f0bdSmrg	    fi
126141b2f0bdSmrg	    prev=
126241b2f0bdSmrg	    continue
126341b2f0bdSmrg	    ;;
126441b2f0bdSmrg	  *)
126541b2f0bdSmrg	    if test "$prev" = dlfiles; then
126641b2f0bdSmrg	      dlfiles="$dlfiles $arg"
126741b2f0bdSmrg	    else
126841b2f0bdSmrg	      dlprefiles="$dlprefiles $arg"
126941b2f0bdSmrg	    fi
127041b2f0bdSmrg	    prev=
127141b2f0bdSmrg	    continue
127241b2f0bdSmrg	    ;;
127341b2f0bdSmrg	  esac
127441b2f0bdSmrg	  ;;
127541b2f0bdSmrg	expsyms)
127641b2f0bdSmrg	  export_symbols="$arg"
127741b2f0bdSmrg	  if test ! -f "$arg"; then
127841b2f0bdSmrg	    $echo "$modename: symbol file \`$arg' does not exist"
127941b2f0bdSmrg	    exit $EXIT_FAILURE
128041b2f0bdSmrg	  fi
128141b2f0bdSmrg	  prev=
128241b2f0bdSmrg	  continue
128341b2f0bdSmrg	  ;;
128441b2f0bdSmrg	expsyms_regex)
128541b2f0bdSmrg	  export_symbols_regex="$arg"
128641b2f0bdSmrg	  prev=
128741b2f0bdSmrg	  continue
128841b2f0bdSmrg	  ;;
128941b2f0bdSmrg	inst_prefix)
129041b2f0bdSmrg	  inst_prefix_dir="$arg"
129141b2f0bdSmrg	  prev=
129241b2f0bdSmrg	  continue
129341b2f0bdSmrg	  ;;
129441b2f0bdSmrg	precious_regex)
129541b2f0bdSmrg	  precious_files_regex="$arg"
129641b2f0bdSmrg	  prev=
129741b2f0bdSmrg	  continue
129841b2f0bdSmrg	  ;;
129941b2f0bdSmrg	release)
130041b2f0bdSmrg	  release="-$arg"
130141b2f0bdSmrg	  prev=
130241b2f0bdSmrg	  continue
130341b2f0bdSmrg	  ;;
130441b2f0bdSmrg	objectlist)
130541b2f0bdSmrg	  if test -f "$arg"; then
130641b2f0bdSmrg	    save_arg=$arg
130741b2f0bdSmrg	    moreargs=
130841b2f0bdSmrg	    for fil in `cat $save_arg`
130941b2f0bdSmrg	    do
131041b2f0bdSmrg#	      moreargs="$moreargs $fil"
131141b2f0bdSmrg	      arg=$fil
131241b2f0bdSmrg	      # A libtool-controlled object.
131341b2f0bdSmrg
131441b2f0bdSmrg	      # Check to see that this really is a libtool object.
131541b2f0bdSmrg	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
131641b2f0bdSmrg		pic_object=
131741b2f0bdSmrg		non_pic_object=
131841b2f0bdSmrg
131941b2f0bdSmrg		# Read the .lo file
132041b2f0bdSmrg		# If there is no directory component, then add one.
132141b2f0bdSmrg		case $arg in
132241b2f0bdSmrg		*/* | *\\*) . $arg ;;
132341b2f0bdSmrg		*) . ./$arg ;;
132441b2f0bdSmrg		esac
132541b2f0bdSmrg
132641b2f0bdSmrg		if test -z "$pic_object" || \
132741b2f0bdSmrg		   test -z "$non_pic_object" ||
132841b2f0bdSmrg		   test "$pic_object" = none && \
132941b2f0bdSmrg		   test "$non_pic_object" = none; then
133041b2f0bdSmrg		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
133141b2f0bdSmrg		  exit $EXIT_FAILURE
133241b2f0bdSmrg		fi
133341b2f0bdSmrg
133441b2f0bdSmrg		# Extract subdirectory from the argument.
133541b2f0bdSmrg		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
133641b2f0bdSmrg		if test "X$xdir" = "X$arg"; then
133741b2f0bdSmrg		  xdir=
133841b2f0bdSmrg		else
133941b2f0bdSmrg		  xdir="$xdir/"
134041b2f0bdSmrg		fi
134141b2f0bdSmrg
134241b2f0bdSmrg		if test "$pic_object" != none; then
134341b2f0bdSmrg		  # Prepend the subdirectory the object is found in.
134441b2f0bdSmrg		  pic_object="$xdir$pic_object"
134541b2f0bdSmrg
134641b2f0bdSmrg		  if test "$prev" = dlfiles; then
134741b2f0bdSmrg		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
134841b2f0bdSmrg		      dlfiles="$dlfiles $pic_object"
134941b2f0bdSmrg		      prev=
135041b2f0bdSmrg		      continue
135141b2f0bdSmrg		    else
135241b2f0bdSmrg		      # If libtool objects are unsupported, then we need to preload.
135341b2f0bdSmrg		      prev=dlprefiles
135441b2f0bdSmrg		    fi
135541b2f0bdSmrg		  fi
135641b2f0bdSmrg
135741b2f0bdSmrg		  # CHECK ME:  I think I busted this.  -Ossama
135841b2f0bdSmrg		  if test "$prev" = dlprefiles; then
135941b2f0bdSmrg		    # Preload the old-style object.
136041b2f0bdSmrg		    dlprefiles="$dlprefiles $pic_object"
136141b2f0bdSmrg		    prev=
136241b2f0bdSmrg		  fi
136341b2f0bdSmrg
136441b2f0bdSmrg		  # A PIC object.
136541b2f0bdSmrg		  libobjs="$libobjs $pic_object"
136641b2f0bdSmrg		  arg="$pic_object"
136741b2f0bdSmrg		fi
136841b2f0bdSmrg
136941b2f0bdSmrg		# Non-PIC object.
137041b2f0bdSmrg		if test "$non_pic_object" != none; then
137141b2f0bdSmrg		  # Prepend the subdirectory the object is found in.
137241b2f0bdSmrg		  non_pic_object="$xdir$non_pic_object"
137341b2f0bdSmrg
137441b2f0bdSmrg		  # A standard non-PIC object
137541b2f0bdSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
137641b2f0bdSmrg		  if test -z "$pic_object" || test "$pic_object" = none ; then
137741b2f0bdSmrg		    arg="$non_pic_object"
137841b2f0bdSmrg		  fi
137941b2f0bdSmrg		else
138041b2f0bdSmrg		  # If the PIC object exists, use it instead.
138141b2f0bdSmrg		  # $xdir was prepended to $pic_object above.
138241b2f0bdSmrg		  non_pic_object="$pic_object"
138341b2f0bdSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
138441b2f0bdSmrg		fi
138541b2f0bdSmrg	      else
138641b2f0bdSmrg		# Only an error if not doing a dry-run.
138741b2f0bdSmrg		if test -z "$run"; then
138841b2f0bdSmrg		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
138941b2f0bdSmrg		  exit $EXIT_FAILURE
139041b2f0bdSmrg		else
139141b2f0bdSmrg		  # Dry-run case.
139241b2f0bdSmrg
139341b2f0bdSmrg		  # Extract subdirectory from the argument.
139441b2f0bdSmrg		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
139541b2f0bdSmrg		  if test "X$xdir" = "X$arg"; then
139641b2f0bdSmrg		    xdir=
139741b2f0bdSmrg		  else
139841b2f0bdSmrg		    xdir="$xdir/"
139941b2f0bdSmrg		  fi
140041b2f0bdSmrg
140141b2f0bdSmrg		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
140241b2f0bdSmrg		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
140341b2f0bdSmrg		  libobjs="$libobjs $pic_object"
140441b2f0bdSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
140541b2f0bdSmrg		fi
140641b2f0bdSmrg	      fi
140741b2f0bdSmrg	    done
140841b2f0bdSmrg	  else
140941b2f0bdSmrg	    $echo "$modename: link input file \`$save_arg' does not exist"
141041b2f0bdSmrg	    exit $EXIT_FAILURE
141141b2f0bdSmrg	  fi
141241b2f0bdSmrg	  arg=$save_arg
141341b2f0bdSmrg	  prev=
141441b2f0bdSmrg	  continue
141541b2f0bdSmrg	  ;;
141641b2f0bdSmrg	rpath | xrpath)
141741b2f0bdSmrg	  # We need an absolute path.
141841b2f0bdSmrg	  case $arg in
141941b2f0bdSmrg	  [\\/]* | [A-Za-z]:[\\/]*) ;;
142041b2f0bdSmrg	  *)
142141b2f0bdSmrg	    $echo "$modename: only absolute run-paths are allowed" 1>&2
142241b2f0bdSmrg	    exit $EXIT_FAILURE
142341b2f0bdSmrg	    ;;
142441b2f0bdSmrg	  esac
142541b2f0bdSmrg	  if test "$prev" = rpath; then
142641b2f0bdSmrg	    case "$rpath " in
142741b2f0bdSmrg	    *" $arg "*) ;;
142841b2f0bdSmrg	    *) rpath="$rpath $arg" ;;
142941b2f0bdSmrg	    esac
143041b2f0bdSmrg	  else
143141b2f0bdSmrg	    case "$xrpath " in
143241b2f0bdSmrg	    *" $arg "*) ;;
143341b2f0bdSmrg	    *) xrpath="$xrpath $arg" ;;
143441b2f0bdSmrg	    esac
143541b2f0bdSmrg	  fi
143641b2f0bdSmrg	  prev=
143741b2f0bdSmrg	  continue
143841b2f0bdSmrg	  ;;
143941b2f0bdSmrg	xcompiler)
144041b2f0bdSmrg	  compiler_flags="$compiler_flags $qarg"
144141b2f0bdSmrg	  prev=
144241b2f0bdSmrg	  compile_command="$compile_command $qarg"
144341b2f0bdSmrg	  finalize_command="$finalize_command $qarg"
144441b2f0bdSmrg	  continue
144541b2f0bdSmrg	  ;;
144641b2f0bdSmrg	xlinker)
144741b2f0bdSmrg	  linker_flags="$linker_flags $qarg"
144841b2f0bdSmrg	  compiler_flags="$compiler_flags $wl$qarg"
144941b2f0bdSmrg	  prev=
145041b2f0bdSmrg	  compile_command="$compile_command $wl$qarg"
145141b2f0bdSmrg	  finalize_command="$finalize_command $wl$qarg"
145241b2f0bdSmrg	  continue
145341b2f0bdSmrg	  ;;
145441b2f0bdSmrg	xcclinker)
145541b2f0bdSmrg	  linker_flags="$linker_flags $qarg"
145641b2f0bdSmrg	  compiler_flags="$compiler_flags $qarg"
145741b2f0bdSmrg	  prev=
145841b2f0bdSmrg	  compile_command="$compile_command $qarg"
145941b2f0bdSmrg	  finalize_command="$finalize_command $qarg"
146041b2f0bdSmrg	  continue
146141b2f0bdSmrg	  ;;
146241b2f0bdSmrg	shrext)
146341b2f0bdSmrg  	  shrext_cmds="$arg"
146441b2f0bdSmrg	  prev=
146541b2f0bdSmrg	  continue
146641b2f0bdSmrg	  ;;
146741b2f0bdSmrg	darwin_framework|darwin_framework_skip)
146841b2f0bdSmrg	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
146941b2f0bdSmrg	  compile_command="$compile_command $arg"
147041b2f0bdSmrg	  finalize_command="$finalize_command $arg"
147141b2f0bdSmrg	  prev=
147241b2f0bdSmrg	  continue
147341b2f0bdSmrg	  ;;
147441b2f0bdSmrg	*)
147541b2f0bdSmrg	  eval "$prev=\"\$arg\""
147641b2f0bdSmrg	  prev=
147741b2f0bdSmrg	  continue
147841b2f0bdSmrg	  ;;
147941b2f0bdSmrg	esac
148041b2f0bdSmrg      fi # test -n "$prev"
148141b2f0bdSmrg
148241b2f0bdSmrg      prevarg="$arg"
148341b2f0bdSmrg
148441b2f0bdSmrg      case $arg in
148541b2f0bdSmrg      -all-static)
148641b2f0bdSmrg	if test -n "$link_static_flag"; then
148741b2f0bdSmrg	  compile_command="$compile_command $link_static_flag"
148841b2f0bdSmrg	  finalize_command="$finalize_command $link_static_flag"
148941b2f0bdSmrg	fi
149041b2f0bdSmrg	continue
149141b2f0bdSmrg	;;
149241b2f0bdSmrg
149341b2f0bdSmrg      -allow-undefined)
149441b2f0bdSmrg	# FIXME: remove this flag sometime in the future.
149541b2f0bdSmrg	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
149641b2f0bdSmrg	continue
149741b2f0bdSmrg	;;
149841b2f0bdSmrg
149941b2f0bdSmrg      -avoid-version)
150041b2f0bdSmrg	avoid_version=yes
150141b2f0bdSmrg	continue
150241b2f0bdSmrg	;;
150341b2f0bdSmrg
150441b2f0bdSmrg      -dlopen)
150541b2f0bdSmrg	prev=dlfiles
150641b2f0bdSmrg	continue
150741b2f0bdSmrg	;;
150841b2f0bdSmrg
150941b2f0bdSmrg      -dlpreopen)
151041b2f0bdSmrg	prev=dlprefiles
151141b2f0bdSmrg	continue
151241b2f0bdSmrg	;;
151341b2f0bdSmrg
151441b2f0bdSmrg      -export-dynamic)
151541b2f0bdSmrg	export_dynamic=yes
151641b2f0bdSmrg	continue
151741b2f0bdSmrg	;;
151841b2f0bdSmrg
151941b2f0bdSmrg      -export-symbols | -export-symbols-regex)
152041b2f0bdSmrg	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
152141b2f0bdSmrg	  $echo "$modename: more than one -exported-symbols argument is not allowed"
152241b2f0bdSmrg	  exit $EXIT_FAILURE
152341b2f0bdSmrg	fi
152441b2f0bdSmrg	if test "X$arg" = "X-export-symbols"; then
152541b2f0bdSmrg	  prev=expsyms
152641b2f0bdSmrg	else
152741b2f0bdSmrg	  prev=expsyms_regex
152841b2f0bdSmrg	fi
152941b2f0bdSmrg	continue
153041b2f0bdSmrg	;;
153141b2f0bdSmrg
153241b2f0bdSmrg      -framework|-arch|-isysroot)
153341b2f0bdSmrg	case " $CC " in
153441b2f0bdSmrg	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
153541b2f0bdSmrg		prev=darwin_framework_skip ;;
153641b2f0bdSmrg	  *) compiler_flags="$compiler_flags $arg"
153741b2f0bdSmrg	     prev=darwin_framework ;;
153841b2f0bdSmrg	esac
153941b2f0bdSmrg	compile_command="$compile_command $arg"
154041b2f0bdSmrg	finalize_command="$finalize_command $arg"
154141b2f0bdSmrg	continue
154241b2f0bdSmrg	;;
154341b2f0bdSmrg
154441b2f0bdSmrg      -inst-prefix-dir)
154541b2f0bdSmrg	prev=inst_prefix
154641b2f0bdSmrg	continue
154741b2f0bdSmrg	;;
154841b2f0bdSmrg
154941b2f0bdSmrg      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
155041b2f0bdSmrg      # so, if we see these flags be careful not to treat them like -L
155141b2f0bdSmrg      -L[A-Z][A-Z]*:*)
155241b2f0bdSmrg	case $with_gcc/$host in
155341b2f0bdSmrg	no/*-*-irix* | /*-*-irix*)
155441b2f0bdSmrg	  compile_command="$compile_command $arg"
155541b2f0bdSmrg	  finalize_command="$finalize_command $arg"
155641b2f0bdSmrg	  ;;
155741b2f0bdSmrg	esac
155841b2f0bdSmrg	continue
155941b2f0bdSmrg	;;
156041b2f0bdSmrg
156141b2f0bdSmrg      -L*)
156241b2f0bdSmrg	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
156341b2f0bdSmrg	# We need an absolute path.
156441b2f0bdSmrg	case $dir in
156541b2f0bdSmrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
156641b2f0bdSmrg	*)
156741b2f0bdSmrg	  absdir=`cd "$dir" && pwd`
156841b2f0bdSmrg	  if test -z "$absdir"; then
156941b2f0bdSmrg	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
157041b2f0bdSmrg	    absdir="$dir"
157141b2f0bdSmrg	    notinst_path="$notinst_path $dir"
157241b2f0bdSmrg	  fi
157341b2f0bdSmrg	  dir="$absdir"
157441b2f0bdSmrg	  ;;
157541b2f0bdSmrg	esac
157641b2f0bdSmrg	case "$deplibs " in
157741b2f0bdSmrg	*" -L$dir "*) ;;
157841b2f0bdSmrg	*)
157941b2f0bdSmrg	  deplibs="$deplibs -L$dir"
158041b2f0bdSmrg	  lib_search_path="$lib_search_path $dir"
158141b2f0bdSmrg	  ;;
158241b2f0bdSmrg	esac
158341b2f0bdSmrg	case $host in
158441b2f0bdSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
158541b2f0bdSmrg	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
158641b2f0bdSmrg	  case :$dllsearchpath: in
158741b2f0bdSmrg	  *":$dir:"*) ;;
158841b2f0bdSmrg	  *) dllsearchpath="$dllsearchpath:$dir";;
158941b2f0bdSmrg	  esac
159041b2f0bdSmrg	  case :$dllsearchpath: in
159141b2f0bdSmrg	  *":$testbindir:"*) ;;
159241b2f0bdSmrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
159341b2f0bdSmrg	  esac
159441b2f0bdSmrg	  ;;
159541b2f0bdSmrg	esac
159641b2f0bdSmrg	continue
159741b2f0bdSmrg	;;
159841b2f0bdSmrg
159941b2f0bdSmrg      -l*)
160041b2f0bdSmrg	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
160141b2f0bdSmrg	  case $host in
160241b2f0bdSmrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
160341b2f0bdSmrg	    # These systems don't actually have a C or math library (as such)
160441b2f0bdSmrg	    continue
160541b2f0bdSmrg	    ;;
160641b2f0bdSmrg	  *-*-os2*)
160741b2f0bdSmrg	    # These systems don't actually have a C library (as such)
160841b2f0bdSmrg	    test "X$arg" = "X-lc" && continue
160941b2f0bdSmrg	    ;;
161041b2f0bdSmrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
161141b2f0bdSmrg	    # Do not include libc due to us having libc/libc_r.
161241b2f0bdSmrg	    test "X$arg" = "X-lc" && continue
161341b2f0bdSmrg	    ;;
161441b2f0bdSmrg	  *-*-rhapsody* | *-*-darwin1.[012])
161541b2f0bdSmrg	    # Rhapsody C and math libraries are in the System framework
161641b2f0bdSmrg	    deplibs="$deplibs -framework System"
161741b2f0bdSmrg	    continue
161841b2f0bdSmrg	    ;;
161941b2f0bdSmrg	  *-*-sco3.2v5* | *-*-sco5v6*)
162041b2f0bdSmrg	    # Causes problems with __ctype
162141b2f0bdSmrg	    test "X$arg" = "X-lc" && continue
162241b2f0bdSmrg	    ;;
162341b2f0bdSmrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
162441b2f0bdSmrg	    # Compiler inserts libc in the correct place for threads to work
162541b2f0bdSmrg	    test "X$arg" = "X-lc" && continue
162641b2f0bdSmrg	    ;;
162741b2f0bdSmrg	  esac
162841b2f0bdSmrg	elif test "X$arg" = "X-lc_r"; then
162941b2f0bdSmrg	 case $host in
163041b2f0bdSmrg	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
163141b2f0bdSmrg	   # Do not include libc_r directly, use -pthread flag.
163241b2f0bdSmrg	   continue
163341b2f0bdSmrg	   ;;
163441b2f0bdSmrg	 esac
163541b2f0bdSmrg	fi
163641b2f0bdSmrg	deplibs="$deplibs $arg"
163741b2f0bdSmrg	continue
163841b2f0bdSmrg	;;
163941b2f0bdSmrg
164041b2f0bdSmrg      # Tru64 UNIX uses -model [arg] to determine the layout of C++
164141b2f0bdSmrg      # classes, name mangling, and exception handling.
164241b2f0bdSmrg      -model)
164341b2f0bdSmrg	compile_command="$compile_command $arg"
164441b2f0bdSmrg	compiler_flags="$compiler_flags $arg"
164541b2f0bdSmrg	finalize_command="$finalize_command $arg"
164641b2f0bdSmrg	prev=xcompiler
164741b2f0bdSmrg	continue
164841b2f0bdSmrg	;;
164941b2f0bdSmrg
165011245024Smrg     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
165141b2f0bdSmrg	compiler_flags="$compiler_flags $arg"
165241b2f0bdSmrg	compile_command="$compile_command $arg"
165341b2f0bdSmrg	finalize_command="$finalize_command $arg"
165441b2f0bdSmrg	continue
165541b2f0bdSmrg	;;
165641b2f0bdSmrg
165711245024Smrg      -multi_module)
165811245024Smrg	single_module="${wl}-multi_module"
165911245024Smrg	continue
166011245024Smrg	;;
166111245024Smrg
166241b2f0bdSmrg      -module)
166341b2f0bdSmrg	module=yes
166441b2f0bdSmrg	continue
166541b2f0bdSmrg	;;
166641b2f0bdSmrg
166741b2f0bdSmrg      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
166841b2f0bdSmrg      # -r[0-9][0-9]* specifies the processor on the SGI compiler
166941b2f0bdSmrg      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
167041b2f0bdSmrg      # +DA*, +DD* enable 64-bit mode on the HP compiler
167141b2f0bdSmrg      # -q* pass through compiler args for the IBM compiler
167241b2f0bdSmrg      # -m* pass through architecture-specific compiler args for GCC
167341b2f0bdSmrg      # -m*, -t[45]*, -txscale* pass through architecture-specific
167441b2f0bdSmrg      # compiler args for GCC
167511245024Smrg      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
167611245024Smrg      # -F/path gives path to uninstalled frameworks, gcc on darwin
167741b2f0bdSmrg      # @file GCC response files
167811245024Smrg      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
167911245024Smrg      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
168041b2f0bdSmrg
168141b2f0bdSmrg	# Unknown arguments in both finalize_command and compile_command need
168241b2f0bdSmrg	# to be aesthetically quoted because they are evaled later.
168341b2f0bdSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
168441b2f0bdSmrg	case $arg in
168541b2f0bdSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
168641b2f0bdSmrg	  arg="\"$arg\""
168741b2f0bdSmrg	  ;;
168841b2f0bdSmrg	esac
168941b2f0bdSmrg        compile_command="$compile_command $arg"
169041b2f0bdSmrg        finalize_command="$finalize_command $arg"
169141b2f0bdSmrg        compiler_flags="$compiler_flags $arg"
169241b2f0bdSmrg        continue
169341b2f0bdSmrg        ;;
169441b2f0bdSmrg
169541b2f0bdSmrg      -shrext)
169641b2f0bdSmrg	prev=shrext
169741b2f0bdSmrg	continue
169841b2f0bdSmrg	;;
169941b2f0bdSmrg
170041b2f0bdSmrg      -no-fast-install)
170141b2f0bdSmrg	fast_install=no
170241b2f0bdSmrg	continue
170341b2f0bdSmrg	;;
170441b2f0bdSmrg
170541b2f0bdSmrg      -no-install)
170641b2f0bdSmrg	case $host in
170711245024Smrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
170841b2f0bdSmrg	  # The PATH hackery in wrapper scripts is required on Windows
170911245024Smrg	  # and Darwin in order for the loader to find any dlls it needs.
171041b2f0bdSmrg	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
171141b2f0bdSmrg	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
171241b2f0bdSmrg	  fast_install=no
171341b2f0bdSmrg	  ;;
171441b2f0bdSmrg	*) no_install=yes ;;
171541b2f0bdSmrg	esac
171641b2f0bdSmrg	continue
171741b2f0bdSmrg	;;
171841b2f0bdSmrg
171941b2f0bdSmrg      -no-undefined)
172041b2f0bdSmrg	allow_undefined=no
172141b2f0bdSmrg	continue
172241b2f0bdSmrg	;;
172341b2f0bdSmrg
172441b2f0bdSmrg      -objectlist)
172541b2f0bdSmrg	prev=objectlist
172641b2f0bdSmrg	continue
172741b2f0bdSmrg	;;
172841b2f0bdSmrg
172941b2f0bdSmrg      -o) prev=output ;;
173041b2f0bdSmrg
173141b2f0bdSmrg      -precious-files-regex)
173241b2f0bdSmrg	prev=precious_regex
173341b2f0bdSmrg	continue
173441b2f0bdSmrg	;;
173541b2f0bdSmrg
173641b2f0bdSmrg      -release)
173741b2f0bdSmrg	prev=release
173841b2f0bdSmrg	continue
173941b2f0bdSmrg	;;
174041b2f0bdSmrg
174141b2f0bdSmrg      -rpath)
174241b2f0bdSmrg	prev=rpath
174341b2f0bdSmrg	continue
174441b2f0bdSmrg	;;
174541b2f0bdSmrg
174641b2f0bdSmrg      -R)
174741b2f0bdSmrg	prev=xrpath
174841b2f0bdSmrg	continue
174941b2f0bdSmrg	;;
175041b2f0bdSmrg
175141b2f0bdSmrg      -R*)
175241b2f0bdSmrg	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
175341b2f0bdSmrg	# We need an absolute path.
175441b2f0bdSmrg	case $dir in
175541b2f0bdSmrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
175641b2f0bdSmrg	*)
175741b2f0bdSmrg	  $echo "$modename: only absolute run-paths are allowed" 1>&2
175841b2f0bdSmrg	  exit $EXIT_FAILURE
175941b2f0bdSmrg	  ;;
176041b2f0bdSmrg	esac
176141b2f0bdSmrg	case "$xrpath " in
176241b2f0bdSmrg	*" $dir "*) ;;
176341b2f0bdSmrg	*) xrpath="$xrpath $dir" ;;
176441b2f0bdSmrg	esac
176541b2f0bdSmrg	continue
176641b2f0bdSmrg	;;
176741b2f0bdSmrg
176811245024Smrg      -static | -static-libtool-libs)
176941b2f0bdSmrg	# The effects of -static are defined in a previous loop.
177041b2f0bdSmrg	# We used to do the same as -all-static on platforms that
177141b2f0bdSmrg	# didn't have a PIC flag, but the assumption that the effects
177241b2f0bdSmrg	# would be equivalent was wrong.  It would break on at least
177341b2f0bdSmrg	# Digital Unix and AIX.
177441b2f0bdSmrg	continue
177541b2f0bdSmrg	;;
177641b2f0bdSmrg
177741b2f0bdSmrg      -thread-safe)
177841b2f0bdSmrg	thread_safe=yes
177941b2f0bdSmrg	continue
178041b2f0bdSmrg	;;
178141b2f0bdSmrg
178241b2f0bdSmrg      -version-info)
178341b2f0bdSmrg	prev=vinfo
178441b2f0bdSmrg	continue
178541b2f0bdSmrg	;;
178641b2f0bdSmrg      -version-number)
178741b2f0bdSmrg	prev=vinfo
178841b2f0bdSmrg	vinfo_number=yes
178941b2f0bdSmrg	continue
179041b2f0bdSmrg	;;
179141b2f0bdSmrg
179241b2f0bdSmrg      -Wc,*)
179341b2f0bdSmrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
179441b2f0bdSmrg	arg=
179541b2f0bdSmrg	save_ifs="$IFS"; IFS=','
179641b2f0bdSmrg	for flag in $args; do
179741b2f0bdSmrg	  IFS="$save_ifs"
179841b2f0bdSmrg	  case $flag in
179941b2f0bdSmrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
180041b2f0bdSmrg	    flag="\"$flag\""
180141b2f0bdSmrg	    ;;
180241b2f0bdSmrg	  esac
180341b2f0bdSmrg	  arg="$arg $wl$flag"
180441b2f0bdSmrg	  compiler_flags="$compiler_flags $flag"
180541b2f0bdSmrg	done
180641b2f0bdSmrg	IFS="$save_ifs"
180741b2f0bdSmrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
180841b2f0bdSmrg	;;
180941b2f0bdSmrg
181041b2f0bdSmrg      -Wl,*)
181141b2f0bdSmrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
181241b2f0bdSmrg	arg=
181341b2f0bdSmrg	save_ifs="$IFS"; IFS=','
181441b2f0bdSmrg	for flag in $args; do
181541b2f0bdSmrg	  IFS="$save_ifs"
181641b2f0bdSmrg	  case $flag in
181741b2f0bdSmrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
181841b2f0bdSmrg	    flag="\"$flag\""
181941b2f0bdSmrg	    ;;
182041b2f0bdSmrg	  esac
182141b2f0bdSmrg	  arg="$arg $wl$flag"
182241b2f0bdSmrg	  compiler_flags="$compiler_flags $wl$flag"
182341b2f0bdSmrg	  linker_flags="$linker_flags $flag"
182441b2f0bdSmrg	done
182541b2f0bdSmrg	IFS="$save_ifs"
182641b2f0bdSmrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
182741b2f0bdSmrg	;;
182841b2f0bdSmrg
182941b2f0bdSmrg      -Xcompiler)
183041b2f0bdSmrg	prev=xcompiler
183141b2f0bdSmrg	continue
183241b2f0bdSmrg	;;
183341b2f0bdSmrg
183441b2f0bdSmrg      -Xlinker)
183541b2f0bdSmrg	prev=xlinker
183641b2f0bdSmrg	continue
183741b2f0bdSmrg	;;
183841b2f0bdSmrg
183941b2f0bdSmrg      -XCClinker)
184041b2f0bdSmrg	prev=xcclinker
184141b2f0bdSmrg	continue
184241b2f0bdSmrg	;;
184341b2f0bdSmrg
184441b2f0bdSmrg      # Some other compiler flag.
184541b2f0bdSmrg      -* | +*)
184641b2f0bdSmrg	# Unknown arguments in both finalize_command and compile_command need
184741b2f0bdSmrg	# to be aesthetically quoted because they are evaled later.
184841b2f0bdSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
184941b2f0bdSmrg	case $arg in
185041b2f0bdSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
185141b2f0bdSmrg	  arg="\"$arg\""
185241b2f0bdSmrg	  ;;
185341b2f0bdSmrg	esac
185441b2f0bdSmrg	;;
185541b2f0bdSmrg
185641b2f0bdSmrg      *.$objext)
185741b2f0bdSmrg	# A standard object.
185841b2f0bdSmrg	objs="$objs $arg"
185941b2f0bdSmrg	;;
186041b2f0bdSmrg
186141b2f0bdSmrg      *.lo)
186241b2f0bdSmrg	# A libtool-controlled object.
186341b2f0bdSmrg
186441b2f0bdSmrg	# Check to see that this really is a libtool object.
186541b2f0bdSmrg	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
186641b2f0bdSmrg	  pic_object=
186741b2f0bdSmrg	  non_pic_object=
186841b2f0bdSmrg
186941b2f0bdSmrg	  # Read the .lo file
187041b2f0bdSmrg	  # If there is no directory component, then add one.
187141b2f0bdSmrg	  case $arg in
187241b2f0bdSmrg	  */* | *\\*) . $arg ;;
187341b2f0bdSmrg	  *) . ./$arg ;;
187441b2f0bdSmrg	  esac
187541b2f0bdSmrg
187641b2f0bdSmrg	  if test -z "$pic_object" || \
187741b2f0bdSmrg	     test -z "$non_pic_object" ||
187841b2f0bdSmrg	     test "$pic_object" = none && \
187941b2f0bdSmrg	     test "$non_pic_object" = none; then
188041b2f0bdSmrg	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
188141b2f0bdSmrg	    exit $EXIT_FAILURE
188241b2f0bdSmrg	  fi
188341b2f0bdSmrg
188441b2f0bdSmrg	  # Extract subdirectory from the argument.
188541b2f0bdSmrg	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
188641b2f0bdSmrg	  if test "X$xdir" = "X$arg"; then
188741b2f0bdSmrg	    xdir=
188841b2f0bdSmrg 	  else
188941b2f0bdSmrg	    xdir="$xdir/"
189041b2f0bdSmrg	  fi
189141b2f0bdSmrg
189241b2f0bdSmrg	  if test "$pic_object" != none; then
189341b2f0bdSmrg	    # Prepend the subdirectory the object is found in.
189441b2f0bdSmrg	    pic_object="$xdir$pic_object"
189541b2f0bdSmrg
189641b2f0bdSmrg	    if test "$prev" = dlfiles; then
189741b2f0bdSmrg	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
189841b2f0bdSmrg		dlfiles="$dlfiles $pic_object"
189941b2f0bdSmrg		prev=
190041b2f0bdSmrg		continue
190141b2f0bdSmrg	      else
190241b2f0bdSmrg		# If libtool objects are unsupported, then we need to preload.
190341b2f0bdSmrg		prev=dlprefiles
190441b2f0bdSmrg	      fi
190541b2f0bdSmrg	    fi
190641b2f0bdSmrg
190741b2f0bdSmrg	    # CHECK ME:  I think I busted this.  -Ossama
190841b2f0bdSmrg	    if test "$prev" = dlprefiles; then
190941b2f0bdSmrg	      # Preload the old-style object.
191041b2f0bdSmrg	      dlprefiles="$dlprefiles $pic_object"
191141b2f0bdSmrg	      prev=
191241b2f0bdSmrg	    fi
191341b2f0bdSmrg
191441b2f0bdSmrg	    # A PIC object.
191541b2f0bdSmrg	    libobjs="$libobjs $pic_object"
191641b2f0bdSmrg	    arg="$pic_object"
191741b2f0bdSmrg	  fi
191841b2f0bdSmrg
191941b2f0bdSmrg	  # Non-PIC object.
192041b2f0bdSmrg	  if test "$non_pic_object" != none; then
192141b2f0bdSmrg	    # Prepend the subdirectory the object is found in.
192241b2f0bdSmrg	    non_pic_object="$xdir$non_pic_object"
192341b2f0bdSmrg
192441b2f0bdSmrg	    # A standard non-PIC object
192541b2f0bdSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
192641b2f0bdSmrg	    if test -z "$pic_object" || test "$pic_object" = none ; then
192741b2f0bdSmrg	      arg="$non_pic_object"
192841b2f0bdSmrg	    fi
192941b2f0bdSmrg	  else
193041b2f0bdSmrg	    # If the PIC object exists, use it instead.
193141b2f0bdSmrg	    # $xdir was prepended to $pic_object above.
193241b2f0bdSmrg	    non_pic_object="$pic_object"
193341b2f0bdSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
193441b2f0bdSmrg	  fi
193541b2f0bdSmrg	else
193641b2f0bdSmrg	  # Only an error if not doing a dry-run.
193741b2f0bdSmrg	  if test -z "$run"; then
193841b2f0bdSmrg	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
193941b2f0bdSmrg	    exit $EXIT_FAILURE
194041b2f0bdSmrg	  else
194141b2f0bdSmrg	    # Dry-run case.
194241b2f0bdSmrg
194341b2f0bdSmrg	    # Extract subdirectory from the argument.
194441b2f0bdSmrg	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
194541b2f0bdSmrg	    if test "X$xdir" = "X$arg"; then
194641b2f0bdSmrg	      xdir=
194741b2f0bdSmrg	    else
194841b2f0bdSmrg	      xdir="$xdir/"
194941b2f0bdSmrg	    fi
195041b2f0bdSmrg
195141b2f0bdSmrg	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
195241b2f0bdSmrg	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
195341b2f0bdSmrg	    libobjs="$libobjs $pic_object"
195441b2f0bdSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
195541b2f0bdSmrg	  fi
195641b2f0bdSmrg	fi
195741b2f0bdSmrg	;;
195841b2f0bdSmrg
195941b2f0bdSmrg      *.$libext)
196041b2f0bdSmrg	# An archive.
196141b2f0bdSmrg	deplibs="$deplibs $arg"
196241b2f0bdSmrg	old_deplibs="$old_deplibs $arg"
196341b2f0bdSmrg	continue
196441b2f0bdSmrg	;;
196541b2f0bdSmrg
196641b2f0bdSmrg      *.la)
196741b2f0bdSmrg	# A libtool-controlled library.
196841b2f0bdSmrg
196941b2f0bdSmrg	if test "$prev" = dlfiles; then
197041b2f0bdSmrg	  # This library was specified with -dlopen.
197141b2f0bdSmrg	  dlfiles="$dlfiles $arg"
197241b2f0bdSmrg	  prev=
197341b2f0bdSmrg	elif test "$prev" = dlprefiles; then
197441b2f0bdSmrg	  # The library was specified with -dlpreopen.
197541b2f0bdSmrg	  dlprefiles="$dlprefiles $arg"
197641b2f0bdSmrg	  prev=
197741b2f0bdSmrg	else
197841b2f0bdSmrg	  deplibs="$deplibs $arg"
197941b2f0bdSmrg	fi
198041b2f0bdSmrg	continue
198141b2f0bdSmrg	;;
198241b2f0bdSmrg
198341b2f0bdSmrg      # Some other compiler argument.
198441b2f0bdSmrg      *)
198541b2f0bdSmrg	# Unknown arguments in both finalize_command and compile_command need
198641b2f0bdSmrg	# to be aesthetically quoted because they are evaled later.
198741b2f0bdSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
198841b2f0bdSmrg	case $arg in
198941b2f0bdSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
199041b2f0bdSmrg	  arg="\"$arg\""
199141b2f0bdSmrg	  ;;
199241b2f0bdSmrg	esac
199341b2f0bdSmrg	;;
199441b2f0bdSmrg      esac # arg
199541b2f0bdSmrg
199641b2f0bdSmrg      # Now actually substitute the argument into the commands.
199741b2f0bdSmrg      if test -n "$arg"; then
199841b2f0bdSmrg	compile_command="$compile_command $arg"
199941b2f0bdSmrg	finalize_command="$finalize_command $arg"
200041b2f0bdSmrg      fi
200141b2f0bdSmrg    done # argument parsing loop
200241b2f0bdSmrg
200341b2f0bdSmrg    if test -n "$prev"; then
200441b2f0bdSmrg      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
200541b2f0bdSmrg      $echo "$help" 1>&2
200641b2f0bdSmrg      exit $EXIT_FAILURE
200741b2f0bdSmrg    fi
200841b2f0bdSmrg
200941b2f0bdSmrg    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
201041b2f0bdSmrg      eval arg=\"$export_dynamic_flag_spec\"
201141b2f0bdSmrg      compile_command="$compile_command $arg"
201241b2f0bdSmrg      finalize_command="$finalize_command $arg"
201341b2f0bdSmrg    fi
201441b2f0bdSmrg
201541b2f0bdSmrg    oldlibs=
201641b2f0bdSmrg    # calculate the name of the file, without its directory
201741b2f0bdSmrg    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
201841b2f0bdSmrg    libobjs_save="$libobjs"
201941b2f0bdSmrg
202041b2f0bdSmrg    if test -n "$shlibpath_var"; then
202141b2f0bdSmrg      # get the directories listed in $shlibpath_var
202241b2f0bdSmrg      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
202341b2f0bdSmrg    else
202441b2f0bdSmrg      shlib_search_path=
202541b2f0bdSmrg    fi
202641b2f0bdSmrg    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
202741b2f0bdSmrg    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
202841b2f0bdSmrg
202941b2f0bdSmrg    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
203041b2f0bdSmrg    if test "X$output_objdir" = "X$output"; then
203141b2f0bdSmrg      output_objdir="$objdir"
203241b2f0bdSmrg    else
203341b2f0bdSmrg      output_objdir="$output_objdir/$objdir"
203441b2f0bdSmrg    fi
203541b2f0bdSmrg    # Create the object directory.
203641b2f0bdSmrg    if test ! -d "$output_objdir"; then
203741b2f0bdSmrg      $show "$mkdir $output_objdir"
203841b2f0bdSmrg      $run $mkdir $output_objdir
203941b2f0bdSmrg      exit_status=$?
204041b2f0bdSmrg      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
204141b2f0bdSmrg	exit $exit_status
204241b2f0bdSmrg      fi
204341b2f0bdSmrg    fi
204441b2f0bdSmrg
204541b2f0bdSmrg    # Determine the type of output
204641b2f0bdSmrg    case $output in
204741b2f0bdSmrg    "")
204841b2f0bdSmrg      $echo "$modename: you must specify an output file" 1>&2
204941b2f0bdSmrg      $echo "$help" 1>&2
205041b2f0bdSmrg      exit $EXIT_FAILURE
205141b2f0bdSmrg      ;;
205241b2f0bdSmrg    *.$libext) linkmode=oldlib ;;
205341b2f0bdSmrg    *.lo | *.$objext) linkmode=obj ;;
205441b2f0bdSmrg    *.la) linkmode=lib ;;
205541b2f0bdSmrg    *) linkmode=prog ;; # Anything else should be a program.
205641b2f0bdSmrg    esac
205741b2f0bdSmrg
205841b2f0bdSmrg    case $host in
205941b2f0bdSmrg    *cygwin* | *mingw* | *pw32*)
206041b2f0bdSmrg      # don't eliminate duplications in $postdeps and $predeps
206141b2f0bdSmrg      duplicate_compiler_generated_deps=yes
206241b2f0bdSmrg      ;;
206341b2f0bdSmrg    *)
206441b2f0bdSmrg      duplicate_compiler_generated_deps=$duplicate_deps
206541b2f0bdSmrg      ;;
206641b2f0bdSmrg    esac
206741b2f0bdSmrg    specialdeplibs=
206841b2f0bdSmrg
206941b2f0bdSmrg    libs=
207041b2f0bdSmrg    # Find all interdependent deplibs by searching for libraries
207141b2f0bdSmrg    # that are linked more than once (e.g. -la -lb -la)
207241b2f0bdSmrg    for deplib in $deplibs; do
207341b2f0bdSmrg      if test "X$duplicate_deps" = "Xyes" ; then
207441b2f0bdSmrg	case "$libs " in
207541b2f0bdSmrg	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
207641b2f0bdSmrg	esac
207741b2f0bdSmrg      fi
207841b2f0bdSmrg      libs="$libs $deplib"
207941b2f0bdSmrg    done
208041b2f0bdSmrg
208141b2f0bdSmrg    if test "$linkmode" = lib; then
208241b2f0bdSmrg      libs="$predeps $libs $compiler_lib_search_path $postdeps"
208341b2f0bdSmrg
208441b2f0bdSmrg      # Compute libraries that are listed more than once in $predeps
208541b2f0bdSmrg      # $postdeps and mark them as special (i.e., whose duplicates are
208641b2f0bdSmrg      # not to be eliminated).
208741b2f0bdSmrg      pre_post_deps=
208841b2f0bdSmrg      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
208941b2f0bdSmrg	for pre_post_dep in $predeps $postdeps; do
209041b2f0bdSmrg	  case "$pre_post_deps " in
209141b2f0bdSmrg	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
209241b2f0bdSmrg	  esac
209341b2f0bdSmrg	  pre_post_deps="$pre_post_deps $pre_post_dep"
209441b2f0bdSmrg	done
209541b2f0bdSmrg      fi
209641b2f0bdSmrg      pre_post_deps=
209741b2f0bdSmrg    fi
209841b2f0bdSmrg
209941b2f0bdSmrg    deplibs=
210041b2f0bdSmrg    newdependency_libs=
210141b2f0bdSmrg    newlib_search_path=
210241b2f0bdSmrg    need_relink=no # whether we're linking any uninstalled libtool libraries
210341b2f0bdSmrg    notinst_deplibs= # not-installed libtool libraries
210441b2f0bdSmrg    case $linkmode in
210541b2f0bdSmrg    lib)
210641b2f0bdSmrg	passes="conv link"
210741b2f0bdSmrg	for file in $dlfiles $dlprefiles; do
210841b2f0bdSmrg	  case $file in
210941b2f0bdSmrg	  *.la) ;;
211041b2f0bdSmrg	  *)
211141b2f0bdSmrg	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
211241b2f0bdSmrg	    exit $EXIT_FAILURE
211341b2f0bdSmrg	    ;;
211441b2f0bdSmrg	  esac
211541b2f0bdSmrg	done
211641b2f0bdSmrg	;;
211741b2f0bdSmrg    prog)
211841b2f0bdSmrg	compile_deplibs=
211941b2f0bdSmrg	finalize_deplibs=
212041b2f0bdSmrg	alldeplibs=no
212141b2f0bdSmrg	newdlfiles=
212241b2f0bdSmrg	newdlprefiles=
212341b2f0bdSmrg	passes="conv scan dlopen dlpreopen link"
212441b2f0bdSmrg	;;
212541b2f0bdSmrg    *)  passes="conv"
212641b2f0bdSmrg	;;
212741b2f0bdSmrg    esac
212841b2f0bdSmrg    for pass in $passes; do
212941b2f0bdSmrg      if test "$linkmode,$pass" = "lib,link" ||
213041b2f0bdSmrg	 test "$linkmode,$pass" = "prog,scan"; then
213141b2f0bdSmrg	libs="$deplibs"
213241b2f0bdSmrg	deplibs=
213341b2f0bdSmrg      fi
213441b2f0bdSmrg      if test "$linkmode" = prog; then
213541b2f0bdSmrg	case $pass in
213641b2f0bdSmrg	dlopen) libs="$dlfiles" ;;
213741b2f0bdSmrg	dlpreopen) libs="$dlprefiles" ;;
213841b2f0bdSmrg	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
213941b2f0bdSmrg	esac
214041b2f0bdSmrg      fi
214141b2f0bdSmrg      if test "$pass" = dlopen; then
214241b2f0bdSmrg	# Collect dlpreopened libraries
214341b2f0bdSmrg	save_deplibs="$deplibs"
214441b2f0bdSmrg	deplibs=
214541b2f0bdSmrg      fi
214641b2f0bdSmrg      for deplib in $libs; do
214741b2f0bdSmrg	lib=
214841b2f0bdSmrg	found=no
214941b2f0bdSmrg	case $deplib in
215011245024Smrg	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
215141b2f0bdSmrg	  if test "$linkmode,$pass" = "prog,link"; then
215241b2f0bdSmrg	    compile_deplibs="$deplib $compile_deplibs"
215341b2f0bdSmrg	    finalize_deplibs="$deplib $finalize_deplibs"
215441b2f0bdSmrg	  else
215541b2f0bdSmrg	    compiler_flags="$compiler_flags $deplib"
215641b2f0bdSmrg	  fi
215741b2f0bdSmrg	  continue
215841b2f0bdSmrg	  ;;
215941b2f0bdSmrg	-l*)
216041b2f0bdSmrg	  if test "$linkmode" != lib && test "$linkmode" != prog; then
216141b2f0bdSmrg	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
216241b2f0bdSmrg	    continue
216341b2f0bdSmrg	  fi
216441b2f0bdSmrg	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
216511245024Smrg	  if test "$linkmode" = lib; then
216611245024Smrg	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
216711245024Smrg	  else
216811245024Smrg	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
216911245024Smrg	  fi
217011245024Smrg	  for searchdir in $searchdirs; do
217141b2f0bdSmrg	    for search_ext in .la $std_shrext .so .a; do
217241b2f0bdSmrg	      # Search the libtool library
217341b2f0bdSmrg	      lib="$searchdir/lib${name}${search_ext}"
217441b2f0bdSmrg	      if test -f "$lib"; then
217541b2f0bdSmrg		if test "$search_ext" = ".la"; then
217641b2f0bdSmrg		  found=yes
217741b2f0bdSmrg		else
217841b2f0bdSmrg		  found=no
217941b2f0bdSmrg		fi
218041b2f0bdSmrg		break 2
218141b2f0bdSmrg	      fi
218241b2f0bdSmrg	    done
218341b2f0bdSmrg	  done
218441b2f0bdSmrg	  if test "$found" != yes; then
218541b2f0bdSmrg	    # deplib doesn't seem to be a libtool library
218641b2f0bdSmrg	    if test "$linkmode,$pass" = "prog,link"; then
218741b2f0bdSmrg	      compile_deplibs="$deplib $compile_deplibs"
218841b2f0bdSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
218941b2f0bdSmrg	    else
219041b2f0bdSmrg	      deplibs="$deplib $deplibs"
219141b2f0bdSmrg	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
219241b2f0bdSmrg	    fi
219341b2f0bdSmrg	    continue
219441b2f0bdSmrg	  else # deplib is a libtool library
219541b2f0bdSmrg	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
219641b2f0bdSmrg	    # We need to do some special things here, and not later.
219741b2f0bdSmrg	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
219841b2f0bdSmrg	      case " $predeps $postdeps " in
219941b2f0bdSmrg	      *" $deplib "*)
220041b2f0bdSmrg		if (${SED} -e '2q' $lib |
220141b2f0bdSmrg                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
220241b2f0bdSmrg		  library_names=
220341b2f0bdSmrg		  old_library=
220441b2f0bdSmrg		  case $lib in
220541b2f0bdSmrg		  */* | *\\*) . $lib ;;
220641b2f0bdSmrg		  *) . ./$lib ;;
220741b2f0bdSmrg		  esac
220841b2f0bdSmrg		  for l in $old_library $library_names; do
220941b2f0bdSmrg		    ll="$l"
221041b2f0bdSmrg		  done
221141b2f0bdSmrg		  if test "X$ll" = "X$old_library" ; then # only static version available
221241b2f0bdSmrg		    found=no
221341b2f0bdSmrg		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
221441b2f0bdSmrg		    test "X$ladir" = "X$lib" && ladir="."
221541b2f0bdSmrg		    lib=$ladir/$old_library
221641b2f0bdSmrg		    if test "$linkmode,$pass" = "prog,link"; then
221741b2f0bdSmrg		      compile_deplibs="$deplib $compile_deplibs"
221841b2f0bdSmrg		      finalize_deplibs="$deplib $finalize_deplibs"
221941b2f0bdSmrg		    else
222041b2f0bdSmrg		      deplibs="$deplib $deplibs"
222141b2f0bdSmrg		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
222241b2f0bdSmrg		    fi
222341b2f0bdSmrg		    continue
222441b2f0bdSmrg		  fi
222541b2f0bdSmrg		fi
222641b2f0bdSmrg	        ;;
222741b2f0bdSmrg	      *) ;;
222841b2f0bdSmrg	      esac
222941b2f0bdSmrg	    fi
223041b2f0bdSmrg	  fi
223141b2f0bdSmrg	  ;; # -l
223241b2f0bdSmrg	-L*)
223341b2f0bdSmrg	  case $linkmode in
223441b2f0bdSmrg	  lib)
223541b2f0bdSmrg	    deplibs="$deplib $deplibs"
223641b2f0bdSmrg	    test "$pass" = conv && continue
223741b2f0bdSmrg	    newdependency_libs="$deplib $newdependency_libs"
223841b2f0bdSmrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
223941b2f0bdSmrg	    ;;
224041b2f0bdSmrg	  prog)
224141b2f0bdSmrg	    if test "$pass" = conv; then
224241b2f0bdSmrg	      deplibs="$deplib $deplibs"
224341b2f0bdSmrg	      continue
224441b2f0bdSmrg	    fi
224541b2f0bdSmrg	    if test "$pass" = scan; then
224641b2f0bdSmrg	      deplibs="$deplib $deplibs"
224741b2f0bdSmrg	    else
224841b2f0bdSmrg	      compile_deplibs="$deplib $compile_deplibs"
224941b2f0bdSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
225041b2f0bdSmrg	    fi
225141b2f0bdSmrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
225241b2f0bdSmrg	    ;;
225341b2f0bdSmrg	  *)
225441b2f0bdSmrg	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
225541b2f0bdSmrg	    ;;
225641b2f0bdSmrg	  esac # linkmode
225741b2f0bdSmrg	  continue
225841b2f0bdSmrg	  ;; # -L
225941b2f0bdSmrg	-R*)
226041b2f0bdSmrg	  if test "$pass" = link; then
226141b2f0bdSmrg	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
226241b2f0bdSmrg	    # Make sure the xrpath contains only unique directories.
226341b2f0bdSmrg	    case "$xrpath " in
226441b2f0bdSmrg	    *" $dir "*) ;;
226541b2f0bdSmrg	    *) xrpath="$xrpath $dir" ;;
226641b2f0bdSmrg	    esac
226741b2f0bdSmrg	  fi
226841b2f0bdSmrg	  deplibs="$deplib $deplibs"
226941b2f0bdSmrg	  continue
227041b2f0bdSmrg	  ;;
227141b2f0bdSmrg	*.la) lib="$deplib" ;;
227241b2f0bdSmrg	*.$libext)
227341b2f0bdSmrg	  if test "$pass" = conv; then
227441b2f0bdSmrg	    deplibs="$deplib $deplibs"
227541b2f0bdSmrg	    continue
227641b2f0bdSmrg	  fi
227741b2f0bdSmrg	  case $linkmode in
227841b2f0bdSmrg	  lib)
227941b2f0bdSmrg	    valid_a_lib=no
228041b2f0bdSmrg	    case $deplibs_check_method in
228141b2f0bdSmrg	      match_pattern*)
228241b2f0bdSmrg		set dummy $deplibs_check_method
228341b2f0bdSmrg	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
228441b2f0bdSmrg		if eval $echo \"$deplib\" 2>/dev/null \
228541b2f0bdSmrg		    | $SED 10q \
228641b2f0bdSmrg		    | $EGREP "$match_pattern_regex" > /dev/null; then
228741b2f0bdSmrg		  valid_a_lib=yes
228841b2f0bdSmrg		fi
228941b2f0bdSmrg		;;
229041b2f0bdSmrg	      pass_all)
229141b2f0bdSmrg		valid_a_lib=yes
229241b2f0bdSmrg		;;
229341b2f0bdSmrg            esac
229441b2f0bdSmrg	    if test "$valid_a_lib" != yes; then
229541b2f0bdSmrg	      $echo
229641b2f0bdSmrg	      $echo "*** Warning: Trying to link with static lib archive $deplib."
229741b2f0bdSmrg	      $echo "*** I have the capability to make that library automatically link in when"
229841b2f0bdSmrg	      $echo "*** you link to this library.  But I can only do this if you have a"
229941b2f0bdSmrg	      $echo "*** shared version of the library, which you do not appear to have"
230041b2f0bdSmrg	      $echo "*** because the file extensions .$libext of this argument makes me believe"
230141b2f0bdSmrg	      $echo "*** that it is just a static archive that I should not used here."
230241b2f0bdSmrg	    else
230341b2f0bdSmrg	      $echo
230441b2f0bdSmrg	      $echo "*** Warning: Linking the shared library $output against the"
230541b2f0bdSmrg	      $echo "*** static library $deplib is not portable!"
230641b2f0bdSmrg	      deplibs="$deplib $deplibs"
230741b2f0bdSmrg	    fi
230841b2f0bdSmrg	    continue
230941b2f0bdSmrg	    ;;
231041b2f0bdSmrg	  prog)
231141b2f0bdSmrg	    if test "$pass" != link; then
231241b2f0bdSmrg	      deplibs="$deplib $deplibs"
231341b2f0bdSmrg	    else
231441b2f0bdSmrg	      compile_deplibs="$deplib $compile_deplibs"
231541b2f0bdSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
231641b2f0bdSmrg	    fi
231741b2f0bdSmrg	    continue
231841b2f0bdSmrg	    ;;
231941b2f0bdSmrg	  esac # linkmode
232041b2f0bdSmrg	  ;; # *.$libext
232141b2f0bdSmrg	*.lo | *.$objext)
232241b2f0bdSmrg	  if test "$pass" = conv; then
232341b2f0bdSmrg	    deplibs="$deplib $deplibs"
232441b2f0bdSmrg	  elif test "$linkmode" = prog; then
232541b2f0bdSmrg	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
232641b2f0bdSmrg	      # If there is no dlopen support or we're linking statically,
232741b2f0bdSmrg	      # we need to preload.
232841b2f0bdSmrg	      newdlprefiles="$newdlprefiles $deplib"
232941b2f0bdSmrg	      compile_deplibs="$deplib $compile_deplibs"
233041b2f0bdSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
233141b2f0bdSmrg	    else
233241b2f0bdSmrg	      newdlfiles="$newdlfiles $deplib"
233341b2f0bdSmrg	    fi
233441b2f0bdSmrg	  fi
233541b2f0bdSmrg	  continue
233641b2f0bdSmrg	  ;;
233741b2f0bdSmrg	%DEPLIBS%)
233841b2f0bdSmrg	  alldeplibs=yes
233941b2f0bdSmrg	  continue
234041b2f0bdSmrg	  ;;
234141b2f0bdSmrg	esac # case $deplib
234241b2f0bdSmrg	if test "$found" = yes || test -f "$lib"; then :
234341b2f0bdSmrg	else
234441b2f0bdSmrg	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
234541b2f0bdSmrg	  exit $EXIT_FAILURE
234641b2f0bdSmrg	fi
234741b2f0bdSmrg
234841b2f0bdSmrg	# Check to see that this really is a libtool archive.
234941b2f0bdSmrg	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
235041b2f0bdSmrg	else
235141b2f0bdSmrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
235241b2f0bdSmrg	  exit $EXIT_FAILURE
235341b2f0bdSmrg	fi
235441b2f0bdSmrg
235541b2f0bdSmrg	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
235641b2f0bdSmrg	test "X$ladir" = "X$lib" && ladir="."
235741b2f0bdSmrg
235841b2f0bdSmrg	dlname=
235941b2f0bdSmrg	dlopen=
236041b2f0bdSmrg	dlpreopen=
236141b2f0bdSmrg	libdir=
236241b2f0bdSmrg	library_names=
236341b2f0bdSmrg	old_library=
236441b2f0bdSmrg	# If the library was installed with an old release of libtool,
236541b2f0bdSmrg	# it will not redefine variables installed, or shouldnotlink
236641b2f0bdSmrg	installed=yes
236741b2f0bdSmrg	shouldnotlink=no
236841b2f0bdSmrg	avoidtemprpath=
236941b2f0bdSmrg
237041b2f0bdSmrg
237141b2f0bdSmrg	# Read the .la file
237241b2f0bdSmrg	case $lib in
237341b2f0bdSmrg	*/* | *\\*) . $lib ;;
237441b2f0bdSmrg	*) . ./$lib ;;
237541b2f0bdSmrg	esac
237641b2f0bdSmrg
237741b2f0bdSmrg	if test "$linkmode,$pass" = "lib,link" ||
237841b2f0bdSmrg	   test "$linkmode,$pass" = "prog,scan" ||
237941b2f0bdSmrg	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
238041b2f0bdSmrg	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
238141b2f0bdSmrg	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
238241b2f0bdSmrg	fi
238341b2f0bdSmrg
238441b2f0bdSmrg	if test "$pass" = conv; then
238541b2f0bdSmrg	  # Only check for convenience libraries
238641b2f0bdSmrg	  deplibs="$lib $deplibs"
238741b2f0bdSmrg	  if test -z "$libdir"; then
238841b2f0bdSmrg	    if test -z "$old_library"; then
238941b2f0bdSmrg	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
239041b2f0bdSmrg	      exit $EXIT_FAILURE
239141b2f0bdSmrg	    fi
239241b2f0bdSmrg	    # It is a libtool convenience library, so add in its objects.
239341b2f0bdSmrg	    convenience="$convenience $ladir/$objdir/$old_library"
239441b2f0bdSmrg	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
239541b2f0bdSmrg	    tmp_libs=
239641b2f0bdSmrg	    for deplib in $dependency_libs; do
239741b2f0bdSmrg	      deplibs="$deplib $deplibs"
239841b2f0bdSmrg              if test "X$duplicate_deps" = "Xyes" ; then
239941b2f0bdSmrg	        case "$tmp_libs " in
240041b2f0bdSmrg	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
240141b2f0bdSmrg	        esac
240241b2f0bdSmrg              fi
240341b2f0bdSmrg	      tmp_libs="$tmp_libs $deplib"
240441b2f0bdSmrg	    done
240541b2f0bdSmrg	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
240641b2f0bdSmrg	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
240741b2f0bdSmrg	    exit $EXIT_FAILURE
240841b2f0bdSmrg	  fi
240941b2f0bdSmrg	  continue
241041b2f0bdSmrg	fi # $pass = conv
241141b2f0bdSmrg
241241b2f0bdSmrg
241341b2f0bdSmrg	# Get the name of the library we link against.
241441b2f0bdSmrg	linklib=
241541b2f0bdSmrg	for l in $old_library $library_names; do
241641b2f0bdSmrg	  linklib="$l"
241741b2f0bdSmrg	done
241841b2f0bdSmrg	if test -z "$linklib"; then
241941b2f0bdSmrg	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
242041b2f0bdSmrg	  exit $EXIT_FAILURE
242141b2f0bdSmrg	fi
242241b2f0bdSmrg
242341b2f0bdSmrg	# This library was specified with -dlopen.
242441b2f0bdSmrg	if test "$pass" = dlopen; then
242541b2f0bdSmrg	  if test -z "$libdir"; then
242641b2f0bdSmrg	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
242741b2f0bdSmrg	    exit $EXIT_FAILURE
242841b2f0bdSmrg	  fi
242941b2f0bdSmrg	  if test -z "$dlname" ||
243041b2f0bdSmrg	     test "$dlopen_support" != yes ||
243141b2f0bdSmrg	     test "$build_libtool_libs" = no; then
243241b2f0bdSmrg	    # If there is no dlname, no dlopen support or we're linking
243341b2f0bdSmrg	    # statically, we need to preload.  We also need to preload any
243441b2f0bdSmrg	    # dependent libraries so libltdl's deplib preloader doesn't
243541b2f0bdSmrg	    # bomb out in the load deplibs phase.
243641b2f0bdSmrg	    dlprefiles="$dlprefiles $lib $dependency_libs"
243741b2f0bdSmrg	  else
243841b2f0bdSmrg	    newdlfiles="$newdlfiles $lib"
243941b2f0bdSmrg	  fi
244041b2f0bdSmrg	  continue
244141b2f0bdSmrg	fi # $pass = dlopen
244241b2f0bdSmrg
244341b2f0bdSmrg	# We need an absolute path.
244441b2f0bdSmrg	case $ladir in
244541b2f0bdSmrg	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
244641b2f0bdSmrg	*)
244741b2f0bdSmrg	  abs_ladir=`cd "$ladir" && pwd`
244841b2f0bdSmrg	  if test -z "$abs_ladir"; then
244941b2f0bdSmrg	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
245041b2f0bdSmrg	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
245141b2f0bdSmrg	    abs_ladir="$ladir"
245241b2f0bdSmrg	  fi
245341b2f0bdSmrg	  ;;
245441b2f0bdSmrg	esac
245541b2f0bdSmrg	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
245641b2f0bdSmrg
245741b2f0bdSmrg	# Find the relevant object directory and library name.
245841b2f0bdSmrg	if test "X$installed" = Xyes; then
245941b2f0bdSmrg	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
246041b2f0bdSmrg	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
246141b2f0bdSmrg	    dir="$ladir"
246241b2f0bdSmrg	    absdir="$abs_ladir"
246341b2f0bdSmrg	    libdir="$abs_ladir"
246441b2f0bdSmrg	  else
246541b2f0bdSmrg	    dir="$libdir"
246641b2f0bdSmrg	    absdir="$libdir"
246741b2f0bdSmrg	  fi
246841b2f0bdSmrg	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
246941b2f0bdSmrg	else
247041b2f0bdSmrg	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
247141b2f0bdSmrg	    dir="$ladir"
247241b2f0bdSmrg	    absdir="$abs_ladir"
247341b2f0bdSmrg	    # Remove this search path later
247441b2f0bdSmrg	    notinst_path="$notinst_path $abs_ladir"
247541b2f0bdSmrg	  else
247641b2f0bdSmrg	    dir="$ladir/$objdir"
247741b2f0bdSmrg	    absdir="$abs_ladir/$objdir"
247841b2f0bdSmrg	    # Remove this search path later
247941b2f0bdSmrg	    notinst_path="$notinst_path $abs_ladir"
248041b2f0bdSmrg	  fi
248141b2f0bdSmrg	fi # $installed = yes
248241b2f0bdSmrg	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
248341b2f0bdSmrg
248441b2f0bdSmrg	# This library was specified with -dlpreopen.
248541b2f0bdSmrg	if test "$pass" = dlpreopen; then
248641b2f0bdSmrg	  if test -z "$libdir"; then
248741b2f0bdSmrg	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
248841b2f0bdSmrg	    exit $EXIT_FAILURE
248941b2f0bdSmrg	  fi
249041b2f0bdSmrg	  # Prefer using a static library (so that no silly _DYNAMIC symbols
249141b2f0bdSmrg	  # are required to link).
249241b2f0bdSmrg	  if test -n "$old_library"; then
249341b2f0bdSmrg	    newdlprefiles="$newdlprefiles $dir/$old_library"
249441b2f0bdSmrg	  # Otherwise, use the dlname, so that lt_dlopen finds it.
249541b2f0bdSmrg	  elif test -n "$dlname"; then
249641b2f0bdSmrg	    newdlprefiles="$newdlprefiles $dir/$dlname"
249741b2f0bdSmrg	  else
249841b2f0bdSmrg	    newdlprefiles="$newdlprefiles $dir/$linklib"
249941b2f0bdSmrg	  fi
250041b2f0bdSmrg	fi # $pass = dlpreopen
250141b2f0bdSmrg
250241b2f0bdSmrg	if test -z "$libdir"; then
250341b2f0bdSmrg	  # Link the convenience library
250441b2f0bdSmrg	  if test "$linkmode" = lib; then
250541b2f0bdSmrg	    deplibs="$dir/$old_library $deplibs"
250641b2f0bdSmrg	  elif test "$linkmode,$pass" = "prog,link"; then
250741b2f0bdSmrg	    compile_deplibs="$dir/$old_library $compile_deplibs"
250841b2f0bdSmrg	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
250941b2f0bdSmrg	  else
251041b2f0bdSmrg	    deplibs="$lib $deplibs" # used for prog,scan pass
251141b2f0bdSmrg	  fi
251241b2f0bdSmrg	  continue
251341b2f0bdSmrg	fi
251441b2f0bdSmrg
251541b2f0bdSmrg
251641b2f0bdSmrg	if test "$linkmode" = prog && test "$pass" != link; then
251741b2f0bdSmrg	  newlib_search_path="$newlib_search_path $ladir"
251841b2f0bdSmrg	  deplibs="$lib $deplibs"
251941b2f0bdSmrg
252041b2f0bdSmrg	  linkalldeplibs=no
252141b2f0bdSmrg	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
252241b2f0bdSmrg	     test "$build_libtool_libs" = no; then
252341b2f0bdSmrg	    linkalldeplibs=yes
252441b2f0bdSmrg	  fi
252541b2f0bdSmrg
252641b2f0bdSmrg	  tmp_libs=
252741b2f0bdSmrg	  for deplib in $dependency_libs; do
252841b2f0bdSmrg	    case $deplib in
252941b2f0bdSmrg	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
253041b2f0bdSmrg	    esac
253141b2f0bdSmrg	    # Need to link against all dependency_libs?
253241b2f0bdSmrg	    if test "$linkalldeplibs" = yes; then
253341b2f0bdSmrg	      deplibs="$deplib $deplibs"
253441b2f0bdSmrg	    else
253541b2f0bdSmrg	      # Need to hardcode shared library paths
253641b2f0bdSmrg	      # or/and link against static libraries
253741b2f0bdSmrg	      newdependency_libs="$deplib $newdependency_libs"
253841b2f0bdSmrg	    fi
253941b2f0bdSmrg	    if test "X$duplicate_deps" = "Xyes" ; then
254041b2f0bdSmrg	      case "$tmp_libs " in
254141b2f0bdSmrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
254241b2f0bdSmrg	      esac
254341b2f0bdSmrg	    fi
254441b2f0bdSmrg	    tmp_libs="$tmp_libs $deplib"
254541b2f0bdSmrg	  done # for deplib
254641b2f0bdSmrg	  continue
254741b2f0bdSmrg	fi # $linkmode = prog...
254841b2f0bdSmrg
254941b2f0bdSmrg	if test "$linkmode,$pass" = "prog,link"; then
255041b2f0bdSmrg	  if test -n "$library_names" &&
255111245024Smrg	     { { test "$prefer_static_libs" = no ||
255211245024Smrg		 test "$prefer_static_libs,$installed" = "built,yes"; } ||
255311245024Smrg	       test -z "$old_library"; }; then
255441b2f0bdSmrg	    # We need to hardcode the library path
255541b2f0bdSmrg	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
255641b2f0bdSmrg	      # Make sure the rpath contains only unique directories.
255741b2f0bdSmrg	      case "$temp_rpath " in
255841b2f0bdSmrg	      *" $dir "*) ;;
255941b2f0bdSmrg	      *" $absdir "*) ;;
256041b2f0bdSmrg	      *) temp_rpath="$temp_rpath $absdir" ;;
256141b2f0bdSmrg	      esac
256241b2f0bdSmrg	    fi
256341b2f0bdSmrg
256441b2f0bdSmrg	    # Hardcode the library path.
256541b2f0bdSmrg	    # Skip directories that are in the system default run-time
256641b2f0bdSmrg	    # search path.
256741b2f0bdSmrg	    case " $sys_lib_dlsearch_path " in
256841b2f0bdSmrg	    *" $absdir "*) ;;
256941b2f0bdSmrg	    *)
257041b2f0bdSmrg	      case "$compile_rpath " in
257141b2f0bdSmrg	      *" $absdir "*) ;;
257241b2f0bdSmrg	      *) compile_rpath="$compile_rpath $absdir"
257341b2f0bdSmrg	      esac
257441b2f0bdSmrg	      ;;
257541b2f0bdSmrg	    esac
257641b2f0bdSmrg	    case " $sys_lib_dlsearch_path " in
257741b2f0bdSmrg	    *" $libdir "*) ;;
257841b2f0bdSmrg	    *)
257941b2f0bdSmrg	      case "$finalize_rpath " in
258041b2f0bdSmrg	      *" $libdir "*) ;;
258141b2f0bdSmrg	      *) finalize_rpath="$finalize_rpath $libdir"
258241b2f0bdSmrg	      esac
258341b2f0bdSmrg	      ;;
258441b2f0bdSmrg	    esac
258541b2f0bdSmrg	  fi # $linkmode,$pass = prog,link...
258641b2f0bdSmrg
258741b2f0bdSmrg	  if test "$alldeplibs" = yes &&
258841b2f0bdSmrg	     { test "$deplibs_check_method" = pass_all ||
258941b2f0bdSmrg	       { test "$build_libtool_libs" = yes &&
259041b2f0bdSmrg		 test -n "$library_names"; }; }; then
259141b2f0bdSmrg	    # We only need to search for static libraries
259241b2f0bdSmrg	    continue
259341b2f0bdSmrg	  fi
259441b2f0bdSmrg	fi
259541b2f0bdSmrg
259641b2f0bdSmrg	link_static=no # Whether the deplib will be linked statically
259741b2f0bdSmrg	use_static_libs=$prefer_static_libs
259841b2f0bdSmrg	if test "$use_static_libs" = built && test "$installed" = yes ; then
259941b2f0bdSmrg	  use_static_libs=no
260041b2f0bdSmrg	fi
260141b2f0bdSmrg	if test -n "$library_names" &&
260241b2f0bdSmrg	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
260341b2f0bdSmrg	  if test "$installed" = no; then
260441b2f0bdSmrg	    notinst_deplibs="$notinst_deplibs $lib"
260541b2f0bdSmrg	    need_relink=yes
260641b2f0bdSmrg	  fi
260741b2f0bdSmrg	  # This is a shared library
260841b2f0bdSmrg
260941b2f0bdSmrg	  # Warn about portability, can't link against -module's on
261041b2f0bdSmrg	  # some systems (darwin)
261141b2f0bdSmrg	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
261241b2f0bdSmrg	    $echo
261341b2f0bdSmrg	    if test "$linkmode" = prog; then
261441b2f0bdSmrg	      $echo "*** Warning: Linking the executable $output against the loadable module"
261541b2f0bdSmrg	    else
261641b2f0bdSmrg	      $echo "*** Warning: Linking the shared library $output against the loadable module"
261741b2f0bdSmrg	    fi
261841b2f0bdSmrg	    $echo "*** $linklib is not portable!"
261941b2f0bdSmrg	  fi
262041b2f0bdSmrg	  if test "$linkmode" = lib &&
262141b2f0bdSmrg	     test "$hardcode_into_libs" = yes; then
262241b2f0bdSmrg	    # Hardcode the library path.
262341b2f0bdSmrg	    # Skip directories that are in the system default run-time
262441b2f0bdSmrg	    # search path.
262541b2f0bdSmrg	    case " $sys_lib_dlsearch_path " in
262641b2f0bdSmrg	    *" $absdir "*) ;;
262741b2f0bdSmrg	    *)
262841b2f0bdSmrg	      case "$compile_rpath " in
262941b2f0bdSmrg	      *" $absdir "*) ;;
263041b2f0bdSmrg	      *) compile_rpath="$compile_rpath $absdir"
263141b2f0bdSmrg	      esac
263241b2f0bdSmrg	      ;;
263341b2f0bdSmrg	    esac
263441b2f0bdSmrg	    case " $sys_lib_dlsearch_path " in
263541b2f0bdSmrg	    *" $libdir "*) ;;
263641b2f0bdSmrg	    *)
263741b2f0bdSmrg	      case "$finalize_rpath " in
263841b2f0bdSmrg	      *" $libdir "*) ;;
263941b2f0bdSmrg	      *) finalize_rpath="$finalize_rpath $libdir"
264041b2f0bdSmrg	      esac
264141b2f0bdSmrg	      ;;
264241b2f0bdSmrg	    esac
264341b2f0bdSmrg	  fi
264441b2f0bdSmrg
264541b2f0bdSmrg	  if test -n "$old_archive_from_expsyms_cmds"; then
264641b2f0bdSmrg	    # figure out the soname
264741b2f0bdSmrg	    set dummy $library_names
264841b2f0bdSmrg	    realname="$2"
264941b2f0bdSmrg	    shift; shift
265041b2f0bdSmrg	    libname=`eval \\$echo \"$libname_spec\"`
265141b2f0bdSmrg	    # use dlname if we got it. it's perfectly good, no?
265241b2f0bdSmrg	    if test -n "$dlname"; then
265341b2f0bdSmrg	      soname="$dlname"
265441b2f0bdSmrg	    elif test -n "$soname_spec"; then
265541b2f0bdSmrg	      # bleh windows
265641b2f0bdSmrg	      case $host in
265741b2f0bdSmrg	      *cygwin* | mingw*)
265841b2f0bdSmrg		major=`expr $current - $age`
265941b2f0bdSmrg		versuffix="-$major"
266041b2f0bdSmrg		;;
266141b2f0bdSmrg	      esac
266241b2f0bdSmrg	      eval soname=\"$soname_spec\"
266341b2f0bdSmrg	    else
266441b2f0bdSmrg	      soname="$realname"
266541b2f0bdSmrg	    fi
266641b2f0bdSmrg
266741b2f0bdSmrg	    # Make a new name for the extract_expsyms_cmds to use
266841b2f0bdSmrg	    soroot="$soname"
266941b2f0bdSmrg	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
267041b2f0bdSmrg	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
267141b2f0bdSmrg
267241b2f0bdSmrg	    # If the library has no export list, then create one now
267341b2f0bdSmrg	    if test -f "$output_objdir/$soname-def"; then :
267441b2f0bdSmrg	    else
267541b2f0bdSmrg	      $show "extracting exported symbol list from \`$soname'"
267641b2f0bdSmrg	      save_ifs="$IFS"; IFS='~'
267741b2f0bdSmrg	      cmds=$extract_expsyms_cmds
267841b2f0bdSmrg	      for cmd in $cmds; do
267941b2f0bdSmrg		IFS="$save_ifs"
268041b2f0bdSmrg		eval cmd=\"$cmd\"
268141b2f0bdSmrg		$show "$cmd"
268241b2f0bdSmrg		$run eval "$cmd" || exit $?
268341b2f0bdSmrg	      done
268441b2f0bdSmrg	      IFS="$save_ifs"
268541b2f0bdSmrg	    fi
268641b2f0bdSmrg
268741b2f0bdSmrg	    # Create $newlib
268841b2f0bdSmrg	    if test -f "$output_objdir/$newlib"; then :; else
268941b2f0bdSmrg	      $show "generating import library for \`$soname'"
269041b2f0bdSmrg	      save_ifs="$IFS"; IFS='~'
269141b2f0bdSmrg	      cmds=$old_archive_from_expsyms_cmds
269241b2f0bdSmrg	      for cmd in $cmds; do
269341b2f0bdSmrg		IFS="$save_ifs"
269441b2f0bdSmrg		eval cmd=\"$cmd\"
269541b2f0bdSmrg		$show "$cmd"
269641b2f0bdSmrg		$run eval "$cmd" || exit $?
269741b2f0bdSmrg	      done
269841b2f0bdSmrg	      IFS="$save_ifs"
269941b2f0bdSmrg	    fi
270041b2f0bdSmrg	    # make sure the library variables are pointing to the new library
270141b2f0bdSmrg	    dir=$output_objdir
270241b2f0bdSmrg	    linklib=$newlib
270341b2f0bdSmrg	  fi # test -n "$old_archive_from_expsyms_cmds"
270441b2f0bdSmrg
270541b2f0bdSmrg	  if test "$linkmode" = prog || test "$mode" != relink; then
270641b2f0bdSmrg	    add_shlibpath=
270741b2f0bdSmrg	    add_dir=
270841b2f0bdSmrg	    add=
270941b2f0bdSmrg	    lib_linked=yes
271041b2f0bdSmrg	    case $hardcode_action in
271141b2f0bdSmrg	    immediate | unsupported)
271241b2f0bdSmrg	      if test "$hardcode_direct" = no; then
271341b2f0bdSmrg		add="$dir/$linklib"
271441b2f0bdSmrg		case $host in
271541b2f0bdSmrg		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
271641b2f0bdSmrg		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
271741b2f0bdSmrg		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
271841b2f0bdSmrg		    *-*-unixware7*) add_dir="-L$dir" ;;
271941b2f0bdSmrg		  *-*-darwin* )
272041b2f0bdSmrg		    # if the lib is a module then we can not link against
272141b2f0bdSmrg		    # it, someone is ignoring the new warnings I added
272241b2f0bdSmrg		    if /usr/bin/file -L $add 2> /dev/null |
272341b2f0bdSmrg                      $EGREP ": [^:]* bundle" >/dev/null ; then
272441b2f0bdSmrg		      $echo "** Warning, lib $linklib is a module, not a shared library"
272541b2f0bdSmrg		      if test -z "$old_library" ; then
272641b2f0bdSmrg		        $echo
272741b2f0bdSmrg		        $echo "** And there doesn't seem to be a static archive available"
272841b2f0bdSmrg		        $echo "** The link will probably fail, sorry"
272941b2f0bdSmrg		      else
273041b2f0bdSmrg		        add="$dir/$old_library"
273141b2f0bdSmrg		      fi
273241b2f0bdSmrg		    fi
273341b2f0bdSmrg		esac
273441b2f0bdSmrg	      elif test "$hardcode_minus_L" = no; then
273541b2f0bdSmrg		case $host in
273641b2f0bdSmrg		*-*-sunos*) add_shlibpath="$dir" ;;
273741b2f0bdSmrg		esac
273841b2f0bdSmrg		add_dir="-L$dir"
273941b2f0bdSmrg		add="-l$name"
274041b2f0bdSmrg	      elif test "$hardcode_shlibpath_var" = no; then
274141b2f0bdSmrg		add_shlibpath="$dir"
274241b2f0bdSmrg		add="-l$name"
274341b2f0bdSmrg	      else
274441b2f0bdSmrg		lib_linked=no
274541b2f0bdSmrg	      fi
274641b2f0bdSmrg	      ;;
274741b2f0bdSmrg	    relink)
274841b2f0bdSmrg	      if test "$hardcode_direct" = yes; then
274941b2f0bdSmrg		add="$dir/$linklib"
275041b2f0bdSmrg	      elif test "$hardcode_minus_L" = yes; then
275141b2f0bdSmrg		add_dir="-L$dir"
275241b2f0bdSmrg		# Try looking first in the location we're being installed to.
275341b2f0bdSmrg		if test -n "$inst_prefix_dir"; then
275441b2f0bdSmrg		  case $libdir in
275541b2f0bdSmrg		    [\\/]*)
275641b2f0bdSmrg		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
275741b2f0bdSmrg		      ;;
275841b2f0bdSmrg		  esac
275941b2f0bdSmrg		fi
276041b2f0bdSmrg		add="-l$name"
276141b2f0bdSmrg	      elif test "$hardcode_shlibpath_var" = yes; then
276241b2f0bdSmrg		add_shlibpath="$dir"
276341b2f0bdSmrg		add="-l$name"
276441b2f0bdSmrg	      else
276541b2f0bdSmrg		lib_linked=no
276641b2f0bdSmrg	      fi
276741b2f0bdSmrg	      ;;
276841b2f0bdSmrg	    *) lib_linked=no ;;
276941b2f0bdSmrg	    esac
277041b2f0bdSmrg
277141b2f0bdSmrg	    if test "$lib_linked" != yes; then
277241b2f0bdSmrg	      $echo "$modename: configuration error: unsupported hardcode properties"
277341b2f0bdSmrg	      exit $EXIT_FAILURE
277441b2f0bdSmrg	    fi
277541b2f0bdSmrg
277641b2f0bdSmrg	    if test -n "$add_shlibpath"; then
277741b2f0bdSmrg	      case :$compile_shlibpath: in
277841b2f0bdSmrg	      *":$add_shlibpath:"*) ;;
277941b2f0bdSmrg	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
278041b2f0bdSmrg	      esac
278141b2f0bdSmrg	    fi
278241b2f0bdSmrg	    if test "$linkmode" = prog; then
278341b2f0bdSmrg	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
278441b2f0bdSmrg	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
278541b2f0bdSmrg	    else
278641b2f0bdSmrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
278741b2f0bdSmrg	      test -n "$add" && deplibs="$add $deplibs"
278841b2f0bdSmrg	      if test "$hardcode_direct" != yes && \
278941b2f0bdSmrg		 test "$hardcode_minus_L" != yes && \
279041b2f0bdSmrg		 test "$hardcode_shlibpath_var" = yes; then
279141b2f0bdSmrg		case :$finalize_shlibpath: in
279241b2f0bdSmrg		*":$libdir:"*) ;;
279341b2f0bdSmrg		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
279441b2f0bdSmrg		esac
279541b2f0bdSmrg	      fi
279641b2f0bdSmrg	    fi
279741b2f0bdSmrg	  fi
279841b2f0bdSmrg
279941b2f0bdSmrg	  if test "$linkmode" = prog || test "$mode" = relink; then
280041b2f0bdSmrg	    add_shlibpath=
280141b2f0bdSmrg	    add_dir=
280241b2f0bdSmrg	    add=
280341b2f0bdSmrg	    # Finalize command for both is simple: just hardcode it.
280441b2f0bdSmrg	    if test "$hardcode_direct" = yes; then
280541b2f0bdSmrg	      add="$libdir/$linklib"
280641b2f0bdSmrg	    elif test "$hardcode_minus_L" = yes; then
280741b2f0bdSmrg	      add_dir="-L$libdir"
280841b2f0bdSmrg	      add="-l$name"
280941b2f0bdSmrg	    elif test "$hardcode_shlibpath_var" = yes; then
281041b2f0bdSmrg	      case :$finalize_shlibpath: in
281141b2f0bdSmrg	      *":$libdir:"*) ;;
281241b2f0bdSmrg	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
281341b2f0bdSmrg	      esac
281441b2f0bdSmrg	      add="-l$name"
281541b2f0bdSmrg	    elif test "$hardcode_automatic" = yes; then
281641b2f0bdSmrg	      if test -n "$inst_prefix_dir" &&
281741b2f0bdSmrg		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
281841b2f0bdSmrg	        add="$inst_prefix_dir$libdir/$linklib"
281941b2f0bdSmrg	      else
282041b2f0bdSmrg	        add="$libdir/$linklib"
282141b2f0bdSmrg	      fi
282241b2f0bdSmrg	    else
282341b2f0bdSmrg	      # We cannot seem to hardcode it, guess we'll fake it.
282441b2f0bdSmrg	      add_dir="-L$libdir"
282541b2f0bdSmrg	      # Try looking first in the location we're being installed to.
282641b2f0bdSmrg	      if test -n "$inst_prefix_dir"; then
282741b2f0bdSmrg		case $libdir in
282841b2f0bdSmrg		  [\\/]*)
282941b2f0bdSmrg		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
283041b2f0bdSmrg		    ;;
283141b2f0bdSmrg		esac
283241b2f0bdSmrg	      fi
283341b2f0bdSmrg	      add="-l$name"
283441b2f0bdSmrg	    fi
283541b2f0bdSmrg
283641b2f0bdSmrg	    if test "$linkmode" = prog; then
283741b2f0bdSmrg	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
283841b2f0bdSmrg	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
283941b2f0bdSmrg	    else
284041b2f0bdSmrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
284141b2f0bdSmrg	      test -n "$add" && deplibs="$add $deplibs"
284241b2f0bdSmrg	    fi
284341b2f0bdSmrg	  fi
284441b2f0bdSmrg	elif test "$linkmode" = prog; then
284541b2f0bdSmrg	  # Here we assume that one of hardcode_direct or hardcode_minus_L
284641b2f0bdSmrg	  # is not unsupported.  This is valid on all known static and
284741b2f0bdSmrg	  # shared platforms.
284841b2f0bdSmrg	  if test "$hardcode_direct" != unsupported; then
284941b2f0bdSmrg	    test -n "$old_library" && linklib="$old_library"
285041b2f0bdSmrg	    compile_deplibs="$dir/$linklib $compile_deplibs"
285141b2f0bdSmrg	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
285241b2f0bdSmrg	  else
285341b2f0bdSmrg	    compile_deplibs="-l$name -L$dir $compile_deplibs"
285441b2f0bdSmrg	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
285541b2f0bdSmrg	  fi
285641b2f0bdSmrg	elif test "$build_libtool_libs" = yes; then
285741b2f0bdSmrg	  # Not a shared library
285841b2f0bdSmrg	  if test "$deplibs_check_method" != pass_all; then
285941b2f0bdSmrg	    # We're trying link a shared library against a static one
286041b2f0bdSmrg	    # but the system doesn't support it.
286141b2f0bdSmrg
286241b2f0bdSmrg	    # Just print a warning and add the library to dependency_libs so
286341b2f0bdSmrg	    # that the program can be linked against the static library.
286441b2f0bdSmrg	    $echo
286541b2f0bdSmrg	    $echo "*** Warning: This system can not link to static lib archive $lib."
286641b2f0bdSmrg	    $echo "*** I have the capability to make that library automatically link in when"
286741b2f0bdSmrg	    $echo "*** you link to this library.  But I can only do this if you have a"
286841b2f0bdSmrg	    $echo "*** shared version of the library, which you do not appear to have."
286941b2f0bdSmrg	    if test "$module" = yes; then
287041b2f0bdSmrg	      $echo "*** But as you try to build a module library, libtool will still create "
287141b2f0bdSmrg	      $echo "*** a static module, that should work as long as the dlopening application"
287241b2f0bdSmrg	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
287341b2f0bdSmrg	      if test -z "$global_symbol_pipe"; then
287441b2f0bdSmrg		$echo
287541b2f0bdSmrg		$echo "*** However, this would only work if libtool was able to extract symbol"
287641b2f0bdSmrg		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
287741b2f0bdSmrg		$echo "*** not find such a program.  So, this module is probably useless."
287841b2f0bdSmrg		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
287941b2f0bdSmrg	      fi
288041b2f0bdSmrg	      if test "$build_old_libs" = no; then
288141b2f0bdSmrg		build_libtool_libs=module
288241b2f0bdSmrg		build_old_libs=yes
288341b2f0bdSmrg	      else
288441b2f0bdSmrg		build_libtool_libs=no
288541b2f0bdSmrg	      fi
288641b2f0bdSmrg	    fi
288741b2f0bdSmrg	  else
288841b2f0bdSmrg	    deplibs="$dir/$old_library $deplibs"
288941b2f0bdSmrg	    link_static=yes
289041b2f0bdSmrg	  fi
289141b2f0bdSmrg	fi # link shared/static library?
289241b2f0bdSmrg
289341b2f0bdSmrg	if test "$linkmode" = lib; then
289441b2f0bdSmrg	  if test -n "$dependency_libs" &&
289541b2f0bdSmrg	     { test "$hardcode_into_libs" != yes ||
289641b2f0bdSmrg	       test "$build_old_libs" = yes ||
289741b2f0bdSmrg	       test "$link_static" = yes; }; then
289841b2f0bdSmrg	    # Extract -R from dependency_libs
289941b2f0bdSmrg	    temp_deplibs=
290041b2f0bdSmrg	    for libdir in $dependency_libs; do
290141b2f0bdSmrg	      case $libdir in
290241b2f0bdSmrg	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
290341b2f0bdSmrg		   case " $xrpath " in
290441b2f0bdSmrg		   *" $temp_xrpath "*) ;;
290541b2f0bdSmrg		   *) xrpath="$xrpath $temp_xrpath";;
290641b2f0bdSmrg		   esac;;
290741b2f0bdSmrg	      *) temp_deplibs="$temp_deplibs $libdir";;
290841b2f0bdSmrg	      esac
290941b2f0bdSmrg	    done
291041b2f0bdSmrg	    dependency_libs="$temp_deplibs"
291141b2f0bdSmrg	  fi
291241b2f0bdSmrg
291341b2f0bdSmrg	  newlib_search_path="$newlib_search_path $absdir"
291441b2f0bdSmrg	  # Link against this library
291541b2f0bdSmrg	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
291641b2f0bdSmrg	  # ... and its dependency_libs
291741b2f0bdSmrg	  tmp_libs=
291841b2f0bdSmrg	  for deplib in $dependency_libs; do
291941b2f0bdSmrg	    newdependency_libs="$deplib $newdependency_libs"
292041b2f0bdSmrg	    if test "X$duplicate_deps" = "Xyes" ; then
292141b2f0bdSmrg	      case "$tmp_libs " in
292241b2f0bdSmrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
292341b2f0bdSmrg	      esac
292441b2f0bdSmrg	    fi
292541b2f0bdSmrg	    tmp_libs="$tmp_libs $deplib"
292641b2f0bdSmrg	  done
292741b2f0bdSmrg
292841b2f0bdSmrg	  if test "$link_all_deplibs" != no; then
292941b2f0bdSmrg	    # Add the search paths of all dependency libraries
293041b2f0bdSmrg	    for deplib in $dependency_libs; do
293141b2f0bdSmrg	      case $deplib in
293241b2f0bdSmrg	      -L*) path="$deplib" ;;
293341b2f0bdSmrg	      *.la)
293441b2f0bdSmrg		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
293541b2f0bdSmrg		test "X$dir" = "X$deplib" && dir="."
293641b2f0bdSmrg		# We need an absolute path.
293741b2f0bdSmrg		case $dir in
293841b2f0bdSmrg		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
293941b2f0bdSmrg		*)
294041b2f0bdSmrg		  absdir=`cd "$dir" && pwd`
294141b2f0bdSmrg		  if test -z "$absdir"; then
294241b2f0bdSmrg		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
294341b2f0bdSmrg		    absdir="$dir"
294441b2f0bdSmrg		  fi
294541b2f0bdSmrg		  ;;
294641b2f0bdSmrg		esac
294741b2f0bdSmrg		if grep "^installed=no" $deplib > /dev/null; then
294841b2f0bdSmrg		  path="$absdir/$objdir"
294941b2f0bdSmrg		else
295041b2f0bdSmrg		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
295141b2f0bdSmrg		  if test -z "$libdir"; then
295241b2f0bdSmrg		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
295341b2f0bdSmrg		    exit $EXIT_FAILURE
295441b2f0bdSmrg		  fi
295541b2f0bdSmrg		  if test "$absdir" != "$libdir"; then
295641b2f0bdSmrg		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
295741b2f0bdSmrg		  fi
295841b2f0bdSmrg		  path="$absdir"
295941b2f0bdSmrg		fi
296041b2f0bdSmrg		depdepl=
296141b2f0bdSmrg		case $host in
296241b2f0bdSmrg		*-*-darwin*)
296341b2f0bdSmrg		  # we do not want to link against static libs,
296441b2f0bdSmrg		  # but need to link against shared
296541b2f0bdSmrg		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
296611245024Smrg		  eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
296741b2f0bdSmrg		  if test -n "$deplibrary_names" ; then
296841b2f0bdSmrg		    for tmp in $deplibrary_names ; do
296941b2f0bdSmrg		      depdepl=$tmp
297041b2f0bdSmrg		    done
297111245024Smrg		    if test -f "$deplibdir/$depdepl" ; then
297211245024Smrg		      depdepl="$deplibdir/$depdepl"
297311245024Smrg	      	    elif test -f "$path/$depdepl" ; then
297441b2f0bdSmrg		      depdepl="$path/$depdepl"
297511245024Smrg		    else
297611245024Smrg		      # Can't find it, oh well...
297711245024Smrg		      depdepl=
297841b2f0bdSmrg		    fi
297941b2f0bdSmrg		    # do not add paths which are already there
298041b2f0bdSmrg		    case " $newlib_search_path " in
298141b2f0bdSmrg		    *" $path "*) ;;
298241b2f0bdSmrg		    *) newlib_search_path="$newlib_search_path $path";;
298341b2f0bdSmrg		    esac
298441b2f0bdSmrg		  fi
298541b2f0bdSmrg		  path=""
298641b2f0bdSmrg		  ;;
298741b2f0bdSmrg		*)
298841b2f0bdSmrg		  path="-L$path"
298941b2f0bdSmrg		  ;;
299041b2f0bdSmrg		esac
299141b2f0bdSmrg		;;
299241b2f0bdSmrg	      -l*)
299341b2f0bdSmrg		case $host in
299441b2f0bdSmrg		*-*-darwin*)
299541b2f0bdSmrg		  # Again, we only want to link against shared libraries
299641b2f0bdSmrg		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
299741b2f0bdSmrg		  for tmp in $newlib_search_path ; do
299841b2f0bdSmrg		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
299941b2f0bdSmrg		      eval depdepl="$tmp/lib$tmp_libs.dylib"
300041b2f0bdSmrg		      break
300141b2f0bdSmrg		    fi
300241b2f0bdSmrg		  done
300341b2f0bdSmrg		  path=""
300441b2f0bdSmrg		  ;;
300541b2f0bdSmrg		*) continue ;;
300641b2f0bdSmrg		esac
300741b2f0bdSmrg		;;
300841b2f0bdSmrg	      *) continue ;;
300941b2f0bdSmrg	      esac
301041b2f0bdSmrg	      case " $deplibs " in
301141b2f0bdSmrg	      *" $path "*) ;;
301241b2f0bdSmrg	      *) deplibs="$path $deplibs" ;;
301341b2f0bdSmrg	      esac
301441b2f0bdSmrg	      case " $deplibs " in
301541b2f0bdSmrg	      *" $depdepl "*) ;;
301641b2f0bdSmrg	      *) deplibs="$depdepl $deplibs" ;;
301741b2f0bdSmrg	      esac
301841b2f0bdSmrg	    done
301941b2f0bdSmrg	  fi # link_all_deplibs != no
302041b2f0bdSmrg	fi # linkmode = lib
302141b2f0bdSmrg      done # for deplib in $libs
302241b2f0bdSmrg      dependency_libs="$newdependency_libs"
302341b2f0bdSmrg      if test "$pass" = dlpreopen; then
302441b2f0bdSmrg	# Link the dlpreopened libraries before other libraries
302541b2f0bdSmrg	for deplib in $save_deplibs; do
302641b2f0bdSmrg	  deplibs="$deplib $deplibs"
302741b2f0bdSmrg	done
302841b2f0bdSmrg      fi
302941b2f0bdSmrg      if test "$pass" != dlopen; then
303041b2f0bdSmrg	if test "$pass" != conv; then
303141b2f0bdSmrg	  # Make sure lib_search_path contains only unique directories.
303241b2f0bdSmrg	  lib_search_path=
303341b2f0bdSmrg	  for dir in $newlib_search_path; do
303441b2f0bdSmrg	    case "$lib_search_path " in
303541b2f0bdSmrg	    *" $dir "*) ;;
303641b2f0bdSmrg	    *) lib_search_path="$lib_search_path $dir" ;;
303741b2f0bdSmrg	    esac
303841b2f0bdSmrg	  done
303941b2f0bdSmrg	  newlib_search_path=
304041b2f0bdSmrg	fi
304141b2f0bdSmrg
304241b2f0bdSmrg	if test "$linkmode,$pass" != "prog,link"; then
304341b2f0bdSmrg	  vars="deplibs"
304441b2f0bdSmrg	else
304541b2f0bdSmrg	  vars="compile_deplibs finalize_deplibs"
304641b2f0bdSmrg	fi
304741b2f0bdSmrg	for var in $vars dependency_libs; do
304841b2f0bdSmrg	  # Add libraries to $var in reverse order
304941b2f0bdSmrg	  eval tmp_libs=\"\$$var\"
305041b2f0bdSmrg	  new_libs=
305141b2f0bdSmrg	  for deplib in $tmp_libs; do
305241b2f0bdSmrg	    # FIXME: Pedantically, this is the right thing to do, so
305341b2f0bdSmrg	    #        that some nasty dependency loop isn't accidentally
305441b2f0bdSmrg	    #        broken:
305541b2f0bdSmrg	    #new_libs="$deplib $new_libs"
305641b2f0bdSmrg	    # Pragmatically, this seems to cause very few problems in
305741b2f0bdSmrg	    # practice:
305841b2f0bdSmrg	    case $deplib in
305941b2f0bdSmrg	    -L*) new_libs="$deplib $new_libs" ;;
306041b2f0bdSmrg	    -R*) ;;
306141b2f0bdSmrg	    *)
306241b2f0bdSmrg	      # And here is the reason: when a library appears more
306341b2f0bdSmrg	      # than once as an explicit dependence of a library, or
306441b2f0bdSmrg	      # is implicitly linked in more than once by the
306541b2f0bdSmrg	      # compiler, it is considered special, and multiple
306641b2f0bdSmrg	      # occurrences thereof are not removed.  Compare this
306741b2f0bdSmrg	      # with having the same library being listed as a
306841b2f0bdSmrg	      # dependency of multiple other libraries: in this case,
306941b2f0bdSmrg	      # we know (pedantically, we assume) the library does not
307041b2f0bdSmrg	      # need to be listed more than once, so we keep only the
307141b2f0bdSmrg	      # last copy.  This is not always right, but it is rare
307241b2f0bdSmrg	      # enough that we require users that really mean to play
307341b2f0bdSmrg	      # such unportable linking tricks to link the library
307441b2f0bdSmrg	      # using -Wl,-lname, so that libtool does not consider it
307541b2f0bdSmrg	      # for duplicate removal.
307641b2f0bdSmrg	      case " $specialdeplibs " in
307741b2f0bdSmrg	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
307841b2f0bdSmrg	      *)
307941b2f0bdSmrg		case " $new_libs " in
308041b2f0bdSmrg		*" $deplib "*) ;;
308141b2f0bdSmrg		*) new_libs="$deplib $new_libs" ;;
308241b2f0bdSmrg		esac
308341b2f0bdSmrg		;;
308441b2f0bdSmrg	      esac
308541b2f0bdSmrg	      ;;
308641b2f0bdSmrg	    esac
308741b2f0bdSmrg	  done
308841b2f0bdSmrg	  tmp_libs=
308941b2f0bdSmrg	  for deplib in $new_libs; do
309041b2f0bdSmrg	    case $deplib in
309141b2f0bdSmrg	    -L*)
309241b2f0bdSmrg	      case " $tmp_libs " in
309341b2f0bdSmrg	      *" $deplib "*) ;;
309441b2f0bdSmrg	      *) tmp_libs="$tmp_libs $deplib" ;;
309541b2f0bdSmrg	      esac
309641b2f0bdSmrg	      ;;
309741b2f0bdSmrg	    *) tmp_libs="$tmp_libs $deplib" ;;
309841b2f0bdSmrg	    esac
309941b2f0bdSmrg	  done
310041b2f0bdSmrg	  eval $var=\"$tmp_libs\"
310141b2f0bdSmrg	done # for var
310241b2f0bdSmrg      fi
310341b2f0bdSmrg      # Last step: remove runtime libs from dependency_libs
310441b2f0bdSmrg      # (they stay in deplibs)
310541b2f0bdSmrg      tmp_libs=
310641b2f0bdSmrg      for i in $dependency_libs ; do
310741b2f0bdSmrg	case " $predeps $postdeps $compiler_lib_search_path " in
310841b2f0bdSmrg	*" $i "*)
310941b2f0bdSmrg	  i=""
311041b2f0bdSmrg	  ;;
311141b2f0bdSmrg	esac
311241b2f0bdSmrg	if test -n "$i" ; then
311341b2f0bdSmrg	  tmp_libs="$tmp_libs $i"
311441b2f0bdSmrg	fi
311541b2f0bdSmrg      done
311641b2f0bdSmrg      dependency_libs=$tmp_libs
311741b2f0bdSmrg    done # for pass
311841b2f0bdSmrg    if test "$linkmode" = prog; then
311941b2f0bdSmrg      dlfiles="$newdlfiles"
312041b2f0bdSmrg      dlprefiles="$newdlprefiles"
312141b2f0bdSmrg    fi
312241b2f0bdSmrg
312341b2f0bdSmrg    case $linkmode in
312441b2f0bdSmrg    oldlib)
312511245024Smrg      case " $deplibs" in
312611245024Smrg      *\ -l* | *\ -L*)
312711245024Smrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
312811245024Smrg      esac
312941b2f0bdSmrg
313041b2f0bdSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
313141b2f0bdSmrg	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
313241b2f0bdSmrg      fi
313341b2f0bdSmrg
313441b2f0bdSmrg      if test -n "$rpath"; then
313541b2f0bdSmrg	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
313641b2f0bdSmrg      fi
313741b2f0bdSmrg
313841b2f0bdSmrg      if test -n "$xrpath"; then
313941b2f0bdSmrg	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
314041b2f0bdSmrg      fi
314141b2f0bdSmrg
314241b2f0bdSmrg      if test -n "$vinfo"; then
314341b2f0bdSmrg	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
314441b2f0bdSmrg      fi
314541b2f0bdSmrg
314641b2f0bdSmrg      if test -n "$release"; then
314741b2f0bdSmrg	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
314841b2f0bdSmrg      fi
314941b2f0bdSmrg
315041b2f0bdSmrg      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
315141b2f0bdSmrg	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
315241b2f0bdSmrg      fi
315341b2f0bdSmrg
315441b2f0bdSmrg      # Now set the variables for building old libraries.
315541b2f0bdSmrg      build_libtool_libs=no
315641b2f0bdSmrg      oldlibs="$output"
315741b2f0bdSmrg      objs="$objs$old_deplibs"
315841b2f0bdSmrg      ;;
315941b2f0bdSmrg
316041b2f0bdSmrg    lib)
316141b2f0bdSmrg      # Make sure we only generate libraries of the form `libNAME.la'.
316241b2f0bdSmrg      case $outputname in
316341b2f0bdSmrg      lib*)
316441b2f0bdSmrg	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
316541b2f0bdSmrg	eval shared_ext=\"$shrext_cmds\"
316641b2f0bdSmrg	eval libname=\"$libname_spec\"
316741b2f0bdSmrg	;;
316841b2f0bdSmrg      *)
316941b2f0bdSmrg	if test "$module" = no; then
317041b2f0bdSmrg	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
317141b2f0bdSmrg	  $echo "$help" 1>&2
317241b2f0bdSmrg	  exit $EXIT_FAILURE
317341b2f0bdSmrg	fi
317441b2f0bdSmrg	if test "$need_lib_prefix" != no; then
317541b2f0bdSmrg	  # Add the "lib" prefix for modules if required
317641b2f0bdSmrg	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
317741b2f0bdSmrg	  eval shared_ext=\"$shrext_cmds\"
317841b2f0bdSmrg	  eval libname=\"$libname_spec\"
317941b2f0bdSmrg	else
318041b2f0bdSmrg	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
318141b2f0bdSmrg	fi
318241b2f0bdSmrg	;;
318341b2f0bdSmrg      esac
318441b2f0bdSmrg
318541b2f0bdSmrg      if test -n "$objs"; then
318641b2f0bdSmrg	if test "$deplibs_check_method" != pass_all; then
318741b2f0bdSmrg	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
318841b2f0bdSmrg	  exit $EXIT_FAILURE
318941b2f0bdSmrg	else
319041b2f0bdSmrg	  $echo
319141b2f0bdSmrg	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
319241b2f0bdSmrg	  $echo "*** objects $objs is not portable!"
319341b2f0bdSmrg	  libobjs="$libobjs $objs"
319441b2f0bdSmrg	fi
319541b2f0bdSmrg      fi
319641b2f0bdSmrg
319741b2f0bdSmrg      if test "$dlself" != no; then
319841b2f0bdSmrg	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
319941b2f0bdSmrg      fi
320041b2f0bdSmrg
320141b2f0bdSmrg      set dummy $rpath
320241b2f0bdSmrg      if test "$#" -gt 2; then
320341b2f0bdSmrg	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
320441b2f0bdSmrg      fi
320541b2f0bdSmrg      install_libdir="$2"
320641b2f0bdSmrg
320741b2f0bdSmrg      oldlibs=
320841b2f0bdSmrg      if test -z "$rpath"; then
320941b2f0bdSmrg	if test "$build_libtool_libs" = yes; then
321041b2f0bdSmrg	  # Building a libtool convenience library.
321141b2f0bdSmrg	  # Some compilers have problems with a `.al' extension so
321241b2f0bdSmrg	  # convenience libraries should have the same extension an
321341b2f0bdSmrg	  # archive normally would.
321441b2f0bdSmrg	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
321541b2f0bdSmrg	  build_libtool_libs=convenience
321641b2f0bdSmrg	  build_old_libs=yes
321741b2f0bdSmrg	fi
321841b2f0bdSmrg
321941b2f0bdSmrg	if test -n "$vinfo"; then
322041b2f0bdSmrg	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
322141b2f0bdSmrg	fi
322241b2f0bdSmrg
322341b2f0bdSmrg	if test -n "$release"; then
322441b2f0bdSmrg	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
322541b2f0bdSmrg	fi
322641b2f0bdSmrg      else
322741b2f0bdSmrg
322841b2f0bdSmrg	# Parse the version information argument.
322941b2f0bdSmrg	save_ifs="$IFS"; IFS=':'
323041b2f0bdSmrg	set dummy $vinfo 0 0 0
323141b2f0bdSmrg	IFS="$save_ifs"
323241b2f0bdSmrg
323341b2f0bdSmrg	if test -n "$8"; then
323441b2f0bdSmrg	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
323541b2f0bdSmrg	  $echo "$help" 1>&2
323641b2f0bdSmrg	  exit $EXIT_FAILURE
323741b2f0bdSmrg	fi
323841b2f0bdSmrg
323941b2f0bdSmrg	# convert absolute version numbers to libtool ages
324041b2f0bdSmrg	# this retains compatibility with .la files and attempts
324141b2f0bdSmrg	# to make the code below a bit more comprehensible
324241b2f0bdSmrg
324341b2f0bdSmrg	case $vinfo_number in
324441b2f0bdSmrg	yes)
324541b2f0bdSmrg	  number_major="$2"
324641b2f0bdSmrg	  number_minor="$3"
324741b2f0bdSmrg	  number_revision="$4"
324841b2f0bdSmrg	  #
324941b2f0bdSmrg	  # There are really only two kinds -- those that
325041b2f0bdSmrg	  # use the current revision as the major version
325141b2f0bdSmrg	  # and those that subtract age and use age as
325241b2f0bdSmrg	  # a minor version.  But, then there is irix
325341b2f0bdSmrg	  # which has an extra 1 added just for fun
325441b2f0bdSmrg	  #
325541b2f0bdSmrg	  case $version_type in
325611245024Smrg	  darwin|linux|osf|windows|none)
325741b2f0bdSmrg	    current=`expr $number_major + $number_minor`
325841b2f0bdSmrg	    age="$number_minor"
325941b2f0bdSmrg	    revision="$number_revision"
326041b2f0bdSmrg	    ;;
326141b2f0bdSmrg	  freebsd-aout|freebsd-elf|sunos)
326241b2f0bdSmrg	    current="$number_major"
326341b2f0bdSmrg	    revision="$number_minor"
326441b2f0bdSmrg	    age="0"
326541b2f0bdSmrg	    ;;
326641b2f0bdSmrg	  irix|nonstopux)
326711245024Smrg	    current=`expr $number_major + $number_minor`
326841b2f0bdSmrg	    age="$number_minor"
326941b2f0bdSmrg	    revision="$number_minor"
327011245024Smrg	    lt_irix_increment=no
327141b2f0bdSmrg	    ;;
327241b2f0bdSmrg	  esac
327341b2f0bdSmrg	  ;;
327441b2f0bdSmrg	no)
327541b2f0bdSmrg	  current="$2"
327641b2f0bdSmrg	  revision="$3"
327741b2f0bdSmrg	  age="$4"
327841b2f0bdSmrg	  ;;
327941b2f0bdSmrg	esac
328041b2f0bdSmrg
328141b2f0bdSmrg	# Check that each of the things are valid numbers.
328241b2f0bdSmrg	case $current in
328341b2f0bdSmrg	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]) ;;
328441b2f0bdSmrg	*)
328541b2f0bdSmrg	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
328641b2f0bdSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
328741b2f0bdSmrg	  exit $EXIT_FAILURE
328841b2f0bdSmrg	  ;;
328941b2f0bdSmrg	esac
329041b2f0bdSmrg
329141b2f0bdSmrg	case $revision in
329241b2f0bdSmrg	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]) ;;
329341b2f0bdSmrg	*)
329441b2f0bdSmrg	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
329541b2f0bdSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
329641b2f0bdSmrg	  exit $EXIT_FAILURE
329741b2f0bdSmrg	  ;;
329841b2f0bdSmrg	esac
329941b2f0bdSmrg
330041b2f0bdSmrg	case $age in
330141b2f0bdSmrg	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]) ;;
330241b2f0bdSmrg	*)
330341b2f0bdSmrg	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
330441b2f0bdSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
330541b2f0bdSmrg	  exit $EXIT_FAILURE
330641b2f0bdSmrg	  ;;
330741b2f0bdSmrg	esac
330841b2f0bdSmrg
330941b2f0bdSmrg	if test "$age" -gt "$current"; then
331041b2f0bdSmrg	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
331141b2f0bdSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
331241b2f0bdSmrg	  exit $EXIT_FAILURE
331341b2f0bdSmrg	fi
331441b2f0bdSmrg
331541b2f0bdSmrg	# Calculate the version variables.
331641b2f0bdSmrg	major=
331741b2f0bdSmrg	versuffix=
331841b2f0bdSmrg	verstring=
331941b2f0bdSmrg	case $version_type in
332041b2f0bdSmrg	none) ;;
332141b2f0bdSmrg
332241b2f0bdSmrg	darwin)
332341b2f0bdSmrg	  # Like Linux, but with the current version available in
332441b2f0bdSmrg	  # verstring for coding it into the library header
332541b2f0bdSmrg	  major=.`expr $current - $age`
332641b2f0bdSmrg	  versuffix="$major.$age.$revision"
332741b2f0bdSmrg	  # Darwin ld doesn't like 0 for these options...
332841b2f0bdSmrg	  minor_current=`expr $current + 1`
332911245024Smrg	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
333011245024Smrg	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
333141b2f0bdSmrg	  ;;
333241b2f0bdSmrg
333341b2f0bdSmrg	freebsd-aout)
333441b2f0bdSmrg	  major=".$current"
333541b2f0bdSmrg	  versuffix=".$current.$revision";
333641b2f0bdSmrg	  ;;
333741b2f0bdSmrg
333841b2f0bdSmrg	freebsd-elf)
333941b2f0bdSmrg	  major=".$current"
334041b2f0bdSmrg	  versuffix=".$current";
334141b2f0bdSmrg	  ;;
334241b2f0bdSmrg
334341b2f0bdSmrg	irix | nonstopux)
334411245024Smrg	  if test "X$lt_irix_increment" = "Xno"; then
334511245024Smrg	    major=`expr $current - $age`
334611245024Smrg	  else
334711245024Smrg	    major=`expr $current - $age + 1`
334811245024Smrg	  fi
334941b2f0bdSmrg	  case $version_type in
335041b2f0bdSmrg	    nonstopux) verstring_prefix=nonstopux ;;
335141b2f0bdSmrg	    *)         verstring_prefix=sgi ;;
335241b2f0bdSmrg	  esac
335341b2f0bdSmrg	  verstring="$verstring_prefix$major.$revision"
335441b2f0bdSmrg
335541b2f0bdSmrg	  # Add in all the interfaces that we are compatible with.
335641b2f0bdSmrg	  loop=$revision
335741b2f0bdSmrg	  while test "$loop" -ne 0; do
335841b2f0bdSmrg	    iface=`expr $revision - $loop`
335941b2f0bdSmrg	    loop=`expr $loop - 1`
336041b2f0bdSmrg	    verstring="$verstring_prefix$major.$iface:$verstring"
336141b2f0bdSmrg	  done
336241b2f0bdSmrg
336341b2f0bdSmrg	  # Before this point, $major must not contain `.'.
336441b2f0bdSmrg	  major=.$major
336541b2f0bdSmrg	  versuffix="$major.$revision"
336641b2f0bdSmrg	  ;;
336741b2f0bdSmrg
336841b2f0bdSmrg	linux)
336941b2f0bdSmrg	  major=.`expr $current - $age`
337041b2f0bdSmrg	  versuffix="$major.$age.$revision"
337141b2f0bdSmrg	  ;;
337241b2f0bdSmrg
337341b2f0bdSmrg	osf)
337441b2f0bdSmrg	  major=.`expr $current - $age`
337541b2f0bdSmrg	  versuffix=".$current.$age.$revision"
337641b2f0bdSmrg	  verstring="$current.$age.$revision"
337741b2f0bdSmrg
337841b2f0bdSmrg	  # Add in all the interfaces that we are compatible with.
337941b2f0bdSmrg	  loop=$age
338041b2f0bdSmrg	  while test "$loop" -ne 0; do
338141b2f0bdSmrg	    iface=`expr $current - $loop`
338241b2f0bdSmrg	    loop=`expr $loop - 1`
338341b2f0bdSmrg	    verstring="$verstring:${iface}.0"
338441b2f0bdSmrg	  done
338541b2f0bdSmrg
338641b2f0bdSmrg	  # Make executables depend on our current version.
338741b2f0bdSmrg	  verstring="$verstring:${current}.0"
338841b2f0bdSmrg	  ;;
338941b2f0bdSmrg
339041b2f0bdSmrg	sunos)
339141b2f0bdSmrg	  major=".$current"
339241b2f0bdSmrg	  versuffix=".$current.$revision"
339341b2f0bdSmrg	  ;;
339441b2f0bdSmrg
339541b2f0bdSmrg	windows)
339641b2f0bdSmrg	  # Use '-' rather than '.', since we only want one
339741b2f0bdSmrg	  # extension on DOS 8.3 filesystems.
339841b2f0bdSmrg	  major=`expr $current - $age`
339941b2f0bdSmrg	  versuffix="-$major"
340041b2f0bdSmrg	  ;;
340141b2f0bdSmrg
340241b2f0bdSmrg	*)
340341b2f0bdSmrg	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
340441b2f0bdSmrg	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
340541b2f0bdSmrg	  exit $EXIT_FAILURE
340641b2f0bdSmrg	  ;;
340741b2f0bdSmrg	esac
340841b2f0bdSmrg
340941b2f0bdSmrg	# Clear the version info if we defaulted, and they specified a release.
341041b2f0bdSmrg	if test -z "$vinfo" && test -n "$release"; then
341141b2f0bdSmrg	  major=
341241b2f0bdSmrg	  case $version_type in
341341b2f0bdSmrg	  darwin)
341441b2f0bdSmrg	    # we can't check for "0.0" in archive_cmds due to quoting
341541b2f0bdSmrg	    # problems, so we reset it completely
341641b2f0bdSmrg	    verstring=
341741b2f0bdSmrg	    ;;
341841b2f0bdSmrg	  *)
341941b2f0bdSmrg	    verstring="0.0"
342041b2f0bdSmrg	    ;;
342141b2f0bdSmrg	  esac
342241b2f0bdSmrg	  if test "$need_version" = no; then
342341b2f0bdSmrg	    versuffix=
342441b2f0bdSmrg	  else
342541b2f0bdSmrg	    versuffix=".0.0"
342641b2f0bdSmrg	  fi
342741b2f0bdSmrg	fi
342841b2f0bdSmrg
342941b2f0bdSmrg	# Remove version info from name if versioning should be avoided
343041b2f0bdSmrg	if test "$avoid_version" = yes && test "$need_version" = no; then
343141b2f0bdSmrg	  major=
343241b2f0bdSmrg	  versuffix=
343341b2f0bdSmrg	  verstring=""
343441b2f0bdSmrg	fi
343541b2f0bdSmrg
343641b2f0bdSmrg	# Check to see if the archive will have undefined symbols.
343741b2f0bdSmrg	if test "$allow_undefined" = yes; then
343841b2f0bdSmrg	  if test "$allow_undefined_flag" = unsupported; then
343941b2f0bdSmrg	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
344041b2f0bdSmrg	    build_libtool_libs=no
344141b2f0bdSmrg	    build_old_libs=yes
344241b2f0bdSmrg	  fi
344341b2f0bdSmrg	else
344441b2f0bdSmrg	  # Don't allow undefined symbols.
344541b2f0bdSmrg	  allow_undefined_flag="$no_undefined_flag"
344641b2f0bdSmrg	fi
344741b2f0bdSmrg      fi
344841b2f0bdSmrg
344941b2f0bdSmrg      if test "$mode" != relink; then
345041b2f0bdSmrg	# Remove our outputs, but don't remove object files since they
345141b2f0bdSmrg	# may have been created when compiling PIC objects.
345241b2f0bdSmrg	removelist=
345341b2f0bdSmrg	tempremovelist=`$echo "$output_objdir/*"`
345441b2f0bdSmrg	for p in $tempremovelist; do
345541b2f0bdSmrg	  case $p in
345641b2f0bdSmrg	    *.$objext)
345741b2f0bdSmrg	       ;;
345841b2f0bdSmrg	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
345941b2f0bdSmrg	       if test "X$precious_files_regex" != "X"; then
346041b2f0bdSmrg	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
346141b2f0bdSmrg	         then
346241b2f0bdSmrg		   continue
346341b2f0bdSmrg		 fi
346441b2f0bdSmrg	       fi
346541b2f0bdSmrg	       removelist="$removelist $p"
346641b2f0bdSmrg	       ;;
346741b2f0bdSmrg	    *) ;;
346841b2f0bdSmrg	  esac
346941b2f0bdSmrg	done
347041b2f0bdSmrg	if test -n "$removelist"; then
347141b2f0bdSmrg	  $show "${rm}r $removelist"
347241b2f0bdSmrg	  $run ${rm}r $removelist
347341b2f0bdSmrg	fi
347441b2f0bdSmrg      fi
347541b2f0bdSmrg
347641b2f0bdSmrg      # Now set the variables for building old libraries.
347741b2f0bdSmrg      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
347841b2f0bdSmrg	oldlibs="$oldlibs $output_objdir/$libname.$libext"
347941b2f0bdSmrg
348041b2f0bdSmrg	# Transform .lo files to .o files.
348141b2f0bdSmrg	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
348241b2f0bdSmrg      fi
348341b2f0bdSmrg
348441b2f0bdSmrg      # Eliminate all temporary directories.
348511245024Smrg      #for path in $notinst_path; do
348611245024Smrg      #	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
348711245024Smrg      #	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
348811245024Smrg      #	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
348911245024Smrg      #done
349041b2f0bdSmrg
349141b2f0bdSmrg      if test -n "$xrpath"; then
349241b2f0bdSmrg	# If the user specified any rpath flags, then add them.
349341b2f0bdSmrg	temp_xrpath=
349441b2f0bdSmrg	for libdir in $xrpath; do
349541b2f0bdSmrg	  temp_xrpath="$temp_xrpath -R$libdir"
349641b2f0bdSmrg	  case "$finalize_rpath " in
349741b2f0bdSmrg	  *" $libdir "*) ;;
349841b2f0bdSmrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
349941b2f0bdSmrg	  esac
350041b2f0bdSmrg	done
350141b2f0bdSmrg	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
350241b2f0bdSmrg	  dependency_libs="$temp_xrpath $dependency_libs"
350341b2f0bdSmrg	fi
350441b2f0bdSmrg      fi
350541b2f0bdSmrg
350641b2f0bdSmrg      # Make sure dlfiles contains only unique files that won't be dlpreopened
350741b2f0bdSmrg      old_dlfiles="$dlfiles"
350841b2f0bdSmrg      dlfiles=
350941b2f0bdSmrg      for lib in $old_dlfiles; do
351041b2f0bdSmrg	case " $dlprefiles $dlfiles " in
351141b2f0bdSmrg	*" $lib "*) ;;
351241b2f0bdSmrg	*) dlfiles="$dlfiles $lib" ;;
351341b2f0bdSmrg	esac
351441b2f0bdSmrg      done
351541b2f0bdSmrg
351641b2f0bdSmrg      # Make sure dlprefiles contains only unique files
351741b2f0bdSmrg      old_dlprefiles="$dlprefiles"
351841b2f0bdSmrg      dlprefiles=
351941b2f0bdSmrg      for lib in $old_dlprefiles; do
352041b2f0bdSmrg	case "$dlprefiles " in
352141b2f0bdSmrg	*" $lib "*) ;;
352241b2f0bdSmrg	*) dlprefiles="$dlprefiles $lib" ;;
352341b2f0bdSmrg	esac
352441b2f0bdSmrg      done
352541b2f0bdSmrg
352641b2f0bdSmrg      if test "$build_libtool_libs" = yes; then
352741b2f0bdSmrg	if test -n "$rpath"; then
352841b2f0bdSmrg	  case $host in
352941b2f0bdSmrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
353041b2f0bdSmrg	    # these systems don't actually have a c library (as such)!
353141b2f0bdSmrg	    ;;
353241b2f0bdSmrg	  *-*-rhapsody* | *-*-darwin1.[012])
353341b2f0bdSmrg	    # Rhapsody C library is in the System framework
353441b2f0bdSmrg	    deplibs="$deplibs -framework System"
353541b2f0bdSmrg	    ;;
353641b2f0bdSmrg	  *-*-netbsd*)
353741b2f0bdSmrg	    # Don't link with libc until the a.out ld.so is fixed.
353841b2f0bdSmrg	    ;;
353941b2f0bdSmrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
354041b2f0bdSmrg	    # Do not include libc due to us having libc/libc_r.
354141b2f0bdSmrg	    ;;
354241b2f0bdSmrg	  *-*-sco3.2v5* | *-*-sco5v6*)
354341b2f0bdSmrg	    # Causes problems with __ctype
354441b2f0bdSmrg	    ;;
354541b2f0bdSmrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
354641b2f0bdSmrg	    # Compiler inserts libc in the correct place for threads to work
354741b2f0bdSmrg	    ;;
354841b2f0bdSmrg 	  *)
354941b2f0bdSmrg	    # Add libc to deplibs on all other systems if necessary.
355041b2f0bdSmrg	    if test "$build_libtool_need_lc" = "yes"; then
355141b2f0bdSmrg	      deplibs="$deplibs -lc"
355241b2f0bdSmrg	    fi
355341b2f0bdSmrg	    ;;
355441b2f0bdSmrg	  esac
355541b2f0bdSmrg	fi
355641b2f0bdSmrg
355741b2f0bdSmrg	# Transform deplibs into only deplibs that can be linked in shared.
355841b2f0bdSmrg	name_save=$name
355941b2f0bdSmrg	libname_save=$libname
356041b2f0bdSmrg	release_save=$release
356141b2f0bdSmrg	versuffix_save=$versuffix
356241b2f0bdSmrg	major_save=$major
356341b2f0bdSmrg	# I'm not sure if I'm treating the release correctly.  I think
356441b2f0bdSmrg	# release should show up in the -l (ie -lgmp5) so we don't want to
356541b2f0bdSmrg	# add it in twice.  Is that correct?
356641b2f0bdSmrg	release=""
356741b2f0bdSmrg	versuffix=""
356841b2f0bdSmrg	major=""
356941b2f0bdSmrg	newdeplibs=
357041b2f0bdSmrg	droppeddeps=no
357141b2f0bdSmrg	case $deplibs_check_method in
357241b2f0bdSmrg	pass_all)
357341b2f0bdSmrg	  # Don't check for shared/static.  Everything works.
357441b2f0bdSmrg	  # This might be a little naive.  We might want to check
357541b2f0bdSmrg	  # whether the library exists or not.  But this is on
357641b2f0bdSmrg	  # osf3 & osf4 and I'm not really sure... Just
357741b2f0bdSmrg	  # implementing what was already the behavior.
357841b2f0bdSmrg	  newdeplibs=$deplibs
357941b2f0bdSmrg	  ;;
358041b2f0bdSmrg	test_compile)
358141b2f0bdSmrg	  # This code stresses the "libraries are programs" paradigm to its
358241b2f0bdSmrg	  # limits. Maybe even breaks it.  We compile a program, linking it
358341b2f0bdSmrg	  # against the deplibs as a proxy for the library.  Then we can check
358441b2f0bdSmrg	  # whether they linked in statically or dynamically with ldd.
358541b2f0bdSmrg	  $rm conftest.c
358641b2f0bdSmrg	  cat > conftest.c <<EOF
358741b2f0bdSmrg	  int main() { return 0; }
358841b2f0bdSmrgEOF
358941b2f0bdSmrg	  $rm conftest
359011245024Smrg	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
359141b2f0bdSmrg	    ldd_output=`ldd conftest`
359241b2f0bdSmrg	    for i in $deplibs; do
359341b2f0bdSmrg	      name=`expr $i : '-l\(.*\)'`
359441b2f0bdSmrg	      # If $name is empty we are operating on a -L argument.
359511245024Smrg              if test "$name" != "" && test "$name" != "0"; then
359641b2f0bdSmrg		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
359741b2f0bdSmrg		  case " $predeps $postdeps " in
359841b2f0bdSmrg		  *" $i "*)
359941b2f0bdSmrg		    newdeplibs="$newdeplibs $i"
360041b2f0bdSmrg		    i=""
360141b2f0bdSmrg		    ;;
360241b2f0bdSmrg		  esac
360341b2f0bdSmrg	        fi
360441b2f0bdSmrg		if test -n "$i" ; then
360541b2f0bdSmrg		  libname=`eval \\$echo \"$libname_spec\"`
360641b2f0bdSmrg		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
360741b2f0bdSmrg		  set dummy $deplib_matches
360841b2f0bdSmrg		  deplib_match=$2
360941b2f0bdSmrg		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
361041b2f0bdSmrg		    newdeplibs="$newdeplibs $i"
361141b2f0bdSmrg		  else
361241b2f0bdSmrg		    droppeddeps=yes
361341b2f0bdSmrg		    $echo
361441b2f0bdSmrg		    $echo "*** Warning: dynamic linker does not accept needed library $i."
361541b2f0bdSmrg		    $echo "*** I have the capability to make that library automatically link in when"
361641b2f0bdSmrg		    $echo "*** you link to this library.  But I can only do this if you have a"
361741b2f0bdSmrg		    $echo "*** shared version of the library, which I believe you do not have"
361841b2f0bdSmrg		    $echo "*** because a test_compile did reveal that the linker did not use it for"
361941b2f0bdSmrg		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
362041b2f0bdSmrg		  fi
362141b2f0bdSmrg		fi
362241b2f0bdSmrg	      else
362341b2f0bdSmrg		newdeplibs="$newdeplibs $i"
362441b2f0bdSmrg	      fi
362541b2f0bdSmrg	    done
362641b2f0bdSmrg	  else
362741b2f0bdSmrg	    # Error occurred in the first compile.  Let's try to salvage
362841b2f0bdSmrg	    # the situation: Compile a separate program for each library.
362941b2f0bdSmrg	    for i in $deplibs; do
363041b2f0bdSmrg	      name=`expr $i : '-l\(.*\)'`
363141b2f0bdSmrg	      # If $name is empty we are operating on a -L argument.
363241b2f0bdSmrg              if test "$name" != "" && test "$name" != "0"; then
363341b2f0bdSmrg		$rm conftest
363411245024Smrg		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
363541b2f0bdSmrg		  ldd_output=`ldd conftest`
363641b2f0bdSmrg		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
363741b2f0bdSmrg		    case " $predeps $postdeps " in
363841b2f0bdSmrg		    *" $i "*)
363941b2f0bdSmrg		      newdeplibs="$newdeplibs $i"
364041b2f0bdSmrg		      i=""
364141b2f0bdSmrg		      ;;
364241b2f0bdSmrg		    esac
364341b2f0bdSmrg		  fi
364441b2f0bdSmrg		  if test -n "$i" ; then
364541b2f0bdSmrg		    libname=`eval \\$echo \"$libname_spec\"`
364641b2f0bdSmrg		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
364741b2f0bdSmrg		    set dummy $deplib_matches
364841b2f0bdSmrg		    deplib_match=$2
364941b2f0bdSmrg		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
365041b2f0bdSmrg		      newdeplibs="$newdeplibs $i"
365141b2f0bdSmrg		    else
365241b2f0bdSmrg		      droppeddeps=yes
365341b2f0bdSmrg		      $echo
365441b2f0bdSmrg		      $echo "*** Warning: dynamic linker does not accept needed library $i."
365541b2f0bdSmrg		      $echo "*** I have the capability to make that library automatically link in when"
365641b2f0bdSmrg		      $echo "*** you link to this library.  But I can only do this if you have a"
365741b2f0bdSmrg		      $echo "*** shared version of the library, which you do not appear to have"
365841b2f0bdSmrg		      $echo "*** because a test_compile did reveal that the linker did not use this one"
365941b2f0bdSmrg		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
366041b2f0bdSmrg		    fi
366141b2f0bdSmrg		  fi
366241b2f0bdSmrg		else
366341b2f0bdSmrg		  droppeddeps=yes
366441b2f0bdSmrg		  $echo
366541b2f0bdSmrg		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
366611245024Smrg		  $echo "*** make it link in!  You will probably need to install it or some"
366741b2f0bdSmrg		  $echo "*** library that it depends on before this library will be fully"
366841b2f0bdSmrg		  $echo "*** functional.  Installing it before continuing would be even better."
366941b2f0bdSmrg		fi
367041b2f0bdSmrg	      else
367141b2f0bdSmrg		newdeplibs="$newdeplibs $i"
367241b2f0bdSmrg	      fi
367341b2f0bdSmrg	    done
367441b2f0bdSmrg	  fi
367541b2f0bdSmrg	  ;;
367641b2f0bdSmrg	file_magic*)
367741b2f0bdSmrg	  set dummy $deplibs_check_method
367841b2f0bdSmrg	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
367941b2f0bdSmrg	  for a_deplib in $deplibs; do
368041b2f0bdSmrg	    name=`expr $a_deplib : '-l\(.*\)'`
368141b2f0bdSmrg	    # If $name is empty we are operating on a -L argument.
368241b2f0bdSmrg            if test "$name" != "" && test  "$name" != "0"; then
368341b2f0bdSmrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
368441b2f0bdSmrg		case " $predeps $postdeps " in
368541b2f0bdSmrg		*" $a_deplib "*)
368641b2f0bdSmrg		  newdeplibs="$newdeplibs $a_deplib"
368741b2f0bdSmrg		  a_deplib=""
368841b2f0bdSmrg		  ;;
368941b2f0bdSmrg		esac
369041b2f0bdSmrg	      fi
369141b2f0bdSmrg	      if test -n "$a_deplib" ; then
369241b2f0bdSmrg		libname=`eval \\$echo \"$libname_spec\"`
369341b2f0bdSmrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
369441b2f0bdSmrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
369541b2f0bdSmrg		  for potent_lib in $potential_libs; do
369641b2f0bdSmrg		      # Follow soft links.
369741b2f0bdSmrg		      if ls -lLd "$potent_lib" 2>/dev/null \
369841b2f0bdSmrg			 | grep " -> " >/dev/null; then
369941b2f0bdSmrg			continue
370041b2f0bdSmrg		      fi
370141b2f0bdSmrg		      # The statement above tries to avoid entering an
370241b2f0bdSmrg		      # endless loop below, in case of cyclic links.
370341b2f0bdSmrg		      # We might still enter an endless loop, since a link
370441b2f0bdSmrg		      # loop can be closed while we follow links,
370541b2f0bdSmrg		      # but so what?
370641b2f0bdSmrg		      potlib="$potent_lib"
370741b2f0bdSmrg		      while test -h "$potlib" 2>/dev/null; do
370841b2f0bdSmrg			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
370941b2f0bdSmrg			case $potliblink in
371041b2f0bdSmrg			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
371141b2f0bdSmrg			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
371241b2f0bdSmrg			esac
371341b2f0bdSmrg		      done
371441b2f0bdSmrg		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
371541b2f0bdSmrg			 | ${SED} 10q \
371641b2f0bdSmrg			 | $EGREP "$file_magic_regex" > /dev/null; then
371741b2f0bdSmrg			newdeplibs="$newdeplibs $a_deplib"
371841b2f0bdSmrg			a_deplib=""
371941b2f0bdSmrg			break 2
372041b2f0bdSmrg		      fi
372141b2f0bdSmrg		  done
372241b2f0bdSmrg		done
372341b2f0bdSmrg	      fi
372441b2f0bdSmrg	      if test -n "$a_deplib" ; then
372541b2f0bdSmrg		droppeddeps=yes
372641b2f0bdSmrg		$echo
372741b2f0bdSmrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
372841b2f0bdSmrg		$echo "*** I have the capability to make that library automatically link in when"
372941b2f0bdSmrg		$echo "*** you link to this library.  But I can only do this if you have a"
373041b2f0bdSmrg		$echo "*** shared version of the library, which you do not appear to have"
373141b2f0bdSmrg		$echo "*** because I did check the linker path looking for a file starting"
373241b2f0bdSmrg		if test -z "$potlib" ; then
373341b2f0bdSmrg		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
373441b2f0bdSmrg		else
373541b2f0bdSmrg		  $echo "*** with $libname and none of the candidates passed a file format test"
373641b2f0bdSmrg		  $echo "*** using a file magic. Last file checked: $potlib"
373741b2f0bdSmrg		fi
373841b2f0bdSmrg	      fi
373941b2f0bdSmrg	    else
374041b2f0bdSmrg	      # Add a -L argument.
374141b2f0bdSmrg	      newdeplibs="$newdeplibs $a_deplib"
374241b2f0bdSmrg	    fi
374341b2f0bdSmrg	  done # Gone through all deplibs.
374441b2f0bdSmrg	  ;;
374541b2f0bdSmrg	match_pattern*)
374641b2f0bdSmrg	  set dummy $deplibs_check_method
374741b2f0bdSmrg	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
374841b2f0bdSmrg	  for a_deplib in $deplibs; do
374941b2f0bdSmrg	    name=`expr $a_deplib : '-l\(.*\)'`
375041b2f0bdSmrg	    # If $name is empty we are operating on a -L argument.
375141b2f0bdSmrg	    if test -n "$name" && test "$name" != "0"; then
375241b2f0bdSmrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
375341b2f0bdSmrg		case " $predeps $postdeps " in
375441b2f0bdSmrg		*" $a_deplib "*)
375541b2f0bdSmrg		  newdeplibs="$newdeplibs $a_deplib"
375641b2f0bdSmrg		  a_deplib=""
375741b2f0bdSmrg		  ;;
375841b2f0bdSmrg		esac
375941b2f0bdSmrg	      fi
376041b2f0bdSmrg	      if test -n "$a_deplib" ; then
376141b2f0bdSmrg		libname=`eval \\$echo \"$libname_spec\"`
376241b2f0bdSmrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
376341b2f0bdSmrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
376441b2f0bdSmrg		  for potent_lib in $potential_libs; do
376541b2f0bdSmrg		    potlib="$potent_lib" # see symlink-check above in file_magic test
376641b2f0bdSmrg		    if eval $echo \"$potent_lib\" 2>/dev/null \
376741b2f0bdSmrg		        | ${SED} 10q \
376841b2f0bdSmrg		        | $EGREP "$match_pattern_regex" > /dev/null; then
376941b2f0bdSmrg		      newdeplibs="$newdeplibs $a_deplib"
377041b2f0bdSmrg		      a_deplib=""
377141b2f0bdSmrg		      break 2
377241b2f0bdSmrg		    fi
377341b2f0bdSmrg		  done
377441b2f0bdSmrg		done
377541b2f0bdSmrg	      fi
377641b2f0bdSmrg	      if test -n "$a_deplib" ; then
377741b2f0bdSmrg		droppeddeps=yes
377841b2f0bdSmrg		$echo
377941b2f0bdSmrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
378041b2f0bdSmrg		$echo "*** I have the capability to make that library automatically link in when"
378141b2f0bdSmrg		$echo "*** you link to this library.  But I can only do this if you have a"
378241b2f0bdSmrg		$echo "*** shared version of the library, which you do not appear to have"
378341b2f0bdSmrg		$echo "*** because I did check the linker path looking for a file starting"
378441b2f0bdSmrg		if test -z "$potlib" ; then
378541b2f0bdSmrg		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
378641b2f0bdSmrg		else
378741b2f0bdSmrg		  $echo "*** with $libname and none of the candidates passed a file format test"
378841b2f0bdSmrg		  $echo "*** using a regex pattern. Last file checked: $potlib"
378941b2f0bdSmrg		fi
379041b2f0bdSmrg	      fi
379141b2f0bdSmrg	    else
379241b2f0bdSmrg	      # Add a -L argument.
379341b2f0bdSmrg	      newdeplibs="$newdeplibs $a_deplib"
379441b2f0bdSmrg	    fi
379541b2f0bdSmrg	  done # Gone through all deplibs.
379641b2f0bdSmrg	  ;;
379741b2f0bdSmrg	none | unknown | *)
379841b2f0bdSmrg	  newdeplibs=""
379941b2f0bdSmrg	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
380041b2f0bdSmrg	    -e 's/ -[LR][^ ]*//g'`
380141b2f0bdSmrg	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
380241b2f0bdSmrg	    for i in $predeps $postdeps ; do
380341b2f0bdSmrg	      # can't use Xsed below, because $i might contain '/'
380441b2f0bdSmrg	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
380541b2f0bdSmrg	    done
380641b2f0bdSmrg	  fi
380741b2f0bdSmrg	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
380841b2f0bdSmrg	    | grep . >/dev/null; then
380941b2f0bdSmrg	    $echo
381041b2f0bdSmrg	    if test "X$deplibs_check_method" = "Xnone"; then
381141b2f0bdSmrg	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
381241b2f0bdSmrg	    else
381341b2f0bdSmrg	      $echo "*** Warning: inter-library dependencies are not known to be supported."
381441b2f0bdSmrg	    fi
381541b2f0bdSmrg	    $echo "*** All declared inter-library dependencies are being dropped."
381641b2f0bdSmrg	    droppeddeps=yes
381741b2f0bdSmrg	  fi
381841b2f0bdSmrg	  ;;
381941b2f0bdSmrg	esac
382041b2f0bdSmrg	versuffix=$versuffix_save
382141b2f0bdSmrg	major=$major_save
382241b2f0bdSmrg	release=$release_save
382341b2f0bdSmrg	libname=$libname_save
382441b2f0bdSmrg	name=$name_save
382541b2f0bdSmrg
382641b2f0bdSmrg	case $host in
382741b2f0bdSmrg	*-*-rhapsody* | *-*-darwin1.[012])
382841b2f0bdSmrg	  # On Rhapsody replace the C library is the System framework
382941b2f0bdSmrg	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
383041b2f0bdSmrg	  ;;
383141b2f0bdSmrg	esac
383241b2f0bdSmrg
383341b2f0bdSmrg	if test "$droppeddeps" = yes; then
383441b2f0bdSmrg	  if test "$module" = yes; then
383541b2f0bdSmrg	    $echo
383641b2f0bdSmrg	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
383741b2f0bdSmrg	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
383841b2f0bdSmrg	    $echo "*** a static module, that should work as long as the dlopening"
383941b2f0bdSmrg	    $echo "*** application is linked with the -dlopen flag."
384041b2f0bdSmrg	    if test -z "$global_symbol_pipe"; then
384141b2f0bdSmrg	      $echo
384241b2f0bdSmrg	      $echo "*** However, this would only work if libtool was able to extract symbol"
384341b2f0bdSmrg	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
384441b2f0bdSmrg	      $echo "*** not find such a program.  So, this module is probably useless."
384541b2f0bdSmrg	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
384641b2f0bdSmrg	    fi
384741b2f0bdSmrg	    if test "$build_old_libs" = no; then
384841b2f0bdSmrg	      oldlibs="$output_objdir/$libname.$libext"
384941b2f0bdSmrg	      build_libtool_libs=module
385041b2f0bdSmrg	      build_old_libs=yes
385141b2f0bdSmrg	    else
385241b2f0bdSmrg	      build_libtool_libs=no
385341b2f0bdSmrg	    fi
385441b2f0bdSmrg	  else
385541b2f0bdSmrg	    $echo "*** The inter-library dependencies that have been dropped here will be"
385641b2f0bdSmrg	    $echo "*** automatically added whenever a program is linked with this library"
385741b2f0bdSmrg	    $echo "*** or is declared to -dlopen it."
385841b2f0bdSmrg
385941b2f0bdSmrg	    if test "$allow_undefined" = no; then
386041b2f0bdSmrg	      $echo
386141b2f0bdSmrg	      $echo "*** Since this library must not contain undefined symbols,"
386241b2f0bdSmrg	      $echo "*** because either the platform does not support them or"
386341b2f0bdSmrg	      $echo "*** it was explicitly requested with -no-undefined,"
386441b2f0bdSmrg	      $echo "*** libtool will only create a static version of it."
386541b2f0bdSmrg	      if test "$build_old_libs" = no; then
386641b2f0bdSmrg		oldlibs="$output_objdir/$libname.$libext"
386741b2f0bdSmrg		build_libtool_libs=module
386841b2f0bdSmrg		build_old_libs=yes
386941b2f0bdSmrg	      else
387041b2f0bdSmrg		build_libtool_libs=no
387141b2f0bdSmrg	      fi
387241b2f0bdSmrg	    fi
387341b2f0bdSmrg	  fi
387441b2f0bdSmrg	fi
387541b2f0bdSmrg	# Done checking deplibs!
387641b2f0bdSmrg	deplibs=$newdeplibs
387741b2f0bdSmrg      fi
387841b2f0bdSmrg
387941b2f0bdSmrg
388041b2f0bdSmrg      # move library search paths that coincide with paths to not yet
388141b2f0bdSmrg      # installed libraries to the beginning of the library search list
388241b2f0bdSmrg      new_libs=
388341b2f0bdSmrg      for path in $notinst_path; do
388441b2f0bdSmrg	case " $new_libs " in
388541b2f0bdSmrg	*" -L$path/$objdir "*) ;;
388641b2f0bdSmrg	*)
388741b2f0bdSmrg	  case " $deplibs " in
388841b2f0bdSmrg	  *" -L$path/$objdir "*)
388941b2f0bdSmrg	    new_libs="$new_libs -L$path/$objdir" ;;
389041b2f0bdSmrg	  esac
389141b2f0bdSmrg	  ;;
389241b2f0bdSmrg	esac
389341b2f0bdSmrg      done
389441b2f0bdSmrg      for deplib in $deplibs; do
389541b2f0bdSmrg	case $deplib in
389641b2f0bdSmrg	-L*)
389741b2f0bdSmrg	  case " $new_libs " in
389841b2f0bdSmrg	  *" $deplib "*) ;;
389941b2f0bdSmrg	  *) new_libs="$new_libs $deplib" ;;
390041b2f0bdSmrg	  esac
390141b2f0bdSmrg	  ;;
390241b2f0bdSmrg	*) new_libs="$new_libs $deplib" ;;
390341b2f0bdSmrg	esac
390441b2f0bdSmrg      done
390541b2f0bdSmrg      deplibs="$new_libs"
390641b2f0bdSmrg
390741b2f0bdSmrg
390841b2f0bdSmrg      # All the library-specific variables (install_libdir is set above).
390941b2f0bdSmrg      library_names=
391041b2f0bdSmrg      old_library=
391141b2f0bdSmrg      dlname=
391241b2f0bdSmrg
391341b2f0bdSmrg      # Test again, we may have decided not to build it any more
391441b2f0bdSmrg      if test "$build_libtool_libs" = yes; then
391541b2f0bdSmrg	if test "$hardcode_into_libs" = yes; then
391641b2f0bdSmrg	  # Hardcode the library paths
391741b2f0bdSmrg	  hardcode_libdirs=
391841b2f0bdSmrg	  dep_rpath=
391941b2f0bdSmrg	  rpath="$finalize_rpath"
392041b2f0bdSmrg	  test "$mode" != relink && rpath="$compile_rpath$rpath"
392141b2f0bdSmrg	  for libdir in $rpath; do
392241b2f0bdSmrg	    if test -n "$hardcode_libdir_flag_spec"; then
392341b2f0bdSmrg	      if test -n "$hardcode_libdir_separator"; then
392441b2f0bdSmrg		if test -z "$hardcode_libdirs"; then
392541b2f0bdSmrg		  hardcode_libdirs="$libdir"
392641b2f0bdSmrg		else
392741b2f0bdSmrg		  # Just accumulate the unique libdirs.
392841b2f0bdSmrg		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
392941b2f0bdSmrg		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
393041b2f0bdSmrg		    ;;
393141b2f0bdSmrg		  *)
393241b2f0bdSmrg		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
393341b2f0bdSmrg		    ;;
393441b2f0bdSmrg		  esac
393541b2f0bdSmrg		fi
393641b2f0bdSmrg	      else
393741b2f0bdSmrg		eval flag=\"$hardcode_libdir_flag_spec\"
393841b2f0bdSmrg		dep_rpath="$dep_rpath $flag"
393941b2f0bdSmrg	      fi
394041b2f0bdSmrg	    elif test -n "$runpath_var"; then
394141b2f0bdSmrg	      case "$perm_rpath " in
394241b2f0bdSmrg	      *" $libdir "*) ;;
394341b2f0bdSmrg	      *) perm_rpath="$perm_rpath $libdir" ;;
394441b2f0bdSmrg	      esac
394541b2f0bdSmrg	    fi
394641b2f0bdSmrg	  done
394741b2f0bdSmrg	  # Substitute the hardcoded libdirs into the rpath.
394841b2f0bdSmrg	  if test -n "$hardcode_libdir_separator" &&
394941b2f0bdSmrg	     test -n "$hardcode_libdirs"; then
395041b2f0bdSmrg	    libdir="$hardcode_libdirs"
395141b2f0bdSmrg	    if test -n "$hardcode_libdir_flag_spec_ld"; then
395211245024Smrg	      case $archive_cmds in
395311245024Smrg	      *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
395411245024Smrg	      *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
395511245024Smrg	      esac
395641b2f0bdSmrg	    else
395741b2f0bdSmrg	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
395841b2f0bdSmrg	    fi
395941b2f0bdSmrg	  fi
396041b2f0bdSmrg	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
396141b2f0bdSmrg	    # We should set the runpath_var.
396241b2f0bdSmrg	    rpath=
396341b2f0bdSmrg	    for dir in $perm_rpath; do
396441b2f0bdSmrg	      rpath="$rpath$dir:"
396541b2f0bdSmrg	    done
396641b2f0bdSmrg	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
396741b2f0bdSmrg	  fi
396841b2f0bdSmrg	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
396941b2f0bdSmrg	fi
397041b2f0bdSmrg
397141b2f0bdSmrg	shlibpath="$finalize_shlibpath"
397241b2f0bdSmrg	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
397341b2f0bdSmrg	if test -n "$shlibpath"; then
397441b2f0bdSmrg	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
397541b2f0bdSmrg	fi
397641b2f0bdSmrg
397741b2f0bdSmrg	# Get the real and link names of the library.
397841b2f0bdSmrg	eval shared_ext=\"$shrext_cmds\"
397941b2f0bdSmrg	eval library_names=\"$library_names_spec\"
398041b2f0bdSmrg	set dummy $library_names
398141b2f0bdSmrg	realname="$2"
398241b2f0bdSmrg	shift; shift
398341b2f0bdSmrg
398441b2f0bdSmrg	if test -n "$soname_spec"; then
398541b2f0bdSmrg	  eval soname=\"$soname_spec\"
398641b2f0bdSmrg	else
398741b2f0bdSmrg	  soname="$realname"
398841b2f0bdSmrg	fi
398941b2f0bdSmrg	if test -z "$dlname"; then
399041b2f0bdSmrg	  dlname=$soname
399141b2f0bdSmrg	fi
399241b2f0bdSmrg
399341b2f0bdSmrg	lib="$output_objdir/$realname"
399441b2f0bdSmrg	linknames=
399541b2f0bdSmrg	for link
399641b2f0bdSmrg	do
399741b2f0bdSmrg	  linknames="$linknames $link"
399841b2f0bdSmrg	done
399941b2f0bdSmrg
400041b2f0bdSmrg	# Use standard objects if they are pic
400141b2f0bdSmrg	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
400241b2f0bdSmrg
400341b2f0bdSmrg	# Prepare the list of exported symbols
400441b2f0bdSmrg	if test -z "$export_symbols"; then
400541b2f0bdSmrg	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
400641b2f0bdSmrg	    $show "generating symbol list for \`$libname.la'"
400741b2f0bdSmrg	    export_symbols="$output_objdir/$libname.exp"
400841b2f0bdSmrg	    $run $rm $export_symbols
400941b2f0bdSmrg	    cmds=$export_symbols_cmds
401041b2f0bdSmrg	    save_ifs="$IFS"; IFS='~'
401141b2f0bdSmrg	    for cmd in $cmds; do
401241b2f0bdSmrg	      IFS="$save_ifs"
401341b2f0bdSmrg	      eval cmd=\"$cmd\"
401441b2f0bdSmrg	      if len=`expr "X$cmd" : ".*"` &&
401541b2f0bdSmrg	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
401641b2f0bdSmrg	        $show "$cmd"
401741b2f0bdSmrg	        $run eval "$cmd" || exit $?
401841b2f0bdSmrg	        skipped_export=false
401941b2f0bdSmrg	      else
402041b2f0bdSmrg	        # The command line is too long to execute in one step.
402141b2f0bdSmrg	        $show "using reloadable object file for export list..."
402241b2f0bdSmrg	        skipped_export=:
402341b2f0bdSmrg		# Break out early, otherwise skipped_export may be
402441b2f0bdSmrg		# set to false by a later but shorter cmd.
402541b2f0bdSmrg		break
402641b2f0bdSmrg	      fi
402741b2f0bdSmrg	    done
402841b2f0bdSmrg	    IFS="$save_ifs"
402941b2f0bdSmrg	    if test -n "$export_symbols_regex"; then
403041b2f0bdSmrg	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
403141b2f0bdSmrg	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
403241b2f0bdSmrg	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
403341b2f0bdSmrg	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
403441b2f0bdSmrg	    fi
403541b2f0bdSmrg	  fi
403641b2f0bdSmrg	fi
403741b2f0bdSmrg
403841b2f0bdSmrg	if test -n "$export_symbols" && test -n "$include_expsyms"; then
403941b2f0bdSmrg	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
404041b2f0bdSmrg	fi
404141b2f0bdSmrg
404241b2f0bdSmrg	tmp_deplibs=
404341b2f0bdSmrg	for test_deplib in $deplibs; do
404441b2f0bdSmrg		case " $convenience " in
404541b2f0bdSmrg		*" $test_deplib "*) ;;
404641b2f0bdSmrg		*)
404741b2f0bdSmrg			tmp_deplibs="$tmp_deplibs $test_deplib"
404841b2f0bdSmrg			;;
404941b2f0bdSmrg		esac
405041b2f0bdSmrg	done
405141b2f0bdSmrg	deplibs="$tmp_deplibs"
405241b2f0bdSmrg
405341b2f0bdSmrg	if test -n "$convenience"; then
405441b2f0bdSmrg	  if test -n "$whole_archive_flag_spec"; then
405541b2f0bdSmrg	    save_libobjs=$libobjs
405641b2f0bdSmrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
405741b2f0bdSmrg	  else
405841b2f0bdSmrg	    gentop="$output_objdir/${outputname}x"
405941b2f0bdSmrg	    generated="$generated $gentop"
406041b2f0bdSmrg
406141b2f0bdSmrg	    func_extract_archives $gentop $convenience
406241b2f0bdSmrg	    libobjs="$libobjs $func_extract_archives_result"
406341b2f0bdSmrg	  fi
406441b2f0bdSmrg	fi
406541b2f0bdSmrg	
406641b2f0bdSmrg	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
406741b2f0bdSmrg	  eval flag=\"$thread_safe_flag_spec\"
406841b2f0bdSmrg	  linker_flags="$linker_flags $flag"
406941b2f0bdSmrg	fi
407041b2f0bdSmrg
407141b2f0bdSmrg	# Make a backup of the uninstalled library when relinking
407241b2f0bdSmrg	if test "$mode" = relink; then
407341b2f0bdSmrg	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
407441b2f0bdSmrg	fi
407541b2f0bdSmrg
407641b2f0bdSmrg	# Do each of the archive commands.
407741b2f0bdSmrg	if test "$module" = yes && test -n "$module_cmds" ; then
407841b2f0bdSmrg	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
407941b2f0bdSmrg	    eval test_cmds=\"$module_expsym_cmds\"
408041b2f0bdSmrg	    cmds=$module_expsym_cmds
408141b2f0bdSmrg	  else
408241b2f0bdSmrg	    eval test_cmds=\"$module_cmds\"
408341b2f0bdSmrg	    cmds=$module_cmds
408441b2f0bdSmrg	  fi
408541b2f0bdSmrg	else
408641b2f0bdSmrg	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
408741b2f0bdSmrg	  eval test_cmds=\"$archive_expsym_cmds\"
408841b2f0bdSmrg	  cmds=$archive_expsym_cmds
408941b2f0bdSmrg	else
409041b2f0bdSmrg	  eval test_cmds=\"$archive_cmds\"
409141b2f0bdSmrg	  cmds=$archive_cmds
409241b2f0bdSmrg	  fi
409341b2f0bdSmrg	fi
409441b2f0bdSmrg
409541b2f0bdSmrg	if test "X$skipped_export" != "X:" &&
409641b2f0bdSmrg	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
409741b2f0bdSmrg	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
409841b2f0bdSmrg	  :
409941b2f0bdSmrg	else
410041b2f0bdSmrg	  # The command line is too long to link in one step, link piecewise.
410141b2f0bdSmrg	  $echo "creating reloadable object files..."
410241b2f0bdSmrg
410341b2f0bdSmrg	  # Save the value of $output and $libobjs because we want to
410441b2f0bdSmrg	  # use them later.  If we have whole_archive_flag_spec, we
410541b2f0bdSmrg	  # want to use save_libobjs as it was before
410641b2f0bdSmrg	  # whole_archive_flag_spec was expanded, because we can't
410741b2f0bdSmrg	  # assume the linker understands whole_archive_flag_spec.
410841b2f0bdSmrg	  # This may have to be revisited, in case too many
410941b2f0bdSmrg	  # convenience libraries get linked in and end up exceeding
411041b2f0bdSmrg	  # the spec.
411141b2f0bdSmrg	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
411241b2f0bdSmrg	    save_libobjs=$libobjs
411341b2f0bdSmrg	  fi
411441b2f0bdSmrg	  save_output=$output
411541b2f0bdSmrg	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
411641b2f0bdSmrg
411741b2f0bdSmrg	  # Clear the reloadable object creation command queue and
411841b2f0bdSmrg	  # initialize k to one.
411941b2f0bdSmrg	  test_cmds=
412041b2f0bdSmrg	  concat_cmds=
412141b2f0bdSmrg	  objlist=
412241b2f0bdSmrg	  delfiles=
412341b2f0bdSmrg	  last_robj=
412441b2f0bdSmrg	  k=1
412541b2f0bdSmrg	  output=$output_objdir/$output_la-${k}.$objext
412641b2f0bdSmrg	  # Loop over the list of objects to be linked.
412741b2f0bdSmrg	  for obj in $save_libobjs
412841b2f0bdSmrg	  do
412941b2f0bdSmrg	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
413041b2f0bdSmrg	    if test "X$objlist" = X ||
413141b2f0bdSmrg	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
413241b2f0bdSmrg		 test "$len" -le "$max_cmd_len"; }; then
413341b2f0bdSmrg	      objlist="$objlist $obj"
413441b2f0bdSmrg	    else
413541b2f0bdSmrg	      # The command $test_cmds is almost too long, add a
413641b2f0bdSmrg	      # command to the queue.
413741b2f0bdSmrg	      if test "$k" -eq 1 ; then
413841b2f0bdSmrg		# The first file doesn't have a previous command to add.
413941b2f0bdSmrg		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
414041b2f0bdSmrg	      else
414141b2f0bdSmrg		# All subsequent reloadable object files will link in
414241b2f0bdSmrg		# the last one created.
414341b2f0bdSmrg		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
414441b2f0bdSmrg	      fi
414541b2f0bdSmrg	      last_robj=$output_objdir/$output_la-${k}.$objext
414641b2f0bdSmrg	      k=`expr $k + 1`
414741b2f0bdSmrg	      output=$output_objdir/$output_la-${k}.$objext
414841b2f0bdSmrg	      objlist=$obj
414941b2f0bdSmrg	      len=1
415041b2f0bdSmrg	    fi
415141b2f0bdSmrg	  done
415241b2f0bdSmrg	  # Handle the remaining objects by creating one last
415341b2f0bdSmrg	  # reloadable object file.  All subsequent reloadable object
415441b2f0bdSmrg	  # files will link in the last one created.
415541b2f0bdSmrg	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
415641b2f0bdSmrg	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
415741b2f0bdSmrg
415841b2f0bdSmrg	  if ${skipped_export-false}; then
415941b2f0bdSmrg	    $show "generating symbol list for \`$libname.la'"
416041b2f0bdSmrg	    export_symbols="$output_objdir/$libname.exp"
416141b2f0bdSmrg	    $run $rm $export_symbols
416241b2f0bdSmrg	    libobjs=$output
416341b2f0bdSmrg	    # Append the command to create the export file.
416441b2f0bdSmrg	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
416541b2f0bdSmrg          fi
416641b2f0bdSmrg
416741b2f0bdSmrg	  # Set up a command to remove the reloadable object files
416841b2f0bdSmrg	  # after they are used.
416941b2f0bdSmrg	  i=0
417041b2f0bdSmrg	  while test "$i" -lt "$k"
417141b2f0bdSmrg	  do
417241b2f0bdSmrg	    i=`expr $i + 1`
417341b2f0bdSmrg	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
417441b2f0bdSmrg	  done
417541b2f0bdSmrg
417641b2f0bdSmrg	  $echo "creating a temporary reloadable object file: $output"
417741b2f0bdSmrg
417841b2f0bdSmrg	  # Loop through the commands generated above and execute them.
417941b2f0bdSmrg	  save_ifs="$IFS"; IFS='~'
418041b2f0bdSmrg	  for cmd in $concat_cmds; do
418141b2f0bdSmrg	    IFS="$save_ifs"
418241b2f0bdSmrg	    $show "$cmd"
418341b2f0bdSmrg	    $run eval "$cmd" || exit $?
418441b2f0bdSmrg	  done
418541b2f0bdSmrg	  IFS="$save_ifs"
418641b2f0bdSmrg
418741b2f0bdSmrg	  libobjs=$output
418841b2f0bdSmrg	  # Restore the value of output.
418941b2f0bdSmrg	  output=$save_output
419041b2f0bdSmrg
419141b2f0bdSmrg	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
419241b2f0bdSmrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
419341b2f0bdSmrg	  fi
419441b2f0bdSmrg	  # Expand the library linking commands again to reset the
419541b2f0bdSmrg	  # value of $libobjs for piecewise linking.
419641b2f0bdSmrg
419741b2f0bdSmrg	  # Do each of the archive commands.
419841b2f0bdSmrg	  if test "$module" = yes && test -n "$module_cmds" ; then
419941b2f0bdSmrg	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
420041b2f0bdSmrg	      cmds=$module_expsym_cmds
420141b2f0bdSmrg	    else
420241b2f0bdSmrg	      cmds=$module_cmds
420341b2f0bdSmrg	    fi
420441b2f0bdSmrg	  else
420541b2f0bdSmrg	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
420641b2f0bdSmrg	    cmds=$archive_expsym_cmds
420741b2f0bdSmrg	  else
420841b2f0bdSmrg	    cmds=$archive_cmds
420941b2f0bdSmrg	    fi
421041b2f0bdSmrg	  fi
421141b2f0bdSmrg
421241b2f0bdSmrg	  # Append the command to remove the reloadable object files
421341b2f0bdSmrg	  # to the just-reset $cmds.
421441b2f0bdSmrg	  eval cmds=\"\$cmds~\$rm $delfiles\"
421541b2f0bdSmrg	fi
421641b2f0bdSmrg	save_ifs="$IFS"; IFS='~'
421741b2f0bdSmrg	for cmd in $cmds; do
421841b2f0bdSmrg	  IFS="$save_ifs"
421941b2f0bdSmrg	  eval cmd=\"$cmd\"
422041b2f0bdSmrg	  $show "$cmd"
422141b2f0bdSmrg	  $run eval "$cmd" || {
422241b2f0bdSmrg	    lt_exit=$?
422341b2f0bdSmrg
422441b2f0bdSmrg	    # Restore the uninstalled library and exit
422541b2f0bdSmrg	    if test "$mode" = relink; then
422641b2f0bdSmrg	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
422741b2f0bdSmrg	    fi
422841b2f0bdSmrg
422941b2f0bdSmrg	    exit $lt_exit
423041b2f0bdSmrg	  }
423141b2f0bdSmrg	done
423241b2f0bdSmrg	IFS="$save_ifs"
423341b2f0bdSmrg
423441b2f0bdSmrg	# Restore the uninstalled library and exit
423541b2f0bdSmrg	if test "$mode" = relink; then
423641b2f0bdSmrg	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
423741b2f0bdSmrg
423841b2f0bdSmrg	  if test -n "$convenience"; then
423941b2f0bdSmrg	    if test -z "$whole_archive_flag_spec"; then
424041b2f0bdSmrg	      $show "${rm}r $gentop"
424141b2f0bdSmrg	      $run ${rm}r "$gentop"
424241b2f0bdSmrg	    fi
424341b2f0bdSmrg	  fi
424441b2f0bdSmrg
424541b2f0bdSmrg	  exit $EXIT_SUCCESS
424641b2f0bdSmrg	fi
424741b2f0bdSmrg
424841b2f0bdSmrg	# Create links to the real library.
424941b2f0bdSmrg	for linkname in $linknames; do
425041b2f0bdSmrg	  if test "$realname" != "$linkname"; then
425141b2f0bdSmrg	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
425241b2f0bdSmrg	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
425341b2f0bdSmrg	  fi
425441b2f0bdSmrg	done
425541b2f0bdSmrg
425641b2f0bdSmrg	# If -module or -export-dynamic was specified, set the dlname.
425741b2f0bdSmrg	if test "$module" = yes || test "$export_dynamic" = yes; then
425841b2f0bdSmrg	  # On all known operating systems, these are identical.
425941b2f0bdSmrg	  dlname="$soname"
426041b2f0bdSmrg	fi
426141b2f0bdSmrg      fi
426241b2f0bdSmrg      ;;
426341b2f0bdSmrg
426441b2f0bdSmrg    obj)
426511245024Smrg      case " $deplibs" in
426611245024Smrg      *\ -l* | *\ -L*)
426711245024Smrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
426811245024Smrg      esac
426941b2f0bdSmrg
427041b2f0bdSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
427141b2f0bdSmrg	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
427241b2f0bdSmrg      fi
427341b2f0bdSmrg
427441b2f0bdSmrg      if test -n "$rpath"; then
427541b2f0bdSmrg	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
427641b2f0bdSmrg      fi
427741b2f0bdSmrg
427841b2f0bdSmrg      if test -n "$xrpath"; then
427941b2f0bdSmrg	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
428041b2f0bdSmrg      fi
428141b2f0bdSmrg
428241b2f0bdSmrg      if test -n "$vinfo"; then
428341b2f0bdSmrg	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
428441b2f0bdSmrg      fi
428541b2f0bdSmrg
428641b2f0bdSmrg      if test -n "$release"; then
428741b2f0bdSmrg	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
428841b2f0bdSmrg      fi
428941b2f0bdSmrg
429041b2f0bdSmrg      case $output in
429141b2f0bdSmrg      *.lo)
429241b2f0bdSmrg	if test -n "$objs$old_deplibs"; then
429341b2f0bdSmrg	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
429441b2f0bdSmrg	  exit $EXIT_FAILURE
429541b2f0bdSmrg	fi
429641b2f0bdSmrg	libobj="$output"
429741b2f0bdSmrg	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
429841b2f0bdSmrg	;;
429941b2f0bdSmrg      *)
430041b2f0bdSmrg	libobj=
430141b2f0bdSmrg	obj="$output"
430241b2f0bdSmrg	;;
430341b2f0bdSmrg      esac
430441b2f0bdSmrg
430541b2f0bdSmrg      # Delete the old objects.
430641b2f0bdSmrg      $run $rm $obj $libobj
430741b2f0bdSmrg
430841b2f0bdSmrg      # Objects from convenience libraries.  This assumes
430941b2f0bdSmrg      # single-version convenience libraries.  Whenever we create
431041b2f0bdSmrg      # different ones for PIC/non-PIC, this we'll have to duplicate
431141b2f0bdSmrg      # the extraction.
431241b2f0bdSmrg      reload_conv_objs=
431341b2f0bdSmrg      gentop=
431441b2f0bdSmrg      # reload_cmds runs $LD directly, so let us get rid of
431511245024Smrg      # -Wl from whole_archive_flag_spec and hope we can get by with
431611245024Smrg      # turning comma into space..
431741b2f0bdSmrg      wl=
431841b2f0bdSmrg
431941b2f0bdSmrg      if test -n "$convenience"; then
432041b2f0bdSmrg	if test -n "$whole_archive_flag_spec"; then
432111245024Smrg	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
432211245024Smrg	  reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
432341b2f0bdSmrg	else
432441b2f0bdSmrg	  gentop="$output_objdir/${obj}x"
432541b2f0bdSmrg	  generated="$generated $gentop"
432641b2f0bdSmrg
432741b2f0bdSmrg	  func_extract_archives $gentop $convenience
432841b2f0bdSmrg	  reload_conv_objs="$reload_objs $func_extract_archives_result"
432941b2f0bdSmrg	fi
433041b2f0bdSmrg      fi
433141b2f0bdSmrg
433241b2f0bdSmrg      # Create the old-style object.
433341b2f0bdSmrg      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
433441b2f0bdSmrg
433541b2f0bdSmrg      output="$obj"
433641b2f0bdSmrg      cmds=$reload_cmds
433741b2f0bdSmrg      save_ifs="$IFS"; IFS='~'
433841b2f0bdSmrg      for cmd in $cmds; do
433941b2f0bdSmrg	IFS="$save_ifs"
434041b2f0bdSmrg	eval cmd=\"$cmd\"
434141b2f0bdSmrg	$show "$cmd"
434241b2f0bdSmrg	$run eval "$cmd" || exit $?
434341b2f0bdSmrg      done
434441b2f0bdSmrg      IFS="$save_ifs"
434541b2f0bdSmrg
434641b2f0bdSmrg      # Exit if we aren't doing a library object file.
434741b2f0bdSmrg      if test -z "$libobj"; then
434841b2f0bdSmrg	if test -n "$gentop"; then
434941b2f0bdSmrg	  $show "${rm}r $gentop"
435041b2f0bdSmrg	  $run ${rm}r $gentop
435141b2f0bdSmrg	fi
435241b2f0bdSmrg
435341b2f0bdSmrg	exit $EXIT_SUCCESS
435441b2f0bdSmrg      fi
435541b2f0bdSmrg
435641b2f0bdSmrg      if test "$build_libtool_libs" != yes; then
435741b2f0bdSmrg	if test -n "$gentop"; then
435841b2f0bdSmrg	  $show "${rm}r $gentop"
435941b2f0bdSmrg	  $run ${rm}r $gentop
436041b2f0bdSmrg	fi
436141b2f0bdSmrg
436241b2f0bdSmrg	# Create an invalid libtool object if no PIC, so that we don't
436341b2f0bdSmrg	# accidentally link it into a program.
436441b2f0bdSmrg	# $show "echo timestamp > $libobj"
436541b2f0bdSmrg	# $run eval "echo timestamp > $libobj" || exit $?
436641b2f0bdSmrg	exit $EXIT_SUCCESS
436741b2f0bdSmrg      fi
436841b2f0bdSmrg
436941b2f0bdSmrg      if test -n "$pic_flag" || test "$pic_mode" != default; then
437041b2f0bdSmrg	# Only do commands if we really have different PIC objects.
437141b2f0bdSmrg	reload_objs="$libobjs $reload_conv_objs"
437241b2f0bdSmrg	output="$libobj"
437341b2f0bdSmrg	cmds=$reload_cmds
437441b2f0bdSmrg	save_ifs="$IFS"; IFS='~'
437541b2f0bdSmrg	for cmd in $cmds; do
437641b2f0bdSmrg	  IFS="$save_ifs"
437741b2f0bdSmrg	  eval cmd=\"$cmd\"
437841b2f0bdSmrg	  $show "$cmd"
437941b2f0bdSmrg	  $run eval "$cmd" || exit $?
438041b2f0bdSmrg	done
438141b2f0bdSmrg	IFS="$save_ifs"
438241b2f0bdSmrg      fi
438341b2f0bdSmrg
438441b2f0bdSmrg      if test -n "$gentop"; then
438541b2f0bdSmrg	$show "${rm}r $gentop"
438641b2f0bdSmrg	$run ${rm}r $gentop
438741b2f0bdSmrg      fi
438841b2f0bdSmrg
438941b2f0bdSmrg      exit $EXIT_SUCCESS
439041b2f0bdSmrg      ;;
439141b2f0bdSmrg
439241b2f0bdSmrg    prog)
439341b2f0bdSmrg      case $host in
439441b2f0bdSmrg	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
439541b2f0bdSmrg      esac
439641b2f0bdSmrg      if test -n "$vinfo"; then
439741b2f0bdSmrg	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
439841b2f0bdSmrg      fi
439941b2f0bdSmrg
440041b2f0bdSmrg      if test -n "$release"; then
440141b2f0bdSmrg	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
440241b2f0bdSmrg      fi
440341b2f0bdSmrg
440441b2f0bdSmrg      if test "$preload" = yes; then
440541b2f0bdSmrg	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
440641b2f0bdSmrg	   test "$dlopen_self_static" = unknown; then
440741b2f0bdSmrg	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
440841b2f0bdSmrg	fi
440941b2f0bdSmrg      fi
441041b2f0bdSmrg
441141b2f0bdSmrg      case $host in
441241b2f0bdSmrg      *-*-rhapsody* | *-*-darwin1.[012])
441341b2f0bdSmrg	# On Rhapsody replace the C library is the System framework
441441b2f0bdSmrg	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
441541b2f0bdSmrg	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
441641b2f0bdSmrg	;;
441741b2f0bdSmrg      esac
441841b2f0bdSmrg
441941b2f0bdSmrg      case $host in
442041b2f0bdSmrg      *darwin*)
442141b2f0bdSmrg        # Don't allow lazy linking, it breaks C++ global constructors
442241b2f0bdSmrg        if test "$tagname" = CXX ; then
442341b2f0bdSmrg        compile_command="$compile_command ${wl}-bind_at_load"
442441b2f0bdSmrg        finalize_command="$finalize_command ${wl}-bind_at_load"
442541b2f0bdSmrg        fi
442641b2f0bdSmrg        ;;
442741b2f0bdSmrg      esac
442841b2f0bdSmrg
442941b2f0bdSmrg
443041b2f0bdSmrg      # move library search paths that coincide with paths to not yet
443141b2f0bdSmrg      # installed libraries to the beginning of the library search list
443241b2f0bdSmrg      new_libs=
443341b2f0bdSmrg      for path in $notinst_path; do
443441b2f0bdSmrg	case " $new_libs " in
443541b2f0bdSmrg	*" -L$path/$objdir "*) ;;
443641b2f0bdSmrg	*)
443741b2f0bdSmrg	  case " $compile_deplibs " in
443841b2f0bdSmrg	  *" -L$path/$objdir "*)
443941b2f0bdSmrg	    new_libs="$new_libs -L$path/$objdir" ;;
444041b2f0bdSmrg	  esac
444141b2f0bdSmrg	  ;;
444241b2f0bdSmrg	esac
444341b2f0bdSmrg      done
444441b2f0bdSmrg      for deplib in $compile_deplibs; do
444541b2f0bdSmrg	case $deplib in
444641b2f0bdSmrg	-L*)
444741b2f0bdSmrg	  case " $new_libs " in
444841b2f0bdSmrg	  *" $deplib "*) ;;
444941b2f0bdSmrg	  *) new_libs="$new_libs $deplib" ;;
445041b2f0bdSmrg	  esac
445141b2f0bdSmrg	  ;;
445241b2f0bdSmrg	*) new_libs="$new_libs $deplib" ;;
445341b2f0bdSmrg	esac
445441b2f0bdSmrg      done
445541b2f0bdSmrg      compile_deplibs="$new_libs"
445641b2f0bdSmrg
445741b2f0bdSmrg
445841b2f0bdSmrg      compile_command="$compile_command $compile_deplibs"
445941b2f0bdSmrg      finalize_command="$finalize_command $finalize_deplibs"
446041b2f0bdSmrg
446141b2f0bdSmrg      if test -n "$rpath$xrpath"; then
446241b2f0bdSmrg	# If the user specified any rpath flags, then add them.
446341b2f0bdSmrg	for libdir in $rpath $xrpath; do
446441b2f0bdSmrg	  # This is the magic to use -rpath.
446541b2f0bdSmrg	  case "$finalize_rpath " in
446641b2f0bdSmrg	  *" $libdir "*) ;;
446741b2f0bdSmrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
446841b2f0bdSmrg	  esac
446941b2f0bdSmrg	done
447041b2f0bdSmrg      fi
447141b2f0bdSmrg
447241b2f0bdSmrg      # Now hardcode the library paths
447341b2f0bdSmrg      rpath=
447441b2f0bdSmrg      hardcode_libdirs=
447541b2f0bdSmrg      for libdir in $compile_rpath $finalize_rpath; do
447641b2f0bdSmrg	if test -n "$hardcode_libdir_flag_spec"; then
447741b2f0bdSmrg	  if test -n "$hardcode_libdir_separator"; then
447841b2f0bdSmrg	    if test -z "$hardcode_libdirs"; then
447941b2f0bdSmrg	      hardcode_libdirs="$libdir"
448041b2f0bdSmrg	    else
448141b2f0bdSmrg	      # Just accumulate the unique libdirs.
448241b2f0bdSmrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
448341b2f0bdSmrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
448441b2f0bdSmrg		;;
448541b2f0bdSmrg	      *)
448641b2f0bdSmrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
448741b2f0bdSmrg		;;
448841b2f0bdSmrg	      esac
448941b2f0bdSmrg	    fi
449041b2f0bdSmrg	  else
449141b2f0bdSmrg	    eval flag=\"$hardcode_libdir_flag_spec\"
449241b2f0bdSmrg	    rpath="$rpath $flag"
449341b2f0bdSmrg	  fi
449441b2f0bdSmrg	elif test -n "$runpath_var"; then
449541b2f0bdSmrg	  case "$perm_rpath " in
449641b2f0bdSmrg	  *" $libdir "*) ;;
449741b2f0bdSmrg	  *) perm_rpath="$perm_rpath $libdir" ;;
449841b2f0bdSmrg	  esac
449941b2f0bdSmrg	fi
450041b2f0bdSmrg	case $host in
450141b2f0bdSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
450241b2f0bdSmrg	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
450341b2f0bdSmrg	  case :$dllsearchpath: in
450441b2f0bdSmrg	  *":$libdir:"*) ;;
450541b2f0bdSmrg	  *) dllsearchpath="$dllsearchpath:$libdir";;
450641b2f0bdSmrg	  esac
450741b2f0bdSmrg	  case :$dllsearchpath: in
450841b2f0bdSmrg	  *":$testbindir:"*) ;;
450941b2f0bdSmrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
451041b2f0bdSmrg	  esac
451141b2f0bdSmrg	  ;;
451241b2f0bdSmrg	esac
451341b2f0bdSmrg      done
451441b2f0bdSmrg      # Substitute the hardcoded libdirs into the rpath.
451541b2f0bdSmrg      if test -n "$hardcode_libdir_separator" &&
451641b2f0bdSmrg	 test -n "$hardcode_libdirs"; then
451741b2f0bdSmrg	libdir="$hardcode_libdirs"
451841b2f0bdSmrg	eval rpath=\" $hardcode_libdir_flag_spec\"
451941b2f0bdSmrg      fi
452041b2f0bdSmrg      compile_rpath="$rpath"
452141b2f0bdSmrg
452241b2f0bdSmrg      rpath=
452341b2f0bdSmrg      hardcode_libdirs=
452441b2f0bdSmrg      for libdir in $finalize_rpath; do
452541b2f0bdSmrg	if test -n "$hardcode_libdir_flag_spec"; then
452641b2f0bdSmrg	  if test -n "$hardcode_libdir_separator"; then
452741b2f0bdSmrg	    if test -z "$hardcode_libdirs"; then
452841b2f0bdSmrg	      hardcode_libdirs="$libdir"
452941b2f0bdSmrg	    else
453041b2f0bdSmrg	      # Just accumulate the unique libdirs.
453141b2f0bdSmrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
453241b2f0bdSmrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
453341b2f0bdSmrg		;;
453441b2f0bdSmrg	      *)
453541b2f0bdSmrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
453641b2f0bdSmrg		;;
453741b2f0bdSmrg	      esac
453841b2f0bdSmrg	    fi
453941b2f0bdSmrg	  else
454041b2f0bdSmrg	    eval flag=\"$hardcode_libdir_flag_spec\"
454141b2f0bdSmrg	    rpath="$rpath $flag"
454241b2f0bdSmrg	  fi
454341b2f0bdSmrg	elif test -n "$runpath_var"; then
454441b2f0bdSmrg	  case "$finalize_perm_rpath " in
454541b2f0bdSmrg	  *" $libdir "*) ;;
454641b2f0bdSmrg	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
454741b2f0bdSmrg	  esac
454841b2f0bdSmrg	fi
454941b2f0bdSmrg      done
455041b2f0bdSmrg      # Substitute the hardcoded libdirs into the rpath.
455141b2f0bdSmrg      if test -n "$hardcode_libdir_separator" &&
455241b2f0bdSmrg	 test -n "$hardcode_libdirs"; then
455341b2f0bdSmrg	libdir="$hardcode_libdirs"
455441b2f0bdSmrg	eval rpath=\" $hardcode_libdir_flag_spec\"
455541b2f0bdSmrg      fi
455641b2f0bdSmrg      finalize_rpath="$rpath"
455741b2f0bdSmrg
455841b2f0bdSmrg      if test -n "$libobjs" && test "$build_old_libs" = yes; then
455941b2f0bdSmrg	# Transform all the library objects into standard objects.
456041b2f0bdSmrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
456141b2f0bdSmrg	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
456241b2f0bdSmrg      fi
456341b2f0bdSmrg
456441b2f0bdSmrg      dlsyms=
456541b2f0bdSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
456641b2f0bdSmrg	if test -n "$NM" && test -n "$global_symbol_pipe"; then
456741b2f0bdSmrg	  dlsyms="${outputname}S.c"
456841b2f0bdSmrg	else
456941b2f0bdSmrg	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
457041b2f0bdSmrg	fi
457141b2f0bdSmrg      fi
457241b2f0bdSmrg
457341b2f0bdSmrg      if test -n "$dlsyms"; then
457441b2f0bdSmrg	case $dlsyms in
457541b2f0bdSmrg	"") ;;
457641b2f0bdSmrg	*.c)
457741b2f0bdSmrg	  # Discover the nlist of each of the dlfiles.
457841b2f0bdSmrg	  nlist="$output_objdir/${outputname}.nm"
457941b2f0bdSmrg
458041b2f0bdSmrg	  $show "$rm $nlist ${nlist}S ${nlist}T"
458141b2f0bdSmrg	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
458241b2f0bdSmrg
458341b2f0bdSmrg	  # Parse the name list into a source file.
458441b2f0bdSmrg	  $show "creating $output_objdir/$dlsyms"
458541b2f0bdSmrg
458641b2f0bdSmrg	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
458741b2f0bdSmrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
458841b2f0bdSmrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
458941b2f0bdSmrg
459041b2f0bdSmrg#ifdef __cplusplus
459141b2f0bdSmrgextern \"C\" {
459241b2f0bdSmrg#endif
459341b2f0bdSmrg
459441b2f0bdSmrg/* Prevent the only kind of declaration conflicts we can make. */
459541b2f0bdSmrg#define lt_preloaded_symbols some_other_symbol
459641b2f0bdSmrg
459741b2f0bdSmrg/* External symbol declarations for the compiler. */\
459841b2f0bdSmrg"
459941b2f0bdSmrg
460041b2f0bdSmrg	  if test "$dlself" = yes; then
460141b2f0bdSmrg	    $show "generating symbol list for \`$output'"
460241b2f0bdSmrg
460341b2f0bdSmrg	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
460441b2f0bdSmrg
460541b2f0bdSmrg	    # Add our own program objects to the symbol list.
460641b2f0bdSmrg	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
460741b2f0bdSmrg	    for arg in $progfiles; do
460841b2f0bdSmrg	      $show "extracting global C symbols from \`$arg'"
460941b2f0bdSmrg	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
461041b2f0bdSmrg	    done
461141b2f0bdSmrg
461241b2f0bdSmrg	    if test -n "$exclude_expsyms"; then
461341b2f0bdSmrg	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
461441b2f0bdSmrg	      $run eval '$mv "$nlist"T "$nlist"'
461541b2f0bdSmrg	    fi
461641b2f0bdSmrg
461741b2f0bdSmrg	    if test -n "$export_symbols_regex"; then
461841b2f0bdSmrg	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
461941b2f0bdSmrg	      $run eval '$mv "$nlist"T "$nlist"'
462041b2f0bdSmrg	    fi
462141b2f0bdSmrg
462241b2f0bdSmrg	    # Prepare the list of exported symbols
462341b2f0bdSmrg	    if test -z "$export_symbols"; then
462441b2f0bdSmrg	      export_symbols="$output_objdir/$outputname.exp"
462541b2f0bdSmrg	      $run $rm $export_symbols
462641b2f0bdSmrg	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
462741b2f0bdSmrg              case $host in
462841b2f0bdSmrg              *cygwin* | *mingw* )
462941b2f0bdSmrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
463041b2f0bdSmrg		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
463141b2f0bdSmrg                ;;
463241b2f0bdSmrg              esac
463341b2f0bdSmrg	    else
463441b2f0bdSmrg	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
463541b2f0bdSmrg	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
463641b2f0bdSmrg	      $run eval 'mv "$nlist"T "$nlist"'
463741b2f0bdSmrg              case $host in
463841b2f0bdSmrg              *cygwin* | *mingw* )
463941b2f0bdSmrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
464041b2f0bdSmrg		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
464141b2f0bdSmrg                ;;
464241b2f0bdSmrg              esac
464341b2f0bdSmrg	    fi
464441b2f0bdSmrg	  fi
464541b2f0bdSmrg
464641b2f0bdSmrg	  for arg in $dlprefiles; do
464741b2f0bdSmrg	    $show "extracting global C symbols from \`$arg'"
464841b2f0bdSmrg	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
464941b2f0bdSmrg	    $run eval '$echo ": $name " >> "$nlist"'
465041b2f0bdSmrg	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
465141b2f0bdSmrg	  done
465241b2f0bdSmrg
465341b2f0bdSmrg	  if test -z "$run"; then
465441b2f0bdSmrg	    # Make sure we have at least an empty file.
465541b2f0bdSmrg	    test -f "$nlist" || : > "$nlist"
465641b2f0bdSmrg
465741b2f0bdSmrg	    if test -n "$exclude_expsyms"; then
465841b2f0bdSmrg	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
465941b2f0bdSmrg	      $mv "$nlist"T "$nlist"
466041b2f0bdSmrg	    fi
466141b2f0bdSmrg
466241b2f0bdSmrg	    # Try sorting and uniquifying the output.
466341b2f0bdSmrg	    if grep -v "^: " < "$nlist" |
466441b2f0bdSmrg		if sort -k 3 </dev/null >/dev/null 2>&1; then
466541b2f0bdSmrg		  sort -k 3
466641b2f0bdSmrg		else
466741b2f0bdSmrg		  sort +2
466841b2f0bdSmrg		fi |
466941b2f0bdSmrg		uniq > "$nlist"S; then
467041b2f0bdSmrg	      :
467141b2f0bdSmrg	    else
467241b2f0bdSmrg	      grep -v "^: " < "$nlist" > "$nlist"S
467341b2f0bdSmrg	    fi
467441b2f0bdSmrg
467541b2f0bdSmrg	    if test -f "$nlist"S; then
467641b2f0bdSmrg	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
467741b2f0bdSmrg	    else
467841b2f0bdSmrg	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
467941b2f0bdSmrg	    fi
468041b2f0bdSmrg
468141b2f0bdSmrg	    $echo >> "$output_objdir/$dlsyms" "\
468241b2f0bdSmrg
468341b2f0bdSmrg#undef lt_preloaded_symbols
468441b2f0bdSmrg
468541b2f0bdSmrg#if defined (__STDC__) && __STDC__
468641b2f0bdSmrg# define lt_ptr void *
468741b2f0bdSmrg#else
468841b2f0bdSmrg# define lt_ptr char *
468941b2f0bdSmrg# define const
469041b2f0bdSmrg#endif
469141b2f0bdSmrg
469241b2f0bdSmrg/* The mapping between symbol names and symbols. */
469341b2f0bdSmrg"
469441b2f0bdSmrg
469541b2f0bdSmrg	    case $host in
469641b2f0bdSmrg	    *cygwin* | *mingw* )
469741b2f0bdSmrg	  $echo >> "$output_objdir/$dlsyms" "\
469841b2f0bdSmrg/* DATA imports from DLLs on WIN32 can't be const, because
469941b2f0bdSmrg   runtime relocations are performed -- see ld's documentation
470041b2f0bdSmrg   on pseudo-relocs */
470141b2f0bdSmrgstruct {
470241b2f0bdSmrg"
470341b2f0bdSmrg	      ;;
470441b2f0bdSmrg	    * )
470541b2f0bdSmrg	  $echo >> "$output_objdir/$dlsyms" "\
470641b2f0bdSmrgconst struct {
470741b2f0bdSmrg"
470841b2f0bdSmrg	      ;;
470941b2f0bdSmrg	    esac
471041b2f0bdSmrg
471141b2f0bdSmrg
471241b2f0bdSmrg	  $echo >> "$output_objdir/$dlsyms" "\
471341b2f0bdSmrg  const char *name;
471441b2f0bdSmrg  lt_ptr address;
471541b2f0bdSmrg}
471641b2f0bdSmrglt_preloaded_symbols[] =
471741b2f0bdSmrg{\
471841b2f0bdSmrg"
471941b2f0bdSmrg
472041b2f0bdSmrg	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
472141b2f0bdSmrg
472241b2f0bdSmrg	    $echo >> "$output_objdir/$dlsyms" "\
472341b2f0bdSmrg  {0, (lt_ptr) 0}
472441b2f0bdSmrg};
472541b2f0bdSmrg
472641b2f0bdSmrg/* This works around a problem in FreeBSD linker */
472741b2f0bdSmrg#ifdef FREEBSD_WORKAROUND
472841b2f0bdSmrgstatic const void *lt_preloaded_setup() {
472941b2f0bdSmrg  return lt_preloaded_symbols;
473041b2f0bdSmrg}
473141b2f0bdSmrg#endif
473241b2f0bdSmrg
473341b2f0bdSmrg#ifdef __cplusplus
473441b2f0bdSmrg}
473541b2f0bdSmrg#endif\
473641b2f0bdSmrg"
473741b2f0bdSmrg	  fi
473841b2f0bdSmrg
473941b2f0bdSmrg	  pic_flag_for_symtable=
474041b2f0bdSmrg	  case $host in
474141b2f0bdSmrg	  # compiling the symbol table file with pic_flag works around
474241b2f0bdSmrg	  # a FreeBSD bug that causes programs to crash when -lm is
474341b2f0bdSmrg	  # linked before any other PIC object.  But we must not use
474441b2f0bdSmrg	  # pic_flag when linking with -static.  The problem exists in
474541b2f0bdSmrg	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
474641b2f0bdSmrg	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
474741b2f0bdSmrg	    case "$compile_command " in
474841b2f0bdSmrg	    *" -static "*) ;;
474941b2f0bdSmrg	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
475041b2f0bdSmrg	    esac;;
475141b2f0bdSmrg	  *-*-hpux*)
475241b2f0bdSmrg	    case "$compile_command " in
475341b2f0bdSmrg	    *" -static "*) ;;
475441b2f0bdSmrg	    *) pic_flag_for_symtable=" $pic_flag";;
475541b2f0bdSmrg	    esac
475641b2f0bdSmrg	  esac
475741b2f0bdSmrg
475841b2f0bdSmrg	  # Now compile the dynamic symbol file.
475941b2f0bdSmrg	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
476041b2f0bdSmrg	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
476141b2f0bdSmrg
476241b2f0bdSmrg	  # Clean up the generated files.
476341b2f0bdSmrg	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
476441b2f0bdSmrg	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
476541b2f0bdSmrg
476641b2f0bdSmrg	  # Transform the symbol file into the correct name.
476741b2f0bdSmrg          case $host in
476841b2f0bdSmrg          *cygwin* | *mingw* )
476941b2f0bdSmrg            if test -f "$output_objdir/${outputname}.def" ; then
477011245024Smrg              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
477111245024Smrg              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
477241b2f0bdSmrg            else
477311245024Smrg              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
477411245024Smrg              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
477541b2f0bdSmrg             fi
477641b2f0bdSmrg            ;;
477741b2f0bdSmrg          * )
477811245024Smrg            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
477911245024Smrg            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
478041b2f0bdSmrg            ;;
478141b2f0bdSmrg          esac
478241b2f0bdSmrg	  ;;
478341b2f0bdSmrg	*)
478441b2f0bdSmrg	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
478541b2f0bdSmrg	  exit $EXIT_FAILURE
478641b2f0bdSmrg	  ;;
478741b2f0bdSmrg	esac
478841b2f0bdSmrg      else
478941b2f0bdSmrg	# We keep going just in case the user didn't refer to
479041b2f0bdSmrg	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
479141b2f0bdSmrg	# really was required.
479241b2f0bdSmrg
479341b2f0bdSmrg	# Nullify the symbol file.
479411245024Smrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
479511245024Smrg	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
479641b2f0bdSmrg      fi
479741b2f0bdSmrg
479841b2f0bdSmrg      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
479941b2f0bdSmrg	# Replace the output file specification.
480011245024Smrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
480141b2f0bdSmrg	link_command="$compile_command$compile_rpath"
480241b2f0bdSmrg
480341b2f0bdSmrg	# We have no uninstalled library dependencies, so finalize right now.
480441b2f0bdSmrg	$show "$link_command"
480541b2f0bdSmrg	$run eval "$link_command"
480641b2f0bdSmrg	exit_status=$?
480741b2f0bdSmrg
480841b2f0bdSmrg	# Delete the generated files.
480941b2f0bdSmrg	if test -n "$dlsyms"; then
481041b2f0bdSmrg	  $show "$rm $output_objdir/${outputname}S.${objext}"
481141b2f0bdSmrg	  $run $rm "$output_objdir/${outputname}S.${objext}"
481241b2f0bdSmrg	fi
481341b2f0bdSmrg
481441b2f0bdSmrg	exit $exit_status
481541b2f0bdSmrg      fi
481641b2f0bdSmrg
481741b2f0bdSmrg      if test -n "$shlibpath_var"; then
481841b2f0bdSmrg	# We should set the shlibpath_var
481941b2f0bdSmrg	rpath=
482041b2f0bdSmrg	for dir in $temp_rpath; do
482141b2f0bdSmrg	  case $dir in
482241b2f0bdSmrg	  [\\/]* | [A-Za-z]:[\\/]*)
482341b2f0bdSmrg	    # Absolute path.
482441b2f0bdSmrg	    rpath="$rpath$dir:"
482541b2f0bdSmrg	    ;;
482641b2f0bdSmrg	  *)
482741b2f0bdSmrg	    # Relative path: add a thisdir entry.
482841b2f0bdSmrg	    rpath="$rpath\$thisdir/$dir:"
482941b2f0bdSmrg	    ;;
483041b2f0bdSmrg	  esac
483141b2f0bdSmrg	done
483241b2f0bdSmrg	temp_rpath="$rpath"
483341b2f0bdSmrg      fi
483441b2f0bdSmrg
483541b2f0bdSmrg      if test -n "$compile_shlibpath$finalize_shlibpath"; then
483641b2f0bdSmrg	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
483741b2f0bdSmrg      fi
483841b2f0bdSmrg      if test -n "$finalize_shlibpath"; then
483941b2f0bdSmrg	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
484041b2f0bdSmrg      fi
484141b2f0bdSmrg
484241b2f0bdSmrg      compile_var=
484341b2f0bdSmrg      finalize_var=
484441b2f0bdSmrg      if test -n "$runpath_var"; then
484541b2f0bdSmrg	if test -n "$perm_rpath"; then
484641b2f0bdSmrg	  # We should set the runpath_var.
484741b2f0bdSmrg	  rpath=
484841b2f0bdSmrg	  for dir in $perm_rpath; do
484941b2f0bdSmrg	    rpath="$rpath$dir:"
485041b2f0bdSmrg	  done
485141b2f0bdSmrg	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
485241b2f0bdSmrg	fi
485341b2f0bdSmrg	if test -n "$finalize_perm_rpath"; then
485441b2f0bdSmrg	  # We should set the runpath_var.
485541b2f0bdSmrg	  rpath=
485641b2f0bdSmrg	  for dir in $finalize_perm_rpath; do
485741b2f0bdSmrg	    rpath="$rpath$dir:"
485841b2f0bdSmrg	  done
485941b2f0bdSmrg	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
486041b2f0bdSmrg	fi
486141b2f0bdSmrg      fi
486241b2f0bdSmrg
486341b2f0bdSmrg      if test "$no_install" = yes; then
486441b2f0bdSmrg	# We don't need to create a wrapper script.
486541b2f0bdSmrg	link_command="$compile_var$compile_command$compile_rpath"
486641b2f0bdSmrg	# Replace the output file specification.
486741b2f0bdSmrg	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
486841b2f0bdSmrg	# Delete the old output file.
486941b2f0bdSmrg	$run $rm $output
487041b2f0bdSmrg	# Link the executable and exit
487141b2f0bdSmrg	$show "$link_command"
487241b2f0bdSmrg	$run eval "$link_command" || exit $?
487341b2f0bdSmrg	exit $EXIT_SUCCESS
487441b2f0bdSmrg      fi
487541b2f0bdSmrg
487641b2f0bdSmrg      if test "$hardcode_action" = relink; then
487741b2f0bdSmrg	# Fast installation is not supported
487841b2f0bdSmrg	link_command="$compile_var$compile_command$compile_rpath"
487941b2f0bdSmrg	relink_command="$finalize_var$finalize_command$finalize_rpath"
488041b2f0bdSmrg
488141b2f0bdSmrg	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
488241b2f0bdSmrg	$echo "$modename: \`$output' will be relinked during installation" 1>&2
488341b2f0bdSmrg      else
488441b2f0bdSmrg	if test "$fast_install" != no; then
488541b2f0bdSmrg	  link_command="$finalize_var$compile_command$finalize_rpath"
488641b2f0bdSmrg	  if test "$fast_install" = yes; then
488711245024Smrg	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
488841b2f0bdSmrg	  else
488941b2f0bdSmrg	    # fast_install is set to needless
489041b2f0bdSmrg	    relink_command=
489141b2f0bdSmrg	  fi
489241b2f0bdSmrg	else
489341b2f0bdSmrg	  link_command="$compile_var$compile_command$compile_rpath"
489441b2f0bdSmrg	  relink_command="$finalize_var$finalize_command$finalize_rpath"
489541b2f0bdSmrg	fi
489641b2f0bdSmrg      fi
489741b2f0bdSmrg
489841b2f0bdSmrg      # Replace the output file specification.
489941b2f0bdSmrg      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
490041b2f0bdSmrg
490141b2f0bdSmrg      # Delete the old output files.
490241b2f0bdSmrg      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
490341b2f0bdSmrg
490441b2f0bdSmrg      $show "$link_command"
490541b2f0bdSmrg      $run eval "$link_command" || exit $?
490641b2f0bdSmrg
490741b2f0bdSmrg      # Now create the wrapper script.
490841b2f0bdSmrg      $show "creating $output"
490941b2f0bdSmrg
491041b2f0bdSmrg      # Quote the relink command for shipping.
491141b2f0bdSmrg      if test -n "$relink_command"; then
491241b2f0bdSmrg	# Preserve any variables that may affect compiler behavior
491341b2f0bdSmrg	for var in $variables_saved_for_relink; do
491441b2f0bdSmrg	  if eval test -z \"\${$var+set}\"; then
491541b2f0bdSmrg	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
491641b2f0bdSmrg	  elif eval var_value=\$$var; test -z "$var_value"; then
491741b2f0bdSmrg	    relink_command="$var=; export $var; $relink_command"
491841b2f0bdSmrg	  else
491941b2f0bdSmrg	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
492041b2f0bdSmrg	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
492141b2f0bdSmrg	  fi
492241b2f0bdSmrg	done
492341b2f0bdSmrg	relink_command="(cd `pwd`; $relink_command)"
492411245024Smrg	relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
492541b2f0bdSmrg      fi
492641b2f0bdSmrg
492741b2f0bdSmrg      # Quote $echo for shipping.
492841b2f0bdSmrg      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
492941b2f0bdSmrg	case $progpath in
493041b2f0bdSmrg	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
493141b2f0bdSmrg	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
493241b2f0bdSmrg	esac
493341b2f0bdSmrg	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
493441b2f0bdSmrg      else
493541b2f0bdSmrg	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
493641b2f0bdSmrg      fi
493741b2f0bdSmrg
493841b2f0bdSmrg      # Only actually do things if our run command is non-null.
493941b2f0bdSmrg      if test -z "$run"; then
494041b2f0bdSmrg	# win32 will think the script is a binary if it has
494141b2f0bdSmrg	# a .exe suffix, so we strip it off here.
494241b2f0bdSmrg	case $output in
494341b2f0bdSmrg	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
494441b2f0bdSmrg	esac
494541b2f0bdSmrg	# test for cygwin because mv fails w/o .exe extensions
494641b2f0bdSmrg	case $host in
494741b2f0bdSmrg	  *cygwin*)
494841b2f0bdSmrg	    exeext=.exe
494941b2f0bdSmrg	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
495041b2f0bdSmrg	  *) exeext= ;;
495141b2f0bdSmrg	esac
495241b2f0bdSmrg	case $host in
495341b2f0bdSmrg	  *cygwin* | *mingw* )
495441b2f0bdSmrg            output_name=`basename $output`
495541b2f0bdSmrg            output_path=`dirname $output`
495641b2f0bdSmrg            cwrappersource="$output_path/$objdir/lt-$output_name.c"
495741b2f0bdSmrg            cwrapper="$output_path/$output_name.exe"
495841b2f0bdSmrg            $rm $cwrappersource $cwrapper
495941b2f0bdSmrg            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
496041b2f0bdSmrg
496141b2f0bdSmrg	    cat > $cwrappersource <<EOF
496241b2f0bdSmrg
496341b2f0bdSmrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
496441b2f0bdSmrg   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
496541b2f0bdSmrg
496641b2f0bdSmrg   The $output program cannot be directly executed until all the libtool
496741b2f0bdSmrg   libraries that it depends on are installed.
496841b2f0bdSmrg
496941b2f0bdSmrg   This wrapper executable should never be moved out of the build directory.
497041b2f0bdSmrg   If it is, it will not operate correctly.
497141b2f0bdSmrg
497241b2f0bdSmrg   Currently, it simply execs the wrapper *script* "/bin/sh $output",
497341b2f0bdSmrg   but could eventually absorb all of the scripts functionality and
497441b2f0bdSmrg   exec $objdir/$outputname directly.
497541b2f0bdSmrg*/
497641b2f0bdSmrgEOF
497741b2f0bdSmrg	    cat >> $cwrappersource<<"EOF"
497841b2f0bdSmrg#include <stdio.h>
497941b2f0bdSmrg#include <stdlib.h>
498041b2f0bdSmrg#include <unistd.h>
498141b2f0bdSmrg#include <malloc.h>
498241b2f0bdSmrg#include <stdarg.h>
498341b2f0bdSmrg#include <assert.h>
498441b2f0bdSmrg#include <string.h>
498541b2f0bdSmrg#include <ctype.h>
498641b2f0bdSmrg#include <sys/stat.h>
498741b2f0bdSmrg
498841b2f0bdSmrg#if defined(PATH_MAX)
498941b2f0bdSmrg# define LT_PATHMAX PATH_MAX
499041b2f0bdSmrg#elif defined(MAXPATHLEN)
499141b2f0bdSmrg# define LT_PATHMAX MAXPATHLEN
499241b2f0bdSmrg#else
499341b2f0bdSmrg# define LT_PATHMAX 1024
499441b2f0bdSmrg#endif
499541b2f0bdSmrg
499641b2f0bdSmrg#ifndef DIR_SEPARATOR
499741b2f0bdSmrg# define DIR_SEPARATOR '/'
499841b2f0bdSmrg# define PATH_SEPARATOR ':'
499941b2f0bdSmrg#endif
500041b2f0bdSmrg
500141b2f0bdSmrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
500241b2f0bdSmrg  defined (__OS2__)
500341b2f0bdSmrg# define HAVE_DOS_BASED_FILE_SYSTEM
500441b2f0bdSmrg# ifndef DIR_SEPARATOR_2
500541b2f0bdSmrg#  define DIR_SEPARATOR_2 '\\'
500641b2f0bdSmrg# endif
500741b2f0bdSmrg# ifndef PATH_SEPARATOR_2
500841b2f0bdSmrg#  define PATH_SEPARATOR_2 ';'
500941b2f0bdSmrg# endif
501041b2f0bdSmrg#endif
501141b2f0bdSmrg
501241b2f0bdSmrg#ifndef DIR_SEPARATOR_2
501341b2f0bdSmrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
501441b2f0bdSmrg#else /* DIR_SEPARATOR_2 */
501541b2f0bdSmrg# define IS_DIR_SEPARATOR(ch) \
501641b2f0bdSmrg        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
501741b2f0bdSmrg#endif /* DIR_SEPARATOR_2 */
501841b2f0bdSmrg
501941b2f0bdSmrg#ifndef PATH_SEPARATOR_2
502041b2f0bdSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
502141b2f0bdSmrg#else /* PATH_SEPARATOR_2 */
502241b2f0bdSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
502341b2f0bdSmrg#endif /* PATH_SEPARATOR_2 */
502441b2f0bdSmrg
502541b2f0bdSmrg#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
502641b2f0bdSmrg#define XFREE(stale) do { \
502741b2f0bdSmrg  if (stale) { free ((void *) stale); stale = 0; } \
502841b2f0bdSmrg} while (0)
502941b2f0bdSmrg
503041b2f0bdSmrg/* -DDEBUG is fairly common in CFLAGS.  */
503141b2f0bdSmrg#undef DEBUG
503241b2f0bdSmrg#if defined DEBUGWRAPPER
503341b2f0bdSmrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
503441b2f0bdSmrg#else
503541b2f0bdSmrg# define DEBUG(format, ...)
503641b2f0bdSmrg#endif
503741b2f0bdSmrg
503841b2f0bdSmrgconst char *program_name = NULL;
503941b2f0bdSmrg
504041b2f0bdSmrgvoid * xmalloc (size_t num);
504141b2f0bdSmrgchar * xstrdup (const char *string);
504241b2f0bdSmrgconst char * base_name (const char *name);
504341b2f0bdSmrgchar * find_executable(const char *wrapper);
504441b2f0bdSmrgint    check_executable(const char *path);
504541b2f0bdSmrgchar * strendzap(char *str, const char *pat);
504641b2f0bdSmrgvoid lt_fatal (const char *message, ...);
504741b2f0bdSmrg
504841b2f0bdSmrgint
504941b2f0bdSmrgmain (int argc, char *argv[])
505041b2f0bdSmrg{
505141b2f0bdSmrg  char **newargz;
505241b2f0bdSmrg  int i;
505341b2f0bdSmrg
505441b2f0bdSmrg  program_name = (char *) xstrdup (base_name (argv[0]));
505541b2f0bdSmrg  DEBUG("(main) argv[0]      : %s\n",argv[0]);
505641b2f0bdSmrg  DEBUG("(main) program_name : %s\n",program_name);
505741b2f0bdSmrg  newargz = XMALLOC(char *, argc+2);
505841b2f0bdSmrgEOF
505941b2f0bdSmrg
506041b2f0bdSmrg            cat >> $cwrappersource <<EOF
506141b2f0bdSmrg  newargz[0] = (char *) xstrdup("$SHELL");
506241b2f0bdSmrgEOF
506341b2f0bdSmrg
506441b2f0bdSmrg            cat >> $cwrappersource <<"EOF"
506541b2f0bdSmrg  newargz[1] = find_executable(argv[0]);
506641b2f0bdSmrg  if (newargz[1] == NULL)
506741b2f0bdSmrg    lt_fatal("Couldn't find %s", argv[0]);
506841b2f0bdSmrg  DEBUG("(main) found exe at : %s\n",newargz[1]);
506941b2f0bdSmrg  /* we know the script has the same name, without the .exe */
507041b2f0bdSmrg  /* so make sure newargz[1] doesn't end in .exe */
507141b2f0bdSmrg  strendzap(newargz[1],".exe");
507241b2f0bdSmrg  for (i = 1; i < argc; i++)
507341b2f0bdSmrg    newargz[i+1] = xstrdup(argv[i]);
507441b2f0bdSmrg  newargz[argc+1] = NULL;
507541b2f0bdSmrg
507641b2f0bdSmrg  for (i=0; i<argc+1; i++)
507741b2f0bdSmrg  {
507841b2f0bdSmrg    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
507941b2f0bdSmrg    ;
508041b2f0bdSmrg  }
508141b2f0bdSmrg
508241b2f0bdSmrgEOF
508341b2f0bdSmrg
508441b2f0bdSmrg            case $host_os in
508541b2f0bdSmrg              mingw*)
508641b2f0bdSmrg                cat >> $cwrappersource <<EOF
508741b2f0bdSmrg  execv("$SHELL",(char const **)newargz);
508841b2f0bdSmrgEOF
508941b2f0bdSmrg              ;;
509041b2f0bdSmrg              *)
509141b2f0bdSmrg                cat >> $cwrappersource <<EOF
509241b2f0bdSmrg  execv("$SHELL",newargz);
509341b2f0bdSmrgEOF
509441b2f0bdSmrg              ;;
509541b2f0bdSmrg            esac
509641b2f0bdSmrg
509741b2f0bdSmrg            cat >> $cwrappersource <<"EOF"
509841b2f0bdSmrg  return 127;
509941b2f0bdSmrg}
510041b2f0bdSmrg
510141b2f0bdSmrgvoid *
510241b2f0bdSmrgxmalloc (size_t num)
510341b2f0bdSmrg{
510441b2f0bdSmrg  void * p = (void *) malloc (num);
510541b2f0bdSmrg  if (!p)
510641b2f0bdSmrg    lt_fatal ("Memory exhausted");
510741b2f0bdSmrg
510841b2f0bdSmrg  return p;
510941b2f0bdSmrg}
511041b2f0bdSmrg
511141b2f0bdSmrgchar *
511241b2f0bdSmrgxstrdup (const char *string)
511341b2f0bdSmrg{
511441b2f0bdSmrg  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
511541b2f0bdSmrg;
511641b2f0bdSmrg}
511741b2f0bdSmrg
511841b2f0bdSmrgconst char *
511941b2f0bdSmrgbase_name (const char *name)
512041b2f0bdSmrg{
512141b2f0bdSmrg  const char *base;
512241b2f0bdSmrg
512341b2f0bdSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
512441b2f0bdSmrg  /* Skip over the disk name in MSDOS pathnames. */
512541b2f0bdSmrg  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
512641b2f0bdSmrg    name += 2;
512741b2f0bdSmrg#endif
512841b2f0bdSmrg
512941b2f0bdSmrg  for (base = name; *name; name++)
513041b2f0bdSmrg    if (IS_DIR_SEPARATOR (*name))
513141b2f0bdSmrg      base = name + 1;
513241b2f0bdSmrg  return base;
513341b2f0bdSmrg}
513441b2f0bdSmrg
513541b2f0bdSmrgint
513641b2f0bdSmrgcheck_executable(const char * path)
513741b2f0bdSmrg{
513841b2f0bdSmrg  struct stat st;
513941b2f0bdSmrg
514041b2f0bdSmrg  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
514141b2f0bdSmrg  if ((!path) || (!*path))
514241b2f0bdSmrg    return 0;
514341b2f0bdSmrg
514441b2f0bdSmrg  if ((stat (path, &st) >= 0) &&
514541b2f0bdSmrg      (
514641b2f0bdSmrg        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
514741b2f0bdSmrg#if defined (S_IXOTH)
514841b2f0bdSmrg       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
514941b2f0bdSmrg#endif
515041b2f0bdSmrg#if defined (S_IXGRP)
515141b2f0bdSmrg       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
515241b2f0bdSmrg#endif
515341b2f0bdSmrg       ((st.st_mode & S_IXUSR) == S_IXUSR))
515441b2f0bdSmrg      )
515541b2f0bdSmrg    return 1;
515641b2f0bdSmrg  else
515741b2f0bdSmrg    return 0;
515841b2f0bdSmrg}
515941b2f0bdSmrg
516041b2f0bdSmrg/* Searches for the full path of the wrapper.  Returns
516141b2f0bdSmrg   newly allocated full path name if found, NULL otherwise */
516241b2f0bdSmrgchar *
516341b2f0bdSmrgfind_executable (const char* wrapper)
516441b2f0bdSmrg{
516541b2f0bdSmrg  int has_slash = 0;
516641b2f0bdSmrg  const char* p;
516741b2f0bdSmrg  const char* p_next;
516841b2f0bdSmrg  /* static buffer for getcwd */
516941b2f0bdSmrg  char tmp[LT_PATHMAX + 1];
517041b2f0bdSmrg  int tmp_len;
517141b2f0bdSmrg  char* concat_name;
517241b2f0bdSmrg
517341b2f0bdSmrg  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
517441b2f0bdSmrg
517541b2f0bdSmrg  if ((wrapper == NULL) || (*wrapper == '\0'))
517641b2f0bdSmrg    return NULL;
517741b2f0bdSmrg
517841b2f0bdSmrg  /* Absolute path? */
517941b2f0bdSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
518041b2f0bdSmrg  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
518141b2f0bdSmrg  {
518241b2f0bdSmrg    concat_name = xstrdup (wrapper);
518341b2f0bdSmrg    if (check_executable(concat_name))
518441b2f0bdSmrg      return concat_name;
518541b2f0bdSmrg    XFREE(concat_name);
518641b2f0bdSmrg  }
518741b2f0bdSmrg  else
518841b2f0bdSmrg  {
518941b2f0bdSmrg#endif
519041b2f0bdSmrg    if (IS_DIR_SEPARATOR (wrapper[0]))
519141b2f0bdSmrg    {
519241b2f0bdSmrg      concat_name = xstrdup (wrapper);
519341b2f0bdSmrg      if (check_executable(concat_name))
519441b2f0bdSmrg        return concat_name;
519541b2f0bdSmrg      XFREE(concat_name);
519641b2f0bdSmrg    }
519741b2f0bdSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
519841b2f0bdSmrg  }
519941b2f0bdSmrg#endif
520041b2f0bdSmrg
520141b2f0bdSmrg  for (p = wrapper; *p; p++)
520241b2f0bdSmrg    if (*p == '/')
520341b2f0bdSmrg    {
520441b2f0bdSmrg      has_slash = 1;
520541b2f0bdSmrg      break;
520641b2f0bdSmrg    }
520741b2f0bdSmrg  if (!has_slash)
520841b2f0bdSmrg  {
520941b2f0bdSmrg    /* no slashes; search PATH */
521041b2f0bdSmrg    const char* path = getenv ("PATH");
521141b2f0bdSmrg    if (path != NULL)
521241b2f0bdSmrg    {
521341b2f0bdSmrg      for (p = path; *p; p = p_next)
521441b2f0bdSmrg      {
521541b2f0bdSmrg        const char* q;
521641b2f0bdSmrg        size_t p_len;
521741b2f0bdSmrg        for (q = p; *q; q++)
521841b2f0bdSmrg          if (IS_PATH_SEPARATOR(*q))
521941b2f0bdSmrg            break;
522041b2f0bdSmrg        p_len = q - p;
522141b2f0bdSmrg        p_next = (*q == '\0' ? q : q + 1);
522241b2f0bdSmrg        if (p_len == 0)
522341b2f0bdSmrg        {
522441b2f0bdSmrg          /* empty path: current directory */
522541b2f0bdSmrg          if (getcwd (tmp, LT_PATHMAX) == NULL)
522641b2f0bdSmrg            lt_fatal ("getcwd failed");
522741b2f0bdSmrg          tmp_len = strlen(tmp);
522841b2f0bdSmrg          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
522941b2f0bdSmrg          memcpy (concat_name, tmp, tmp_len);
523041b2f0bdSmrg          concat_name[tmp_len] = '/';
523141b2f0bdSmrg          strcpy (concat_name + tmp_len + 1, wrapper);
523241b2f0bdSmrg        }
523341b2f0bdSmrg        else
523441b2f0bdSmrg        {
523541b2f0bdSmrg          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
523641b2f0bdSmrg          memcpy (concat_name, p, p_len);
523741b2f0bdSmrg          concat_name[p_len] = '/';
523841b2f0bdSmrg          strcpy (concat_name + p_len + 1, wrapper);
523941b2f0bdSmrg        }
524041b2f0bdSmrg        if (check_executable(concat_name))
524141b2f0bdSmrg          return concat_name;
524241b2f0bdSmrg        XFREE(concat_name);
524341b2f0bdSmrg      }
524441b2f0bdSmrg    }
524541b2f0bdSmrg    /* not found in PATH; assume curdir */
524641b2f0bdSmrg  }
524741b2f0bdSmrg  /* Relative path | not found in path: prepend cwd */
524841b2f0bdSmrg  if (getcwd (tmp, LT_PATHMAX) == NULL)
524941b2f0bdSmrg    lt_fatal ("getcwd failed");
525041b2f0bdSmrg  tmp_len = strlen(tmp);
525141b2f0bdSmrg  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
525241b2f0bdSmrg  memcpy (concat_name, tmp, tmp_len);
525341b2f0bdSmrg  concat_name[tmp_len] = '/';
525441b2f0bdSmrg  strcpy (concat_name + tmp_len + 1, wrapper);
525541b2f0bdSmrg
525641b2f0bdSmrg  if (check_executable(concat_name))
525741b2f0bdSmrg    return concat_name;
525841b2f0bdSmrg  XFREE(concat_name);
525941b2f0bdSmrg  return NULL;
526041b2f0bdSmrg}
526141b2f0bdSmrg
526241b2f0bdSmrgchar *
526341b2f0bdSmrgstrendzap(char *str, const char *pat)
526441b2f0bdSmrg{
526541b2f0bdSmrg  size_t len, patlen;
526641b2f0bdSmrg
526741b2f0bdSmrg  assert(str != NULL);
526841b2f0bdSmrg  assert(pat != NULL);
526941b2f0bdSmrg
527041b2f0bdSmrg  len = strlen(str);
527141b2f0bdSmrg  patlen = strlen(pat);
527241b2f0bdSmrg
527341b2f0bdSmrg  if (patlen <= len)
527441b2f0bdSmrg  {
527541b2f0bdSmrg    str += len - patlen;
527641b2f0bdSmrg    if (strcmp(str, pat) == 0)
527741b2f0bdSmrg      *str = '\0';
527841b2f0bdSmrg  }
527941b2f0bdSmrg  return str;
528041b2f0bdSmrg}
528141b2f0bdSmrg
528241b2f0bdSmrgstatic void
528341b2f0bdSmrglt_error_core (int exit_status, const char * mode,
528441b2f0bdSmrg          const char * message, va_list ap)
528541b2f0bdSmrg{
528641b2f0bdSmrg  fprintf (stderr, "%s: %s: ", program_name, mode);
528741b2f0bdSmrg  vfprintf (stderr, message, ap);
528841b2f0bdSmrg  fprintf (stderr, ".\n");
528941b2f0bdSmrg
529041b2f0bdSmrg  if (exit_status >= 0)
529141b2f0bdSmrg    exit (exit_status);
529241b2f0bdSmrg}
529341b2f0bdSmrg
529441b2f0bdSmrgvoid
529541b2f0bdSmrglt_fatal (const char *message, ...)
529641b2f0bdSmrg{
529741b2f0bdSmrg  va_list ap;
529841b2f0bdSmrg  va_start (ap, message);
529941b2f0bdSmrg  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
530041b2f0bdSmrg  va_end (ap);
530141b2f0bdSmrg}
530241b2f0bdSmrgEOF
530341b2f0bdSmrg          # we should really use a build-platform specific compiler
530441b2f0bdSmrg          # here, but OTOH, the wrappers (shell script and this C one)
530541b2f0bdSmrg          # are only useful if you want to execute the "real" binary.
530641b2f0bdSmrg          # Since the "real" binary is built for $host, then this
530741b2f0bdSmrg          # wrapper might as well be built for $host, too.
530841b2f0bdSmrg          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
530941b2f0bdSmrg          ;;
531041b2f0bdSmrg        esac
531141b2f0bdSmrg        $rm $output
531241b2f0bdSmrg        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
531341b2f0bdSmrg
531441b2f0bdSmrg	$echo > $output "\
531541b2f0bdSmrg#! $SHELL
531641b2f0bdSmrg
531741b2f0bdSmrg# $output - temporary wrapper script for $objdir/$outputname
531841b2f0bdSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
531941b2f0bdSmrg#
532041b2f0bdSmrg# The $output program cannot be directly executed until all the libtool
532141b2f0bdSmrg# libraries that it depends on are installed.
532241b2f0bdSmrg#
532341b2f0bdSmrg# This wrapper script should never be moved out of the build directory.
532441b2f0bdSmrg# If it is, it will not operate correctly.
532541b2f0bdSmrg
532641b2f0bdSmrg# Sed substitution that helps us do robust quoting.  It backslashifies
532741b2f0bdSmrg# metacharacters that are still active within double-quoted strings.
532841b2f0bdSmrgXsed='${SED} -e 1s/^X//'
532941b2f0bdSmrgsed_quote_subst='$sed_quote_subst'
533041b2f0bdSmrg
533111245024Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
533211245024Smrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
533311245024Smrg  emulate sh
533411245024Smrg  NULLCMD=:
533511245024Smrg  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
533611245024Smrg  # is contrary to our usage.  Disable this feature.
533711245024Smrg  alias -g '\${1+\"\$@\"}'='\"\$@\"'
533811245024Smrg  setopt NO_GLOB_SUBST
533911245024Smrgelse
534011245024Smrg  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
534111245024Smrgfi
534211245024SmrgBIN_SH=xpg4; export BIN_SH # for Tru64
534311245024SmrgDUALCASE=1; export DUALCASE # for MKS sh
534411245024Smrg
534541b2f0bdSmrg# The HP-UX ksh and POSIX shell print the target directory to stdout
534641b2f0bdSmrg# if CDPATH is set.
534741b2f0bdSmrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
534841b2f0bdSmrg
534941b2f0bdSmrgrelink_command=\"$relink_command\"
535041b2f0bdSmrg
535141b2f0bdSmrg# This environment variable determines our operation mode.
535241b2f0bdSmrgif test \"\$libtool_install_magic\" = \"$magic\"; then
535341b2f0bdSmrg  # install mode needs the following variable:
535441b2f0bdSmrg  notinst_deplibs='$notinst_deplibs'
535541b2f0bdSmrgelse
535641b2f0bdSmrg  # When we are sourced in execute mode, \$file and \$echo are already set.
535741b2f0bdSmrg  if test \"\$libtool_execute_magic\" != \"$magic\"; then
535841b2f0bdSmrg    echo=\"$qecho\"
535941b2f0bdSmrg    file=\"\$0\"
536041b2f0bdSmrg    # Make sure echo works.
536141b2f0bdSmrg    if test \"X\$1\" = X--no-reexec; then
536241b2f0bdSmrg      # Discard the --no-reexec flag, and continue.
536341b2f0bdSmrg      shift
536441b2f0bdSmrg    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
536541b2f0bdSmrg      # Yippee, \$echo works!
536641b2f0bdSmrg      :
536741b2f0bdSmrg    else
536841b2f0bdSmrg      # Restart under the correct shell, and then maybe \$echo will work.
536941b2f0bdSmrg      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
537041b2f0bdSmrg    fi
537141b2f0bdSmrg  fi\
537241b2f0bdSmrg"
537341b2f0bdSmrg	$echo >> $output "\
537441b2f0bdSmrg
537541b2f0bdSmrg  # Find the directory that this script lives in.
537641b2f0bdSmrg  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
537741b2f0bdSmrg  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
537841b2f0bdSmrg
537941b2f0bdSmrg  # Follow symbolic links until we get to the real thisdir.
538041b2f0bdSmrg  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
538141b2f0bdSmrg  while test -n \"\$file\"; do
538241b2f0bdSmrg    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
538341b2f0bdSmrg
538441b2f0bdSmrg    # If there was a directory component, then change thisdir.
538541b2f0bdSmrg    if test \"x\$destdir\" != \"x\$file\"; then
538641b2f0bdSmrg      case \"\$destdir\" in
538741b2f0bdSmrg      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
538841b2f0bdSmrg      *) thisdir=\"\$thisdir/\$destdir\" ;;
538941b2f0bdSmrg      esac
539041b2f0bdSmrg    fi
539141b2f0bdSmrg
539241b2f0bdSmrg    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
539341b2f0bdSmrg    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
539441b2f0bdSmrg  done
539541b2f0bdSmrg
539641b2f0bdSmrg  # Try to get the absolute directory name.
539741b2f0bdSmrg  absdir=\`cd \"\$thisdir\" && pwd\`
539841b2f0bdSmrg  test -n \"\$absdir\" && thisdir=\"\$absdir\"
539941b2f0bdSmrg"
540041b2f0bdSmrg
540141b2f0bdSmrg	if test "$fast_install" = yes; then
540241b2f0bdSmrg	  $echo >> $output "\
540341b2f0bdSmrg  program=lt-'$outputname'$exeext
540441b2f0bdSmrg  progdir=\"\$thisdir/$objdir\"
540541b2f0bdSmrg
540641b2f0bdSmrg  if test ! -f \"\$progdir/\$program\" || \\
540741b2f0bdSmrg     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
540841b2f0bdSmrg       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
540941b2f0bdSmrg
541041b2f0bdSmrg    file=\"\$\$-\$program\"
541141b2f0bdSmrg
541241b2f0bdSmrg    if test ! -d \"\$progdir\"; then
541341b2f0bdSmrg      $mkdir \"\$progdir\"
541441b2f0bdSmrg    else
541541b2f0bdSmrg      $rm \"\$progdir/\$file\"
541641b2f0bdSmrg    fi"
541741b2f0bdSmrg
541841b2f0bdSmrg	  $echo >> $output "\
541941b2f0bdSmrg
542041b2f0bdSmrg    # relink executable if necessary
542141b2f0bdSmrg    if test -n \"\$relink_command\"; then
542241b2f0bdSmrg      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
542341b2f0bdSmrg      else
542441b2f0bdSmrg	$echo \"\$relink_command_output\" >&2
542541b2f0bdSmrg	$rm \"\$progdir/\$file\"
542641b2f0bdSmrg	exit $EXIT_FAILURE
542741b2f0bdSmrg      fi
542841b2f0bdSmrg    fi
542941b2f0bdSmrg
543041b2f0bdSmrg    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
543141b2f0bdSmrg    { $rm \"\$progdir/\$program\";
543241b2f0bdSmrg      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
543341b2f0bdSmrg    $rm \"\$progdir/\$file\"
543441b2f0bdSmrg  fi"
543541b2f0bdSmrg	else
543641b2f0bdSmrg	  $echo >> $output "\
543741b2f0bdSmrg  program='$outputname'
543841b2f0bdSmrg  progdir=\"\$thisdir/$objdir\"
543941b2f0bdSmrg"
544041b2f0bdSmrg	fi
544141b2f0bdSmrg
544241b2f0bdSmrg	$echo >> $output "\
544341b2f0bdSmrg
544441b2f0bdSmrg  if test -f \"\$progdir/\$program\"; then"
544541b2f0bdSmrg
544641b2f0bdSmrg	# Export our shlibpath_var if we have one.
544741b2f0bdSmrg	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
544841b2f0bdSmrg	  $echo >> $output "\
544941b2f0bdSmrg    # Add our own library path to $shlibpath_var
545041b2f0bdSmrg    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
545141b2f0bdSmrg
545241b2f0bdSmrg    # Some systems cannot cope with colon-terminated $shlibpath_var
545341b2f0bdSmrg    # The second colon is a workaround for a bug in BeOS R4 sed
545441b2f0bdSmrg    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
545541b2f0bdSmrg
545641b2f0bdSmrg    export $shlibpath_var
545741b2f0bdSmrg"
545841b2f0bdSmrg	fi
545941b2f0bdSmrg
546041b2f0bdSmrg	# fixup the dll searchpath if we need to.
546141b2f0bdSmrg	if test -n "$dllsearchpath"; then
546241b2f0bdSmrg	  $echo >> $output "\
546341b2f0bdSmrg    # Add the dll search path components to the executable PATH
546441b2f0bdSmrg    PATH=$dllsearchpath:\$PATH
546541b2f0bdSmrg"
546641b2f0bdSmrg	fi
546741b2f0bdSmrg
546841b2f0bdSmrg	$echo >> $output "\
546941b2f0bdSmrg    if test \"\$libtool_execute_magic\" != \"$magic\"; then
547041b2f0bdSmrg      # Run the actual program with our arguments.
547141b2f0bdSmrg"
547241b2f0bdSmrg	case $host in
547341b2f0bdSmrg	# Backslashes separate directories on plain windows
547441b2f0bdSmrg	*-*-mingw | *-*-os2*)
547541b2f0bdSmrg	  $echo >> $output "\
547641b2f0bdSmrg      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
547741b2f0bdSmrg"
547841b2f0bdSmrg	  ;;
547941b2f0bdSmrg
548041b2f0bdSmrg	*)
548141b2f0bdSmrg	  $echo >> $output "\
548241b2f0bdSmrg      exec \"\$progdir/\$program\" \${1+\"\$@\"}
548341b2f0bdSmrg"
548441b2f0bdSmrg	  ;;
548541b2f0bdSmrg	esac
548641b2f0bdSmrg	$echo >> $output "\
548711245024Smrg      \$echo \"\$0: cannot exec \$program \$*\"
548841b2f0bdSmrg      exit $EXIT_FAILURE
548941b2f0bdSmrg    fi
549041b2f0bdSmrg  else
549141b2f0bdSmrg    # The program doesn't exist.
549241b2f0bdSmrg    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
549341b2f0bdSmrg    \$echo \"This script is just a wrapper for \$program.\" 1>&2
549441b2f0bdSmrg    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
549541b2f0bdSmrg    exit $EXIT_FAILURE
549641b2f0bdSmrg  fi
549741b2f0bdSmrgfi\
549841b2f0bdSmrg"
549941b2f0bdSmrg	chmod +x $output
550041b2f0bdSmrg      fi
550141b2f0bdSmrg      exit $EXIT_SUCCESS
550241b2f0bdSmrg      ;;
550341b2f0bdSmrg    esac
550441b2f0bdSmrg
550541b2f0bdSmrg    # See if we need to build an old-fashioned archive.
550641b2f0bdSmrg    for oldlib in $oldlibs; do
550741b2f0bdSmrg
550841b2f0bdSmrg      if test "$build_libtool_libs" = convenience; then
550941b2f0bdSmrg	oldobjs="$libobjs_save"
551041b2f0bdSmrg	addlibs="$convenience"
551141b2f0bdSmrg	build_libtool_libs=no
551241b2f0bdSmrg      else
551341b2f0bdSmrg	if test "$build_libtool_libs" = module; then
551441b2f0bdSmrg	  oldobjs="$libobjs_save"
551541b2f0bdSmrg	  build_libtool_libs=no
551641b2f0bdSmrg	else
551741b2f0bdSmrg	  oldobjs="$old_deplibs $non_pic_objects"
551841b2f0bdSmrg	fi
551941b2f0bdSmrg	addlibs="$old_convenience"
552041b2f0bdSmrg      fi
552141b2f0bdSmrg
552241b2f0bdSmrg      if test -n "$addlibs"; then
552341b2f0bdSmrg	gentop="$output_objdir/${outputname}x"
552441b2f0bdSmrg	generated="$generated $gentop"
552541b2f0bdSmrg
552641b2f0bdSmrg	func_extract_archives $gentop $addlibs
552741b2f0bdSmrg	oldobjs="$oldobjs $func_extract_archives_result"
552841b2f0bdSmrg      fi
552941b2f0bdSmrg
553041b2f0bdSmrg      # Do each command in the archive commands.
553141b2f0bdSmrg      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
553241b2f0bdSmrg       cmds=$old_archive_from_new_cmds
553341b2f0bdSmrg      else
553441b2f0bdSmrg	# POSIX demands no paths to be encoded in archives.  We have
553541b2f0bdSmrg	# to avoid creating archives with duplicate basenames if we
553641b2f0bdSmrg	# might have to extract them afterwards, e.g., when creating a
553741b2f0bdSmrg	# static archive out of a convenience library, or when linking
553841b2f0bdSmrg	# the entirety of a libtool archive into another (currently
553941b2f0bdSmrg	# not supported by libtool).
554041b2f0bdSmrg	if (for obj in $oldobjs
554141b2f0bdSmrg	    do
554241b2f0bdSmrg	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
554341b2f0bdSmrg	    done | sort | sort -uc >/dev/null 2>&1); then
554441b2f0bdSmrg	  :
554541b2f0bdSmrg	else
554641b2f0bdSmrg	  $echo "copying selected object files to avoid basename conflicts..."
554741b2f0bdSmrg
554841b2f0bdSmrg	  if test -z "$gentop"; then
554941b2f0bdSmrg	    gentop="$output_objdir/${outputname}x"
555041b2f0bdSmrg	    generated="$generated $gentop"
555141b2f0bdSmrg
555241b2f0bdSmrg	    $show "${rm}r $gentop"
555341b2f0bdSmrg	    $run ${rm}r "$gentop"
555441b2f0bdSmrg	    $show "$mkdir $gentop"
555541b2f0bdSmrg	    $run $mkdir "$gentop"
555641b2f0bdSmrg	    exit_status=$?
555741b2f0bdSmrg	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
555841b2f0bdSmrg	      exit $exit_status
555941b2f0bdSmrg	    fi
556041b2f0bdSmrg	  fi
556141b2f0bdSmrg
556241b2f0bdSmrg	  save_oldobjs=$oldobjs
556341b2f0bdSmrg	  oldobjs=
556441b2f0bdSmrg	  counter=1
556541b2f0bdSmrg	  for obj in $save_oldobjs
556641b2f0bdSmrg	  do
556741b2f0bdSmrg	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
556841b2f0bdSmrg	    case " $oldobjs " in
556941b2f0bdSmrg	    " ") oldobjs=$obj ;;
557041b2f0bdSmrg	    *[\ /]"$objbase "*)
557141b2f0bdSmrg	      while :; do
557241b2f0bdSmrg		# Make sure we don't pick an alternate name that also
557341b2f0bdSmrg		# overlaps.
557441b2f0bdSmrg		newobj=lt$counter-$objbase
557541b2f0bdSmrg		counter=`expr $counter + 1`
557641b2f0bdSmrg		case " $oldobjs " in
557741b2f0bdSmrg		*[\ /]"$newobj "*) ;;
557841b2f0bdSmrg		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
557941b2f0bdSmrg		esac
558041b2f0bdSmrg	      done
558141b2f0bdSmrg	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
558241b2f0bdSmrg	      $run ln "$obj" "$gentop/$newobj" ||
558341b2f0bdSmrg	      $run cp "$obj" "$gentop/$newobj"
558441b2f0bdSmrg	      oldobjs="$oldobjs $gentop/$newobj"
558541b2f0bdSmrg	      ;;
558641b2f0bdSmrg	    *) oldobjs="$oldobjs $obj" ;;
558741b2f0bdSmrg	    esac
558841b2f0bdSmrg	  done
558941b2f0bdSmrg	fi
559041b2f0bdSmrg
559141b2f0bdSmrg	eval cmds=\"$old_archive_cmds\"
559241b2f0bdSmrg
559341b2f0bdSmrg	if len=`expr "X$cmds" : ".*"` &&
559441b2f0bdSmrg	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
559541b2f0bdSmrg	  cmds=$old_archive_cmds
559641b2f0bdSmrg	else
559741b2f0bdSmrg	  # the command line is too long to link in one step, link in parts
559841b2f0bdSmrg	  $echo "using piecewise archive linking..."
559941b2f0bdSmrg	  save_RANLIB=$RANLIB
560041b2f0bdSmrg	  RANLIB=:
560141b2f0bdSmrg	  objlist=
560241b2f0bdSmrg	  concat_cmds=
560341b2f0bdSmrg	  save_oldobjs=$oldobjs
560441b2f0bdSmrg
560541b2f0bdSmrg	  # Is there a better way of finding the last object in the list?
560641b2f0bdSmrg	  for obj in $save_oldobjs
560741b2f0bdSmrg	  do
560841b2f0bdSmrg	    last_oldobj=$obj
560941b2f0bdSmrg	  done
561041b2f0bdSmrg	  for obj in $save_oldobjs
561141b2f0bdSmrg	  do
561241b2f0bdSmrg	    oldobjs="$objlist $obj"
561341b2f0bdSmrg	    objlist="$objlist $obj"
561441b2f0bdSmrg	    eval test_cmds=\"$old_archive_cmds\"
561541b2f0bdSmrg	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
561641b2f0bdSmrg	       test "$len" -le "$max_cmd_len"; then
561741b2f0bdSmrg	      :
561841b2f0bdSmrg	    else
561941b2f0bdSmrg	      # the above command should be used before it gets too long
562041b2f0bdSmrg	      oldobjs=$objlist
562141b2f0bdSmrg	      if test "$obj" = "$last_oldobj" ; then
562241b2f0bdSmrg	        RANLIB=$save_RANLIB
562341b2f0bdSmrg	      fi
562441b2f0bdSmrg	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
562541b2f0bdSmrg	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
562641b2f0bdSmrg	      objlist=
562741b2f0bdSmrg	    fi
562841b2f0bdSmrg	  done
562941b2f0bdSmrg	  RANLIB=$save_RANLIB
563041b2f0bdSmrg	  oldobjs=$objlist
563141b2f0bdSmrg	  if test "X$oldobjs" = "X" ; then
563241b2f0bdSmrg	    eval cmds=\"\$concat_cmds\"
563341b2f0bdSmrg	  else
563441b2f0bdSmrg	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
563541b2f0bdSmrg	  fi
563641b2f0bdSmrg	fi
563741b2f0bdSmrg      fi
563841b2f0bdSmrg      save_ifs="$IFS"; IFS='~'
563941b2f0bdSmrg      for cmd in $cmds; do
564041b2f0bdSmrg        eval cmd=\"$cmd\"
564141b2f0bdSmrg	IFS="$save_ifs"
564241b2f0bdSmrg	$show "$cmd"
564341b2f0bdSmrg	$run eval "$cmd" || exit $?
564441b2f0bdSmrg      done
564541b2f0bdSmrg      IFS="$save_ifs"
564641b2f0bdSmrg    done
564741b2f0bdSmrg
564841b2f0bdSmrg    if test -n "$generated"; then
564941b2f0bdSmrg      $show "${rm}r$generated"
565041b2f0bdSmrg      $run ${rm}r$generated
565141b2f0bdSmrg    fi
565241b2f0bdSmrg
565341b2f0bdSmrg    # Now create the libtool archive.
565441b2f0bdSmrg    case $output in
565541b2f0bdSmrg    *.la)
565641b2f0bdSmrg      old_library=
565741b2f0bdSmrg      test "$build_old_libs" = yes && old_library="$libname.$libext"
565841b2f0bdSmrg      $show "creating $output"
565941b2f0bdSmrg
566041b2f0bdSmrg      # Preserve any variables that may affect compiler behavior
566141b2f0bdSmrg      for var in $variables_saved_for_relink; do
566241b2f0bdSmrg	if eval test -z \"\${$var+set}\"; then
566341b2f0bdSmrg	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
566441b2f0bdSmrg	elif eval var_value=\$$var; test -z "$var_value"; then
566541b2f0bdSmrg	  relink_command="$var=; export $var; $relink_command"
566641b2f0bdSmrg	else
566741b2f0bdSmrg	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
566841b2f0bdSmrg	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
566941b2f0bdSmrg	fi
567041b2f0bdSmrg      done
567141b2f0bdSmrg      # Quote the link command for shipping.
567241b2f0bdSmrg      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
567311245024Smrg      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
567441b2f0bdSmrg      if test "$hardcode_automatic" = yes ; then
567541b2f0bdSmrg	relink_command=
567641b2f0bdSmrg      fi
567741b2f0bdSmrg
567841b2f0bdSmrg
567941b2f0bdSmrg      # Only create the output if not a dry run.
568041b2f0bdSmrg      if test -z "$run"; then
568141b2f0bdSmrg	for installed in no yes; do
568241b2f0bdSmrg	  if test "$installed" = yes; then
568341b2f0bdSmrg	    if test -z "$install_libdir"; then
568441b2f0bdSmrg	      break
568541b2f0bdSmrg	    fi
568641b2f0bdSmrg	    output="$output_objdir/$outputname"i
568741b2f0bdSmrg	    # Replace all uninstalled libtool libraries with the installed ones
568841b2f0bdSmrg	    newdependency_libs=
568941b2f0bdSmrg	    for deplib in $dependency_libs; do
569041b2f0bdSmrg	      case $deplib in
569141b2f0bdSmrg	      *.la)
569241b2f0bdSmrg		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
569341b2f0bdSmrg		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
569441b2f0bdSmrg		if test -z "$libdir"; then
569541b2f0bdSmrg		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
569641b2f0bdSmrg		  exit $EXIT_FAILURE
569741b2f0bdSmrg		fi
569841b2f0bdSmrg		newdependency_libs="$newdependency_libs $libdir/$name"
569941b2f0bdSmrg		;;
570041b2f0bdSmrg	      *) newdependency_libs="$newdependency_libs $deplib" ;;
570141b2f0bdSmrg	      esac
570241b2f0bdSmrg	    done
570341b2f0bdSmrg	    dependency_libs="$newdependency_libs"
570441b2f0bdSmrg	    newdlfiles=
570541b2f0bdSmrg	    for lib in $dlfiles; do
570641b2f0bdSmrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
570741b2f0bdSmrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
570841b2f0bdSmrg	      if test -z "$libdir"; then
570941b2f0bdSmrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
571041b2f0bdSmrg		exit $EXIT_FAILURE
571141b2f0bdSmrg	      fi
571241b2f0bdSmrg	      newdlfiles="$newdlfiles $libdir/$name"
571341b2f0bdSmrg	    done
571441b2f0bdSmrg	    dlfiles="$newdlfiles"
571541b2f0bdSmrg	    newdlprefiles=
571641b2f0bdSmrg	    for lib in $dlprefiles; do
571741b2f0bdSmrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
571841b2f0bdSmrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
571941b2f0bdSmrg	      if test -z "$libdir"; then
572041b2f0bdSmrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
572141b2f0bdSmrg		exit $EXIT_FAILURE
572241b2f0bdSmrg	      fi
572341b2f0bdSmrg	      newdlprefiles="$newdlprefiles $libdir/$name"
572441b2f0bdSmrg	    done
572541b2f0bdSmrg	    dlprefiles="$newdlprefiles"
572641b2f0bdSmrg	  else
572741b2f0bdSmrg	    newdlfiles=
572841b2f0bdSmrg	    for lib in $dlfiles; do
572941b2f0bdSmrg	      case $lib in
573041b2f0bdSmrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
573141b2f0bdSmrg		*) abs=`pwd`"/$lib" ;;
573241b2f0bdSmrg	      esac
573341b2f0bdSmrg	      newdlfiles="$newdlfiles $abs"
573441b2f0bdSmrg	    done
573541b2f0bdSmrg	    dlfiles="$newdlfiles"
573641b2f0bdSmrg	    newdlprefiles=
573741b2f0bdSmrg	    for lib in $dlprefiles; do
573841b2f0bdSmrg	      case $lib in
573941b2f0bdSmrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
574041b2f0bdSmrg		*) abs=`pwd`"/$lib" ;;
574141b2f0bdSmrg	      esac
574241b2f0bdSmrg	      newdlprefiles="$newdlprefiles $abs"
574341b2f0bdSmrg	    done
574441b2f0bdSmrg	    dlprefiles="$newdlprefiles"
574541b2f0bdSmrg	  fi
574641b2f0bdSmrg	  $rm $output
574741b2f0bdSmrg	  # place dlname in correct position for cygwin
574841b2f0bdSmrg	  tdlname=$dlname
574941b2f0bdSmrg	  case $host,$output,$installed,$module,$dlname in
575041b2f0bdSmrg	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
575141b2f0bdSmrg	  esac
575241b2f0bdSmrg	  $echo > $output "\
575341b2f0bdSmrg# $outputname - a libtool library file
575441b2f0bdSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
575541b2f0bdSmrg#
575641b2f0bdSmrg# Please DO NOT delete this file!
575741b2f0bdSmrg# It is necessary for linking the library.
575841b2f0bdSmrg
575941b2f0bdSmrg# The name that we can dlopen(3).
576041b2f0bdSmrgdlname='$tdlname'
576141b2f0bdSmrg
576241b2f0bdSmrg# Names of this library.
576341b2f0bdSmrglibrary_names='$library_names'
576441b2f0bdSmrg
576541b2f0bdSmrg# The name of the static archive.
576641b2f0bdSmrgold_library='$old_library'
576741b2f0bdSmrg
576841b2f0bdSmrg# Libraries that this one depends upon.
576941b2f0bdSmrgdependency_libs='$dependency_libs'
577041b2f0bdSmrg
577141b2f0bdSmrg# Version information for $libname.
577241b2f0bdSmrgcurrent=$current
577341b2f0bdSmrgage=$age
577441b2f0bdSmrgrevision=$revision
577541b2f0bdSmrg
577641b2f0bdSmrg# Is this an already installed library?
577741b2f0bdSmrginstalled=$installed
577841b2f0bdSmrg
577941b2f0bdSmrg# Should we warn about portability when linking against -modules?
578041b2f0bdSmrgshouldnotlink=$module
578141b2f0bdSmrg
578241b2f0bdSmrg# Files to dlopen/dlpreopen
578341b2f0bdSmrgdlopen='$dlfiles'
578441b2f0bdSmrgdlpreopen='$dlprefiles'
578541b2f0bdSmrg
578641b2f0bdSmrg# Directory that this library needs to be installed in:
578741b2f0bdSmrglibdir='$install_libdir'"
578841b2f0bdSmrg	  if test "$installed" = no && test "$need_relink" = yes; then
578941b2f0bdSmrg	    $echo >> $output "\
579041b2f0bdSmrgrelink_command=\"$relink_command\""
579141b2f0bdSmrg	  fi
579241b2f0bdSmrg	done
579341b2f0bdSmrg      fi
579441b2f0bdSmrg
579541b2f0bdSmrg      # Do a symbolic link so that the libtool archive can be found in
579641b2f0bdSmrg      # LD_LIBRARY_PATH before the program is installed.
579741b2f0bdSmrg      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
579841b2f0bdSmrg      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
579941b2f0bdSmrg      ;;
580041b2f0bdSmrg    esac
580141b2f0bdSmrg    exit $EXIT_SUCCESS
580241b2f0bdSmrg    ;;
580341b2f0bdSmrg
580441b2f0bdSmrg  # libtool install mode
580541b2f0bdSmrg  install)
580641b2f0bdSmrg    modename="$modename: install"
580741b2f0bdSmrg
580841b2f0bdSmrg    # There may be an optional sh(1) argument at the beginning of
580941b2f0bdSmrg    # install_prog (especially on Windows NT).
581041b2f0bdSmrg    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
581141b2f0bdSmrg       # Allow the use of GNU shtool's install command.
581241b2f0bdSmrg       $echo "X$nonopt" | grep shtool > /dev/null; then
581341b2f0bdSmrg      # Aesthetically quote it.
581441b2f0bdSmrg      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
581541b2f0bdSmrg      case $arg in
581641b2f0bdSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
581741b2f0bdSmrg	arg="\"$arg\""
581841b2f0bdSmrg	;;
581941b2f0bdSmrg      esac
582041b2f0bdSmrg      install_prog="$arg "
582141b2f0bdSmrg      arg="$1"
582241b2f0bdSmrg      shift
582341b2f0bdSmrg    else
582441b2f0bdSmrg      install_prog=
582541b2f0bdSmrg      arg=$nonopt
582641b2f0bdSmrg    fi
582741b2f0bdSmrg
582841b2f0bdSmrg    # The real first argument should be the name of the installation program.
582941b2f0bdSmrg    # Aesthetically quote it.
583041b2f0bdSmrg    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
583141b2f0bdSmrg    case $arg in
583241b2f0bdSmrg    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
583341b2f0bdSmrg      arg="\"$arg\""
583441b2f0bdSmrg      ;;
583541b2f0bdSmrg    esac
583641b2f0bdSmrg    install_prog="$install_prog$arg"
583741b2f0bdSmrg
583841b2f0bdSmrg    # We need to accept at least all the BSD install flags.
583941b2f0bdSmrg    dest=
584041b2f0bdSmrg    files=
584141b2f0bdSmrg    opts=
584241b2f0bdSmrg    prev=
584341b2f0bdSmrg    install_type=
584441b2f0bdSmrg    isdir=no
584541b2f0bdSmrg    stripme=
584641b2f0bdSmrg    for arg
584741b2f0bdSmrg    do
584841b2f0bdSmrg      if test -n "$dest"; then
584941b2f0bdSmrg	files="$files $dest"
585041b2f0bdSmrg	dest=$arg
585141b2f0bdSmrg	continue
585241b2f0bdSmrg      fi
585341b2f0bdSmrg
585441b2f0bdSmrg      case $arg in
585541b2f0bdSmrg      -d) isdir=yes ;;
585641b2f0bdSmrg      -f) 
585741b2f0bdSmrg      	case " $install_prog " in
585841b2f0bdSmrg	*[\\\ /]cp\ *) ;;
585941b2f0bdSmrg	*) prev=$arg ;;
586041b2f0bdSmrg	esac
586141b2f0bdSmrg	;;
586241b2f0bdSmrg      -g | -m | -o) prev=$arg ;;
586341b2f0bdSmrg      -s)
586441b2f0bdSmrg	stripme=" -s"
586541b2f0bdSmrg	continue
586641b2f0bdSmrg	;;
586741b2f0bdSmrg      -*)
586841b2f0bdSmrg	;;
586941b2f0bdSmrg      *)
587041b2f0bdSmrg	# If the previous option needed an argument, then skip it.
587141b2f0bdSmrg	if test -n "$prev"; then
587241b2f0bdSmrg	  prev=
587341b2f0bdSmrg	else
587441b2f0bdSmrg	  dest=$arg
587541b2f0bdSmrg	  continue
587641b2f0bdSmrg	fi
587741b2f0bdSmrg	;;
587841b2f0bdSmrg      esac
587941b2f0bdSmrg
588041b2f0bdSmrg      # Aesthetically quote the argument.
588141b2f0bdSmrg      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
588241b2f0bdSmrg      case $arg in
588341b2f0bdSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
588441b2f0bdSmrg	arg="\"$arg\""
588541b2f0bdSmrg	;;
588641b2f0bdSmrg      esac
588741b2f0bdSmrg      install_prog="$install_prog $arg"
588841b2f0bdSmrg    done
588941b2f0bdSmrg
589041b2f0bdSmrg    if test -z "$install_prog"; then
589141b2f0bdSmrg      $echo "$modename: you must specify an install program" 1>&2
589241b2f0bdSmrg      $echo "$help" 1>&2
589341b2f0bdSmrg      exit $EXIT_FAILURE
589441b2f0bdSmrg    fi
589541b2f0bdSmrg
589641b2f0bdSmrg    if test -n "$prev"; then
589741b2f0bdSmrg      $echo "$modename: the \`$prev' option requires an argument" 1>&2
589841b2f0bdSmrg      $echo "$help" 1>&2
589941b2f0bdSmrg      exit $EXIT_FAILURE
590041b2f0bdSmrg    fi
590141b2f0bdSmrg
590241b2f0bdSmrg    if test -z "$files"; then
590341b2f0bdSmrg      if test -z "$dest"; then
590441b2f0bdSmrg	$echo "$modename: no file or destination specified" 1>&2
590541b2f0bdSmrg      else
590641b2f0bdSmrg	$echo "$modename: you must specify a destination" 1>&2
590741b2f0bdSmrg      fi
590841b2f0bdSmrg      $echo "$help" 1>&2
590941b2f0bdSmrg      exit $EXIT_FAILURE
591041b2f0bdSmrg    fi
591141b2f0bdSmrg
591241b2f0bdSmrg    # Strip any trailing slash from the destination.
591341b2f0bdSmrg    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
591441b2f0bdSmrg
591541b2f0bdSmrg    # Check to see that the destination is a directory.
591641b2f0bdSmrg    test -d "$dest" && isdir=yes
591741b2f0bdSmrg    if test "$isdir" = yes; then
591841b2f0bdSmrg      destdir="$dest"
591941b2f0bdSmrg      destname=
592041b2f0bdSmrg    else
592141b2f0bdSmrg      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
592241b2f0bdSmrg      test "X$destdir" = "X$dest" && destdir=.
592341b2f0bdSmrg      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
592441b2f0bdSmrg
592541b2f0bdSmrg      # Not a directory, so check to see that there is only one file specified.
592641b2f0bdSmrg      set dummy $files
592741b2f0bdSmrg      if test "$#" -gt 2; then
592841b2f0bdSmrg	$echo "$modename: \`$dest' is not a directory" 1>&2
592941b2f0bdSmrg	$echo "$help" 1>&2
593041b2f0bdSmrg	exit $EXIT_FAILURE
593141b2f0bdSmrg      fi
593241b2f0bdSmrg    fi
593341b2f0bdSmrg    case $destdir in
593441b2f0bdSmrg    [\\/]* | [A-Za-z]:[\\/]*) ;;
593541b2f0bdSmrg    *)
593641b2f0bdSmrg      for file in $files; do
593741b2f0bdSmrg	case $file in
593841b2f0bdSmrg	*.lo) ;;
593941b2f0bdSmrg	*)
594041b2f0bdSmrg	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
594141b2f0bdSmrg	  $echo "$help" 1>&2
594241b2f0bdSmrg	  exit $EXIT_FAILURE
594341b2f0bdSmrg	  ;;
594441b2f0bdSmrg	esac
594541b2f0bdSmrg      done
594641b2f0bdSmrg      ;;
594741b2f0bdSmrg    esac
594841b2f0bdSmrg
594941b2f0bdSmrg    # This variable tells wrapper scripts just to set variables rather
595041b2f0bdSmrg    # than running their programs.
595141b2f0bdSmrg    libtool_install_magic="$magic"
595241b2f0bdSmrg
595341b2f0bdSmrg    staticlibs=
595441b2f0bdSmrg    future_libdirs=
595541b2f0bdSmrg    current_libdirs=
595641b2f0bdSmrg    for file in $files; do
595741b2f0bdSmrg
595841b2f0bdSmrg      # Do each installation.
595941b2f0bdSmrg      case $file in
596041b2f0bdSmrg      *.$libext)
596141b2f0bdSmrg	# Do the static libraries later.
596241b2f0bdSmrg	staticlibs="$staticlibs $file"
596341b2f0bdSmrg	;;
596441b2f0bdSmrg
596541b2f0bdSmrg      *.la)
596641b2f0bdSmrg	# Check to see that this really is a libtool archive.
596741b2f0bdSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
596841b2f0bdSmrg	else
596941b2f0bdSmrg	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
597041b2f0bdSmrg	  $echo "$help" 1>&2
597141b2f0bdSmrg	  exit $EXIT_FAILURE
597241b2f0bdSmrg	fi
597341b2f0bdSmrg
597441b2f0bdSmrg	library_names=
597541b2f0bdSmrg	old_library=
597641b2f0bdSmrg	relink_command=
597741b2f0bdSmrg	# If there is no directory component, then add one.
597841b2f0bdSmrg	case $file in
597941b2f0bdSmrg	*/* | *\\*) . $file ;;
598041b2f0bdSmrg	*) . ./$file ;;
598141b2f0bdSmrg	esac
598241b2f0bdSmrg
598341b2f0bdSmrg	# Add the libdir to current_libdirs if it is the destination.
598441b2f0bdSmrg	if test "X$destdir" = "X$libdir"; then
598541b2f0bdSmrg	  case "$current_libdirs " in
598641b2f0bdSmrg	  *" $libdir "*) ;;
598741b2f0bdSmrg	  *) current_libdirs="$current_libdirs $libdir" ;;
598841b2f0bdSmrg	  esac
598941b2f0bdSmrg	else
599041b2f0bdSmrg	  # Note the libdir as a future libdir.
599141b2f0bdSmrg	  case "$future_libdirs " in
599241b2f0bdSmrg	  *" $libdir "*) ;;
599341b2f0bdSmrg	  *) future_libdirs="$future_libdirs $libdir" ;;
599441b2f0bdSmrg	  esac
599541b2f0bdSmrg	fi
599641b2f0bdSmrg
599741b2f0bdSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
599841b2f0bdSmrg	test "X$dir" = "X$file/" && dir=
599941b2f0bdSmrg	dir="$dir$objdir"
600041b2f0bdSmrg
600141b2f0bdSmrg	if test -n "$relink_command"; then
600241b2f0bdSmrg	  # Determine the prefix the user has applied to our future dir.
600341b2f0bdSmrg	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
600441b2f0bdSmrg
600541b2f0bdSmrg	  # Don't allow the user to place us outside of our expected
600641b2f0bdSmrg	  # location b/c this prevents finding dependent libraries that
600741b2f0bdSmrg	  # are installed to the same prefix.
600841b2f0bdSmrg	  # At present, this check doesn't affect windows .dll's that
600941b2f0bdSmrg	  # are installed into $libdir/../bin (currently, that works fine)
601041b2f0bdSmrg	  # but it's something to keep an eye on.
601141b2f0bdSmrg	  if test "$inst_prefix_dir" = "$destdir"; then
601241b2f0bdSmrg	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
601341b2f0bdSmrg	    exit $EXIT_FAILURE
601441b2f0bdSmrg	  fi
601541b2f0bdSmrg
601641b2f0bdSmrg	  if test -n "$inst_prefix_dir"; then
601741b2f0bdSmrg	    # Stick the inst_prefix_dir data into the link command.
601811245024Smrg	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
601941b2f0bdSmrg	  else
602011245024Smrg	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
602141b2f0bdSmrg	  fi
602241b2f0bdSmrg
602341b2f0bdSmrg	  $echo "$modename: warning: relinking \`$file'" 1>&2
602441b2f0bdSmrg	  $show "$relink_command"
602541b2f0bdSmrg	  if $run eval "$relink_command"; then :
602641b2f0bdSmrg	  else
602741b2f0bdSmrg	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
602841b2f0bdSmrg	    exit $EXIT_FAILURE
602941b2f0bdSmrg	  fi
603041b2f0bdSmrg	fi
603141b2f0bdSmrg
603241b2f0bdSmrg	# See the names of the shared library.
603341b2f0bdSmrg	set dummy $library_names
603441b2f0bdSmrg	if test -n "$2"; then
603541b2f0bdSmrg	  realname="$2"
603641b2f0bdSmrg	  shift
603741b2f0bdSmrg	  shift
603841b2f0bdSmrg
603941b2f0bdSmrg	  srcname="$realname"
604041b2f0bdSmrg	  test -n "$relink_command" && srcname="$realname"T
604141b2f0bdSmrg
604241b2f0bdSmrg	  # Install the shared library and build the symlinks.
604341b2f0bdSmrg	  $show "$install_prog $dir/$srcname $destdir/$realname"
604441b2f0bdSmrg	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
604541b2f0bdSmrg	  if test -n "$stripme" && test -n "$striplib"; then
604641b2f0bdSmrg	    $show "$striplib $destdir/$realname"
604741b2f0bdSmrg	    $run eval "$striplib $destdir/$realname" || exit $?
604841b2f0bdSmrg	  fi
604941b2f0bdSmrg
605041b2f0bdSmrg	  if test "$#" -gt 0; then
605141b2f0bdSmrg	    # Delete the old symlinks, and create new ones.
605241b2f0bdSmrg	    # Try `ln -sf' first, because the `ln' binary might depend on
605341b2f0bdSmrg	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
605441b2f0bdSmrg	    # so we also need to try rm && ln -s.
605541b2f0bdSmrg	    for linkname
605641b2f0bdSmrg	    do
605741b2f0bdSmrg	      if test "$linkname" != "$realname"; then
605841b2f0bdSmrg                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
605941b2f0bdSmrg                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
606041b2f0bdSmrg	      fi
606141b2f0bdSmrg	    done
606241b2f0bdSmrg	  fi
606341b2f0bdSmrg
606441b2f0bdSmrg	  # Do each command in the postinstall commands.
606541b2f0bdSmrg	  lib="$destdir/$realname"
606641b2f0bdSmrg	  cmds=$postinstall_cmds
606741b2f0bdSmrg	  save_ifs="$IFS"; IFS='~'
606841b2f0bdSmrg	  for cmd in $cmds; do
606941b2f0bdSmrg	    IFS="$save_ifs"
607041b2f0bdSmrg	    eval cmd=\"$cmd\"
607141b2f0bdSmrg	    $show "$cmd"
607241b2f0bdSmrg	    $run eval "$cmd" || {
607341b2f0bdSmrg	      lt_exit=$?
607441b2f0bdSmrg
607541b2f0bdSmrg	      # Restore the uninstalled library and exit
607641b2f0bdSmrg	      if test "$mode" = relink; then
607741b2f0bdSmrg		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
607841b2f0bdSmrg	      fi
607941b2f0bdSmrg
608041b2f0bdSmrg	      exit $lt_exit
608141b2f0bdSmrg	    }
608241b2f0bdSmrg	  done
608341b2f0bdSmrg	  IFS="$save_ifs"
608441b2f0bdSmrg	fi
608541b2f0bdSmrg
608641b2f0bdSmrg	# Install the pseudo-library for information purposes.
608741b2f0bdSmrg	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
608841b2f0bdSmrg	instname="$dir/$name"i
608941b2f0bdSmrg	$show "$install_prog $instname $destdir/$name"
609041b2f0bdSmrg	$run eval "$install_prog $instname $destdir/$name" || exit $?
609141b2f0bdSmrg
609241b2f0bdSmrg	# Maybe install the static library, too.
609341b2f0bdSmrg	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
609441b2f0bdSmrg	;;
609541b2f0bdSmrg
609641b2f0bdSmrg      *.lo)
609741b2f0bdSmrg	# Install (i.e. copy) a libtool object.
609841b2f0bdSmrg
609941b2f0bdSmrg	# Figure out destination file name, if it wasn't already specified.
610041b2f0bdSmrg	if test -n "$destname"; then
610141b2f0bdSmrg	  destfile="$destdir/$destname"
610241b2f0bdSmrg	else
610341b2f0bdSmrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
610441b2f0bdSmrg	  destfile="$destdir/$destfile"
610541b2f0bdSmrg	fi
610641b2f0bdSmrg
610741b2f0bdSmrg	# Deduce the name of the destination old-style object file.
610841b2f0bdSmrg	case $destfile in
610941b2f0bdSmrg	*.lo)
611041b2f0bdSmrg	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
611141b2f0bdSmrg	  ;;
611241b2f0bdSmrg	*.$objext)
611341b2f0bdSmrg	  staticdest="$destfile"
611441b2f0bdSmrg	  destfile=
611541b2f0bdSmrg	  ;;
611641b2f0bdSmrg	*)
611741b2f0bdSmrg	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
611841b2f0bdSmrg	  $echo "$help" 1>&2
611941b2f0bdSmrg	  exit $EXIT_FAILURE
612041b2f0bdSmrg	  ;;
612141b2f0bdSmrg	esac
612241b2f0bdSmrg
612341b2f0bdSmrg	# Install the libtool object if requested.
612441b2f0bdSmrg	if test -n "$destfile"; then
612541b2f0bdSmrg	  $show "$install_prog $file $destfile"
612641b2f0bdSmrg	  $run eval "$install_prog $file $destfile" || exit $?
612741b2f0bdSmrg	fi
612841b2f0bdSmrg
612941b2f0bdSmrg	# Install the old object if enabled.
613041b2f0bdSmrg	if test "$build_old_libs" = yes; then
613141b2f0bdSmrg	  # Deduce the name of the old-style object file.
613241b2f0bdSmrg	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
613341b2f0bdSmrg
613441b2f0bdSmrg	  $show "$install_prog $staticobj $staticdest"
613541b2f0bdSmrg	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
613641b2f0bdSmrg	fi
613741b2f0bdSmrg	exit $EXIT_SUCCESS
613841b2f0bdSmrg	;;
613941b2f0bdSmrg
614041b2f0bdSmrg      *)
614141b2f0bdSmrg	# Figure out destination file name, if it wasn't already specified.
614241b2f0bdSmrg	if test -n "$destname"; then
614341b2f0bdSmrg	  destfile="$destdir/$destname"
614441b2f0bdSmrg	else
614541b2f0bdSmrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
614641b2f0bdSmrg	  destfile="$destdir/$destfile"
614741b2f0bdSmrg	fi
614841b2f0bdSmrg
614941b2f0bdSmrg	# If the file is missing, and there is a .exe on the end, strip it
615041b2f0bdSmrg	# because it is most likely a libtool script we actually want to
615141b2f0bdSmrg	# install
615241b2f0bdSmrg	stripped_ext=""
615341b2f0bdSmrg	case $file in
615441b2f0bdSmrg	  *.exe)
615541b2f0bdSmrg	    if test ! -f "$file"; then
615641b2f0bdSmrg	      file=`$echo $file|${SED} 's,.exe$,,'`
615741b2f0bdSmrg	      stripped_ext=".exe"
615841b2f0bdSmrg	    fi
615941b2f0bdSmrg	    ;;
616041b2f0bdSmrg	esac
616141b2f0bdSmrg
616241b2f0bdSmrg	# Do a test to see if this is really a libtool program.
616341b2f0bdSmrg	case $host in
616441b2f0bdSmrg	*cygwin*|*mingw*)
616541b2f0bdSmrg	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
616641b2f0bdSmrg	    ;;
616741b2f0bdSmrg	*)
616841b2f0bdSmrg	    wrapper=$file
616941b2f0bdSmrg	    ;;
617041b2f0bdSmrg	esac
617141b2f0bdSmrg	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
617241b2f0bdSmrg	  notinst_deplibs=
617341b2f0bdSmrg	  relink_command=
617441b2f0bdSmrg
617541b2f0bdSmrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
617641b2f0bdSmrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
617741b2f0bdSmrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
617841b2f0bdSmrg	  # `FILE.' does not work on cygwin managed mounts.
617941b2f0bdSmrg	  #
618041b2f0bdSmrg	  # If there is no directory component, then add one.
618141b2f0bdSmrg	  case $wrapper in
618241b2f0bdSmrg	  */* | *\\*) . ${wrapper} ;;
618341b2f0bdSmrg	  *) . ./${wrapper} ;;
618441b2f0bdSmrg	  esac
618541b2f0bdSmrg
618641b2f0bdSmrg	  # Check the variables that should have been set.
618741b2f0bdSmrg	  if test -z "$notinst_deplibs"; then
618841b2f0bdSmrg	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
618941b2f0bdSmrg	    exit $EXIT_FAILURE
619041b2f0bdSmrg	  fi
619141b2f0bdSmrg
619241b2f0bdSmrg	  finalize=yes
619341b2f0bdSmrg	  for lib in $notinst_deplibs; do
619441b2f0bdSmrg	    # Check to see that each library is installed.
619541b2f0bdSmrg	    libdir=
619641b2f0bdSmrg	    if test -f "$lib"; then
619741b2f0bdSmrg	      # If there is no directory component, then add one.
619841b2f0bdSmrg	      case $lib in
619941b2f0bdSmrg	      */* | *\\*) . $lib ;;
620041b2f0bdSmrg	      *) . ./$lib ;;
620141b2f0bdSmrg	      esac
620241b2f0bdSmrg	    fi
620341b2f0bdSmrg	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
620441b2f0bdSmrg	    if test -n "$libdir" && test ! -f "$libfile"; then
620541b2f0bdSmrg	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
620641b2f0bdSmrg	      finalize=no
620741b2f0bdSmrg	    fi
620841b2f0bdSmrg	  done
620941b2f0bdSmrg
621041b2f0bdSmrg	  relink_command=
621141b2f0bdSmrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
621241b2f0bdSmrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
621341b2f0bdSmrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
621441b2f0bdSmrg	  # `FILE.' does not work on cygwin managed mounts.
621541b2f0bdSmrg	  #
621641b2f0bdSmrg	  # If there is no directory component, then add one.
621741b2f0bdSmrg	  case $wrapper in
621841b2f0bdSmrg	  */* | *\\*) . ${wrapper} ;;
621941b2f0bdSmrg	  *) . ./${wrapper} ;;
622041b2f0bdSmrg	  esac
622141b2f0bdSmrg
622241b2f0bdSmrg	  outputname=
622341b2f0bdSmrg	  if test "$fast_install" = no && test -n "$relink_command"; then
622441b2f0bdSmrg	    if test "$finalize" = yes && test -z "$run"; then
622541b2f0bdSmrg	      tmpdir=`func_mktempdir`
622641b2f0bdSmrg	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
622741b2f0bdSmrg	      outputname="$tmpdir/$file"
622841b2f0bdSmrg	      # Replace the output file specification.
622911245024Smrg	      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
623041b2f0bdSmrg
623141b2f0bdSmrg	      $show "$relink_command"
623241b2f0bdSmrg	      if $run eval "$relink_command"; then :
623341b2f0bdSmrg	      else
623441b2f0bdSmrg		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
623541b2f0bdSmrg		${rm}r "$tmpdir"
623641b2f0bdSmrg		continue
623741b2f0bdSmrg	      fi
623841b2f0bdSmrg	      file="$outputname"
623941b2f0bdSmrg	    else
624041b2f0bdSmrg	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
624141b2f0bdSmrg	    fi
624241b2f0bdSmrg	  else
624341b2f0bdSmrg	    # Install the binary that we compiled earlier.
624441b2f0bdSmrg	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
624541b2f0bdSmrg	  fi
624641b2f0bdSmrg	fi
624741b2f0bdSmrg
624841b2f0bdSmrg	# remove .exe since cygwin /usr/bin/install will append another
624941b2f0bdSmrg	# one anyway 
625041b2f0bdSmrg	case $install_prog,$host in
625141b2f0bdSmrg	*/usr/bin/install*,*cygwin*)
625241b2f0bdSmrg	  case $file:$destfile in
625341b2f0bdSmrg	  *.exe:*.exe)
625441b2f0bdSmrg	    # this is ok
625541b2f0bdSmrg	    ;;
625641b2f0bdSmrg	  *.exe:*)
625741b2f0bdSmrg	    destfile=$destfile.exe
625841b2f0bdSmrg	    ;;
625941b2f0bdSmrg	  *:*.exe)
626041b2f0bdSmrg	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
626141b2f0bdSmrg	    ;;
626241b2f0bdSmrg	  esac
626341b2f0bdSmrg	  ;;
626441b2f0bdSmrg	esac
626541b2f0bdSmrg	$show "$install_prog$stripme $file $destfile"
626641b2f0bdSmrg	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
626741b2f0bdSmrg	test -n "$outputname" && ${rm}r "$tmpdir"
626841b2f0bdSmrg	;;
626941b2f0bdSmrg      esac
627041b2f0bdSmrg    done
627141b2f0bdSmrg
627241b2f0bdSmrg    for file in $staticlibs; do
627341b2f0bdSmrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
627441b2f0bdSmrg
627541b2f0bdSmrg      # Set up the ranlib parameters.
627641b2f0bdSmrg      oldlib="$destdir/$name"
627741b2f0bdSmrg
627841b2f0bdSmrg      $show "$install_prog $file $oldlib"
627941b2f0bdSmrg      $run eval "$install_prog \$file \$oldlib" || exit $?
628041b2f0bdSmrg
628141b2f0bdSmrg      if test -n "$stripme" && test -n "$old_striplib"; then
628241b2f0bdSmrg	$show "$old_striplib $oldlib"
628341b2f0bdSmrg	$run eval "$old_striplib $oldlib" || exit $?
628441b2f0bdSmrg      fi
628541b2f0bdSmrg
628641b2f0bdSmrg      # Do each command in the postinstall commands.
628741b2f0bdSmrg      cmds=$old_postinstall_cmds
628841b2f0bdSmrg      save_ifs="$IFS"; IFS='~'
628941b2f0bdSmrg      for cmd in $cmds; do
629041b2f0bdSmrg	IFS="$save_ifs"
629141b2f0bdSmrg	eval cmd=\"$cmd\"
629241b2f0bdSmrg	$show "$cmd"
629341b2f0bdSmrg	$run eval "$cmd" || exit $?
629441b2f0bdSmrg      done
629541b2f0bdSmrg      IFS="$save_ifs"
629641b2f0bdSmrg    done
629741b2f0bdSmrg
629841b2f0bdSmrg    if test -n "$future_libdirs"; then
629941b2f0bdSmrg      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
630041b2f0bdSmrg    fi
630141b2f0bdSmrg
630241b2f0bdSmrg    if test -n "$current_libdirs"; then
630341b2f0bdSmrg      # Maybe just do a dry run.
630441b2f0bdSmrg      test -n "$run" && current_libdirs=" -n$current_libdirs"
630541b2f0bdSmrg      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
630641b2f0bdSmrg    else
630741b2f0bdSmrg      exit $EXIT_SUCCESS
630841b2f0bdSmrg    fi
630941b2f0bdSmrg    ;;
631041b2f0bdSmrg
631141b2f0bdSmrg  # libtool finish mode
631241b2f0bdSmrg  finish)
631341b2f0bdSmrg    modename="$modename: finish"
631441b2f0bdSmrg    libdirs="$nonopt"
631541b2f0bdSmrg    admincmds=
631641b2f0bdSmrg
631741b2f0bdSmrg    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
631841b2f0bdSmrg      for dir
631941b2f0bdSmrg      do
632041b2f0bdSmrg	libdirs="$libdirs $dir"
632141b2f0bdSmrg      done
632241b2f0bdSmrg
632341b2f0bdSmrg      for libdir in $libdirs; do
632441b2f0bdSmrg	if test -n "$finish_cmds"; then
632541b2f0bdSmrg	  # Do each command in the finish commands.
632641b2f0bdSmrg	  cmds=$finish_cmds
632741b2f0bdSmrg	  save_ifs="$IFS"; IFS='~'
632841b2f0bdSmrg	  for cmd in $cmds; do
632941b2f0bdSmrg	    IFS="$save_ifs"
633041b2f0bdSmrg	    eval cmd=\"$cmd\"
633141b2f0bdSmrg	    $show "$cmd"
633241b2f0bdSmrg	    $run eval "$cmd" || admincmds="$admincmds
633341b2f0bdSmrg       $cmd"
633441b2f0bdSmrg	  done
633541b2f0bdSmrg	  IFS="$save_ifs"
633641b2f0bdSmrg	fi
633741b2f0bdSmrg	if test -n "$finish_eval"; then
633841b2f0bdSmrg	  # Do the single finish_eval.
633941b2f0bdSmrg	  eval cmds=\"$finish_eval\"
634041b2f0bdSmrg	  $run eval "$cmds" || admincmds="$admincmds
634141b2f0bdSmrg       $cmds"
634241b2f0bdSmrg	fi
634341b2f0bdSmrg      done
634441b2f0bdSmrg    fi
634541b2f0bdSmrg
634641b2f0bdSmrg    # Exit here if they wanted silent mode.
634741b2f0bdSmrg    test "$show" = : && exit $EXIT_SUCCESS
634841b2f0bdSmrg
634941b2f0bdSmrg    $echo "X----------------------------------------------------------------------" | $Xsed
635041b2f0bdSmrg    $echo "Libraries have been installed in:"
635141b2f0bdSmrg    for libdir in $libdirs; do
635241b2f0bdSmrg      $echo "   $libdir"
635341b2f0bdSmrg    done
635441b2f0bdSmrg    $echo
635541b2f0bdSmrg    $echo "If you ever happen to want to link against installed libraries"
635641b2f0bdSmrg    $echo "in a given directory, LIBDIR, you must either use libtool, and"
635741b2f0bdSmrg    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
635841b2f0bdSmrg    $echo "flag during linking and do at least one of the following:"
635941b2f0bdSmrg    if test -n "$shlibpath_var"; then
636041b2f0bdSmrg      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
636141b2f0bdSmrg      $echo "     during execution"
636241b2f0bdSmrg    fi
636341b2f0bdSmrg    if test -n "$runpath_var"; then
636441b2f0bdSmrg      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
636541b2f0bdSmrg      $echo "     during linking"
636641b2f0bdSmrg    fi
636741b2f0bdSmrg    if test -n "$hardcode_libdir_flag_spec"; then
636841b2f0bdSmrg      libdir=LIBDIR
636941b2f0bdSmrg      eval flag=\"$hardcode_libdir_flag_spec\"
637041b2f0bdSmrg
637141b2f0bdSmrg      $echo "   - use the \`$flag' linker flag"
637241b2f0bdSmrg    fi
637341b2f0bdSmrg    if test -n "$admincmds"; then
637441b2f0bdSmrg      $echo "   - have your system administrator run these commands:$admincmds"
637541b2f0bdSmrg    fi
637641b2f0bdSmrg    if test -f /etc/ld.so.conf; then
637741b2f0bdSmrg      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
637841b2f0bdSmrg    fi
637941b2f0bdSmrg    $echo
638041b2f0bdSmrg    $echo "See any operating system documentation about shared libraries for"
638141b2f0bdSmrg    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
638241b2f0bdSmrg    $echo "X----------------------------------------------------------------------" | $Xsed
638341b2f0bdSmrg    exit $EXIT_SUCCESS
638441b2f0bdSmrg    ;;
638541b2f0bdSmrg
638641b2f0bdSmrg  # libtool execute mode
638741b2f0bdSmrg  execute)
638841b2f0bdSmrg    modename="$modename: execute"
638941b2f0bdSmrg
639041b2f0bdSmrg    # The first argument is the command name.
639141b2f0bdSmrg    cmd="$nonopt"
639241b2f0bdSmrg    if test -z "$cmd"; then
639341b2f0bdSmrg      $echo "$modename: you must specify a COMMAND" 1>&2
639441b2f0bdSmrg      $echo "$help"
639541b2f0bdSmrg      exit $EXIT_FAILURE
639641b2f0bdSmrg    fi
639741b2f0bdSmrg
639841b2f0bdSmrg    # Handle -dlopen flags immediately.
639941b2f0bdSmrg    for file in $execute_dlfiles; do
640041b2f0bdSmrg      if test ! -f "$file"; then
640141b2f0bdSmrg	$echo "$modename: \`$file' is not a file" 1>&2
640241b2f0bdSmrg	$echo "$help" 1>&2
640341b2f0bdSmrg	exit $EXIT_FAILURE
640441b2f0bdSmrg      fi
640541b2f0bdSmrg
640641b2f0bdSmrg      dir=
640741b2f0bdSmrg      case $file in
640841b2f0bdSmrg      *.la)
640941b2f0bdSmrg	# Check to see that this really is a libtool archive.
641041b2f0bdSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
641141b2f0bdSmrg	else
641241b2f0bdSmrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
641341b2f0bdSmrg	  $echo "$help" 1>&2
641441b2f0bdSmrg	  exit $EXIT_FAILURE
641541b2f0bdSmrg	fi
641641b2f0bdSmrg
641741b2f0bdSmrg	# Read the libtool library.
641841b2f0bdSmrg	dlname=
641941b2f0bdSmrg	library_names=
642041b2f0bdSmrg
642141b2f0bdSmrg	# If there is no directory component, then add one.
642241b2f0bdSmrg	case $file in
642341b2f0bdSmrg	*/* | *\\*) . $file ;;
642441b2f0bdSmrg	*) . ./$file ;;
642541b2f0bdSmrg	esac
642641b2f0bdSmrg
642741b2f0bdSmrg	# Skip this library if it cannot be dlopened.
642841b2f0bdSmrg	if test -z "$dlname"; then
642941b2f0bdSmrg	  # Warn if it was a shared library.
643041b2f0bdSmrg	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
643141b2f0bdSmrg	  continue
643241b2f0bdSmrg	fi
643341b2f0bdSmrg
643441b2f0bdSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
643541b2f0bdSmrg	test "X$dir" = "X$file" && dir=.
643641b2f0bdSmrg
643741b2f0bdSmrg	if test -f "$dir/$objdir/$dlname"; then
643841b2f0bdSmrg	  dir="$dir/$objdir"
643941b2f0bdSmrg	else
644011245024Smrg	  if test ! -f "$dir/$dlname"; then
644111245024Smrg	    $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
644211245024Smrg	    exit $EXIT_FAILURE
644311245024Smrg	  fi
644441b2f0bdSmrg	fi
644541b2f0bdSmrg	;;
644641b2f0bdSmrg
644741b2f0bdSmrg      *.lo)
644841b2f0bdSmrg	# Just add the directory containing the .lo file.
644941b2f0bdSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
645041b2f0bdSmrg	test "X$dir" = "X$file" && dir=.
645141b2f0bdSmrg	;;
645241b2f0bdSmrg
645341b2f0bdSmrg      *)
645441b2f0bdSmrg	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
645541b2f0bdSmrg	continue
645641b2f0bdSmrg	;;
645741b2f0bdSmrg      esac
645841b2f0bdSmrg
645941b2f0bdSmrg      # Get the absolute pathname.
646041b2f0bdSmrg      absdir=`cd "$dir" && pwd`
646141b2f0bdSmrg      test -n "$absdir" && dir="$absdir"
646241b2f0bdSmrg
646341b2f0bdSmrg      # Now add the directory to shlibpath_var.
646441b2f0bdSmrg      if eval "test -z \"\$$shlibpath_var\""; then
646541b2f0bdSmrg	eval "$shlibpath_var=\"\$dir\""
646641b2f0bdSmrg      else
646741b2f0bdSmrg	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
646841b2f0bdSmrg      fi
646941b2f0bdSmrg    done
647041b2f0bdSmrg
647141b2f0bdSmrg    # This variable tells wrapper scripts just to set shlibpath_var
647241b2f0bdSmrg    # rather than running their programs.
647341b2f0bdSmrg    libtool_execute_magic="$magic"
647441b2f0bdSmrg
647541b2f0bdSmrg    # Check if any of the arguments is a wrapper script.
647641b2f0bdSmrg    args=
647741b2f0bdSmrg    for file
647841b2f0bdSmrg    do
647941b2f0bdSmrg      case $file in
648041b2f0bdSmrg      -*) ;;
648141b2f0bdSmrg      *)
648241b2f0bdSmrg	# Do a test to see if this is really a libtool program.
648341b2f0bdSmrg	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
648441b2f0bdSmrg	  # If there is no directory component, then add one.
648541b2f0bdSmrg	  case $file in
648641b2f0bdSmrg	  */* | *\\*) . $file ;;
648741b2f0bdSmrg	  *) . ./$file ;;
648841b2f0bdSmrg	  esac
648941b2f0bdSmrg
649041b2f0bdSmrg	  # Transform arg to wrapped name.
649141b2f0bdSmrg	  file="$progdir/$program"
649241b2f0bdSmrg	fi
649341b2f0bdSmrg	;;
649441b2f0bdSmrg      esac
649541b2f0bdSmrg      # Quote arguments (to preserve shell metacharacters).
649641b2f0bdSmrg      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
649741b2f0bdSmrg      args="$args \"$file\""
649841b2f0bdSmrg    done
649941b2f0bdSmrg
650041b2f0bdSmrg    if test -z "$run"; then
650141b2f0bdSmrg      if test -n "$shlibpath_var"; then
650241b2f0bdSmrg	# Export the shlibpath_var.
650341b2f0bdSmrg	eval "export $shlibpath_var"
650441b2f0bdSmrg      fi
650541b2f0bdSmrg
650641b2f0bdSmrg      # Restore saved environment variables
650711245024Smrg      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
650811245024Smrg      do
650911245024Smrg	eval "if test \"\${save_$lt_var+set}\" = set; then
651011245024Smrg		$lt_var=\$save_$lt_var; export $lt_var
651111245024Smrg	      fi"
651211245024Smrg      done
651341b2f0bdSmrg
651441b2f0bdSmrg      # Now prepare to actually exec the command.
651541b2f0bdSmrg      exec_cmd="\$cmd$args"
651641b2f0bdSmrg    else
651741b2f0bdSmrg      # Display what would be done.
651841b2f0bdSmrg      if test -n "$shlibpath_var"; then
651941b2f0bdSmrg	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
652041b2f0bdSmrg	$echo "export $shlibpath_var"
652141b2f0bdSmrg      fi
652241b2f0bdSmrg      $echo "$cmd$args"
652341b2f0bdSmrg      exit $EXIT_SUCCESS
652441b2f0bdSmrg    fi
652541b2f0bdSmrg    ;;
652641b2f0bdSmrg
652741b2f0bdSmrg  # libtool clean and uninstall mode
652841b2f0bdSmrg  clean | uninstall)
652941b2f0bdSmrg    modename="$modename: $mode"
653041b2f0bdSmrg    rm="$nonopt"
653141b2f0bdSmrg    files=
653241b2f0bdSmrg    rmforce=
653341b2f0bdSmrg    exit_status=0
653441b2f0bdSmrg
653541b2f0bdSmrg    # This variable tells wrapper scripts just to set variables rather
653641b2f0bdSmrg    # than running their programs.
653741b2f0bdSmrg    libtool_install_magic="$magic"
653841b2f0bdSmrg
653941b2f0bdSmrg    for arg
654041b2f0bdSmrg    do
654141b2f0bdSmrg      case $arg in
654241b2f0bdSmrg      -f) rm="$rm $arg"; rmforce=yes ;;
654341b2f0bdSmrg      -*) rm="$rm $arg" ;;
654441b2f0bdSmrg      *) files="$files $arg" ;;
654541b2f0bdSmrg      esac
654641b2f0bdSmrg    done
654741b2f0bdSmrg
654841b2f0bdSmrg    if test -z "$rm"; then
654941b2f0bdSmrg      $echo "$modename: you must specify an RM program" 1>&2
655041b2f0bdSmrg      $echo "$help" 1>&2
655141b2f0bdSmrg      exit $EXIT_FAILURE
655241b2f0bdSmrg    fi
655341b2f0bdSmrg
655441b2f0bdSmrg    rmdirs=
655541b2f0bdSmrg
655641b2f0bdSmrg    origobjdir="$objdir"
655741b2f0bdSmrg    for file in $files; do
655841b2f0bdSmrg      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
655941b2f0bdSmrg      if test "X$dir" = "X$file"; then
656041b2f0bdSmrg	dir=.
656141b2f0bdSmrg	objdir="$origobjdir"
656241b2f0bdSmrg      else
656341b2f0bdSmrg	objdir="$dir/$origobjdir"
656441b2f0bdSmrg      fi
656541b2f0bdSmrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
656641b2f0bdSmrg      test "$mode" = uninstall && objdir="$dir"
656741b2f0bdSmrg
656841b2f0bdSmrg      # Remember objdir for removal later, being careful to avoid duplicates
656941b2f0bdSmrg      if test "$mode" = clean; then
657041b2f0bdSmrg	case " $rmdirs " in
657141b2f0bdSmrg	  *" $objdir "*) ;;
657241b2f0bdSmrg	  *) rmdirs="$rmdirs $objdir" ;;
657341b2f0bdSmrg	esac
657441b2f0bdSmrg      fi
657541b2f0bdSmrg
657641b2f0bdSmrg      # Don't error if the file doesn't exist and rm -f was used.
657741b2f0bdSmrg      if (test -L "$file") >/dev/null 2>&1 \
657841b2f0bdSmrg	|| (test -h "$file") >/dev/null 2>&1 \
657941b2f0bdSmrg	|| test -f "$file"; then
658041b2f0bdSmrg	:
658141b2f0bdSmrg      elif test -d "$file"; then
658241b2f0bdSmrg	exit_status=1
658341b2f0bdSmrg	continue
658441b2f0bdSmrg      elif test "$rmforce" = yes; then
658541b2f0bdSmrg	continue
658641b2f0bdSmrg      fi
658741b2f0bdSmrg
658841b2f0bdSmrg      rmfiles="$file"
658941b2f0bdSmrg
659041b2f0bdSmrg      case $name in
659141b2f0bdSmrg      *.la)
659241b2f0bdSmrg	# Possibly a libtool archive, so verify it.
659341b2f0bdSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
659441b2f0bdSmrg	  . $dir/$name
659541b2f0bdSmrg
659641b2f0bdSmrg	  # Delete the libtool libraries and symlinks.
659741b2f0bdSmrg	  for n in $library_names; do
659841b2f0bdSmrg	    rmfiles="$rmfiles $objdir/$n"
659941b2f0bdSmrg	  done
660041b2f0bdSmrg	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
660141b2f0bdSmrg
660241b2f0bdSmrg	  case "$mode" in
660341b2f0bdSmrg	  clean)
660441b2f0bdSmrg	    case "  $library_names " in
660541b2f0bdSmrg	    # "  " in the beginning catches empty $dlname
660641b2f0bdSmrg	    *" $dlname "*) ;;
660741b2f0bdSmrg	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
660841b2f0bdSmrg	    esac
660941b2f0bdSmrg	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
661041b2f0bdSmrg	    ;;
661141b2f0bdSmrg	  uninstall)
661241b2f0bdSmrg	    if test -n "$library_names"; then
661341b2f0bdSmrg	      # Do each command in the postuninstall commands.
661441b2f0bdSmrg	      cmds=$postuninstall_cmds
661541b2f0bdSmrg	      save_ifs="$IFS"; IFS='~'
661641b2f0bdSmrg	      for cmd in $cmds; do
661741b2f0bdSmrg		IFS="$save_ifs"
661841b2f0bdSmrg		eval cmd=\"$cmd\"
661941b2f0bdSmrg		$show "$cmd"
662041b2f0bdSmrg		$run eval "$cmd"
662141b2f0bdSmrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
662241b2f0bdSmrg		  exit_status=1
662341b2f0bdSmrg		fi
662441b2f0bdSmrg	      done
662541b2f0bdSmrg	      IFS="$save_ifs"
662641b2f0bdSmrg	    fi
662741b2f0bdSmrg
662841b2f0bdSmrg	    if test -n "$old_library"; then
662941b2f0bdSmrg	      # Do each command in the old_postuninstall commands.
663041b2f0bdSmrg	      cmds=$old_postuninstall_cmds
663141b2f0bdSmrg	      save_ifs="$IFS"; IFS='~'
663241b2f0bdSmrg	      for cmd in $cmds; do
663341b2f0bdSmrg		IFS="$save_ifs"
663441b2f0bdSmrg		eval cmd=\"$cmd\"
663541b2f0bdSmrg		$show "$cmd"
663641b2f0bdSmrg		$run eval "$cmd"
663741b2f0bdSmrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
663841b2f0bdSmrg		  exit_status=1
663941b2f0bdSmrg		fi
664041b2f0bdSmrg	      done
664141b2f0bdSmrg	      IFS="$save_ifs"
664241b2f0bdSmrg	    fi
664341b2f0bdSmrg	    # FIXME: should reinstall the best remaining shared library.
664441b2f0bdSmrg	    ;;
664541b2f0bdSmrg	  esac
664641b2f0bdSmrg	fi
664741b2f0bdSmrg	;;
664841b2f0bdSmrg
664941b2f0bdSmrg      *.lo)
665041b2f0bdSmrg	# Possibly a libtool object, so verify it.
665141b2f0bdSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
665241b2f0bdSmrg
665341b2f0bdSmrg	  # Read the .lo file
665441b2f0bdSmrg	  . $dir/$name
665541b2f0bdSmrg
665641b2f0bdSmrg	  # Add PIC object to the list of files to remove.
665741b2f0bdSmrg	  if test -n "$pic_object" \
665841b2f0bdSmrg	     && test "$pic_object" != none; then
665941b2f0bdSmrg	    rmfiles="$rmfiles $dir/$pic_object"
666041b2f0bdSmrg	  fi
666141b2f0bdSmrg
666241b2f0bdSmrg	  # Add non-PIC object to the list of files to remove.
666341b2f0bdSmrg	  if test -n "$non_pic_object" \
666441b2f0bdSmrg	     && test "$non_pic_object" != none; then
666541b2f0bdSmrg	    rmfiles="$rmfiles $dir/$non_pic_object"
666641b2f0bdSmrg	  fi
666741b2f0bdSmrg	fi
666841b2f0bdSmrg	;;
666941b2f0bdSmrg
667041b2f0bdSmrg      *)
667141b2f0bdSmrg	if test "$mode" = clean ; then
667241b2f0bdSmrg	  noexename=$name
667341b2f0bdSmrg	  case $file in
667441b2f0bdSmrg	  *.exe)
667541b2f0bdSmrg	    file=`$echo $file|${SED} 's,.exe$,,'`
667641b2f0bdSmrg	    noexename=`$echo $name|${SED} 's,.exe$,,'`
667741b2f0bdSmrg	    # $file with .exe has already been added to rmfiles,
667841b2f0bdSmrg	    # add $file without .exe
667941b2f0bdSmrg	    rmfiles="$rmfiles $file"
668041b2f0bdSmrg	    ;;
668141b2f0bdSmrg	  esac
668241b2f0bdSmrg	  # Do a test to see if this is a libtool program.
668341b2f0bdSmrg	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
668441b2f0bdSmrg	    relink_command=
668541b2f0bdSmrg	    . $dir/$noexename
668641b2f0bdSmrg
668741b2f0bdSmrg	    # note $name still contains .exe if it was in $file originally
668841b2f0bdSmrg	    # as does the version of $file that was added into $rmfiles
668941b2f0bdSmrg	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
669041b2f0bdSmrg	    if test "$fast_install" = yes && test -n "$relink_command"; then
669141b2f0bdSmrg	      rmfiles="$rmfiles $objdir/lt-$name"
669241b2f0bdSmrg	    fi
669341b2f0bdSmrg	    if test "X$noexename" != "X$name" ; then
669441b2f0bdSmrg	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
669541b2f0bdSmrg	    fi
669641b2f0bdSmrg	  fi
669741b2f0bdSmrg	fi
669841b2f0bdSmrg	;;
669941b2f0bdSmrg      esac
670041b2f0bdSmrg      $show "$rm $rmfiles"
670141b2f0bdSmrg      $run $rm $rmfiles || exit_status=1
670241b2f0bdSmrg    done
670341b2f0bdSmrg    objdir="$origobjdir"
670441b2f0bdSmrg
670541b2f0bdSmrg    # Try to remove the ${objdir}s in the directories where we deleted files
670641b2f0bdSmrg    for dir in $rmdirs; do
670741b2f0bdSmrg      if test -d "$dir"; then
670841b2f0bdSmrg	$show "rmdir $dir"
670941b2f0bdSmrg	$run rmdir $dir >/dev/null 2>&1
671041b2f0bdSmrg      fi
671141b2f0bdSmrg    done
671241b2f0bdSmrg
671341b2f0bdSmrg    exit $exit_status
671441b2f0bdSmrg    ;;
671541b2f0bdSmrg
671641b2f0bdSmrg  "")
671741b2f0bdSmrg    $echo "$modename: you must specify a MODE" 1>&2
671841b2f0bdSmrg    $echo "$generic_help" 1>&2
671941b2f0bdSmrg    exit $EXIT_FAILURE
672041b2f0bdSmrg    ;;
672141b2f0bdSmrg  esac
672241b2f0bdSmrg
672341b2f0bdSmrg  if test -z "$exec_cmd"; then
672441b2f0bdSmrg    $echo "$modename: invalid operation mode \`$mode'" 1>&2
672541b2f0bdSmrg    $echo "$generic_help" 1>&2
672641b2f0bdSmrg    exit $EXIT_FAILURE
672741b2f0bdSmrg  fi
672841b2f0bdSmrgfi # test -z "$show_help"
672941b2f0bdSmrg
673041b2f0bdSmrgif test -n "$exec_cmd"; then
673141b2f0bdSmrg  eval exec $exec_cmd
673241b2f0bdSmrg  exit $EXIT_FAILURE
673341b2f0bdSmrgfi
673441b2f0bdSmrg
673541b2f0bdSmrg# We need to display help for each of the modes.
673641b2f0bdSmrgcase $mode in
673741b2f0bdSmrg"") $echo \
673841b2f0bdSmrg"Usage: $modename [OPTION]... [MODE-ARG]...
673941b2f0bdSmrg
674041b2f0bdSmrgProvide generalized library-building support services.
674141b2f0bdSmrg
674241b2f0bdSmrg    --config          show all configuration variables
674341b2f0bdSmrg    --debug           enable verbose shell tracing
674441b2f0bdSmrg-n, --dry-run         display commands without modifying any files
674541b2f0bdSmrg    --features        display basic configuration information and exit
674641b2f0bdSmrg    --finish          same as \`--mode=finish'
674741b2f0bdSmrg    --help            display this help message and exit
674841b2f0bdSmrg    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
674941b2f0bdSmrg    --quiet           same as \`--silent'
675041b2f0bdSmrg    --silent          don't print informational messages
675141b2f0bdSmrg    --tag=TAG         use configuration variables from tag TAG
675241b2f0bdSmrg    --version         print version information
675341b2f0bdSmrg
675441b2f0bdSmrgMODE must be one of the following:
675541b2f0bdSmrg
675641b2f0bdSmrg      clean           remove files from the build directory
675741b2f0bdSmrg      compile         compile a source file into a libtool object
675841b2f0bdSmrg      execute         automatically set library path, then run a program
675941b2f0bdSmrg      finish          complete the installation of libtool libraries
676041b2f0bdSmrg      install         install libraries or executables
676141b2f0bdSmrg      link            create a library or an executable
676241b2f0bdSmrg      uninstall       remove libraries from an installed directory
676341b2f0bdSmrg
676441b2f0bdSmrgMODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
676541b2f0bdSmrga more detailed description of MODE.
676641b2f0bdSmrg
676741b2f0bdSmrgReport bugs to <bug-libtool@gnu.org>."
676841b2f0bdSmrg  exit $EXIT_SUCCESS
676941b2f0bdSmrg  ;;
677041b2f0bdSmrg
677141b2f0bdSmrgclean)
677241b2f0bdSmrg  $echo \
677341b2f0bdSmrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
677441b2f0bdSmrg
677541b2f0bdSmrgRemove files from the build directory.
677641b2f0bdSmrg
677741b2f0bdSmrgRM is the name of the program to use to delete files associated with each FILE
677841b2f0bdSmrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
677941b2f0bdSmrgto RM.
678041b2f0bdSmrg
678141b2f0bdSmrgIf FILE is a libtool library, object or program, all the files associated
678241b2f0bdSmrgwith it are deleted. Otherwise, only FILE itself is deleted using RM."
678341b2f0bdSmrg  ;;
678441b2f0bdSmrg
678541b2f0bdSmrgcompile)
678641b2f0bdSmrg  $echo \
678741b2f0bdSmrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
678841b2f0bdSmrg
678941b2f0bdSmrgCompile a source file into a libtool library object.
679041b2f0bdSmrg
679141b2f0bdSmrgThis mode accepts the following additional options:
679241b2f0bdSmrg
679341b2f0bdSmrg  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
679441b2f0bdSmrg  -prefer-pic       try to building PIC objects only
679541b2f0bdSmrg  -prefer-non-pic   try to building non-PIC objects only
679641b2f0bdSmrg  -static           always build a \`.o' file suitable for static linking
679741b2f0bdSmrg
679841b2f0bdSmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file
679941b2f0bdSmrgfrom the given SOURCEFILE.
680041b2f0bdSmrg
680141b2f0bdSmrgThe output file name is determined by removing the directory component from
680241b2f0bdSmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the
680341b2f0bdSmrglibrary object suffix, \`.lo'."
680441b2f0bdSmrg  ;;
680541b2f0bdSmrg
680641b2f0bdSmrgexecute)
680741b2f0bdSmrg  $echo \
680841b2f0bdSmrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
680941b2f0bdSmrg
681041b2f0bdSmrgAutomatically set library path, then run a program.
681141b2f0bdSmrg
681241b2f0bdSmrgThis mode accepts the following additional options:
681341b2f0bdSmrg
681441b2f0bdSmrg  -dlopen FILE      add the directory containing FILE to the library path
681541b2f0bdSmrg
681641b2f0bdSmrgThis mode sets the library path environment variable according to \`-dlopen'
681741b2f0bdSmrgflags.
681841b2f0bdSmrg
681941b2f0bdSmrgIf any of the ARGS are libtool executable wrappers, then they are translated
682041b2f0bdSmrginto their corresponding uninstalled binary, and any of their required library
682141b2f0bdSmrgdirectories are added to the library path.
682241b2f0bdSmrg
682341b2f0bdSmrgThen, COMMAND is executed, with ARGS as arguments."
682441b2f0bdSmrg  ;;
682541b2f0bdSmrg
682641b2f0bdSmrgfinish)
682741b2f0bdSmrg  $echo \
682841b2f0bdSmrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
682941b2f0bdSmrg
683041b2f0bdSmrgComplete the installation of libtool libraries.
683141b2f0bdSmrg
683241b2f0bdSmrgEach LIBDIR is a directory that contains libtool libraries.
683341b2f0bdSmrg
683441b2f0bdSmrgThe commands that this mode executes may require superuser privileges.  Use
683541b2f0bdSmrgthe \`--dry-run' option if you just want to see what would be executed."
683641b2f0bdSmrg  ;;
683741b2f0bdSmrg
683841b2f0bdSmrginstall)
683941b2f0bdSmrg  $echo \
684041b2f0bdSmrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
684141b2f0bdSmrg
684241b2f0bdSmrgInstall executables or libraries.
684341b2f0bdSmrg
684441b2f0bdSmrgINSTALL-COMMAND is the installation command.  The first component should be
684541b2f0bdSmrgeither the \`install' or \`cp' program.
684641b2f0bdSmrg
684741b2f0bdSmrgThe rest of the components are interpreted as arguments to that command (only
684841b2f0bdSmrgBSD-compatible install options are recognized)."
684941b2f0bdSmrg  ;;
685041b2f0bdSmrg
685141b2f0bdSmrglink)
685241b2f0bdSmrg  $echo \
685341b2f0bdSmrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
685441b2f0bdSmrg
685541b2f0bdSmrgLink object files or libraries together to form another library, or to
685641b2f0bdSmrgcreate an executable program.
685741b2f0bdSmrg
685841b2f0bdSmrgLINK-COMMAND is a command using the C compiler that you would use to create
685941b2f0bdSmrga program from several object files.
686041b2f0bdSmrg
686141b2f0bdSmrgThe following components of LINK-COMMAND are treated specially:
686241b2f0bdSmrg
686341b2f0bdSmrg  -all-static       do not do any dynamic linking at all
686441b2f0bdSmrg  -avoid-version    do not add a version suffix if possible
686541b2f0bdSmrg  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
686641b2f0bdSmrg  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
686741b2f0bdSmrg  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
686841b2f0bdSmrg  -export-symbols SYMFILE
686911245024Smrg                    try to export only the symbols listed in SYMFILE
687041b2f0bdSmrg  -export-symbols-regex REGEX
687111245024Smrg                    try to export only the symbols matching REGEX
687241b2f0bdSmrg  -LLIBDIR          search LIBDIR for required installed libraries
687341b2f0bdSmrg  -lNAME            OUTPUT-FILE requires the installed library libNAME
687441b2f0bdSmrg  -module           build a library that can dlopened
687541b2f0bdSmrg  -no-fast-install  disable the fast-install mode
687641b2f0bdSmrg  -no-install       link a not-installable executable
687741b2f0bdSmrg  -no-undefined     declare that a library does not refer to external symbols
687841b2f0bdSmrg  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
687941b2f0bdSmrg  -objectlist FILE  Use a list of object files found in FILE to specify objects
688041b2f0bdSmrg  -precious-files-regex REGEX
688141b2f0bdSmrg                    don't remove output files matching REGEX
688241b2f0bdSmrg  -release RELEASE  specify package release information
688341b2f0bdSmrg  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
688441b2f0bdSmrg  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
688511245024Smrg  -static           do not do any dynamic linking of uninstalled libtool libraries
688611245024Smrg  -static-libtool-libs
688711245024Smrg                    do not do any dynamic linking of libtool libraries
688841b2f0bdSmrg  -version-info CURRENT[:REVISION[:AGE]]
688911245024Smrg                    specify library version info [each variable defaults to 0]
689041b2f0bdSmrg
689141b2f0bdSmrgAll other options (arguments beginning with \`-') are ignored.
689241b2f0bdSmrg
689341b2f0bdSmrgEvery other argument is treated as a filename.  Files ending in \`.la' are
689441b2f0bdSmrgtreated as uninstalled libtool libraries, other files are standard or library
689541b2f0bdSmrgobject files.
689641b2f0bdSmrg
689741b2f0bdSmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created,
689841b2f0bdSmrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is
689941b2f0bdSmrgrequired, except when creating a convenience library.
690041b2f0bdSmrg
690141b2f0bdSmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
690241b2f0bdSmrgusing \`ar' and \`ranlib', or on Windows using \`lib'.
690341b2f0bdSmrg
690441b2f0bdSmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
690541b2f0bdSmrgis created, otherwise an executable program is created."
690641b2f0bdSmrg  ;;
690741b2f0bdSmrg
690841b2f0bdSmrguninstall)
690941b2f0bdSmrg  $echo \
691041b2f0bdSmrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
691141b2f0bdSmrg
691241b2f0bdSmrgRemove libraries from an installation directory.
691341b2f0bdSmrg
691441b2f0bdSmrgRM is the name of the program to use to delete files associated with each FILE
691541b2f0bdSmrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
691641b2f0bdSmrgto RM.
691741b2f0bdSmrg
691841b2f0bdSmrgIf FILE is a libtool library, all the files associated with it are deleted.
691941b2f0bdSmrgOtherwise, only FILE itself is deleted using RM."
692041b2f0bdSmrg  ;;
692141b2f0bdSmrg
692241b2f0bdSmrg*)
692341b2f0bdSmrg  $echo "$modename: invalid operation mode \`$mode'" 1>&2
692441b2f0bdSmrg  $echo "$help" 1>&2
692541b2f0bdSmrg  exit $EXIT_FAILURE
692641b2f0bdSmrg  ;;
692741b2f0bdSmrgesac
692841b2f0bdSmrg
692941b2f0bdSmrg$echo
693041b2f0bdSmrg$echo "Try \`$modename --help' for more information about other modes."
693141b2f0bdSmrg
693241b2f0bdSmrgexit $?
693341b2f0bdSmrg
693441b2f0bdSmrg# The TAGs below are defined such that we never get into a situation
693541b2f0bdSmrg# in which we disable both kinds of libraries.  Given conflicting
693641b2f0bdSmrg# choices, we go for a static library, that is the most portable,
693741b2f0bdSmrg# since we can't tell whether shared libraries were disabled because
693841b2f0bdSmrg# the user asked for that or because the platform doesn't support
693941b2f0bdSmrg# them.  This is particularly important on AIX, because we don't
694041b2f0bdSmrg# support having both static and shared libraries enabled at the same
694141b2f0bdSmrg# time on that platform, so we default to a shared-only configuration.
694241b2f0bdSmrg# If a disable-shared tag is given, we'll fallback to a static-only
694341b2f0bdSmrg# configuration.  But we'll never go from static-only to shared-only.
694441b2f0bdSmrg
694541b2f0bdSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
694641b2f0bdSmrgdisable_libs=shared
694741b2f0bdSmrg# ### END LIBTOOL TAG CONFIG: disable-shared
694841b2f0bdSmrg
694941b2f0bdSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static
695041b2f0bdSmrgdisable_libs=static
695141b2f0bdSmrg# ### END LIBTOOL TAG CONFIG: disable-static
695241b2f0bdSmrg
695341b2f0bdSmrg# Local Variables:
695441b2f0bdSmrg# mode:shell-script
695541b2f0bdSmrg# sh-indentation:2
695641b2f0bdSmrg# End:
6957