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