ltmain.sh revision 61b2299d
11ab64890Smrg# ltmain.sh - Provide generalized library-building support services.
21ab64890Smrg# NOTE: Changing this file will not affect anything until you rerun configure.
31ab64890Smrg#
41ab64890Smrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
561b2299dSmrg# 2007, 2008  Free Software Foundation, Inc.
61ab64890Smrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
71ab64890Smrg#
81ab64890Smrg# This program is free software; you can redistribute it and/or modify
91ab64890Smrg# it under the terms of the GNU General Public License as published by
101ab64890Smrg# the Free Software Foundation; either version 2 of the License, or
111ab64890Smrg# (at your option) any later version.
121ab64890Smrg#
131ab64890Smrg# This program is distributed in the hope that it will be useful, but
141ab64890Smrg# WITHOUT ANY WARRANTY; without even the implied warranty of
151ab64890Smrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
161ab64890Smrg# General Public License for more details.
171ab64890Smrg#
181ab64890Smrg# You should have received a copy of the GNU General Public License
191ab64890Smrg# along with this program; if not, write to the Free Software
201ab64890Smrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
211ab64890Smrg#
221ab64890Smrg# As a special exception to the GNU General Public License, if you
231ab64890Smrg# distribute this file as part of a program that contains a
241ab64890Smrg# configuration script generated by Autoconf, you may include it under
251ab64890Smrg# the same distribution terms that you use for the rest of that program.
261ab64890Smrg
271ab64890Smrgbasename="s,^.*/,,g"
281ab64890Smrg
291ab64890Smrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
301ab64890Smrg# is ksh but when the shell is invoked as "sh" and the current value of
311ab64890Smrg# the _XPG environment variable is not equal to 1 (one), the special
321ab64890Smrg# positional parameter $0, within a function call, is the name of the
331ab64890Smrg# function.
341ab64890Smrgprogpath="$0"
351ab64890Smrg
361ab64890Smrg# The name of this program:
371ab64890Smrgprogname=`echo "$progpath" | $SED $basename`
381ab64890Smrgmodename="$progname"
391ab64890Smrg
401ab64890Smrg# Global variables:
411ab64890SmrgEXIT_SUCCESS=0
421ab64890SmrgEXIT_FAILURE=1
431ab64890Smrg
441ab64890SmrgPROGRAM=ltmain.sh
451ab64890SmrgPACKAGE=libtool
4661b2299dSmrgVERSION="1.5.26 Debian 1.5.26-4"
4761b2299dSmrgTIMESTAMP=" (1.1220.2.493 2008/02/01 16:58:18)"
481ab64890Smrg
491ab64890Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
501ab64890Smrgif test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
511ab64890Smrg  emulate sh
521ab64890Smrg  NULLCMD=:
531ab64890Smrg  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
541ab64890Smrg  # is contrary to our usage.  Disable this feature.
551ab64890Smrg  alias -g '${1+"$@"}'='"$@"'
561ab64890Smrg  setopt NO_GLOB_SUBST
571ab64890Smrgelse
581ab64890Smrg  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
591ab64890Smrgfi
601ab64890SmrgBIN_SH=xpg4; export BIN_SH # for Tru64
611ab64890SmrgDUALCASE=1; export DUALCASE # for MKS sh
621ab64890Smrg
631ab64890Smrg# Check that we have a working $echo.
641ab64890Smrgif test "X$1" = X--no-reexec; then
651ab64890Smrg  # Discard the --no-reexec flag, and continue.
661ab64890Smrg  shift
671ab64890Smrgelif test "X$1" = X--fallback-echo; then
681ab64890Smrg  # Avoid inline document here, it may be left over
691ab64890Smrg  :
701ab64890Smrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
711ab64890Smrg  # Yippee, $echo works!
721ab64890Smrg  :
731ab64890Smrgelse
741ab64890Smrg  # Restart under the correct shell, and then maybe $echo will work.
751ab64890Smrg  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
761ab64890Smrgfi
771ab64890Smrg
781ab64890Smrgif test "X$1" = X--fallback-echo; then
791ab64890Smrg  # used as fallback echo
801ab64890Smrg  shift
811ab64890Smrg  cat <<EOF
821ab64890Smrg$*
831ab64890SmrgEOF
841ab64890Smrg  exit $EXIT_SUCCESS
851ab64890Smrgfi
861ab64890Smrg
871ab64890Smrgdefault_mode=
881ab64890Smrghelp="Try \`$progname --help' for more information."
891ab64890Smrgmagic="%%%MAGIC variable%%%"
901ab64890Smrgmkdir="mkdir"
911ab64890Smrgmv="mv -f"
921ab64890Smrgrm="rm -f"
931ab64890Smrg
941ab64890Smrg# Sed substitution that helps us do robust quoting.  It backslashifies
951ab64890Smrg# metacharacters that are still active within double-quoted strings.
961ab64890SmrgXsed="${SED}"' -e 1s/^X//'
971ab64890Smrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
981ab64890Smrg# test EBCDIC or ASCII
991ab64890Smrgcase `echo X|tr X '\101'` in
1001ab64890Smrg A) # ASCII based system
1011ab64890Smrg    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
1021ab64890Smrg  SP2NL='tr \040 \012'
1031ab64890Smrg  NL2SP='tr \015\012 \040\040'
1041ab64890Smrg  ;;
1051ab64890Smrg *) # EBCDIC based system
1061ab64890Smrg  SP2NL='tr \100 \n'
1071ab64890Smrg  NL2SP='tr \r\n \100\100'
1081ab64890Smrg  ;;
1091ab64890Smrgesac
1101ab64890Smrg
1111ab64890Smrg# NLS nuisances.
1121ab64890Smrg# Only set LANG and LC_ALL to C if already set.
1131ab64890Smrg# These must not be set unconditionally because not all systems understand
1141ab64890Smrg# e.g. LANG=C (notably SCO).
1151ab64890Smrg# We save the old values to restore during execute mode.
11661b2299dSmrglt_env=
11761b2299dSmrgfor lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
1181ab64890Smrgdo
1191ab64890Smrg  eval "if test \"\${$lt_var+set}\" = set; then
1201ab64890Smrg	  save_$lt_var=\$$lt_var
12161b2299dSmrg	  lt_env=\"$lt_var=\$$lt_var \$lt_env\"
1221ab64890Smrg	  $lt_var=C
1231ab64890Smrg	  export $lt_var
1241ab64890Smrg	fi"
1251ab64890Smrgdone
1261ab64890Smrg
12761b2299dSmrgif test -n "$lt_env"; then
12861b2299dSmrg  lt_env="env $lt_env"
12961b2299dSmrgfi
13061b2299dSmrg
1311ab64890Smrg# Make sure IFS has a sensible default
1321ab64890Smrglt_nl='
1331ab64890Smrg'
1341ab64890SmrgIFS=" 	$lt_nl"
1351ab64890Smrg
1361ab64890Smrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1371ab64890Smrg  $echo "$modename: not configured to build any kind of library" 1>&2
1381ab64890Smrg  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
1391ab64890Smrg  exit $EXIT_FAILURE
1401ab64890Smrgfi
1411ab64890Smrg
1421ab64890Smrg# Global variables.
1431ab64890Smrgmode=$default_mode
1441ab64890Smrgnonopt=
1451ab64890Smrgprev=
1461ab64890Smrgprevopt=
1471ab64890Smrgrun=
1481ab64890Smrgshow="$echo"
1491ab64890Smrgshow_help=
1501ab64890Smrgexecute_dlfiles=
1511ab64890Smrgduplicate_deps=no
1521ab64890Smrgpreserve_args=
1531ab64890Smrglo2o="s/\\.lo\$/.${objext}/"
1541ab64890Smrgo2lo="s/\\.${objext}\$/.lo/"
1551ab64890Smrgextracted_archives=
1561ab64890Smrgextracted_serial=0
1571ab64890Smrg
1581ab64890Smrg#####################################
1591ab64890Smrg# Shell function definitions:
1601ab64890Smrg# This seems to be the best place for them
1611ab64890Smrg
1621ab64890Smrg# func_mktempdir [string]
1631ab64890Smrg# Make a temporary directory that won't clash with other running
1641ab64890Smrg# libtool processes, and avoids race conditions if possible.  If
1651ab64890Smrg# given, STRING is the basename for that directory.
1661ab64890Smrgfunc_mktempdir ()
1671ab64890Smrg{
1681ab64890Smrg    my_template="${TMPDIR-/tmp}/${1-$progname}"
1691ab64890Smrg
1701ab64890Smrg    if test "$run" = ":"; then
1711ab64890Smrg      # Return a directory name, but don't create it in dry-run mode
1721ab64890Smrg      my_tmpdir="${my_template}-$$"
1731ab64890Smrg    else
1741ab64890Smrg
1751ab64890Smrg      # If mktemp works, use that first and foremost
1761ab64890Smrg      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
1771ab64890Smrg
1781ab64890Smrg      if test ! -d "$my_tmpdir"; then
1791ab64890Smrg	# Failing that, at least try and use $RANDOM to avoid a race
1801ab64890Smrg	my_tmpdir="${my_template}-${RANDOM-0}$$"
1811ab64890Smrg
1821ab64890Smrg	save_mktempdir_umask=`umask`
1831ab64890Smrg	umask 0077
1841ab64890Smrg	$mkdir "$my_tmpdir"
1851ab64890Smrg	umask $save_mktempdir_umask
1861ab64890Smrg      fi
1871ab64890Smrg
1881ab64890Smrg      # If we're not in dry-run mode, bomb out on failure
1891ab64890Smrg      test -d "$my_tmpdir" || {
1901ab64890Smrg        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
1911ab64890Smrg	exit $EXIT_FAILURE
1921ab64890Smrg      }
1931ab64890Smrg    fi
1941ab64890Smrg
1951ab64890Smrg    $echo "X$my_tmpdir" | $Xsed
1961ab64890Smrg}
1971ab64890Smrg
1981ab64890Smrg
1991ab64890Smrg# func_win32_libid arg
2001ab64890Smrg# return the library type of file 'arg'
2011ab64890Smrg#
2021ab64890Smrg# Need a lot of goo to handle *both* DLLs and import libs
2031ab64890Smrg# Has to be a shell function in order to 'eat' the argument
2041ab64890Smrg# that is supplied when $file_magic_command is called.
2051ab64890Smrgfunc_win32_libid ()
2061ab64890Smrg{
2071ab64890Smrg  win32_libid_type="unknown"
2081ab64890Smrg  win32_fileres=`file -L $1 2>/dev/null`
2091ab64890Smrg  case $win32_fileres in
2101ab64890Smrg  *ar\ archive\ import\ library*) # definitely import
2111ab64890Smrg    win32_libid_type="x86 archive import"
2121ab64890Smrg    ;;
2131ab64890Smrg  *ar\ archive*) # could be an import, or static
2141ab64890Smrg    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
2151ab64890Smrg      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
2161ab64890Smrg      win32_nmres=`eval $NM -f posix -A $1 | \
2171ab64890Smrg	$SED -n -e '1,100{
2181ab64890Smrg		/ I /{
2191ab64890Smrg			s,.*,import,
2201ab64890Smrg			p
2211ab64890Smrg			q
2221ab64890Smrg			}
2231ab64890Smrg		}'`
2241ab64890Smrg      case $win32_nmres in
2251ab64890Smrg      import*)  win32_libid_type="x86 archive import";;
2261ab64890Smrg      *)        win32_libid_type="x86 archive static";;
2271ab64890Smrg      esac
2281ab64890Smrg    fi
2291ab64890Smrg    ;;
2301ab64890Smrg  *DLL*)
2311ab64890Smrg    win32_libid_type="x86 DLL"
2321ab64890Smrg    ;;
2331ab64890Smrg  *executable*) # but shell scripts are "executable" too...
2341ab64890Smrg    case $win32_fileres in
2351ab64890Smrg    *MS\ Windows\ PE\ Intel*)
2361ab64890Smrg      win32_libid_type="x86 DLL"
2371ab64890Smrg      ;;
2381ab64890Smrg    esac
2391ab64890Smrg    ;;
2401ab64890Smrg  esac
2411ab64890Smrg  $echo $win32_libid_type
2421ab64890Smrg}
2431ab64890Smrg
2441ab64890Smrg
2451ab64890Smrg# func_infer_tag arg
2461ab64890Smrg# Infer tagged configuration to use if any are available and
2471ab64890Smrg# if one wasn't chosen via the "--tag" command line option.
2481ab64890Smrg# Only attempt this if the compiler in the base compile
2491ab64890Smrg# command doesn't match the default compiler.
2501ab64890Smrg# arg is usually of the form 'gcc ...'
2511ab64890Smrgfunc_infer_tag ()
2521ab64890Smrg{
2531ab64890Smrg    if test -n "$available_tags" && test -z "$tagname"; then
2541ab64890Smrg      CC_quoted=
2551ab64890Smrg      for arg in $CC; do
2561ab64890Smrg	case $arg in
2571ab64890Smrg	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
2581ab64890Smrg	  arg="\"$arg\""
2591ab64890Smrg	  ;;
2601ab64890Smrg	esac
2611ab64890Smrg	CC_quoted="$CC_quoted $arg"
2621ab64890Smrg      done
2631ab64890Smrg      case $@ in
2641ab64890Smrg      # Blanks in the command may have been stripped by the calling shell,
2651ab64890Smrg      # but not from the CC environment variable when configure was run.
2661ab64890Smrg      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
2671ab64890Smrg      # Blanks at the start of $base_compile will cause this to fail
2681ab64890Smrg      # if we don't check for them as well.
2691ab64890Smrg      *)
2701ab64890Smrg	for z in $available_tags; do
2711ab64890Smrg	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
2721ab64890Smrg	    # Evaluate the configuration.
2731ab64890Smrg	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
2741ab64890Smrg	    CC_quoted=
2751ab64890Smrg	    for arg in $CC; do
2761ab64890Smrg	    # Double-quote args containing other shell metacharacters.
2771ab64890Smrg	    case $arg in
2781ab64890Smrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
2791ab64890Smrg	      arg="\"$arg\""
2801ab64890Smrg	      ;;
2811ab64890Smrg	    esac
2821ab64890Smrg	    CC_quoted="$CC_quoted $arg"
2831ab64890Smrg	  done
2841ab64890Smrg	    case "$@ " in
2851ab64890Smrg	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
2861ab64890Smrg	      # The compiler in the base compile command matches
2871ab64890Smrg	      # the one in the tagged configuration.
2881ab64890Smrg	      # Assume this is the tagged configuration we want.
2891ab64890Smrg	      tagname=$z
2901ab64890Smrg	      break
2911ab64890Smrg	      ;;
2921ab64890Smrg	    esac
2931ab64890Smrg	  fi
2941ab64890Smrg	done
2951ab64890Smrg	# If $tagname still isn't set, then no tagged configuration
2961ab64890Smrg	# was found and let the user know that the "--tag" command
2971ab64890Smrg	# line option must be used.
2981ab64890Smrg	if test -z "$tagname"; then
2991ab64890Smrg	  $echo "$modename: unable to infer tagged configuration"
3001ab64890Smrg	  $echo "$modename: specify a tag with \`--tag'" 1>&2
3011ab64890Smrg	  exit $EXIT_FAILURE
3021ab64890Smrg#        else
3031ab64890Smrg#          $echo "$modename: using $tagname tagged configuration"
3041ab64890Smrg	fi
3051ab64890Smrg	;;
3061ab64890Smrg      esac
3071ab64890Smrg    fi
3081ab64890Smrg}
3091ab64890Smrg
3101ab64890Smrg
3111ab64890Smrg# func_extract_an_archive dir oldlib
3121ab64890Smrgfunc_extract_an_archive ()
3131ab64890Smrg{
3141ab64890Smrg    f_ex_an_ar_dir="$1"; shift
3151ab64890Smrg    f_ex_an_ar_oldlib="$1"
3161ab64890Smrg
3171ab64890Smrg    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
3181ab64890Smrg    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
3191ab64890Smrg    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
3201ab64890Smrg     :
3211ab64890Smrg    else
3221ab64890Smrg      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
3231ab64890Smrg      exit $EXIT_FAILURE
3241ab64890Smrg    fi
3251ab64890Smrg}
3261ab64890Smrg
3271ab64890Smrg# func_extract_archives gentop oldlib ...
3281ab64890Smrgfunc_extract_archives ()
3291ab64890Smrg{
3301ab64890Smrg    my_gentop="$1"; shift
3311ab64890Smrg    my_oldlibs=${1+"$@"}
3321ab64890Smrg    my_oldobjs=""
3331ab64890Smrg    my_xlib=""
3341ab64890Smrg    my_xabs=""
3351ab64890Smrg    my_xdir=""
3361ab64890Smrg    my_status=""
3371ab64890Smrg
3381ab64890Smrg    $show "${rm}r $my_gentop"
3391ab64890Smrg    $run ${rm}r "$my_gentop"
3401ab64890Smrg    $show "$mkdir $my_gentop"
3411ab64890Smrg    $run $mkdir "$my_gentop"
3421ab64890Smrg    my_status=$?
3431ab64890Smrg    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
3441ab64890Smrg      exit $my_status
3451ab64890Smrg    fi
3461ab64890Smrg
3471ab64890Smrg    for my_xlib in $my_oldlibs; do
3481ab64890Smrg      # Extract the objects.
3491ab64890Smrg      case $my_xlib in
3501ab64890Smrg	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3511ab64890Smrg	*) my_xabs=`pwd`"/$my_xlib" ;;
3521ab64890Smrg      esac
3531ab64890Smrg      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
3541ab64890Smrg      my_xlib_u=$my_xlib
3551ab64890Smrg      while :; do
3561ab64890Smrg        case " $extracted_archives " in
3571ab64890Smrg	*" $my_xlib_u "*)
3581ab64890Smrg	  extracted_serial=`expr $extracted_serial + 1`
3591ab64890Smrg	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
3601ab64890Smrg	*) break ;;
3611ab64890Smrg	esac
3621ab64890Smrg      done
3631ab64890Smrg      extracted_archives="$extracted_archives $my_xlib_u"
3641ab64890Smrg      my_xdir="$my_gentop/$my_xlib_u"
3651ab64890Smrg
3661ab64890Smrg      $show "${rm}r $my_xdir"
3671ab64890Smrg      $run ${rm}r "$my_xdir"
3681ab64890Smrg      $show "$mkdir $my_xdir"
3691ab64890Smrg      $run $mkdir "$my_xdir"
3701ab64890Smrg      exit_status=$?
3711ab64890Smrg      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
3721ab64890Smrg	exit $exit_status
3731ab64890Smrg      fi
3741ab64890Smrg      case $host in
3751ab64890Smrg      *-darwin*)
3761ab64890Smrg	$show "Extracting $my_xabs"
3771ab64890Smrg	# Do not bother doing anything if just a dry run
3781ab64890Smrg	if test -z "$run"; then
3791ab64890Smrg	  darwin_orig_dir=`pwd`
3801ab64890Smrg	  cd $my_xdir || exit $?
3811ab64890Smrg	  darwin_archive=$my_xabs
3821ab64890Smrg	  darwin_curdir=`pwd`
3831ab64890Smrg	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
3841ab64890Smrg	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
3851ab64890Smrg	  if test -n "$darwin_arches"; then 
3861ab64890Smrg	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
3871ab64890Smrg	    darwin_arch=
3881ab64890Smrg	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
3891ab64890Smrg	    for darwin_arch in  $darwin_arches ; do
3901ab64890Smrg	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3911ab64890Smrg	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3921ab64890Smrg	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3931ab64890Smrg	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3941ab64890Smrg	      cd "$darwin_curdir"
3951ab64890Smrg	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3961ab64890Smrg	    done # $darwin_arches
3971ab64890Smrg      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
3981ab64890Smrg	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
3991ab64890Smrg	    darwin_file=
4001ab64890Smrg	    darwin_files=
4011ab64890Smrg	    for darwin_file in $darwin_filelist; do
4021ab64890Smrg	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
4031ab64890Smrg	      lipo -create -output "$darwin_file" $darwin_files
4041ab64890Smrg	    done # $darwin_filelist
4051ab64890Smrg	    ${rm}r unfat-$$
4061ab64890Smrg	    cd "$darwin_orig_dir"
4071ab64890Smrg	  else
4081ab64890Smrg	    cd "$darwin_orig_dir"
4091ab64890Smrg 	    func_extract_an_archive "$my_xdir" "$my_xabs"
4101ab64890Smrg	  fi # $darwin_arches
4111ab64890Smrg	fi # $run
4121ab64890Smrg	;;
4131ab64890Smrg      *)
4141ab64890Smrg        func_extract_an_archive "$my_xdir" "$my_xabs"
4151ab64890Smrg        ;;
4161ab64890Smrg      esac
4171ab64890Smrg      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
4181ab64890Smrg    done
4191ab64890Smrg    func_extract_archives_result="$my_oldobjs"
4201ab64890Smrg}
4211ab64890Smrg# End of Shell function definitions
4221ab64890Smrg#####################################
4231ab64890Smrg
4241ab64890Smrg# Darwin sucks
4251ab64890Smrgeval std_shrext=\"$shrext_cmds\"
4261ab64890Smrg
4271ab64890Smrgdisable_libs=no
4281ab64890Smrg
4291ab64890Smrg# Parse our command line options once, thoroughly.
4301ab64890Smrgwhile test "$#" -gt 0
4311ab64890Smrgdo
4321ab64890Smrg  arg="$1"
4331ab64890Smrg  shift
4341ab64890Smrg
4351ab64890Smrg  case $arg in
4361ab64890Smrg  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
4371ab64890Smrg  *) optarg= ;;
4381ab64890Smrg  esac
4391ab64890Smrg
4401ab64890Smrg  # If the previous option needs an argument, assign it.
4411ab64890Smrg  if test -n "$prev"; then
4421ab64890Smrg    case $prev in
4431ab64890Smrg    execute_dlfiles)
4441ab64890Smrg      execute_dlfiles="$execute_dlfiles $arg"
4451ab64890Smrg      ;;
4461ab64890Smrg    tag)
4471ab64890Smrg      tagname="$arg"
4481ab64890Smrg      preserve_args="${preserve_args}=$arg"
4491ab64890Smrg
4501ab64890Smrg      # Check whether tagname contains only valid characters
4511ab64890Smrg      case $tagname in
4521ab64890Smrg      *[!-_A-Za-z0-9,/]*)
4531ab64890Smrg	$echo "$progname: invalid tag name: $tagname" 1>&2
4541ab64890Smrg	exit $EXIT_FAILURE
4551ab64890Smrg	;;
4561ab64890Smrg      esac
4571ab64890Smrg
4581ab64890Smrg      case $tagname in
4591ab64890Smrg      CC)
4601ab64890Smrg	# Don't test for the "default" C tag, as we know, it's there, but
4611ab64890Smrg	# not specially marked.
4621ab64890Smrg	;;
4631ab64890Smrg      *)
4641ab64890Smrg	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
4651ab64890Smrg	  taglist="$taglist $tagname"
4661ab64890Smrg	  # Evaluate the configuration.
4671ab64890Smrg	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
4681ab64890Smrg	else
4691ab64890Smrg	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
4701ab64890Smrg	fi
4711ab64890Smrg	;;
4721ab64890Smrg      esac
4731ab64890Smrg      ;;
4741ab64890Smrg    *)
4751ab64890Smrg      eval "$prev=\$arg"
4761ab64890Smrg      ;;
4771ab64890Smrg    esac
4781ab64890Smrg
4791ab64890Smrg    prev=
4801ab64890Smrg    prevopt=
4811ab64890Smrg    continue
4821ab64890Smrg  fi
4831ab64890Smrg
4841ab64890Smrg  # Have we seen a non-optional argument yet?
4851ab64890Smrg  case $arg in
4861ab64890Smrg  --help)
4871ab64890Smrg    show_help=yes
4881ab64890Smrg    ;;
4891ab64890Smrg
4901ab64890Smrg  --version)
4911ab64890Smrg    echo "\
4921ab64890Smrg$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
4931ab64890Smrg
49461b2299dSmrgCopyright (C) 2008  Free Software Foundation, Inc.
4951ab64890SmrgThis is free software; see the source for copying conditions.  There is NO
4961ab64890Smrgwarranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
4971ab64890Smrg    exit $?
4981ab64890Smrg    ;;
4991ab64890Smrg
5001ab64890Smrg  --config)
5011ab64890Smrg    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
5021ab64890Smrg    # Now print the configurations for the tags.
5031ab64890Smrg    for tagname in $taglist; do
5041ab64890Smrg      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
5051ab64890Smrg    done
5061ab64890Smrg    exit $?
5071ab64890Smrg    ;;
5081ab64890Smrg
5091ab64890Smrg  --debug)
5101ab64890Smrg    $echo "$progname: enabling shell trace mode"
5111ab64890Smrg    set -x
5121ab64890Smrg    preserve_args="$preserve_args $arg"
5131ab64890Smrg    ;;
5141ab64890Smrg
5151ab64890Smrg  --dry-run | -n)
5161ab64890Smrg    run=:
5171ab64890Smrg    ;;
5181ab64890Smrg
5191ab64890Smrg  --features)
5201ab64890Smrg    $echo "host: $host"
5211ab64890Smrg    if test "$build_libtool_libs" = yes; then
5221ab64890Smrg      $echo "enable shared libraries"
5231ab64890Smrg    else
5241ab64890Smrg      $echo "disable shared libraries"
5251ab64890Smrg    fi
5261ab64890Smrg    if test "$build_old_libs" = yes; then
5271ab64890Smrg      $echo "enable static libraries"
5281ab64890Smrg    else
5291ab64890Smrg      $echo "disable static libraries"
5301ab64890Smrg    fi
5311ab64890Smrg    exit $?
5321ab64890Smrg    ;;
5331ab64890Smrg
5341ab64890Smrg  --finish) mode="finish" ;;
5351ab64890Smrg
5361ab64890Smrg  --mode) prevopt="--mode" prev=mode ;;
5371ab64890Smrg  --mode=*) mode="$optarg" ;;
5381ab64890Smrg
5391ab64890Smrg  --preserve-dup-deps) duplicate_deps="yes" ;;
5401ab64890Smrg
5411ab64890Smrg  --quiet | --silent)
5421ab64890Smrg    show=:
5431ab64890Smrg    preserve_args="$preserve_args $arg"
5441ab64890Smrg    ;;
5451ab64890Smrg
5461ab64890Smrg  --tag)
5471ab64890Smrg    prevopt="--tag"
5481ab64890Smrg    prev=tag
5491ab64890Smrg    preserve_args="$preserve_args --tag"
5501ab64890Smrg    ;;
5511ab64890Smrg  --tag=*)
5521ab64890Smrg    set tag "$optarg" ${1+"$@"}
5531ab64890Smrg    shift
5541ab64890Smrg    prev=tag
5551ab64890Smrg    preserve_args="$preserve_args --tag"
5561ab64890Smrg    ;;
5571ab64890Smrg
5581ab64890Smrg  -dlopen)
5591ab64890Smrg    prevopt="-dlopen"
5601ab64890Smrg    prev=execute_dlfiles
5611ab64890Smrg    ;;
5621ab64890Smrg
5631ab64890Smrg  -*)
5641ab64890Smrg    $echo "$modename: unrecognized option \`$arg'" 1>&2
5651ab64890Smrg    $echo "$help" 1>&2
5661ab64890Smrg    exit $EXIT_FAILURE
5671ab64890Smrg    ;;
5681ab64890Smrg
5691ab64890Smrg  *)
5701ab64890Smrg    nonopt="$arg"
5711ab64890Smrg    break
5721ab64890Smrg    ;;
5731ab64890Smrg  esac
5741ab64890Smrgdone
5751ab64890Smrg
5761ab64890Smrgif test -n "$prevopt"; then
5771ab64890Smrg  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
5781ab64890Smrg  $echo "$help" 1>&2
5791ab64890Smrg  exit $EXIT_FAILURE
5801ab64890Smrgfi
5811ab64890Smrg
5821ab64890Smrgcase $disable_libs in
5831ab64890Smrgno) 
5841ab64890Smrg  ;;
5851ab64890Smrgshared)
5861ab64890Smrg  build_libtool_libs=no
5871ab64890Smrg  build_old_libs=yes
5881ab64890Smrg  ;;
5891ab64890Smrgstatic)
5901ab64890Smrg  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
5911ab64890Smrg  ;;
5921ab64890Smrgesac
5931ab64890Smrg
5941ab64890Smrg# If this variable is set in any of the actions, the command in it
5951ab64890Smrg# will be execed at the end.  This prevents here-documents from being
5961ab64890Smrg# left over by shells.
5971ab64890Smrgexec_cmd=
5981ab64890Smrg
5991ab64890Smrgif test -z "$show_help"; then
6001ab64890Smrg
6011ab64890Smrg  # Infer the operation mode.
6021ab64890Smrg  if test -z "$mode"; then
6031ab64890Smrg    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
6041ab64890Smrg    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
6051ab64890Smrg    case $nonopt in
6061ab64890Smrg    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
6071ab64890Smrg      mode=link
6081ab64890Smrg      for arg
6091ab64890Smrg      do
6101ab64890Smrg	case $arg in
6111ab64890Smrg	-c)
6121ab64890Smrg	   mode=compile
6131ab64890Smrg	   break
6141ab64890Smrg	   ;;
6151ab64890Smrg	esac
6161ab64890Smrg      done
6171ab64890Smrg      ;;
6181ab64890Smrg    *db | *dbx | *strace | *truss)
6191ab64890Smrg      mode=execute
6201ab64890Smrg      ;;
6211ab64890Smrg    *install*|cp|mv)
6221ab64890Smrg      mode=install
6231ab64890Smrg      ;;
6241ab64890Smrg    *rm)
6251ab64890Smrg      mode=uninstall
6261ab64890Smrg      ;;
6271ab64890Smrg    *)
6281ab64890Smrg      # If we have no mode, but dlfiles were specified, then do execute mode.
6291ab64890Smrg      test -n "$execute_dlfiles" && mode=execute
6301ab64890Smrg
6311ab64890Smrg      # Just use the default operation mode.
6321ab64890Smrg      if test -z "$mode"; then
6331ab64890Smrg	if test -n "$nonopt"; then
6341ab64890Smrg	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
6351ab64890Smrg	else
6361ab64890Smrg	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
6371ab64890Smrg	fi
6381ab64890Smrg      fi
6391ab64890Smrg      ;;
6401ab64890Smrg    esac
6411ab64890Smrg  fi
6421ab64890Smrg
6431ab64890Smrg  # Only execute mode is allowed to have -dlopen flags.
6441ab64890Smrg  if test -n "$execute_dlfiles" && test "$mode" != execute; then
6451ab64890Smrg    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
6461ab64890Smrg    $echo "$help" 1>&2
6471ab64890Smrg    exit $EXIT_FAILURE
6481ab64890Smrg  fi
6491ab64890Smrg
6501ab64890Smrg  # Change the help message to a mode-specific one.
6511ab64890Smrg  generic_help="$help"
6521ab64890Smrg  help="Try \`$modename --help --mode=$mode' for more information."
6531ab64890Smrg
6541ab64890Smrg  # These modes are in order of execution frequency so that they run quickly.
6551ab64890Smrg  case $mode in
6561ab64890Smrg  # libtool compile mode
6571ab64890Smrg  compile)
6581ab64890Smrg    modename="$modename: compile"
6591ab64890Smrg    # Get the compilation command and the source file.
6601ab64890Smrg    base_compile=
6611ab64890Smrg    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
6621ab64890Smrg    suppress_opt=yes
6631ab64890Smrg    suppress_output=
6641ab64890Smrg    arg_mode=normal
6651ab64890Smrg    libobj=
6661ab64890Smrg    later=
6671ab64890Smrg
6681ab64890Smrg    for arg
6691ab64890Smrg    do
6701ab64890Smrg      case $arg_mode in
6711ab64890Smrg      arg  )
6721ab64890Smrg	# do not "continue".  Instead, add this to base_compile
6731ab64890Smrg	lastarg="$arg"
6741ab64890Smrg	arg_mode=normal
6751ab64890Smrg	;;
6761ab64890Smrg
6771ab64890Smrg      target )
6781ab64890Smrg	libobj="$arg"
6791ab64890Smrg	arg_mode=normal
6801ab64890Smrg	continue
6811ab64890Smrg	;;
6821ab64890Smrg
6831ab64890Smrg      normal )
6841ab64890Smrg	# Accept any command-line options.
6851ab64890Smrg	case $arg in
6861ab64890Smrg	-o)
6871ab64890Smrg	  if test -n "$libobj" ; then
6881ab64890Smrg	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
6891ab64890Smrg	    exit $EXIT_FAILURE
6901ab64890Smrg	  fi
6911ab64890Smrg	  arg_mode=target
6921ab64890Smrg	  continue
6931ab64890Smrg	  ;;
6941ab64890Smrg
6951ab64890Smrg	-static | -prefer-pic | -prefer-non-pic)
6961ab64890Smrg	  later="$later $arg"
6971ab64890Smrg	  continue
6981ab64890Smrg	  ;;
6991ab64890Smrg
7001ab64890Smrg	-no-suppress)
7011ab64890Smrg	  suppress_opt=no
7021ab64890Smrg	  continue
7031ab64890Smrg	  ;;
7041ab64890Smrg
7051ab64890Smrg	-Xcompiler)
7061ab64890Smrg	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
7071ab64890Smrg	  continue      #  The current "srcfile" will either be retained or
7081ab64890Smrg	  ;;            #  replaced later.  I would guess that would be a bug.
7091ab64890Smrg
7101ab64890Smrg	-Wc,*)
7111ab64890Smrg	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
7121ab64890Smrg	  lastarg=
7131ab64890Smrg	  save_ifs="$IFS"; IFS=','
7141ab64890Smrg 	  for arg in $args; do
7151ab64890Smrg	    IFS="$save_ifs"
7161ab64890Smrg
7171ab64890Smrg	    # Double-quote args containing other shell metacharacters.
7181ab64890Smrg	    # Many Bourne shells cannot handle close brackets correctly
7191ab64890Smrg	    # in scan sets, so we specify it separately.
7201ab64890Smrg	    case $arg in
7211ab64890Smrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
7221ab64890Smrg	      arg="\"$arg\""
7231ab64890Smrg	      ;;
7241ab64890Smrg	    esac
7251ab64890Smrg	    lastarg="$lastarg $arg"
7261ab64890Smrg	  done
7271ab64890Smrg	  IFS="$save_ifs"
7281ab64890Smrg	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
7291ab64890Smrg
7301ab64890Smrg	  # Add the arguments to base_compile.
7311ab64890Smrg	  base_compile="$base_compile $lastarg"
7321ab64890Smrg	  continue
7331ab64890Smrg	  ;;
7341ab64890Smrg
7351ab64890Smrg	* )
7361ab64890Smrg	  # Accept the current argument as the source file.
7371ab64890Smrg	  # The previous "srcfile" becomes the current argument.
7381ab64890Smrg	  #
7391ab64890Smrg	  lastarg="$srcfile"
7401ab64890Smrg	  srcfile="$arg"
7411ab64890Smrg	  ;;
7421ab64890Smrg	esac  #  case $arg
7431ab64890Smrg	;;
7441ab64890Smrg      esac    #  case $arg_mode
7451ab64890Smrg
7461ab64890Smrg      # Aesthetically quote the previous argument.
7471ab64890Smrg      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
7481ab64890Smrg
7491ab64890Smrg      case $lastarg in
7501ab64890Smrg      # Double-quote args containing other shell metacharacters.
7511ab64890Smrg      # Many Bourne shells cannot handle close brackets correctly
7521ab64890Smrg      # in scan sets, and some SunOS ksh mistreat backslash-escaping
7531ab64890Smrg      # in scan sets (worked around with variable expansion),
7541ab64890Smrg      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
7551ab64890Smrg      # at all, so we specify them separately.
7561ab64890Smrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
7571ab64890Smrg	lastarg="\"$lastarg\""
7581ab64890Smrg	;;
7591ab64890Smrg      esac
7601ab64890Smrg
7611ab64890Smrg      base_compile="$base_compile $lastarg"
7621ab64890Smrg    done # for arg
7631ab64890Smrg
7641ab64890Smrg    case $arg_mode in
7651ab64890Smrg    arg)
7661ab64890Smrg      $echo "$modename: you must specify an argument for -Xcompile"
7671ab64890Smrg      exit $EXIT_FAILURE
7681ab64890Smrg      ;;
7691ab64890Smrg    target)
7701ab64890Smrg      $echo "$modename: you must specify a target with \`-o'" 1>&2
7711ab64890Smrg      exit $EXIT_FAILURE
7721ab64890Smrg      ;;
7731ab64890Smrg    *)
7741ab64890Smrg      # Get the name of the library object.
7751ab64890Smrg      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
7761ab64890Smrg      ;;
7771ab64890Smrg    esac
7781ab64890Smrg
7791ab64890Smrg    # Recognize several different file suffixes.
7801ab64890Smrg    # If the user specifies -o file.o, it is replaced with file.lo
7811ab64890Smrg    xform='[cCFSifmso]'
7821ab64890Smrg    case $libobj in
7831ab64890Smrg    *.ada) xform=ada ;;
7841ab64890Smrg    *.adb) xform=adb ;;
7851ab64890Smrg    *.ads) xform=ads ;;
7861ab64890Smrg    *.asm) xform=asm ;;
7871ab64890Smrg    *.c++) xform=c++ ;;
7881ab64890Smrg    *.cc) xform=cc ;;
7891ab64890Smrg    *.ii) xform=ii ;;
7901ab64890Smrg    *.class) xform=class ;;
7911ab64890Smrg    *.cpp) xform=cpp ;;
7921ab64890Smrg    *.cxx) xform=cxx ;;
7931ab64890Smrg    *.[fF][09]?) xform=[fF][09]. ;;
7941ab64890Smrg    *.for) xform=for ;;
7951ab64890Smrg    *.java) xform=java ;;
7961ab64890Smrg    *.obj) xform=obj ;;
79761b2299dSmrg    *.sx) xform=sx ;;
7981ab64890Smrg    esac
7991ab64890Smrg
8001ab64890Smrg    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
8011ab64890Smrg
8021ab64890Smrg    case $libobj in
8031ab64890Smrg    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
8041ab64890Smrg    *)
8051ab64890Smrg      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
8061ab64890Smrg      exit $EXIT_FAILURE
8071ab64890Smrg      ;;
8081ab64890Smrg    esac
8091ab64890Smrg
8101ab64890Smrg    func_infer_tag $base_compile
8111ab64890Smrg
8121ab64890Smrg    for arg in $later; do
8131ab64890Smrg      case $arg in
8141ab64890Smrg      -static)
8151ab64890Smrg	build_old_libs=yes
8161ab64890Smrg	continue
8171ab64890Smrg	;;
8181ab64890Smrg
8191ab64890Smrg      -prefer-pic)
8201ab64890Smrg	pic_mode=yes
8211ab64890Smrg	continue
8221ab64890Smrg	;;
8231ab64890Smrg
8241ab64890Smrg      -prefer-non-pic)
8251ab64890Smrg	pic_mode=no
8261ab64890Smrg	continue
8271ab64890Smrg	;;
8281ab64890Smrg      esac
8291ab64890Smrg    done
8301ab64890Smrg
8311ab64890Smrg    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
8321ab64890Smrg    case $qlibobj in
8331ab64890Smrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
8341ab64890Smrg	qlibobj="\"$qlibobj\"" ;;
8351ab64890Smrg    esac
8361ab64890Smrg    test "X$libobj" != "X$qlibobj" \
8371ab64890Smrg	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
8381ab64890Smrg	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
8391ab64890Smrg    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
8401ab64890Smrg    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
8411ab64890Smrg    if test "X$xdir" = "X$obj"; then
8421ab64890Smrg      xdir=
8431ab64890Smrg    else
8441ab64890Smrg      xdir=$xdir/
8451ab64890Smrg    fi
8461ab64890Smrg    lobj=${xdir}$objdir/$objname
8471ab64890Smrg
8481ab64890Smrg    if test -z "$base_compile"; then
8491ab64890Smrg      $echo "$modename: you must specify a compilation command" 1>&2
8501ab64890Smrg      $echo "$help" 1>&2
8511ab64890Smrg      exit $EXIT_FAILURE
8521ab64890Smrg    fi
8531ab64890Smrg
8541ab64890Smrg    # Delete any leftover library objects.
8551ab64890Smrg    if test "$build_old_libs" = yes; then
8561ab64890Smrg      removelist="$obj $lobj $libobj ${libobj}T"
8571ab64890Smrg    else
8581ab64890Smrg      removelist="$lobj $libobj ${libobj}T"
8591ab64890Smrg    fi
8601ab64890Smrg
8611ab64890Smrg    $run $rm $removelist
8621ab64890Smrg    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
8631ab64890Smrg
8641ab64890Smrg    # On Cygwin there's no "real" PIC flag so we must build both object types
8651ab64890Smrg    case $host_os in
8661ab64890Smrg    cygwin* | mingw* | pw32* | os2*)
8671ab64890Smrg      pic_mode=default
8681ab64890Smrg      ;;
8691ab64890Smrg    esac
8701ab64890Smrg    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
8711ab64890Smrg      # non-PIC code in shared libraries is not supported
8721ab64890Smrg      pic_mode=default
8731ab64890Smrg    fi
8741ab64890Smrg
8751ab64890Smrg    # Calculate the filename of the output object if compiler does
8761ab64890Smrg    # not support -o with -c
8771ab64890Smrg    if test "$compiler_c_o" = no; then
8781ab64890Smrg      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
8791ab64890Smrg      lockfile="$output_obj.lock"
8801ab64890Smrg      removelist="$removelist $output_obj $lockfile"
8811ab64890Smrg      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
8821ab64890Smrg    else
8831ab64890Smrg      output_obj=
8841ab64890Smrg      need_locks=no
8851ab64890Smrg      lockfile=
8861ab64890Smrg    fi
8871ab64890Smrg
8881ab64890Smrg    # Lock this critical section if it is needed
8891ab64890Smrg    # We use this script file to make the link, it avoids creating a new file
8901ab64890Smrg    if test "$need_locks" = yes; then
8911ab64890Smrg      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
8921ab64890Smrg	$show "Waiting for $lockfile to be removed"
8931ab64890Smrg	sleep 2
8941ab64890Smrg      done
8951ab64890Smrg    elif test "$need_locks" = warn; then
8961ab64890Smrg      if test -f "$lockfile"; then
8971ab64890Smrg	$echo "\
8981ab64890Smrg*** ERROR, $lockfile exists and contains:
8991ab64890Smrg`cat $lockfile 2>/dev/null`
9001ab64890Smrg
9011ab64890SmrgThis indicates that another process is trying to use the same
9021ab64890Smrgtemporary object file, and libtool could not work around it because
9031ab64890Smrgyour compiler does not support \`-c' and \`-o' together.  If you
9041ab64890Smrgrepeat this compilation, it may succeed, by chance, but you had better
9051ab64890Smrgavoid parallel builds (make -j) in this platform, or get a better
9061ab64890Smrgcompiler."
9071ab64890Smrg
9081ab64890Smrg	$run $rm $removelist
9091ab64890Smrg	exit $EXIT_FAILURE
9101ab64890Smrg      fi
9111ab64890Smrg      $echo "$srcfile" > "$lockfile"
9121ab64890Smrg    fi
9131ab64890Smrg
9141ab64890Smrg    if test -n "$fix_srcfile_path"; then
9151ab64890Smrg      eval srcfile=\"$fix_srcfile_path\"
9161ab64890Smrg    fi
9171ab64890Smrg    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
9181ab64890Smrg    case $qsrcfile in
9191ab64890Smrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
9201ab64890Smrg      qsrcfile="\"$qsrcfile\"" ;;
9211ab64890Smrg    esac
9221ab64890Smrg
9231ab64890Smrg    $run $rm "$libobj" "${libobj}T"
9241ab64890Smrg
9251ab64890Smrg    # Create a libtool object file (analogous to a ".la" file),
9261ab64890Smrg    # but don't create it if we're doing a dry run.
9271ab64890Smrg    test -z "$run" && cat > ${libobj}T <<EOF
9281ab64890Smrg# $libobj - a libtool object file
9291ab64890Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
9301ab64890Smrg#
9311ab64890Smrg# Please DO NOT delete this file!
9321ab64890Smrg# It is necessary for linking the library.
9331ab64890Smrg
9341ab64890Smrg# Name of the PIC object.
9351ab64890SmrgEOF
9361ab64890Smrg
9371ab64890Smrg    # Only build a PIC object if we are building libtool libraries.
9381ab64890Smrg    if test "$build_libtool_libs" = yes; then
9391ab64890Smrg      # Without this assignment, base_compile gets emptied.
9401ab64890Smrg      fbsd_hideous_sh_bug=$base_compile
9411ab64890Smrg
9421ab64890Smrg      if test "$pic_mode" != no; then
9431ab64890Smrg	command="$base_compile $qsrcfile $pic_flag"
9441ab64890Smrg      else
9451ab64890Smrg	# Don't build PIC code
9461ab64890Smrg	command="$base_compile $qsrcfile"
9471ab64890Smrg      fi
9481ab64890Smrg
9491ab64890Smrg      if test ! -d "${xdir}$objdir"; then
9501ab64890Smrg	$show "$mkdir ${xdir}$objdir"
9511ab64890Smrg	$run $mkdir ${xdir}$objdir
9521ab64890Smrg	exit_status=$?
9531ab64890Smrg	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
9541ab64890Smrg	  exit $exit_status
9551ab64890Smrg	fi
9561ab64890Smrg      fi
9571ab64890Smrg
9581ab64890Smrg      if test -z "$output_obj"; then
9591ab64890Smrg	# Place PIC objects in $objdir
9601ab64890Smrg	command="$command -o $lobj"
9611ab64890Smrg      fi
9621ab64890Smrg
9631ab64890Smrg      $run $rm "$lobj" "$output_obj"
9641ab64890Smrg
9651ab64890Smrg      $show "$command"
96661b2299dSmrg      if $run eval $lt_env "$command"; then :
9671ab64890Smrg      else
9681ab64890Smrg	test -n "$output_obj" && $run $rm $removelist
9691ab64890Smrg	exit $EXIT_FAILURE
9701ab64890Smrg      fi
9711ab64890Smrg
9721ab64890Smrg      if test "$need_locks" = warn &&
9731ab64890Smrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
9741ab64890Smrg	$echo "\
9751ab64890Smrg*** ERROR, $lockfile contains:
9761ab64890Smrg`cat $lockfile 2>/dev/null`
9771ab64890Smrg
9781ab64890Smrgbut it should contain:
9791ab64890Smrg$srcfile
9801ab64890Smrg
9811ab64890SmrgThis indicates that another process is trying to use the same
9821ab64890Smrgtemporary object file, and libtool could not work around it because
9831ab64890Smrgyour compiler does not support \`-c' and \`-o' together.  If you
9841ab64890Smrgrepeat this compilation, it may succeed, by chance, but you had better
9851ab64890Smrgavoid parallel builds (make -j) in this platform, or get a better
9861ab64890Smrgcompiler."
9871ab64890Smrg
9881ab64890Smrg	$run $rm $removelist
9891ab64890Smrg	exit $EXIT_FAILURE
9901ab64890Smrg      fi
9911ab64890Smrg
9921ab64890Smrg      # Just move the object if needed, then go on to compile the next one
9931ab64890Smrg      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
9941ab64890Smrg	$show "$mv $output_obj $lobj"
9951ab64890Smrg	if $run $mv $output_obj $lobj; then :
9961ab64890Smrg	else
9971ab64890Smrg	  error=$?
9981ab64890Smrg	  $run $rm $removelist
9991ab64890Smrg	  exit $error
10001ab64890Smrg	fi
10011ab64890Smrg      fi
10021ab64890Smrg
10031ab64890Smrg      # Append the name of the PIC object to the libtool object file.
10041ab64890Smrg      test -z "$run" && cat >> ${libobj}T <<EOF
10051ab64890Smrgpic_object='$objdir/$objname'
10061ab64890Smrg
10071ab64890SmrgEOF
10081ab64890Smrg
10091ab64890Smrg      # Allow error messages only from the first compilation.
10101ab64890Smrg      if test "$suppress_opt" = yes; then
10111ab64890Smrg        suppress_output=' >/dev/null 2>&1'
10121ab64890Smrg      fi
10131ab64890Smrg    else
10141ab64890Smrg      # No PIC object so indicate it doesn't exist in the libtool
10151ab64890Smrg      # object file.
10161ab64890Smrg      test -z "$run" && cat >> ${libobj}T <<EOF
10171ab64890Smrgpic_object=none
10181ab64890Smrg
10191ab64890SmrgEOF
10201ab64890Smrg    fi
10211ab64890Smrg
10221ab64890Smrg    # Only build a position-dependent object if we build old libraries.
10231ab64890Smrg    if test "$build_old_libs" = yes; then
10241ab64890Smrg      if test "$pic_mode" != yes; then
10251ab64890Smrg	# Don't build PIC code
10261ab64890Smrg	command="$base_compile $qsrcfile"
10271ab64890Smrg      else
10281ab64890Smrg	command="$base_compile $qsrcfile $pic_flag"
10291ab64890Smrg      fi
10301ab64890Smrg      if test "$compiler_c_o" = yes; then
10311ab64890Smrg	command="$command -o $obj"
10321ab64890Smrg      fi
10331ab64890Smrg
10341ab64890Smrg      # Suppress compiler output if we already did a PIC compilation.
10351ab64890Smrg      command="$command$suppress_output"
10361ab64890Smrg      $run $rm "$obj" "$output_obj"
10371ab64890Smrg      $show "$command"
103861b2299dSmrg      if $run eval $lt_env "$command"; then :
10391ab64890Smrg      else
10401ab64890Smrg	$run $rm $removelist
10411ab64890Smrg	exit $EXIT_FAILURE
10421ab64890Smrg      fi
10431ab64890Smrg
10441ab64890Smrg      if test "$need_locks" = warn &&
10451ab64890Smrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
10461ab64890Smrg	$echo "\
10471ab64890Smrg*** ERROR, $lockfile contains:
10481ab64890Smrg`cat $lockfile 2>/dev/null`
10491ab64890Smrg
10501ab64890Smrgbut it should contain:
10511ab64890Smrg$srcfile
10521ab64890Smrg
10531ab64890SmrgThis indicates that another process is trying to use the same
10541ab64890Smrgtemporary object file, and libtool could not work around it because
10551ab64890Smrgyour compiler does not support \`-c' and \`-o' together.  If you
10561ab64890Smrgrepeat this compilation, it may succeed, by chance, but you had better
10571ab64890Smrgavoid parallel builds (make -j) in this platform, or get a better
10581ab64890Smrgcompiler."
10591ab64890Smrg
10601ab64890Smrg	$run $rm $removelist
10611ab64890Smrg	exit $EXIT_FAILURE
10621ab64890Smrg      fi
10631ab64890Smrg
10641ab64890Smrg      # Just move the object if needed
10651ab64890Smrg      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
10661ab64890Smrg	$show "$mv $output_obj $obj"
10671ab64890Smrg	if $run $mv $output_obj $obj; then :
10681ab64890Smrg	else
10691ab64890Smrg	  error=$?
10701ab64890Smrg	  $run $rm $removelist
10711ab64890Smrg	  exit $error
10721ab64890Smrg	fi
10731ab64890Smrg      fi
10741ab64890Smrg
10751ab64890Smrg      # Append the name of the non-PIC object the libtool object file.
10761ab64890Smrg      # Only append if the libtool object file exists.
10771ab64890Smrg      test -z "$run" && cat >> ${libobj}T <<EOF
10781ab64890Smrg# Name of the non-PIC object.
10791ab64890Smrgnon_pic_object='$objname'
10801ab64890Smrg
10811ab64890SmrgEOF
10821ab64890Smrg    else
10831ab64890Smrg      # Append the name of the non-PIC object the libtool object file.
10841ab64890Smrg      # Only append if the libtool object file exists.
10851ab64890Smrg      test -z "$run" && cat >> ${libobj}T <<EOF
10861ab64890Smrg# Name of the non-PIC object.
10871ab64890Smrgnon_pic_object=none
10881ab64890Smrg
10891ab64890SmrgEOF
10901ab64890Smrg    fi
10911ab64890Smrg
10921ab64890Smrg    $run $mv "${libobj}T" "${libobj}"
10931ab64890Smrg
10941ab64890Smrg    # Unlock the critical section if it was locked
10951ab64890Smrg    if test "$need_locks" != no; then
10961ab64890Smrg      $run $rm "$lockfile"
10971ab64890Smrg    fi
10981ab64890Smrg
10991ab64890Smrg    exit $EXIT_SUCCESS
11001ab64890Smrg    ;;
11011ab64890Smrg
11021ab64890Smrg  # libtool link mode
11031ab64890Smrg  link | relink)
11041ab64890Smrg    modename="$modename: link"
11051ab64890Smrg    case $host in
11061ab64890Smrg    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
11071ab64890Smrg      # It is impossible to link a dll without this setting, and
11081ab64890Smrg      # we shouldn't force the makefile maintainer to figure out
11091ab64890Smrg      # which system we are compiling for in order to pass an extra
11101ab64890Smrg      # flag for every libtool invocation.
11111ab64890Smrg      # allow_undefined=no
11121ab64890Smrg
11131ab64890Smrg      # FIXME: Unfortunately, there are problems with the above when trying
11141ab64890Smrg      # to make a dll which has undefined symbols, in which case not
11151ab64890Smrg      # even a static library is built.  For now, we need to specify
11161ab64890Smrg      # -no-undefined on the libtool link line when we can be certain
11171ab64890Smrg      # that all symbols are satisfied, otherwise we get a static library.
11181ab64890Smrg      allow_undefined=yes
11191ab64890Smrg      ;;
11201ab64890Smrg    *)
11211ab64890Smrg      allow_undefined=yes
11221ab64890Smrg      ;;
11231ab64890Smrg    esac
11241ab64890Smrg    libtool_args="$nonopt"
11251ab64890Smrg    base_compile="$nonopt $@"
11261ab64890Smrg    compile_command="$nonopt"
11271ab64890Smrg    finalize_command="$nonopt"
11281ab64890Smrg
11291ab64890Smrg    compile_rpath=
11301ab64890Smrg    finalize_rpath=
11311ab64890Smrg    compile_shlibpath=
11321ab64890Smrg    finalize_shlibpath=
11331ab64890Smrg    convenience=
11341ab64890Smrg    old_convenience=
11351ab64890Smrg    deplibs=
11361ab64890Smrg    old_deplibs=
11371ab64890Smrg    compiler_flags=
11381ab64890Smrg    linker_flags=
11391ab64890Smrg    dllsearchpath=
11401ab64890Smrg    lib_search_path=`pwd`
11411ab64890Smrg    inst_prefix_dir=
11421ab64890Smrg
11431ab64890Smrg    avoid_version=no
11441ab64890Smrg    dlfiles=
11451ab64890Smrg    dlprefiles=
11461ab64890Smrg    dlself=no
11471ab64890Smrg    export_dynamic=no
11481ab64890Smrg    export_symbols=
11491ab64890Smrg    export_symbols_regex=
11501ab64890Smrg    generated=
11511ab64890Smrg    libobjs=
11521ab64890Smrg    ltlibs=
11531ab64890Smrg    module=no
11541ab64890Smrg    no_install=no
11551ab64890Smrg    objs=
11561ab64890Smrg    non_pic_objects=
11571ab64890Smrg    notinst_path= # paths that contain not-installed libtool libraries
11581ab64890Smrg    precious_files_regex=
11591ab64890Smrg    prefer_static_libs=no
11601ab64890Smrg    preload=no
11611ab64890Smrg    prev=
11621ab64890Smrg    prevarg=
11631ab64890Smrg    release=
11641ab64890Smrg    rpath=
11651ab64890Smrg    xrpath=
11661ab64890Smrg    perm_rpath=
11671ab64890Smrg    temp_rpath=
11681ab64890Smrg    thread_safe=no
11691ab64890Smrg    vinfo=
11701ab64890Smrg    vinfo_number=no
117161b2299dSmrg    single_module="${wl}-single_module"
11721ab64890Smrg
11731ab64890Smrg    func_infer_tag $base_compile
11741ab64890Smrg
11751ab64890Smrg    # We need to know -static, to get the right output filenames.
11761ab64890Smrg    for arg
11771ab64890Smrg    do
11781ab64890Smrg      case $arg in
11791ab64890Smrg      -all-static | -static | -static-libtool-libs)
11801ab64890Smrg	case $arg in
11811ab64890Smrg	-all-static)
11821ab64890Smrg	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
11831ab64890Smrg	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
11841ab64890Smrg	  fi
11851ab64890Smrg	  if test -n "$link_static_flag"; then
11861ab64890Smrg	    dlopen_self=$dlopen_self_static
11871ab64890Smrg	  fi
11881ab64890Smrg	  prefer_static_libs=yes
11891ab64890Smrg	  ;;
11901ab64890Smrg	-static)
11911ab64890Smrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
11921ab64890Smrg	    dlopen_self=$dlopen_self_static
11931ab64890Smrg	  fi
11941ab64890Smrg	  prefer_static_libs=built
11951ab64890Smrg	  ;;
11961ab64890Smrg	-static-libtool-libs)
11971ab64890Smrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
11981ab64890Smrg	    dlopen_self=$dlopen_self_static
11991ab64890Smrg	  fi
12001ab64890Smrg	  prefer_static_libs=yes
12011ab64890Smrg	  ;;
12021ab64890Smrg	esac
12031ab64890Smrg	build_libtool_libs=no
12041ab64890Smrg	build_old_libs=yes
12051ab64890Smrg	break
12061ab64890Smrg	;;
12071ab64890Smrg      esac
12081ab64890Smrg    done
12091ab64890Smrg
12101ab64890Smrg    # See if our shared archives depend on static archives.
12111ab64890Smrg    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
12121ab64890Smrg
12131ab64890Smrg    # Go through the arguments, transforming them on the way.
12141ab64890Smrg    while test "$#" -gt 0; do
12151ab64890Smrg      arg="$1"
12161ab64890Smrg      shift
12171ab64890Smrg      case $arg in
12181ab64890Smrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
12191ab64890Smrg	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
12201ab64890Smrg	;;
12211ab64890Smrg      *) qarg=$arg ;;
12221ab64890Smrg      esac
12231ab64890Smrg      libtool_args="$libtool_args $qarg"
12241ab64890Smrg
12251ab64890Smrg      # If the previous option needs an argument, assign it.
12261ab64890Smrg      if test -n "$prev"; then
12271ab64890Smrg	case $prev in
12281ab64890Smrg	output)
12291ab64890Smrg	  compile_command="$compile_command @OUTPUT@"
12301ab64890Smrg	  finalize_command="$finalize_command @OUTPUT@"
12311ab64890Smrg	  ;;
12321ab64890Smrg	esac
12331ab64890Smrg
12341ab64890Smrg	case $prev in
12351ab64890Smrg	dlfiles|dlprefiles)
12361ab64890Smrg	  if test "$preload" = no; then
12371ab64890Smrg	    # Add the symbol object into the linking commands.
12381ab64890Smrg	    compile_command="$compile_command @SYMFILE@"
12391ab64890Smrg	    finalize_command="$finalize_command @SYMFILE@"
12401ab64890Smrg	    preload=yes
12411ab64890Smrg	  fi
12421ab64890Smrg	  case $arg in
12431ab64890Smrg	  *.la | *.lo) ;;  # We handle these cases below.
12441ab64890Smrg	  force)
12451ab64890Smrg	    if test "$dlself" = no; then
12461ab64890Smrg	      dlself=needless
12471ab64890Smrg	      export_dynamic=yes
12481ab64890Smrg	    fi
12491ab64890Smrg	    prev=
12501ab64890Smrg	    continue
12511ab64890Smrg	    ;;
12521ab64890Smrg	  self)
12531ab64890Smrg	    if test "$prev" = dlprefiles; then
12541ab64890Smrg	      dlself=yes
12551ab64890Smrg	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
12561ab64890Smrg	      dlself=yes
12571ab64890Smrg	    else
12581ab64890Smrg	      dlself=needless
12591ab64890Smrg	      export_dynamic=yes
12601ab64890Smrg	    fi
12611ab64890Smrg	    prev=
12621ab64890Smrg	    continue
12631ab64890Smrg	    ;;
12641ab64890Smrg	  *)
12651ab64890Smrg	    if test "$prev" = dlfiles; then
12661ab64890Smrg	      dlfiles="$dlfiles $arg"
12671ab64890Smrg	    else
12681ab64890Smrg	      dlprefiles="$dlprefiles $arg"
12691ab64890Smrg	    fi
12701ab64890Smrg	    prev=
12711ab64890Smrg	    continue
12721ab64890Smrg	    ;;
12731ab64890Smrg	  esac
12741ab64890Smrg	  ;;
12751ab64890Smrg	expsyms)
12761ab64890Smrg	  export_symbols="$arg"
12771ab64890Smrg	  if test ! -f "$arg"; then
12781ab64890Smrg	    $echo "$modename: symbol file \`$arg' does not exist"
12791ab64890Smrg	    exit $EXIT_FAILURE
12801ab64890Smrg	  fi
12811ab64890Smrg	  prev=
12821ab64890Smrg	  continue
12831ab64890Smrg	  ;;
12841ab64890Smrg	expsyms_regex)
12851ab64890Smrg	  export_symbols_regex="$arg"
12861ab64890Smrg	  prev=
12871ab64890Smrg	  continue
12881ab64890Smrg	  ;;
12891ab64890Smrg	inst_prefix)
12901ab64890Smrg	  inst_prefix_dir="$arg"
12911ab64890Smrg	  prev=
12921ab64890Smrg	  continue
12931ab64890Smrg	  ;;
12941ab64890Smrg	precious_regex)
12951ab64890Smrg	  precious_files_regex="$arg"
12961ab64890Smrg	  prev=
12971ab64890Smrg	  continue
12981ab64890Smrg	  ;;
12991ab64890Smrg	release)
13001ab64890Smrg	  release="-$arg"
13011ab64890Smrg	  prev=
13021ab64890Smrg	  continue
13031ab64890Smrg	  ;;
13041ab64890Smrg	objectlist)
13051ab64890Smrg	  if test -f "$arg"; then
13061ab64890Smrg	    save_arg=$arg
13071ab64890Smrg	    moreargs=
13081ab64890Smrg	    for fil in `cat $save_arg`
13091ab64890Smrg	    do
13101ab64890Smrg#	      moreargs="$moreargs $fil"
13111ab64890Smrg	      arg=$fil
13121ab64890Smrg	      # A libtool-controlled object.
13131ab64890Smrg
13141ab64890Smrg	      # Check to see that this really is a libtool object.
13151ab64890Smrg	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
13161ab64890Smrg		pic_object=
13171ab64890Smrg		non_pic_object=
13181ab64890Smrg
13191ab64890Smrg		# Read the .lo file
13201ab64890Smrg		# If there is no directory component, then add one.
13211ab64890Smrg		case $arg in
13221ab64890Smrg		*/* | *\\*) . $arg ;;
13231ab64890Smrg		*) . ./$arg ;;
13241ab64890Smrg		esac
13251ab64890Smrg
13261ab64890Smrg		if test -z "$pic_object" || \
13271ab64890Smrg		   test -z "$non_pic_object" ||
13281ab64890Smrg		   test "$pic_object" = none && \
13291ab64890Smrg		   test "$non_pic_object" = none; then
13301ab64890Smrg		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
13311ab64890Smrg		  exit $EXIT_FAILURE
13321ab64890Smrg		fi
13331ab64890Smrg
13341ab64890Smrg		# Extract subdirectory from the argument.
13351ab64890Smrg		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
13361ab64890Smrg		if test "X$xdir" = "X$arg"; then
13371ab64890Smrg		  xdir=
13381ab64890Smrg		else
13391ab64890Smrg		  xdir="$xdir/"
13401ab64890Smrg		fi
13411ab64890Smrg
13421ab64890Smrg		if test "$pic_object" != none; then
13431ab64890Smrg		  # Prepend the subdirectory the object is found in.
13441ab64890Smrg		  pic_object="$xdir$pic_object"
13451ab64890Smrg
13461ab64890Smrg		  if test "$prev" = dlfiles; then
13471ab64890Smrg		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
13481ab64890Smrg		      dlfiles="$dlfiles $pic_object"
13491ab64890Smrg		      prev=
13501ab64890Smrg		      continue
13511ab64890Smrg		    else
13521ab64890Smrg		      # If libtool objects are unsupported, then we need to preload.
13531ab64890Smrg		      prev=dlprefiles
13541ab64890Smrg		    fi
13551ab64890Smrg		  fi
13561ab64890Smrg
13571ab64890Smrg		  # CHECK ME:  I think I busted this.  -Ossama
13581ab64890Smrg		  if test "$prev" = dlprefiles; then
13591ab64890Smrg		    # Preload the old-style object.
13601ab64890Smrg		    dlprefiles="$dlprefiles $pic_object"
13611ab64890Smrg		    prev=
13621ab64890Smrg		  fi
13631ab64890Smrg
13641ab64890Smrg		  # A PIC object.
13651ab64890Smrg		  libobjs="$libobjs $pic_object"
13661ab64890Smrg		  arg="$pic_object"
13671ab64890Smrg		fi
13681ab64890Smrg
13691ab64890Smrg		# Non-PIC object.
13701ab64890Smrg		if test "$non_pic_object" != none; then
13711ab64890Smrg		  # Prepend the subdirectory the object is found in.
13721ab64890Smrg		  non_pic_object="$xdir$non_pic_object"
13731ab64890Smrg
13741ab64890Smrg		  # A standard non-PIC object
13751ab64890Smrg		  non_pic_objects="$non_pic_objects $non_pic_object"
13761ab64890Smrg		  if test -z "$pic_object" || test "$pic_object" = none ; then
13771ab64890Smrg		    arg="$non_pic_object"
13781ab64890Smrg		  fi
13791ab64890Smrg		else
13801ab64890Smrg		  # If the PIC object exists, use it instead.
13811ab64890Smrg		  # $xdir was prepended to $pic_object above.
13821ab64890Smrg		  non_pic_object="$pic_object"
13831ab64890Smrg		  non_pic_objects="$non_pic_objects $non_pic_object"
13841ab64890Smrg		fi
13851ab64890Smrg	      else
13861ab64890Smrg		# Only an error if not doing a dry-run.
13871ab64890Smrg		if test -z "$run"; then
13881ab64890Smrg		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
13891ab64890Smrg		  exit $EXIT_FAILURE
13901ab64890Smrg		else
13911ab64890Smrg		  # Dry-run case.
13921ab64890Smrg
13931ab64890Smrg		  # Extract subdirectory from the argument.
13941ab64890Smrg		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
13951ab64890Smrg		  if test "X$xdir" = "X$arg"; then
13961ab64890Smrg		    xdir=
13971ab64890Smrg		  else
13981ab64890Smrg		    xdir="$xdir/"
13991ab64890Smrg		  fi
14001ab64890Smrg
14011ab64890Smrg		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
14021ab64890Smrg		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
14031ab64890Smrg		  libobjs="$libobjs $pic_object"
14041ab64890Smrg		  non_pic_objects="$non_pic_objects $non_pic_object"
14051ab64890Smrg		fi
14061ab64890Smrg	      fi
14071ab64890Smrg	    done
14081ab64890Smrg	  else
14091ab64890Smrg	    $echo "$modename: link input file \`$save_arg' does not exist"
14101ab64890Smrg	    exit $EXIT_FAILURE
14111ab64890Smrg	  fi
14121ab64890Smrg	  arg=$save_arg
14131ab64890Smrg	  prev=
14141ab64890Smrg	  continue
14151ab64890Smrg	  ;;
14161ab64890Smrg	rpath | xrpath)
14171ab64890Smrg	  # We need an absolute path.
14181ab64890Smrg	  case $arg in
14191ab64890Smrg	  [\\/]* | [A-Za-z]:[\\/]*) ;;
14201ab64890Smrg	  *)
14211ab64890Smrg	    $echo "$modename: only absolute run-paths are allowed" 1>&2
14221ab64890Smrg	    exit $EXIT_FAILURE
14231ab64890Smrg	    ;;
14241ab64890Smrg	  esac
14251ab64890Smrg	  if test "$prev" = rpath; then
14261ab64890Smrg	    case "$rpath " in
14271ab64890Smrg	    *" $arg "*) ;;
14281ab64890Smrg	    *) rpath="$rpath $arg" ;;
14291ab64890Smrg	    esac
14301ab64890Smrg	  else
14311ab64890Smrg	    case "$xrpath " in
14321ab64890Smrg	    *" $arg "*) ;;
14331ab64890Smrg	    *) xrpath="$xrpath $arg" ;;
14341ab64890Smrg	    esac
14351ab64890Smrg	  fi
14361ab64890Smrg	  prev=
14371ab64890Smrg	  continue
14381ab64890Smrg	  ;;
14391ab64890Smrg	xcompiler)
14401ab64890Smrg	  compiler_flags="$compiler_flags $qarg"
14411ab64890Smrg	  prev=
14421ab64890Smrg	  compile_command="$compile_command $qarg"
14431ab64890Smrg	  finalize_command="$finalize_command $qarg"
14441ab64890Smrg	  continue
14451ab64890Smrg	  ;;
14461ab64890Smrg	xlinker)
14471ab64890Smrg	  linker_flags="$linker_flags $qarg"
14481ab64890Smrg	  compiler_flags="$compiler_flags $wl$qarg"
14491ab64890Smrg	  prev=
14501ab64890Smrg	  compile_command="$compile_command $wl$qarg"
14511ab64890Smrg	  finalize_command="$finalize_command $wl$qarg"
14521ab64890Smrg	  continue
14531ab64890Smrg	  ;;
14541ab64890Smrg	xcclinker)
14551ab64890Smrg	  linker_flags="$linker_flags $qarg"
14561ab64890Smrg	  compiler_flags="$compiler_flags $qarg"
14571ab64890Smrg	  prev=
14581ab64890Smrg	  compile_command="$compile_command $qarg"
14591ab64890Smrg	  finalize_command="$finalize_command $qarg"
14601ab64890Smrg	  continue
14611ab64890Smrg	  ;;
14621ab64890Smrg	shrext)
14631ab64890Smrg  	  shrext_cmds="$arg"
14641ab64890Smrg	  prev=
14651ab64890Smrg	  continue
14661ab64890Smrg	  ;;
14671ab64890Smrg	darwin_framework|darwin_framework_skip)
14681ab64890Smrg	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
14691ab64890Smrg	  compile_command="$compile_command $arg"
14701ab64890Smrg	  finalize_command="$finalize_command $arg"
14711ab64890Smrg	  prev=
14721ab64890Smrg	  continue
14731ab64890Smrg	  ;;
14741ab64890Smrg	*)
14751ab64890Smrg	  eval "$prev=\"\$arg\""
14761ab64890Smrg	  prev=
14771ab64890Smrg	  continue
14781ab64890Smrg	  ;;
14791ab64890Smrg	esac
14801ab64890Smrg      fi # test -n "$prev"
14811ab64890Smrg
14821ab64890Smrg      prevarg="$arg"
14831ab64890Smrg
14841ab64890Smrg      case $arg in
14851ab64890Smrg      -all-static)
14861ab64890Smrg	if test -n "$link_static_flag"; then
14871ab64890Smrg	  compile_command="$compile_command $link_static_flag"
14881ab64890Smrg	  finalize_command="$finalize_command $link_static_flag"
14891ab64890Smrg	fi
14901ab64890Smrg	continue
14911ab64890Smrg	;;
14921ab64890Smrg
14931ab64890Smrg      -allow-undefined)
14941ab64890Smrg	# FIXME: remove this flag sometime in the future.
14951ab64890Smrg	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
14961ab64890Smrg	continue
14971ab64890Smrg	;;
14981ab64890Smrg
14991ab64890Smrg      -avoid-version)
15001ab64890Smrg	avoid_version=yes
15011ab64890Smrg	continue
15021ab64890Smrg	;;
15031ab64890Smrg
15041ab64890Smrg      -dlopen)
15051ab64890Smrg	prev=dlfiles
15061ab64890Smrg	continue
15071ab64890Smrg	;;
15081ab64890Smrg
15091ab64890Smrg      -dlpreopen)
15101ab64890Smrg	prev=dlprefiles
15111ab64890Smrg	continue
15121ab64890Smrg	;;
15131ab64890Smrg
15141ab64890Smrg      -export-dynamic)
15151ab64890Smrg	export_dynamic=yes
15161ab64890Smrg	continue
15171ab64890Smrg	;;
15181ab64890Smrg
15191ab64890Smrg      -export-symbols | -export-symbols-regex)
15201ab64890Smrg	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
15211ab64890Smrg	  $echo "$modename: more than one -exported-symbols argument is not allowed"
15221ab64890Smrg	  exit $EXIT_FAILURE
15231ab64890Smrg	fi
15241ab64890Smrg	if test "X$arg" = "X-export-symbols"; then
15251ab64890Smrg	  prev=expsyms
15261ab64890Smrg	else
15271ab64890Smrg	  prev=expsyms_regex
15281ab64890Smrg	fi
15291ab64890Smrg	continue
15301ab64890Smrg	;;
15311ab64890Smrg
15321ab64890Smrg      -framework|-arch|-isysroot)
15331ab64890Smrg	case " $CC " in
15341ab64890Smrg	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
15351ab64890Smrg		prev=darwin_framework_skip ;;
15361ab64890Smrg	  *) compiler_flags="$compiler_flags $arg"
15371ab64890Smrg	     prev=darwin_framework ;;
15381ab64890Smrg	esac
15391ab64890Smrg	compile_command="$compile_command $arg"
15401ab64890Smrg	finalize_command="$finalize_command $arg"
15411ab64890Smrg	continue
15421ab64890Smrg	;;
15431ab64890Smrg
15441ab64890Smrg      -inst-prefix-dir)
15451ab64890Smrg	prev=inst_prefix
15461ab64890Smrg	continue
15471ab64890Smrg	;;
15481ab64890Smrg
15491ab64890Smrg      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
15501ab64890Smrg      # so, if we see these flags be careful not to treat them like -L
15511ab64890Smrg      -L[A-Z][A-Z]*:*)
15521ab64890Smrg	case $with_gcc/$host in
15531ab64890Smrg	no/*-*-irix* | /*-*-irix*)
15541ab64890Smrg	  compile_command="$compile_command $arg"
15551ab64890Smrg	  finalize_command="$finalize_command $arg"
15561ab64890Smrg	  ;;
15571ab64890Smrg	esac
15581ab64890Smrg	continue
15591ab64890Smrg	;;
15601ab64890Smrg
15611ab64890Smrg      -L*)
15621ab64890Smrg	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
15631ab64890Smrg	# We need an absolute path.
15641ab64890Smrg	case $dir in
15651ab64890Smrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
15661ab64890Smrg	*)
15671ab64890Smrg	  absdir=`cd "$dir" && pwd`
15681ab64890Smrg	  if test -z "$absdir"; then
15691ab64890Smrg	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
15701ab64890Smrg	    absdir="$dir"
15711ab64890Smrg	    notinst_path="$notinst_path $dir"
15721ab64890Smrg	  fi
15731ab64890Smrg	  dir="$absdir"
15741ab64890Smrg	  ;;
15751ab64890Smrg	esac
15761ab64890Smrg	case "$deplibs " in
15771ab64890Smrg	*" -L$dir "*) ;;
15781ab64890Smrg	*)
15791ab64890Smrg	  deplibs="$deplibs -L$dir"
15801ab64890Smrg	  lib_search_path="$lib_search_path $dir"
15811ab64890Smrg	  ;;
15821ab64890Smrg	esac
15831ab64890Smrg	case $host in
15841ab64890Smrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
15851ab64890Smrg	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
15861ab64890Smrg	  case :$dllsearchpath: in
15871ab64890Smrg	  *":$dir:"*) ;;
15881ab64890Smrg	  *) dllsearchpath="$dllsearchpath:$dir";;
15891ab64890Smrg	  esac
15901ab64890Smrg	  case :$dllsearchpath: in
15911ab64890Smrg	  *":$testbindir:"*) ;;
15921ab64890Smrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
15931ab64890Smrg	  esac
15941ab64890Smrg	  ;;
15951ab64890Smrg	esac
15961ab64890Smrg	continue
15971ab64890Smrg	;;
15981ab64890Smrg
15991ab64890Smrg      -l*)
16001ab64890Smrg	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
16011ab64890Smrg	  case $host in
16021ab64890Smrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
16031ab64890Smrg	    # These systems don't actually have a C or math library (as such)
16041ab64890Smrg	    continue
16051ab64890Smrg	    ;;
16061ab64890Smrg	  *-*-os2*)
16071ab64890Smrg	    # These systems don't actually have a C library (as such)
16081ab64890Smrg	    test "X$arg" = "X-lc" && continue
16091ab64890Smrg	    ;;
16101ab64890Smrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
16111ab64890Smrg	    # Do not include libc due to us having libc/libc_r.
16121ab64890Smrg	    test "X$arg" = "X-lc" && continue
16131ab64890Smrg	    ;;
16141ab64890Smrg	  *-*-rhapsody* | *-*-darwin1.[012])
16151ab64890Smrg	    # Rhapsody C and math libraries are in the System framework
16161ab64890Smrg	    deplibs="$deplibs -framework System"
16171ab64890Smrg	    continue
16181ab64890Smrg	    ;;
16191ab64890Smrg	  *-*-sco3.2v5* | *-*-sco5v6*)
16201ab64890Smrg	    # Causes problems with __ctype
16211ab64890Smrg	    test "X$arg" = "X-lc" && continue
16221ab64890Smrg	    ;;
16231ab64890Smrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
16241ab64890Smrg	    # Compiler inserts libc in the correct place for threads to work
16251ab64890Smrg	    test "X$arg" = "X-lc" && continue
16261ab64890Smrg	    ;;
16271ab64890Smrg	  esac
16281ab64890Smrg	elif test "X$arg" = "X-lc_r"; then
16291ab64890Smrg	 case $host in
16301ab64890Smrg	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
16311ab64890Smrg	   # Do not include libc_r directly, use -pthread flag.
16321ab64890Smrg	   continue
16331ab64890Smrg	   ;;
16341ab64890Smrg	 esac
16351ab64890Smrg	fi
16361ab64890Smrg	deplibs="$deplibs $arg"
16371ab64890Smrg	continue
16381ab64890Smrg	;;
16391ab64890Smrg
16401ab64890Smrg      # Tru64 UNIX uses -model [arg] to determine the layout of C++
16411ab64890Smrg      # classes, name mangling, and exception handling.
16421ab64890Smrg      -model)
16431ab64890Smrg	compile_command="$compile_command $arg"
16441ab64890Smrg	compiler_flags="$compiler_flags $arg"
16451ab64890Smrg	finalize_command="$finalize_command $arg"
16461ab64890Smrg	prev=xcompiler
16471ab64890Smrg	continue
16481ab64890Smrg	;;
16491ab64890Smrg
16501ab64890Smrg     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
16511ab64890Smrg	compiler_flags="$compiler_flags $arg"
16521ab64890Smrg	compile_command="$compile_command $arg"
16531ab64890Smrg	finalize_command="$finalize_command $arg"
16541ab64890Smrg	continue
16551ab64890Smrg	;;
16561ab64890Smrg
165761b2299dSmrg      -multi_module)
165861b2299dSmrg	single_module="${wl}-multi_module"
165961b2299dSmrg	continue
166061b2299dSmrg	;;
166161b2299dSmrg
16621ab64890Smrg      -module)
16631ab64890Smrg	module=yes
16641ab64890Smrg	continue
16651ab64890Smrg	;;
16661ab64890Smrg
16671ab64890Smrg      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
16681ab64890Smrg      # -r[0-9][0-9]* specifies the processor on the SGI compiler
16691ab64890Smrg      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
16701ab64890Smrg      # +DA*, +DD* enable 64-bit mode on the HP compiler
16711ab64890Smrg      # -q* pass through compiler args for the IBM compiler
16721ab64890Smrg      # -m* pass through architecture-specific compiler args for GCC
16731ab64890Smrg      # -m*, -t[45]*, -txscale* pass through architecture-specific
16741ab64890Smrg      # compiler args for GCC
16751ab64890Smrg      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
16761ab64890Smrg      # -F/path gives path to uninstalled frameworks, gcc on darwin
16771ab64890Smrg      # @file GCC response files
16781ab64890Smrg      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
16791ab64890Smrg      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
16801ab64890Smrg
16811ab64890Smrg	# Unknown arguments in both finalize_command and compile_command need
16821ab64890Smrg	# to be aesthetically quoted because they are evaled later.
16831ab64890Smrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
16841ab64890Smrg	case $arg in
16851ab64890Smrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
16861ab64890Smrg	  arg="\"$arg\""
16871ab64890Smrg	  ;;
16881ab64890Smrg	esac
16891ab64890Smrg        compile_command="$compile_command $arg"
16901ab64890Smrg        finalize_command="$finalize_command $arg"
16911ab64890Smrg        compiler_flags="$compiler_flags $arg"
16921ab64890Smrg        continue
16931ab64890Smrg        ;;
16941ab64890Smrg
16951ab64890Smrg      -shrext)
16961ab64890Smrg	prev=shrext
16971ab64890Smrg	continue
16981ab64890Smrg	;;
16991ab64890Smrg
17001ab64890Smrg      -no-fast-install)
17011ab64890Smrg	fast_install=no
17021ab64890Smrg	continue
17031ab64890Smrg	;;
17041ab64890Smrg
17051ab64890Smrg      -no-install)
17061ab64890Smrg	case $host in
17071ab64890Smrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
17081ab64890Smrg	  # The PATH hackery in wrapper scripts is required on Windows
17091ab64890Smrg	  # and Darwin in order for the loader to find any dlls it needs.
17101ab64890Smrg	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
17111ab64890Smrg	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
17121ab64890Smrg	  fast_install=no
17131ab64890Smrg	  ;;
17141ab64890Smrg	*) no_install=yes ;;
17151ab64890Smrg	esac
17161ab64890Smrg	continue
17171ab64890Smrg	;;
17181ab64890Smrg
17191ab64890Smrg      -no-undefined)
17201ab64890Smrg	allow_undefined=no
17211ab64890Smrg	continue
17221ab64890Smrg	;;
17231ab64890Smrg
17241ab64890Smrg      -objectlist)
17251ab64890Smrg	prev=objectlist
17261ab64890Smrg	continue
17271ab64890Smrg	;;
17281ab64890Smrg
17291ab64890Smrg      -o) prev=output ;;
17301ab64890Smrg
17311ab64890Smrg      -precious-files-regex)
17321ab64890Smrg	prev=precious_regex
17331ab64890Smrg	continue
17341ab64890Smrg	;;
17351ab64890Smrg
17361ab64890Smrg      -release)
17371ab64890Smrg	prev=release
17381ab64890Smrg	continue
17391ab64890Smrg	;;
17401ab64890Smrg
17411ab64890Smrg      -rpath)
17421ab64890Smrg	prev=rpath
17431ab64890Smrg	continue
17441ab64890Smrg	;;
17451ab64890Smrg
17461ab64890Smrg      -R)
17471ab64890Smrg	prev=xrpath
17481ab64890Smrg	continue
17491ab64890Smrg	;;
17501ab64890Smrg
17511ab64890Smrg      -R*)
17521ab64890Smrg	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
17531ab64890Smrg	# We need an absolute path.
17541ab64890Smrg	case $dir in
17551ab64890Smrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
17561ab64890Smrg	*)
17571ab64890Smrg	  $echo "$modename: only absolute run-paths are allowed" 1>&2
17581ab64890Smrg	  exit $EXIT_FAILURE
17591ab64890Smrg	  ;;
17601ab64890Smrg	esac
17611ab64890Smrg	case "$xrpath " in
17621ab64890Smrg	*" $dir "*) ;;
17631ab64890Smrg	*) xrpath="$xrpath $dir" ;;
17641ab64890Smrg	esac
17651ab64890Smrg	continue
17661ab64890Smrg	;;
17671ab64890Smrg
17681ab64890Smrg      -static | -static-libtool-libs)
17691ab64890Smrg	# The effects of -static are defined in a previous loop.
17701ab64890Smrg	# We used to do the same as -all-static on platforms that
17711ab64890Smrg	# didn't have a PIC flag, but the assumption that the effects
17721ab64890Smrg	# would be equivalent was wrong.  It would break on at least
17731ab64890Smrg	# Digital Unix and AIX.
17741ab64890Smrg	continue
17751ab64890Smrg	;;
17761ab64890Smrg
17771ab64890Smrg      -thread-safe)
17781ab64890Smrg	thread_safe=yes
17791ab64890Smrg	continue
17801ab64890Smrg	;;
17811ab64890Smrg
17821ab64890Smrg      -version-info)
17831ab64890Smrg	prev=vinfo
17841ab64890Smrg	continue
17851ab64890Smrg	;;
17861ab64890Smrg      -version-number)
17871ab64890Smrg	prev=vinfo
17881ab64890Smrg	vinfo_number=yes
17891ab64890Smrg	continue
17901ab64890Smrg	;;
17911ab64890Smrg
17921ab64890Smrg      -Wc,*)
17931ab64890Smrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
17941ab64890Smrg	arg=
17951ab64890Smrg	save_ifs="$IFS"; IFS=','
17961ab64890Smrg	for flag in $args; do
17971ab64890Smrg	  IFS="$save_ifs"
17981ab64890Smrg	  case $flag in
17991ab64890Smrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
18001ab64890Smrg	    flag="\"$flag\""
18011ab64890Smrg	    ;;
18021ab64890Smrg	  esac
18031ab64890Smrg	  arg="$arg $wl$flag"
18041ab64890Smrg	  compiler_flags="$compiler_flags $flag"
18051ab64890Smrg	done
18061ab64890Smrg	IFS="$save_ifs"
18071ab64890Smrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
18081ab64890Smrg	;;
18091ab64890Smrg
18101ab64890Smrg      -Wl,*)
18111ab64890Smrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
18121ab64890Smrg	arg=
18131ab64890Smrg	save_ifs="$IFS"; IFS=','
18141ab64890Smrg	for flag in $args; do
18151ab64890Smrg	  IFS="$save_ifs"
18161ab64890Smrg	  case $flag in
18171ab64890Smrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
18181ab64890Smrg	    flag="\"$flag\""
18191ab64890Smrg	    ;;
18201ab64890Smrg	  esac
18211ab64890Smrg	  arg="$arg $wl$flag"
18221ab64890Smrg	  compiler_flags="$compiler_flags $wl$flag"
18231ab64890Smrg	  linker_flags="$linker_flags $flag"
18241ab64890Smrg	done
18251ab64890Smrg	IFS="$save_ifs"
18261ab64890Smrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
18271ab64890Smrg	;;
18281ab64890Smrg
18291ab64890Smrg      -Xcompiler)
18301ab64890Smrg	prev=xcompiler
18311ab64890Smrg	continue
18321ab64890Smrg	;;
18331ab64890Smrg
18341ab64890Smrg      -Xlinker)
18351ab64890Smrg	prev=xlinker
18361ab64890Smrg	continue
18371ab64890Smrg	;;
18381ab64890Smrg
18391ab64890Smrg      -XCClinker)
18401ab64890Smrg	prev=xcclinker
18411ab64890Smrg	continue
18421ab64890Smrg	;;
18431ab64890Smrg
18441ab64890Smrg      # Some other compiler flag.
18451ab64890Smrg      -* | +*)
18461ab64890Smrg	# Unknown arguments in both finalize_command and compile_command need
18471ab64890Smrg	# to be aesthetically quoted because they are evaled later.
18481ab64890Smrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
18491ab64890Smrg	case $arg in
18501ab64890Smrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
18511ab64890Smrg	  arg="\"$arg\""
18521ab64890Smrg	  ;;
18531ab64890Smrg	esac
18541ab64890Smrg	;;
18551ab64890Smrg
18561ab64890Smrg      *.$objext)
18571ab64890Smrg	# A standard object.
18581ab64890Smrg	objs="$objs $arg"
18591ab64890Smrg	;;
18601ab64890Smrg
18611ab64890Smrg      *.lo)
18621ab64890Smrg	# A libtool-controlled object.
18631ab64890Smrg
18641ab64890Smrg	# Check to see that this really is a libtool object.
18651ab64890Smrg	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
18661ab64890Smrg	  pic_object=
18671ab64890Smrg	  non_pic_object=
18681ab64890Smrg
18691ab64890Smrg	  # Read the .lo file
18701ab64890Smrg	  # If there is no directory component, then add one.
18711ab64890Smrg	  case $arg in
18721ab64890Smrg	  */* | *\\*) . $arg ;;
18731ab64890Smrg	  *) . ./$arg ;;
18741ab64890Smrg	  esac
18751ab64890Smrg
18761ab64890Smrg	  if test -z "$pic_object" || \
18771ab64890Smrg	     test -z "$non_pic_object" ||
18781ab64890Smrg	     test "$pic_object" = none && \
18791ab64890Smrg	     test "$non_pic_object" = none; then
18801ab64890Smrg	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
18811ab64890Smrg	    exit $EXIT_FAILURE
18821ab64890Smrg	  fi
18831ab64890Smrg
18841ab64890Smrg	  # Extract subdirectory from the argument.
18851ab64890Smrg	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
18861ab64890Smrg	  if test "X$xdir" = "X$arg"; then
18871ab64890Smrg	    xdir=
18881ab64890Smrg 	  else
18891ab64890Smrg	    xdir="$xdir/"
18901ab64890Smrg	  fi
18911ab64890Smrg
18921ab64890Smrg	  if test "$pic_object" != none; then
18931ab64890Smrg	    # Prepend the subdirectory the object is found in.
18941ab64890Smrg	    pic_object="$xdir$pic_object"
18951ab64890Smrg
18961ab64890Smrg	    if test "$prev" = dlfiles; then
18971ab64890Smrg	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
18981ab64890Smrg		dlfiles="$dlfiles $pic_object"
18991ab64890Smrg		prev=
19001ab64890Smrg		continue
19011ab64890Smrg	      else
19021ab64890Smrg		# If libtool objects are unsupported, then we need to preload.
19031ab64890Smrg		prev=dlprefiles
19041ab64890Smrg	      fi
19051ab64890Smrg	    fi
19061ab64890Smrg
19071ab64890Smrg	    # CHECK ME:  I think I busted this.  -Ossama
19081ab64890Smrg	    if test "$prev" = dlprefiles; then
19091ab64890Smrg	      # Preload the old-style object.
19101ab64890Smrg	      dlprefiles="$dlprefiles $pic_object"
19111ab64890Smrg	      prev=
19121ab64890Smrg	    fi
19131ab64890Smrg
19141ab64890Smrg	    # A PIC object.
19151ab64890Smrg	    libobjs="$libobjs $pic_object"
19161ab64890Smrg	    arg="$pic_object"
19171ab64890Smrg	  fi
19181ab64890Smrg
19191ab64890Smrg	  # Non-PIC object.
19201ab64890Smrg	  if test "$non_pic_object" != none; then
19211ab64890Smrg	    # Prepend the subdirectory the object is found in.
19221ab64890Smrg	    non_pic_object="$xdir$non_pic_object"
19231ab64890Smrg
19241ab64890Smrg	    # A standard non-PIC object
19251ab64890Smrg	    non_pic_objects="$non_pic_objects $non_pic_object"
19261ab64890Smrg	    if test -z "$pic_object" || test "$pic_object" = none ; then
19271ab64890Smrg	      arg="$non_pic_object"
19281ab64890Smrg	    fi
19291ab64890Smrg	  else
19301ab64890Smrg	    # If the PIC object exists, use it instead.
19311ab64890Smrg	    # $xdir was prepended to $pic_object above.
19321ab64890Smrg	    non_pic_object="$pic_object"
19331ab64890Smrg	    non_pic_objects="$non_pic_objects $non_pic_object"
19341ab64890Smrg	  fi
19351ab64890Smrg	else
19361ab64890Smrg	  # Only an error if not doing a dry-run.
19371ab64890Smrg	  if test -z "$run"; then
19381ab64890Smrg	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
19391ab64890Smrg	    exit $EXIT_FAILURE
19401ab64890Smrg	  else
19411ab64890Smrg	    # Dry-run case.
19421ab64890Smrg
19431ab64890Smrg	    # Extract subdirectory from the argument.
19441ab64890Smrg	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
19451ab64890Smrg	    if test "X$xdir" = "X$arg"; then
19461ab64890Smrg	      xdir=
19471ab64890Smrg	    else
19481ab64890Smrg	      xdir="$xdir/"
19491ab64890Smrg	    fi
19501ab64890Smrg
19511ab64890Smrg	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
19521ab64890Smrg	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
19531ab64890Smrg	    libobjs="$libobjs $pic_object"
19541ab64890Smrg	    non_pic_objects="$non_pic_objects $non_pic_object"
19551ab64890Smrg	  fi
19561ab64890Smrg	fi
19571ab64890Smrg	;;
19581ab64890Smrg
19591ab64890Smrg      *.$libext)
19601ab64890Smrg	# An archive.
19611ab64890Smrg	deplibs="$deplibs $arg"
19621ab64890Smrg	old_deplibs="$old_deplibs $arg"
19631ab64890Smrg	continue
19641ab64890Smrg	;;
19651ab64890Smrg
19661ab64890Smrg      *.la)
19671ab64890Smrg	# A libtool-controlled library.
19681ab64890Smrg
19691ab64890Smrg	if test "$prev" = dlfiles; then
19701ab64890Smrg	  # This library was specified with -dlopen.
19711ab64890Smrg	  dlfiles="$dlfiles $arg"
19721ab64890Smrg	  prev=
19731ab64890Smrg	elif test "$prev" = dlprefiles; then
19741ab64890Smrg	  # The library was specified with -dlpreopen.
19751ab64890Smrg	  dlprefiles="$dlprefiles $arg"
19761ab64890Smrg	  prev=
19771ab64890Smrg	else
19781ab64890Smrg	  deplibs="$deplibs $arg"
19791ab64890Smrg	fi
19801ab64890Smrg	continue
19811ab64890Smrg	;;
19821ab64890Smrg
19831ab64890Smrg      # Some other compiler argument.
19841ab64890Smrg      *)
19851ab64890Smrg	# Unknown arguments in both finalize_command and compile_command need
19861ab64890Smrg	# to be aesthetically quoted because they are evaled later.
19871ab64890Smrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
19881ab64890Smrg	case $arg in
19891ab64890Smrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
19901ab64890Smrg	  arg="\"$arg\""
19911ab64890Smrg	  ;;
19921ab64890Smrg	esac
19931ab64890Smrg	;;
19941ab64890Smrg      esac # arg
19951ab64890Smrg
19961ab64890Smrg      # Now actually substitute the argument into the commands.
19971ab64890Smrg      if test -n "$arg"; then
19981ab64890Smrg	compile_command="$compile_command $arg"
19991ab64890Smrg	finalize_command="$finalize_command $arg"
20001ab64890Smrg      fi
20011ab64890Smrg    done # argument parsing loop
20021ab64890Smrg
20031ab64890Smrg    if test -n "$prev"; then
20041ab64890Smrg      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
20051ab64890Smrg      $echo "$help" 1>&2
20061ab64890Smrg      exit $EXIT_FAILURE
20071ab64890Smrg    fi
20081ab64890Smrg
20091ab64890Smrg    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
20101ab64890Smrg      eval arg=\"$export_dynamic_flag_spec\"
20111ab64890Smrg      compile_command="$compile_command $arg"
20121ab64890Smrg      finalize_command="$finalize_command $arg"
20131ab64890Smrg    fi
20141ab64890Smrg
20151ab64890Smrg    oldlibs=
20161ab64890Smrg    # calculate the name of the file, without its directory
20171ab64890Smrg    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
20181ab64890Smrg    libobjs_save="$libobjs"
20191ab64890Smrg
20201ab64890Smrg    if test -n "$shlibpath_var"; then
20211ab64890Smrg      # get the directories listed in $shlibpath_var
20221ab64890Smrg      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
20231ab64890Smrg    else
20241ab64890Smrg      shlib_search_path=
20251ab64890Smrg    fi
20261ab64890Smrg    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
20271ab64890Smrg    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
20281ab64890Smrg
20291ab64890Smrg    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
20301ab64890Smrg    if test "X$output_objdir" = "X$output"; then
20311ab64890Smrg      output_objdir="$objdir"
20321ab64890Smrg    else
20331ab64890Smrg      output_objdir="$output_objdir/$objdir"
20341ab64890Smrg    fi
20351ab64890Smrg    # Create the object directory.
20361ab64890Smrg    if test ! -d "$output_objdir"; then
20371ab64890Smrg      $show "$mkdir $output_objdir"
20381ab64890Smrg      $run $mkdir $output_objdir
20391ab64890Smrg      exit_status=$?
20401ab64890Smrg      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
20411ab64890Smrg	exit $exit_status
20421ab64890Smrg      fi
20431ab64890Smrg    fi
20441ab64890Smrg
20451ab64890Smrg    # Determine the type of output
20461ab64890Smrg    case $output in
20471ab64890Smrg    "")
20481ab64890Smrg      $echo "$modename: you must specify an output file" 1>&2
20491ab64890Smrg      $echo "$help" 1>&2
20501ab64890Smrg      exit $EXIT_FAILURE
20511ab64890Smrg      ;;
20521ab64890Smrg    *.$libext) linkmode=oldlib ;;
20531ab64890Smrg    *.lo | *.$objext) linkmode=obj ;;
20541ab64890Smrg    *.la) linkmode=lib ;;
20551ab64890Smrg    *) linkmode=prog ;; # Anything else should be a program.
20561ab64890Smrg    esac
20571ab64890Smrg
20581ab64890Smrg    case $host in
20591ab64890Smrg    *cygwin* | *mingw* | *pw32*)
20601ab64890Smrg      # don't eliminate duplications in $postdeps and $predeps
20611ab64890Smrg      duplicate_compiler_generated_deps=yes
20621ab64890Smrg      ;;
20631ab64890Smrg    *)
20641ab64890Smrg      duplicate_compiler_generated_deps=$duplicate_deps
20651ab64890Smrg      ;;
20661ab64890Smrg    esac
20671ab64890Smrg    specialdeplibs=
20681ab64890Smrg
20691ab64890Smrg    libs=
20701ab64890Smrg    # Find all interdependent deplibs by searching for libraries
20711ab64890Smrg    # that are linked more than once (e.g. -la -lb -la)
20721ab64890Smrg    for deplib in $deplibs; do
20731ab64890Smrg      if test "X$duplicate_deps" = "Xyes" ; then
20741ab64890Smrg	case "$libs " in
20751ab64890Smrg	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
20761ab64890Smrg	esac
20771ab64890Smrg      fi
20781ab64890Smrg      libs="$libs $deplib"
20791ab64890Smrg    done
20801ab64890Smrg
20811ab64890Smrg    if test "$linkmode" = lib; then
20821ab64890Smrg      libs="$predeps $libs $compiler_lib_search_path $postdeps"
20831ab64890Smrg
20841ab64890Smrg      # Compute libraries that are listed more than once in $predeps
20851ab64890Smrg      # $postdeps and mark them as special (i.e., whose duplicates are
20861ab64890Smrg      # not to be eliminated).
20871ab64890Smrg      pre_post_deps=
20881ab64890Smrg      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
20891ab64890Smrg	for pre_post_dep in $predeps $postdeps; do
20901ab64890Smrg	  case "$pre_post_deps " in
20911ab64890Smrg	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
20921ab64890Smrg	  esac
20931ab64890Smrg	  pre_post_deps="$pre_post_deps $pre_post_dep"
20941ab64890Smrg	done
20951ab64890Smrg      fi
20961ab64890Smrg      pre_post_deps=
20971ab64890Smrg    fi
20981ab64890Smrg
20991ab64890Smrg    deplibs=
21001ab64890Smrg    newdependency_libs=
21011ab64890Smrg    newlib_search_path=
21021ab64890Smrg    need_relink=no # whether we're linking any uninstalled libtool libraries
21031ab64890Smrg    notinst_deplibs= # not-installed libtool libraries
21041ab64890Smrg    case $linkmode in
21051ab64890Smrg    lib)
21061ab64890Smrg	passes="conv link"
21071ab64890Smrg	for file in $dlfiles $dlprefiles; do
21081ab64890Smrg	  case $file in
21091ab64890Smrg	  *.la) ;;
21101ab64890Smrg	  *)
21111ab64890Smrg	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
21121ab64890Smrg	    exit $EXIT_FAILURE
21131ab64890Smrg	    ;;
21141ab64890Smrg	  esac
21151ab64890Smrg	done
21161ab64890Smrg	;;
21171ab64890Smrg    prog)
21181ab64890Smrg	compile_deplibs=
21191ab64890Smrg	finalize_deplibs=
21201ab64890Smrg	alldeplibs=no
21211ab64890Smrg	newdlfiles=
21221ab64890Smrg	newdlprefiles=
21231ab64890Smrg	passes="conv scan dlopen dlpreopen link"
21241ab64890Smrg	;;
21251ab64890Smrg    *)  passes="conv"
21261ab64890Smrg	;;
21271ab64890Smrg    esac
21281ab64890Smrg    for pass in $passes; do
21291ab64890Smrg      if test "$linkmode,$pass" = "lib,link" ||
21301ab64890Smrg	 test "$linkmode,$pass" = "prog,scan"; then
21311ab64890Smrg	libs="$deplibs"
21321ab64890Smrg	deplibs=
21331ab64890Smrg      fi
21341ab64890Smrg      if test "$linkmode" = prog; then
21351ab64890Smrg	case $pass in
21361ab64890Smrg	dlopen) libs="$dlfiles" ;;
21371ab64890Smrg	dlpreopen) libs="$dlprefiles" ;;
213861b2299dSmrg	link)
213961b2299dSmrg	  libs="$deplibs %DEPLIBS%"
214061b2299dSmrg	  test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
214161b2299dSmrg	  ;;
21421ab64890Smrg	esac
21431ab64890Smrg      fi
21441ab64890Smrg      if test "$pass" = dlopen; then
21451ab64890Smrg	# Collect dlpreopened libraries
21461ab64890Smrg	save_deplibs="$deplibs"
21471ab64890Smrg	deplibs=
21481ab64890Smrg      fi
21491ab64890Smrg      for deplib in $libs; do
21501ab64890Smrg	lib=
21511ab64890Smrg	found=no
21521ab64890Smrg	case $deplib in
21531ab64890Smrg	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
21541ab64890Smrg	  if test "$linkmode,$pass" = "prog,link"; then
21551ab64890Smrg	    compile_deplibs="$deplib $compile_deplibs"
21561ab64890Smrg	    finalize_deplibs="$deplib $finalize_deplibs"
21571ab64890Smrg	  else
21581ab64890Smrg	    compiler_flags="$compiler_flags $deplib"
21591ab64890Smrg	  fi
21601ab64890Smrg	  continue
21611ab64890Smrg	  ;;
21621ab64890Smrg	-l*)
21631ab64890Smrg	  if test "$linkmode" != lib && test "$linkmode" != prog; then
21641ab64890Smrg	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
21651ab64890Smrg	    continue
21661ab64890Smrg	  fi
21671ab64890Smrg	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
216861b2299dSmrg	  if test "$linkmode" = lib; then
216961b2299dSmrg	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
217061b2299dSmrg	  else
217161b2299dSmrg	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
217261b2299dSmrg	  fi
217361b2299dSmrg	  for searchdir in $searchdirs; do
21741ab64890Smrg	    for search_ext in .la $std_shrext .so .a; do
21751ab64890Smrg	      # Search the libtool library
21761ab64890Smrg	      lib="$searchdir/lib${name}${search_ext}"
21771ab64890Smrg	      if test -f "$lib"; then
21781ab64890Smrg		if test "$search_ext" = ".la"; then
21791ab64890Smrg		  found=yes
21801ab64890Smrg		else
21811ab64890Smrg		  found=no
21821ab64890Smrg		fi
21831ab64890Smrg		break 2
21841ab64890Smrg	      fi
21851ab64890Smrg	    done
21861ab64890Smrg	  done
21871ab64890Smrg	  if test "$found" != yes; then
21881ab64890Smrg	    # deplib doesn't seem to be a libtool library
21891ab64890Smrg	    if test "$linkmode,$pass" = "prog,link"; then
21901ab64890Smrg	      compile_deplibs="$deplib $compile_deplibs"
21911ab64890Smrg	      finalize_deplibs="$deplib $finalize_deplibs"
21921ab64890Smrg	    else
21931ab64890Smrg	      deplibs="$deplib $deplibs"
21941ab64890Smrg	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
21951ab64890Smrg	    fi
21961ab64890Smrg	    continue
21971ab64890Smrg	  else # deplib is a libtool library
21981ab64890Smrg	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
21991ab64890Smrg	    # We need to do some special things here, and not later.
22001ab64890Smrg	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
22011ab64890Smrg	      case " $predeps $postdeps " in
22021ab64890Smrg	      *" $deplib "*)
22031ab64890Smrg		if (${SED} -e '2q' $lib |
22041ab64890Smrg                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
22051ab64890Smrg		  library_names=
22061ab64890Smrg		  old_library=
22071ab64890Smrg		  case $lib in
22081ab64890Smrg		  */* | *\\*) . $lib ;;
22091ab64890Smrg		  *) . ./$lib ;;
22101ab64890Smrg		  esac
22111ab64890Smrg		  for l in $old_library $library_names; do
22121ab64890Smrg		    ll="$l"
22131ab64890Smrg		  done
22141ab64890Smrg		  if test "X$ll" = "X$old_library" ; then # only static version available
22151ab64890Smrg		    found=no
22161ab64890Smrg		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
22171ab64890Smrg		    test "X$ladir" = "X$lib" && ladir="."
22181ab64890Smrg		    lib=$ladir/$old_library
22191ab64890Smrg		    if test "$linkmode,$pass" = "prog,link"; then
22201ab64890Smrg		      compile_deplibs="$deplib $compile_deplibs"
22211ab64890Smrg		      finalize_deplibs="$deplib $finalize_deplibs"
22221ab64890Smrg		    else
22231ab64890Smrg		      deplibs="$deplib $deplibs"
22241ab64890Smrg		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
22251ab64890Smrg		    fi
22261ab64890Smrg		    continue
22271ab64890Smrg		  fi
22281ab64890Smrg		fi
22291ab64890Smrg	        ;;
22301ab64890Smrg	      *) ;;
22311ab64890Smrg	      esac
22321ab64890Smrg	    fi
22331ab64890Smrg	  fi
22341ab64890Smrg	  ;; # -l
22351ab64890Smrg	-L*)
22361ab64890Smrg	  case $linkmode in
22371ab64890Smrg	  lib)
22381ab64890Smrg	    deplibs="$deplib $deplibs"
22391ab64890Smrg	    test "$pass" = conv && continue
22401ab64890Smrg	    newdependency_libs="$deplib $newdependency_libs"
22411ab64890Smrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
22421ab64890Smrg	    ;;
22431ab64890Smrg	  prog)
22441ab64890Smrg	    if test "$pass" = conv; then
22451ab64890Smrg	      deplibs="$deplib $deplibs"
22461ab64890Smrg	      continue
22471ab64890Smrg	    fi
22481ab64890Smrg	    if test "$pass" = scan; then
22491ab64890Smrg	      deplibs="$deplib $deplibs"
22501ab64890Smrg	    else
22511ab64890Smrg	      compile_deplibs="$deplib $compile_deplibs"
22521ab64890Smrg	      finalize_deplibs="$deplib $finalize_deplibs"
22531ab64890Smrg	    fi
22541ab64890Smrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
22551ab64890Smrg	    ;;
22561ab64890Smrg	  *)
22571ab64890Smrg	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
22581ab64890Smrg	    ;;
22591ab64890Smrg	  esac # linkmode
22601ab64890Smrg	  continue
22611ab64890Smrg	  ;; # -L
22621ab64890Smrg	-R*)
22631ab64890Smrg	  if test "$pass" = link; then
22641ab64890Smrg	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
22651ab64890Smrg	    # Make sure the xrpath contains only unique directories.
22661ab64890Smrg	    case "$xrpath " in
22671ab64890Smrg	    *" $dir "*) ;;
22681ab64890Smrg	    *) xrpath="$xrpath $dir" ;;
22691ab64890Smrg	    esac
22701ab64890Smrg	  fi
22711ab64890Smrg	  deplibs="$deplib $deplibs"
22721ab64890Smrg	  continue
22731ab64890Smrg	  ;;
22741ab64890Smrg	*.la) lib="$deplib" ;;
22751ab64890Smrg	*.$libext)
22761ab64890Smrg	  if test "$pass" = conv; then
22771ab64890Smrg	    deplibs="$deplib $deplibs"
22781ab64890Smrg	    continue
22791ab64890Smrg	  fi
22801ab64890Smrg	  case $linkmode in
22811ab64890Smrg	  lib)
22821ab64890Smrg	    valid_a_lib=no
22831ab64890Smrg	    case $deplibs_check_method in
22841ab64890Smrg	      match_pattern*)
22851ab64890Smrg		set dummy $deplibs_check_method
22861ab64890Smrg	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
22871ab64890Smrg		if eval $echo \"$deplib\" 2>/dev/null \
22881ab64890Smrg		    | $SED 10q \
22891ab64890Smrg		    | $EGREP "$match_pattern_regex" > /dev/null; then
22901ab64890Smrg		  valid_a_lib=yes
22911ab64890Smrg		fi
22921ab64890Smrg		;;
22931ab64890Smrg	      pass_all)
22941ab64890Smrg		valid_a_lib=yes
22951ab64890Smrg		;;
22961ab64890Smrg            esac
22971ab64890Smrg	    if test "$valid_a_lib" != yes; then
22981ab64890Smrg	      $echo
22991ab64890Smrg	      $echo "*** Warning: Trying to link with static lib archive $deplib."
23001ab64890Smrg	      $echo "*** I have the capability to make that library automatically link in when"
23011ab64890Smrg	      $echo "*** you link to this library.  But I can only do this if you have a"
23021ab64890Smrg	      $echo "*** shared version of the library, which you do not appear to have"
23031ab64890Smrg	      $echo "*** because the file extensions .$libext of this argument makes me believe"
23041ab64890Smrg	      $echo "*** that it is just a static archive that I should not used here."
23051ab64890Smrg	    else
23061ab64890Smrg	      $echo
23071ab64890Smrg	      $echo "*** Warning: Linking the shared library $output against the"
23081ab64890Smrg	      $echo "*** static library $deplib is not portable!"
23091ab64890Smrg	      deplibs="$deplib $deplibs"
23101ab64890Smrg	    fi
23111ab64890Smrg	    continue
23121ab64890Smrg	    ;;
23131ab64890Smrg	  prog)
23141ab64890Smrg	    if test "$pass" != link; then
23151ab64890Smrg	      deplibs="$deplib $deplibs"
23161ab64890Smrg	    else
23171ab64890Smrg	      compile_deplibs="$deplib $compile_deplibs"
23181ab64890Smrg	      finalize_deplibs="$deplib $finalize_deplibs"
23191ab64890Smrg	    fi
23201ab64890Smrg	    continue
23211ab64890Smrg	    ;;
23221ab64890Smrg	  esac # linkmode
23231ab64890Smrg	  ;; # *.$libext
23241ab64890Smrg	*.lo | *.$objext)
23251ab64890Smrg	  if test "$pass" = conv; then
23261ab64890Smrg	    deplibs="$deplib $deplibs"
23271ab64890Smrg	  elif test "$linkmode" = prog; then
23281ab64890Smrg	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
23291ab64890Smrg	      # If there is no dlopen support or we're linking statically,
23301ab64890Smrg	      # we need to preload.
23311ab64890Smrg	      newdlprefiles="$newdlprefiles $deplib"
23321ab64890Smrg	      compile_deplibs="$deplib $compile_deplibs"
23331ab64890Smrg	      finalize_deplibs="$deplib $finalize_deplibs"
23341ab64890Smrg	    else
23351ab64890Smrg	      newdlfiles="$newdlfiles $deplib"
23361ab64890Smrg	    fi
23371ab64890Smrg	  fi
23381ab64890Smrg	  continue
23391ab64890Smrg	  ;;
23401ab64890Smrg	%DEPLIBS%)
23411ab64890Smrg	  alldeplibs=yes
23421ab64890Smrg	  continue
23431ab64890Smrg	  ;;
23441ab64890Smrg	esac # case $deplib
23451ab64890Smrg	if test "$found" = yes || test -f "$lib"; then :
23461ab64890Smrg	else
23471ab64890Smrg	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
23481ab64890Smrg	  exit $EXIT_FAILURE
23491ab64890Smrg	fi
23501ab64890Smrg
23511ab64890Smrg	# Check to see that this really is a libtool archive.
23521ab64890Smrg	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
23531ab64890Smrg	else
23541ab64890Smrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
23551ab64890Smrg	  exit $EXIT_FAILURE
23561ab64890Smrg	fi
23571ab64890Smrg
23581ab64890Smrg	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
23591ab64890Smrg	test "X$ladir" = "X$lib" && ladir="."
23601ab64890Smrg
23611ab64890Smrg	dlname=
23621ab64890Smrg	dlopen=
23631ab64890Smrg	dlpreopen=
23641ab64890Smrg	libdir=
23651ab64890Smrg	library_names=
23661ab64890Smrg	old_library=
23671ab64890Smrg	# If the library was installed with an old release of libtool,
23681ab64890Smrg	# it will not redefine variables installed, or shouldnotlink
23691ab64890Smrg	installed=yes
23701ab64890Smrg	shouldnotlink=no
23711ab64890Smrg	avoidtemprpath=
23721ab64890Smrg
23731ab64890Smrg
23741ab64890Smrg	# Read the .la file
23751ab64890Smrg	case $lib in
23761ab64890Smrg	*/* | *\\*) . $lib ;;
23771ab64890Smrg	*) . ./$lib ;;
23781ab64890Smrg	esac
23791ab64890Smrg
23801ab64890Smrg	if test "$linkmode,$pass" = "lib,link" ||
23811ab64890Smrg	   test "$linkmode,$pass" = "prog,scan" ||
23821ab64890Smrg	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
23831ab64890Smrg	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
23841ab64890Smrg	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
23851ab64890Smrg	fi
23861ab64890Smrg
23871ab64890Smrg	if test "$pass" = conv; then
23881ab64890Smrg	  # Only check for convenience libraries
23891ab64890Smrg	  deplibs="$lib $deplibs"
23901ab64890Smrg	  if test -z "$libdir"; then
23911ab64890Smrg	    if test -z "$old_library"; then
23921ab64890Smrg	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
23931ab64890Smrg	      exit $EXIT_FAILURE
23941ab64890Smrg	    fi
23951ab64890Smrg	    # It is a libtool convenience library, so add in its objects.
23961ab64890Smrg	    convenience="$convenience $ladir/$objdir/$old_library"
23971ab64890Smrg	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
23981ab64890Smrg	    tmp_libs=
23991ab64890Smrg	    for deplib in $dependency_libs; do
24001ab64890Smrg	      deplibs="$deplib $deplibs"
24011ab64890Smrg              if test "X$duplicate_deps" = "Xyes" ; then
24021ab64890Smrg	        case "$tmp_libs " in
24031ab64890Smrg	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
24041ab64890Smrg	        esac
24051ab64890Smrg              fi
24061ab64890Smrg	      tmp_libs="$tmp_libs $deplib"
24071ab64890Smrg	    done
24081ab64890Smrg	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
24091ab64890Smrg	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
24101ab64890Smrg	    exit $EXIT_FAILURE
24111ab64890Smrg	  fi
24121ab64890Smrg	  continue
24131ab64890Smrg	fi # $pass = conv
24141ab64890Smrg
24151ab64890Smrg
24161ab64890Smrg	# Get the name of the library we link against.
24171ab64890Smrg	linklib=
24181ab64890Smrg	for l in $old_library $library_names; do
24191ab64890Smrg	  linklib="$l"
24201ab64890Smrg	done
24211ab64890Smrg	if test -z "$linklib"; then
24221ab64890Smrg	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
24231ab64890Smrg	  exit $EXIT_FAILURE
24241ab64890Smrg	fi
24251ab64890Smrg
24261ab64890Smrg	# This library was specified with -dlopen.
24271ab64890Smrg	if test "$pass" = dlopen; then
24281ab64890Smrg	  if test -z "$libdir"; then
24291ab64890Smrg	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
24301ab64890Smrg	    exit $EXIT_FAILURE
24311ab64890Smrg	  fi
24321ab64890Smrg	  if test -z "$dlname" ||
24331ab64890Smrg	     test "$dlopen_support" != yes ||
24341ab64890Smrg	     test "$build_libtool_libs" = no; then
24351ab64890Smrg	    # If there is no dlname, no dlopen support or we're linking
24361ab64890Smrg	    # statically, we need to preload.  We also need to preload any
24371ab64890Smrg	    # dependent libraries so libltdl's deplib preloader doesn't
24381ab64890Smrg	    # bomb out in the load deplibs phase.
24391ab64890Smrg	    dlprefiles="$dlprefiles $lib $dependency_libs"
24401ab64890Smrg	  else
24411ab64890Smrg	    newdlfiles="$newdlfiles $lib"
24421ab64890Smrg	  fi
24431ab64890Smrg	  continue
24441ab64890Smrg	fi # $pass = dlopen
24451ab64890Smrg
24461ab64890Smrg	# We need an absolute path.
24471ab64890Smrg	case $ladir in
24481ab64890Smrg	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
24491ab64890Smrg	*)
24501ab64890Smrg	  abs_ladir=`cd "$ladir" && pwd`
24511ab64890Smrg	  if test -z "$abs_ladir"; then
24521ab64890Smrg	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
24531ab64890Smrg	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
24541ab64890Smrg	    abs_ladir="$ladir"
24551ab64890Smrg	  fi
24561ab64890Smrg	  ;;
24571ab64890Smrg	esac
24581ab64890Smrg	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
24591ab64890Smrg
24601ab64890Smrg	# Find the relevant object directory and library name.
24611ab64890Smrg	if test "X$installed" = Xyes; then
24621ab64890Smrg	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
24631ab64890Smrg	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
24641ab64890Smrg	    dir="$ladir"
24651ab64890Smrg	    absdir="$abs_ladir"
24661ab64890Smrg	    libdir="$abs_ladir"
24671ab64890Smrg	  else
24681ab64890Smrg	    dir="$libdir"
24691ab64890Smrg	    absdir="$libdir"
24701ab64890Smrg	  fi
24711ab64890Smrg	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
24721ab64890Smrg	else
24731ab64890Smrg	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
24741ab64890Smrg	    dir="$ladir"
24751ab64890Smrg	    absdir="$abs_ladir"
24761ab64890Smrg	    # Remove this search path later
24771ab64890Smrg	    notinst_path="$notinst_path $abs_ladir"
24781ab64890Smrg	  else
24791ab64890Smrg	    dir="$ladir/$objdir"
24801ab64890Smrg	    absdir="$abs_ladir/$objdir"
24811ab64890Smrg	    # Remove this search path later
24821ab64890Smrg	    notinst_path="$notinst_path $abs_ladir"
24831ab64890Smrg	  fi
24841ab64890Smrg	fi # $installed = yes
24851ab64890Smrg	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
24861ab64890Smrg
24871ab64890Smrg	# This library was specified with -dlpreopen.
24881ab64890Smrg	if test "$pass" = dlpreopen; then
24891ab64890Smrg	  if test -z "$libdir"; then
24901ab64890Smrg	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
24911ab64890Smrg	    exit $EXIT_FAILURE
24921ab64890Smrg	  fi
24931ab64890Smrg	  # Prefer using a static library (so that no silly _DYNAMIC symbols
24941ab64890Smrg	  # are required to link).
24951ab64890Smrg	  if test -n "$old_library"; then
24961ab64890Smrg	    newdlprefiles="$newdlprefiles $dir/$old_library"
24971ab64890Smrg	  # Otherwise, use the dlname, so that lt_dlopen finds it.
24981ab64890Smrg	  elif test -n "$dlname"; then
24991ab64890Smrg	    newdlprefiles="$newdlprefiles $dir/$dlname"
25001ab64890Smrg	  else
25011ab64890Smrg	    newdlprefiles="$newdlprefiles $dir/$linklib"
25021ab64890Smrg	  fi
25031ab64890Smrg	fi # $pass = dlpreopen
25041ab64890Smrg
25051ab64890Smrg	if test -z "$libdir"; then
25061ab64890Smrg	  # Link the convenience library
25071ab64890Smrg	  if test "$linkmode" = lib; then
25081ab64890Smrg	    deplibs="$dir/$old_library $deplibs"
25091ab64890Smrg	  elif test "$linkmode,$pass" = "prog,link"; then
25101ab64890Smrg	    compile_deplibs="$dir/$old_library $compile_deplibs"
25111ab64890Smrg	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
25121ab64890Smrg	  else
25131ab64890Smrg	    deplibs="$lib $deplibs" # used for prog,scan pass
25141ab64890Smrg	  fi
25151ab64890Smrg	  continue
25161ab64890Smrg	fi
25171ab64890Smrg
25181ab64890Smrg
25191ab64890Smrg	if test "$linkmode" = prog && test "$pass" != link; then
25201ab64890Smrg	  newlib_search_path="$newlib_search_path $ladir"
25211ab64890Smrg	  deplibs="$lib $deplibs"
25221ab64890Smrg
25231ab64890Smrg	  linkalldeplibs=no
25241ab64890Smrg	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
25251ab64890Smrg	     test "$build_libtool_libs" = no; then
25261ab64890Smrg	    linkalldeplibs=yes
25271ab64890Smrg	  fi
25281ab64890Smrg
25291ab64890Smrg	  tmp_libs=
25301ab64890Smrg	  for deplib in $dependency_libs; do
25311ab64890Smrg	    case $deplib in
25321ab64890Smrg	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
25331ab64890Smrg	    esac
25341ab64890Smrg	    # Need to link against all dependency_libs?
25351ab64890Smrg	    if test "$linkalldeplibs" = yes; then
25361ab64890Smrg	      deplibs="$deplib $deplibs"
25371ab64890Smrg	    else
25381ab64890Smrg	      # Need to hardcode shared library paths
25391ab64890Smrg	      # or/and link against static libraries
25401ab64890Smrg	      newdependency_libs="$deplib $newdependency_libs"
25411ab64890Smrg	    fi
25421ab64890Smrg	    if test "X$duplicate_deps" = "Xyes" ; then
25431ab64890Smrg	      case "$tmp_libs " in
25441ab64890Smrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
25451ab64890Smrg	      esac
25461ab64890Smrg	    fi
25471ab64890Smrg	    tmp_libs="$tmp_libs $deplib"
25481ab64890Smrg	  done # for deplib
25491ab64890Smrg	  continue
25501ab64890Smrg	fi # $linkmode = prog...
25511ab64890Smrg
25521ab64890Smrg	if test "$linkmode,$pass" = "prog,link"; then
25531ab64890Smrg	  if test -n "$library_names" &&
25541ab64890Smrg	     { { test "$prefer_static_libs" = no ||
25551ab64890Smrg		 test "$prefer_static_libs,$installed" = "built,yes"; } ||
25561ab64890Smrg	       test -z "$old_library"; }; then
25571ab64890Smrg	    # We need to hardcode the library path
25581ab64890Smrg	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
25591ab64890Smrg	      # Make sure the rpath contains only unique directories.
25601ab64890Smrg	      case "$temp_rpath " in
25611ab64890Smrg	      *" $dir "*) ;;
25621ab64890Smrg	      *" $absdir "*) ;;
25631ab64890Smrg	      *) temp_rpath="$temp_rpath $absdir" ;;
25641ab64890Smrg	      esac
25651ab64890Smrg	    fi
25661ab64890Smrg
25671ab64890Smrg	    # Hardcode the library path.
25681ab64890Smrg	    # Skip directories that are in the system default run-time
25691ab64890Smrg	    # search path.
25701ab64890Smrg	    case " $sys_lib_dlsearch_path " in
25711ab64890Smrg	    *" $absdir "*) ;;
25721ab64890Smrg	    *)
25731ab64890Smrg	      case "$compile_rpath " in
25741ab64890Smrg	      *" $absdir "*) ;;
25751ab64890Smrg	      *) compile_rpath="$compile_rpath $absdir"
25761ab64890Smrg	      esac
25771ab64890Smrg	      ;;
25781ab64890Smrg	    esac
25791ab64890Smrg	    case " $sys_lib_dlsearch_path " in
25801ab64890Smrg	    *" $libdir "*) ;;
25811ab64890Smrg	    *)
25821ab64890Smrg	      case "$finalize_rpath " in
25831ab64890Smrg	      *" $libdir "*) ;;
25841ab64890Smrg	      *) finalize_rpath="$finalize_rpath $libdir"
25851ab64890Smrg	      esac
25861ab64890Smrg	      ;;
25871ab64890Smrg	    esac
25881ab64890Smrg	  fi # $linkmode,$pass = prog,link...
25891ab64890Smrg
25901ab64890Smrg	  if test "$alldeplibs" = yes &&
25911ab64890Smrg	     { test "$deplibs_check_method" = pass_all ||
25921ab64890Smrg	       { test "$build_libtool_libs" = yes &&
25931ab64890Smrg		 test -n "$library_names"; }; }; then
25941ab64890Smrg	    # We only need to search for static libraries
25951ab64890Smrg	    continue
25961ab64890Smrg	  fi
25971ab64890Smrg	fi
25981ab64890Smrg
25991ab64890Smrg	link_static=no # Whether the deplib will be linked statically
26001ab64890Smrg	use_static_libs=$prefer_static_libs
26011ab64890Smrg	if test "$use_static_libs" = built && test "$installed" = yes ; then
26021ab64890Smrg	  use_static_libs=no
26031ab64890Smrg	fi
26041ab64890Smrg	if test -n "$library_names" &&
26051ab64890Smrg	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
26061ab64890Smrg	  if test "$installed" = no; then
26071ab64890Smrg	    notinst_deplibs="$notinst_deplibs $lib"
26081ab64890Smrg	    need_relink=yes
26091ab64890Smrg	  fi
26101ab64890Smrg	  # This is a shared library
26111ab64890Smrg
26121ab64890Smrg	  # Warn about portability, can't link against -module's on
26131ab64890Smrg	  # some systems (darwin)
26141ab64890Smrg	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
26151ab64890Smrg	    $echo
26161ab64890Smrg	    if test "$linkmode" = prog; then
26171ab64890Smrg	      $echo "*** Warning: Linking the executable $output against the loadable module"
26181ab64890Smrg	    else
26191ab64890Smrg	      $echo "*** Warning: Linking the shared library $output against the loadable module"
26201ab64890Smrg	    fi
26211ab64890Smrg	    $echo "*** $linklib is not portable!"
26221ab64890Smrg	  fi
26231ab64890Smrg	  if test "$linkmode" = lib &&
26241ab64890Smrg	     test "$hardcode_into_libs" = yes; then
26251ab64890Smrg	    # Hardcode the library path.
26261ab64890Smrg	    # Skip directories that are in the system default run-time
26271ab64890Smrg	    # search path.
26281ab64890Smrg	    case " $sys_lib_dlsearch_path " in
26291ab64890Smrg	    *" $absdir "*) ;;
26301ab64890Smrg	    *)
26311ab64890Smrg	      case "$compile_rpath " in
26321ab64890Smrg	      *" $absdir "*) ;;
26331ab64890Smrg	      *) compile_rpath="$compile_rpath $absdir"
26341ab64890Smrg	      esac
26351ab64890Smrg	      ;;
26361ab64890Smrg	    esac
26371ab64890Smrg	    case " $sys_lib_dlsearch_path " in
26381ab64890Smrg	    *" $libdir "*) ;;
26391ab64890Smrg	    *)
26401ab64890Smrg	      case "$finalize_rpath " in
26411ab64890Smrg	      *" $libdir "*) ;;
26421ab64890Smrg	      *) finalize_rpath="$finalize_rpath $libdir"
26431ab64890Smrg	      esac
26441ab64890Smrg	      ;;
26451ab64890Smrg	    esac
26461ab64890Smrg	  fi
26471ab64890Smrg
26481ab64890Smrg	  if test -n "$old_archive_from_expsyms_cmds"; then
26491ab64890Smrg	    # figure out the soname
26501ab64890Smrg	    set dummy $library_names
26511ab64890Smrg	    realname="$2"
26521ab64890Smrg	    shift; shift
26531ab64890Smrg	    libname=`eval \\$echo \"$libname_spec\"`
26541ab64890Smrg	    # use dlname if we got it. it's perfectly good, no?
26551ab64890Smrg	    if test -n "$dlname"; then
26561ab64890Smrg	      soname="$dlname"
26571ab64890Smrg	    elif test -n "$soname_spec"; then
26581ab64890Smrg	      # bleh windows
26591ab64890Smrg	      case $host in
26601ab64890Smrg	      *cygwin* | mingw*)
26611ab64890Smrg		major=`expr $current - $age`
26621ab64890Smrg		versuffix="-$major"
26631ab64890Smrg		;;
26641ab64890Smrg	      esac
26651ab64890Smrg	      eval soname=\"$soname_spec\"
26661ab64890Smrg	    else
26671ab64890Smrg	      soname="$realname"
26681ab64890Smrg	    fi
26691ab64890Smrg
26701ab64890Smrg	    # Make a new name for the extract_expsyms_cmds to use
26711ab64890Smrg	    soroot="$soname"
26721ab64890Smrg	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
26731ab64890Smrg	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
26741ab64890Smrg
26751ab64890Smrg	    # If the library has no export list, then create one now
26761ab64890Smrg	    if test -f "$output_objdir/$soname-def"; then :
26771ab64890Smrg	    else
26781ab64890Smrg	      $show "extracting exported symbol list from \`$soname'"
26791ab64890Smrg	      save_ifs="$IFS"; IFS='~'
26801ab64890Smrg	      cmds=$extract_expsyms_cmds
26811ab64890Smrg	      for cmd in $cmds; do
26821ab64890Smrg		IFS="$save_ifs"
26831ab64890Smrg		eval cmd=\"$cmd\"
26841ab64890Smrg		$show "$cmd"
26851ab64890Smrg		$run eval "$cmd" || exit $?
26861ab64890Smrg	      done
26871ab64890Smrg	      IFS="$save_ifs"
26881ab64890Smrg	    fi
26891ab64890Smrg
26901ab64890Smrg	    # Create $newlib
26911ab64890Smrg	    if test -f "$output_objdir/$newlib"; then :; else
26921ab64890Smrg	      $show "generating import library for \`$soname'"
26931ab64890Smrg	      save_ifs="$IFS"; IFS='~'
26941ab64890Smrg	      cmds=$old_archive_from_expsyms_cmds
26951ab64890Smrg	      for cmd in $cmds; do
26961ab64890Smrg		IFS="$save_ifs"
26971ab64890Smrg		eval cmd=\"$cmd\"
26981ab64890Smrg		$show "$cmd"
26991ab64890Smrg		$run eval "$cmd" || exit $?
27001ab64890Smrg	      done
27011ab64890Smrg	      IFS="$save_ifs"
27021ab64890Smrg	    fi
27031ab64890Smrg	    # make sure the library variables are pointing to the new library
27041ab64890Smrg	    dir=$output_objdir
27051ab64890Smrg	    linklib=$newlib
27061ab64890Smrg	  fi # test -n "$old_archive_from_expsyms_cmds"
27071ab64890Smrg
27081ab64890Smrg	  if test "$linkmode" = prog || test "$mode" != relink; then
27091ab64890Smrg	    add_shlibpath=
27101ab64890Smrg	    add_dir=
27111ab64890Smrg	    add=
27121ab64890Smrg	    lib_linked=yes
27131ab64890Smrg	    case $hardcode_action in
27141ab64890Smrg	    immediate | unsupported)
27151ab64890Smrg	      if test "$hardcode_direct" = no; then
27161ab64890Smrg		add="$dir/$linklib"
27171ab64890Smrg		case $host in
27181ab64890Smrg		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
27191ab64890Smrg		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
27201ab64890Smrg		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
27211ab64890Smrg		    *-*-unixware7*) add_dir="-L$dir" ;;
27221ab64890Smrg		  *-*-darwin* )
27231ab64890Smrg		    # if the lib is a module then we can not link against
27241ab64890Smrg		    # it, someone is ignoring the new warnings I added
27251ab64890Smrg		    if /usr/bin/file -L $add 2> /dev/null |
27261ab64890Smrg                      $EGREP ": [^:]* bundle" >/dev/null ; then
27271ab64890Smrg		      $echo "** Warning, lib $linklib is a module, not a shared library"
27281ab64890Smrg		      if test -z "$old_library" ; then
27291ab64890Smrg		        $echo
27301ab64890Smrg		        $echo "** And there doesn't seem to be a static archive available"
27311ab64890Smrg		        $echo "** The link will probably fail, sorry"
27321ab64890Smrg		      else
27331ab64890Smrg		        add="$dir/$old_library"
27341ab64890Smrg		      fi
27351ab64890Smrg		    fi
27361ab64890Smrg		esac
27371ab64890Smrg	      elif test "$hardcode_minus_L" = no; then
27381ab64890Smrg		case $host in
27391ab64890Smrg		*-*-sunos*) add_shlibpath="$dir" ;;
27401ab64890Smrg		esac
27411ab64890Smrg		add_dir="-L$dir"
27421ab64890Smrg		add="-l$name"
27431ab64890Smrg	      elif test "$hardcode_shlibpath_var" = no; then
27441ab64890Smrg		add_shlibpath="$dir"
27451ab64890Smrg		add="-l$name"
27461ab64890Smrg	      else
27471ab64890Smrg		lib_linked=no
27481ab64890Smrg	      fi
27491ab64890Smrg	      ;;
27501ab64890Smrg	    relink)
27511ab64890Smrg	      if test "$hardcode_direct" = yes; then
27521ab64890Smrg		add="$dir/$linklib"
27531ab64890Smrg	      elif test "$hardcode_minus_L" = yes; then
27541ab64890Smrg		add_dir="-L$dir"
27551ab64890Smrg		# Try looking first in the location we're being installed to.
27561ab64890Smrg		if test -n "$inst_prefix_dir"; then
27571ab64890Smrg		  case $libdir in
27581ab64890Smrg		    [\\/]*)
27591ab64890Smrg		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
27601ab64890Smrg		      ;;
27611ab64890Smrg		  esac
27621ab64890Smrg		fi
27631ab64890Smrg		add="-l$name"
27641ab64890Smrg	      elif test "$hardcode_shlibpath_var" = yes; then
27651ab64890Smrg		add_shlibpath="$dir"
27661ab64890Smrg		add="-l$name"
27671ab64890Smrg	      else
27681ab64890Smrg		lib_linked=no
27691ab64890Smrg	      fi
27701ab64890Smrg	      ;;
27711ab64890Smrg	    *) lib_linked=no ;;
27721ab64890Smrg	    esac
27731ab64890Smrg
27741ab64890Smrg	    if test "$lib_linked" != yes; then
27751ab64890Smrg	      $echo "$modename: configuration error: unsupported hardcode properties"
27761ab64890Smrg	      exit $EXIT_FAILURE
27771ab64890Smrg	    fi
27781ab64890Smrg
27791ab64890Smrg	    if test -n "$add_shlibpath"; then
27801ab64890Smrg	      case :$compile_shlibpath: in
27811ab64890Smrg	      *":$add_shlibpath:"*) ;;
27821ab64890Smrg	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
27831ab64890Smrg	      esac
27841ab64890Smrg	    fi
27851ab64890Smrg	    if test "$linkmode" = prog; then
27861ab64890Smrg	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
27871ab64890Smrg	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
27881ab64890Smrg	    else
27891ab64890Smrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
27901ab64890Smrg	      test -n "$add" && deplibs="$add $deplibs"
27911ab64890Smrg	      if test "$hardcode_direct" != yes && \
27921ab64890Smrg		 test "$hardcode_minus_L" != yes && \
27931ab64890Smrg		 test "$hardcode_shlibpath_var" = yes; then
27941ab64890Smrg		case :$finalize_shlibpath: in
27951ab64890Smrg		*":$libdir:"*) ;;
27961ab64890Smrg		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
27971ab64890Smrg		esac
27981ab64890Smrg	      fi
27991ab64890Smrg	    fi
28001ab64890Smrg	  fi
28011ab64890Smrg
28021ab64890Smrg	  if test "$linkmode" = prog || test "$mode" = relink; then
28031ab64890Smrg	    add_shlibpath=
28041ab64890Smrg	    add_dir=
28051ab64890Smrg	    add=
28061ab64890Smrg	    # Finalize command for both is simple: just hardcode it.
28071ab64890Smrg	    if test "$hardcode_direct" = yes; then
28081ab64890Smrg	      add="$libdir/$linklib"
28091ab64890Smrg	    elif test "$hardcode_minus_L" = yes; then
28101ab64890Smrg	      add_dir="-L$libdir"
28111ab64890Smrg	      add="-l$name"
28121ab64890Smrg	    elif test "$hardcode_shlibpath_var" = yes; then
28131ab64890Smrg	      case :$finalize_shlibpath: in
28141ab64890Smrg	      *":$libdir:"*) ;;
28151ab64890Smrg	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
28161ab64890Smrg	      esac
28171ab64890Smrg	      add="-l$name"
28181ab64890Smrg	    elif test "$hardcode_automatic" = yes; then
28191ab64890Smrg	      if test -n "$inst_prefix_dir" &&
28201ab64890Smrg		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
28211ab64890Smrg	        add="$inst_prefix_dir$libdir/$linklib"
28221ab64890Smrg	      else
28231ab64890Smrg	        add="$libdir/$linklib"
28241ab64890Smrg	      fi
28251ab64890Smrg	    else
28261ab64890Smrg	      # We cannot seem to hardcode it, guess we'll fake it.
28271ab64890Smrg	      add_dir="-L$libdir"
28281ab64890Smrg	      # Try looking first in the location we're being installed to.
28291ab64890Smrg	      if test -n "$inst_prefix_dir"; then
28301ab64890Smrg		case $libdir in
28311ab64890Smrg		  [\\/]*)
28321ab64890Smrg		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
28331ab64890Smrg		    ;;
28341ab64890Smrg		esac
28351ab64890Smrg	      fi
28361ab64890Smrg	      add="-l$name"
28371ab64890Smrg	    fi
28381ab64890Smrg
28391ab64890Smrg	    if test "$linkmode" = prog; then
28401ab64890Smrg	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
28411ab64890Smrg	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
28421ab64890Smrg	    else
28431ab64890Smrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
28441ab64890Smrg	      test -n "$add" && deplibs="$add $deplibs"
28451ab64890Smrg	    fi
28461ab64890Smrg	  fi
28471ab64890Smrg	elif test "$linkmode" = prog; then
28481ab64890Smrg	  # Here we assume that one of hardcode_direct or hardcode_minus_L
28491ab64890Smrg	  # is not unsupported.  This is valid on all known static and
28501ab64890Smrg	  # shared platforms.
28511ab64890Smrg	  if test "$hardcode_direct" != unsupported; then
28521ab64890Smrg	    test -n "$old_library" && linklib="$old_library"
28531ab64890Smrg	    compile_deplibs="$dir/$linklib $compile_deplibs"
28541ab64890Smrg	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
28551ab64890Smrg	  else
28561ab64890Smrg	    compile_deplibs="-l$name -L$dir $compile_deplibs"
28571ab64890Smrg	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
28581ab64890Smrg	  fi
28591ab64890Smrg	elif test "$build_libtool_libs" = yes; then
28601ab64890Smrg	  # Not a shared library
28611ab64890Smrg	  if test "$deplibs_check_method" != pass_all; then
28621ab64890Smrg	    # We're trying link a shared library against a static one
28631ab64890Smrg	    # but the system doesn't support it.
28641ab64890Smrg
28651ab64890Smrg	    # Just print a warning and add the library to dependency_libs so
28661ab64890Smrg	    # that the program can be linked against the static library.
28671ab64890Smrg	    $echo
28681ab64890Smrg	    $echo "*** Warning: This system can not link to static lib archive $lib."
28691ab64890Smrg	    $echo "*** I have the capability to make that library automatically link in when"
28701ab64890Smrg	    $echo "*** you link to this library.  But I can only do this if you have a"
28711ab64890Smrg	    $echo "*** shared version of the library, which you do not appear to have."
28721ab64890Smrg	    if test "$module" = yes; then
28731ab64890Smrg	      $echo "*** But as you try to build a module library, libtool will still create "
28741ab64890Smrg	      $echo "*** a static module, that should work as long as the dlopening application"
28751ab64890Smrg	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
28761ab64890Smrg	      if test -z "$global_symbol_pipe"; then
28771ab64890Smrg		$echo
28781ab64890Smrg		$echo "*** However, this would only work if libtool was able to extract symbol"
28791ab64890Smrg		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
28801ab64890Smrg		$echo "*** not find such a program.  So, this module is probably useless."
28811ab64890Smrg		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
28821ab64890Smrg	      fi
28831ab64890Smrg	      if test "$build_old_libs" = no; then
28841ab64890Smrg		build_libtool_libs=module
28851ab64890Smrg		build_old_libs=yes
28861ab64890Smrg	      else
28871ab64890Smrg		build_libtool_libs=no
28881ab64890Smrg	      fi
28891ab64890Smrg	    fi
28901ab64890Smrg	  else
28911ab64890Smrg	    deplibs="$dir/$old_library $deplibs"
28921ab64890Smrg	    link_static=yes
28931ab64890Smrg	  fi
28941ab64890Smrg	fi # link shared/static library?
28951ab64890Smrg
28961ab64890Smrg	if test "$linkmode" = lib; then
28971ab64890Smrg	  if test -n "$dependency_libs" &&
28981ab64890Smrg	     { test "$hardcode_into_libs" != yes ||
28991ab64890Smrg	       test "$build_old_libs" = yes ||
29001ab64890Smrg	       test "$link_static" = yes; }; then
29011ab64890Smrg	    # Extract -R from dependency_libs
29021ab64890Smrg	    temp_deplibs=
29031ab64890Smrg	    for libdir in $dependency_libs; do
29041ab64890Smrg	      case $libdir in
29051ab64890Smrg	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
29061ab64890Smrg		   case " $xrpath " in
29071ab64890Smrg		   *" $temp_xrpath "*) ;;
29081ab64890Smrg		   *) xrpath="$xrpath $temp_xrpath";;
29091ab64890Smrg		   esac;;
29101ab64890Smrg	      *) temp_deplibs="$temp_deplibs $libdir";;
29111ab64890Smrg	      esac
29121ab64890Smrg	    done
29131ab64890Smrg	    dependency_libs="$temp_deplibs"
29141ab64890Smrg	  fi
29151ab64890Smrg
29161ab64890Smrg	  newlib_search_path="$newlib_search_path $absdir"
29171ab64890Smrg	  # Link against this library
29181ab64890Smrg	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
29191ab64890Smrg	  # ... and its dependency_libs
29201ab64890Smrg	  tmp_libs=
29211ab64890Smrg	  for deplib in $dependency_libs; do
29221ab64890Smrg	    newdependency_libs="$deplib $newdependency_libs"
29231ab64890Smrg	    if test "X$duplicate_deps" = "Xyes" ; then
29241ab64890Smrg	      case "$tmp_libs " in
29251ab64890Smrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
29261ab64890Smrg	      esac
29271ab64890Smrg	    fi
29281ab64890Smrg	    tmp_libs="$tmp_libs $deplib"
29291ab64890Smrg	  done
29301ab64890Smrg
29311ab64890Smrg	  if test "$link_all_deplibs" != no; then
29321ab64890Smrg	    # Add the search paths of all dependency libraries
29331ab64890Smrg	    for deplib in $dependency_libs; do
29341ab64890Smrg	      case $deplib in
29351ab64890Smrg	      -L*) path="$deplib" ;;
29361ab64890Smrg	      *.la)
29371ab64890Smrg		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
29381ab64890Smrg		test "X$dir" = "X$deplib" && dir="."
29391ab64890Smrg		# We need an absolute path.
29401ab64890Smrg		case $dir in
29411ab64890Smrg		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
29421ab64890Smrg		*)
29431ab64890Smrg		  absdir=`cd "$dir" && pwd`
29441ab64890Smrg		  if test -z "$absdir"; then
29451ab64890Smrg		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
29461ab64890Smrg		    absdir="$dir"
29471ab64890Smrg		  fi
29481ab64890Smrg		  ;;
29491ab64890Smrg		esac
29501ab64890Smrg		if grep "^installed=no" $deplib > /dev/null; then
29511ab64890Smrg		  path="$absdir/$objdir"
29521ab64890Smrg		else
29531ab64890Smrg		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
29541ab64890Smrg		  if test -z "$libdir"; then
29551ab64890Smrg		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
29561ab64890Smrg		    exit $EXIT_FAILURE
29571ab64890Smrg		  fi
29581ab64890Smrg		  if test "$absdir" != "$libdir"; then
29591ab64890Smrg		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
29601ab64890Smrg		  fi
29611ab64890Smrg		  path="$absdir"
29621ab64890Smrg		fi
29631ab64890Smrg		depdepl=
29641ab64890Smrg		case $host in
29651ab64890Smrg		*-*-darwin*)
29661ab64890Smrg		  # we do not want to link against static libs,
29671ab64890Smrg		  # but need to link against shared
29681ab64890Smrg		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
296961b2299dSmrg		  eval deplibdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
29701ab64890Smrg		  if test -n "$deplibrary_names" ; then
29711ab64890Smrg		    for tmp in $deplibrary_names ; do
29721ab64890Smrg		      depdepl=$tmp
29731ab64890Smrg		    done
297461b2299dSmrg		    if test -f "$deplibdir/$depdepl" ; then
297561b2299dSmrg		      depdepl="$deplibdir/$depdepl"
297661b2299dSmrg	      	    elif test -f "$path/$depdepl" ; then
29771ab64890Smrg		      depdepl="$path/$depdepl"
297861b2299dSmrg		    else
297961b2299dSmrg		      # Can't find it, oh well...
298061b2299dSmrg		      depdepl=
29811ab64890Smrg		    fi
29821ab64890Smrg		    # do not add paths which are already there
29831ab64890Smrg		    case " $newlib_search_path " in
29841ab64890Smrg		    *" $path "*) ;;
29851ab64890Smrg		    *) newlib_search_path="$newlib_search_path $path";;
29861ab64890Smrg		    esac
29871ab64890Smrg		  fi
29881ab64890Smrg		  path=""
29891ab64890Smrg		  ;;
29901ab64890Smrg		*)
29911ab64890Smrg		  path="-L$path"
29921ab64890Smrg		  ;;
29931ab64890Smrg		esac
29941ab64890Smrg		;;
29951ab64890Smrg	      -l*)
29961ab64890Smrg		case $host in
29971ab64890Smrg		*-*-darwin*)
29981ab64890Smrg		  # Again, we only want to link against shared libraries
29991ab64890Smrg		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
30001ab64890Smrg		  for tmp in $newlib_search_path ; do
30011ab64890Smrg		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
30021ab64890Smrg		      eval depdepl="$tmp/lib$tmp_libs.dylib"
30031ab64890Smrg		      break
30041ab64890Smrg		    fi
30051ab64890Smrg		  done
30061ab64890Smrg		  path=""
30071ab64890Smrg		  ;;
30081ab64890Smrg		*) continue ;;
30091ab64890Smrg		esac
30101ab64890Smrg		;;
30111ab64890Smrg	      *) continue ;;
30121ab64890Smrg	      esac
30131ab64890Smrg	      case " $deplibs " in
30141ab64890Smrg	      *" $path "*) ;;
30151ab64890Smrg	      *) deplibs="$path $deplibs" ;;
30161ab64890Smrg	      esac
30171ab64890Smrg	      case " $deplibs " in
30181ab64890Smrg	      *" $depdepl "*) ;;
30191ab64890Smrg	      *) deplibs="$depdepl $deplibs" ;;
30201ab64890Smrg	      esac
30211ab64890Smrg	    done
30221ab64890Smrg	  fi # link_all_deplibs != no
30231ab64890Smrg	fi # linkmode = lib
30241ab64890Smrg      done # for deplib in $libs
30251ab64890Smrg      dependency_libs="$newdependency_libs"
30261ab64890Smrg      if test "$pass" = dlpreopen; then
30271ab64890Smrg	# Link the dlpreopened libraries before other libraries
30281ab64890Smrg	for deplib in $save_deplibs; do
30291ab64890Smrg	  deplibs="$deplib $deplibs"
30301ab64890Smrg	done
30311ab64890Smrg      fi
30321ab64890Smrg      if test "$pass" != dlopen; then
30331ab64890Smrg	if test "$pass" != conv; then
30341ab64890Smrg	  # Make sure lib_search_path contains only unique directories.
30351ab64890Smrg	  lib_search_path=
30361ab64890Smrg	  for dir in $newlib_search_path; do
30371ab64890Smrg	    case "$lib_search_path " in
30381ab64890Smrg	    *" $dir "*) ;;
30391ab64890Smrg	    *) lib_search_path="$lib_search_path $dir" ;;
30401ab64890Smrg	    esac
30411ab64890Smrg	  done
30421ab64890Smrg	  newlib_search_path=
30431ab64890Smrg	fi
30441ab64890Smrg
30451ab64890Smrg	if test "$linkmode,$pass" != "prog,link"; then
30461ab64890Smrg	  vars="deplibs"
30471ab64890Smrg	else
30481ab64890Smrg	  vars="compile_deplibs finalize_deplibs"
30491ab64890Smrg	fi
30501ab64890Smrg	for var in $vars dependency_libs; do
30511ab64890Smrg	  # Add libraries to $var in reverse order
30521ab64890Smrg	  eval tmp_libs=\"\$$var\"
30531ab64890Smrg	  new_libs=
30541ab64890Smrg	  for deplib in $tmp_libs; do
30551ab64890Smrg	    # FIXME: Pedantically, this is the right thing to do, so
30561ab64890Smrg	    #        that some nasty dependency loop isn't accidentally
30571ab64890Smrg	    #        broken:
30581ab64890Smrg	    #new_libs="$deplib $new_libs"
30591ab64890Smrg	    # Pragmatically, this seems to cause very few problems in
30601ab64890Smrg	    # practice:
30611ab64890Smrg	    case $deplib in
30621ab64890Smrg	    -L*) new_libs="$deplib $new_libs" ;;
30631ab64890Smrg	    -R*) ;;
30641ab64890Smrg	    *)
30651ab64890Smrg	      # And here is the reason: when a library appears more
30661ab64890Smrg	      # than once as an explicit dependence of a library, or
30671ab64890Smrg	      # is implicitly linked in more than once by the
30681ab64890Smrg	      # compiler, it is considered special, and multiple
30691ab64890Smrg	      # occurrences thereof are not removed.  Compare this
30701ab64890Smrg	      # with having the same library being listed as a
30711ab64890Smrg	      # dependency of multiple other libraries: in this case,
30721ab64890Smrg	      # we know (pedantically, we assume) the library does not
30731ab64890Smrg	      # need to be listed more than once, so we keep only the
30741ab64890Smrg	      # last copy.  This is not always right, but it is rare
30751ab64890Smrg	      # enough that we require users that really mean to play
30761ab64890Smrg	      # such unportable linking tricks to link the library
30771ab64890Smrg	      # using -Wl,-lname, so that libtool does not consider it
30781ab64890Smrg	      # for duplicate removal.
30791ab64890Smrg	      case " $specialdeplibs " in
30801ab64890Smrg	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
30811ab64890Smrg	      *)
30821ab64890Smrg		case " $new_libs " in
30831ab64890Smrg		*" $deplib "*) ;;
30841ab64890Smrg		*) new_libs="$deplib $new_libs" ;;
30851ab64890Smrg		esac
30861ab64890Smrg		;;
30871ab64890Smrg	      esac
30881ab64890Smrg	      ;;
30891ab64890Smrg	    esac
30901ab64890Smrg	  done
30911ab64890Smrg	  tmp_libs=
30921ab64890Smrg	  for deplib in $new_libs; do
30931ab64890Smrg	    case $deplib in
30941ab64890Smrg	    -L*)
30951ab64890Smrg	      case " $tmp_libs " in
30961ab64890Smrg	      *" $deplib "*) ;;
30971ab64890Smrg	      *) tmp_libs="$tmp_libs $deplib" ;;
30981ab64890Smrg	      esac
30991ab64890Smrg	      ;;
31001ab64890Smrg	    *) tmp_libs="$tmp_libs $deplib" ;;
31011ab64890Smrg	    esac
31021ab64890Smrg	  done
31031ab64890Smrg	  eval $var=\"$tmp_libs\"
31041ab64890Smrg	done # for var
31051ab64890Smrg      fi
31061ab64890Smrg      # Last step: remove runtime libs from dependency_libs
31071ab64890Smrg      # (they stay in deplibs)
31081ab64890Smrg      tmp_libs=
31091ab64890Smrg      for i in $dependency_libs ; do
31101ab64890Smrg	case " $predeps $postdeps $compiler_lib_search_path " in
31111ab64890Smrg	*" $i "*)
31121ab64890Smrg	  i=""
31131ab64890Smrg	  ;;
31141ab64890Smrg	esac
31151ab64890Smrg	if test -n "$i" ; then
31161ab64890Smrg	  tmp_libs="$tmp_libs $i"
31171ab64890Smrg	fi
31181ab64890Smrg      done
31191ab64890Smrg      dependency_libs=$tmp_libs
31201ab64890Smrg    done # for pass
31211ab64890Smrg    if test "$linkmode" = prog; then
31221ab64890Smrg      dlfiles="$newdlfiles"
31231ab64890Smrg      dlprefiles="$newdlprefiles"
31241ab64890Smrg    fi
31251ab64890Smrg
31261ab64890Smrg    case $linkmode in
31271ab64890Smrg    oldlib)
312861b2299dSmrg      case " $deplibs" in
312961b2299dSmrg      *\ -l* | *\ -L*)
313061b2299dSmrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2 ;;
313161b2299dSmrg      esac
31321ab64890Smrg
31331ab64890Smrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
31341ab64890Smrg	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
31351ab64890Smrg      fi
31361ab64890Smrg
31371ab64890Smrg      if test -n "$rpath"; then
31381ab64890Smrg	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
31391ab64890Smrg      fi
31401ab64890Smrg
31411ab64890Smrg      if test -n "$xrpath"; then
31421ab64890Smrg	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
31431ab64890Smrg      fi
31441ab64890Smrg
31451ab64890Smrg      if test -n "$vinfo"; then
31461ab64890Smrg	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
31471ab64890Smrg      fi
31481ab64890Smrg
31491ab64890Smrg      if test -n "$release"; then
31501ab64890Smrg	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
31511ab64890Smrg      fi
31521ab64890Smrg
31531ab64890Smrg      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
31541ab64890Smrg	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
31551ab64890Smrg      fi
31561ab64890Smrg
31571ab64890Smrg      # Now set the variables for building old libraries.
31581ab64890Smrg      build_libtool_libs=no
31591ab64890Smrg      oldlibs="$output"
31601ab64890Smrg      objs="$objs$old_deplibs"
31611ab64890Smrg      ;;
31621ab64890Smrg
31631ab64890Smrg    lib)
31641ab64890Smrg      # Make sure we only generate libraries of the form `libNAME.la'.
31651ab64890Smrg      case $outputname in
31661ab64890Smrg      lib*)
31671ab64890Smrg	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
31681ab64890Smrg	eval shared_ext=\"$shrext_cmds\"
31691ab64890Smrg	eval libname=\"$libname_spec\"
31701ab64890Smrg	;;
31711ab64890Smrg      *)
31721ab64890Smrg	if test "$module" = no; then
31731ab64890Smrg	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
31741ab64890Smrg	  $echo "$help" 1>&2
31751ab64890Smrg	  exit $EXIT_FAILURE
31761ab64890Smrg	fi
31771ab64890Smrg	if test "$need_lib_prefix" != no; then
31781ab64890Smrg	  # Add the "lib" prefix for modules if required
31791ab64890Smrg	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
31801ab64890Smrg	  eval shared_ext=\"$shrext_cmds\"
31811ab64890Smrg	  eval libname=\"$libname_spec\"
31821ab64890Smrg	else
31831ab64890Smrg	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
31841ab64890Smrg	fi
31851ab64890Smrg	;;
31861ab64890Smrg      esac
31871ab64890Smrg
31881ab64890Smrg      if test -n "$objs"; then
31891ab64890Smrg	if test "$deplibs_check_method" != pass_all; then
31901ab64890Smrg	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
31911ab64890Smrg	  exit $EXIT_FAILURE
31921ab64890Smrg	else
31931ab64890Smrg	  $echo
31941ab64890Smrg	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
31951ab64890Smrg	  $echo "*** objects $objs is not portable!"
31961ab64890Smrg	  libobjs="$libobjs $objs"
31971ab64890Smrg	fi
31981ab64890Smrg      fi
31991ab64890Smrg
32001ab64890Smrg      if test "$dlself" != no; then
32011ab64890Smrg	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
32021ab64890Smrg      fi
32031ab64890Smrg
32041ab64890Smrg      set dummy $rpath
32051ab64890Smrg      if test "$#" -gt 2; then
32061ab64890Smrg	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
32071ab64890Smrg      fi
32081ab64890Smrg      install_libdir="$2"
32091ab64890Smrg
32101ab64890Smrg      oldlibs=
32111ab64890Smrg      if test -z "$rpath"; then
32121ab64890Smrg	if test "$build_libtool_libs" = yes; then
32131ab64890Smrg	  # Building a libtool convenience library.
32141ab64890Smrg	  # Some compilers have problems with a `.al' extension so
32151ab64890Smrg	  # convenience libraries should have the same extension an
32161ab64890Smrg	  # archive normally would.
32171ab64890Smrg	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
32181ab64890Smrg	  build_libtool_libs=convenience
32191ab64890Smrg	  build_old_libs=yes
32201ab64890Smrg	fi
32211ab64890Smrg
32221ab64890Smrg	if test -n "$vinfo"; then
32231ab64890Smrg	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
32241ab64890Smrg	fi
32251ab64890Smrg
32261ab64890Smrg	if test -n "$release"; then
32271ab64890Smrg	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
32281ab64890Smrg	fi
32291ab64890Smrg      else
32301ab64890Smrg
32311ab64890Smrg	# Parse the version information argument.
32321ab64890Smrg	save_ifs="$IFS"; IFS=':'
32331ab64890Smrg	set dummy $vinfo 0 0 0
32341ab64890Smrg	IFS="$save_ifs"
32351ab64890Smrg
32361ab64890Smrg	if test -n "$8"; then
32371ab64890Smrg	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
32381ab64890Smrg	  $echo "$help" 1>&2
32391ab64890Smrg	  exit $EXIT_FAILURE
32401ab64890Smrg	fi
32411ab64890Smrg
32421ab64890Smrg	# convert absolute version numbers to libtool ages
32431ab64890Smrg	# this retains compatibility with .la files and attempts
32441ab64890Smrg	# to make the code below a bit more comprehensible
32451ab64890Smrg
32461ab64890Smrg	case $vinfo_number in
32471ab64890Smrg	yes)
32481ab64890Smrg	  number_major="$2"
32491ab64890Smrg	  number_minor="$3"
32501ab64890Smrg	  number_revision="$4"
32511ab64890Smrg	  #
32521ab64890Smrg	  # There are really only two kinds -- those that
32531ab64890Smrg	  # use the current revision as the major version
32541ab64890Smrg	  # and those that subtract age and use age as
32551ab64890Smrg	  # a minor version.  But, then there is irix
32561ab64890Smrg	  # which has an extra 1 added just for fun
32571ab64890Smrg	  #
32581ab64890Smrg	  case $version_type in
32591ab64890Smrg	  darwin|linux|osf|windows|none)
32601ab64890Smrg	    current=`expr $number_major + $number_minor`
32611ab64890Smrg	    age="$number_minor"
32621ab64890Smrg	    revision="$number_revision"
32631ab64890Smrg	    ;;
32641ab64890Smrg	  freebsd-aout|freebsd-elf|sunos)
32651ab64890Smrg	    current="$number_major"
32661ab64890Smrg	    revision="$number_minor"
32671ab64890Smrg	    age="0"
32681ab64890Smrg	    ;;
32691ab64890Smrg	  irix|nonstopux)
32701ab64890Smrg	    current=`expr $number_major + $number_minor`
32711ab64890Smrg	    age="$number_minor"
32721ab64890Smrg	    revision="$number_minor"
32731ab64890Smrg	    lt_irix_increment=no
32741ab64890Smrg	    ;;
327561b2299dSmrg	  *)
327661b2299dSmrg	    $echo "$modename: unknown library version type \`$version_type'" 1>&2
327761b2299dSmrg	    $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
327861b2299dSmrg	    exit $EXIT_FAILURE
327961b2299dSmrg	    ;;
32801ab64890Smrg	  esac
32811ab64890Smrg	  ;;
32821ab64890Smrg	no)
32831ab64890Smrg	  current="$2"
32841ab64890Smrg	  revision="$3"
32851ab64890Smrg	  age="$4"
32861ab64890Smrg	  ;;
32871ab64890Smrg	esac
32881ab64890Smrg
32891ab64890Smrg	# Check that each of the things are valid numbers.
32901ab64890Smrg	case $current in
32911ab64890Smrg	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]) ;;
32921ab64890Smrg	*)
32931ab64890Smrg	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
32941ab64890Smrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
32951ab64890Smrg	  exit $EXIT_FAILURE
32961ab64890Smrg	  ;;
32971ab64890Smrg	esac
32981ab64890Smrg
32991ab64890Smrg	case $revision in
33001ab64890Smrg	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]) ;;
33011ab64890Smrg	*)
33021ab64890Smrg	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
33031ab64890Smrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
33041ab64890Smrg	  exit $EXIT_FAILURE
33051ab64890Smrg	  ;;
33061ab64890Smrg	esac
33071ab64890Smrg
33081ab64890Smrg	case $age in
33091ab64890Smrg	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]) ;;
33101ab64890Smrg	*)
33111ab64890Smrg	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
33121ab64890Smrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
33131ab64890Smrg	  exit $EXIT_FAILURE
33141ab64890Smrg	  ;;
33151ab64890Smrg	esac
33161ab64890Smrg
33171ab64890Smrg	if test "$age" -gt "$current"; then
33181ab64890Smrg	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
33191ab64890Smrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
33201ab64890Smrg	  exit $EXIT_FAILURE
33211ab64890Smrg	fi
33221ab64890Smrg
33231ab64890Smrg	# Calculate the version variables.
33241ab64890Smrg	major=
33251ab64890Smrg	versuffix=
33261ab64890Smrg	verstring=
33271ab64890Smrg	case $version_type in
33281ab64890Smrg	none) ;;
33291ab64890Smrg
33301ab64890Smrg	darwin)
33311ab64890Smrg	  # Like Linux, but with the current version available in
33321ab64890Smrg	  # verstring for coding it into the library header
33331ab64890Smrg	  major=.`expr $current - $age`
33341ab64890Smrg	  versuffix="$major.$age.$revision"
33351ab64890Smrg	  # Darwin ld doesn't like 0 for these options...
33361ab64890Smrg	  minor_current=`expr $current + 1`
33371ab64890Smrg	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
33381ab64890Smrg	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
33391ab64890Smrg	  ;;
33401ab64890Smrg
33411ab64890Smrg	freebsd-aout)
33421ab64890Smrg	  major=".$current"
33431ab64890Smrg	  versuffix=".$current.$revision";
33441ab64890Smrg	  ;;
33451ab64890Smrg
33461ab64890Smrg	freebsd-elf)
33471ab64890Smrg	  major=".$current"
33481ab64890Smrg	  versuffix=".$current";
33491ab64890Smrg	  ;;
33501ab64890Smrg
33511ab64890Smrg	irix | nonstopux)
33521ab64890Smrg	  if test "X$lt_irix_increment" = "Xno"; then
33531ab64890Smrg	    major=`expr $current - $age`
33541ab64890Smrg	  else
33551ab64890Smrg	    major=`expr $current - $age + 1`
33561ab64890Smrg	  fi
33571ab64890Smrg	  case $version_type in
33581ab64890Smrg	    nonstopux) verstring_prefix=nonstopux ;;
33591ab64890Smrg	    *)         verstring_prefix=sgi ;;
33601ab64890Smrg	  esac
33611ab64890Smrg	  verstring="$verstring_prefix$major.$revision"
33621ab64890Smrg
33631ab64890Smrg	  # Add in all the interfaces that we are compatible with.
33641ab64890Smrg	  loop=$revision
33651ab64890Smrg	  while test "$loop" -ne 0; do
33661ab64890Smrg	    iface=`expr $revision - $loop`
33671ab64890Smrg	    loop=`expr $loop - 1`
33681ab64890Smrg	    verstring="$verstring_prefix$major.$iface:$verstring"
33691ab64890Smrg	  done
33701ab64890Smrg
33711ab64890Smrg	  # Before this point, $major must not contain `.'.
33721ab64890Smrg	  major=.$major
33731ab64890Smrg	  versuffix="$major.$revision"
33741ab64890Smrg	  ;;
33751ab64890Smrg
33761ab64890Smrg	linux)
33771ab64890Smrg	  major=.`expr $current - $age`
33781ab64890Smrg	  versuffix="$major.$age.$revision"
33791ab64890Smrg	  ;;
33801ab64890Smrg
33811ab64890Smrg	osf)
33821ab64890Smrg	  major=.`expr $current - $age`
33831ab64890Smrg	  versuffix=".$current.$age.$revision"
33841ab64890Smrg	  verstring="$current.$age.$revision"
33851ab64890Smrg
33861ab64890Smrg	  # Add in all the interfaces that we are compatible with.
33871ab64890Smrg	  loop=$age
33881ab64890Smrg	  while test "$loop" -ne 0; do
33891ab64890Smrg	    iface=`expr $current - $loop`
33901ab64890Smrg	    loop=`expr $loop - 1`
33911ab64890Smrg	    verstring="$verstring:${iface}.0"
33921ab64890Smrg	  done
33931ab64890Smrg
33941ab64890Smrg	  # Make executables depend on our current version.
33951ab64890Smrg	  verstring="$verstring:${current}.0"
33961ab64890Smrg	  ;;
33971ab64890Smrg
33981ab64890Smrg	sunos)
33991ab64890Smrg	  major=".$current"
34001ab64890Smrg	  versuffix=".$current.$revision"
34011ab64890Smrg	  ;;
34021ab64890Smrg
34031ab64890Smrg	windows)
34041ab64890Smrg	  # Use '-' rather than '.', since we only want one
34051ab64890Smrg	  # extension on DOS 8.3 filesystems.
34061ab64890Smrg	  major=`expr $current - $age`
34071ab64890Smrg	  versuffix="-$major"
34081ab64890Smrg	  ;;
34091ab64890Smrg
34101ab64890Smrg	*)
34111ab64890Smrg	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
34121ab64890Smrg	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
34131ab64890Smrg	  exit $EXIT_FAILURE
34141ab64890Smrg	  ;;
34151ab64890Smrg	esac
34161ab64890Smrg
34171ab64890Smrg	# Clear the version info if we defaulted, and they specified a release.
34181ab64890Smrg	if test -z "$vinfo" && test -n "$release"; then
34191ab64890Smrg	  major=
34201ab64890Smrg	  case $version_type in
34211ab64890Smrg	  darwin)
34221ab64890Smrg	    # we can't check for "0.0" in archive_cmds due to quoting
34231ab64890Smrg	    # problems, so we reset it completely
34241ab64890Smrg	    verstring=
34251ab64890Smrg	    ;;
34261ab64890Smrg	  *)
34271ab64890Smrg	    verstring="0.0"
34281ab64890Smrg	    ;;
34291ab64890Smrg	  esac
34301ab64890Smrg	  if test "$need_version" = no; then
34311ab64890Smrg	    versuffix=
34321ab64890Smrg	  else
34331ab64890Smrg	    versuffix=".0.0"
34341ab64890Smrg	  fi
34351ab64890Smrg	fi
34361ab64890Smrg
34371ab64890Smrg	# Remove version info from name if versioning should be avoided
34381ab64890Smrg	if test "$avoid_version" = yes && test "$need_version" = no; then
34391ab64890Smrg	  major=
34401ab64890Smrg	  versuffix=
34411ab64890Smrg	  verstring=""
34421ab64890Smrg	fi
34431ab64890Smrg
34441ab64890Smrg	# Check to see if the archive will have undefined symbols.
34451ab64890Smrg	if test "$allow_undefined" = yes; then
34461ab64890Smrg	  if test "$allow_undefined_flag" = unsupported; then
34471ab64890Smrg	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
34481ab64890Smrg	    build_libtool_libs=no
34491ab64890Smrg	    build_old_libs=yes
34501ab64890Smrg	  fi
34511ab64890Smrg	else
34521ab64890Smrg	  # Don't allow undefined symbols.
34531ab64890Smrg	  allow_undefined_flag="$no_undefined_flag"
34541ab64890Smrg	fi
34551ab64890Smrg      fi
34561ab64890Smrg
34571ab64890Smrg      if test "$mode" != relink; then
34581ab64890Smrg	# Remove our outputs, but don't remove object files since they
34591ab64890Smrg	# may have been created when compiling PIC objects.
34601ab64890Smrg	removelist=
34611ab64890Smrg	tempremovelist=`$echo "$output_objdir/*"`
34621ab64890Smrg	for p in $tempremovelist; do
34631ab64890Smrg	  case $p in
34641ab64890Smrg	    *.$objext)
34651ab64890Smrg	       ;;
34661ab64890Smrg	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
34671ab64890Smrg	       if test "X$precious_files_regex" != "X"; then
34681ab64890Smrg	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
34691ab64890Smrg	         then
34701ab64890Smrg		   continue
34711ab64890Smrg		 fi
34721ab64890Smrg	       fi
34731ab64890Smrg	       removelist="$removelist $p"
34741ab64890Smrg	       ;;
34751ab64890Smrg	    *) ;;
34761ab64890Smrg	  esac
34771ab64890Smrg	done
34781ab64890Smrg	if test -n "$removelist"; then
34791ab64890Smrg	  $show "${rm}r $removelist"
34801ab64890Smrg	  $run ${rm}r $removelist
34811ab64890Smrg	fi
34821ab64890Smrg      fi
34831ab64890Smrg
34841ab64890Smrg      # Now set the variables for building old libraries.
34851ab64890Smrg      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
34861ab64890Smrg	oldlibs="$oldlibs $output_objdir/$libname.$libext"
34871ab64890Smrg
34881ab64890Smrg	# Transform .lo files to .o files.
34891ab64890Smrg	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
34901ab64890Smrg      fi
34911ab64890Smrg
34921ab64890Smrg      # Eliminate all temporary directories.
34931ab64890Smrg      #for path in $notinst_path; do
34941ab64890Smrg      #	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
34951ab64890Smrg      #	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
34961ab64890Smrg      #	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
34971ab64890Smrg      #done
34981ab64890Smrg
34991ab64890Smrg      if test -n "$xrpath"; then
35001ab64890Smrg	# If the user specified any rpath flags, then add them.
35011ab64890Smrg	temp_xrpath=
35021ab64890Smrg	for libdir in $xrpath; do
35031ab64890Smrg	  temp_xrpath="$temp_xrpath -R$libdir"
35041ab64890Smrg	  case "$finalize_rpath " in
35051ab64890Smrg	  *" $libdir "*) ;;
35061ab64890Smrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
35071ab64890Smrg	  esac
35081ab64890Smrg	done
35091ab64890Smrg	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
35101ab64890Smrg	  dependency_libs="$temp_xrpath $dependency_libs"
35111ab64890Smrg	fi
35121ab64890Smrg      fi
35131ab64890Smrg
35141ab64890Smrg      # Make sure dlfiles contains only unique files that won't be dlpreopened
35151ab64890Smrg      old_dlfiles="$dlfiles"
35161ab64890Smrg      dlfiles=
35171ab64890Smrg      for lib in $old_dlfiles; do
35181ab64890Smrg	case " $dlprefiles $dlfiles " in
35191ab64890Smrg	*" $lib "*) ;;
35201ab64890Smrg	*) dlfiles="$dlfiles $lib" ;;
35211ab64890Smrg	esac
35221ab64890Smrg      done
35231ab64890Smrg
35241ab64890Smrg      # Make sure dlprefiles contains only unique files
35251ab64890Smrg      old_dlprefiles="$dlprefiles"
35261ab64890Smrg      dlprefiles=
35271ab64890Smrg      for lib in $old_dlprefiles; do
35281ab64890Smrg	case "$dlprefiles " in
35291ab64890Smrg	*" $lib "*) ;;
35301ab64890Smrg	*) dlprefiles="$dlprefiles $lib" ;;
35311ab64890Smrg	esac
35321ab64890Smrg      done
35331ab64890Smrg
35341ab64890Smrg      if test "$build_libtool_libs" = yes; then
35351ab64890Smrg	if test -n "$rpath"; then
35361ab64890Smrg	  case $host in
35371ab64890Smrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
35381ab64890Smrg	    # these systems don't actually have a c library (as such)!
35391ab64890Smrg	    ;;
35401ab64890Smrg	  *-*-rhapsody* | *-*-darwin1.[012])
35411ab64890Smrg	    # Rhapsody C library is in the System framework
35421ab64890Smrg	    deplibs="$deplibs -framework System"
35431ab64890Smrg	    ;;
35441ab64890Smrg	  *-*-netbsd*)
35451ab64890Smrg	    # Don't link with libc until the a.out ld.so is fixed.
35461ab64890Smrg	    ;;
35471ab64890Smrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
35481ab64890Smrg	    # Do not include libc due to us having libc/libc_r.
35491ab64890Smrg	    ;;
35501ab64890Smrg	  *-*-sco3.2v5* | *-*-sco5v6*)
35511ab64890Smrg	    # Causes problems with __ctype
35521ab64890Smrg	    ;;
35531ab64890Smrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
35541ab64890Smrg	    # Compiler inserts libc in the correct place for threads to work
35551ab64890Smrg	    ;;
35561ab64890Smrg 	  *)
35571ab64890Smrg	    # Add libc to deplibs on all other systems if necessary.
35581ab64890Smrg	    if test "$build_libtool_need_lc" = "yes"; then
35591ab64890Smrg	      deplibs="$deplibs -lc"
35601ab64890Smrg	    fi
35611ab64890Smrg	    ;;
35621ab64890Smrg	  esac
35631ab64890Smrg	fi
35641ab64890Smrg
35651ab64890Smrg	# Transform deplibs into only deplibs that can be linked in shared.
35661ab64890Smrg	name_save=$name
35671ab64890Smrg	libname_save=$libname
35681ab64890Smrg	release_save=$release
35691ab64890Smrg	versuffix_save=$versuffix
35701ab64890Smrg	major_save=$major
35711ab64890Smrg	# I'm not sure if I'm treating the release correctly.  I think
35721ab64890Smrg	# release should show up in the -l (ie -lgmp5) so we don't want to
35731ab64890Smrg	# add it in twice.  Is that correct?
35741ab64890Smrg	release=""
35751ab64890Smrg	versuffix=""
35761ab64890Smrg	major=""
35771ab64890Smrg	newdeplibs=
35781ab64890Smrg	droppeddeps=no
35791ab64890Smrg	case $deplibs_check_method in
35801ab64890Smrg	pass_all)
35811ab64890Smrg	  # Don't check for shared/static.  Everything works.
35821ab64890Smrg	  # This might be a little naive.  We might want to check
35831ab64890Smrg	  # whether the library exists or not.  But this is on
35841ab64890Smrg	  # osf3 & osf4 and I'm not really sure... Just
35851ab64890Smrg	  # implementing what was already the behavior.
35861ab64890Smrg	  newdeplibs=$deplibs
35871ab64890Smrg	  ;;
35881ab64890Smrg	test_compile)
35891ab64890Smrg	  # This code stresses the "libraries are programs" paradigm to its
35901ab64890Smrg	  # limits. Maybe even breaks it.  We compile a program, linking it
35911ab64890Smrg	  # against the deplibs as a proxy for the library.  Then we can check
35921ab64890Smrg	  # whether they linked in statically or dynamically with ldd.
35931ab64890Smrg	  $rm conftest.c
35941ab64890Smrg	  cat > conftest.c <<EOF
35951ab64890Smrg	  int main() { return 0; }
35961ab64890SmrgEOF
35971ab64890Smrg	  $rm conftest
35981ab64890Smrg	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
35991ab64890Smrg	    ldd_output=`ldd conftest`
36001ab64890Smrg	    for i in $deplibs; do
36011ab64890Smrg	      name=`expr $i : '-l\(.*\)'`
36021ab64890Smrg	      # If $name is empty we are operating on a -L argument.
36031ab64890Smrg              if test "$name" != "" && test "$name" != "0"; then
36041ab64890Smrg		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
36051ab64890Smrg		  case " $predeps $postdeps " in
36061ab64890Smrg		  *" $i "*)
36071ab64890Smrg		    newdeplibs="$newdeplibs $i"
36081ab64890Smrg		    i=""
36091ab64890Smrg		    ;;
36101ab64890Smrg		  esac
36111ab64890Smrg	        fi
36121ab64890Smrg		if test -n "$i" ; then
36131ab64890Smrg		  libname=`eval \\$echo \"$libname_spec\"`
36141ab64890Smrg		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
36151ab64890Smrg		  set dummy $deplib_matches
36161ab64890Smrg		  deplib_match=$2
36171ab64890Smrg		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
36181ab64890Smrg		    newdeplibs="$newdeplibs $i"
36191ab64890Smrg		  else
36201ab64890Smrg		    droppeddeps=yes
36211ab64890Smrg		    $echo
36221ab64890Smrg		    $echo "*** Warning: dynamic linker does not accept needed library $i."
36231ab64890Smrg		    $echo "*** I have the capability to make that library automatically link in when"
36241ab64890Smrg		    $echo "*** you link to this library.  But I can only do this if you have a"
36251ab64890Smrg		    $echo "*** shared version of the library, which I believe you do not have"
36261ab64890Smrg		    $echo "*** because a test_compile did reveal that the linker did not use it for"
36271ab64890Smrg		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
36281ab64890Smrg		  fi
36291ab64890Smrg		fi
36301ab64890Smrg	      else
36311ab64890Smrg		newdeplibs="$newdeplibs $i"
36321ab64890Smrg	      fi
36331ab64890Smrg	    done
36341ab64890Smrg	  else
36351ab64890Smrg	    # Error occurred in the first compile.  Let's try to salvage
36361ab64890Smrg	    # the situation: Compile a separate program for each library.
36371ab64890Smrg	    for i in $deplibs; do
36381ab64890Smrg	      name=`expr $i : '-l\(.*\)'`
36391ab64890Smrg	      # If $name is empty we are operating on a -L argument.
36401ab64890Smrg              if test "$name" != "" && test "$name" != "0"; then
36411ab64890Smrg		$rm conftest
36421ab64890Smrg		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
36431ab64890Smrg		  ldd_output=`ldd conftest`
36441ab64890Smrg		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
36451ab64890Smrg		    case " $predeps $postdeps " in
36461ab64890Smrg		    *" $i "*)
36471ab64890Smrg		      newdeplibs="$newdeplibs $i"
36481ab64890Smrg		      i=""
36491ab64890Smrg		      ;;
36501ab64890Smrg		    esac
36511ab64890Smrg		  fi
36521ab64890Smrg		  if test -n "$i" ; then
36531ab64890Smrg		    libname=`eval \\$echo \"$libname_spec\"`
36541ab64890Smrg		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
36551ab64890Smrg		    set dummy $deplib_matches
36561ab64890Smrg		    deplib_match=$2
36571ab64890Smrg		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
36581ab64890Smrg		      newdeplibs="$newdeplibs $i"
36591ab64890Smrg		    else
36601ab64890Smrg		      droppeddeps=yes
36611ab64890Smrg		      $echo
36621ab64890Smrg		      $echo "*** Warning: dynamic linker does not accept needed library $i."
36631ab64890Smrg		      $echo "*** I have the capability to make that library automatically link in when"
36641ab64890Smrg		      $echo "*** you link to this library.  But I can only do this if you have a"
36651ab64890Smrg		      $echo "*** shared version of the library, which you do not appear to have"
36661ab64890Smrg		      $echo "*** because a test_compile did reveal that the linker did not use this one"
36671ab64890Smrg		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
36681ab64890Smrg		    fi
36691ab64890Smrg		  fi
36701ab64890Smrg		else
36711ab64890Smrg		  droppeddeps=yes
36721ab64890Smrg		  $echo
36731ab64890Smrg		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
36741ab64890Smrg		  $echo "*** make it link in!  You will probably need to install it or some"
36751ab64890Smrg		  $echo "*** library that it depends on before this library will be fully"
36761ab64890Smrg		  $echo "*** functional.  Installing it before continuing would be even better."
36771ab64890Smrg		fi
36781ab64890Smrg	      else
36791ab64890Smrg		newdeplibs="$newdeplibs $i"
36801ab64890Smrg	      fi
36811ab64890Smrg	    done
36821ab64890Smrg	  fi
36831ab64890Smrg	  ;;
36841ab64890Smrg	file_magic*)
36851ab64890Smrg	  set dummy $deplibs_check_method
36861ab64890Smrg	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
36871ab64890Smrg	  for a_deplib in $deplibs; do
36881ab64890Smrg	    name=`expr $a_deplib : '-l\(.*\)'`
36891ab64890Smrg	    # If $name is empty we are operating on a -L argument.
36901ab64890Smrg            if test "$name" != "" && test  "$name" != "0"; then
36911ab64890Smrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
36921ab64890Smrg		case " $predeps $postdeps " in
36931ab64890Smrg		*" $a_deplib "*)
36941ab64890Smrg		  newdeplibs="$newdeplibs $a_deplib"
36951ab64890Smrg		  a_deplib=""
36961ab64890Smrg		  ;;
36971ab64890Smrg		esac
36981ab64890Smrg	      fi
36991ab64890Smrg	      if test -n "$a_deplib" ; then
37001ab64890Smrg		libname=`eval \\$echo \"$libname_spec\"`
37011ab64890Smrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
37021ab64890Smrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
37031ab64890Smrg		  for potent_lib in $potential_libs; do
37041ab64890Smrg		      # Follow soft links.
37051ab64890Smrg		      if ls -lLd "$potent_lib" 2>/dev/null \
37061ab64890Smrg			 | grep " -> " >/dev/null; then
37071ab64890Smrg			continue
37081ab64890Smrg		      fi
37091ab64890Smrg		      # The statement above tries to avoid entering an
37101ab64890Smrg		      # endless loop below, in case of cyclic links.
37111ab64890Smrg		      # We might still enter an endless loop, since a link
37121ab64890Smrg		      # loop can be closed while we follow links,
37131ab64890Smrg		      # but so what?
37141ab64890Smrg		      potlib="$potent_lib"
37151ab64890Smrg		      while test -h "$potlib" 2>/dev/null; do
37161ab64890Smrg			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
37171ab64890Smrg			case $potliblink in
37181ab64890Smrg			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
37191ab64890Smrg			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
37201ab64890Smrg			esac
37211ab64890Smrg		      done
37221ab64890Smrg		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
37231ab64890Smrg			 | ${SED} 10q \
37241ab64890Smrg			 | $EGREP "$file_magic_regex" > /dev/null; then
37251ab64890Smrg			newdeplibs="$newdeplibs $a_deplib"
37261ab64890Smrg			a_deplib=""
37271ab64890Smrg			break 2
37281ab64890Smrg		      fi
37291ab64890Smrg		  done
37301ab64890Smrg		done
37311ab64890Smrg	      fi
37321ab64890Smrg	      if test -n "$a_deplib" ; then
37331ab64890Smrg		droppeddeps=yes
37341ab64890Smrg		$echo
37351ab64890Smrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
37361ab64890Smrg		$echo "*** I have the capability to make that library automatically link in when"
37371ab64890Smrg		$echo "*** you link to this library.  But I can only do this if you have a"
37381ab64890Smrg		$echo "*** shared version of the library, which you do not appear to have"
37391ab64890Smrg		$echo "*** because I did check the linker path looking for a file starting"
37401ab64890Smrg		if test -z "$potlib" ; then
37411ab64890Smrg		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
37421ab64890Smrg		else
37431ab64890Smrg		  $echo "*** with $libname and none of the candidates passed a file format test"
37441ab64890Smrg		  $echo "*** using a file magic. Last file checked: $potlib"
37451ab64890Smrg		fi
37461ab64890Smrg	      fi
37471ab64890Smrg	    else
37481ab64890Smrg	      # Add a -L argument.
37491ab64890Smrg	      newdeplibs="$newdeplibs $a_deplib"
37501ab64890Smrg	    fi
37511ab64890Smrg	  done # Gone through all deplibs.
37521ab64890Smrg	  ;;
37531ab64890Smrg	match_pattern*)
37541ab64890Smrg	  set dummy $deplibs_check_method
37551ab64890Smrg	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
37561ab64890Smrg	  for a_deplib in $deplibs; do
37571ab64890Smrg	    name=`expr $a_deplib : '-l\(.*\)'`
37581ab64890Smrg	    # If $name is empty we are operating on a -L argument.
37591ab64890Smrg	    if test -n "$name" && test "$name" != "0"; then
37601ab64890Smrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
37611ab64890Smrg		case " $predeps $postdeps " in
37621ab64890Smrg		*" $a_deplib "*)
37631ab64890Smrg		  newdeplibs="$newdeplibs $a_deplib"
37641ab64890Smrg		  a_deplib=""
37651ab64890Smrg		  ;;
37661ab64890Smrg		esac
37671ab64890Smrg	      fi
37681ab64890Smrg	      if test -n "$a_deplib" ; then
37691ab64890Smrg		libname=`eval \\$echo \"$libname_spec\"`
37701ab64890Smrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
37711ab64890Smrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
37721ab64890Smrg		  for potent_lib in $potential_libs; do
37731ab64890Smrg		    potlib="$potent_lib" # see symlink-check above in file_magic test
37741ab64890Smrg		    if eval $echo \"$potent_lib\" 2>/dev/null \
37751ab64890Smrg		        | ${SED} 10q \
37761ab64890Smrg		        | $EGREP "$match_pattern_regex" > /dev/null; then
37771ab64890Smrg		      newdeplibs="$newdeplibs $a_deplib"
37781ab64890Smrg		      a_deplib=""
37791ab64890Smrg		      break 2
37801ab64890Smrg		    fi
37811ab64890Smrg		  done
37821ab64890Smrg		done
37831ab64890Smrg	      fi
37841ab64890Smrg	      if test -n "$a_deplib" ; then
37851ab64890Smrg		droppeddeps=yes
37861ab64890Smrg		$echo
37871ab64890Smrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
37881ab64890Smrg		$echo "*** I have the capability to make that library automatically link in when"
37891ab64890Smrg		$echo "*** you link to this library.  But I can only do this if you have a"
37901ab64890Smrg		$echo "*** shared version of the library, which you do not appear to have"
37911ab64890Smrg		$echo "*** because I did check the linker path looking for a file starting"
37921ab64890Smrg		if test -z "$potlib" ; then
37931ab64890Smrg		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
37941ab64890Smrg		else
37951ab64890Smrg		  $echo "*** with $libname and none of the candidates passed a file format test"
37961ab64890Smrg		  $echo "*** using a regex pattern. Last file checked: $potlib"
37971ab64890Smrg		fi
37981ab64890Smrg	      fi
37991ab64890Smrg	    else
38001ab64890Smrg	      # Add a -L argument.
38011ab64890Smrg	      newdeplibs="$newdeplibs $a_deplib"
38021ab64890Smrg	    fi
38031ab64890Smrg	  done # Gone through all deplibs.
38041ab64890Smrg	  ;;
38051ab64890Smrg	none | unknown | *)
38061ab64890Smrg	  newdeplibs=""
38071ab64890Smrg	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
38081ab64890Smrg	    -e 's/ -[LR][^ ]*//g'`
38091ab64890Smrg	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
38101ab64890Smrg	    for i in $predeps $postdeps ; do
38111ab64890Smrg	      # can't use Xsed below, because $i might contain '/'
38121ab64890Smrg	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
38131ab64890Smrg	    done
38141ab64890Smrg	  fi
38151ab64890Smrg	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
38161ab64890Smrg	    | grep . >/dev/null; then
38171ab64890Smrg	    $echo
38181ab64890Smrg	    if test "X$deplibs_check_method" = "Xnone"; then
38191ab64890Smrg	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
38201ab64890Smrg	    else
38211ab64890Smrg	      $echo "*** Warning: inter-library dependencies are not known to be supported."
38221ab64890Smrg	    fi
38231ab64890Smrg	    $echo "*** All declared inter-library dependencies are being dropped."
38241ab64890Smrg	    droppeddeps=yes
38251ab64890Smrg	  fi
38261ab64890Smrg	  ;;
38271ab64890Smrg	esac
38281ab64890Smrg	versuffix=$versuffix_save
38291ab64890Smrg	major=$major_save
38301ab64890Smrg	release=$release_save
38311ab64890Smrg	libname=$libname_save
38321ab64890Smrg	name=$name_save
38331ab64890Smrg
38341ab64890Smrg	case $host in
38351ab64890Smrg	*-*-rhapsody* | *-*-darwin1.[012])
38361ab64890Smrg	  # On Rhapsody replace the C library is the System framework
38371ab64890Smrg	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
38381ab64890Smrg	  ;;
38391ab64890Smrg	esac
38401ab64890Smrg
38411ab64890Smrg	if test "$droppeddeps" = yes; then
38421ab64890Smrg	  if test "$module" = yes; then
38431ab64890Smrg	    $echo
38441ab64890Smrg	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
38451ab64890Smrg	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
38461ab64890Smrg	    $echo "*** a static module, that should work as long as the dlopening"
38471ab64890Smrg	    $echo "*** application is linked with the -dlopen flag."
38481ab64890Smrg	    if test -z "$global_symbol_pipe"; then
38491ab64890Smrg	      $echo
38501ab64890Smrg	      $echo "*** However, this would only work if libtool was able to extract symbol"
38511ab64890Smrg	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
38521ab64890Smrg	      $echo "*** not find such a program.  So, this module is probably useless."
38531ab64890Smrg	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
38541ab64890Smrg	    fi
38551ab64890Smrg	    if test "$build_old_libs" = no; then
38561ab64890Smrg	      oldlibs="$output_objdir/$libname.$libext"
38571ab64890Smrg	      build_libtool_libs=module
38581ab64890Smrg	      build_old_libs=yes
38591ab64890Smrg	    else
38601ab64890Smrg	      build_libtool_libs=no
38611ab64890Smrg	    fi
38621ab64890Smrg	  else
38631ab64890Smrg	    $echo "*** The inter-library dependencies that have been dropped here will be"
38641ab64890Smrg	    $echo "*** automatically added whenever a program is linked with this library"
38651ab64890Smrg	    $echo "*** or is declared to -dlopen it."
38661ab64890Smrg
38671ab64890Smrg	    if test "$allow_undefined" = no; then
38681ab64890Smrg	      $echo
38691ab64890Smrg	      $echo "*** Since this library must not contain undefined symbols,"
38701ab64890Smrg	      $echo "*** because either the platform does not support them or"
38711ab64890Smrg	      $echo "*** it was explicitly requested with -no-undefined,"
38721ab64890Smrg	      $echo "*** libtool will only create a static version of it."
38731ab64890Smrg	      if test "$build_old_libs" = no; then
38741ab64890Smrg		oldlibs="$output_objdir/$libname.$libext"
38751ab64890Smrg		build_libtool_libs=module
38761ab64890Smrg		build_old_libs=yes
38771ab64890Smrg	      else
38781ab64890Smrg		build_libtool_libs=no
38791ab64890Smrg	      fi
38801ab64890Smrg	    fi
38811ab64890Smrg	  fi
38821ab64890Smrg	fi
38831ab64890Smrg	# Done checking deplibs!
38841ab64890Smrg	deplibs=$newdeplibs
38851ab64890Smrg      fi
38861ab64890Smrg
38871ab64890Smrg
38881ab64890Smrg      # move library search paths that coincide with paths to not yet
38891ab64890Smrg      # installed libraries to the beginning of the library search list
38901ab64890Smrg      new_libs=
38911ab64890Smrg      for path in $notinst_path; do
38921ab64890Smrg	case " $new_libs " in
38931ab64890Smrg	*" -L$path/$objdir "*) ;;
38941ab64890Smrg	*)
38951ab64890Smrg	  case " $deplibs " in
38961ab64890Smrg	  *" -L$path/$objdir "*)
38971ab64890Smrg	    new_libs="$new_libs -L$path/$objdir" ;;
38981ab64890Smrg	  esac
38991ab64890Smrg	  ;;
39001ab64890Smrg	esac
39011ab64890Smrg      done
39021ab64890Smrg      for deplib in $deplibs; do
39031ab64890Smrg	case $deplib in
39041ab64890Smrg	-L*)
39051ab64890Smrg	  case " $new_libs " in
39061ab64890Smrg	  *" $deplib "*) ;;
39071ab64890Smrg	  *) new_libs="$new_libs $deplib" ;;
39081ab64890Smrg	  esac
39091ab64890Smrg	  ;;
39101ab64890Smrg	*) new_libs="$new_libs $deplib" ;;
39111ab64890Smrg	esac
39121ab64890Smrg      done
39131ab64890Smrg      deplibs="$new_libs"
39141ab64890Smrg
39151ab64890Smrg
39161ab64890Smrg      # All the library-specific variables (install_libdir is set above).
39171ab64890Smrg      library_names=
39181ab64890Smrg      old_library=
39191ab64890Smrg      dlname=
39201ab64890Smrg
39211ab64890Smrg      # Test again, we may have decided not to build it any more
39221ab64890Smrg      if test "$build_libtool_libs" = yes; then
39231ab64890Smrg	if test "$hardcode_into_libs" = yes; then
39241ab64890Smrg	  # Hardcode the library paths
39251ab64890Smrg	  hardcode_libdirs=
39261ab64890Smrg	  dep_rpath=
39271ab64890Smrg	  rpath="$finalize_rpath"
39281ab64890Smrg	  test "$mode" != relink && rpath="$compile_rpath$rpath"
39291ab64890Smrg	  for libdir in $rpath; do
39301ab64890Smrg	    if test -n "$hardcode_libdir_flag_spec"; then
39311ab64890Smrg	      if test -n "$hardcode_libdir_separator"; then
39321ab64890Smrg		if test -z "$hardcode_libdirs"; then
39331ab64890Smrg		  hardcode_libdirs="$libdir"
39341ab64890Smrg		else
39351ab64890Smrg		  # Just accumulate the unique libdirs.
39361ab64890Smrg		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
39371ab64890Smrg		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
39381ab64890Smrg		    ;;
39391ab64890Smrg		  *)
39401ab64890Smrg		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
39411ab64890Smrg		    ;;
39421ab64890Smrg		  esac
39431ab64890Smrg		fi
39441ab64890Smrg	      else
39451ab64890Smrg		eval flag=\"$hardcode_libdir_flag_spec\"
39461ab64890Smrg		dep_rpath="$dep_rpath $flag"
39471ab64890Smrg	      fi
39481ab64890Smrg	    elif test -n "$runpath_var"; then
39491ab64890Smrg	      case "$perm_rpath " in
39501ab64890Smrg	      *" $libdir "*) ;;
39511ab64890Smrg	      *) perm_rpath="$perm_rpath $libdir" ;;
39521ab64890Smrg	      esac
39531ab64890Smrg	    fi
39541ab64890Smrg	  done
39551ab64890Smrg	  # Substitute the hardcoded libdirs into the rpath.
39561ab64890Smrg	  if test -n "$hardcode_libdir_separator" &&
39571ab64890Smrg	     test -n "$hardcode_libdirs"; then
39581ab64890Smrg	    libdir="$hardcode_libdirs"
39591ab64890Smrg	    if test -n "$hardcode_libdir_flag_spec_ld"; then
39601ab64890Smrg	      case $archive_cmds in
39611ab64890Smrg	      *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
39621ab64890Smrg	      *)      eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
39631ab64890Smrg	      esac
39641ab64890Smrg	    else
39651ab64890Smrg	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
39661ab64890Smrg	    fi
39671ab64890Smrg	  fi
39681ab64890Smrg	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
39691ab64890Smrg	    # We should set the runpath_var.
39701ab64890Smrg	    rpath=
39711ab64890Smrg	    for dir in $perm_rpath; do
39721ab64890Smrg	      rpath="$rpath$dir:"
39731ab64890Smrg	    done
39741ab64890Smrg	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
39751ab64890Smrg	  fi
39761ab64890Smrg	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
39771ab64890Smrg	fi
39781ab64890Smrg
39791ab64890Smrg	shlibpath="$finalize_shlibpath"
39801ab64890Smrg	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
39811ab64890Smrg	if test -n "$shlibpath"; then
39821ab64890Smrg	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
39831ab64890Smrg	fi
39841ab64890Smrg
39851ab64890Smrg	# Get the real and link names of the library.
39861ab64890Smrg	eval shared_ext=\"$shrext_cmds\"
39871ab64890Smrg	eval library_names=\"$library_names_spec\"
39881ab64890Smrg	set dummy $library_names
39891ab64890Smrg	realname="$2"
39901ab64890Smrg	shift; shift
39911ab64890Smrg
39921ab64890Smrg	if test -n "$soname_spec"; then
39931ab64890Smrg	  eval soname=\"$soname_spec\"
39941ab64890Smrg	else
39951ab64890Smrg	  soname="$realname"
39961ab64890Smrg	fi
39971ab64890Smrg	if test -z "$dlname"; then
39981ab64890Smrg	  dlname=$soname
39991ab64890Smrg	fi
40001ab64890Smrg
40011ab64890Smrg	lib="$output_objdir/$realname"
40021ab64890Smrg	linknames=
40031ab64890Smrg	for link
40041ab64890Smrg	do
40051ab64890Smrg	  linknames="$linknames $link"
40061ab64890Smrg	done
40071ab64890Smrg
40081ab64890Smrg	# Use standard objects if they are pic
40091ab64890Smrg	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
40101ab64890Smrg
40111ab64890Smrg	# Prepare the list of exported symbols
40121ab64890Smrg	if test -z "$export_symbols"; then
40131ab64890Smrg	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
40141ab64890Smrg	    $show "generating symbol list for \`$libname.la'"
40151ab64890Smrg	    export_symbols="$output_objdir/$libname.exp"
40161ab64890Smrg	    $run $rm $export_symbols
40171ab64890Smrg	    cmds=$export_symbols_cmds
40181ab64890Smrg	    save_ifs="$IFS"; IFS='~'
40191ab64890Smrg	    for cmd in $cmds; do
40201ab64890Smrg	      IFS="$save_ifs"
40211ab64890Smrg	      eval cmd=\"$cmd\"
40221ab64890Smrg	      if len=`expr "X$cmd" : ".*"` &&
40231ab64890Smrg	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
40241ab64890Smrg	        $show "$cmd"
40251ab64890Smrg	        $run eval "$cmd" || exit $?
40261ab64890Smrg	        skipped_export=false
40271ab64890Smrg	      else
40281ab64890Smrg	        # The command line is too long to execute in one step.
40291ab64890Smrg	        $show "using reloadable object file for export list..."
40301ab64890Smrg	        skipped_export=:
40311ab64890Smrg		# Break out early, otherwise skipped_export may be
40321ab64890Smrg		# set to false by a later but shorter cmd.
40331ab64890Smrg		break
40341ab64890Smrg	      fi
40351ab64890Smrg	    done
40361ab64890Smrg	    IFS="$save_ifs"
40371ab64890Smrg	    if test -n "$export_symbols_regex"; then
40381ab64890Smrg	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
40391ab64890Smrg	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
40401ab64890Smrg	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
40411ab64890Smrg	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
40421ab64890Smrg	    fi
40431ab64890Smrg	  fi
40441ab64890Smrg	fi
40451ab64890Smrg
40461ab64890Smrg	if test -n "$export_symbols" && test -n "$include_expsyms"; then
40471ab64890Smrg	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
40481ab64890Smrg	fi
40491ab64890Smrg
40501ab64890Smrg	tmp_deplibs=
40511ab64890Smrg	for test_deplib in $deplibs; do
40521ab64890Smrg		case " $convenience " in
40531ab64890Smrg		*" $test_deplib "*) ;;
40541ab64890Smrg		*)
40551ab64890Smrg			tmp_deplibs="$tmp_deplibs $test_deplib"
40561ab64890Smrg			;;
40571ab64890Smrg		esac
40581ab64890Smrg	done
40591ab64890Smrg	deplibs="$tmp_deplibs"
40601ab64890Smrg
40611ab64890Smrg	if test -n "$convenience"; then
40621ab64890Smrg	  if test -n "$whole_archive_flag_spec"; then
40631ab64890Smrg	    save_libobjs=$libobjs
40641ab64890Smrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
40651ab64890Smrg	  else
40661ab64890Smrg	    gentop="$output_objdir/${outputname}x"
40671ab64890Smrg	    generated="$generated $gentop"
40681ab64890Smrg
40691ab64890Smrg	    func_extract_archives $gentop $convenience
40701ab64890Smrg	    libobjs="$libobjs $func_extract_archives_result"
40711ab64890Smrg	  fi
40721ab64890Smrg	fi
40731ab64890Smrg	
40741ab64890Smrg	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
40751ab64890Smrg	  eval flag=\"$thread_safe_flag_spec\"
40761ab64890Smrg	  linker_flags="$linker_flags $flag"
40771ab64890Smrg	fi
40781ab64890Smrg
40791ab64890Smrg	# Make a backup of the uninstalled library when relinking
40801ab64890Smrg	if test "$mode" = relink; then
40811ab64890Smrg	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
40821ab64890Smrg	fi
40831ab64890Smrg
40841ab64890Smrg	# Do each of the archive commands.
40851ab64890Smrg	if test "$module" = yes && test -n "$module_cmds" ; then
40861ab64890Smrg	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
40871ab64890Smrg	    eval test_cmds=\"$module_expsym_cmds\"
40881ab64890Smrg	    cmds=$module_expsym_cmds
40891ab64890Smrg	  else
40901ab64890Smrg	    eval test_cmds=\"$module_cmds\"
40911ab64890Smrg	    cmds=$module_cmds
40921ab64890Smrg	  fi
40931ab64890Smrg	else
40941ab64890Smrg	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
40951ab64890Smrg	  eval test_cmds=\"$archive_expsym_cmds\"
40961ab64890Smrg	  cmds=$archive_expsym_cmds
40971ab64890Smrg	else
40981ab64890Smrg	  eval test_cmds=\"$archive_cmds\"
40991ab64890Smrg	  cmds=$archive_cmds
41001ab64890Smrg	  fi
41011ab64890Smrg	fi
41021ab64890Smrg
41031ab64890Smrg	if test "X$skipped_export" != "X:" &&
41041ab64890Smrg	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
41051ab64890Smrg	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
41061ab64890Smrg	  :
41071ab64890Smrg	else
41081ab64890Smrg	  # The command line is too long to link in one step, link piecewise.
41091ab64890Smrg	  $echo "creating reloadable object files..."
41101ab64890Smrg
41111ab64890Smrg	  # Save the value of $output and $libobjs because we want to
41121ab64890Smrg	  # use them later.  If we have whole_archive_flag_spec, we
41131ab64890Smrg	  # want to use save_libobjs as it was before
41141ab64890Smrg	  # whole_archive_flag_spec was expanded, because we can't
41151ab64890Smrg	  # assume the linker understands whole_archive_flag_spec.
41161ab64890Smrg	  # This may have to be revisited, in case too many
41171ab64890Smrg	  # convenience libraries get linked in and end up exceeding
41181ab64890Smrg	  # the spec.
41191ab64890Smrg	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
41201ab64890Smrg	    save_libobjs=$libobjs
41211ab64890Smrg	  fi
41221ab64890Smrg	  save_output=$output
41231ab64890Smrg	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
41241ab64890Smrg
41251ab64890Smrg	  # Clear the reloadable object creation command queue and
41261ab64890Smrg	  # initialize k to one.
41271ab64890Smrg	  test_cmds=
41281ab64890Smrg	  concat_cmds=
41291ab64890Smrg	  objlist=
41301ab64890Smrg	  delfiles=
41311ab64890Smrg	  last_robj=
41321ab64890Smrg	  k=1
41331ab64890Smrg	  output=$output_objdir/$output_la-${k}.$objext
41341ab64890Smrg	  # Loop over the list of objects to be linked.
41351ab64890Smrg	  for obj in $save_libobjs
41361ab64890Smrg	  do
41371ab64890Smrg	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
41381ab64890Smrg	    if test "X$objlist" = X ||
41391ab64890Smrg	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
41401ab64890Smrg		 test "$len" -le "$max_cmd_len"; }; then
41411ab64890Smrg	      objlist="$objlist $obj"
41421ab64890Smrg	    else
41431ab64890Smrg	      # The command $test_cmds is almost too long, add a
41441ab64890Smrg	      # command to the queue.
41451ab64890Smrg	      if test "$k" -eq 1 ; then
41461ab64890Smrg		# The first file doesn't have a previous command to add.
41471ab64890Smrg		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
41481ab64890Smrg	      else
41491ab64890Smrg		# All subsequent reloadable object files will link in
41501ab64890Smrg		# the last one created.
41511ab64890Smrg		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
41521ab64890Smrg	      fi
41531ab64890Smrg	      last_robj=$output_objdir/$output_la-${k}.$objext
41541ab64890Smrg	      k=`expr $k + 1`
41551ab64890Smrg	      output=$output_objdir/$output_la-${k}.$objext
41561ab64890Smrg	      objlist=$obj
41571ab64890Smrg	      len=1
41581ab64890Smrg	    fi
41591ab64890Smrg	  done
41601ab64890Smrg	  # Handle the remaining objects by creating one last
41611ab64890Smrg	  # reloadable object file.  All subsequent reloadable object
41621ab64890Smrg	  # files will link in the last one created.
41631ab64890Smrg	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
41641ab64890Smrg	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
41651ab64890Smrg
41661ab64890Smrg	  if ${skipped_export-false}; then
41671ab64890Smrg	    $show "generating symbol list for \`$libname.la'"
41681ab64890Smrg	    export_symbols="$output_objdir/$libname.exp"
41691ab64890Smrg	    $run $rm $export_symbols
41701ab64890Smrg	    libobjs=$output
41711ab64890Smrg	    # Append the command to create the export file.
41721ab64890Smrg	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
41731ab64890Smrg          fi
41741ab64890Smrg
41751ab64890Smrg	  # Set up a command to remove the reloadable object files
41761ab64890Smrg	  # after they are used.
41771ab64890Smrg	  i=0
41781ab64890Smrg	  while test "$i" -lt "$k"
41791ab64890Smrg	  do
41801ab64890Smrg	    i=`expr $i + 1`
41811ab64890Smrg	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
41821ab64890Smrg	  done
41831ab64890Smrg
41841ab64890Smrg	  $echo "creating a temporary reloadable object file: $output"
41851ab64890Smrg
41861ab64890Smrg	  # Loop through the commands generated above and execute them.
41871ab64890Smrg	  save_ifs="$IFS"; IFS='~'
41881ab64890Smrg	  for cmd in $concat_cmds; do
41891ab64890Smrg	    IFS="$save_ifs"
41901ab64890Smrg	    $show "$cmd"
41911ab64890Smrg	    $run eval "$cmd" || exit $?
41921ab64890Smrg	  done
41931ab64890Smrg	  IFS="$save_ifs"
41941ab64890Smrg
41951ab64890Smrg	  libobjs=$output
41961ab64890Smrg	  # Restore the value of output.
41971ab64890Smrg	  output=$save_output
41981ab64890Smrg
41991ab64890Smrg	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
42001ab64890Smrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
42011ab64890Smrg	  fi
42021ab64890Smrg	  # Expand the library linking commands again to reset the
42031ab64890Smrg	  # value of $libobjs for piecewise linking.
42041ab64890Smrg
42051ab64890Smrg	  # Do each of the archive commands.
42061ab64890Smrg	  if test "$module" = yes && test -n "$module_cmds" ; then
42071ab64890Smrg	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
42081ab64890Smrg	      cmds=$module_expsym_cmds
42091ab64890Smrg	    else
42101ab64890Smrg	      cmds=$module_cmds
42111ab64890Smrg	    fi
42121ab64890Smrg	  else
42131ab64890Smrg	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
42141ab64890Smrg	    cmds=$archive_expsym_cmds
42151ab64890Smrg	  else
42161ab64890Smrg	    cmds=$archive_cmds
42171ab64890Smrg	    fi
42181ab64890Smrg	  fi
42191ab64890Smrg
42201ab64890Smrg	  # Append the command to remove the reloadable object files
42211ab64890Smrg	  # to the just-reset $cmds.
42221ab64890Smrg	  eval cmds=\"\$cmds~\$rm $delfiles\"
42231ab64890Smrg	fi
42241ab64890Smrg	save_ifs="$IFS"; IFS='~'
42251ab64890Smrg	for cmd in $cmds; do
42261ab64890Smrg	  IFS="$save_ifs"
42271ab64890Smrg	  eval cmd=\"$cmd\"
42281ab64890Smrg	  $show "$cmd"
42291ab64890Smrg	  $run eval "$cmd" || {
42301ab64890Smrg	    lt_exit=$?
42311ab64890Smrg
42321ab64890Smrg	    # Restore the uninstalled library and exit
42331ab64890Smrg	    if test "$mode" = relink; then
42341ab64890Smrg	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
42351ab64890Smrg	    fi
42361ab64890Smrg
42371ab64890Smrg	    exit $lt_exit
42381ab64890Smrg	  }
42391ab64890Smrg	done
42401ab64890Smrg	IFS="$save_ifs"
42411ab64890Smrg
42421ab64890Smrg	# Restore the uninstalled library and exit
42431ab64890Smrg	if test "$mode" = relink; then
42441ab64890Smrg	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
42451ab64890Smrg
42461ab64890Smrg	  if test -n "$convenience"; then
42471ab64890Smrg	    if test -z "$whole_archive_flag_spec"; then
42481ab64890Smrg	      $show "${rm}r $gentop"
42491ab64890Smrg	      $run ${rm}r "$gentop"
42501ab64890Smrg	    fi
42511ab64890Smrg	  fi
42521ab64890Smrg
42531ab64890Smrg	  exit $EXIT_SUCCESS
42541ab64890Smrg	fi
42551ab64890Smrg
42561ab64890Smrg	# Create links to the real library.
42571ab64890Smrg	for linkname in $linknames; do
42581ab64890Smrg	  if test "$realname" != "$linkname"; then
42591ab64890Smrg	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
42601ab64890Smrg	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
42611ab64890Smrg	  fi
42621ab64890Smrg	done
42631ab64890Smrg
42641ab64890Smrg	# If -module or -export-dynamic was specified, set the dlname.
42651ab64890Smrg	if test "$module" = yes || test "$export_dynamic" = yes; then
42661ab64890Smrg	  # On all known operating systems, these are identical.
42671ab64890Smrg	  dlname="$soname"
42681ab64890Smrg	fi
42691ab64890Smrg      fi
42701ab64890Smrg      ;;
42711ab64890Smrg
42721ab64890Smrg    obj)
427361b2299dSmrg      case " $deplibs" in
427461b2299dSmrg      *\ -l* | *\ -L*)
427561b2299dSmrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2 ;;
427661b2299dSmrg      esac
42771ab64890Smrg
42781ab64890Smrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
42791ab64890Smrg	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
42801ab64890Smrg      fi
42811ab64890Smrg
42821ab64890Smrg      if test -n "$rpath"; then
42831ab64890Smrg	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
42841ab64890Smrg      fi
42851ab64890Smrg
42861ab64890Smrg      if test -n "$xrpath"; then
42871ab64890Smrg	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
42881ab64890Smrg      fi
42891ab64890Smrg
42901ab64890Smrg      if test -n "$vinfo"; then
42911ab64890Smrg	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
42921ab64890Smrg      fi
42931ab64890Smrg
42941ab64890Smrg      if test -n "$release"; then
42951ab64890Smrg	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
42961ab64890Smrg      fi
42971ab64890Smrg
42981ab64890Smrg      case $output in
42991ab64890Smrg      *.lo)
43001ab64890Smrg	if test -n "$objs$old_deplibs"; then
43011ab64890Smrg	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
43021ab64890Smrg	  exit $EXIT_FAILURE
43031ab64890Smrg	fi
43041ab64890Smrg	libobj="$output"
43051ab64890Smrg	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
43061ab64890Smrg	;;
43071ab64890Smrg      *)
43081ab64890Smrg	libobj=
43091ab64890Smrg	obj="$output"
43101ab64890Smrg	;;
43111ab64890Smrg      esac
43121ab64890Smrg
43131ab64890Smrg      # Delete the old objects.
43141ab64890Smrg      $run $rm $obj $libobj
43151ab64890Smrg
43161ab64890Smrg      # Objects from convenience libraries.  This assumes
43171ab64890Smrg      # single-version convenience libraries.  Whenever we create
43181ab64890Smrg      # different ones for PIC/non-PIC, this we'll have to duplicate
43191ab64890Smrg      # the extraction.
43201ab64890Smrg      reload_conv_objs=
43211ab64890Smrg      gentop=
43221ab64890Smrg      # reload_cmds runs $LD directly, so let us get rid of
43231ab64890Smrg      # -Wl from whole_archive_flag_spec and hope we can get by with
43241ab64890Smrg      # turning comma into space..
43251ab64890Smrg      wl=
43261ab64890Smrg
43271ab64890Smrg      if test -n "$convenience"; then
43281ab64890Smrg	if test -n "$whole_archive_flag_spec"; then
43291ab64890Smrg	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
43301ab64890Smrg	  reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
43311ab64890Smrg	else
43321ab64890Smrg	  gentop="$output_objdir/${obj}x"
43331ab64890Smrg	  generated="$generated $gentop"
43341ab64890Smrg
43351ab64890Smrg	  func_extract_archives $gentop $convenience
43361ab64890Smrg	  reload_conv_objs="$reload_objs $func_extract_archives_result"
43371ab64890Smrg	fi
43381ab64890Smrg      fi
43391ab64890Smrg
43401ab64890Smrg      # Create the old-style object.
43411ab64890Smrg      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
43421ab64890Smrg
43431ab64890Smrg      output="$obj"
43441ab64890Smrg      cmds=$reload_cmds
43451ab64890Smrg      save_ifs="$IFS"; IFS='~'
43461ab64890Smrg      for cmd in $cmds; do
43471ab64890Smrg	IFS="$save_ifs"
43481ab64890Smrg	eval cmd=\"$cmd\"
43491ab64890Smrg	$show "$cmd"
43501ab64890Smrg	$run eval "$cmd" || exit $?
43511ab64890Smrg      done
43521ab64890Smrg      IFS="$save_ifs"
43531ab64890Smrg
43541ab64890Smrg      # Exit if we aren't doing a library object file.
43551ab64890Smrg      if test -z "$libobj"; then
43561ab64890Smrg	if test -n "$gentop"; then
43571ab64890Smrg	  $show "${rm}r $gentop"
43581ab64890Smrg	  $run ${rm}r $gentop
43591ab64890Smrg	fi
43601ab64890Smrg
43611ab64890Smrg	exit $EXIT_SUCCESS
43621ab64890Smrg      fi
43631ab64890Smrg
43641ab64890Smrg      if test "$build_libtool_libs" != yes; then
43651ab64890Smrg	if test -n "$gentop"; then
43661ab64890Smrg	  $show "${rm}r $gentop"
43671ab64890Smrg	  $run ${rm}r $gentop
43681ab64890Smrg	fi
43691ab64890Smrg
43701ab64890Smrg	# Create an invalid libtool object if no PIC, so that we don't
43711ab64890Smrg	# accidentally link it into a program.
43721ab64890Smrg	# $show "echo timestamp > $libobj"
43731ab64890Smrg	# $run eval "echo timestamp > $libobj" || exit $?
43741ab64890Smrg	exit $EXIT_SUCCESS
43751ab64890Smrg      fi
43761ab64890Smrg
43771ab64890Smrg      if test -n "$pic_flag" || test "$pic_mode" != default; then
43781ab64890Smrg	# Only do commands if we really have different PIC objects.
43791ab64890Smrg	reload_objs="$libobjs $reload_conv_objs"
43801ab64890Smrg	output="$libobj"
43811ab64890Smrg	cmds=$reload_cmds
43821ab64890Smrg	save_ifs="$IFS"; IFS='~'
43831ab64890Smrg	for cmd in $cmds; do
43841ab64890Smrg	  IFS="$save_ifs"
43851ab64890Smrg	  eval cmd=\"$cmd\"
43861ab64890Smrg	  $show "$cmd"
43871ab64890Smrg	  $run eval "$cmd" || exit $?
43881ab64890Smrg	done
43891ab64890Smrg	IFS="$save_ifs"
43901ab64890Smrg      fi
43911ab64890Smrg
43921ab64890Smrg      if test -n "$gentop"; then
43931ab64890Smrg	$show "${rm}r $gentop"
43941ab64890Smrg	$run ${rm}r $gentop
43951ab64890Smrg      fi
43961ab64890Smrg
43971ab64890Smrg      exit $EXIT_SUCCESS
43981ab64890Smrg      ;;
43991ab64890Smrg
44001ab64890Smrg    prog)
44011ab64890Smrg      case $host in
44021ab64890Smrg	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
44031ab64890Smrg      esac
44041ab64890Smrg      if test -n "$vinfo"; then
44051ab64890Smrg	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
44061ab64890Smrg      fi
44071ab64890Smrg
44081ab64890Smrg      if test -n "$release"; then
44091ab64890Smrg	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
44101ab64890Smrg      fi
44111ab64890Smrg
44121ab64890Smrg      if test "$preload" = yes; then
44131ab64890Smrg	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
44141ab64890Smrg	   test "$dlopen_self_static" = unknown; then
44151ab64890Smrg	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
44161ab64890Smrg	fi
44171ab64890Smrg      fi
44181ab64890Smrg
44191ab64890Smrg      case $host in
44201ab64890Smrg      *-*-rhapsody* | *-*-darwin1.[012])
44211ab64890Smrg	# On Rhapsody replace the C library is the System framework
44221ab64890Smrg	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
44231ab64890Smrg	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
44241ab64890Smrg	;;
44251ab64890Smrg      esac
44261ab64890Smrg
44271ab64890Smrg      case $host in
44281ab64890Smrg      *darwin*)
44291ab64890Smrg        # Don't allow lazy linking, it breaks C++ global constructors
44301ab64890Smrg        if test "$tagname" = CXX ; then
44311ab64890Smrg        compile_command="$compile_command ${wl}-bind_at_load"
44321ab64890Smrg        finalize_command="$finalize_command ${wl}-bind_at_load"
44331ab64890Smrg        fi
44341ab64890Smrg        ;;
44351ab64890Smrg      esac
44361ab64890Smrg
44371ab64890Smrg
44381ab64890Smrg      # move library search paths that coincide with paths to not yet
44391ab64890Smrg      # installed libraries to the beginning of the library search list
44401ab64890Smrg      new_libs=
44411ab64890Smrg      for path in $notinst_path; do
44421ab64890Smrg	case " $new_libs " in
44431ab64890Smrg	*" -L$path/$objdir "*) ;;
44441ab64890Smrg	*)
44451ab64890Smrg	  case " $compile_deplibs " in
44461ab64890Smrg	  *" -L$path/$objdir "*)
44471ab64890Smrg	    new_libs="$new_libs -L$path/$objdir" ;;
44481ab64890Smrg	  esac
44491ab64890Smrg	  ;;
44501ab64890Smrg	esac
44511ab64890Smrg      done
44521ab64890Smrg      for deplib in $compile_deplibs; do
44531ab64890Smrg	case $deplib in
44541ab64890Smrg	-L*)
44551ab64890Smrg	  case " $new_libs " in
44561ab64890Smrg	  *" $deplib "*) ;;
44571ab64890Smrg	  *) new_libs="$new_libs $deplib" ;;
44581ab64890Smrg	  esac
44591ab64890Smrg	  ;;
44601ab64890Smrg	*) new_libs="$new_libs $deplib" ;;
44611ab64890Smrg	esac
44621ab64890Smrg      done
44631ab64890Smrg      compile_deplibs="$new_libs"
44641ab64890Smrg
44651ab64890Smrg
44661ab64890Smrg      compile_command="$compile_command $compile_deplibs"
44671ab64890Smrg      finalize_command="$finalize_command $finalize_deplibs"
44681ab64890Smrg
44691ab64890Smrg      if test -n "$rpath$xrpath"; then
44701ab64890Smrg	# If the user specified any rpath flags, then add them.
44711ab64890Smrg	for libdir in $rpath $xrpath; do
44721ab64890Smrg	  # This is the magic to use -rpath.
44731ab64890Smrg	  case "$finalize_rpath " in
44741ab64890Smrg	  *" $libdir "*) ;;
44751ab64890Smrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
44761ab64890Smrg	  esac
44771ab64890Smrg	done
44781ab64890Smrg      fi
44791ab64890Smrg
44801ab64890Smrg      # Now hardcode the library paths
44811ab64890Smrg      rpath=
44821ab64890Smrg      hardcode_libdirs=
44831ab64890Smrg      for libdir in $compile_rpath $finalize_rpath; do
44841ab64890Smrg	if test -n "$hardcode_libdir_flag_spec"; then
44851ab64890Smrg	  if test -n "$hardcode_libdir_separator"; then
44861ab64890Smrg	    if test -z "$hardcode_libdirs"; then
44871ab64890Smrg	      hardcode_libdirs="$libdir"
44881ab64890Smrg	    else
44891ab64890Smrg	      # Just accumulate the unique libdirs.
44901ab64890Smrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
44911ab64890Smrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
44921ab64890Smrg		;;
44931ab64890Smrg	      *)
44941ab64890Smrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
44951ab64890Smrg		;;
44961ab64890Smrg	      esac
44971ab64890Smrg	    fi
44981ab64890Smrg	  else
44991ab64890Smrg	    eval flag=\"$hardcode_libdir_flag_spec\"
45001ab64890Smrg	    rpath="$rpath $flag"
45011ab64890Smrg	  fi
45021ab64890Smrg	elif test -n "$runpath_var"; then
45031ab64890Smrg	  case "$perm_rpath " in
45041ab64890Smrg	  *" $libdir "*) ;;
45051ab64890Smrg	  *) perm_rpath="$perm_rpath $libdir" ;;
45061ab64890Smrg	  esac
45071ab64890Smrg	fi
45081ab64890Smrg	case $host in
45091ab64890Smrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
45101ab64890Smrg	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
45111ab64890Smrg	  case :$dllsearchpath: in
45121ab64890Smrg	  *":$libdir:"*) ;;
45131ab64890Smrg	  *) dllsearchpath="$dllsearchpath:$libdir";;
45141ab64890Smrg	  esac
45151ab64890Smrg	  case :$dllsearchpath: in
45161ab64890Smrg	  *":$testbindir:"*) ;;
45171ab64890Smrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
45181ab64890Smrg	  esac
45191ab64890Smrg	  ;;
45201ab64890Smrg	esac
45211ab64890Smrg      done
45221ab64890Smrg      # Substitute the hardcoded libdirs into the rpath.
45231ab64890Smrg      if test -n "$hardcode_libdir_separator" &&
45241ab64890Smrg	 test -n "$hardcode_libdirs"; then
45251ab64890Smrg	libdir="$hardcode_libdirs"
45261ab64890Smrg	eval rpath=\" $hardcode_libdir_flag_spec\"
45271ab64890Smrg      fi
45281ab64890Smrg      compile_rpath="$rpath"
45291ab64890Smrg
45301ab64890Smrg      rpath=
45311ab64890Smrg      hardcode_libdirs=
45321ab64890Smrg      for libdir in $finalize_rpath; do
45331ab64890Smrg	if test -n "$hardcode_libdir_flag_spec"; then
45341ab64890Smrg	  if test -n "$hardcode_libdir_separator"; then
45351ab64890Smrg	    if test -z "$hardcode_libdirs"; then
45361ab64890Smrg	      hardcode_libdirs="$libdir"
45371ab64890Smrg	    else
45381ab64890Smrg	      # Just accumulate the unique libdirs.
45391ab64890Smrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
45401ab64890Smrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
45411ab64890Smrg		;;
45421ab64890Smrg	      *)
45431ab64890Smrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
45441ab64890Smrg		;;
45451ab64890Smrg	      esac
45461ab64890Smrg	    fi
45471ab64890Smrg	  else
45481ab64890Smrg	    eval flag=\"$hardcode_libdir_flag_spec\"
45491ab64890Smrg	    rpath="$rpath $flag"
45501ab64890Smrg	  fi
45511ab64890Smrg	elif test -n "$runpath_var"; then
45521ab64890Smrg	  case "$finalize_perm_rpath " in
45531ab64890Smrg	  *" $libdir "*) ;;
45541ab64890Smrg	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
45551ab64890Smrg	  esac
45561ab64890Smrg	fi
45571ab64890Smrg      done
45581ab64890Smrg      # Substitute the hardcoded libdirs into the rpath.
45591ab64890Smrg      if test -n "$hardcode_libdir_separator" &&
45601ab64890Smrg	 test -n "$hardcode_libdirs"; then
45611ab64890Smrg	libdir="$hardcode_libdirs"
45621ab64890Smrg	eval rpath=\" $hardcode_libdir_flag_spec\"
45631ab64890Smrg      fi
45641ab64890Smrg      finalize_rpath="$rpath"
45651ab64890Smrg
45661ab64890Smrg      if test -n "$libobjs" && test "$build_old_libs" = yes; then
45671ab64890Smrg	# Transform all the library objects into standard objects.
45681ab64890Smrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
45691ab64890Smrg	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
45701ab64890Smrg      fi
45711ab64890Smrg
45721ab64890Smrg      dlsyms=
45731ab64890Smrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
45741ab64890Smrg	if test -n "$NM" && test -n "$global_symbol_pipe"; then
45751ab64890Smrg	  dlsyms="${outputname}S.c"
45761ab64890Smrg	else
45771ab64890Smrg	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
45781ab64890Smrg	fi
45791ab64890Smrg      fi
45801ab64890Smrg
45811ab64890Smrg      if test -n "$dlsyms"; then
45821ab64890Smrg	case $dlsyms in
45831ab64890Smrg	"") ;;
45841ab64890Smrg	*.c)
45851ab64890Smrg	  # Discover the nlist of each of the dlfiles.
45861ab64890Smrg	  nlist="$output_objdir/${outputname}.nm"
45871ab64890Smrg
45881ab64890Smrg	  $show "$rm $nlist ${nlist}S ${nlist}T"
45891ab64890Smrg	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
45901ab64890Smrg
45911ab64890Smrg	  # Parse the name list into a source file.
45921ab64890Smrg	  $show "creating $output_objdir/$dlsyms"
45931ab64890Smrg
45941ab64890Smrg	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
45951ab64890Smrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
45961ab64890Smrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
45971ab64890Smrg
45981ab64890Smrg#ifdef __cplusplus
45991ab64890Smrgextern \"C\" {
46001ab64890Smrg#endif
46011ab64890Smrg
46021ab64890Smrg/* Prevent the only kind of declaration conflicts we can make. */
46031ab64890Smrg#define lt_preloaded_symbols some_other_symbol
46041ab64890Smrg
46051ab64890Smrg/* External symbol declarations for the compiler. */\
46061ab64890Smrg"
46071ab64890Smrg
46081ab64890Smrg	  if test "$dlself" = yes; then
46091ab64890Smrg	    $show "generating symbol list for \`$output'"
46101ab64890Smrg
46111ab64890Smrg	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
46121ab64890Smrg
46131ab64890Smrg	    # Add our own program objects to the symbol list.
46141ab64890Smrg	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
46151ab64890Smrg	    for arg in $progfiles; do
46161ab64890Smrg	      $show "extracting global C symbols from \`$arg'"
46171ab64890Smrg	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
46181ab64890Smrg	    done
46191ab64890Smrg
46201ab64890Smrg	    if test -n "$exclude_expsyms"; then
46211ab64890Smrg	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
46221ab64890Smrg	      $run eval '$mv "$nlist"T "$nlist"'
46231ab64890Smrg	    fi
46241ab64890Smrg
46251ab64890Smrg	    if test -n "$export_symbols_regex"; then
46261ab64890Smrg	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
46271ab64890Smrg	      $run eval '$mv "$nlist"T "$nlist"'
46281ab64890Smrg	    fi
46291ab64890Smrg
46301ab64890Smrg	    # Prepare the list of exported symbols
46311ab64890Smrg	    if test -z "$export_symbols"; then
46321ab64890Smrg	      export_symbols="$output_objdir/$outputname.exp"
46331ab64890Smrg	      $run $rm $export_symbols
46341ab64890Smrg	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
46351ab64890Smrg              case $host in
46361ab64890Smrg              *cygwin* | *mingw* )
46371ab64890Smrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
46381ab64890Smrg		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
46391ab64890Smrg                ;;
46401ab64890Smrg              esac
46411ab64890Smrg	    else
46421ab64890Smrg	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
46431ab64890Smrg	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
46441ab64890Smrg	      $run eval 'mv "$nlist"T "$nlist"'
46451ab64890Smrg              case $host in
46461ab64890Smrg              *cygwin* | *mingw* )
46471ab64890Smrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
46481ab64890Smrg		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
46491ab64890Smrg                ;;
46501ab64890Smrg              esac
46511ab64890Smrg	    fi
46521ab64890Smrg	  fi
46531ab64890Smrg
46541ab64890Smrg	  for arg in $dlprefiles; do
46551ab64890Smrg	    $show "extracting global C symbols from \`$arg'"
46561ab64890Smrg	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
46571ab64890Smrg	    $run eval '$echo ": $name " >> "$nlist"'
46581ab64890Smrg	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
46591ab64890Smrg	  done
46601ab64890Smrg
46611ab64890Smrg	  if test -z "$run"; then
46621ab64890Smrg	    # Make sure we have at least an empty file.
46631ab64890Smrg	    test -f "$nlist" || : > "$nlist"
46641ab64890Smrg
46651ab64890Smrg	    if test -n "$exclude_expsyms"; then
46661ab64890Smrg	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
46671ab64890Smrg	      $mv "$nlist"T "$nlist"
46681ab64890Smrg	    fi
46691ab64890Smrg
46701ab64890Smrg	    # Try sorting and uniquifying the output.
46711ab64890Smrg	    if grep -v "^: " < "$nlist" |
46721ab64890Smrg		if sort -k 3 </dev/null >/dev/null 2>&1; then
46731ab64890Smrg		  sort -k 3
46741ab64890Smrg		else
46751ab64890Smrg		  sort +2
46761ab64890Smrg		fi |
46771ab64890Smrg		uniq > "$nlist"S; then
46781ab64890Smrg	      :
46791ab64890Smrg	    else
46801ab64890Smrg	      grep -v "^: " < "$nlist" > "$nlist"S
46811ab64890Smrg	    fi
46821ab64890Smrg
46831ab64890Smrg	    if test -f "$nlist"S; then
46841ab64890Smrg	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
46851ab64890Smrg	    else
46861ab64890Smrg	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
46871ab64890Smrg	    fi
46881ab64890Smrg
46891ab64890Smrg	    $echo >> "$output_objdir/$dlsyms" "\
46901ab64890Smrg
46911ab64890Smrg#undef lt_preloaded_symbols
46921ab64890Smrg
46931ab64890Smrg#if defined (__STDC__) && __STDC__
46941ab64890Smrg# define lt_ptr void *
46951ab64890Smrg#else
46961ab64890Smrg# define lt_ptr char *
46971ab64890Smrg# define const
46981ab64890Smrg#endif
46991ab64890Smrg
47001ab64890Smrg/* The mapping between symbol names and symbols. */
47011ab64890Smrg"
47021ab64890Smrg
47031ab64890Smrg	    case $host in
47041ab64890Smrg	    *cygwin* | *mingw* )
47051ab64890Smrg	  $echo >> "$output_objdir/$dlsyms" "\
47061ab64890Smrg/* DATA imports from DLLs on WIN32 can't be const, because
47071ab64890Smrg   runtime relocations are performed -- see ld's documentation
47081ab64890Smrg   on pseudo-relocs */
47091ab64890Smrgstruct {
47101ab64890Smrg"
47111ab64890Smrg	      ;;
47121ab64890Smrg	    * )
47131ab64890Smrg	  $echo >> "$output_objdir/$dlsyms" "\
47141ab64890Smrgconst struct {
47151ab64890Smrg"
47161ab64890Smrg	      ;;
47171ab64890Smrg	    esac
47181ab64890Smrg
47191ab64890Smrg
47201ab64890Smrg	  $echo >> "$output_objdir/$dlsyms" "\
47211ab64890Smrg  const char *name;
47221ab64890Smrg  lt_ptr address;
47231ab64890Smrg}
47241ab64890Smrglt_preloaded_symbols[] =
47251ab64890Smrg{\
47261ab64890Smrg"
47271ab64890Smrg
47281ab64890Smrg	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
47291ab64890Smrg
47301ab64890Smrg	    $echo >> "$output_objdir/$dlsyms" "\
47311ab64890Smrg  {0, (lt_ptr) 0}
47321ab64890Smrg};
47331ab64890Smrg
47341ab64890Smrg/* This works around a problem in FreeBSD linker */
47351ab64890Smrg#ifdef FREEBSD_WORKAROUND
47361ab64890Smrgstatic const void *lt_preloaded_setup() {
47371ab64890Smrg  return lt_preloaded_symbols;
47381ab64890Smrg}
47391ab64890Smrg#endif
47401ab64890Smrg
47411ab64890Smrg#ifdef __cplusplus
47421ab64890Smrg}
47431ab64890Smrg#endif\
47441ab64890Smrg"
47451ab64890Smrg	  fi
47461ab64890Smrg
47471ab64890Smrg	  pic_flag_for_symtable=
47481ab64890Smrg	  case $host in
47491ab64890Smrg	  # compiling the symbol table file with pic_flag works around
47501ab64890Smrg	  # a FreeBSD bug that causes programs to crash when -lm is
47511ab64890Smrg	  # linked before any other PIC object.  But we must not use
47521ab64890Smrg	  # pic_flag when linking with -static.  The problem exists in
47531ab64890Smrg	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
47541ab64890Smrg	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
47551ab64890Smrg	    case "$compile_command " in
47561ab64890Smrg	    *" -static "*) ;;
47571ab64890Smrg	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
47581ab64890Smrg	    esac;;
47591ab64890Smrg	  *-*-hpux*)
47601ab64890Smrg	    case "$compile_command " in
47611ab64890Smrg	    *" -static "*) ;;
47621ab64890Smrg	    *) pic_flag_for_symtable=" $pic_flag";;
47631ab64890Smrg	    esac
47641ab64890Smrg	  esac
47651ab64890Smrg
47661ab64890Smrg	  # Now compile the dynamic symbol file.
47671ab64890Smrg	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
47681ab64890Smrg	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
47691ab64890Smrg
47701ab64890Smrg	  # Clean up the generated files.
47711ab64890Smrg	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
47721ab64890Smrg	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
47731ab64890Smrg
47741ab64890Smrg	  # Transform the symbol file into the correct name.
47751ab64890Smrg          case $host in
47761ab64890Smrg          *cygwin* | *mingw* )
47771ab64890Smrg            if test -f "$output_objdir/${outputname}.def" ; then
47781ab64890Smrg              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
47791ab64890Smrg              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
47801ab64890Smrg            else
47811ab64890Smrg              compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
47821ab64890Smrg              finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
47831ab64890Smrg             fi
47841ab64890Smrg            ;;
47851ab64890Smrg          * )
47861ab64890Smrg            compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
47871ab64890Smrg            finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
47881ab64890Smrg            ;;
47891ab64890Smrg          esac
47901ab64890Smrg	  ;;
47911ab64890Smrg	*)
47921ab64890Smrg	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
47931ab64890Smrg	  exit $EXIT_FAILURE
47941ab64890Smrg	  ;;
47951ab64890Smrg	esac
47961ab64890Smrg      else
47971ab64890Smrg	# We keep going just in case the user didn't refer to
47981ab64890Smrg	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
47991ab64890Smrg	# really was required.
48001ab64890Smrg
48011ab64890Smrg	# Nullify the symbol file.
48021ab64890Smrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
48031ab64890Smrg	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
48041ab64890Smrg      fi
48051ab64890Smrg
48061ab64890Smrg      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
48071ab64890Smrg	# Replace the output file specification.
48081ab64890Smrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
48091ab64890Smrg	link_command="$compile_command$compile_rpath"
48101ab64890Smrg
48111ab64890Smrg	# We have no uninstalled library dependencies, so finalize right now.
48121ab64890Smrg	$show "$link_command"
48131ab64890Smrg	$run eval "$link_command"
48141ab64890Smrg	exit_status=$?
48151ab64890Smrg
48161ab64890Smrg	# Delete the generated files.
48171ab64890Smrg	if test -n "$dlsyms"; then
48181ab64890Smrg	  $show "$rm $output_objdir/${outputname}S.${objext}"
48191ab64890Smrg	  $run $rm "$output_objdir/${outputname}S.${objext}"
48201ab64890Smrg	fi
48211ab64890Smrg
48221ab64890Smrg	exit $exit_status
48231ab64890Smrg      fi
48241ab64890Smrg
48251ab64890Smrg      if test -n "$shlibpath_var"; then
48261ab64890Smrg	# We should set the shlibpath_var
48271ab64890Smrg	rpath=
48281ab64890Smrg	for dir in $temp_rpath; do
48291ab64890Smrg	  case $dir in
48301ab64890Smrg	  [\\/]* | [A-Za-z]:[\\/]*)
48311ab64890Smrg	    # Absolute path.
48321ab64890Smrg	    rpath="$rpath$dir:"
48331ab64890Smrg	    ;;
48341ab64890Smrg	  *)
48351ab64890Smrg	    # Relative path: add a thisdir entry.
48361ab64890Smrg	    rpath="$rpath\$thisdir/$dir:"
48371ab64890Smrg	    ;;
48381ab64890Smrg	  esac
48391ab64890Smrg	done
48401ab64890Smrg	temp_rpath="$rpath"
48411ab64890Smrg      fi
48421ab64890Smrg
48431ab64890Smrg      if test -n "$compile_shlibpath$finalize_shlibpath"; then
48441ab64890Smrg	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
48451ab64890Smrg      fi
48461ab64890Smrg      if test -n "$finalize_shlibpath"; then
48471ab64890Smrg	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
48481ab64890Smrg      fi
48491ab64890Smrg
48501ab64890Smrg      compile_var=
48511ab64890Smrg      finalize_var=
48521ab64890Smrg      if test -n "$runpath_var"; then
48531ab64890Smrg	if test -n "$perm_rpath"; then
48541ab64890Smrg	  # We should set the runpath_var.
48551ab64890Smrg	  rpath=
48561ab64890Smrg	  for dir in $perm_rpath; do
48571ab64890Smrg	    rpath="$rpath$dir:"
48581ab64890Smrg	  done
48591ab64890Smrg	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
48601ab64890Smrg	fi
48611ab64890Smrg	if test -n "$finalize_perm_rpath"; then
48621ab64890Smrg	  # We should set the runpath_var.
48631ab64890Smrg	  rpath=
48641ab64890Smrg	  for dir in $finalize_perm_rpath; do
48651ab64890Smrg	    rpath="$rpath$dir:"
48661ab64890Smrg	  done
48671ab64890Smrg	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
48681ab64890Smrg	fi
48691ab64890Smrg      fi
48701ab64890Smrg
48711ab64890Smrg      if test "$no_install" = yes; then
48721ab64890Smrg	# We don't need to create a wrapper script.
48731ab64890Smrg	link_command="$compile_var$compile_command$compile_rpath"
48741ab64890Smrg	# Replace the output file specification.
48751ab64890Smrg	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
48761ab64890Smrg	# Delete the old output file.
48771ab64890Smrg	$run $rm $output
48781ab64890Smrg	# Link the executable and exit
48791ab64890Smrg	$show "$link_command"
48801ab64890Smrg	$run eval "$link_command" || exit $?
48811ab64890Smrg	exit $EXIT_SUCCESS
48821ab64890Smrg      fi
48831ab64890Smrg
48841ab64890Smrg      if test "$hardcode_action" = relink; then
48851ab64890Smrg	# Fast installation is not supported
48861ab64890Smrg	link_command="$compile_var$compile_command$compile_rpath"
48871ab64890Smrg	relink_command="$finalize_var$finalize_command$finalize_rpath"
48881ab64890Smrg
48891ab64890Smrg	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
48901ab64890Smrg	$echo "$modename: \`$output' will be relinked during installation" 1>&2
48911ab64890Smrg      else
48921ab64890Smrg	if test "$fast_install" != no; then
48931ab64890Smrg	  link_command="$finalize_var$compile_command$finalize_rpath"
48941ab64890Smrg	  if test "$fast_install" = yes; then
48951ab64890Smrg	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
48961ab64890Smrg	  else
48971ab64890Smrg	    # fast_install is set to needless
48981ab64890Smrg	    relink_command=
48991ab64890Smrg	  fi
49001ab64890Smrg	else
49011ab64890Smrg	  link_command="$compile_var$compile_command$compile_rpath"
49021ab64890Smrg	  relink_command="$finalize_var$finalize_command$finalize_rpath"
49031ab64890Smrg	fi
49041ab64890Smrg      fi
49051ab64890Smrg
49061ab64890Smrg      # Replace the output file specification.
49071ab64890Smrg      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
49081ab64890Smrg
49091ab64890Smrg      # Delete the old output files.
49101ab64890Smrg      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
49111ab64890Smrg
49121ab64890Smrg      $show "$link_command"
49131ab64890Smrg      $run eval "$link_command" || exit $?
49141ab64890Smrg
49151ab64890Smrg      # Now create the wrapper script.
49161ab64890Smrg      $show "creating $output"
49171ab64890Smrg
49181ab64890Smrg      # Quote the relink command for shipping.
49191ab64890Smrg      if test -n "$relink_command"; then
49201ab64890Smrg	# Preserve any variables that may affect compiler behavior
49211ab64890Smrg	for var in $variables_saved_for_relink; do
49221ab64890Smrg	  if eval test -z \"\${$var+set}\"; then
49231ab64890Smrg	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
49241ab64890Smrg	  elif eval var_value=\$$var; test -z "$var_value"; then
49251ab64890Smrg	    relink_command="$var=; export $var; $relink_command"
49261ab64890Smrg	  else
49271ab64890Smrg	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
49281ab64890Smrg	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
49291ab64890Smrg	  fi
49301ab64890Smrg	done
49311ab64890Smrg	relink_command="(cd `pwd`; $relink_command)"
49321ab64890Smrg	relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
49331ab64890Smrg      fi
49341ab64890Smrg
49351ab64890Smrg      # Quote $echo for shipping.
49361ab64890Smrg      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
49371ab64890Smrg	case $progpath in
49381ab64890Smrg	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
49391ab64890Smrg	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
49401ab64890Smrg	esac
49411ab64890Smrg	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
49421ab64890Smrg      else
49431ab64890Smrg	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
49441ab64890Smrg      fi
49451ab64890Smrg
49461ab64890Smrg      # Only actually do things if our run command is non-null.
49471ab64890Smrg      if test -z "$run"; then
49481ab64890Smrg	# win32 will think the script is a binary if it has
49491ab64890Smrg	# a .exe suffix, so we strip it off here.
49501ab64890Smrg	case $output in
49511ab64890Smrg	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
49521ab64890Smrg	esac
49531ab64890Smrg	# test for cygwin because mv fails w/o .exe extensions
49541ab64890Smrg	case $host in
49551ab64890Smrg	  *cygwin*)
49561ab64890Smrg	    exeext=.exe
49571ab64890Smrg	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
49581ab64890Smrg	  *) exeext= ;;
49591ab64890Smrg	esac
49601ab64890Smrg	case $host in
49611ab64890Smrg	  *cygwin* | *mingw* )
49621ab64890Smrg            output_name=`basename $output`
49631ab64890Smrg            output_path=`dirname $output`
49641ab64890Smrg            cwrappersource="$output_path/$objdir/lt-$output_name.c"
49651ab64890Smrg            cwrapper="$output_path/$output_name.exe"
49661ab64890Smrg            $rm $cwrappersource $cwrapper
49671ab64890Smrg            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
49681ab64890Smrg
49691ab64890Smrg	    cat > $cwrappersource <<EOF
49701ab64890Smrg
49711ab64890Smrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
49721ab64890Smrg   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
49731ab64890Smrg
49741ab64890Smrg   The $output program cannot be directly executed until all the libtool
49751ab64890Smrg   libraries that it depends on are installed.
49761ab64890Smrg
49771ab64890Smrg   This wrapper executable should never be moved out of the build directory.
49781ab64890Smrg   If it is, it will not operate correctly.
49791ab64890Smrg
49801ab64890Smrg   Currently, it simply execs the wrapper *script* "/bin/sh $output",
49811ab64890Smrg   but could eventually absorb all of the scripts functionality and
49821ab64890Smrg   exec $objdir/$outputname directly.
49831ab64890Smrg*/
49841ab64890SmrgEOF
49851ab64890Smrg	    cat >> $cwrappersource<<"EOF"
49861ab64890Smrg#include <stdio.h>
49871ab64890Smrg#include <stdlib.h>
49881ab64890Smrg#include <unistd.h>
49891ab64890Smrg#include <malloc.h>
49901ab64890Smrg#include <stdarg.h>
49911ab64890Smrg#include <assert.h>
49921ab64890Smrg#include <string.h>
49931ab64890Smrg#include <ctype.h>
49941ab64890Smrg#include <sys/stat.h>
49951ab64890Smrg
49961ab64890Smrg#if defined(PATH_MAX)
49971ab64890Smrg# define LT_PATHMAX PATH_MAX
49981ab64890Smrg#elif defined(MAXPATHLEN)
49991ab64890Smrg# define LT_PATHMAX MAXPATHLEN
50001ab64890Smrg#else
50011ab64890Smrg# define LT_PATHMAX 1024
50021ab64890Smrg#endif
50031ab64890Smrg
50041ab64890Smrg#ifndef DIR_SEPARATOR
50051ab64890Smrg# define DIR_SEPARATOR '/'
50061ab64890Smrg# define PATH_SEPARATOR ':'
50071ab64890Smrg#endif
50081ab64890Smrg
50091ab64890Smrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
50101ab64890Smrg  defined (__OS2__)
50111ab64890Smrg# define HAVE_DOS_BASED_FILE_SYSTEM
50121ab64890Smrg# ifndef DIR_SEPARATOR_2
50131ab64890Smrg#  define DIR_SEPARATOR_2 '\\'
50141ab64890Smrg# endif
50151ab64890Smrg# ifndef PATH_SEPARATOR_2
50161ab64890Smrg#  define PATH_SEPARATOR_2 ';'
50171ab64890Smrg# endif
50181ab64890Smrg#endif
50191ab64890Smrg
50201ab64890Smrg#ifndef DIR_SEPARATOR_2
50211ab64890Smrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
50221ab64890Smrg#else /* DIR_SEPARATOR_2 */
50231ab64890Smrg# define IS_DIR_SEPARATOR(ch) \
50241ab64890Smrg        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
50251ab64890Smrg#endif /* DIR_SEPARATOR_2 */
50261ab64890Smrg
50271ab64890Smrg#ifndef PATH_SEPARATOR_2
50281ab64890Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
50291ab64890Smrg#else /* PATH_SEPARATOR_2 */
50301ab64890Smrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
50311ab64890Smrg#endif /* PATH_SEPARATOR_2 */
50321ab64890Smrg
50331ab64890Smrg#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
50341ab64890Smrg#define XFREE(stale) do { \
50351ab64890Smrg  if (stale) { free ((void *) stale); stale = 0; } \
50361ab64890Smrg} while (0)
50371ab64890Smrg
50381ab64890Smrg/* -DDEBUG is fairly common in CFLAGS.  */
50391ab64890Smrg#undef DEBUG
50401ab64890Smrg#if defined DEBUGWRAPPER
50411ab64890Smrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
50421ab64890Smrg#else
50431ab64890Smrg# define DEBUG(format, ...)
50441ab64890Smrg#endif
50451ab64890Smrg
50461ab64890Smrgconst char *program_name = NULL;
50471ab64890Smrg
50481ab64890Smrgvoid * xmalloc (size_t num);
50491ab64890Smrgchar * xstrdup (const char *string);
50501ab64890Smrgconst char * base_name (const char *name);
50511ab64890Smrgchar * find_executable(const char *wrapper);
50521ab64890Smrgint    check_executable(const char *path);
50531ab64890Smrgchar * strendzap(char *str, const char *pat);
50541ab64890Smrgvoid lt_fatal (const char *message, ...);
50551ab64890Smrg
50561ab64890Smrgint
50571ab64890Smrgmain (int argc, char *argv[])
50581ab64890Smrg{
50591ab64890Smrg  char **newargz;
50601ab64890Smrg  int i;
50611ab64890Smrg
50621ab64890Smrg  program_name = (char *) xstrdup (base_name (argv[0]));
50631ab64890Smrg  DEBUG("(main) argv[0]      : %s\n",argv[0]);
50641ab64890Smrg  DEBUG("(main) program_name : %s\n",program_name);
50651ab64890Smrg  newargz = XMALLOC(char *, argc+2);
50661ab64890SmrgEOF
50671ab64890Smrg
50681ab64890Smrg            cat >> $cwrappersource <<EOF
50691ab64890Smrg  newargz[0] = (char *) xstrdup("$SHELL");
50701ab64890SmrgEOF
50711ab64890Smrg
50721ab64890Smrg            cat >> $cwrappersource <<"EOF"
50731ab64890Smrg  newargz[1] = find_executable(argv[0]);
50741ab64890Smrg  if (newargz[1] == NULL)
50751ab64890Smrg    lt_fatal("Couldn't find %s", argv[0]);
50761ab64890Smrg  DEBUG("(main) found exe at : %s\n",newargz[1]);
50771ab64890Smrg  /* we know the script has the same name, without the .exe */
50781ab64890Smrg  /* so make sure newargz[1] doesn't end in .exe */
50791ab64890Smrg  strendzap(newargz[1],".exe");
50801ab64890Smrg  for (i = 1; i < argc; i++)
50811ab64890Smrg    newargz[i+1] = xstrdup(argv[i]);
50821ab64890Smrg  newargz[argc+1] = NULL;
50831ab64890Smrg
50841ab64890Smrg  for (i=0; i<argc+1; i++)
50851ab64890Smrg  {
50861ab64890Smrg    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
50871ab64890Smrg    ;
50881ab64890Smrg  }
50891ab64890Smrg
50901ab64890SmrgEOF
50911ab64890Smrg
50921ab64890Smrg            case $host_os in
50931ab64890Smrg              mingw*)
50941ab64890Smrg                cat >> $cwrappersource <<EOF
50951ab64890Smrg  execv("$SHELL",(char const **)newargz);
50961ab64890SmrgEOF
50971ab64890Smrg              ;;
50981ab64890Smrg              *)
50991ab64890Smrg                cat >> $cwrappersource <<EOF
51001ab64890Smrg  execv("$SHELL",newargz);
51011ab64890SmrgEOF
51021ab64890Smrg              ;;
51031ab64890Smrg            esac
51041ab64890Smrg
51051ab64890Smrg            cat >> $cwrappersource <<"EOF"
51061ab64890Smrg  return 127;
51071ab64890Smrg}
51081ab64890Smrg
51091ab64890Smrgvoid *
51101ab64890Smrgxmalloc (size_t num)
51111ab64890Smrg{
51121ab64890Smrg  void * p = (void *) malloc (num);
51131ab64890Smrg  if (!p)
51141ab64890Smrg    lt_fatal ("Memory exhausted");
51151ab64890Smrg
51161ab64890Smrg  return p;
51171ab64890Smrg}
51181ab64890Smrg
51191ab64890Smrgchar *
51201ab64890Smrgxstrdup (const char *string)
51211ab64890Smrg{
51221ab64890Smrg  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
51231ab64890Smrg;
51241ab64890Smrg}
51251ab64890Smrg
51261ab64890Smrgconst char *
51271ab64890Smrgbase_name (const char *name)
51281ab64890Smrg{
51291ab64890Smrg  const char *base;
51301ab64890Smrg
51311ab64890Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
51321ab64890Smrg  /* Skip over the disk name in MSDOS pathnames. */
51331ab64890Smrg  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
51341ab64890Smrg    name += 2;
51351ab64890Smrg#endif
51361ab64890Smrg
51371ab64890Smrg  for (base = name; *name; name++)
51381ab64890Smrg    if (IS_DIR_SEPARATOR (*name))
51391ab64890Smrg      base = name + 1;
51401ab64890Smrg  return base;
51411ab64890Smrg}
51421ab64890Smrg
51431ab64890Smrgint
51441ab64890Smrgcheck_executable(const char * path)
51451ab64890Smrg{
51461ab64890Smrg  struct stat st;
51471ab64890Smrg
51481ab64890Smrg  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
51491ab64890Smrg  if ((!path) || (!*path))
51501ab64890Smrg    return 0;
51511ab64890Smrg
51521ab64890Smrg  if ((stat (path, &st) >= 0) &&
51531ab64890Smrg      (
51541ab64890Smrg        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
51551ab64890Smrg#if defined (S_IXOTH)
51561ab64890Smrg       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
51571ab64890Smrg#endif
51581ab64890Smrg#if defined (S_IXGRP)
51591ab64890Smrg       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
51601ab64890Smrg#endif
51611ab64890Smrg       ((st.st_mode & S_IXUSR) == S_IXUSR))
51621ab64890Smrg      )
51631ab64890Smrg    return 1;
51641ab64890Smrg  else
51651ab64890Smrg    return 0;
51661ab64890Smrg}
51671ab64890Smrg
51681ab64890Smrg/* Searches for the full path of the wrapper.  Returns
51691ab64890Smrg   newly allocated full path name if found, NULL otherwise */
51701ab64890Smrgchar *
51711ab64890Smrgfind_executable (const char* wrapper)
51721ab64890Smrg{
51731ab64890Smrg  int has_slash = 0;
51741ab64890Smrg  const char* p;
51751ab64890Smrg  const char* p_next;
51761ab64890Smrg  /* static buffer for getcwd */
51771ab64890Smrg  char tmp[LT_PATHMAX + 1];
51781ab64890Smrg  int tmp_len;
51791ab64890Smrg  char* concat_name;
51801ab64890Smrg
51811ab64890Smrg  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
51821ab64890Smrg
51831ab64890Smrg  if ((wrapper == NULL) || (*wrapper == '\0'))
51841ab64890Smrg    return NULL;
51851ab64890Smrg
51861ab64890Smrg  /* Absolute path? */
51871ab64890Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
51881ab64890Smrg  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
51891ab64890Smrg  {
51901ab64890Smrg    concat_name = xstrdup (wrapper);
51911ab64890Smrg    if (check_executable(concat_name))
51921ab64890Smrg      return concat_name;
51931ab64890Smrg    XFREE(concat_name);
51941ab64890Smrg  }
51951ab64890Smrg  else
51961ab64890Smrg  {
51971ab64890Smrg#endif
51981ab64890Smrg    if (IS_DIR_SEPARATOR (wrapper[0]))
51991ab64890Smrg    {
52001ab64890Smrg      concat_name = xstrdup (wrapper);
52011ab64890Smrg      if (check_executable(concat_name))
52021ab64890Smrg        return concat_name;
52031ab64890Smrg      XFREE(concat_name);
52041ab64890Smrg    }
52051ab64890Smrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
52061ab64890Smrg  }
52071ab64890Smrg#endif
52081ab64890Smrg
52091ab64890Smrg  for (p = wrapper; *p; p++)
52101ab64890Smrg    if (*p == '/')
52111ab64890Smrg    {
52121ab64890Smrg      has_slash = 1;
52131ab64890Smrg      break;
52141ab64890Smrg    }
52151ab64890Smrg  if (!has_slash)
52161ab64890Smrg  {
52171ab64890Smrg    /* no slashes; search PATH */
52181ab64890Smrg    const char* path = getenv ("PATH");
52191ab64890Smrg    if (path != NULL)
52201ab64890Smrg    {
52211ab64890Smrg      for (p = path; *p; p = p_next)
52221ab64890Smrg      {
52231ab64890Smrg        const char* q;
52241ab64890Smrg        size_t p_len;
52251ab64890Smrg        for (q = p; *q; q++)
52261ab64890Smrg          if (IS_PATH_SEPARATOR(*q))
52271ab64890Smrg            break;
52281ab64890Smrg        p_len = q - p;
52291ab64890Smrg        p_next = (*q == '\0' ? q : q + 1);
52301ab64890Smrg        if (p_len == 0)
52311ab64890Smrg        {
52321ab64890Smrg          /* empty path: current directory */
52331ab64890Smrg          if (getcwd (tmp, LT_PATHMAX) == NULL)
52341ab64890Smrg            lt_fatal ("getcwd failed");
52351ab64890Smrg          tmp_len = strlen(tmp);
52361ab64890Smrg          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
52371ab64890Smrg          memcpy (concat_name, tmp, tmp_len);
52381ab64890Smrg          concat_name[tmp_len] = '/';
52391ab64890Smrg          strcpy (concat_name + tmp_len + 1, wrapper);
52401ab64890Smrg        }
52411ab64890Smrg        else
52421ab64890Smrg        {
52431ab64890Smrg          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
52441ab64890Smrg          memcpy (concat_name, p, p_len);
52451ab64890Smrg          concat_name[p_len] = '/';
52461ab64890Smrg          strcpy (concat_name + p_len + 1, wrapper);
52471ab64890Smrg        }
52481ab64890Smrg        if (check_executable(concat_name))
52491ab64890Smrg          return concat_name;
52501ab64890Smrg        XFREE(concat_name);
52511ab64890Smrg      }
52521ab64890Smrg    }
52531ab64890Smrg    /* not found in PATH; assume curdir */
52541ab64890Smrg  }
52551ab64890Smrg  /* Relative path | not found in path: prepend cwd */
52561ab64890Smrg  if (getcwd (tmp, LT_PATHMAX) == NULL)
52571ab64890Smrg    lt_fatal ("getcwd failed");
52581ab64890Smrg  tmp_len = strlen(tmp);
52591ab64890Smrg  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
52601ab64890Smrg  memcpy (concat_name, tmp, tmp_len);
52611ab64890Smrg  concat_name[tmp_len] = '/';
52621ab64890Smrg  strcpy (concat_name + tmp_len + 1, wrapper);
52631ab64890Smrg
52641ab64890Smrg  if (check_executable(concat_name))
52651ab64890Smrg    return concat_name;
52661ab64890Smrg  XFREE(concat_name);
52671ab64890Smrg  return NULL;
52681ab64890Smrg}
52691ab64890Smrg
52701ab64890Smrgchar *
52711ab64890Smrgstrendzap(char *str, const char *pat)
52721ab64890Smrg{
52731ab64890Smrg  size_t len, patlen;
52741ab64890Smrg
52751ab64890Smrg  assert(str != NULL);
52761ab64890Smrg  assert(pat != NULL);
52771ab64890Smrg
52781ab64890Smrg  len = strlen(str);
52791ab64890Smrg  patlen = strlen(pat);
52801ab64890Smrg
52811ab64890Smrg  if (patlen <= len)
52821ab64890Smrg  {
52831ab64890Smrg    str += len - patlen;
52841ab64890Smrg    if (strcmp(str, pat) == 0)
52851ab64890Smrg      *str = '\0';
52861ab64890Smrg  }
52871ab64890Smrg  return str;
52881ab64890Smrg}
52891ab64890Smrg
52901ab64890Smrgstatic void
52911ab64890Smrglt_error_core (int exit_status, const char * mode,
52921ab64890Smrg          const char * message, va_list ap)
52931ab64890Smrg{
52941ab64890Smrg  fprintf (stderr, "%s: %s: ", program_name, mode);
52951ab64890Smrg  vfprintf (stderr, message, ap);
52961ab64890Smrg  fprintf (stderr, ".\n");
52971ab64890Smrg
52981ab64890Smrg  if (exit_status >= 0)
52991ab64890Smrg    exit (exit_status);
53001ab64890Smrg}
53011ab64890Smrg
53021ab64890Smrgvoid
53031ab64890Smrglt_fatal (const char *message, ...)
53041ab64890Smrg{
53051ab64890Smrg  va_list ap;
53061ab64890Smrg  va_start (ap, message);
53071ab64890Smrg  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
53081ab64890Smrg  va_end (ap);
53091ab64890Smrg}
53101ab64890SmrgEOF
53111ab64890Smrg          # we should really use a build-platform specific compiler
53121ab64890Smrg          # here, but OTOH, the wrappers (shell script and this C one)
53131ab64890Smrg          # are only useful if you want to execute the "real" binary.
53141ab64890Smrg          # Since the "real" binary is built for $host, then this
53151ab64890Smrg          # wrapper might as well be built for $host, too.
53161ab64890Smrg          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
53171ab64890Smrg          ;;
53181ab64890Smrg        esac
53191ab64890Smrg        $rm $output
53201ab64890Smrg        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
53211ab64890Smrg
53221ab64890Smrg	$echo > $output "\
53231ab64890Smrg#! $SHELL
53241ab64890Smrg
53251ab64890Smrg# $output - temporary wrapper script for $objdir/$outputname
53261ab64890Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
53271ab64890Smrg#
53281ab64890Smrg# The $output program cannot be directly executed until all the libtool
53291ab64890Smrg# libraries that it depends on are installed.
53301ab64890Smrg#
53311ab64890Smrg# This wrapper script should never be moved out of the build directory.
53321ab64890Smrg# If it is, it will not operate correctly.
53331ab64890Smrg
53341ab64890Smrg# Sed substitution that helps us do robust quoting.  It backslashifies
53351ab64890Smrg# metacharacters that are still active within double-quoted strings.
53361ab64890SmrgXsed='${SED} -e 1s/^X//'
53371ab64890Smrgsed_quote_subst='$sed_quote_subst'
53381ab64890Smrg
53391ab64890Smrg# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
53401ab64890Smrgif test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
53411ab64890Smrg  emulate sh
53421ab64890Smrg  NULLCMD=:
53431ab64890Smrg  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
53441ab64890Smrg  # is contrary to our usage.  Disable this feature.
53451ab64890Smrg  alias -g '\${1+\"\$@\"}'='\"\$@\"'
53461ab64890Smrg  setopt NO_GLOB_SUBST
53471ab64890Smrgelse
53481ab64890Smrg  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
53491ab64890Smrgfi
53501ab64890SmrgBIN_SH=xpg4; export BIN_SH # for Tru64
53511ab64890SmrgDUALCASE=1; export DUALCASE # for MKS sh
53521ab64890Smrg
53531ab64890Smrg# The HP-UX ksh and POSIX shell print the target directory to stdout
53541ab64890Smrg# if CDPATH is set.
53551ab64890Smrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
53561ab64890Smrg
53571ab64890Smrgrelink_command=\"$relink_command\"
53581ab64890Smrg
53591ab64890Smrg# This environment variable determines our operation mode.
53601ab64890Smrgif test \"\$libtool_install_magic\" = \"$magic\"; then
53611ab64890Smrg  # install mode needs the following variable:
53621ab64890Smrg  notinst_deplibs='$notinst_deplibs'
53631ab64890Smrgelse
53641ab64890Smrg  # When we are sourced in execute mode, \$file and \$echo are already set.
53651ab64890Smrg  if test \"\$libtool_execute_magic\" != \"$magic\"; then
53661ab64890Smrg    echo=\"$qecho\"
53671ab64890Smrg    file=\"\$0\"
53681ab64890Smrg    # Make sure echo works.
53691ab64890Smrg    if test \"X\$1\" = X--no-reexec; then
53701ab64890Smrg      # Discard the --no-reexec flag, and continue.
53711ab64890Smrg      shift
53721ab64890Smrg    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
53731ab64890Smrg      # Yippee, \$echo works!
53741ab64890Smrg      :
53751ab64890Smrg    else
53761ab64890Smrg      # Restart under the correct shell, and then maybe \$echo will work.
53771ab64890Smrg      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
53781ab64890Smrg    fi
53791ab64890Smrg  fi\
53801ab64890Smrg"
53811ab64890Smrg	$echo >> $output "\
53821ab64890Smrg
53831ab64890Smrg  # Find the directory that this script lives in.
53841ab64890Smrg  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
53851ab64890Smrg  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
53861ab64890Smrg
53871ab64890Smrg  # Follow symbolic links until we get to the real thisdir.
53881ab64890Smrg  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
53891ab64890Smrg  while test -n \"\$file\"; do
53901ab64890Smrg    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
53911ab64890Smrg
53921ab64890Smrg    # If there was a directory component, then change thisdir.
53931ab64890Smrg    if test \"x\$destdir\" != \"x\$file\"; then
53941ab64890Smrg      case \"\$destdir\" in
53951ab64890Smrg      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
53961ab64890Smrg      *) thisdir=\"\$thisdir/\$destdir\" ;;
53971ab64890Smrg      esac
53981ab64890Smrg    fi
53991ab64890Smrg
54001ab64890Smrg    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
54011ab64890Smrg    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
54021ab64890Smrg  done
54031ab64890Smrg
54041ab64890Smrg  # Try to get the absolute directory name.
54051ab64890Smrg  absdir=\`cd \"\$thisdir\" && pwd\`
54061ab64890Smrg  test -n \"\$absdir\" && thisdir=\"\$absdir\"
54071ab64890Smrg"
54081ab64890Smrg
54091ab64890Smrg	if test "$fast_install" = yes; then
54101ab64890Smrg	  $echo >> $output "\
54111ab64890Smrg  program=lt-'$outputname'$exeext
54121ab64890Smrg  progdir=\"\$thisdir/$objdir\"
54131ab64890Smrg
54141ab64890Smrg  if test ! -f \"\$progdir/\$program\" || \\
54151ab64890Smrg     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
54161ab64890Smrg       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
54171ab64890Smrg
54181ab64890Smrg    file=\"\$\$-\$program\"
54191ab64890Smrg
54201ab64890Smrg    if test ! -d \"\$progdir\"; then
54211ab64890Smrg      $mkdir \"\$progdir\"
54221ab64890Smrg    else
54231ab64890Smrg      $rm \"\$progdir/\$file\"
54241ab64890Smrg    fi"
54251ab64890Smrg
54261ab64890Smrg	  $echo >> $output "\
54271ab64890Smrg
54281ab64890Smrg    # relink executable if necessary
54291ab64890Smrg    if test -n \"\$relink_command\"; then
54301ab64890Smrg      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
54311ab64890Smrg      else
54321ab64890Smrg	$echo \"\$relink_command_output\" >&2
54331ab64890Smrg	$rm \"\$progdir/\$file\"
54341ab64890Smrg	exit $EXIT_FAILURE
54351ab64890Smrg      fi
54361ab64890Smrg    fi
54371ab64890Smrg
54381ab64890Smrg    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
54391ab64890Smrg    { $rm \"\$progdir/\$program\";
54401ab64890Smrg      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
54411ab64890Smrg    $rm \"\$progdir/\$file\"
54421ab64890Smrg  fi"
54431ab64890Smrg	else
54441ab64890Smrg	  $echo >> $output "\
54451ab64890Smrg  program='$outputname'
54461ab64890Smrg  progdir=\"\$thisdir/$objdir\"
54471ab64890Smrg"
54481ab64890Smrg	fi
54491ab64890Smrg
54501ab64890Smrg	$echo >> $output "\
54511ab64890Smrg
54521ab64890Smrg  if test -f \"\$progdir/\$program\"; then"
54531ab64890Smrg
54541ab64890Smrg	# Export our shlibpath_var if we have one.
54551ab64890Smrg	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
54561ab64890Smrg	  $echo >> $output "\
54571ab64890Smrg    # Add our own library path to $shlibpath_var
54581ab64890Smrg    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
54591ab64890Smrg
54601ab64890Smrg    # Some systems cannot cope with colon-terminated $shlibpath_var
54611ab64890Smrg    # The second colon is a workaround for a bug in BeOS R4 sed
54621ab64890Smrg    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
54631ab64890Smrg
54641ab64890Smrg    export $shlibpath_var
54651ab64890Smrg"
54661ab64890Smrg	fi
54671ab64890Smrg
54681ab64890Smrg	# fixup the dll searchpath if we need to.
54691ab64890Smrg	if test -n "$dllsearchpath"; then
54701ab64890Smrg	  $echo >> $output "\
54711ab64890Smrg    # Add the dll search path components to the executable PATH
54721ab64890Smrg    PATH=$dllsearchpath:\$PATH
54731ab64890Smrg"
54741ab64890Smrg	fi
54751ab64890Smrg
54761ab64890Smrg	$echo >> $output "\
54771ab64890Smrg    if test \"\$libtool_execute_magic\" != \"$magic\"; then
54781ab64890Smrg      # Run the actual program with our arguments.
54791ab64890Smrg"
54801ab64890Smrg	case $host in
54811ab64890Smrg	# Backslashes separate directories on plain windows
54821ab64890Smrg	*-*-mingw | *-*-os2*)
54831ab64890Smrg	  $echo >> $output "\
54841ab64890Smrg      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
54851ab64890Smrg"
54861ab64890Smrg	  ;;
54871ab64890Smrg
54881ab64890Smrg	*)
54891ab64890Smrg	  $echo >> $output "\
54901ab64890Smrg      exec \"\$progdir/\$program\" \${1+\"\$@\"}
54911ab64890Smrg"
54921ab64890Smrg	  ;;
54931ab64890Smrg	esac
54941ab64890Smrg	$echo >> $output "\
54951ab64890Smrg      \$echo \"\$0: cannot exec \$program \$*\"
54961ab64890Smrg      exit $EXIT_FAILURE
54971ab64890Smrg    fi
54981ab64890Smrg  else
54991ab64890Smrg    # The program doesn't exist.
55001ab64890Smrg    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
55011ab64890Smrg    \$echo \"This script is just a wrapper for \$program.\" 1>&2
55021ab64890Smrg    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
55031ab64890Smrg    exit $EXIT_FAILURE
55041ab64890Smrg  fi
55051ab64890Smrgfi\
55061ab64890Smrg"
55071ab64890Smrg	chmod +x $output
55081ab64890Smrg      fi
55091ab64890Smrg      exit $EXIT_SUCCESS
55101ab64890Smrg      ;;
55111ab64890Smrg    esac
55121ab64890Smrg
55131ab64890Smrg    # See if we need to build an old-fashioned archive.
55141ab64890Smrg    for oldlib in $oldlibs; do
55151ab64890Smrg
55161ab64890Smrg      if test "$build_libtool_libs" = convenience; then
55171ab64890Smrg	oldobjs="$libobjs_save"
55181ab64890Smrg	addlibs="$convenience"
55191ab64890Smrg	build_libtool_libs=no
55201ab64890Smrg      else
55211ab64890Smrg	if test "$build_libtool_libs" = module; then
55221ab64890Smrg	  oldobjs="$libobjs_save"
55231ab64890Smrg	  build_libtool_libs=no
55241ab64890Smrg	else
55251ab64890Smrg	  oldobjs="$old_deplibs $non_pic_objects"
55261ab64890Smrg	fi
55271ab64890Smrg	addlibs="$old_convenience"
55281ab64890Smrg      fi
55291ab64890Smrg
55301ab64890Smrg      if test -n "$addlibs"; then
55311ab64890Smrg	gentop="$output_objdir/${outputname}x"
55321ab64890Smrg	generated="$generated $gentop"
55331ab64890Smrg
55341ab64890Smrg	func_extract_archives $gentop $addlibs
55351ab64890Smrg	oldobjs="$oldobjs $func_extract_archives_result"
55361ab64890Smrg      fi
55371ab64890Smrg
55381ab64890Smrg      # Do each command in the archive commands.
55391ab64890Smrg      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
55401ab64890Smrg       cmds=$old_archive_from_new_cmds
55411ab64890Smrg      else
55421ab64890Smrg	# POSIX demands no paths to be encoded in archives.  We have
55431ab64890Smrg	# to avoid creating archives with duplicate basenames if we
55441ab64890Smrg	# might have to extract them afterwards, e.g., when creating a
55451ab64890Smrg	# static archive out of a convenience library, or when linking
55461ab64890Smrg	# the entirety of a libtool archive into another (currently
55471ab64890Smrg	# not supported by libtool).
55481ab64890Smrg	if (for obj in $oldobjs
55491ab64890Smrg	    do
55501ab64890Smrg	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
55511ab64890Smrg	    done | sort | sort -uc >/dev/null 2>&1); then
55521ab64890Smrg	  :
55531ab64890Smrg	else
55541ab64890Smrg	  $echo "copying selected object files to avoid basename conflicts..."
55551ab64890Smrg
55561ab64890Smrg	  if test -z "$gentop"; then
55571ab64890Smrg	    gentop="$output_objdir/${outputname}x"
55581ab64890Smrg	    generated="$generated $gentop"
55591ab64890Smrg
55601ab64890Smrg	    $show "${rm}r $gentop"
55611ab64890Smrg	    $run ${rm}r "$gentop"
55621ab64890Smrg	    $show "$mkdir $gentop"
55631ab64890Smrg	    $run $mkdir "$gentop"
55641ab64890Smrg	    exit_status=$?
55651ab64890Smrg	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
55661ab64890Smrg	      exit $exit_status
55671ab64890Smrg	    fi
55681ab64890Smrg	  fi
55691ab64890Smrg
55701ab64890Smrg	  save_oldobjs=$oldobjs
55711ab64890Smrg	  oldobjs=
55721ab64890Smrg	  counter=1
55731ab64890Smrg	  for obj in $save_oldobjs
55741ab64890Smrg	  do
55751ab64890Smrg	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
55761ab64890Smrg	    case " $oldobjs " in
55771ab64890Smrg	    " ") oldobjs=$obj ;;
55781ab64890Smrg	    *[\ /]"$objbase "*)
55791ab64890Smrg	      while :; do
55801ab64890Smrg		# Make sure we don't pick an alternate name that also
55811ab64890Smrg		# overlaps.
55821ab64890Smrg		newobj=lt$counter-$objbase
55831ab64890Smrg		counter=`expr $counter + 1`
55841ab64890Smrg		case " $oldobjs " in
55851ab64890Smrg		*[\ /]"$newobj "*) ;;
55861ab64890Smrg		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
55871ab64890Smrg		esac
55881ab64890Smrg	      done
55891ab64890Smrg	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
55901ab64890Smrg	      $run ln "$obj" "$gentop/$newobj" ||
55911ab64890Smrg	      $run cp "$obj" "$gentop/$newobj"
55921ab64890Smrg	      oldobjs="$oldobjs $gentop/$newobj"
55931ab64890Smrg	      ;;
55941ab64890Smrg	    *) oldobjs="$oldobjs $obj" ;;
55951ab64890Smrg	    esac
55961ab64890Smrg	  done
55971ab64890Smrg	fi
55981ab64890Smrg
55991ab64890Smrg	eval cmds=\"$old_archive_cmds\"
56001ab64890Smrg
56011ab64890Smrg	if len=`expr "X$cmds" : ".*"` &&
56021ab64890Smrg	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
56031ab64890Smrg	  cmds=$old_archive_cmds
56041ab64890Smrg	else
56051ab64890Smrg	  # the command line is too long to link in one step, link in parts
56061ab64890Smrg	  $echo "using piecewise archive linking..."
56071ab64890Smrg	  save_RANLIB=$RANLIB
56081ab64890Smrg	  RANLIB=:
56091ab64890Smrg	  objlist=
56101ab64890Smrg	  concat_cmds=
56111ab64890Smrg	  save_oldobjs=$oldobjs
56121ab64890Smrg
56131ab64890Smrg	  # Is there a better way of finding the last object in the list?
56141ab64890Smrg	  for obj in $save_oldobjs
56151ab64890Smrg	  do
56161ab64890Smrg	    last_oldobj=$obj
56171ab64890Smrg	  done
56181ab64890Smrg	  for obj in $save_oldobjs
56191ab64890Smrg	  do
56201ab64890Smrg	    oldobjs="$objlist $obj"
56211ab64890Smrg	    objlist="$objlist $obj"
56221ab64890Smrg	    eval test_cmds=\"$old_archive_cmds\"
56231ab64890Smrg	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
56241ab64890Smrg	       test "$len" -le "$max_cmd_len"; then
56251ab64890Smrg	      :
56261ab64890Smrg	    else
56271ab64890Smrg	      # the above command should be used before it gets too long
56281ab64890Smrg	      oldobjs=$objlist
56291ab64890Smrg	      if test "$obj" = "$last_oldobj" ; then
56301ab64890Smrg	        RANLIB=$save_RANLIB
56311ab64890Smrg	      fi
56321ab64890Smrg	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
56331ab64890Smrg	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
56341ab64890Smrg	      objlist=
56351ab64890Smrg	    fi
56361ab64890Smrg	  done
56371ab64890Smrg	  RANLIB=$save_RANLIB
56381ab64890Smrg	  oldobjs=$objlist
56391ab64890Smrg	  if test "X$oldobjs" = "X" ; then
56401ab64890Smrg	    eval cmds=\"\$concat_cmds\"
56411ab64890Smrg	  else
56421ab64890Smrg	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
56431ab64890Smrg	  fi
56441ab64890Smrg	fi
56451ab64890Smrg      fi
56461ab64890Smrg      save_ifs="$IFS"; IFS='~'
56471ab64890Smrg      for cmd in $cmds; do
56481ab64890Smrg        eval cmd=\"$cmd\"
56491ab64890Smrg	IFS="$save_ifs"
56501ab64890Smrg	$show "$cmd"
56511ab64890Smrg	$run eval "$cmd" || exit $?
56521ab64890Smrg      done
56531ab64890Smrg      IFS="$save_ifs"
56541ab64890Smrg    done
56551ab64890Smrg
56561ab64890Smrg    if test -n "$generated"; then
56571ab64890Smrg      $show "${rm}r$generated"
56581ab64890Smrg      $run ${rm}r$generated
56591ab64890Smrg    fi
56601ab64890Smrg
56611ab64890Smrg    # Now create the libtool archive.
56621ab64890Smrg    case $output in
56631ab64890Smrg    *.la)
56641ab64890Smrg      old_library=
56651ab64890Smrg      test "$build_old_libs" = yes && old_library="$libname.$libext"
56661ab64890Smrg      $show "creating $output"
56671ab64890Smrg
56681ab64890Smrg      # Preserve any variables that may affect compiler behavior
56691ab64890Smrg      for var in $variables_saved_for_relink; do
56701ab64890Smrg	if eval test -z \"\${$var+set}\"; then
56711ab64890Smrg	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
56721ab64890Smrg	elif eval var_value=\$$var; test -z "$var_value"; then
56731ab64890Smrg	  relink_command="$var=; export $var; $relink_command"
56741ab64890Smrg	else
56751ab64890Smrg	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
56761ab64890Smrg	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
56771ab64890Smrg	fi
56781ab64890Smrg      done
56791ab64890Smrg      # Quote the link command for shipping.
56801ab64890Smrg      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
56811ab64890Smrg      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
56821ab64890Smrg      if test "$hardcode_automatic" = yes ; then
56831ab64890Smrg	relink_command=
56841ab64890Smrg      fi
56851ab64890Smrg
56861ab64890Smrg
56871ab64890Smrg      # Only create the output if not a dry run.
56881ab64890Smrg      if test -z "$run"; then
56891ab64890Smrg	for installed in no yes; do
56901ab64890Smrg	  if test "$installed" = yes; then
56911ab64890Smrg	    if test -z "$install_libdir"; then
56921ab64890Smrg	      break
56931ab64890Smrg	    fi
56941ab64890Smrg	    output="$output_objdir/$outputname"i
56951ab64890Smrg	    # Replace all uninstalled libtool libraries with the installed ones
56961ab64890Smrg	    newdependency_libs=
56971ab64890Smrg	    for deplib in $dependency_libs; do
56981ab64890Smrg	      case $deplib in
56991ab64890Smrg	      *.la)
57001ab64890Smrg		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
57011ab64890Smrg		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
57021ab64890Smrg		if test -z "$libdir"; then
57031ab64890Smrg		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
57041ab64890Smrg		  exit $EXIT_FAILURE
57051ab64890Smrg		fi
57061ab64890Smrg		newdependency_libs="$newdependency_libs $libdir/$name"
57071ab64890Smrg		;;
57081ab64890Smrg	      *) newdependency_libs="$newdependency_libs $deplib" ;;
57091ab64890Smrg	      esac
57101ab64890Smrg	    done
57111ab64890Smrg	    dependency_libs="$newdependency_libs"
57121ab64890Smrg	    newdlfiles=
57131ab64890Smrg	    for lib in $dlfiles; do
57141ab64890Smrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
57151ab64890Smrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
57161ab64890Smrg	      if test -z "$libdir"; then
57171ab64890Smrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
57181ab64890Smrg		exit $EXIT_FAILURE
57191ab64890Smrg	      fi
57201ab64890Smrg	      newdlfiles="$newdlfiles $libdir/$name"
57211ab64890Smrg	    done
57221ab64890Smrg	    dlfiles="$newdlfiles"
57231ab64890Smrg	    newdlprefiles=
57241ab64890Smrg	    for lib in $dlprefiles; do
57251ab64890Smrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
57261ab64890Smrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
57271ab64890Smrg	      if test -z "$libdir"; then
57281ab64890Smrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
57291ab64890Smrg		exit $EXIT_FAILURE
57301ab64890Smrg	      fi
57311ab64890Smrg	      newdlprefiles="$newdlprefiles $libdir/$name"
57321ab64890Smrg	    done
57331ab64890Smrg	    dlprefiles="$newdlprefiles"
57341ab64890Smrg	  else
57351ab64890Smrg	    newdlfiles=
57361ab64890Smrg	    for lib in $dlfiles; do
57371ab64890Smrg	      case $lib in
57381ab64890Smrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
57391ab64890Smrg		*) abs=`pwd`"/$lib" ;;
57401ab64890Smrg	      esac
57411ab64890Smrg	      newdlfiles="$newdlfiles $abs"
57421ab64890Smrg	    done
57431ab64890Smrg	    dlfiles="$newdlfiles"
57441ab64890Smrg	    newdlprefiles=
57451ab64890Smrg	    for lib in $dlprefiles; do
57461ab64890Smrg	      case $lib in
57471ab64890Smrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
57481ab64890Smrg		*) abs=`pwd`"/$lib" ;;
57491ab64890Smrg	      esac
57501ab64890Smrg	      newdlprefiles="$newdlprefiles $abs"
57511ab64890Smrg	    done
57521ab64890Smrg	    dlprefiles="$newdlprefiles"
57531ab64890Smrg	  fi
57541ab64890Smrg	  $rm $output
57551ab64890Smrg	  # place dlname in correct position for cygwin
57561ab64890Smrg	  tdlname=$dlname
57571ab64890Smrg	  case $host,$output,$installed,$module,$dlname in
57581ab64890Smrg	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
57591ab64890Smrg	  esac
57601ab64890Smrg	  $echo > $output "\
57611ab64890Smrg# $outputname - a libtool library file
57621ab64890Smrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
57631ab64890Smrg#
57641ab64890Smrg# Please DO NOT delete this file!
57651ab64890Smrg# It is necessary for linking the library.
57661ab64890Smrg
57671ab64890Smrg# The name that we can dlopen(3).
57681ab64890Smrgdlname='$tdlname'
57691ab64890Smrg
57701ab64890Smrg# Names of this library.
57711ab64890Smrglibrary_names='$library_names'
57721ab64890Smrg
57731ab64890Smrg# The name of the static archive.
57741ab64890Smrgold_library='$old_library'
57751ab64890Smrg
57761ab64890Smrg# Libraries that this one depends upon.
57771ab64890Smrgdependency_libs='$dependency_libs'
57781ab64890Smrg
57791ab64890Smrg# Version information for $libname.
57801ab64890Smrgcurrent=$current
57811ab64890Smrgage=$age
57821ab64890Smrgrevision=$revision
57831ab64890Smrg
57841ab64890Smrg# Is this an already installed library?
57851ab64890Smrginstalled=$installed
57861ab64890Smrg
57871ab64890Smrg# Should we warn about portability when linking against -modules?
57881ab64890Smrgshouldnotlink=$module
57891ab64890Smrg
57901ab64890Smrg# Files to dlopen/dlpreopen
57911ab64890Smrgdlopen='$dlfiles'
57921ab64890Smrgdlpreopen='$dlprefiles'
57931ab64890Smrg
57941ab64890Smrg# Directory that this library needs to be installed in:
57951ab64890Smrglibdir='$install_libdir'"
57961ab64890Smrg	  if test "$installed" = no && test "$need_relink" = yes; then
57971ab64890Smrg	    $echo >> $output "\
57981ab64890Smrgrelink_command=\"$relink_command\""
57991ab64890Smrg	  fi
58001ab64890Smrg	done
58011ab64890Smrg      fi
58021ab64890Smrg
58031ab64890Smrg      # Do a symbolic link so that the libtool archive can be found in
58041ab64890Smrg      # LD_LIBRARY_PATH before the program is installed.
58051ab64890Smrg      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
58061ab64890Smrg      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
58071ab64890Smrg      ;;
58081ab64890Smrg    esac
58091ab64890Smrg    exit $EXIT_SUCCESS
58101ab64890Smrg    ;;
58111ab64890Smrg
58121ab64890Smrg  # libtool install mode
58131ab64890Smrg  install)
58141ab64890Smrg    modename="$modename: install"
58151ab64890Smrg
58161ab64890Smrg    # There may be an optional sh(1) argument at the beginning of
58171ab64890Smrg    # install_prog (especially on Windows NT).
58181ab64890Smrg    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
58191ab64890Smrg       # Allow the use of GNU shtool's install command.
58201ab64890Smrg       $echo "X$nonopt" | grep shtool > /dev/null; then
58211ab64890Smrg      # Aesthetically quote it.
58221ab64890Smrg      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
58231ab64890Smrg      case $arg in
58241ab64890Smrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
58251ab64890Smrg	arg="\"$arg\""
58261ab64890Smrg	;;
58271ab64890Smrg      esac
58281ab64890Smrg      install_prog="$arg "
58291ab64890Smrg      arg="$1"
58301ab64890Smrg      shift
58311ab64890Smrg    else
58321ab64890Smrg      install_prog=
58331ab64890Smrg      arg=$nonopt
58341ab64890Smrg    fi
58351ab64890Smrg
58361ab64890Smrg    # The real first argument should be the name of the installation program.
58371ab64890Smrg    # Aesthetically quote it.
58381ab64890Smrg    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
58391ab64890Smrg    case $arg in
58401ab64890Smrg    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
58411ab64890Smrg      arg="\"$arg\""
58421ab64890Smrg      ;;
58431ab64890Smrg    esac
58441ab64890Smrg    install_prog="$install_prog$arg"
58451ab64890Smrg
58461ab64890Smrg    # We need to accept at least all the BSD install flags.
58471ab64890Smrg    dest=
58481ab64890Smrg    files=
58491ab64890Smrg    opts=
58501ab64890Smrg    prev=
58511ab64890Smrg    install_type=
58521ab64890Smrg    isdir=no
58531ab64890Smrg    stripme=
58541ab64890Smrg    for arg
58551ab64890Smrg    do
58561ab64890Smrg      if test -n "$dest"; then
58571ab64890Smrg	files="$files $dest"
58581ab64890Smrg	dest=$arg
58591ab64890Smrg	continue
58601ab64890Smrg      fi
58611ab64890Smrg
58621ab64890Smrg      case $arg in
58631ab64890Smrg      -d) isdir=yes ;;
58641ab64890Smrg      -f) 
58651ab64890Smrg      	case " $install_prog " in
58661ab64890Smrg	*[\\\ /]cp\ *) ;;
58671ab64890Smrg	*) prev=$arg ;;
58681ab64890Smrg	esac
58691ab64890Smrg	;;
58701ab64890Smrg      -g | -m | -o) prev=$arg ;;
58711ab64890Smrg      -s)
58721ab64890Smrg	stripme=" -s"
58731ab64890Smrg	continue
58741ab64890Smrg	;;
58751ab64890Smrg      -*)
58761ab64890Smrg	;;
58771ab64890Smrg      *)
58781ab64890Smrg	# If the previous option needed an argument, then skip it.
58791ab64890Smrg	if test -n "$prev"; then
58801ab64890Smrg	  prev=
58811ab64890Smrg	else
58821ab64890Smrg	  dest=$arg
58831ab64890Smrg	  continue
58841ab64890Smrg	fi
58851ab64890Smrg	;;
58861ab64890Smrg      esac
58871ab64890Smrg
58881ab64890Smrg      # Aesthetically quote the argument.
58891ab64890Smrg      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
58901ab64890Smrg      case $arg in
58911ab64890Smrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
58921ab64890Smrg	arg="\"$arg\""
58931ab64890Smrg	;;
58941ab64890Smrg      esac
58951ab64890Smrg      install_prog="$install_prog $arg"
58961ab64890Smrg    done
58971ab64890Smrg
58981ab64890Smrg    if test -z "$install_prog"; then
58991ab64890Smrg      $echo "$modename: you must specify an install program" 1>&2
59001ab64890Smrg      $echo "$help" 1>&2
59011ab64890Smrg      exit $EXIT_FAILURE
59021ab64890Smrg    fi
59031ab64890Smrg
59041ab64890Smrg    if test -n "$prev"; then
59051ab64890Smrg      $echo "$modename: the \`$prev' option requires an argument" 1>&2
59061ab64890Smrg      $echo "$help" 1>&2
59071ab64890Smrg      exit $EXIT_FAILURE
59081ab64890Smrg    fi
59091ab64890Smrg
59101ab64890Smrg    if test -z "$files"; then
59111ab64890Smrg      if test -z "$dest"; then
59121ab64890Smrg	$echo "$modename: no file or destination specified" 1>&2
59131ab64890Smrg      else
59141ab64890Smrg	$echo "$modename: you must specify a destination" 1>&2
59151ab64890Smrg      fi
59161ab64890Smrg      $echo "$help" 1>&2
59171ab64890Smrg      exit $EXIT_FAILURE
59181ab64890Smrg    fi
59191ab64890Smrg
59201ab64890Smrg    # Strip any trailing slash from the destination.
59211ab64890Smrg    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
59221ab64890Smrg
59231ab64890Smrg    # Check to see that the destination is a directory.
59241ab64890Smrg    test -d "$dest" && isdir=yes
59251ab64890Smrg    if test "$isdir" = yes; then
59261ab64890Smrg      destdir="$dest"
59271ab64890Smrg      destname=
59281ab64890Smrg    else
59291ab64890Smrg      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
59301ab64890Smrg      test "X$destdir" = "X$dest" && destdir=.
59311ab64890Smrg      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
59321ab64890Smrg
59331ab64890Smrg      # Not a directory, so check to see that there is only one file specified.
59341ab64890Smrg      set dummy $files
59351ab64890Smrg      if test "$#" -gt 2; then
59361ab64890Smrg	$echo "$modename: \`$dest' is not a directory" 1>&2
59371ab64890Smrg	$echo "$help" 1>&2
59381ab64890Smrg	exit $EXIT_FAILURE
59391ab64890Smrg      fi
59401ab64890Smrg    fi
59411ab64890Smrg    case $destdir in
59421ab64890Smrg    [\\/]* | [A-Za-z]:[\\/]*) ;;
59431ab64890Smrg    *)
59441ab64890Smrg      for file in $files; do
59451ab64890Smrg	case $file in
59461ab64890Smrg	*.lo) ;;
59471ab64890Smrg	*)
59481ab64890Smrg	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
59491ab64890Smrg	  $echo "$help" 1>&2
59501ab64890Smrg	  exit $EXIT_FAILURE
59511ab64890Smrg	  ;;
59521ab64890Smrg	esac
59531ab64890Smrg      done
59541ab64890Smrg      ;;
59551ab64890Smrg    esac
59561ab64890Smrg
59571ab64890Smrg    # This variable tells wrapper scripts just to set variables rather
59581ab64890Smrg    # than running their programs.
59591ab64890Smrg    libtool_install_magic="$magic"
59601ab64890Smrg
59611ab64890Smrg    staticlibs=
59621ab64890Smrg    future_libdirs=
59631ab64890Smrg    current_libdirs=
59641ab64890Smrg    for file in $files; do
59651ab64890Smrg
59661ab64890Smrg      # Do each installation.
59671ab64890Smrg      case $file in
59681ab64890Smrg      *.$libext)
59691ab64890Smrg	# Do the static libraries later.
59701ab64890Smrg	staticlibs="$staticlibs $file"
59711ab64890Smrg	;;
59721ab64890Smrg
59731ab64890Smrg      *.la)
59741ab64890Smrg	# Check to see that this really is a libtool archive.
59751ab64890Smrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
59761ab64890Smrg	else
59771ab64890Smrg	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
59781ab64890Smrg	  $echo "$help" 1>&2
59791ab64890Smrg	  exit $EXIT_FAILURE
59801ab64890Smrg	fi
59811ab64890Smrg
59821ab64890Smrg	library_names=
59831ab64890Smrg	old_library=
59841ab64890Smrg	relink_command=
59851ab64890Smrg	# If there is no directory component, then add one.
59861ab64890Smrg	case $file in
59871ab64890Smrg	*/* | *\\*) . $file ;;
59881ab64890Smrg	*) . ./$file ;;
59891ab64890Smrg	esac
59901ab64890Smrg
59911ab64890Smrg	# Add the libdir to current_libdirs if it is the destination.
59921ab64890Smrg	if test "X$destdir" = "X$libdir"; then
59931ab64890Smrg	  case "$current_libdirs " in
59941ab64890Smrg	  *" $libdir "*) ;;
59951ab64890Smrg	  *) current_libdirs="$current_libdirs $libdir" ;;
59961ab64890Smrg	  esac
59971ab64890Smrg	else
59981ab64890Smrg	  # Note the libdir as a future libdir.
59991ab64890Smrg	  case "$future_libdirs " in
60001ab64890Smrg	  *" $libdir "*) ;;
60011ab64890Smrg	  *) future_libdirs="$future_libdirs $libdir" ;;
60021ab64890Smrg	  esac
60031ab64890Smrg	fi
60041ab64890Smrg
60051ab64890Smrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
60061ab64890Smrg	test "X$dir" = "X$file/" && dir=
60071ab64890Smrg	dir="$dir$objdir"
60081ab64890Smrg
60091ab64890Smrg	if test -n "$relink_command"; then
60101ab64890Smrg	  # Determine the prefix the user has applied to our future dir.
60111ab64890Smrg	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
60121ab64890Smrg
60131ab64890Smrg	  # Don't allow the user to place us outside of our expected
60141ab64890Smrg	  # location b/c this prevents finding dependent libraries that
60151ab64890Smrg	  # are installed to the same prefix.
60161ab64890Smrg	  # At present, this check doesn't affect windows .dll's that
60171ab64890Smrg	  # are installed into $libdir/../bin (currently, that works fine)
60181ab64890Smrg	  # but it's something to keep an eye on.
60191ab64890Smrg	  if test "$inst_prefix_dir" = "$destdir"; then
60201ab64890Smrg	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
60211ab64890Smrg	    exit $EXIT_FAILURE
60221ab64890Smrg	  fi
60231ab64890Smrg
60241ab64890Smrg	  if test -n "$inst_prefix_dir"; then
60251ab64890Smrg	    # Stick the inst_prefix_dir data into the link command.
60261ab64890Smrg	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
60271ab64890Smrg	  else
60281ab64890Smrg	    relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
60291ab64890Smrg	  fi
60301ab64890Smrg
60311ab64890Smrg	  $echo "$modename: warning: relinking \`$file'" 1>&2
60321ab64890Smrg	  $show "$relink_command"
60331ab64890Smrg	  if $run eval "$relink_command"; then :
60341ab64890Smrg	  else
60351ab64890Smrg	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
60361ab64890Smrg	    exit $EXIT_FAILURE
60371ab64890Smrg	  fi
60381ab64890Smrg	fi
60391ab64890Smrg
60401ab64890Smrg	# See the names of the shared library.
60411ab64890Smrg	set dummy $library_names
60421ab64890Smrg	if test -n "$2"; then
60431ab64890Smrg	  realname="$2"
60441ab64890Smrg	  shift
60451ab64890Smrg	  shift
60461ab64890Smrg
60471ab64890Smrg	  srcname="$realname"
60481ab64890Smrg	  test -n "$relink_command" && srcname="$realname"T
60491ab64890Smrg
60501ab64890Smrg	  # Install the shared library and build the symlinks.
60511ab64890Smrg	  $show "$install_prog $dir/$srcname $destdir/$realname"
60521ab64890Smrg	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
60531ab64890Smrg	  if test -n "$stripme" && test -n "$striplib"; then
60541ab64890Smrg	    $show "$striplib $destdir/$realname"
60551ab64890Smrg	    $run eval "$striplib $destdir/$realname" || exit $?
60561ab64890Smrg	  fi
60571ab64890Smrg
60581ab64890Smrg	  if test "$#" -gt 0; then
60591ab64890Smrg	    # Delete the old symlinks, and create new ones.
60601ab64890Smrg	    # Try `ln -sf' first, because the `ln' binary might depend on
60611ab64890Smrg	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
60621ab64890Smrg	    # so we also need to try rm && ln -s.
60631ab64890Smrg	    for linkname
60641ab64890Smrg	    do
60651ab64890Smrg	      if test "$linkname" != "$realname"; then
60661ab64890Smrg                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
60671ab64890Smrg                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
60681ab64890Smrg	      fi
60691ab64890Smrg	    done
60701ab64890Smrg	  fi
60711ab64890Smrg
60721ab64890Smrg	  # Do each command in the postinstall commands.
60731ab64890Smrg	  lib="$destdir/$realname"
60741ab64890Smrg	  cmds=$postinstall_cmds
60751ab64890Smrg	  save_ifs="$IFS"; IFS='~'
60761ab64890Smrg	  for cmd in $cmds; do
60771ab64890Smrg	    IFS="$save_ifs"
60781ab64890Smrg	    eval cmd=\"$cmd\"
60791ab64890Smrg	    $show "$cmd"
60801ab64890Smrg	    $run eval "$cmd" || {
60811ab64890Smrg	      lt_exit=$?
60821ab64890Smrg
60831ab64890Smrg	      # Restore the uninstalled library and exit
60841ab64890Smrg	      if test "$mode" = relink; then
60851ab64890Smrg		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
60861ab64890Smrg	      fi
60871ab64890Smrg
60881ab64890Smrg	      exit $lt_exit
60891ab64890Smrg	    }
60901ab64890Smrg	  done
60911ab64890Smrg	  IFS="$save_ifs"
60921ab64890Smrg	fi
60931ab64890Smrg
60941ab64890Smrg	# Install the pseudo-library for information purposes.
60951ab64890Smrg	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
60961ab64890Smrg	instname="$dir/$name"i
60971ab64890Smrg	$show "$install_prog $instname $destdir/$name"
60981ab64890Smrg	$run eval "$install_prog $instname $destdir/$name" || exit $?
60991ab64890Smrg
61001ab64890Smrg	# Maybe install the static library, too.
61011ab64890Smrg	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
61021ab64890Smrg	;;
61031ab64890Smrg
61041ab64890Smrg      *.lo)
61051ab64890Smrg	# Install (i.e. copy) a libtool object.
61061ab64890Smrg
61071ab64890Smrg	# Figure out destination file name, if it wasn't already specified.
61081ab64890Smrg	if test -n "$destname"; then
61091ab64890Smrg	  destfile="$destdir/$destname"
61101ab64890Smrg	else
61111ab64890Smrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
61121ab64890Smrg	  destfile="$destdir/$destfile"
61131ab64890Smrg	fi
61141ab64890Smrg
61151ab64890Smrg	# Deduce the name of the destination old-style object file.
61161ab64890Smrg	case $destfile in
61171ab64890Smrg	*.lo)
61181ab64890Smrg	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
61191ab64890Smrg	  ;;
61201ab64890Smrg	*.$objext)
61211ab64890Smrg	  staticdest="$destfile"
61221ab64890Smrg	  destfile=
61231ab64890Smrg	  ;;
61241ab64890Smrg	*)
61251ab64890Smrg	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
61261ab64890Smrg	  $echo "$help" 1>&2
61271ab64890Smrg	  exit $EXIT_FAILURE
61281ab64890Smrg	  ;;
61291ab64890Smrg	esac
61301ab64890Smrg
61311ab64890Smrg	# Install the libtool object if requested.
61321ab64890Smrg	if test -n "$destfile"; then
61331ab64890Smrg	  $show "$install_prog $file $destfile"
61341ab64890Smrg	  $run eval "$install_prog $file $destfile" || exit $?
61351ab64890Smrg	fi
61361ab64890Smrg
61371ab64890Smrg	# Install the old object if enabled.
61381ab64890Smrg	if test "$build_old_libs" = yes; then
61391ab64890Smrg	  # Deduce the name of the old-style object file.
61401ab64890Smrg	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
61411ab64890Smrg
61421ab64890Smrg	  $show "$install_prog $staticobj $staticdest"
61431ab64890Smrg	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
61441ab64890Smrg	fi
61451ab64890Smrg	exit $EXIT_SUCCESS
61461ab64890Smrg	;;
61471ab64890Smrg
61481ab64890Smrg      *)
61491ab64890Smrg	# Figure out destination file name, if it wasn't already specified.
61501ab64890Smrg	if test -n "$destname"; then
61511ab64890Smrg	  destfile="$destdir/$destname"
61521ab64890Smrg	else
61531ab64890Smrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
61541ab64890Smrg	  destfile="$destdir/$destfile"
61551ab64890Smrg	fi
61561ab64890Smrg
61571ab64890Smrg	# If the file is missing, and there is a .exe on the end, strip it
61581ab64890Smrg	# because it is most likely a libtool script we actually want to
61591ab64890Smrg	# install
61601ab64890Smrg	stripped_ext=""
61611ab64890Smrg	case $file in
61621ab64890Smrg	  *.exe)
61631ab64890Smrg	    if test ! -f "$file"; then
61641ab64890Smrg	      file=`$echo $file|${SED} 's,.exe$,,'`
61651ab64890Smrg	      stripped_ext=".exe"
61661ab64890Smrg	    fi
61671ab64890Smrg	    ;;
61681ab64890Smrg	esac
61691ab64890Smrg
61701ab64890Smrg	# Do a test to see if this is really a libtool program.
61711ab64890Smrg	case $host in
61721ab64890Smrg	*cygwin*|*mingw*)
61731ab64890Smrg	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
61741ab64890Smrg	    ;;
61751ab64890Smrg	*)
61761ab64890Smrg	    wrapper=$file
61771ab64890Smrg	    ;;
61781ab64890Smrg	esac
61791ab64890Smrg	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
61801ab64890Smrg	  notinst_deplibs=
61811ab64890Smrg	  relink_command=
61821ab64890Smrg
61831ab64890Smrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
61841ab64890Smrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
61851ab64890Smrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
61861ab64890Smrg	  # `FILE.' does not work on cygwin managed mounts.
61871ab64890Smrg	  #
61881ab64890Smrg	  # If there is no directory component, then add one.
61891ab64890Smrg	  case $wrapper in
61901ab64890Smrg	  */* | *\\*) . ${wrapper} ;;
61911ab64890Smrg	  *) . ./${wrapper} ;;
61921ab64890Smrg	  esac
61931ab64890Smrg
61941ab64890Smrg	  # Check the variables that should have been set.
61951ab64890Smrg	  if test -z "$notinst_deplibs"; then
61961ab64890Smrg	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
61971ab64890Smrg	    exit $EXIT_FAILURE
61981ab64890Smrg	  fi
61991ab64890Smrg
62001ab64890Smrg	  finalize=yes
62011ab64890Smrg	  for lib in $notinst_deplibs; do
62021ab64890Smrg	    # Check to see that each library is installed.
62031ab64890Smrg	    libdir=
62041ab64890Smrg	    if test -f "$lib"; then
62051ab64890Smrg	      # If there is no directory component, then add one.
62061ab64890Smrg	      case $lib in
62071ab64890Smrg	      */* | *\\*) . $lib ;;
62081ab64890Smrg	      *) . ./$lib ;;
62091ab64890Smrg	      esac
62101ab64890Smrg	    fi
62111ab64890Smrg	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
62121ab64890Smrg	    if test -n "$libdir" && test ! -f "$libfile"; then
62131ab64890Smrg	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
62141ab64890Smrg	      finalize=no
62151ab64890Smrg	    fi
62161ab64890Smrg	  done
62171ab64890Smrg
62181ab64890Smrg	  relink_command=
62191ab64890Smrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
62201ab64890Smrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
62211ab64890Smrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
62221ab64890Smrg	  # `FILE.' does not work on cygwin managed mounts.
62231ab64890Smrg	  #
62241ab64890Smrg	  # If there is no directory component, then add one.
62251ab64890Smrg	  case $wrapper in
62261ab64890Smrg	  */* | *\\*) . ${wrapper} ;;
62271ab64890Smrg	  *) . ./${wrapper} ;;
62281ab64890Smrg	  esac
62291ab64890Smrg
62301ab64890Smrg	  outputname=
62311ab64890Smrg	  if test "$fast_install" = no && test -n "$relink_command"; then
62321ab64890Smrg	    if test "$finalize" = yes && test -z "$run"; then
62331ab64890Smrg	      tmpdir=`func_mktempdir`
62341ab64890Smrg	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
62351ab64890Smrg	      outputname="$tmpdir/$file"
62361ab64890Smrg	      # Replace the output file specification.
62371ab64890Smrg	      relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
62381ab64890Smrg
62391ab64890Smrg	      $show "$relink_command"
62401ab64890Smrg	      if $run eval "$relink_command"; then :
62411ab64890Smrg	      else
62421ab64890Smrg		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
62431ab64890Smrg		${rm}r "$tmpdir"
62441ab64890Smrg		continue
62451ab64890Smrg	      fi
62461ab64890Smrg	      file="$outputname"
62471ab64890Smrg	    else
62481ab64890Smrg	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
62491ab64890Smrg	    fi
62501ab64890Smrg	  else
62511ab64890Smrg	    # Install the binary that we compiled earlier.
62521ab64890Smrg	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
62531ab64890Smrg	  fi
62541ab64890Smrg	fi
62551ab64890Smrg
62561ab64890Smrg	# remove .exe since cygwin /usr/bin/install will append another
62571ab64890Smrg	# one anyway 
62581ab64890Smrg	case $install_prog,$host in
62591ab64890Smrg	*/usr/bin/install*,*cygwin*)
62601ab64890Smrg	  case $file:$destfile in
62611ab64890Smrg	  *.exe:*.exe)
62621ab64890Smrg	    # this is ok
62631ab64890Smrg	    ;;
62641ab64890Smrg	  *.exe:*)
62651ab64890Smrg	    destfile=$destfile.exe
62661ab64890Smrg	    ;;
62671ab64890Smrg	  *:*.exe)
62681ab64890Smrg	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
62691ab64890Smrg	    ;;
62701ab64890Smrg	  esac
62711ab64890Smrg	  ;;
62721ab64890Smrg	esac
62731ab64890Smrg	$show "$install_prog$stripme $file $destfile"
62741ab64890Smrg	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
62751ab64890Smrg	test -n "$outputname" && ${rm}r "$tmpdir"
62761ab64890Smrg	;;
62771ab64890Smrg      esac
62781ab64890Smrg    done
62791ab64890Smrg
62801ab64890Smrg    for file in $staticlibs; do
62811ab64890Smrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
62821ab64890Smrg
62831ab64890Smrg      # Set up the ranlib parameters.
62841ab64890Smrg      oldlib="$destdir/$name"
62851ab64890Smrg
62861ab64890Smrg      $show "$install_prog $file $oldlib"
62871ab64890Smrg      $run eval "$install_prog \$file \$oldlib" || exit $?
62881ab64890Smrg
62891ab64890Smrg      if test -n "$stripme" && test -n "$old_striplib"; then
62901ab64890Smrg	$show "$old_striplib $oldlib"
62911ab64890Smrg	$run eval "$old_striplib $oldlib" || exit $?
62921ab64890Smrg      fi
62931ab64890Smrg
62941ab64890Smrg      # Do each command in the postinstall commands.
62951ab64890Smrg      cmds=$old_postinstall_cmds
62961ab64890Smrg      save_ifs="$IFS"; IFS='~'
62971ab64890Smrg      for cmd in $cmds; do
62981ab64890Smrg	IFS="$save_ifs"
62991ab64890Smrg	eval cmd=\"$cmd\"
63001ab64890Smrg	$show "$cmd"
63011ab64890Smrg	$run eval "$cmd" || exit $?
63021ab64890Smrg      done
63031ab64890Smrg      IFS="$save_ifs"
63041ab64890Smrg    done
63051ab64890Smrg
63061ab64890Smrg    if test -n "$future_libdirs"; then
63071ab64890Smrg      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
63081ab64890Smrg    fi
63091ab64890Smrg
63101ab64890Smrg    if test -n "$current_libdirs"; then
63111ab64890Smrg      # Maybe just do a dry run.
63121ab64890Smrg      test -n "$run" && current_libdirs=" -n$current_libdirs"
63131ab64890Smrg      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
63141ab64890Smrg    else
63151ab64890Smrg      exit $EXIT_SUCCESS
63161ab64890Smrg    fi
63171ab64890Smrg    ;;
63181ab64890Smrg
63191ab64890Smrg  # libtool finish mode
63201ab64890Smrg  finish)
63211ab64890Smrg    modename="$modename: finish"
63221ab64890Smrg    libdirs="$nonopt"
63231ab64890Smrg    admincmds=
63241ab64890Smrg
63251ab64890Smrg    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
63261ab64890Smrg      for dir
63271ab64890Smrg      do
63281ab64890Smrg	libdirs="$libdirs $dir"
63291ab64890Smrg      done
63301ab64890Smrg
63311ab64890Smrg      for libdir in $libdirs; do
63321ab64890Smrg	if test -n "$finish_cmds"; then
63331ab64890Smrg	  # Do each command in the finish commands.
63341ab64890Smrg	  cmds=$finish_cmds
63351ab64890Smrg	  save_ifs="$IFS"; IFS='~'
63361ab64890Smrg	  for cmd in $cmds; do
63371ab64890Smrg	    IFS="$save_ifs"
63381ab64890Smrg	    eval cmd=\"$cmd\"
63391ab64890Smrg	    $show "$cmd"
63401ab64890Smrg	    $run eval "$cmd" || admincmds="$admincmds
63411ab64890Smrg       $cmd"
63421ab64890Smrg	  done
63431ab64890Smrg	  IFS="$save_ifs"
63441ab64890Smrg	fi
63451ab64890Smrg	if test -n "$finish_eval"; then
63461ab64890Smrg	  # Do the single finish_eval.
63471ab64890Smrg	  eval cmds=\"$finish_eval\"
63481ab64890Smrg	  $run eval "$cmds" || admincmds="$admincmds
63491ab64890Smrg       $cmds"
63501ab64890Smrg	fi
63511ab64890Smrg      done
63521ab64890Smrg    fi
63531ab64890Smrg
63541ab64890Smrg    # Exit here if they wanted silent mode.
63551ab64890Smrg    test "$show" = : && exit $EXIT_SUCCESS
63561ab64890Smrg
63571ab64890Smrg    $echo "X----------------------------------------------------------------------" | $Xsed
63581ab64890Smrg    $echo "Libraries have been installed in:"
63591ab64890Smrg    for libdir in $libdirs; do
63601ab64890Smrg      $echo "   $libdir"
63611ab64890Smrg    done
63621ab64890Smrg    $echo
63631ab64890Smrg    $echo "If you ever happen to want to link against installed libraries"
63641ab64890Smrg    $echo "in a given directory, LIBDIR, you must either use libtool, and"
63651ab64890Smrg    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
63661ab64890Smrg    $echo "flag during linking and do at least one of the following:"
63671ab64890Smrg    if test -n "$shlibpath_var"; then
63681ab64890Smrg      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
63691ab64890Smrg      $echo "     during execution"
63701ab64890Smrg    fi
63711ab64890Smrg    if test -n "$runpath_var"; then
63721ab64890Smrg      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
63731ab64890Smrg      $echo "     during linking"
63741ab64890Smrg    fi
63751ab64890Smrg    if test -n "$hardcode_libdir_flag_spec"; then
63761ab64890Smrg      libdir=LIBDIR
63771ab64890Smrg      eval flag=\"$hardcode_libdir_flag_spec\"
63781ab64890Smrg
63791ab64890Smrg      $echo "   - use the \`$flag' linker flag"
63801ab64890Smrg    fi
63811ab64890Smrg    if test -n "$admincmds"; then
63821ab64890Smrg      $echo "   - have your system administrator run these commands:$admincmds"
63831ab64890Smrg    fi
63841ab64890Smrg    if test -f /etc/ld.so.conf; then
63851ab64890Smrg      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
63861ab64890Smrg    fi
63871ab64890Smrg    $echo
63881ab64890Smrg    $echo "See any operating system documentation about shared libraries for"
63891ab64890Smrg    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
63901ab64890Smrg    $echo "X----------------------------------------------------------------------" | $Xsed
63911ab64890Smrg    exit $EXIT_SUCCESS
63921ab64890Smrg    ;;
63931ab64890Smrg
63941ab64890Smrg  # libtool execute mode
63951ab64890Smrg  execute)
63961ab64890Smrg    modename="$modename: execute"
63971ab64890Smrg
63981ab64890Smrg    # The first argument is the command name.
63991ab64890Smrg    cmd="$nonopt"
64001ab64890Smrg    if test -z "$cmd"; then
64011ab64890Smrg      $echo "$modename: you must specify a COMMAND" 1>&2
64021ab64890Smrg      $echo "$help"
64031ab64890Smrg      exit $EXIT_FAILURE
64041ab64890Smrg    fi
64051ab64890Smrg
64061ab64890Smrg    # Handle -dlopen flags immediately.
64071ab64890Smrg    for file in $execute_dlfiles; do
64081ab64890Smrg      if test ! -f "$file"; then
64091ab64890Smrg	$echo "$modename: \`$file' is not a file" 1>&2
64101ab64890Smrg	$echo "$help" 1>&2
64111ab64890Smrg	exit $EXIT_FAILURE
64121ab64890Smrg      fi
64131ab64890Smrg
64141ab64890Smrg      dir=
64151ab64890Smrg      case $file in
64161ab64890Smrg      *.la)
64171ab64890Smrg	# Check to see that this really is a libtool archive.
64181ab64890Smrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
64191ab64890Smrg	else
64201ab64890Smrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
64211ab64890Smrg	  $echo "$help" 1>&2
64221ab64890Smrg	  exit $EXIT_FAILURE
64231ab64890Smrg	fi
64241ab64890Smrg
64251ab64890Smrg	# Read the libtool library.
64261ab64890Smrg	dlname=
64271ab64890Smrg	library_names=
64281ab64890Smrg
64291ab64890Smrg	# If there is no directory component, then add one.
64301ab64890Smrg	case $file in
64311ab64890Smrg	*/* | *\\*) . $file ;;
64321ab64890Smrg	*) . ./$file ;;
64331ab64890Smrg	esac
64341ab64890Smrg
64351ab64890Smrg	# Skip this library if it cannot be dlopened.
64361ab64890Smrg	if test -z "$dlname"; then
64371ab64890Smrg	  # Warn if it was a shared library.
64381ab64890Smrg	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
64391ab64890Smrg	  continue
64401ab64890Smrg	fi
64411ab64890Smrg
64421ab64890Smrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
64431ab64890Smrg	test "X$dir" = "X$file" && dir=.
64441ab64890Smrg
64451ab64890Smrg	if test -f "$dir/$objdir/$dlname"; then
64461ab64890Smrg	  dir="$dir/$objdir"
64471ab64890Smrg	else
64481ab64890Smrg	  if test ! -f "$dir/$dlname"; then
64491ab64890Smrg	    $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
64501ab64890Smrg	    exit $EXIT_FAILURE
64511ab64890Smrg	  fi
64521ab64890Smrg	fi
64531ab64890Smrg	;;
64541ab64890Smrg
64551ab64890Smrg      *.lo)
64561ab64890Smrg	# Just add the directory containing the .lo file.
64571ab64890Smrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
64581ab64890Smrg	test "X$dir" = "X$file" && dir=.
64591ab64890Smrg	;;
64601ab64890Smrg
64611ab64890Smrg      *)
64621ab64890Smrg	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
64631ab64890Smrg	continue
64641ab64890Smrg	;;
64651ab64890Smrg      esac
64661ab64890Smrg
64671ab64890Smrg      # Get the absolute pathname.
64681ab64890Smrg      absdir=`cd "$dir" && pwd`
64691ab64890Smrg      test -n "$absdir" && dir="$absdir"
64701ab64890Smrg
64711ab64890Smrg      # Now add the directory to shlibpath_var.
64721ab64890Smrg      if eval "test -z \"\$$shlibpath_var\""; then
64731ab64890Smrg	eval "$shlibpath_var=\"\$dir\""
64741ab64890Smrg      else
64751ab64890Smrg	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
64761ab64890Smrg      fi
64771ab64890Smrg    done
64781ab64890Smrg
64791ab64890Smrg    # This variable tells wrapper scripts just to set shlibpath_var
64801ab64890Smrg    # rather than running their programs.
64811ab64890Smrg    libtool_execute_magic="$magic"
64821ab64890Smrg
64831ab64890Smrg    # Check if any of the arguments is a wrapper script.
64841ab64890Smrg    args=
64851ab64890Smrg    for file
64861ab64890Smrg    do
64871ab64890Smrg      case $file in
64881ab64890Smrg      -*) ;;
64891ab64890Smrg      *)
64901ab64890Smrg	# Do a test to see if this is really a libtool program.
64911ab64890Smrg	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
64921ab64890Smrg	  # If there is no directory component, then add one.
64931ab64890Smrg	  case $file in
64941ab64890Smrg	  */* | *\\*) . $file ;;
64951ab64890Smrg	  *) . ./$file ;;
64961ab64890Smrg	  esac
64971ab64890Smrg
64981ab64890Smrg	  # Transform arg to wrapped name.
64991ab64890Smrg	  file="$progdir/$program"
65001ab64890Smrg	fi
65011ab64890Smrg	;;
65021ab64890Smrg      esac
65031ab64890Smrg      # Quote arguments (to preserve shell metacharacters).
65041ab64890Smrg      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
65051ab64890Smrg      args="$args \"$file\""
65061ab64890Smrg    done
65071ab64890Smrg
65081ab64890Smrg    if test -z "$run"; then
65091ab64890Smrg      if test -n "$shlibpath_var"; then
65101ab64890Smrg	# Export the shlibpath_var.
65111ab64890Smrg	eval "export $shlibpath_var"
65121ab64890Smrg      fi
65131ab64890Smrg
65141ab64890Smrg      # Restore saved environment variables
651561b2299dSmrg      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
65161ab64890Smrg      do
65171ab64890Smrg	eval "if test \"\${save_$lt_var+set}\" = set; then
65181ab64890Smrg		$lt_var=\$save_$lt_var; export $lt_var
65191ab64890Smrg	      fi"
65201ab64890Smrg      done
65211ab64890Smrg
65221ab64890Smrg      # Now prepare to actually exec the command.
65231ab64890Smrg      exec_cmd="\$cmd$args"
65241ab64890Smrg    else
65251ab64890Smrg      # Display what would be done.
65261ab64890Smrg      if test -n "$shlibpath_var"; then
65271ab64890Smrg	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
65281ab64890Smrg	$echo "export $shlibpath_var"
65291ab64890Smrg      fi
65301ab64890Smrg      $echo "$cmd$args"
65311ab64890Smrg      exit $EXIT_SUCCESS
65321ab64890Smrg    fi
65331ab64890Smrg    ;;
65341ab64890Smrg
65351ab64890Smrg  # libtool clean and uninstall mode
65361ab64890Smrg  clean | uninstall)
65371ab64890Smrg    modename="$modename: $mode"
65381ab64890Smrg    rm="$nonopt"
65391ab64890Smrg    files=
65401ab64890Smrg    rmforce=
65411ab64890Smrg    exit_status=0
65421ab64890Smrg
65431ab64890Smrg    # This variable tells wrapper scripts just to set variables rather
65441ab64890Smrg    # than running their programs.
65451ab64890Smrg    libtool_install_magic="$magic"
65461ab64890Smrg
65471ab64890Smrg    for arg
65481ab64890Smrg    do
65491ab64890Smrg      case $arg in
65501ab64890Smrg      -f) rm="$rm $arg"; rmforce=yes ;;
65511ab64890Smrg      -*) rm="$rm $arg" ;;
65521ab64890Smrg      *) files="$files $arg" ;;
65531ab64890Smrg      esac
65541ab64890Smrg    done
65551ab64890Smrg
65561ab64890Smrg    if test -z "$rm"; then
65571ab64890Smrg      $echo "$modename: you must specify an RM program" 1>&2
65581ab64890Smrg      $echo "$help" 1>&2
65591ab64890Smrg      exit $EXIT_FAILURE
65601ab64890Smrg    fi
65611ab64890Smrg
65621ab64890Smrg    rmdirs=
65631ab64890Smrg
65641ab64890Smrg    origobjdir="$objdir"
65651ab64890Smrg    for file in $files; do
65661ab64890Smrg      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
65671ab64890Smrg      if test "X$dir" = "X$file"; then
65681ab64890Smrg	dir=.
65691ab64890Smrg	objdir="$origobjdir"
65701ab64890Smrg      else
65711ab64890Smrg	objdir="$dir/$origobjdir"
65721ab64890Smrg      fi
65731ab64890Smrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
65741ab64890Smrg      test "$mode" = uninstall && objdir="$dir"
65751ab64890Smrg
65761ab64890Smrg      # Remember objdir for removal later, being careful to avoid duplicates
65771ab64890Smrg      if test "$mode" = clean; then
65781ab64890Smrg	case " $rmdirs " in
65791ab64890Smrg	  *" $objdir "*) ;;
65801ab64890Smrg	  *) rmdirs="$rmdirs $objdir" ;;
65811ab64890Smrg	esac
65821ab64890Smrg      fi
65831ab64890Smrg
65841ab64890Smrg      # Don't error if the file doesn't exist and rm -f was used.
65851ab64890Smrg      if (test -L "$file") >/dev/null 2>&1 \
65861ab64890Smrg	|| (test -h "$file") >/dev/null 2>&1 \
65871ab64890Smrg	|| test -f "$file"; then
65881ab64890Smrg	:
65891ab64890Smrg      elif test -d "$file"; then
65901ab64890Smrg	exit_status=1
65911ab64890Smrg	continue
65921ab64890Smrg      elif test "$rmforce" = yes; then
65931ab64890Smrg	continue
65941ab64890Smrg      fi
65951ab64890Smrg
65961ab64890Smrg      rmfiles="$file"
65971ab64890Smrg
65981ab64890Smrg      case $name in
65991ab64890Smrg      *.la)
66001ab64890Smrg	# Possibly a libtool archive, so verify it.
66011ab64890Smrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
66021ab64890Smrg	  . $dir/$name
66031ab64890Smrg
66041ab64890Smrg	  # Delete the libtool libraries and symlinks.
66051ab64890Smrg	  for n in $library_names; do
66061ab64890Smrg	    rmfiles="$rmfiles $objdir/$n"
66071ab64890Smrg	  done
66081ab64890Smrg	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
66091ab64890Smrg
66101ab64890Smrg	  case "$mode" in
66111ab64890Smrg	  clean)
66121ab64890Smrg	    case "  $library_names " in
66131ab64890Smrg	    # "  " in the beginning catches empty $dlname
66141ab64890Smrg	    *" $dlname "*) ;;
66151ab64890Smrg	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
66161ab64890Smrg	    esac
66171ab64890Smrg	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
66181ab64890Smrg	    ;;
66191ab64890Smrg	  uninstall)
66201ab64890Smrg	    if test -n "$library_names"; then
66211ab64890Smrg	      # Do each command in the postuninstall commands.
66221ab64890Smrg	      cmds=$postuninstall_cmds
66231ab64890Smrg	      save_ifs="$IFS"; IFS='~'
66241ab64890Smrg	      for cmd in $cmds; do
66251ab64890Smrg		IFS="$save_ifs"
66261ab64890Smrg		eval cmd=\"$cmd\"
66271ab64890Smrg		$show "$cmd"
66281ab64890Smrg		$run eval "$cmd"
66291ab64890Smrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
66301ab64890Smrg		  exit_status=1
66311ab64890Smrg		fi
66321ab64890Smrg	      done
66331ab64890Smrg	      IFS="$save_ifs"
66341ab64890Smrg	    fi
66351ab64890Smrg
66361ab64890Smrg	    if test -n "$old_library"; then
66371ab64890Smrg	      # Do each command in the old_postuninstall commands.
66381ab64890Smrg	      cmds=$old_postuninstall_cmds
66391ab64890Smrg	      save_ifs="$IFS"; IFS='~'
66401ab64890Smrg	      for cmd in $cmds; do
66411ab64890Smrg		IFS="$save_ifs"
66421ab64890Smrg		eval cmd=\"$cmd\"
66431ab64890Smrg		$show "$cmd"
66441ab64890Smrg		$run eval "$cmd"
66451ab64890Smrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
66461ab64890Smrg		  exit_status=1
66471ab64890Smrg		fi
66481ab64890Smrg	      done
66491ab64890Smrg	      IFS="$save_ifs"
66501ab64890Smrg	    fi
66511ab64890Smrg	    # FIXME: should reinstall the best remaining shared library.
66521ab64890Smrg	    ;;
66531ab64890Smrg	  esac
66541ab64890Smrg	fi
66551ab64890Smrg	;;
66561ab64890Smrg
66571ab64890Smrg      *.lo)
66581ab64890Smrg	# Possibly a libtool object, so verify it.
66591ab64890Smrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
66601ab64890Smrg
66611ab64890Smrg	  # Read the .lo file
66621ab64890Smrg	  . $dir/$name
66631ab64890Smrg
66641ab64890Smrg	  # Add PIC object to the list of files to remove.
66651ab64890Smrg	  if test -n "$pic_object" \
66661ab64890Smrg	     && test "$pic_object" != none; then
66671ab64890Smrg	    rmfiles="$rmfiles $dir/$pic_object"
66681ab64890Smrg	  fi
66691ab64890Smrg
66701ab64890Smrg	  # Add non-PIC object to the list of files to remove.
66711ab64890Smrg	  if test -n "$non_pic_object" \
66721ab64890Smrg	     && test "$non_pic_object" != none; then
66731ab64890Smrg	    rmfiles="$rmfiles $dir/$non_pic_object"
66741ab64890Smrg	  fi
66751ab64890Smrg	fi
66761ab64890Smrg	;;
66771ab64890Smrg
66781ab64890Smrg      *)
66791ab64890Smrg	if test "$mode" = clean ; then
66801ab64890Smrg	  noexename=$name
66811ab64890Smrg	  case $file in
66821ab64890Smrg	  *.exe)
66831ab64890Smrg	    file=`$echo $file|${SED} 's,.exe$,,'`
66841ab64890Smrg	    noexename=`$echo $name|${SED} 's,.exe$,,'`
66851ab64890Smrg	    # $file with .exe has already been added to rmfiles,
66861ab64890Smrg	    # add $file without .exe
66871ab64890Smrg	    rmfiles="$rmfiles $file"
66881ab64890Smrg	    ;;
66891ab64890Smrg	  esac
66901ab64890Smrg	  # Do a test to see if this is a libtool program.
66911ab64890Smrg	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
66921ab64890Smrg	    relink_command=
66931ab64890Smrg	    . $dir/$noexename
66941ab64890Smrg
66951ab64890Smrg	    # note $name still contains .exe if it was in $file originally
66961ab64890Smrg	    # as does the version of $file that was added into $rmfiles
66971ab64890Smrg	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
66981ab64890Smrg	    if test "$fast_install" = yes && test -n "$relink_command"; then
66991ab64890Smrg	      rmfiles="$rmfiles $objdir/lt-$name"
67001ab64890Smrg	    fi
67011ab64890Smrg	    if test "X$noexename" != "X$name" ; then
67021ab64890Smrg	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
67031ab64890Smrg	    fi
67041ab64890Smrg	  fi
67051ab64890Smrg	fi
67061ab64890Smrg	;;
67071ab64890Smrg      esac
67081ab64890Smrg      $show "$rm $rmfiles"
67091ab64890Smrg      $run $rm $rmfiles || exit_status=1
67101ab64890Smrg    done
67111ab64890Smrg    objdir="$origobjdir"
67121ab64890Smrg
67131ab64890Smrg    # Try to remove the ${objdir}s in the directories where we deleted files
67141ab64890Smrg    for dir in $rmdirs; do
67151ab64890Smrg      if test -d "$dir"; then
67161ab64890Smrg	$show "rmdir $dir"
67171ab64890Smrg	$run rmdir $dir >/dev/null 2>&1
67181ab64890Smrg      fi
67191ab64890Smrg    done
67201ab64890Smrg
67211ab64890Smrg    exit $exit_status
67221ab64890Smrg    ;;
67231ab64890Smrg
67241ab64890Smrg  "")
67251ab64890Smrg    $echo "$modename: you must specify a MODE" 1>&2
67261ab64890Smrg    $echo "$generic_help" 1>&2
67271ab64890Smrg    exit $EXIT_FAILURE
67281ab64890Smrg    ;;
67291ab64890Smrg  esac
67301ab64890Smrg
67311ab64890Smrg  if test -z "$exec_cmd"; then
67321ab64890Smrg    $echo "$modename: invalid operation mode \`$mode'" 1>&2
67331ab64890Smrg    $echo "$generic_help" 1>&2
67341ab64890Smrg    exit $EXIT_FAILURE
67351ab64890Smrg  fi
67361ab64890Smrgfi # test -z "$show_help"
67371ab64890Smrg
67381ab64890Smrgif test -n "$exec_cmd"; then
67391ab64890Smrg  eval exec $exec_cmd
67401ab64890Smrg  exit $EXIT_FAILURE
67411ab64890Smrgfi
67421ab64890Smrg
67431ab64890Smrg# We need to display help for each of the modes.
67441ab64890Smrgcase $mode in
67451ab64890Smrg"") $echo \
67461ab64890Smrg"Usage: $modename [OPTION]... [MODE-ARG]...
67471ab64890Smrg
67481ab64890SmrgProvide generalized library-building support services.
67491ab64890Smrg
67501ab64890Smrg    --config          show all configuration variables
67511ab64890Smrg    --debug           enable verbose shell tracing
67521ab64890Smrg-n, --dry-run         display commands without modifying any files
67531ab64890Smrg    --features        display basic configuration information and exit
67541ab64890Smrg    --finish          same as \`--mode=finish'
67551ab64890Smrg    --help            display this help message and exit
67561ab64890Smrg    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
67571ab64890Smrg    --quiet           same as \`--silent'
67581ab64890Smrg    --silent          don't print informational messages
67591ab64890Smrg    --tag=TAG         use configuration variables from tag TAG
67601ab64890Smrg    --version         print version information
67611ab64890Smrg
67621ab64890SmrgMODE must be one of the following:
67631ab64890Smrg
67641ab64890Smrg      clean           remove files from the build directory
67651ab64890Smrg      compile         compile a source file into a libtool object
67661ab64890Smrg      execute         automatically set library path, then run a program
67671ab64890Smrg      finish          complete the installation of libtool libraries
67681ab64890Smrg      install         install libraries or executables
67691ab64890Smrg      link            create a library or an executable
67701ab64890Smrg      uninstall       remove libraries from an installed directory
67711ab64890Smrg
67721ab64890SmrgMODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
67731ab64890Smrga more detailed description of MODE.
67741ab64890Smrg
67751ab64890SmrgReport bugs to <bug-libtool@gnu.org>."
67761ab64890Smrg  exit $EXIT_SUCCESS
67771ab64890Smrg  ;;
67781ab64890Smrg
67791ab64890Smrgclean)
67801ab64890Smrg  $echo \
67811ab64890Smrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
67821ab64890Smrg
67831ab64890SmrgRemove files from the build directory.
67841ab64890Smrg
67851ab64890SmrgRM is the name of the program to use to delete files associated with each FILE
67861ab64890Smrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
67871ab64890Smrgto RM.
67881ab64890Smrg
67891ab64890SmrgIf FILE is a libtool library, object or program, all the files associated
67901ab64890Smrgwith it are deleted. Otherwise, only FILE itself is deleted using RM."
67911ab64890Smrg  ;;
67921ab64890Smrg
67931ab64890Smrgcompile)
67941ab64890Smrg  $echo \
67951ab64890Smrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
67961ab64890Smrg
67971ab64890SmrgCompile a source file into a libtool library object.
67981ab64890Smrg
67991ab64890SmrgThis mode accepts the following additional options:
68001ab64890Smrg
68011ab64890Smrg  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
68021ab64890Smrg  -prefer-pic       try to building PIC objects only
68031ab64890Smrg  -prefer-non-pic   try to building non-PIC objects only
68041ab64890Smrg  -static           always build a \`.o' file suitable for static linking
68051ab64890Smrg
68061ab64890SmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file
68071ab64890Smrgfrom the given SOURCEFILE.
68081ab64890Smrg
68091ab64890SmrgThe output file name is determined by removing the directory component from
68101ab64890SmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the
68111ab64890Smrglibrary object suffix, \`.lo'."
68121ab64890Smrg  ;;
68131ab64890Smrg
68141ab64890Smrgexecute)
68151ab64890Smrg  $echo \
68161ab64890Smrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
68171ab64890Smrg
68181ab64890SmrgAutomatically set library path, then run a program.
68191ab64890Smrg
68201ab64890SmrgThis mode accepts the following additional options:
68211ab64890Smrg
68221ab64890Smrg  -dlopen FILE      add the directory containing FILE to the library path
68231ab64890Smrg
68241ab64890SmrgThis mode sets the library path environment variable according to \`-dlopen'
68251ab64890Smrgflags.
68261ab64890Smrg
68271ab64890SmrgIf any of the ARGS are libtool executable wrappers, then they are translated
68281ab64890Smrginto their corresponding uninstalled binary, and any of their required library
68291ab64890Smrgdirectories are added to the library path.
68301ab64890Smrg
68311ab64890SmrgThen, COMMAND is executed, with ARGS as arguments."
68321ab64890Smrg  ;;
68331ab64890Smrg
68341ab64890Smrgfinish)
68351ab64890Smrg  $echo \
68361ab64890Smrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
68371ab64890Smrg
68381ab64890SmrgComplete the installation of libtool libraries.
68391ab64890Smrg
68401ab64890SmrgEach LIBDIR is a directory that contains libtool libraries.
68411ab64890Smrg
68421ab64890SmrgThe commands that this mode executes may require superuser privileges.  Use
68431ab64890Smrgthe \`--dry-run' option if you just want to see what would be executed."
68441ab64890Smrg  ;;
68451ab64890Smrg
68461ab64890Smrginstall)
68471ab64890Smrg  $echo \
68481ab64890Smrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
68491ab64890Smrg
68501ab64890SmrgInstall executables or libraries.
68511ab64890Smrg
68521ab64890SmrgINSTALL-COMMAND is the installation command.  The first component should be
68531ab64890Smrgeither the \`install' or \`cp' program.
68541ab64890Smrg
68551ab64890SmrgThe rest of the components are interpreted as arguments to that command (only
68561ab64890SmrgBSD-compatible install options are recognized)."
68571ab64890Smrg  ;;
68581ab64890Smrg
68591ab64890Smrglink)
68601ab64890Smrg  $echo \
68611ab64890Smrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
68621ab64890Smrg
68631ab64890SmrgLink object files or libraries together to form another library, or to
68641ab64890Smrgcreate an executable program.
68651ab64890Smrg
68661ab64890SmrgLINK-COMMAND is a command using the C compiler that you would use to create
68671ab64890Smrga program from several object files.
68681ab64890Smrg
68691ab64890SmrgThe following components of LINK-COMMAND are treated specially:
68701ab64890Smrg
68711ab64890Smrg  -all-static       do not do any dynamic linking at all
68721ab64890Smrg  -avoid-version    do not add a version suffix if possible
68731ab64890Smrg  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
68741ab64890Smrg  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
68751ab64890Smrg  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
68761ab64890Smrg  -export-symbols SYMFILE
68771ab64890Smrg                    try to export only the symbols listed in SYMFILE
68781ab64890Smrg  -export-symbols-regex REGEX
68791ab64890Smrg                    try to export only the symbols matching REGEX
68801ab64890Smrg  -LLIBDIR          search LIBDIR for required installed libraries
68811ab64890Smrg  -lNAME            OUTPUT-FILE requires the installed library libNAME
68821ab64890Smrg  -module           build a library that can dlopened
68831ab64890Smrg  -no-fast-install  disable the fast-install mode
68841ab64890Smrg  -no-install       link a not-installable executable
68851ab64890Smrg  -no-undefined     declare that a library does not refer to external symbols
68861ab64890Smrg  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
68871ab64890Smrg  -objectlist FILE  Use a list of object files found in FILE to specify objects
68881ab64890Smrg  -precious-files-regex REGEX
68891ab64890Smrg                    don't remove output files matching REGEX
68901ab64890Smrg  -release RELEASE  specify package release information
68911ab64890Smrg  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
68921ab64890Smrg  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
68931ab64890Smrg  -static           do not do any dynamic linking of uninstalled libtool libraries
68941ab64890Smrg  -static-libtool-libs
68951ab64890Smrg                    do not do any dynamic linking of libtool libraries
68961ab64890Smrg  -version-info CURRENT[:REVISION[:AGE]]
68971ab64890Smrg                    specify library version info [each variable defaults to 0]
68981ab64890Smrg
68991ab64890SmrgAll other options (arguments beginning with \`-') are ignored.
69001ab64890Smrg
69011ab64890SmrgEvery other argument is treated as a filename.  Files ending in \`.la' are
69021ab64890Smrgtreated as uninstalled libtool libraries, other files are standard or library
69031ab64890Smrgobject files.
69041ab64890Smrg
69051ab64890SmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created,
69061ab64890Smrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is
69071ab64890Smrgrequired, except when creating a convenience library.
69081ab64890Smrg
69091ab64890SmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
69101ab64890Smrgusing \`ar' and \`ranlib', or on Windows using \`lib'.
69111ab64890Smrg
69121ab64890SmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
69131ab64890Smrgis created, otherwise an executable program is created."
69141ab64890Smrg  ;;
69151ab64890Smrg
69161ab64890Smrguninstall)
69171ab64890Smrg  $echo \
69181ab64890Smrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
69191ab64890Smrg
69201ab64890SmrgRemove libraries from an installation directory.
69211ab64890Smrg
69221ab64890SmrgRM is the name of the program to use to delete files associated with each FILE
69231ab64890Smrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
69241ab64890Smrgto RM.
69251ab64890Smrg
69261ab64890SmrgIf FILE is a libtool library, all the files associated with it are deleted.
69271ab64890SmrgOtherwise, only FILE itself is deleted using RM."
69281ab64890Smrg  ;;
69291ab64890Smrg
69301ab64890Smrg*)
69311ab64890Smrg  $echo "$modename: invalid operation mode \`$mode'" 1>&2
69321ab64890Smrg  $echo "$help" 1>&2
69331ab64890Smrg  exit $EXIT_FAILURE
69341ab64890Smrg  ;;
69351ab64890Smrgesac
69361ab64890Smrg
69371ab64890Smrg$echo
69381ab64890Smrg$echo "Try \`$modename --help' for more information about other modes."
69391ab64890Smrg
69401ab64890Smrgexit $?
69411ab64890Smrg
69421ab64890Smrg# The TAGs below are defined such that we never get into a situation
69431ab64890Smrg# in which we disable both kinds of libraries.  Given conflicting
69441ab64890Smrg# choices, we go for a static library, that is the most portable,
69451ab64890Smrg# since we can't tell whether shared libraries were disabled because
69461ab64890Smrg# the user asked for that or because the platform doesn't support
69471ab64890Smrg# them.  This is particularly important on AIX, because we don't
69481ab64890Smrg# support having both static and shared libraries enabled at the same
69491ab64890Smrg# time on that platform, so we default to a shared-only configuration.
69501ab64890Smrg# If a disable-shared tag is given, we'll fallback to a static-only
69511ab64890Smrg# configuration.  But we'll never go from static-only to shared-only.
69521ab64890Smrg
69531ab64890Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
69541ab64890Smrgdisable_libs=shared
69551ab64890Smrg# ### END LIBTOOL TAG CONFIG: disable-shared
69561ab64890Smrg
69571ab64890Smrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static
69581ab64890Smrgdisable_libs=static
69591ab64890Smrg# ### END LIBTOOL TAG CONFIG: disable-static
69601ab64890Smrg
69611ab64890Smrg# Local Variables:
69621ab64890Smrg# mode:shell-script
69631ab64890Smrg# sh-indentation:2
69641ab64890Smrg# End:
6965