ltmain.sh revision 6df26cac
16df26cacSmrg# ltmain.sh - Provide generalized library-building support services.
26df26cacSmrg# NOTE: Changing this file will not affect anything until you rerun configure.
36df26cacSmrg#
46df26cacSmrg# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
56df26cacSmrg# Free Software Foundation, Inc.
66df26cacSmrg# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
76df26cacSmrg#
86df26cacSmrg# This program is free software; you can redistribute it and/or modify
96df26cacSmrg# it under the terms of the GNU General Public License as published by
106df26cacSmrg# the Free Software Foundation; either version 2 of the License, or
116df26cacSmrg# (at your option) any later version.
126df26cacSmrg#
136df26cacSmrg# This program is distributed in the hope that it will be useful, but
146df26cacSmrg# WITHOUT ANY WARRANTY; without even the implied warranty of
156df26cacSmrg# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
166df26cacSmrg# General Public License for more details.
176df26cacSmrg#
186df26cacSmrg# You should have received a copy of the GNU General Public License
196df26cacSmrg# along with this program; if not, write to the Free Software
206df26cacSmrg# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
216df26cacSmrg#
226df26cacSmrg# As a special exception to the GNU General Public License, if you
236df26cacSmrg# distribute this file as part of a program that contains a
246df26cacSmrg# configuration script generated by Autoconf, you may include it under
256df26cacSmrg# the same distribution terms that you use for the rest of that program.
266df26cacSmrg
276df26cacSmrgbasename="s,^.*/,,g"
286df26cacSmrg
296df26cacSmrg# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
306df26cacSmrg# is ksh but when the shell is invoked as "sh" and the current value of
316df26cacSmrg# the _XPG environment variable is not equal to 1 (one), the special
326df26cacSmrg# positional parameter $0, within a function call, is the name of the
336df26cacSmrg# function.
346df26cacSmrgprogpath="$0"
356df26cacSmrg
366df26cacSmrg# The name of this program:
376df26cacSmrgprogname=`echo "$progpath" | $SED $basename`
386df26cacSmrgmodename="$progname"
396df26cacSmrg
406df26cacSmrg# Global variables:
416df26cacSmrgEXIT_SUCCESS=0
426df26cacSmrgEXIT_FAILURE=1
436df26cacSmrg
446df26cacSmrgPROGRAM=ltmain.sh
456df26cacSmrgPACKAGE=libtool
466df26cacSmrgVERSION="1.5.22 Debian 1.5.22-4"
476df26cacSmrgTIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
486df26cacSmrg
496df26cacSmrg# See if we are running on zsh, and set the options which allow our
506df26cacSmrg# commands through without removal of \ escapes.
516df26cacSmrgif test -n "${ZSH_VERSION+set}" ; then
526df26cacSmrg  setopt NO_GLOB_SUBST
536df26cacSmrgfi
546df26cacSmrg
556df26cacSmrg# Check that we have a working $echo.
566df26cacSmrgif test "X$1" = X--no-reexec; then
576df26cacSmrg  # Discard the --no-reexec flag, and continue.
586df26cacSmrg  shift
596df26cacSmrgelif test "X$1" = X--fallback-echo; then
606df26cacSmrg  # Avoid inline document here, it may be left over
616df26cacSmrg  :
626df26cacSmrgelif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
636df26cacSmrg  # Yippee, $echo works!
646df26cacSmrg  :
656df26cacSmrgelse
666df26cacSmrg  # Restart under the correct shell, and then maybe $echo will work.
676df26cacSmrg  exec $SHELL "$progpath" --no-reexec ${1+"$@"}
686df26cacSmrgfi
696df26cacSmrg
706df26cacSmrgif test "X$1" = X--fallback-echo; then
716df26cacSmrg  # used as fallback echo
726df26cacSmrg  shift
736df26cacSmrg  cat <<EOF
746df26cacSmrg$*
756df26cacSmrgEOF
766df26cacSmrg  exit $EXIT_SUCCESS
776df26cacSmrgfi
786df26cacSmrg
796df26cacSmrgdefault_mode=
806df26cacSmrghelp="Try \`$progname --help' for more information."
816df26cacSmrgmagic="%%%MAGIC variable%%%"
826df26cacSmrgmkdir="mkdir"
836df26cacSmrgmv="mv -f"
846df26cacSmrgrm="rm -f"
856df26cacSmrg
866df26cacSmrg# Sed substitution that helps us do robust quoting.  It backslashifies
876df26cacSmrg# metacharacters that are still active within double-quoted strings.
886df26cacSmrgXsed="${SED}"' -e 1s/^X//'
896df26cacSmrgsed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
906df26cacSmrg# test EBCDIC or ASCII
916df26cacSmrgcase `echo X|tr X '\101'` in
926df26cacSmrg A) # ASCII based system
936df26cacSmrg    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
946df26cacSmrg  SP2NL='tr \040 \012'
956df26cacSmrg  NL2SP='tr \015\012 \040\040'
966df26cacSmrg  ;;
976df26cacSmrg *) # EBCDIC based system
986df26cacSmrg  SP2NL='tr \100 \n'
996df26cacSmrg  NL2SP='tr \r\n \100\100'
1006df26cacSmrg  ;;
1016df26cacSmrgesac
1026df26cacSmrg
1036df26cacSmrg# NLS nuisances.
1046df26cacSmrg# Only set LANG and LC_ALL to C if already set.
1056df26cacSmrg# These must not be set unconditionally because not all systems understand
1066df26cacSmrg# e.g. LANG=C (notably SCO).
1076df26cacSmrg# We save the old values to restore during execute mode.
1086df26cacSmrgif test "${LC_ALL+set}" = set; then
1096df26cacSmrg  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
1106df26cacSmrgfi
1116df26cacSmrgif test "${LANG+set}" = set; then
1126df26cacSmrg  save_LANG="$LANG"; LANG=C; export LANG
1136df26cacSmrgfi
1146df26cacSmrg
1156df26cacSmrg# Make sure IFS has a sensible default
1166df26cacSmrglt_nl='
1176df26cacSmrg'
1186df26cacSmrgIFS=" 	$lt_nl"
1196df26cacSmrg
1206df26cacSmrgif test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
1216df26cacSmrg  $echo "$modename: not configured to build any kind of library" 1>&2
1226df26cacSmrg  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
1236df26cacSmrg  exit $EXIT_FAILURE
1246df26cacSmrgfi
1256df26cacSmrg
1266df26cacSmrg# Global variables.
1276df26cacSmrgmode=$default_mode
1286df26cacSmrgnonopt=
1296df26cacSmrgprev=
1306df26cacSmrgprevopt=
1316df26cacSmrgrun=
1326df26cacSmrgshow="$echo"
1336df26cacSmrgshow_help=
1346df26cacSmrgexecute_dlfiles=
1356df26cacSmrgduplicate_deps=no
1366df26cacSmrgpreserve_args=
1376df26cacSmrglo2o="s/\\.lo\$/.${objext}/"
1386df26cacSmrgo2lo="s/\\.${objext}\$/.lo/"
1396df26cacSmrg
1406df26cacSmrg#####################################
1416df26cacSmrg# Shell function definitions:
1426df26cacSmrg# This seems to be the best place for them
1436df26cacSmrg
1446df26cacSmrg# func_mktempdir [string]
1456df26cacSmrg# Make a temporary directory that won't clash with other running
1466df26cacSmrg# libtool processes, and avoids race conditions if possible.  If
1476df26cacSmrg# given, STRING is the basename for that directory.
1486df26cacSmrgfunc_mktempdir ()
1496df26cacSmrg{
1506df26cacSmrg    my_template="${TMPDIR-/tmp}/${1-$progname}"
1516df26cacSmrg
1526df26cacSmrg    if test "$run" = ":"; then
1536df26cacSmrg      # Return a directory name, but don't create it in dry-run mode
1546df26cacSmrg      my_tmpdir="${my_template}-$$"
1556df26cacSmrg    else
1566df26cacSmrg
1576df26cacSmrg      # If mktemp works, use that first and foremost
1586df26cacSmrg      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
1596df26cacSmrg
1606df26cacSmrg      if test ! -d "$my_tmpdir"; then
1616df26cacSmrg	# Failing that, at least try and use $RANDOM to avoid a race
1626df26cacSmrg	my_tmpdir="${my_template}-${RANDOM-0}$$"
1636df26cacSmrg
1646df26cacSmrg	save_mktempdir_umask=`umask`
1656df26cacSmrg	umask 0077
1666df26cacSmrg	$mkdir "$my_tmpdir"
1676df26cacSmrg	umask $save_mktempdir_umask
1686df26cacSmrg      fi
1696df26cacSmrg
1706df26cacSmrg      # If we're not in dry-run mode, bomb out on failure
1716df26cacSmrg      test -d "$my_tmpdir" || {
1726df26cacSmrg        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
1736df26cacSmrg	exit $EXIT_FAILURE
1746df26cacSmrg      }
1756df26cacSmrg    fi
1766df26cacSmrg
1776df26cacSmrg    $echo "X$my_tmpdir" | $Xsed
1786df26cacSmrg}
1796df26cacSmrg
1806df26cacSmrg
1816df26cacSmrg# func_win32_libid arg
1826df26cacSmrg# return the library type of file 'arg'
1836df26cacSmrg#
1846df26cacSmrg# Need a lot of goo to handle *both* DLLs and import libs
1856df26cacSmrg# Has to be a shell function in order to 'eat' the argument
1866df26cacSmrg# that is supplied when $file_magic_command is called.
1876df26cacSmrgfunc_win32_libid ()
1886df26cacSmrg{
1896df26cacSmrg  win32_libid_type="unknown"
1906df26cacSmrg  win32_fileres=`file -L $1 2>/dev/null`
1916df26cacSmrg  case $win32_fileres in
1926df26cacSmrg  *ar\ archive\ import\ library*) # definitely import
1936df26cacSmrg    win32_libid_type="x86 archive import"
1946df26cacSmrg    ;;
1956df26cacSmrg  *ar\ archive*) # could be an import, or static
1966df26cacSmrg    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
1976df26cacSmrg      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
1986df26cacSmrg      win32_nmres=`eval $NM -f posix -A $1 | \
1996df26cacSmrg	$SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
2006df26cacSmrg      case $win32_nmres in
2016df26cacSmrg      import*)  win32_libid_type="x86 archive import";;
2026df26cacSmrg      *)        win32_libid_type="x86 archive static";;
2036df26cacSmrg      esac
2046df26cacSmrg    fi
2056df26cacSmrg    ;;
2066df26cacSmrg  *DLL*)
2076df26cacSmrg    win32_libid_type="x86 DLL"
2086df26cacSmrg    ;;
2096df26cacSmrg  *executable*) # but shell scripts are "executable" too...
2106df26cacSmrg    case $win32_fileres in
2116df26cacSmrg    *MS\ Windows\ PE\ Intel*)
2126df26cacSmrg      win32_libid_type="x86 DLL"
2136df26cacSmrg      ;;
2146df26cacSmrg    esac
2156df26cacSmrg    ;;
2166df26cacSmrg  esac
2176df26cacSmrg  $echo $win32_libid_type
2186df26cacSmrg}
2196df26cacSmrg
2206df26cacSmrg
2216df26cacSmrg# func_infer_tag arg
2226df26cacSmrg# Infer tagged configuration to use if any are available and
2236df26cacSmrg# if one wasn't chosen via the "--tag" command line option.
2246df26cacSmrg# Only attempt this if the compiler in the base compile
2256df26cacSmrg# command doesn't match the default compiler.
2266df26cacSmrg# arg is usually of the form 'gcc ...'
2276df26cacSmrgfunc_infer_tag ()
2286df26cacSmrg{
2296df26cacSmrg    if test -n "$available_tags" && test -z "$tagname"; then
2306df26cacSmrg      CC_quoted=
2316df26cacSmrg      for arg in $CC; do
2326df26cacSmrg	case $arg in
2336df26cacSmrg	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
2346df26cacSmrg	  arg="\"$arg\""
2356df26cacSmrg	  ;;
2366df26cacSmrg	esac
2376df26cacSmrg	CC_quoted="$CC_quoted $arg"
2386df26cacSmrg      done
2396df26cacSmrg      case $@ in
2406df26cacSmrg      # Blanks in the command may have been stripped by the calling shell,
2416df26cacSmrg      # but not from the CC environment variable when configure was run.
2426df26cacSmrg      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
2436df26cacSmrg      # Blanks at the start of $base_compile will cause this to fail
2446df26cacSmrg      # if we don't check for them as well.
2456df26cacSmrg      *)
2466df26cacSmrg	for z in $available_tags; do
2476df26cacSmrg	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
2486df26cacSmrg	    # Evaluate the configuration.
2496df26cacSmrg	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
2506df26cacSmrg	    CC_quoted=
2516df26cacSmrg	    for arg in $CC; do
2526df26cacSmrg	    # Double-quote args containing other shell metacharacters.
2536df26cacSmrg	    case $arg in
2546df26cacSmrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
2556df26cacSmrg	      arg="\"$arg\""
2566df26cacSmrg	      ;;
2576df26cacSmrg	    esac
2586df26cacSmrg	    CC_quoted="$CC_quoted $arg"
2596df26cacSmrg	  done
2606df26cacSmrg	    case "$@ " in
2616df26cacSmrg	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
2626df26cacSmrg	      # The compiler in the base compile command matches
2636df26cacSmrg	      # the one in the tagged configuration.
2646df26cacSmrg	      # Assume this is the tagged configuration we want.
2656df26cacSmrg	      tagname=$z
2666df26cacSmrg	      break
2676df26cacSmrg	      ;;
2686df26cacSmrg	    esac
2696df26cacSmrg	  fi
2706df26cacSmrg	done
2716df26cacSmrg	# If $tagname still isn't set, then no tagged configuration
2726df26cacSmrg	# was found and let the user know that the "--tag" command
2736df26cacSmrg	# line option must be used.
2746df26cacSmrg	if test -z "$tagname"; then
2756df26cacSmrg	  $echo "$modename: unable to infer tagged configuration"
2766df26cacSmrg	  $echo "$modename: specify a tag with \`--tag'" 1>&2
2776df26cacSmrg	  exit $EXIT_FAILURE
2786df26cacSmrg#        else
2796df26cacSmrg#          $echo "$modename: using $tagname tagged configuration"
2806df26cacSmrg	fi
2816df26cacSmrg	;;
2826df26cacSmrg      esac
2836df26cacSmrg    fi
2846df26cacSmrg}
2856df26cacSmrg
2866df26cacSmrg
2876df26cacSmrg# func_extract_an_archive dir oldlib
2886df26cacSmrgfunc_extract_an_archive ()
2896df26cacSmrg{
2906df26cacSmrg    f_ex_an_ar_dir="$1"; shift
2916df26cacSmrg    f_ex_an_ar_oldlib="$1"
2926df26cacSmrg
2936df26cacSmrg    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
2946df26cacSmrg    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
2956df26cacSmrg    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
2966df26cacSmrg     :
2976df26cacSmrg    else
2986df26cacSmrg      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
2996df26cacSmrg      exit $EXIT_FAILURE
3006df26cacSmrg    fi
3016df26cacSmrg}
3026df26cacSmrg
3036df26cacSmrg# func_extract_archives gentop oldlib ...
3046df26cacSmrgfunc_extract_archives ()
3056df26cacSmrg{
3066df26cacSmrg    my_gentop="$1"; shift
3076df26cacSmrg    my_oldlibs=${1+"$@"}
3086df26cacSmrg    my_oldobjs=""
3096df26cacSmrg    my_xlib=""
3106df26cacSmrg    my_xabs=""
3116df26cacSmrg    my_xdir=""
3126df26cacSmrg    my_status=""
3136df26cacSmrg
3146df26cacSmrg    $show "${rm}r $my_gentop"
3156df26cacSmrg    $run ${rm}r "$my_gentop"
3166df26cacSmrg    $show "$mkdir $my_gentop"
3176df26cacSmrg    $run $mkdir "$my_gentop"
3186df26cacSmrg    my_status=$?
3196df26cacSmrg    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
3206df26cacSmrg      exit $my_status
3216df26cacSmrg    fi
3226df26cacSmrg
3236df26cacSmrg    for my_xlib in $my_oldlibs; do
3246df26cacSmrg      # Extract the objects.
3256df26cacSmrg      case $my_xlib in
3266df26cacSmrg	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
3276df26cacSmrg	*) my_xabs=`pwd`"/$my_xlib" ;;
3286df26cacSmrg      esac
3296df26cacSmrg      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
3306df26cacSmrg      my_xdir="$my_gentop/$my_xlib"
3316df26cacSmrg
3326df26cacSmrg      $show "${rm}r $my_xdir"
3336df26cacSmrg      $run ${rm}r "$my_xdir"
3346df26cacSmrg      $show "$mkdir $my_xdir"
3356df26cacSmrg      $run $mkdir "$my_xdir"
3366df26cacSmrg      exit_status=$?
3376df26cacSmrg      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
3386df26cacSmrg	exit $exit_status
3396df26cacSmrg      fi
3406df26cacSmrg      case $host in
3416df26cacSmrg      *-darwin*)
3426df26cacSmrg	$show "Extracting $my_xabs"
3436df26cacSmrg	# Do not bother doing anything if just a dry run
3446df26cacSmrg	if test -z "$run"; then
3456df26cacSmrg	  darwin_orig_dir=`pwd`
3466df26cacSmrg	  cd $my_xdir || exit $?
3476df26cacSmrg	  darwin_archive=$my_xabs
3486df26cacSmrg	  darwin_curdir=`pwd`
3496df26cacSmrg	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
3506df26cacSmrg	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
3516df26cacSmrg	  if test -n "$darwin_arches"; then 
3526df26cacSmrg	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
3536df26cacSmrg	    darwin_arch=
3546df26cacSmrg	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
3556df26cacSmrg	    for darwin_arch in  $darwin_arches ; do
3566df26cacSmrg	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3576df26cacSmrg	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
3586df26cacSmrg	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
3596df26cacSmrg	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
3606df26cacSmrg	      cd "$darwin_curdir"
3616df26cacSmrg	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
3626df26cacSmrg	    done # $darwin_arches
3636df26cacSmrg      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
3646df26cacSmrg	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
3656df26cacSmrg	    darwin_file=
3666df26cacSmrg	    darwin_files=
3676df26cacSmrg	    for darwin_file in $darwin_filelist; do
3686df26cacSmrg	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
3696df26cacSmrg	      lipo -create -output "$darwin_file" $darwin_files
3706df26cacSmrg	    done # $darwin_filelist
3716df26cacSmrg	    ${rm}r unfat-$$
3726df26cacSmrg	    cd "$darwin_orig_dir"
3736df26cacSmrg	  else
3746df26cacSmrg	    cd "$darwin_orig_dir"
3756df26cacSmrg 	    func_extract_an_archive "$my_xdir" "$my_xabs"
3766df26cacSmrg	  fi # $darwin_arches
3776df26cacSmrg	fi # $run
3786df26cacSmrg	;;
3796df26cacSmrg      *)
3806df26cacSmrg        func_extract_an_archive "$my_xdir" "$my_xabs"
3816df26cacSmrg        ;;
3826df26cacSmrg      esac
3836df26cacSmrg      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
3846df26cacSmrg    done
3856df26cacSmrg    func_extract_archives_result="$my_oldobjs"
3866df26cacSmrg}
3876df26cacSmrg# End of Shell function definitions
3886df26cacSmrg#####################################
3896df26cacSmrg
3906df26cacSmrg# Darwin sucks
3916df26cacSmrgeval std_shrext=\"$shrext_cmds\"
3926df26cacSmrg
3936df26cacSmrgdisable_libs=no
3946df26cacSmrg
3956df26cacSmrg# Parse our command line options once, thoroughly.
3966df26cacSmrgwhile test "$#" -gt 0
3976df26cacSmrgdo
3986df26cacSmrg  arg="$1"
3996df26cacSmrg  shift
4006df26cacSmrg
4016df26cacSmrg  case $arg in
4026df26cacSmrg  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
4036df26cacSmrg  *) optarg= ;;
4046df26cacSmrg  esac
4056df26cacSmrg
4066df26cacSmrg  # If the previous option needs an argument, assign it.
4076df26cacSmrg  if test -n "$prev"; then
4086df26cacSmrg    case $prev in
4096df26cacSmrg    execute_dlfiles)
4106df26cacSmrg      execute_dlfiles="$execute_dlfiles $arg"
4116df26cacSmrg      ;;
4126df26cacSmrg    tag)
4136df26cacSmrg      tagname="$arg"
4146df26cacSmrg      preserve_args="${preserve_args}=$arg"
4156df26cacSmrg
4166df26cacSmrg      # Check whether tagname contains only valid characters
4176df26cacSmrg      case $tagname in
4186df26cacSmrg      *[!-_A-Za-z0-9,/]*)
4196df26cacSmrg	$echo "$progname: invalid tag name: $tagname" 1>&2
4206df26cacSmrg	exit $EXIT_FAILURE
4216df26cacSmrg	;;
4226df26cacSmrg      esac
4236df26cacSmrg
4246df26cacSmrg      case $tagname in
4256df26cacSmrg      CC)
4266df26cacSmrg	# Don't test for the "default" C tag, as we know, it's there, but
4276df26cacSmrg	# not specially marked.
4286df26cacSmrg	;;
4296df26cacSmrg      *)
4306df26cacSmrg	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
4316df26cacSmrg	  taglist="$taglist $tagname"
4326df26cacSmrg	  # Evaluate the configuration.
4336df26cacSmrg	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
4346df26cacSmrg	else
4356df26cacSmrg	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
4366df26cacSmrg	fi
4376df26cacSmrg	;;
4386df26cacSmrg      esac
4396df26cacSmrg      ;;
4406df26cacSmrg    *)
4416df26cacSmrg      eval "$prev=\$arg"
4426df26cacSmrg      ;;
4436df26cacSmrg    esac
4446df26cacSmrg
4456df26cacSmrg    prev=
4466df26cacSmrg    prevopt=
4476df26cacSmrg    continue
4486df26cacSmrg  fi
4496df26cacSmrg
4506df26cacSmrg  # Have we seen a non-optional argument yet?
4516df26cacSmrg  case $arg in
4526df26cacSmrg  --help)
4536df26cacSmrg    show_help=yes
4546df26cacSmrg    ;;
4556df26cacSmrg
4566df26cacSmrg  --version)
4576df26cacSmrg    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
4586df26cacSmrg    $echo
4596df26cacSmrg    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
4606df26cacSmrg    $echo "This is free software; see the source for copying conditions.  There is NO"
4616df26cacSmrg    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
4626df26cacSmrg    exit $?
4636df26cacSmrg    ;;
4646df26cacSmrg
4656df26cacSmrg  --config)
4666df26cacSmrg    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
4676df26cacSmrg    # Now print the configurations for the tags.
4686df26cacSmrg    for tagname in $taglist; do
4696df26cacSmrg      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
4706df26cacSmrg    done
4716df26cacSmrg    exit $?
4726df26cacSmrg    ;;
4736df26cacSmrg
4746df26cacSmrg  --debug)
4756df26cacSmrg    $echo "$progname: enabling shell trace mode"
4766df26cacSmrg    set -x
4776df26cacSmrg    preserve_args="$preserve_args $arg"
4786df26cacSmrg    ;;
4796df26cacSmrg
4806df26cacSmrg  --dry-run | -n)
4816df26cacSmrg    run=:
4826df26cacSmrg    ;;
4836df26cacSmrg
4846df26cacSmrg  --features)
4856df26cacSmrg    $echo "host: $host"
4866df26cacSmrg    if test "$build_libtool_libs" = yes; then
4876df26cacSmrg      $echo "enable shared libraries"
4886df26cacSmrg    else
4896df26cacSmrg      $echo "disable shared libraries"
4906df26cacSmrg    fi
4916df26cacSmrg    if test "$build_old_libs" = yes; then
4926df26cacSmrg      $echo "enable static libraries"
4936df26cacSmrg    else
4946df26cacSmrg      $echo "disable static libraries"
4956df26cacSmrg    fi
4966df26cacSmrg    exit $?
4976df26cacSmrg    ;;
4986df26cacSmrg
4996df26cacSmrg  --finish) mode="finish" ;;
5006df26cacSmrg
5016df26cacSmrg  --mode) prevopt="--mode" prev=mode ;;
5026df26cacSmrg  --mode=*) mode="$optarg" ;;
5036df26cacSmrg
5046df26cacSmrg  --preserve-dup-deps) duplicate_deps="yes" ;;
5056df26cacSmrg
5066df26cacSmrg  --quiet | --silent)
5076df26cacSmrg    show=:
5086df26cacSmrg    preserve_args="$preserve_args $arg"
5096df26cacSmrg    ;;
5106df26cacSmrg
5116df26cacSmrg  --tag)
5126df26cacSmrg    prevopt="--tag"
5136df26cacSmrg    prev=tag
5146df26cacSmrg    preserve_args="$preserve_args --tag"
5156df26cacSmrg    ;;
5166df26cacSmrg  --tag=*)
5176df26cacSmrg    set tag "$optarg" ${1+"$@"}
5186df26cacSmrg    shift
5196df26cacSmrg    prev=tag
5206df26cacSmrg    preserve_args="$preserve_args --tag"
5216df26cacSmrg    ;;
5226df26cacSmrg
5236df26cacSmrg  -dlopen)
5246df26cacSmrg    prevopt="-dlopen"
5256df26cacSmrg    prev=execute_dlfiles
5266df26cacSmrg    ;;
5276df26cacSmrg
5286df26cacSmrg  -*)
5296df26cacSmrg    $echo "$modename: unrecognized option \`$arg'" 1>&2
5306df26cacSmrg    $echo "$help" 1>&2
5316df26cacSmrg    exit $EXIT_FAILURE
5326df26cacSmrg    ;;
5336df26cacSmrg
5346df26cacSmrg  *)
5356df26cacSmrg    nonopt="$arg"
5366df26cacSmrg    break
5376df26cacSmrg    ;;
5386df26cacSmrg  esac
5396df26cacSmrgdone
5406df26cacSmrg
5416df26cacSmrgif test -n "$prevopt"; then
5426df26cacSmrg  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
5436df26cacSmrg  $echo "$help" 1>&2
5446df26cacSmrg  exit $EXIT_FAILURE
5456df26cacSmrgfi
5466df26cacSmrg
5476df26cacSmrgcase $disable_libs in
5486df26cacSmrgno) 
5496df26cacSmrg  ;;
5506df26cacSmrgshared)
5516df26cacSmrg  build_libtool_libs=no
5526df26cacSmrg  build_old_libs=yes
5536df26cacSmrg  ;;
5546df26cacSmrgstatic)
5556df26cacSmrg  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
5566df26cacSmrg  ;;
5576df26cacSmrgesac
5586df26cacSmrg
5596df26cacSmrg# If this variable is set in any of the actions, the command in it
5606df26cacSmrg# will be execed at the end.  This prevents here-documents from being
5616df26cacSmrg# left over by shells.
5626df26cacSmrgexec_cmd=
5636df26cacSmrg
5646df26cacSmrgif test -z "$show_help"; then
5656df26cacSmrg
5666df26cacSmrg  # Infer the operation mode.
5676df26cacSmrg  if test -z "$mode"; then
5686df26cacSmrg    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
5696df26cacSmrg    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
5706df26cacSmrg    case $nonopt in
5716df26cacSmrg    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
5726df26cacSmrg      mode=link
5736df26cacSmrg      for arg
5746df26cacSmrg      do
5756df26cacSmrg	case $arg in
5766df26cacSmrg	-c)
5776df26cacSmrg	   mode=compile
5786df26cacSmrg	   break
5796df26cacSmrg	   ;;
5806df26cacSmrg	esac
5816df26cacSmrg      done
5826df26cacSmrg      ;;
5836df26cacSmrg    *db | *dbx | *strace | *truss)
5846df26cacSmrg      mode=execute
5856df26cacSmrg      ;;
5866df26cacSmrg    *install*|cp|mv)
5876df26cacSmrg      mode=install
5886df26cacSmrg      ;;
5896df26cacSmrg    *rm)
5906df26cacSmrg      mode=uninstall
5916df26cacSmrg      ;;
5926df26cacSmrg    *)
5936df26cacSmrg      # If we have no mode, but dlfiles were specified, then do execute mode.
5946df26cacSmrg      test -n "$execute_dlfiles" && mode=execute
5956df26cacSmrg
5966df26cacSmrg      # Just use the default operation mode.
5976df26cacSmrg      if test -z "$mode"; then
5986df26cacSmrg	if test -n "$nonopt"; then
5996df26cacSmrg	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
6006df26cacSmrg	else
6016df26cacSmrg	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
6026df26cacSmrg	fi
6036df26cacSmrg      fi
6046df26cacSmrg      ;;
6056df26cacSmrg    esac
6066df26cacSmrg  fi
6076df26cacSmrg
6086df26cacSmrg  # Only execute mode is allowed to have -dlopen flags.
6096df26cacSmrg  if test -n "$execute_dlfiles" && test "$mode" != execute; then
6106df26cacSmrg    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
6116df26cacSmrg    $echo "$help" 1>&2
6126df26cacSmrg    exit $EXIT_FAILURE
6136df26cacSmrg  fi
6146df26cacSmrg
6156df26cacSmrg  # Change the help message to a mode-specific one.
6166df26cacSmrg  generic_help="$help"
6176df26cacSmrg  help="Try \`$modename --help --mode=$mode' for more information."
6186df26cacSmrg
6196df26cacSmrg  # These modes are in order of execution frequency so that they run quickly.
6206df26cacSmrg  case $mode in
6216df26cacSmrg  # libtool compile mode
6226df26cacSmrg  compile)
6236df26cacSmrg    modename="$modename: compile"
6246df26cacSmrg    # Get the compilation command and the source file.
6256df26cacSmrg    base_compile=
6266df26cacSmrg    srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
6276df26cacSmrg    suppress_opt=yes
6286df26cacSmrg    suppress_output=
6296df26cacSmrg    arg_mode=normal
6306df26cacSmrg    libobj=
6316df26cacSmrg    later=
6326df26cacSmrg
6336df26cacSmrg    for arg
6346df26cacSmrg    do
6356df26cacSmrg      case $arg_mode in
6366df26cacSmrg      arg  )
6376df26cacSmrg	# do not "continue".  Instead, add this to base_compile
6386df26cacSmrg	lastarg="$arg"
6396df26cacSmrg	arg_mode=normal
6406df26cacSmrg	;;
6416df26cacSmrg
6426df26cacSmrg      target )
6436df26cacSmrg	libobj="$arg"
6446df26cacSmrg	arg_mode=normal
6456df26cacSmrg	continue
6466df26cacSmrg	;;
6476df26cacSmrg
6486df26cacSmrg      normal )
6496df26cacSmrg	# Accept any command-line options.
6506df26cacSmrg	case $arg in
6516df26cacSmrg	-o)
6526df26cacSmrg	  if test -n "$libobj" ; then
6536df26cacSmrg	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
6546df26cacSmrg	    exit $EXIT_FAILURE
6556df26cacSmrg	  fi
6566df26cacSmrg	  arg_mode=target
6576df26cacSmrg	  continue
6586df26cacSmrg	  ;;
6596df26cacSmrg
6606df26cacSmrg	-static | -prefer-pic | -prefer-non-pic)
6616df26cacSmrg	  later="$later $arg"
6626df26cacSmrg	  continue
6636df26cacSmrg	  ;;
6646df26cacSmrg
6656df26cacSmrg	-no-suppress)
6666df26cacSmrg	  suppress_opt=no
6676df26cacSmrg	  continue
6686df26cacSmrg	  ;;
6696df26cacSmrg
6706df26cacSmrg	-Xcompiler)
6716df26cacSmrg	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
6726df26cacSmrg	  continue      #  The current "srcfile" will either be retained or
6736df26cacSmrg	  ;;            #  replaced later.  I would guess that would be a bug.
6746df26cacSmrg
6756df26cacSmrg	-Wc,*)
6766df26cacSmrg	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
6776df26cacSmrg	  lastarg=
6786df26cacSmrg	  save_ifs="$IFS"; IFS=','
6796df26cacSmrg 	  for arg in $args; do
6806df26cacSmrg	    IFS="$save_ifs"
6816df26cacSmrg
6826df26cacSmrg	    # Double-quote args containing other shell metacharacters.
6836df26cacSmrg	    # Many Bourne shells cannot handle close brackets correctly
6846df26cacSmrg	    # in scan sets, so we specify it separately.
6856df26cacSmrg	    case $arg in
6866df26cacSmrg	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
6876df26cacSmrg	      arg="\"$arg\""
6886df26cacSmrg	      ;;
6896df26cacSmrg	    esac
6906df26cacSmrg	    lastarg="$lastarg $arg"
6916df26cacSmrg	  done
6926df26cacSmrg	  IFS="$save_ifs"
6936df26cacSmrg	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
6946df26cacSmrg
6956df26cacSmrg	  # Add the arguments to base_compile.
6966df26cacSmrg	  base_compile="$base_compile $lastarg"
6976df26cacSmrg	  continue
6986df26cacSmrg	  ;;
6996df26cacSmrg
7006df26cacSmrg	* )
7016df26cacSmrg	  # Accept the current argument as the source file.
7026df26cacSmrg	  # The previous "srcfile" becomes the current argument.
7036df26cacSmrg	  #
7046df26cacSmrg	  lastarg="$srcfile"
7056df26cacSmrg	  srcfile="$arg"
7066df26cacSmrg	  ;;
7076df26cacSmrg	esac  #  case $arg
7086df26cacSmrg	;;
7096df26cacSmrg      esac    #  case $arg_mode
7106df26cacSmrg
7116df26cacSmrg      # Aesthetically quote the previous argument.
7126df26cacSmrg      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
7136df26cacSmrg
7146df26cacSmrg      case $lastarg in
7156df26cacSmrg      # Double-quote args containing other shell metacharacters.
7166df26cacSmrg      # Many Bourne shells cannot handle close brackets correctly
7176df26cacSmrg      # in scan sets, and some SunOS ksh mistreat backslash-escaping
7186df26cacSmrg      # in scan sets (worked around with variable expansion),
7196df26cacSmrg      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
7206df26cacSmrg      # at all, so we specify them separately.
7216df26cacSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
7226df26cacSmrg	lastarg="\"$lastarg\""
7236df26cacSmrg	;;
7246df26cacSmrg      esac
7256df26cacSmrg
7266df26cacSmrg      base_compile="$base_compile $lastarg"
7276df26cacSmrg    done # for arg
7286df26cacSmrg
7296df26cacSmrg    case $arg_mode in
7306df26cacSmrg    arg)
7316df26cacSmrg      $echo "$modename: you must specify an argument for -Xcompile"
7326df26cacSmrg      exit $EXIT_FAILURE
7336df26cacSmrg      ;;
7346df26cacSmrg    target)
7356df26cacSmrg      $echo "$modename: you must specify a target with \`-o'" 1>&2
7366df26cacSmrg      exit $EXIT_FAILURE
7376df26cacSmrg      ;;
7386df26cacSmrg    *)
7396df26cacSmrg      # Get the name of the library object.
7406df26cacSmrg      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
7416df26cacSmrg      ;;
7426df26cacSmrg    esac
7436df26cacSmrg
7446df26cacSmrg    # Recognize several different file suffixes.
7456df26cacSmrg    # If the user specifies -o file.o, it is replaced with file.lo
7466df26cacSmrg    xform='[cCFSifmso]'
7476df26cacSmrg    case $libobj in
7486df26cacSmrg    *.ada) xform=ada ;;
7496df26cacSmrg    *.adb) xform=adb ;;
7506df26cacSmrg    *.ads) xform=ads ;;
7516df26cacSmrg    *.asm) xform=asm ;;
7526df26cacSmrg    *.c++) xform=c++ ;;
7536df26cacSmrg    *.cc) xform=cc ;;
7546df26cacSmrg    *.ii) xform=ii ;;
7556df26cacSmrg    *.class) xform=class ;;
7566df26cacSmrg    *.cpp) xform=cpp ;;
7576df26cacSmrg    *.cxx) xform=cxx ;;
7586df26cacSmrg    *.f90) xform=f90 ;;
7596df26cacSmrg    *.for) xform=for ;;
7606df26cacSmrg    *.java) xform=java ;;
7616df26cacSmrg    esac
7626df26cacSmrg
7636df26cacSmrg    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
7646df26cacSmrg
7656df26cacSmrg    case $libobj in
7666df26cacSmrg    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
7676df26cacSmrg    *)
7686df26cacSmrg      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
7696df26cacSmrg      exit $EXIT_FAILURE
7706df26cacSmrg      ;;
7716df26cacSmrg    esac
7726df26cacSmrg
7736df26cacSmrg    func_infer_tag $base_compile
7746df26cacSmrg
7756df26cacSmrg    for arg in $later; do
7766df26cacSmrg      case $arg in
7776df26cacSmrg      -static)
7786df26cacSmrg	build_old_libs=yes
7796df26cacSmrg	continue
7806df26cacSmrg	;;
7816df26cacSmrg
7826df26cacSmrg      -prefer-pic)
7836df26cacSmrg	pic_mode=yes
7846df26cacSmrg	continue
7856df26cacSmrg	;;
7866df26cacSmrg
7876df26cacSmrg      -prefer-non-pic)
7886df26cacSmrg	pic_mode=no
7896df26cacSmrg	continue
7906df26cacSmrg	;;
7916df26cacSmrg      esac
7926df26cacSmrg    done
7936df26cacSmrg
7946df26cacSmrg    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
7956df26cacSmrg    case $qlibobj in
7966df26cacSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
7976df26cacSmrg	qlibobj="\"$qlibobj\"" ;;
7986df26cacSmrg    esac
7996df26cacSmrg    test "X$libobj" != "X$qlibobj" \
8006df26cacSmrg	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
8016df26cacSmrg	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
8026df26cacSmrg    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
8036df26cacSmrg    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
8046df26cacSmrg    if test "X$xdir" = "X$obj"; then
8056df26cacSmrg      xdir=
8066df26cacSmrg    else
8076df26cacSmrg      xdir=$xdir/
8086df26cacSmrg    fi
8096df26cacSmrg    lobj=${xdir}$objdir/$objname
8106df26cacSmrg
8116df26cacSmrg    if test -z "$base_compile"; then
8126df26cacSmrg      $echo "$modename: you must specify a compilation command" 1>&2
8136df26cacSmrg      $echo "$help" 1>&2
8146df26cacSmrg      exit $EXIT_FAILURE
8156df26cacSmrg    fi
8166df26cacSmrg
8176df26cacSmrg    # Delete any leftover library objects.
8186df26cacSmrg    if test "$build_old_libs" = yes; then
8196df26cacSmrg      removelist="$obj $lobj $libobj ${libobj}T"
8206df26cacSmrg    else
8216df26cacSmrg      removelist="$lobj $libobj ${libobj}T"
8226df26cacSmrg    fi
8236df26cacSmrg
8246df26cacSmrg    $run $rm $removelist
8256df26cacSmrg    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
8266df26cacSmrg
8276df26cacSmrg    # On Cygwin there's no "real" PIC flag so we must build both object types
8286df26cacSmrg    case $host_os in
8296df26cacSmrg    cygwin* | mingw* | pw32* | os2*)
8306df26cacSmrg      pic_mode=default
8316df26cacSmrg      ;;
8326df26cacSmrg    esac
8336df26cacSmrg    if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then
8346df26cacSmrg      # non-PIC code in shared libraries is not supported
8356df26cacSmrg      pic_mode=default
8366df26cacSmrg    fi
8376df26cacSmrg
8386df26cacSmrg    # Calculate the filename of the output object if compiler does
8396df26cacSmrg    # not support -o with -c
8406df26cacSmrg    if test "$compiler_c_o" = no; then
8416df26cacSmrg      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
8426df26cacSmrg      lockfile="$output_obj.lock"
8436df26cacSmrg      removelist="$removelist $output_obj $lockfile"
8446df26cacSmrg      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
8456df26cacSmrg    else
8466df26cacSmrg      output_obj=
8476df26cacSmrg      need_locks=no
8486df26cacSmrg      lockfile=
8496df26cacSmrg    fi
8506df26cacSmrg
8516df26cacSmrg    # Lock this critical section if it is needed
8526df26cacSmrg    # We use this script file to make the link, it avoids creating a new file
8536df26cacSmrg    if test "$need_locks" = yes; then
8546df26cacSmrg      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
8556df26cacSmrg	$show "Waiting for $lockfile to be removed"
8566df26cacSmrg	sleep 2
8576df26cacSmrg      done
8586df26cacSmrg    elif test "$need_locks" = warn; then
8596df26cacSmrg      if test -f "$lockfile"; then
8606df26cacSmrg	$echo "\
8616df26cacSmrg*** ERROR, $lockfile exists and contains:
8626df26cacSmrg`cat $lockfile 2>/dev/null`
8636df26cacSmrg
8646df26cacSmrgThis indicates that another process is trying to use the same
8656df26cacSmrgtemporary object file, and libtool could not work around it because
8666df26cacSmrgyour compiler does not support \`-c' and \`-o' together.  If you
8676df26cacSmrgrepeat this compilation, it may succeed, by chance, but you had better
8686df26cacSmrgavoid parallel builds (make -j) in this platform, or get a better
8696df26cacSmrgcompiler."
8706df26cacSmrg
8716df26cacSmrg	$run $rm $removelist
8726df26cacSmrg	exit $EXIT_FAILURE
8736df26cacSmrg      fi
8746df26cacSmrg      $echo "$srcfile" > "$lockfile"
8756df26cacSmrg    fi
8766df26cacSmrg
8776df26cacSmrg    if test -n "$fix_srcfile_path"; then
8786df26cacSmrg      eval srcfile=\"$fix_srcfile_path\"
8796df26cacSmrg    fi
8806df26cacSmrg    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
8816df26cacSmrg    case $qsrcfile in
8826df26cacSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
8836df26cacSmrg      qsrcfile="\"$qsrcfile\"" ;;
8846df26cacSmrg    esac
8856df26cacSmrg
8866df26cacSmrg    $run $rm "$libobj" "${libobj}T"
8876df26cacSmrg
8886df26cacSmrg    # Create a libtool object file (analogous to a ".la" file),
8896df26cacSmrg    # but don't create it if we're doing a dry run.
8906df26cacSmrg    test -z "$run" && cat > ${libobj}T <<EOF
8916df26cacSmrg# $libobj - a libtool object file
8926df26cacSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
8936df26cacSmrg#
8946df26cacSmrg# Please DO NOT delete this file!
8956df26cacSmrg# It is necessary for linking the library.
8966df26cacSmrg
8976df26cacSmrg# Name of the PIC object.
8986df26cacSmrgEOF
8996df26cacSmrg
9006df26cacSmrg    # Only build a PIC object if we are building libtool libraries.
9016df26cacSmrg    if test "$build_libtool_libs" = yes; then
9026df26cacSmrg      # Without this assignment, base_compile gets emptied.
9036df26cacSmrg      fbsd_hideous_sh_bug=$base_compile
9046df26cacSmrg
9056df26cacSmrg      if test "$pic_mode" != no; then
9066df26cacSmrg	command="$base_compile $qsrcfile $pic_flag"
9076df26cacSmrg      else
9086df26cacSmrg	# Don't build PIC code
9096df26cacSmrg	command="$base_compile $qsrcfile"
9106df26cacSmrg      fi
9116df26cacSmrg
9126df26cacSmrg      if test ! -d "${xdir}$objdir"; then
9136df26cacSmrg	$show "$mkdir ${xdir}$objdir"
9146df26cacSmrg	$run $mkdir ${xdir}$objdir
9156df26cacSmrg	exit_status=$?
9166df26cacSmrg	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
9176df26cacSmrg	  exit $exit_status
9186df26cacSmrg	fi
9196df26cacSmrg      fi
9206df26cacSmrg
9216df26cacSmrg      if test -z "$output_obj"; then
9226df26cacSmrg	# Place PIC objects in $objdir
9236df26cacSmrg	command="$command -o $lobj"
9246df26cacSmrg      fi
9256df26cacSmrg
9266df26cacSmrg      $run $rm "$lobj" "$output_obj"
9276df26cacSmrg
9286df26cacSmrg      $show "$command"
9296df26cacSmrg      if $run eval "$command"; then :
9306df26cacSmrg      else
9316df26cacSmrg	test -n "$output_obj" && $run $rm $removelist
9326df26cacSmrg	exit $EXIT_FAILURE
9336df26cacSmrg      fi
9346df26cacSmrg
9356df26cacSmrg      if test "$need_locks" = warn &&
9366df26cacSmrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
9376df26cacSmrg	$echo "\
9386df26cacSmrg*** ERROR, $lockfile contains:
9396df26cacSmrg`cat $lockfile 2>/dev/null`
9406df26cacSmrg
9416df26cacSmrgbut it should contain:
9426df26cacSmrg$srcfile
9436df26cacSmrg
9446df26cacSmrgThis indicates that another process is trying to use the same
9456df26cacSmrgtemporary object file, and libtool could not work around it because
9466df26cacSmrgyour compiler does not support \`-c' and \`-o' together.  If you
9476df26cacSmrgrepeat this compilation, it may succeed, by chance, but you had better
9486df26cacSmrgavoid parallel builds (make -j) in this platform, or get a better
9496df26cacSmrgcompiler."
9506df26cacSmrg
9516df26cacSmrg	$run $rm $removelist
9526df26cacSmrg	exit $EXIT_FAILURE
9536df26cacSmrg      fi
9546df26cacSmrg
9556df26cacSmrg      # Just move the object if needed, then go on to compile the next one
9566df26cacSmrg      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
9576df26cacSmrg	$show "$mv $output_obj $lobj"
9586df26cacSmrg	if $run $mv $output_obj $lobj; then :
9596df26cacSmrg	else
9606df26cacSmrg	  error=$?
9616df26cacSmrg	  $run $rm $removelist
9626df26cacSmrg	  exit $error
9636df26cacSmrg	fi
9646df26cacSmrg      fi
9656df26cacSmrg
9666df26cacSmrg      # Append the name of the PIC object to the libtool object file.
9676df26cacSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
9686df26cacSmrgpic_object='$objdir/$objname'
9696df26cacSmrg
9706df26cacSmrgEOF
9716df26cacSmrg
9726df26cacSmrg      # Allow error messages only from the first compilation.
9736df26cacSmrg      if test "$suppress_opt" = yes; then
9746df26cacSmrg        suppress_output=' >/dev/null 2>&1'
9756df26cacSmrg      fi
9766df26cacSmrg    else
9776df26cacSmrg      # No PIC object so indicate it doesn't exist in the libtool
9786df26cacSmrg      # object file.
9796df26cacSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
9806df26cacSmrgpic_object=none
9816df26cacSmrg
9826df26cacSmrgEOF
9836df26cacSmrg    fi
9846df26cacSmrg
9856df26cacSmrg    # Only build a position-dependent object if we build old libraries.
9866df26cacSmrg    if test "$build_old_libs" = yes; then
9876df26cacSmrg      if test "$pic_mode" != yes; then
9886df26cacSmrg	# Don't build PIC code
9896df26cacSmrg	command="$base_compile $qsrcfile"
9906df26cacSmrg      else
9916df26cacSmrg	command="$base_compile $qsrcfile $pic_flag"
9926df26cacSmrg      fi
9936df26cacSmrg      if test "$compiler_c_o" = yes; then
9946df26cacSmrg	command="$command -o $obj"
9956df26cacSmrg      fi
9966df26cacSmrg
9976df26cacSmrg      # Suppress compiler output if we already did a PIC compilation.
9986df26cacSmrg      command="$command$suppress_output"
9996df26cacSmrg      $run $rm "$obj" "$output_obj"
10006df26cacSmrg      $show "$command"
10016df26cacSmrg      if $run eval "$command"; then :
10026df26cacSmrg      else
10036df26cacSmrg	$run $rm $removelist
10046df26cacSmrg	exit $EXIT_FAILURE
10056df26cacSmrg      fi
10066df26cacSmrg
10076df26cacSmrg      if test "$need_locks" = warn &&
10086df26cacSmrg	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
10096df26cacSmrg	$echo "\
10106df26cacSmrg*** ERROR, $lockfile contains:
10116df26cacSmrg`cat $lockfile 2>/dev/null`
10126df26cacSmrg
10136df26cacSmrgbut it should contain:
10146df26cacSmrg$srcfile
10156df26cacSmrg
10166df26cacSmrgThis indicates that another process is trying to use the same
10176df26cacSmrgtemporary object file, and libtool could not work around it because
10186df26cacSmrgyour compiler does not support \`-c' and \`-o' together.  If you
10196df26cacSmrgrepeat this compilation, it may succeed, by chance, but you had better
10206df26cacSmrgavoid parallel builds (make -j) in this platform, or get a better
10216df26cacSmrgcompiler."
10226df26cacSmrg
10236df26cacSmrg	$run $rm $removelist
10246df26cacSmrg	exit $EXIT_FAILURE
10256df26cacSmrg      fi
10266df26cacSmrg
10276df26cacSmrg      # Just move the object if needed
10286df26cacSmrg      if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
10296df26cacSmrg	$show "$mv $output_obj $obj"
10306df26cacSmrg	if $run $mv $output_obj $obj; then :
10316df26cacSmrg	else
10326df26cacSmrg	  error=$?
10336df26cacSmrg	  $run $rm $removelist
10346df26cacSmrg	  exit $error
10356df26cacSmrg	fi
10366df26cacSmrg      fi
10376df26cacSmrg
10386df26cacSmrg      # Append the name of the non-PIC object the libtool object file.
10396df26cacSmrg      # Only append if the libtool object file exists.
10406df26cacSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
10416df26cacSmrg# Name of the non-PIC object.
10426df26cacSmrgnon_pic_object='$objname'
10436df26cacSmrg
10446df26cacSmrgEOF
10456df26cacSmrg    else
10466df26cacSmrg      # Append the name of the non-PIC object the libtool object file.
10476df26cacSmrg      # Only append if the libtool object file exists.
10486df26cacSmrg      test -z "$run" && cat >> ${libobj}T <<EOF
10496df26cacSmrg# Name of the non-PIC object.
10506df26cacSmrgnon_pic_object=none
10516df26cacSmrg
10526df26cacSmrgEOF
10536df26cacSmrg    fi
10546df26cacSmrg
10556df26cacSmrg    $run $mv "${libobj}T" "${libobj}"
10566df26cacSmrg
10576df26cacSmrg    # Unlock the critical section if it was locked
10586df26cacSmrg    if test "$need_locks" != no; then
10596df26cacSmrg      $run $rm "$lockfile"
10606df26cacSmrg    fi
10616df26cacSmrg
10626df26cacSmrg    exit $EXIT_SUCCESS
10636df26cacSmrg    ;;
10646df26cacSmrg
10656df26cacSmrg  # libtool link mode
10666df26cacSmrg  link | relink)
10676df26cacSmrg    modename="$modename: link"
10686df26cacSmrg    case $host in
10696df26cacSmrg    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
10706df26cacSmrg      # It is impossible to link a dll without this setting, and
10716df26cacSmrg      # we shouldn't force the makefile maintainer to figure out
10726df26cacSmrg      # which system we are compiling for in order to pass an extra
10736df26cacSmrg      # flag for every libtool invocation.
10746df26cacSmrg      # allow_undefined=no
10756df26cacSmrg
10766df26cacSmrg      # FIXME: Unfortunately, there are problems with the above when trying
10776df26cacSmrg      # to make a dll which has undefined symbols, in which case not
10786df26cacSmrg      # even a static library is built.  For now, we need to specify
10796df26cacSmrg      # -no-undefined on the libtool link line when we can be certain
10806df26cacSmrg      # that all symbols are satisfied, otherwise we get a static library.
10816df26cacSmrg      allow_undefined=yes
10826df26cacSmrg      ;;
10836df26cacSmrg    *)
10846df26cacSmrg      allow_undefined=yes
10856df26cacSmrg      ;;
10866df26cacSmrg    esac
10876df26cacSmrg    libtool_args="$nonopt"
10886df26cacSmrg    base_compile="$nonopt $@"
10896df26cacSmrg    compile_command="$nonopt"
10906df26cacSmrg    finalize_command="$nonopt"
10916df26cacSmrg
10926df26cacSmrg    compile_rpath=
10936df26cacSmrg    finalize_rpath=
10946df26cacSmrg    compile_shlibpath=
10956df26cacSmrg    finalize_shlibpath=
10966df26cacSmrg    convenience=
10976df26cacSmrg    old_convenience=
10986df26cacSmrg    deplibs=
10996df26cacSmrg    old_deplibs=
11006df26cacSmrg    compiler_flags=
11016df26cacSmrg    linker_flags=
11026df26cacSmrg    dllsearchpath=
11036df26cacSmrg    lib_search_path=`pwd`
11046df26cacSmrg    inst_prefix_dir=
11056df26cacSmrg
11066df26cacSmrg    avoid_version=no
11076df26cacSmrg    dlfiles=
11086df26cacSmrg    dlprefiles=
11096df26cacSmrg    dlself=no
11106df26cacSmrg    export_dynamic=no
11116df26cacSmrg    export_symbols=
11126df26cacSmrg    export_symbols_regex=
11136df26cacSmrg    generated=
11146df26cacSmrg    libobjs=
11156df26cacSmrg    ltlibs=
11166df26cacSmrg    module=no
11176df26cacSmrg    no_install=no
11186df26cacSmrg    objs=
11196df26cacSmrg    non_pic_objects=
11206df26cacSmrg    notinst_path= # paths that contain not-installed libtool libraries
11216df26cacSmrg    precious_files_regex=
11226df26cacSmrg    prefer_static_libs=no
11236df26cacSmrg    preload=no
11246df26cacSmrg    prev=
11256df26cacSmrg    prevarg=
11266df26cacSmrg    release=
11276df26cacSmrg    rpath=
11286df26cacSmrg    xrpath=
11296df26cacSmrg    perm_rpath=
11306df26cacSmrg    temp_rpath=
11316df26cacSmrg    thread_safe=no
11326df26cacSmrg    vinfo=
11336df26cacSmrg    vinfo_number=no
11346df26cacSmrg
11356df26cacSmrg    func_infer_tag $base_compile
11366df26cacSmrg
11376df26cacSmrg    # We need to know -static, to get the right output filenames.
11386df26cacSmrg    for arg
11396df26cacSmrg    do
11406df26cacSmrg      case $arg in
11416df26cacSmrg      -all-static | -static)
11426df26cacSmrg	if test "X$arg" = "X-all-static"; then
11436df26cacSmrg	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
11446df26cacSmrg	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
11456df26cacSmrg	  fi
11466df26cacSmrg	  if test -n "$link_static_flag"; then
11476df26cacSmrg	    dlopen_self=$dlopen_self_static
11486df26cacSmrg	  fi
11496df26cacSmrg	  prefer_static_libs=yes
11506df26cacSmrg	else
11516df26cacSmrg	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
11526df26cacSmrg	    dlopen_self=$dlopen_self_static
11536df26cacSmrg	  fi
11546df26cacSmrg	  prefer_static_libs=built
11556df26cacSmrg	fi
11566df26cacSmrg	build_libtool_libs=no
11576df26cacSmrg	build_old_libs=yes
11586df26cacSmrg	break
11596df26cacSmrg	;;
11606df26cacSmrg      esac
11616df26cacSmrg    done
11626df26cacSmrg
11636df26cacSmrg    # See if our shared archives depend on static archives.
11646df26cacSmrg    test -n "$old_archive_from_new_cmds" && build_old_libs=yes
11656df26cacSmrg
11666df26cacSmrg    # Go through the arguments, transforming them on the way.
11676df26cacSmrg    while test "$#" -gt 0; do
11686df26cacSmrg      arg="$1"
11696df26cacSmrg      shift
11706df26cacSmrg      case $arg in
11716df26cacSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
11726df26cacSmrg	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
11736df26cacSmrg	;;
11746df26cacSmrg      *) qarg=$arg ;;
11756df26cacSmrg      esac
11766df26cacSmrg      libtool_args="$libtool_args $qarg"
11776df26cacSmrg
11786df26cacSmrg      # If the previous option needs an argument, assign it.
11796df26cacSmrg      if test -n "$prev"; then
11806df26cacSmrg	case $prev in
11816df26cacSmrg	output)
11826df26cacSmrg	  compile_command="$compile_command @OUTPUT@"
11836df26cacSmrg	  finalize_command="$finalize_command @OUTPUT@"
11846df26cacSmrg	  ;;
11856df26cacSmrg	esac
11866df26cacSmrg
11876df26cacSmrg	case $prev in
11886df26cacSmrg	dlfiles|dlprefiles)
11896df26cacSmrg	  if test "$preload" = no; then
11906df26cacSmrg	    # Add the symbol object into the linking commands.
11916df26cacSmrg	    compile_command="$compile_command @SYMFILE@"
11926df26cacSmrg	    finalize_command="$finalize_command @SYMFILE@"
11936df26cacSmrg	    preload=yes
11946df26cacSmrg	  fi
11956df26cacSmrg	  case $arg in
11966df26cacSmrg	  *.la | *.lo) ;;  # We handle these cases below.
11976df26cacSmrg	  force)
11986df26cacSmrg	    if test "$dlself" = no; then
11996df26cacSmrg	      dlself=needless
12006df26cacSmrg	      export_dynamic=yes
12016df26cacSmrg	    fi
12026df26cacSmrg	    prev=
12036df26cacSmrg	    continue
12046df26cacSmrg	    ;;
12056df26cacSmrg	  self)
12066df26cacSmrg	    if test "$prev" = dlprefiles; then
12076df26cacSmrg	      dlself=yes
12086df26cacSmrg	    elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then
12096df26cacSmrg	      dlself=yes
12106df26cacSmrg	    else
12116df26cacSmrg	      dlself=needless
12126df26cacSmrg	      export_dynamic=yes
12136df26cacSmrg	    fi
12146df26cacSmrg	    prev=
12156df26cacSmrg	    continue
12166df26cacSmrg	    ;;
12176df26cacSmrg	  *)
12186df26cacSmrg	    if test "$prev" = dlfiles; then
12196df26cacSmrg	      dlfiles="$dlfiles $arg"
12206df26cacSmrg	    else
12216df26cacSmrg	      dlprefiles="$dlprefiles $arg"
12226df26cacSmrg	    fi
12236df26cacSmrg	    prev=
12246df26cacSmrg	    continue
12256df26cacSmrg	    ;;
12266df26cacSmrg	  esac
12276df26cacSmrg	  ;;
12286df26cacSmrg	expsyms)
12296df26cacSmrg	  export_symbols="$arg"
12306df26cacSmrg	  if test ! -f "$arg"; then
12316df26cacSmrg	    $echo "$modename: symbol file \`$arg' does not exist"
12326df26cacSmrg	    exit $EXIT_FAILURE
12336df26cacSmrg	  fi
12346df26cacSmrg	  prev=
12356df26cacSmrg	  continue
12366df26cacSmrg	  ;;
12376df26cacSmrg	expsyms_regex)
12386df26cacSmrg	  export_symbols_regex="$arg"
12396df26cacSmrg	  prev=
12406df26cacSmrg	  continue
12416df26cacSmrg	  ;;
12426df26cacSmrg	inst_prefix)
12436df26cacSmrg	  inst_prefix_dir="$arg"
12446df26cacSmrg	  prev=
12456df26cacSmrg	  continue
12466df26cacSmrg	  ;;
12476df26cacSmrg	precious_regex)
12486df26cacSmrg	  precious_files_regex="$arg"
12496df26cacSmrg	  prev=
12506df26cacSmrg	  continue
12516df26cacSmrg	  ;;
12526df26cacSmrg	release)
12536df26cacSmrg	  release="-$arg"
12546df26cacSmrg	  prev=
12556df26cacSmrg	  continue
12566df26cacSmrg	  ;;
12576df26cacSmrg	objectlist)
12586df26cacSmrg	  if test -f "$arg"; then
12596df26cacSmrg	    save_arg=$arg
12606df26cacSmrg	    moreargs=
12616df26cacSmrg	    for fil in `cat $save_arg`
12626df26cacSmrg	    do
12636df26cacSmrg#	      moreargs="$moreargs $fil"
12646df26cacSmrg	      arg=$fil
12656df26cacSmrg	      # A libtool-controlled object.
12666df26cacSmrg
12676df26cacSmrg	      # Check to see that this really is a libtool object.
12686df26cacSmrg	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
12696df26cacSmrg		pic_object=
12706df26cacSmrg		non_pic_object=
12716df26cacSmrg
12726df26cacSmrg		# Read the .lo file
12736df26cacSmrg		# If there is no directory component, then add one.
12746df26cacSmrg		case $arg in
12756df26cacSmrg		*/* | *\\*) . $arg ;;
12766df26cacSmrg		*) . ./$arg ;;
12776df26cacSmrg		esac
12786df26cacSmrg
12796df26cacSmrg		if test -z "$pic_object" || \
12806df26cacSmrg		   test -z "$non_pic_object" ||
12816df26cacSmrg		   test "$pic_object" = none && \
12826df26cacSmrg		   test "$non_pic_object" = none; then
12836df26cacSmrg		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
12846df26cacSmrg		  exit $EXIT_FAILURE
12856df26cacSmrg		fi
12866df26cacSmrg
12876df26cacSmrg		# Extract subdirectory from the argument.
12886df26cacSmrg		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
12896df26cacSmrg		if test "X$xdir" = "X$arg"; then
12906df26cacSmrg		  xdir=
12916df26cacSmrg		else
12926df26cacSmrg		  xdir="$xdir/"
12936df26cacSmrg		fi
12946df26cacSmrg
12956df26cacSmrg		if test "$pic_object" != none; then
12966df26cacSmrg		  # Prepend the subdirectory the object is found in.
12976df26cacSmrg		  pic_object="$xdir$pic_object"
12986df26cacSmrg
12996df26cacSmrg		  if test "$prev" = dlfiles; then
13006df26cacSmrg		    if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
13016df26cacSmrg		      dlfiles="$dlfiles $pic_object"
13026df26cacSmrg		      prev=
13036df26cacSmrg		      continue
13046df26cacSmrg		    else
13056df26cacSmrg		      # If libtool objects are unsupported, then we need to preload.
13066df26cacSmrg		      prev=dlprefiles
13076df26cacSmrg		    fi
13086df26cacSmrg		  fi
13096df26cacSmrg
13106df26cacSmrg		  # CHECK ME:  I think I busted this.  -Ossama
13116df26cacSmrg		  if test "$prev" = dlprefiles; then
13126df26cacSmrg		    # Preload the old-style object.
13136df26cacSmrg		    dlprefiles="$dlprefiles $pic_object"
13146df26cacSmrg		    prev=
13156df26cacSmrg		  fi
13166df26cacSmrg
13176df26cacSmrg		  # A PIC object.
13186df26cacSmrg		  libobjs="$libobjs $pic_object"
13196df26cacSmrg		  arg="$pic_object"
13206df26cacSmrg		fi
13216df26cacSmrg
13226df26cacSmrg		# Non-PIC object.
13236df26cacSmrg		if test "$non_pic_object" != none; then
13246df26cacSmrg		  # Prepend the subdirectory the object is found in.
13256df26cacSmrg		  non_pic_object="$xdir$non_pic_object"
13266df26cacSmrg
13276df26cacSmrg		  # A standard non-PIC object
13286df26cacSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
13296df26cacSmrg		  if test -z "$pic_object" || test "$pic_object" = none ; then
13306df26cacSmrg		    arg="$non_pic_object"
13316df26cacSmrg		  fi
13326df26cacSmrg		else
13336df26cacSmrg		  # If the PIC object exists, use it instead.
13346df26cacSmrg		  # $xdir was prepended to $pic_object above.
13356df26cacSmrg		  non_pic_object="$pic_object"
13366df26cacSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
13376df26cacSmrg		fi
13386df26cacSmrg	      else
13396df26cacSmrg		# Only an error if not doing a dry-run.
13406df26cacSmrg		if test -z "$run"; then
13416df26cacSmrg		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
13426df26cacSmrg		  exit $EXIT_FAILURE
13436df26cacSmrg		else
13446df26cacSmrg		  # Dry-run case.
13456df26cacSmrg
13466df26cacSmrg		  # Extract subdirectory from the argument.
13476df26cacSmrg		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
13486df26cacSmrg		  if test "X$xdir" = "X$arg"; then
13496df26cacSmrg		    xdir=
13506df26cacSmrg		  else
13516df26cacSmrg		    xdir="$xdir/"
13526df26cacSmrg		  fi
13536df26cacSmrg
13546df26cacSmrg		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
13556df26cacSmrg		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
13566df26cacSmrg		  libobjs="$libobjs $pic_object"
13576df26cacSmrg		  non_pic_objects="$non_pic_objects $non_pic_object"
13586df26cacSmrg		fi
13596df26cacSmrg	      fi
13606df26cacSmrg	    done
13616df26cacSmrg	  else
13626df26cacSmrg	    $echo "$modename: link input file \`$save_arg' does not exist"
13636df26cacSmrg	    exit $EXIT_FAILURE
13646df26cacSmrg	  fi
13656df26cacSmrg	  arg=$save_arg
13666df26cacSmrg	  prev=
13676df26cacSmrg	  continue
13686df26cacSmrg	  ;;
13696df26cacSmrg	rpath | xrpath)
13706df26cacSmrg	  # We need an absolute path.
13716df26cacSmrg	  case $arg in
13726df26cacSmrg	  [\\/]* | [A-Za-z]:[\\/]*) ;;
13736df26cacSmrg	  *)
13746df26cacSmrg	    $echo "$modename: only absolute run-paths are allowed" 1>&2
13756df26cacSmrg	    exit $EXIT_FAILURE
13766df26cacSmrg	    ;;
13776df26cacSmrg	  esac
13786df26cacSmrg	  if test "$prev" = rpath; then
13796df26cacSmrg	    case "$rpath " in
13806df26cacSmrg	    *" $arg "*) ;;
13816df26cacSmrg	    *) rpath="$rpath $arg" ;;
13826df26cacSmrg	    esac
13836df26cacSmrg	  else
13846df26cacSmrg	    case "$xrpath " in
13856df26cacSmrg	    *" $arg "*) ;;
13866df26cacSmrg	    *) xrpath="$xrpath $arg" ;;
13876df26cacSmrg	    esac
13886df26cacSmrg	  fi
13896df26cacSmrg	  prev=
13906df26cacSmrg	  continue
13916df26cacSmrg	  ;;
13926df26cacSmrg	xcompiler)
13936df26cacSmrg	  compiler_flags="$compiler_flags $qarg"
13946df26cacSmrg	  prev=
13956df26cacSmrg	  compile_command="$compile_command $qarg"
13966df26cacSmrg	  finalize_command="$finalize_command $qarg"
13976df26cacSmrg	  continue
13986df26cacSmrg	  ;;
13996df26cacSmrg	xlinker)
14006df26cacSmrg	  linker_flags="$linker_flags $qarg"
14016df26cacSmrg	  compiler_flags="$compiler_flags $wl$qarg"
14026df26cacSmrg	  prev=
14036df26cacSmrg	  compile_command="$compile_command $wl$qarg"
14046df26cacSmrg	  finalize_command="$finalize_command $wl$qarg"
14056df26cacSmrg	  continue
14066df26cacSmrg	  ;;
14076df26cacSmrg	xcclinker)
14086df26cacSmrg	  linker_flags="$linker_flags $qarg"
14096df26cacSmrg	  compiler_flags="$compiler_flags $qarg"
14106df26cacSmrg	  prev=
14116df26cacSmrg	  compile_command="$compile_command $qarg"
14126df26cacSmrg	  finalize_command="$finalize_command $qarg"
14136df26cacSmrg	  continue
14146df26cacSmrg	  ;;
14156df26cacSmrg	shrext)
14166df26cacSmrg  	  shrext_cmds="$arg"
14176df26cacSmrg	  prev=
14186df26cacSmrg	  continue
14196df26cacSmrg	  ;;
14206df26cacSmrg	darwin_framework|darwin_framework_skip)
14216df26cacSmrg	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
14226df26cacSmrg	  compile_command="$compile_command $arg"
14236df26cacSmrg	  finalize_command="$finalize_command $arg"
14246df26cacSmrg	  prev=
14256df26cacSmrg	  continue
14266df26cacSmrg	  ;;
14276df26cacSmrg	*)
14286df26cacSmrg	  eval "$prev=\"\$arg\""
14296df26cacSmrg	  prev=
14306df26cacSmrg	  continue
14316df26cacSmrg	  ;;
14326df26cacSmrg	esac
14336df26cacSmrg      fi # test -n "$prev"
14346df26cacSmrg
14356df26cacSmrg      prevarg="$arg"
14366df26cacSmrg
14376df26cacSmrg      case $arg in
14386df26cacSmrg      -all-static)
14396df26cacSmrg	if test -n "$link_static_flag"; then
14406df26cacSmrg	  compile_command="$compile_command $link_static_flag"
14416df26cacSmrg	  finalize_command="$finalize_command $link_static_flag"
14426df26cacSmrg	fi
14436df26cacSmrg	continue
14446df26cacSmrg	;;
14456df26cacSmrg
14466df26cacSmrg      -allow-undefined)
14476df26cacSmrg	# FIXME: remove this flag sometime in the future.
14486df26cacSmrg	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
14496df26cacSmrg	continue
14506df26cacSmrg	;;
14516df26cacSmrg
14526df26cacSmrg      -avoid-version)
14536df26cacSmrg	avoid_version=yes
14546df26cacSmrg	continue
14556df26cacSmrg	;;
14566df26cacSmrg
14576df26cacSmrg      -dlopen)
14586df26cacSmrg	prev=dlfiles
14596df26cacSmrg	continue
14606df26cacSmrg	;;
14616df26cacSmrg
14626df26cacSmrg      -dlpreopen)
14636df26cacSmrg	prev=dlprefiles
14646df26cacSmrg	continue
14656df26cacSmrg	;;
14666df26cacSmrg
14676df26cacSmrg      -export-dynamic)
14686df26cacSmrg	export_dynamic=yes
14696df26cacSmrg	continue
14706df26cacSmrg	;;
14716df26cacSmrg
14726df26cacSmrg      -export-symbols | -export-symbols-regex)
14736df26cacSmrg	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
14746df26cacSmrg	  $echo "$modename: more than one -exported-symbols argument is not allowed"
14756df26cacSmrg	  exit $EXIT_FAILURE
14766df26cacSmrg	fi
14776df26cacSmrg	if test "X$arg" = "X-export-symbols"; then
14786df26cacSmrg	  prev=expsyms
14796df26cacSmrg	else
14806df26cacSmrg	  prev=expsyms_regex
14816df26cacSmrg	fi
14826df26cacSmrg	continue
14836df26cacSmrg	;;
14846df26cacSmrg
14856df26cacSmrg      -framework|-arch|-isysroot)
14866df26cacSmrg	case " $CC " in
14876df26cacSmrg	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
14886df26cacSmrg		prev=darwin_framework_skip ;;
14896df26cacSmrg	  *) compiler_flags="$compiler_flags $arg"
14906df26cacSmrg	     prev=darwin_framework ;;
14916df26cacSmrg	esac
14926df26cacSmrg	compile_command="$compile_command $arg"
14936df26cacSmrg	finalize_command="$finalize_command $arg"
14946df26cacSmrg	continue
14956df26cacSmrg	;;
14966df26cacSmrg
14976df26cacSmrg      -inst-prefix-dir)
14986df26cacSmrg	prev=inst_prefix
14996df26cacSmrg	continue
15006df26cacSmrg	;;
15016df26cacSmrg
15026df26cacSmrg      # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:*
15036df26cacSmrg      # so, if we see these flags be careful not to treat them like -L
15046df26cacSmrg      -L[A-Z][A-Z]*:*)
15056df26cacSmrg	case $with_gcc/$host in
15066df26cacSmrg	no/*-*-irix* | /*-*-irix*)
15076df26cacSmrg	  compile_command="$compile_command $arg"
15086df26cacSmrg	  finalize_command="$finalize_command $arg"
15096df26cacSmrg	  ;;
15106df26cacSmrg	esac
15116df26cacSmrg	continue
15126df26cacSmrg	;;
15136df26cacSmrg
15146df26cacSmrg      -L*)
15156df26cacSmrg	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
15166df26cacSmrg	# We need an absolute path.
15176df26cacSmrg	case $dir in
15186df26cacSmrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
15196df26cacSmrg	*)
15206df26cacSmrg	  absdir=`cd "$dir" && pwd`
15216df26cacSmrg	  if test -z "$absdir"; then
15226df26cacSmrg	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
15236df26cacSmrg	    absdir="$dir"
15246df26cacSmrg	    notinst_path="$notinst_path $dir"
15256df26cacSmrg	  fi
15266df26cacSmrg	  dir="$absdir"
15276df26cacSmrg	  ;;
15286df26cacSmrg	esac
15296df26cacSmrg	case "$deplibs " in
15306df26cacSmrg	*" -L$dir "*) ;;
15316df26cacSmrg	*)
15326df26cacSmrg	  deplibs="$deplibs -L$dir"
15336df26cacSmrg	  lib_search_path="$lib_search_path $dir"
15346df26cacSmrg	  ;;
15356df26cacSmrg	esac
15366df26cacSmrg	case $host in
15376df26cacSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
15386df26cacSmrg	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
15396df26cacSmrg	  case :$dllsearchpath: in
15406df26cacSmrg	  *":$dir:"*) ;;
15416df26cacSmrg	  *) dllsearchpath="$dllsearchpath:$dir";;
15426df26cacSmrg	  esac
15436df26cacSmrg	  case :$dllsearchpath: in
15446df26cacSmrg	  *":$testbindir:"*) ;;
15456df26cacSmrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
15466df26cacSmrg	  esac
15476df26cacSmrg	  ;;
15486df26cacSmrg	esac
15496df26cacSmrg	continue
15506df26cacSmrg	;;
15516df26cacSmrg
15526df26cacSmrg      -l*)
15536df26cacSmrg	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
15546df26cacSmrg	  case $host in
15556df26cacSmrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
15566df26cacSmrg	    # These systems don't actually have a C or math library (as such)
15576df26cacSmrg	    continue
15586df26cacSmrg	    ;;
15596df26cacSmrg	  *-*-os2*)
15606df26cacSmrg	    # These systems don't actually have a C library (as such)
15616df26cacSmrg	    test "X$arg" = "X-lc" && continue
15626df26cacSmrg	    ;;
15636df26cacSmrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
15646df26cacSmrg	    # Do not include libc due to us having libc/libc_r.
15656df26cacSmrg	    test "X$arg" = "X-lc" && continue
15666df26cacSmrg	    ;;
15676df26cacSmrg	  *-*-rhapsody* | *-*-darwin1.[012])
15686df26cacSmrg	    # Rhapsody C and math libraries are in the System framework
15696df26cacSmrg	    deplibs="$deplibs -framework System"
15706df26cacSmrg	    continue
15716df26cacSmrg	    ;;
15726df26cacSmrg	  *-*-sco3.2v5* | *-*-sco5v6*)
15736df26cacSmrg	    # Causes problems with __ctype
15746df26cacSmrg	    test "X$arg" = "X-lc" && continue
15756df26cacSmrg	    ;;
15766df26cacSmrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
15776df26cacSmrg	    # Compiler inserts libc in the correct place for threads to work
15786df26cacSmrg	    test "X$arg" = "X-lc" && continue
15796df26cacSmrg	    ;;
15806df26cacSmrg	  esac
15816df26cacSmrg	elif test "X$arg" = "X-lc_r"; then
15826df26cacSmrg	 case $host in
15836df26cacSmrg	 *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
15846df26cacSmrg	   # Do not include libc_r directly, use -pthread flag.
15856df26cacSmrg	   continue
15866df26cacSmrg	   ;;
15876df26cacSmrg	 esac
15886df26cacSmrg	fi
15896df26cacSmrg	deplibs="$deplibs $arg"
15906df26cacSmrg	continue
15916df26cacSmrg	;;
15926df26cacSmrg
15936df26cacSmrg      # Tru64 UNIX uses -model [arg] to determine the layout of C++
15946df26cacSmrg      # classes, name mangling, and exception handling.
15956df26cacSmrg      -model)
15966df26cacSmrg	compile_command="$compile_command $arg"
15976df26cacSmrg	compiler_flags="$compiler_flags $arg"
15986df26cacSmrg	finalize_command="$finalize_command $arg"
15996df26cacSmrg	prev=xcompiler
16006df26cacSmrg	continue
16016df26cacSmrg	;;
16026df26cacSmrg
16036df26cacSmrg     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
16046df26cacSmrg	compiler_flags="$compiler_flags $arg"
16056df26cacSmrg	compile_command="$compile_command $arg"
16066df26cacSmrg	finalize_command="$finalize_command $arg"
16076df26cacSmrg	continue
16086df26cacSmrg	;;
16096df26cacSmrg
16106df26cacSmrg      -module)
16116df26cacSmrg	module=yes
16126df26cacSmrg	continue
16136df26cacSmrg	;;
16146df26cacSmrg
16156df26cacSmrg      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
16166df26cacSmrg      # -r[0-9][0-9]* specifies the processor on the SGI compiler
16176df26cacSmrg      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
16186df26cacSmrg      # +DA*, +DD* enable 64-bit mode on the HP compiler
16196df26cacSmrg      # -q* pass through compiler args for the IBM compiler
16206df26cacSmrg      # -m* pass through architecture-specific compiler args for GCC
16216df26cacSmrg      # -m*, -t[45]*, -txscale* pass through architecture-specific
16226df26cacSmrg      # compiler args for GCC
16236df26cacSmrg      # -pg pass through profiling flag for GCC
16246df26cacSmrg      # @file GCC response files
16256df26cacSmrg      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
16266df26cacSmrg      -t[45]*|-txscale*|@*)
16276df26cacSmrg
16286df26cacSmrg	# Unknown arguments in both finalize_command and compile_command need
16296df26cacSmrg	# to be aesthetically quoted because they are evaled later.
16306df26cacSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
16316df26cacSmrg	case $arg in
16326df26cacSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
16336df26cacSmrg	  arg="\"$arg\""
16346df26cacSmrg	  ;;
16356df26cacSmrg	esac
16366df26cacSmrg        compile_command="$compile_command $arg"
16376df26cacSmrg        finalize_command="$finalize_command $arg"
16386df26cacSmrg        compiler_flags="$compiler_flags $arg"
16396df26cacSmrg        continue
16406df26cacSmrg        ;;
16416df26cacSmrg
16426df26cacSmrg      -shrext)
16436df26cacSmrg	prev=shrext
16446df26cacSmrg	continue
16456df26cacSmrg	;;
16466df26cacSmrg
16476df26cacSmrg      -no-fast-install)
16486df26cacSmrg	fast_install=no
16496df26cacSmrg	continue
16506df26cacSmrg	;;
16516df26cacSmrg
16526df26cacSmrg      -no-install)
16536df26cacSmrg	case $host in
16546df26cacSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
16556df26cacSmrg	  # The PATH hackery in wrapper scripts is required on Windows
16566df26cacSmrg	  # in order for the loader to find any dlls it needs.
16576df26cacSmrg	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
16586df26cacSmrg	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
16596df26cacSmrg	  fast_install=no
16606df26cacSmrg	  ;;
16616df26cacSmrg	*) no_install=yes ;;
16626df26cacSmrg	esac
16636df26cacSmrg	continue
16646df26cacSmrg	;;
16656df26cacSmrg
16666df26cacSmrg      -no-undefined)
16676df26cacSmrg	allow_undefined=no
16686df26cacSmrg	continue
16696df26cacSmrg	;;
16706df26cacSmrg
16716df26cacSmrg      -objectlist)
16726df26cacSmrg	prev=objectlist
16736df26cacSmrg	continue
16746df26cacSmrg	;;
16756df26cacSmrg
16766df26cacSmrg      -o) prev=output ;;
16776df26cacSmrg
16786df26cacSmrg      -precious-files-regex)
16796df26cacSmrg	prev=precious_regex
16806df26cacSmrg	continue
16816df26cacSmrg	;;
16826df26cacSmrg
16836df26cacSmrg      -release)
16846df26cacSmrg	prev=release
16856df26cacSmrg	continue
16866df26cacSmrg	;;
16876df26cacSmrg
16886df26cacSmrg      -rpath)
16896df26cacSmrg	prev=rpath
16906df26cacSmrg	continue
16916df26cacSmrg	;;
16926df26cacSmrg
16936df26cacSmrg      -R)
16946df26cacSmrg	prev=xrpath
16956df26cacSmrg	continue
16966df26cacSmrg	;;
16976df26cacSmrg
16986df26cacSmrg      -R*)
16996df26cacSmrg	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
17006df26cacSmrg	# We need an absolute path.
17016df26cacSmrg	case $dir in
17026df26cacSmrg	[\\/]* | [A-Za-z]:[\\/]*) ;;
17036df26cacSmrg	*)
17046df26cacSmrg	  $echo "$modename: only absolute run-paths are allowed" 1>&2
17056df26cacSmrg	  exit $EXIT_FAILURE
17066df26cacSmrg	  ;;
17076df26cacSmrg	esac
17086df26cacSmrg	case "$xrpath " in
17096df26cacSmrg	*" $dir "*) ;;
17106df26cacSmrg	*) xrpath="$xrpath $dir" ;;
17116df26cacSmrg	esac
17126df26cacSmrg	continue
17136df26cacSmrg	;;
17146df26cacSmrg
17156df26cacSmrg      -static)
17166df26cacSmrg	# The effects of -static are defined in a previous loop.
17176df26cacSmrg	# We used to do the same as -all-static on platforms that
17186df26cacSmrg	# didn't have a PIC flag, but the assumption that the effects
17196df26cacSmrg	# would be equivalent was wrong.  It would break on at least
17206df26cacSmrg	# Digital Unix and AIX.
17216df26cacSmrg	continue
17226df26cacSmrg	;;
17236df26cacSmrg
17246df26cacSmrg      -thread-safe)
17256df26cacSmrg	thread_safe=yes
17266df26cacSmrg	continue
17276df26cacSmrg	;;
17286df26cacSmrg
17296df26cacSmrg      -version-info)
17306df26cacSmrg	prev=vinfo
17316df26cacSmrg	continue
17326df26cacSmrg	;;
17336df26cacSmrg      -version-number)
17346df26cacSmrg	prev=vinfo
17356df26cacSmrg	vinfo_number=yes
17366df26cacSmrg	continue
17376df26cacSmrg	;;
17386df26cacSmrg
17396df26cacSmrg      -Wc,*)
17406df26cacSmrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
17416df26cacSmrg	arg=
17426df26cacSmrg	save_ifs="$IFS"; IFS=','
17436df26cacSmrg	for flag in $args; do
17446df26cacSmrg	  IFS="$save_ifs"
17456df26cacSmrg	  case $flag in
17466df26cacSmrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
17476df26cacSmrg	    flag="\"$flag\""
17486df26cacSmrg	    ;;
17496df26cacSmrg	  esac
17506df26cacSmrg	  arg="$arg $wl$flag"
17516df26cacSmrg	  compiler_flags="$compiler_flags $flag"
17526df26cacSmrg	done
17536df26cacSmrg	IFS="$save_ifs"
17546df26cacSmrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
17556df26cacSmrg	;;
17566df26cacSmrg
17576df26cacSmrg      -Wl,*)
17586df26cacSmrg	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
17596df26cacSmrg	arg=
17606df26cacSmrg	save_ifs="$IFS"; IFS=','
17616df26cacSmrg	for flag in $args; do
17626df26cacSmrg	  IFS="$save_ifs"
17636df26cacSmrg	  case $flag in
17646df26cacSmrg	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
17656df26cacSmrg	    flag="\"$flag\""
17666df26cacSmrg	    ;;
17676df26cacSmrg	  esac
17686df26cacSmrg	  arg="$arg $wl$flag"
17696df26cacSmrg	  compiler_flags="$compiler_flags $wl$flag"
17706df26cacSmrg	  linker_flags="$linker_flags $flag"
17716df26cacSmrg	done
17726df26cacSmrg	IFS="$save_ifs"
17736df26cacSmrg	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
17746df26cacSmrg	;;
17756df26cacSmrg
17766df26cacSmrg      -Xcompiler)
17776df26cacSmrg	prev=xcompiler
17786df26cacSmrg	continue
17796df26cacSmrg	;;
17806df26cacSmrg
17816df26cacSmrg      -Xlinker)
17826df26cacSmrg	prev=xlinker
17836df26cacSmrg	continue
17846df26cacSmrg	;;
17856df26cacSmrg
17866df26cacSmrg      -XCClinker)
17876df26cacSmrg	prev=xcclinker
17886df26cacSmrg	continue
17896df26cacSmrg	;;
17906df26cacSmrg
17916df26cacSmrg      # Some other compiler flag.
17926df26cacSmrg      -* | +*)
17936df26cacSmrg	# Unknown arguments in both finalize_command and compile_command need
17946df26cacSmrg	# to be aesthetically quoted because they are evaled later.
17956df26cacSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
17966df26cacSmrg	case $arg in
17976df26cacSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
17986df26cacSmrg	  arg="\"$arg\""
17996df26cacSmrg	  ;;
18006df26cacSmrg	esac
18016df26cacSmrg	;;
18026df26cacSmrg
18036df26cacSmrg      *.$objext)
18046df26cacSmrg	# A standard object.
18056df26cacSmrg	objs="$objs $arg"
18066df26cacSmrg	;;
18076df26cacSmrg
18086df26cacSmrg      *.lo)
18096df26cacSmrg	# A libtool-controlled object.
18106df26cacSmrg
18116df26cacSmrg	# Check to see that this really is a libtool object.
18126df26cacSmrg	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
18136df26cacSmrg	  pic_object=
18146df26cacSmrg	  non_pic_object=
18156df26cacSmrg
18166df26cacSmrg	  # Read the .lo file
18176df26cacSmrg	  # If there is no directory component, then add one.
18186df26cacSmrg	  case $arg in
18196df26cacSmrg	  */* | *\\*) . $arg ;;
18206df26cacSmrg	  *) . ./$arg ;;
18216df26cacSmrg	  esac
18226df26cacSmrg
18236df26cacSmrg	  if test -z "$pic_object" || \
18246df26cacSmrg	     test -z "$non_pic_object" ||
18256df26cacSmrg	     test "$pic_object" = none && \
18266df26cacSmrg	     test "$non_pic_object" = none; then
18276df26cacSmrg	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
18286df26cacSmrg	    exit $EXIT_FAILURE
18296df26cacSmrg	  fi
18306df26cacSmrg
18316df26cacSmrg	  # Extract subdirectory from the argument.
18326df26cacSmrg	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
18336df26cacSmrg	  if test "X$xdir" = "X$arg"; then
18346df26cacSmrg	    xdir=
18356df26cacSmrg 	  else
18366df26cacSmrg	    xdir="$xdir/"
18376df26cacSmrg	  fi
18386df26cacSmrg
18396df26cacSmrg	  if test "$pic_object" != none; then
18406df26cacSmrg	    # Prepend the subdirectory the object is found in.
18416df26cacSmrg	    pic_object="$xdir$pic_object"
18426df26cacSmrg
18436df26cacSmrg	    if test "$prev" = dlfiles; then
18446df26cacSmrg	      if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
18456df26cacSmrg		dlfiles="$dlfiles $pic_object"
18466df26cacSmrg		prev=
18476df26cacSmrg		continue
18486df26cacSmrg	      else
18496df26cacSmrg		# If libtool objects are unsupported, then we need to preload.
18506df26cacSmrg		prev=dlprefiles
18516df26cacSmrg	      fi
18526df26cacSmrg	    fi
18536df26cacSmrg
18546df26cacSmrg	    # CHECK ME:  I think I busted this.  -Ossama
18556df26cacSmrg	    if test "$prev" = dlprefiles; then
18566df26cacSmrg	      # Preload the old-style object.
18576df26cacSmrg	      dlprefiles="$dlprefiles $pic_object"
18586df26cacSmrg	      prev=
18596df26cacSmrg	    fi
18606df26cacSmrg
18616df26cacSmrg	    # A PIC object.
18626df26cacSmrg	    libobjs="$libobjs $pic_object"
18636df26cacSmrg	    arg="$pic_object"
18646df26cacSmrg	  fi
18656df26cacSmrg
18666df26cacSmrg	  # Non-PIC object.
18676df26cacSmrg	  if test "$non_pic_object" != none; then
18686df26cacSmrg	    # Prepend the subdirectory the object is found in.
18696df26cacSmrg	    non_pic_object="$xdir$non_pic_object"
18706df26cacSmrg
18716df26cacSmrg	    # A standard non-PIC object
18726df26cacSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
18736df26cacSmrg	    if test -z "$pic_object" || test "$pic_object" = none ; then
18746df26cacSmrg	      arg="$non_pic_object"
18756df26cacSmrg	    fi
18766df26cacSmrg	  else
18776df26cacSmrg	    # If the PIC object exists, use it instead.
18786df26cacSmrg	    # $xdir was prepended to $pic_object above.
18796df26cacSmrg	    non_pic_object="$pic_object"
18806df26cacSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
18816df26cacSmrg	  fi
18826df26cacSmrg	else
18836df26cacSmrg	  # Only an error if not doing a dry-run.
18846df26cacSmrg	  if test -z "$run"; then
18856df26cacSmrg	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
18866df26cacSmrg	    exit $EXIT_FAILURE
18876df26cacSmrg	  else
18886df26cacSmrg	    # Dry-run case.
18896df26cacSmrg
18906df26cacSmrg	    # Extract subdirectory from the argument.
18916df26cacSmrg	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
18926df26cacSmrg	    if test "X$xdir" = "X$arg"; then
18936df26cacSmrg	      xdir=
18946df26cacSmrg	    else
18956df26cacSmrg	      xdir="$xdir/"
18966df26cacSmrg	    fi
18976df26cacSmrg
18986df26cacSmrg	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
18996df26cacSmrg	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
19006df26cacSmrg	    libobjs="$libobjs $pic_object"
19016df26cacSmrg	    non_pic_objects="$non_pic_objects $non_pic_object"
19026df26cacSmrg	  fi
19036df26cacSmrg	fi
19046df26cacSmrg	;;
19056df26cacSmrg
19066df26cacSmrg      *.$libext)
19076df26cacSmrg	# An archive.
19086df26cacSmrg	deplibs="$deplibs $arg"
19096df26cacSmrg	old_deplibs="$old_deplibs $arg"
19106df26cacSmrg	continue
19116df26cacSmrg	;;
19126df26cacSmrg
19136df26cacSmrg      *.la)
19146df26cacSmrg	# A libtool-controlled library.
19156df26cacSmrg
19166df26cacSmrg	if test "$prev" = dlfiles; then
19176df26cacSmrg	  # This library was specified with -dlopen.
19186df26cacSmrg	  dlfiles="$dlfiles $arg"
19196df26cacSmrg	  prev=
19206df26cacSmrg	elif test "$prev" = dlprefiles; then
19216df26cacSmrg	  # The library was specified with -dlpreopen.
19226df26cacSmrg	  dlprefiles="$dlprefiles $arg"
19236df26cacSmrg	  prev=
19246df26cacSmrg	else
19256df26cacSmrg	  deplibs="$deplibs $arg"
19266df26cacSmrg	fi
19276df26cacSmrg	continue
19286df26cacSmrg	;;
19296df26cacSmrg
19306df26cacSmrg      # Some other compiler argument.
19316df26cacSmrg      *)
19326df26cacSmrg	# Unknown arguments in both finalize_command and compile_command need
19336df26cacSmrg	# to be aesthetically quoted because they are evaled later.
19346df26cacSmrg	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
19356df26cacSmrg	case $arg in
19366df26cacSmrg	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
19376df26cacSmrg	  arg="\"$arg\""
19386df26cacSmrg	  ;;
19396df26cacSmrg	esac
19406df26cacSmrg	;;
19416df26cacSmrg      esac # arg
19426df26cacSmrg
19436df26cacSmrg      # Now actually substitute the argument into the commands.
19446df26cacSmrg      if test -n "$arg"; then
19456df26cacSmrg	compile_command="$compile_command $arg"
19466df26cacSmrg	finalize_command="$finalize_command $arg"
19476df26cacSmrg      fi
19486df26cacSmrg    done # argument parsing loop
19496df26cacSmrg
19506df26cacSmrg    if test -n "$prev"; then
19516df26cacSmrg      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
19526df26cacSmrg      $echo "$help" 1>&2
19536df26cacSmrg      exit $EXIT_FAILURE
19546df26cacSmrg    fi
19556df26cacSmrg
19566df26cacSmrg    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
19576df26cacSmrg      eval arg=\"$export_dynamic_flag_spec\"
19586df26cacSmrg      compile_command="$compile_command $arg"
19596df26cacSmrg      finalize_command="$finalize_command $arg"
19606df26cacSmrg    fi
19616df26cacSmrg
19626df26cacSmrg    oldlibs=
19636df26cacSmrg    # calculate the name of the file, without its directory
19646df26cacSmrg    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
19656df26cacSmrg    libobjs_save="$libobjs"
19666df26cacSmrg
19676df26cacSmrg    if test -n "$shlibpath_var"; then
19686df26cacSmrg      # get the directories listed in $shlibpath_var
19696df26cacSmrg      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
19706df26cacSmrg    else
19716df26cacSmrg      shlib_search_path=
19726df26cacSmrg    fi
19736df26cacSmrg    eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
19746df26cacSmrg    eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
19756df26cacSmrg
19766df26cacSmrg    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
19776df26cacSmrg    if test "X$output_objdir" = "X$output"; then
19786df26cacSmrg      output_objdir="$objdir"
19796df26cacSmrg    else
19806df26cacSmrg      output_objdir="$output_objdir/$objdir"
19816df26cacSmrg    fi
19826df26cacSmrg    # Create the object directory.
19836df26cacSmrg    if test ! -d "$output_objdir"; then
19846df26cacSmrg      $show "$mkdir $output_objdir"
19856df26cacSmrg      $run $mkdir $output_objdir
19866df26cacSmrg      exit_status=$?
19876df26cacSmrg      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
19886df26cacSmrg	exit $exit_status
19896df26cacSmrg      fi
19906df26cacSmrg    fi
19916df26cacSmrg
19926df26cacSmrg    # Determine the type of output
19936df26cacSmrg    case $output in
19946df26cacSmrg    "")
19956df26cacSmrg      $echo "$modename: you must specify an output file" 1>&2
19966df26cacSmrg      $echo "$help" 1>&2
19976df26cacSmrg      exit $EXIT_FAILURE
19986df26cacSmrg      ;;
19996df26cacSmrg    *.$libext) linkmode=oldlib ;;
20006df26cacSmrg    *.lo | *.$objext) linkmode=obj ;;
20016df26cacSmrg    *.la) linkmode=lib ;;
20026df26cacSmrg    *) linkmode=prog ;; # Anything else should be a program.
20036df26cacSmrg    esac
20046df26cacSmrg
20056df26cacSmrg    case $host in
20066df26cacSmrg    *cygwin* | *mingw* | *pw32*)
20076df26cacSmrg      # don't eliminate duplications in $postdeps and $predeps
20086df26cacSmrg      duplicate_compiler_generated_deps=yes
20096df26cacSmrg      ;;
20106df26cacSmrg    *)
20116df26cacSmrg      duplicate_compiler_generated_deps=$duplicate_deps
20126df26cacSmrg      ;;
20136df26cacSmrg    esac
20146df26cacSmrg    specialdeplibs=
20156df26cacSmrg
20166df26cacSmrg    libs=
20176df26cacSmrg    # Find all interdependent deplibs by searching for libraries
20186df26cacSmrg    # that are linked more than once (e.g. -la -lb -la)
20196df26cacSmrg    for deplib in $deplibs; do
20206df26cacSmrg      if test "X$duplicate_deps" = "Xyes" ; then
20216df26cacSmrg	case "$libs " in
20226df26cacSmrg	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
20236df26cacSmrg	esac
20246df26cacSmrg      fi
20256df26cacSmrg      libs="$libs $deplib"
20266df26cacSmrg    done
20276df26cacSmrg
20286df26cacSmrg    if test "$linkmode" = lib; then
20296df26cacSmrg      libs="$predeps $libs $compiler_lib_search_path $postdeps"
20306df26cacSmrg
20316df26cacSmrg      # Compute libraries that are listed more than once in $predeps
20326df26cacSmrg      # $postdeps and mark them as special (i.e., whose duplicates are
20336df26cacSmrg      # not to be eliminated).
20346df26cacSmrg      pre_post_deps=
20356df26cacSmrg      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
20366df26cacSmrg	for pre_post_dep in $predeps $postdeps; do
20376df26cacSmrg	  case "$pre_post_deps " in
20386df26cacSmrg	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
20396df26cacSmrg	  esac
20406df26cacSmrg	  pre_post_deps="$pre_post_deps $pre_post_dep"
20416df26cacSmrg	done
20426df26cacSmrg      fi
20436df26cacSmrg      pre_post_deps=
20446df26cacSmrg    fi
20456df26cacSmrg
20466df26cacSmrg    deplibs=
20476df26cacSmrg    newdependency_libs=
20486df26cacSmrg    newlib_search_path=
20496df26cacSmrg    need_relink=no # whether we're linking any uninstalled libtool libraries
20506df26cacSmrg    notinst_deplibs= # not-installed libtool libraries
20516df26cacSmrg    case $linkmode in
20526df26cacSmrg    lib)
20536df26cacSmrg	passes="conv link"
20546df26cacSmrg	for file in $dlfiles $dlprefiles; do
20556df26cacSmrg	  case $file in
20566df26cacSmrg	  *.la) ;;
20576df26cacSmrg	  *)
20586df26cacSmrg	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
20596df26cacSmrg	    exit $EXIT_FAILURE
20606df26cacSmrg	    ;;
20616df26cacSmrg	  esac
20626df26cacSmrg	done
20636df26cacSmrg	;;
20646df26cacSmrg    prog)
20656df26cacSmrg	compile_deplibs=
20666df26cacSmrg	finalize_deplibs=
20676df26cacSmrg	alldeplibs=no
20686df26cacSmrg	newdlfiles=
20696df26cacSmrg	newdlprefiles=
20706df26cacSmrg	passes="conv scan dlopen dlpreopen link"
20716df26cacSmrg	;;
20726df26cacSmrg    *)  passes="conv"
20736df26cacSmrg	;;
20746df26cacSmrg    esac
20756df26cacSmrg    for pass in $passes; do
20766df26cacSmrg      if test "$linkmode,$pass" = "lib,link" ||
20776df26cacSmrg	 test "$linkmode,$pass" = "prog,scan"; then
20786df26cacSmrg	libs="$deplibs"
20796df26cacSmrg	deplibs=
20806df26cacSmrg      fi
20816df26cacSmrg      if test "$linkmode" = prog; then
20826df26cacSmrg	case $pass in
20836df26cacSmrg	dlopen) libs="$dlfiles" ;;
20846df26cacSmrg	dlpreopen) libs="$dlprefiles" ;;
20856df26cacSmrg	link)
20866df26cacSmrg	  libs="$deplibs %DEPLIBS%"
20876df26cacSmrg	  test "X$link_all_deplibs" != Xno && libs="$libs $dependency_libs"
20886df26cacSmrg	  ;;
20896df26cacSmrg	esac
20906df26cacSmrg      fi
20916df26cacSmrg      if test "$pass" = dlopen; then
20926df26cacSmrg	# Collect dlpreopened libraries
20936df26cacSmrg	save_deplibs="$deplibs"
20946df26cacSmrg	deplibs=
20956df26cacSmrg      fi
20966df26cacSmrg      for deplib in $libs; do
20976df26cacSmrg	lib=
20986df26cacSmrg	found=no
20996df26cacSmrg	case $deplib in
21006df26cacSmrg	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
21016df26cacSmrg	  if test "$linkmode,$pass" = "prog,link"; then
21026df26cacSmrg	    compile_deplibs="$deplib $compile_deplibs"
21036df26cacSmrg	    finalize_deplibs="$deplib $finalize_deplibs"
21046df26cacSmrg	  else
21056df26cacSmrg	    compiler_flags="$compiler_flags $deplib"
21066df26cacSmrg	  fi
21076df26cacSmrg	  continue
21086df26cacSmrg	  ;;
21096df26cacSmrg	-l*)
21106df26cacSmrg	  if test "$linkmode" != lib && test "$linkmode" != prog; then
21116df26cacSmrg	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
21126df26cacSmrg	    continue
21136df26cacSmrg	  fi
21146df26cacSmrg	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
21156df26cacSmrg	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
21166df26cacSmrg	    for search_ext in .la $std_shrext .so .a; do
21176df26cacSmrg	      # Search the libtool library
21186df26cacSmrg	      lib="$searchdir/lib${name}${search_ext}"
21196df26cacSmrg	      if test -f "$lib"; then
21206df26cacSmrg		if test "$search_ext" = ".la"; then
21216df26cacSmrg		  found=yes
21226df26cacSmrg		else
21236df26cacSmrg		  found=no
21246df26cacSmrg		fi
21256df26cacSmrg		break 2
21266df26cacSmrg	      fi
21276df26cacSmrg	    done
21286df26cacSmrg	  done
21296df26cacSmrg	  if test "$found" != yes; then
21306df26cacSmrg	    # deplib doesn't seem to be a libtool library
21316df26cacSmrg	    if test "$linkmode,$pass" = "prog,link"; then
21326df26cacSmrg	      compile_deplibs="$deplib $compile_deplibs"
21336df26cacSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
21346df26cacSmrg	    else
21356df26cacSmrg	      deplibs="$deplib $deplibs"
21366df26cacSmrg	      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
21376df26cacSmrg	    fi
21386df26cacSmrg	    continue
21396df26cacSmrg	  else # deplib is a libtool library
21406df26cacSmrg	    # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib,
21416df26cacSmrg	    # We need to do some special things here, and not later.
21426df26cacSmrg	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
21436df26cacSmrg	      case " $predeps $postdeps " in
21446df26cacSmrg	      *" $deplib "*)
21456df26cacSmrg		if (${SED} -e '2q' $lib |
21466df26cacSmrg                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
21476df26cacSmrg		  library_names=
21486df26cacSmrg		  old_library=
21496df26cacSmrg		  case $lib in
21506df26cacSmrg		  */* | *\\*) . $lib ;;
21516df26cacSmrg		  *) . ./$lib ;;
21526df26cacSmrg		  esac
21536df26cacSmrg		  for l in $old_library $library_names; do
21546df26cacSmrg		    ll="$l"
21556df26cacSmrg		  done
21566df26cacSmrg		  if test "X$ll" = "X$old_library" ; then # only static version available
21576df26cacSmrg		    found=no
21586df26cacSmrg		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
21596df26cacSmrg		    test "X$ladir" = "X$lib" && ladir="."
21606df26cacSmrg		    lib=$ladir/$old_library
21616df26cacSmrg		    if test "$linkmode,$pass" = "prog,link"; then
21626df26cacSmrg		      compile_deplibs="$deplib $compile_deplibs"
21636df26cacSmrg		      finalize_deplibs="$deplib $finalize_deplibs"
21646df26cacSmrg		    else
21656df26cacSmrg		      deplibs="$deplib $deplibs"
21666df26cacSmrg		      test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs"
21676df26cacSmrg		    fi
21686df26cacSmrg		    continue
21696df26cacSmrg		  fi
21706df26cacSmrg		fi
21716df26cacSmrg	        ;;
21726df26cacSmrg	      *) ;;
21736df26cacSmrg	      esac
21746df26cacSmrg	    fi
21756df26cacSmrg	  fi
21766df26cacSmrg	  ;; # -l
21776df26cacSmrg	-L*)
21786df26cacSmrg	  case $linkmode in
21796df26cacSmrg	  lib)
21806df26cacSmrg	    deplibs="$deplib $deplibs"
21816df26cacSmrg	    test "$pass" = conv && continue
21826df26cacSmrg	    newdependency_libs="$deplib $newdependency_libs"
21836df26cacSmrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
21846df26cacSmrg	    ;;
21856df26cacSmrg	  prog)
21866df26cacSmrg	    if test "$pass" = conv; then
21876df26cacSmrg	      deplibs="$deplib $deplibs"
21886df26cacSmrg	      continue
21896df26cacSmrg	    fi
21906df26cacSmrg	    if test "$pass" = scan; then
21916df26cacSmrg	      deplibs="$deplib $deplibs"
21926df26cacSmrg	    else
21936df26cacSmrg	      compile_deplibs="$deplib $compile_deplibs"
21946df26cacSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
21956df26cacSmrg	    fi
21966df26cacSmrg	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
21976df26cacSmrg	    ;;
21986df26cacSmrg	  *)
21996df26cacSmrg	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
22006df26cacSmrg	    ;;
22016df26cacSmrg	  esac # linkmode
22026df26cacSmrg	  continue
22036df26cacSmrg	  ;; # -L
22046df26cacSmrg	-R*)
22056df26cacSmrg	  if test "$pass" = link; then
22066df26cacSmrg	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
22076df26cacSmrg	    # Make sure the xrpath contains only unique directories.
22086df26cacSmrg	    case "$xrpath " in
22096df26cacSmrg	    *" $dir "*) ;;
22106df26cacSmrg	    *) xrpath="$xrpath $dir" ;;
22116df26cacSmrg	    esac
22126df26cacSmrg	  fi
22136df26cacSmrg	  deplibs="$deplib $deplibs"
22146df26cacSmrg	  continue
22156df26cacSmrg	  ;;
22166df26cacSmrg	*.la) lib="$deplib" ;;
22176df26cacSmrg	*.$libext)
22186df26cacSmrg	  if test "$pass" = conv; then
22196df26cacSmrg	    deplibs="$deplib $deplibs"
22206df26cacSmrg	    continue
22216df26cacSmrg	  fi
22226df26cacSmrg	  case $linkmode in
22236df26cacSmrg	  lib)
22246df26cacSmrg	    valid_a_lib=no
22256df26cacSmrg	    case $deplibs_check_method in
22266df26cacSmrg	      match_pattern*)
22276df26cacSmrg		set dummy $deplibs_check_method
22286df26cacSmrg	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
22296df26cacSmrg		if eval $echo \"$deplib\" 2>/dev/null \
22306df26cacSmrg		    | $SED 10q \
22316df26cacSmrg		    | $EGREP "$match_pattern_regex" > /dev/null; then
22326df26cacSmrg		  valid_a_lib=yes
22336df26cacSmrg		fi
22346df26cacSmrg		;;
22356df26cacSmrg	      pass_all)
22366df26cacSmrg		valid_a_lib=yes
22376df26cacSmrg		;;
22386df26cacSmrg            esac
22396df26cacSmrg	    if test "$valid_a_lib" != yes; then
22406df26cacSmrg	      $echo
22416df26cacSmrg	      $echo "*** Warning: Trying to link with static lib archive $deplib."
22426df26cacSmrg	      $echo "*** I have the capability to make that library automatically link in when"
22436df26cacSmrg	      $echo "*** you link to this library.  But I can only do this if you have a"
22446df26cacSmrg	      $echo "*** shared version of the library, which you do not appear to have"
22456df26cacSmrg	      $echo "*** because the file extensions .$libext of this argument makes me believe"
22466df26cacSmrg	      $echo "*** that it is just a static archive that I should not used here."
22476df26cacSmrg	    else
22486df26cacSmrg	      $echo
22496df26cacSmrg	      $echo "*** Warning: Linking the shared library $output against the"
22506df26cacSmrg	      $echo "*** static library $deplib is not portable!"
22516df26cacSmrg	      deplibs="$deplib $deplibs"
22526df26cacSmrg	    fi
22536df26cacSmrg	    continue
22546df26cacSmrg	    ;;
22556df26cacSmrg	  prog)
22566df26cacSmrg	    if test "$pass" != link; then
22576df26cacSmrg	      deplibs="$deplib $deplibs"
22586df26cacSmrg	    else
22596df26cacSmrg	      compile_deplibs="$deplib $compile_deplibs"
22606df26cacSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
22616df26cacSmrg	    fi
22626df26cacSmrg	    continue
22636df26cacSmrg	    ;;
22646df26cacSmrg	  esac # linkmode
22656df26cacSmrg	  ;; # *.$libext
22666df26cacSmrg	*.lo | *.$objext)
22676df26cacSmrg	  if test "$pass" = conv; then
22686df26cacSmrg	    deplibs="$deplib $deplibs"
22696df26cacSmrg	  elif test "$linkmode" = prog; then
22706df26cacSmrg	    if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
22716df26cacSmrg	      # If there is no dlopen support or we're linking statically,
22726df26cacSmrg	      # we need to preload.
22736df26cacSmrg	      newdlprefiles="$newdlprefiles $deplib"
22746df26cacSmrg	      compile_deplibs="$deplib $compile_deplibs"
22756df26cacSmrg	      finalize_deplibs="$deplib $finalize_deplibs"
22766df26cacSmrg	    else
22776df26cacSmrg	      newdlfiles="$newdlfiles $deplib"
22786df26cacSmrg	    fi
22796df26cacSmrg	  fi
22806df26cacSmrg	  continue
22816df26cacSmrg	  ;;
22826df26cacSmrg	%DEPLIBS%)
22836df26cacSmrg	  alldeplibs=yes
22846df26cacSmrg	  continue
22856df26cacSmrg	  ;;
22866df26cacSmrg	esac # case $deplib
22876df26cacSmrg	if test "$found" = yes || test -f "$lib"; then :
22886df26cacSmrg	else
22896df26cacSmrg	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
22906df26cacSmrg	  exit $EXIT_FAILURE
22916df26cacSmrg	fi
22926df26cacSmrg
22936df26cacSmrg	# Check to see that this really is a libtool archive.
22946df26cacSmrg	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
22956df26cacSmrg	else
22966df26cacSmrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
22976df26cacSmrg	  exit $EXIT_FAILURE
22986df26cacSmrg	fi
22996df26cacSmrg
23006df26cacSmrg	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
23016df26cacSmrg	test "X$ladir" = "X$lib" && ladir="."
23026df26cacSmrg
23036df26cacSmrg	dlname=
23046df26cacSmrg	dlopen=
23056df26cacSmrg	dlpreopen=
23066df26cacSmrg	libdir=
23076df26cacSmrg	library_names=
23086df26cacSmrg	old_library=
23096df26cacSmrg	# If the library was installed with an old release of libtool,
23106df26cacSmrg	# it will not redefine variables installed, or shouldnotlink
23116df26cacSmrg	installed=yes
23126df26cacSmrg	shouldnotlink=no
23136df26cacSmrg	avoidtemprpath=
23146df26cacSmrg
23156df26cacSmrg
23166df26cacSmrg	# Read the .la file
23176df26cacSmrg	case $lib in
23186df26cacSmrg	*/* | *\\*) . $lib ;;
23196df26cacSmrg	*) . ./$lib ;;
23206df26cacSmrg	esac
23216df26cacSmrg
23226df26cacSmrg	if test "$linkmode,$pass" = "lib,link" ||
23236df26cacSmrg	   test "$linkmode,$pass" = "prog,scan" ||
23246df26cacSmrg	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
23256df26cacSmrg	  test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
23266df26cacSmrg	  test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
23276df26cacSmrg	fi
23286df26cacSmrg
23296df26cacSmrg	if test "$pass" = conv; then
23306df26cacSmrg	  # Only check for convenience libraries
23316df26cacSmrg	  deplibs="$lib $deplibs"
23326df26cacSmrg	  if test -z "$libdir"; then
23336df26cacSmrg	    if test -z "$old_library"; then
23346df26cacSmrg	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
23356df26cacSmrg	      exit $EXIT_FAILURE
23366df26cacSmrg	    fi
23376df26cacSmrg	    # It is a libtool convenience library, so add in its objects.
23386df26cacSmrg	    convenience="$convenience $ladir/$objdir/$old_library"
23396df26cacSmrg	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
23406df26cacSmrg	    tmp_libs=
23416df26cacSmrg	    for deplib in $dependency_libs; do
23426df26cacSmrg	      deplibs="$deplib $deplibs"
23436df26cacSmrg              if test "X$duplicate_deps" = "Xyes" ; then
23446df26cacSmrg	        case "$tmp_libs " in
23456df26cacSmrg	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
23466df26cacSmrg	        esac
23476df26cacSmrg              fi
23486df26cacSmrg	      tmp_libs="$tmp_libs $deplib"
23496df26cacSmrg	    done
23506df26cacSmrg	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
23516df26cacSmrg	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
23526df26cacSmrg	    exit $EXIT_FAILURE
23536df26cacSmrg	  fi
23546df26cacSmrg	  continue
23556df26cacSmrg	fi # $pass = conv
23566df26cacSmrg
23576df26cacSmrg
23586df26cacSmrg	# Get the name of the library we link against.
23596df26cacSmrg	linklib=
23606df26cacSmrg	for l in $old_library $library_names; do
23616df26cacSmrg	  linklib="$l"
23626df26cacSmrg	done
23636df26cacSmrg	if test -z "$linklib"; then
23646df26cacSmrg	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
23656df26cacSmrg	  exit $EXIT_FAILURE
23666df26cacSmrg	fi
23676df26cacSmrg
23686df26cacSmrg	# This library was specified with -dlopen.
23696df26cacSmrg	if test "$pass" = dlopen; then
23706df26cacSmrg	  if test -z "$libdir"; then
23716df26cacSmrg	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
23726df26cacSmrg	    exit $EXIT_FAILURE
23736df26cacSmrg	  fi
23746df26cacSmrg	  if test -z "$dlname" ||
23756df26cacSmrg	     test "$dlopen_support" != yes ||
23766df26cacSmrg	     test "$build_libtool_libs" = no; then
23776df26cacSmrg	    # If there is no dlname, no dlopen support or we're linking
23786df26cacSmrg	    # statically, we need to preload.  We also need to preload any
23796df26cacSmrg	    # dependent libraries so libltdl's deplib preloader doesn't
23806df26cacSmrg	    # bomb out in the load deplibs phase.
23816df26cacSmrg	    dlprefiles="$dlprefiles $lib $dependency_libs"
23826df26cacSmrg	  else
23836df26cacSmrg	    newdlfiles="$newdlfiles $lib"
23846df26cacSmrg	  fi
23856df26cacSmrg	  continue
23866df26cacSmrg	fi # $pass = dlopen
23876df26cacSmrg
23886df26cacSmrg	# We need an absolute path.
23896df26cacSmrg	case $ladir in
23906df26cacSmrg	[\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;;
23916df26cacSmrg	*)
23926df26cacSmrg	  abs_ladir=`cd "$ladir" && pwd`
23936df26cacSmrg	  if test -z "$abs_ladir"; then
23946df26cacSmrg	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
23956df26cacSmrg	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
23966df26cacSmrg	    abs_ladir="$ladir"
23976df26cacSmrg	  fi
23986df26cacSmrg	  ;;
23996df26cacSmrg	esac
24006df26cacSmrg	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
24016df26cacSmrg
24026df26cacSmrg	# Find the relevant object directory and library name.
24036df26cacSmrg	if test "X$installed" = Xyes; then
24046df26cacSmrg	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
24056df26cacSmrg	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
24066df26cacSmrg	    dir="$ladir"
24076df26cacSmrg	    absdir="$abs_ladir"
24086df26cacSmrg	    libdir="$abs_ladir"
24096df26cacSmrg	  else
24106df26cacSmrg	    dir="$libdir"
24116df26cacSmrg	    absdir="$libdir"
24126df26cacSmrg	  fi
24136df26cacSmrg	  test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
24146df26cacSmrg	else
24156df26cacSmrg	  if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then
24166df26cacSmrg	    dir="$ladir"
24176df26cacSmrg	    absdir="$abs_ladir"
24186df26cacSmrg	    # Remove this search path later
24196df26cacSmrg	    notinst_path="$notinst_path $abs_ladir"
24206df26cacSmrg	  else
24216df26cacSmrg	    dir="$ladir/$objdir"
24226df26cacSmrg	    absdir="$abs_ladir/$objdir"
24236df26cacSmrg	    # Remove this search path later
24246df26cacSmrg	    notinst_path="$notinst_path $abs_ladir"
24256df26cacSmrg	  fi
24266df26cacSmrg	fi # $installed = yes
24276df26cacSmrg	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
24286df26cacSmrg
24296df26cacSmrg	# This library was specified with -dlpreopen.
24306df26cacSmrg	if test "$pass" = dlpreopen; then
24316df26cacSmrg	  if test -z "$libdir"; then
24326df26cacSmrg	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
24336df26cacSmrg	    exit $EXIT_FAILURE
24346df26cacSmrg	  fi
24356df26cacSmrg	  # Prefer using a static library (so that no silly _DYNAMIC symbols
24366df26cacSmrg	  # are required to link).
24376df26cacSmrg	  if test -n "$old_library"; then
24386df26cacSmrg	    newdlprefiles="$newdlprefiles $dir/$old_library"
24396df26cacSmrg	  # Otherwise, use the dlname, so that lt_dlopen finds it.
24406df26cacSmrg	  elif test -n "$dlname"; then
24416df26cacSmrg	    newdlprefiles="$newdlprefiles $dir/$dlname"
24426df26cacSmrg	  else
24436df26cacSmrg	    newdlprefiles="$newdlprefiles $dir/$linklib"
24446df26cacSmrg	  fi
24456df26cacSmrg	fi # $pass = dlpreopen
24466df26cacSmrg
24476df26cacSmrg	if test -z "$libdir"; then
24486df26cacSmrg	  # Link the convenience library
24496df26cacSmrg	  if test "$linkmode" = lib; then
24506df26cacSmrg	    deplibs="$dir/$old_library $deplibs"
24516df26cacSmrg	  elif test "$linkmode,$pass" = "prog,link"; then
24526df26cacSmrg	    compile_deplibs="$dir/$old_library $compile_deplibs"
24536df26cacSmrg	    finalize_deplibs="$dir/$old_library $finalize_deplibs"
24546df26cacSmrg	  else
24556df26cacSmrg	    deplibs="$lib $deplibs" # used for prog,scan pass
24566df26cacSmrg	  fi
24576df26cacSmrg	  continue
24586df26cacSmrg	fi
24596df26cacSmrg
24606df26cacSmrg
24616df26cacSmrg	if test "$linkmode" = prog && test "$pass" != link; then
24626df26cacSmrg	  newlib_search_path="$newlib_search_path $ladir"
24636df26cacSmrg	  deplibs="$lib $deplibs"
24646df26cacSmrg
24656df26cacSmrg	  linkalldeplibs=no
24666df26cacSmrg	  if test "$link_all_deplibs" != no || test -z "$library_names" ||
24676df26cacSmrg	     test "$build_libtool_libs" = no; then
24686df26cacSmrg	    linkalldeplibs=yes
24696df26cacSmrg	  fi
24706df26cacSmrg
24716df26cacSmrg	  tmp_libs=
24726df26cacSmrg	  for deplib in $dependency_libs; do
24736df26cacSmrg	    case $deplib in
24746df26cacSmrg	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
24756df26cacSmrg	    esac
24766df26cacSmrg	    # Need to link against all dependency_libs?
24776df26cacSmrg	    if test "$linkalldeplibs" = yes; then
24786df26cacSmrg	      deplibs="$deplib $deplibs"
24796df26cacSmrg	    else
24806df26cacSmrg	      # Need to hardcode shared library paths
24816df26cacSmrg	      # or/and link against static libraries
24826df26cacSmrg	      newdependency_libs="$deplib $newdependency_libs"
24836df26cacSmrg	    fi
24846df26cacSmrg	    if test "X$duplicate_deps" = "Xyes" ; then
24856df26cacSmrg	      case "$tmp_libs " in
24866df26cacSmrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
24876df26cacSmrg	      esac
24886df26cacSmrg	    fi
24896df26cacSmrg	    tmp_libs="$tmp_libs $deplib"
24906df26cacSmrg	  done # for deplib
24916df26cacSmrg	  continue
24926df26cacSmrg	fi # $linkmode = prog...
24936df26cacSmrg
24946df26cacSmrg	if test "$linkmode,$pass" = "prog,link"; then
24956df26cacSmrg	  if test -n "$library_names" &&
24966df26cacSmrg	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
24976df26cacSmrg	    # We need to hardcode the library path
24986df26cacSmrg	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
24996df26cacSmrg	      # Make sure the rpath contains only unique directories.
25006df26cacSmrg	      case "$temp_rpath " in
25016df26cacSmrg	      *" $dir "*) ;;
25026df26cacSmrg	      *" $absdir "*) ;;
25036df26cacSmrg	      *) temp_rpath="$temp_rpath $absdir" ;;
25046df26cacSmrg	      esac
25056df26cacSmrg	    fi
25066df26cacSmrg
25076df26cacSmrg	    # Hardcode the library path.
25086df26cacSmrg	    # Skip directories that are in the system default run-time
25096df26cacSmrg	    # search path.
25106df26cacSmrg	    case " $sys_lib_dlsearch_path " in
25116df26cacSmrg	    *" $absdir "*) ;;
25126df26cacSmrg	    *)
25136df26cacSmrg	      case "$compile_rpath " in
25146df26cacSmrg	      *" $absdir "*) ;;
25156df26cacSmrg	      *) compile_rpath="$compile_rpath $absdir"
25166df26cacSmrg	      esac
25176df26cacSmrg	      ;;
25186df26cacSmrg	    esac
25196df26cacSmrg	    case " $sys_lib_dlsearch_path " in
25206df26cacSmrg	    *" $libdir "*) ;;
25216df26cacSmrg	    *)
25226df26cacSmrg	      case "$finalize_rpath " in
25236df26cacSmrg	      *" $libdir "*) ;;
25246df26cacSmrg	      *) finalize_rpath="$finalize_rpath $libdir"
25256df26cacSmrg	      esac
25266df26cacSmrg	      ;;
25276df26cacSmrg	    esac
25286df26cacSmrg	  fi # $linkmode,$pass = prog,link...
25296df26cacSmrg
25306df26cacSmrg	  if test "$alldeplibs" = yes &&
25316df26cacSmrg	     { test "$deplibs_check_method" = pass_all ||
25326df26cacSmrg	       { test "$build_libtool_libs" = yes &&
25336df26cacSmrg		 test -n "$library_names"; }; }; then
25346df26cacSmrg	    # We only need to search for static libraries
25356df26cacSmrg	    continue
25366df26cacSmrg	  fi
25376df26cacSmrg	fi
25386df26cacSmrg
25396df26cacSmrg	link_static=no # Whether the deplib will be linked statically
25406df26cacSmrg	use_static_libs=$prefer_static_libs
25416df26cacSmrg	if test "$use_static_libs" = built && test "$installed" = yes ; then
25426df26cacSmrg	  use_static_libs=no
25436df26cacSmrg	fi
25446df26cacSmrg	if test -n "$library_names" &&
25456df26cacSmrg	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
25466df26cacSmrg	  if test "$installed" = no; then
25476df26cacSmrg	    notinst_deplibs="$notinst_deplibs $lib"
25486df26cacSmrg	    need_relink=yes
25496df26cacSmrg	  fi
25506df26cacSmrg	  # This is a shared library
25516df26cacSmrg
25526df26cacSmrg	  # Warn about portability, can't link against -module's on
25536df26cacSmrg	  # some systems (darwin)
25546df26cacSmrg	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
25556df26cacSmrg	    $echo
25566df26cacSmrg	    if test "$linkmode" = prog; then
25576df26cacSmrg	      $echo "*** Warning: Linking the executable $output against the loadable module"
25586df26cacSmrg	    else
25596df26cacSmrg	      $echo "*** Warning: Linking the shared library $output against the loadable module"
25606df26cacSmrg	    fi
25616df26cacSmrg	    $echo "*** $linklib is not portable!"
25626df26cacSmrg	  fi
25636df26cacSmrg	  if test "$linkmode" = lib &&
25646df26cacSmrg	     test "$hardcode_into_libs" = yes; then
25656df26cacSmrg	    # Hardcode the library path.
25666df26cacSmrg	    # Skip directories that are in the system default run-time
25676df26cacSmrg	    # search path.
25686df26cacSmrg	    case " $sys_lib_dlsearch_path " in
25696df26cacSmrg	    *" $absdir "*) ;;
25706df26cacSmrg	    *)
25716df26cacSmrg	      case "$compile_rpath " in
25726df26cacSmrg	      *" $absdir "*) ;;
25736df26cacSmrg	      *) compile_rpath="$compile_rpath $absdir"
25746df26cacSmrg	      esac
25756df26cacSmrg	      ;;
25766df26cacSmrg	    esac
25776df26cacSmrg	    case " $sys_lib_dlsearch_path " in
25786df26cacSmrg	    *" $libdir "*) ;;
25796df26cacSmrg	    *)
25806df26cacSmrg	      case "$finalize_rpath " in
25816df26cacSmrg	      *" $libdir "*) ;;
25826df26cacSmrg	      *) finalize_rpath="$finalize_rpath $libdir"
25836df26cacSmrg	      esac
25846df26cacSmrg	      ;;
25856df26cacSmrg	    esac
25866df26cacSmrg	  fi
25876df26cacSmrg
25886df26cacSmrg	  if test -n "$old_archive_from_expsyms_cmds"; then
25896df26cacSmrg	    # figure out the soname
25906df26cacSmrg	    set dummy $library_names
25916df26cacSmrg	    realname="$2"
25926df26cacSmrg	    shift; shift
25936df26cacSmrg	    libname=`eval \\$echo \"$libname_spec\"`
25946df26cacSmrg	    # use dlname if we got it. it's perfectly good, no?
25956df26cacSmrg	    if test -n "$dlname"; then
25966df26cacSmrg	      soname="$dlname"
25976df26cacSmrg	    elif test -n "$soname_spec"; then
25986df26cacSmrg	      # bleh windows
25996df26cacSmrg	      case $host in
26006df26cacSmrg	      *cygwin* | mingw*)
26016df26cacSmrg		major=`expr $current - $age`
26026df26cacSmrg		versuffix="-$major"
26036df26cacSmrg		;;
26046df26cacSmrg	      esac
26056df26cacSmrg	      eval soname=\"$soname_spec\"
26066df26cacSmrg	    else
26076df26cacSmrg	      soname="$realname"
26086df26cacSmrg	    fi
26096df26cacSmrg
26106df26cacSmrg	    # Make a new name for the extract_expsyms_cmds to use
26116df26cacSmrg	    soroot="$soname"
26126df26cacSmrg	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
26136df26cacSmrg	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
26146df26cacSmrg
26156df26cacSmrg	    # If the library has no export list, then create one now
26166df26cacSmrg	    if test -f "$output_objdir/$soname-def"; then :
26176df26cacSmrg	    else
26186df26cacSmrg	      $show "extracting exported symbol list from \`$soname'"
26196df26cacSmrg	      save_ifs="$IFS"; IFS='~'
26206df26cacSmrg	      cmds=$extract_expsyms_cmds
26216df26cacSmrg	      for cmd in $cmds; do
26226df26cacSmrg		IFS="$save_ifs"
26236df26cacSmrg		eval cmd=\"$cmd\"
26246df26cacSmrg		$show "$cmd"
26256df26cacSmrg		$run eval "$cmd" || exit $?
26266df26cacSmrg	      done
26276df26cacSmrg	      IFS="$save_ifs"
26286df26cacSmrg	    fi
26296df26cacSmrg
26306df26cacSmrg	    # Create $newlib
26316df26cacSmrg	    if test -f "$output_objdir/$newlib"; then :; else
26326df26cacSmrg	      $show "generating import library for \`$soname'"
26336df26cacSmrg	      save_ifs="$IFS"; IFS='~'
26346df26cacSmrg	      cmds=$old_archive_from_expsyms_cmds
26356df26cacSmrg	      for cmd in $cmds; do
26366df26cacSmrg		IFS="$save_ifs"
26376df26cacSmrg		eval cmd=\"$cmd\"
26386df26cacSmrg		$show "$cmd"
26396df26cacSmrg		$run eval "$cmd" || exit $?
26406df26cacSmrg	      done
26416df26cacSmrg	      IFS="$save_ifs"
26426df26cacSmrg	    fi
26436df26cacSmrg	    # make sure the library variables are pointing to the new library
26446df26cacSmrg	    dir=$output_objdir
26456df26cacSmrg	    linklib=$newlib
26466df26cacSmrg	  fi # test -n "$old_archive_from_expsyms_cmds"
26476df26cacSmrg
26486df26cacSmrg	  if test "$linkmode" = prog || test "$mode" != relink; then
26496df26cacSmrg	    add_shlibpath=
26506df26cacSmrg	    add_dir=
26516df26cacSmrg	    add=
26526df26cacSmrg	    lib_linked=yes
26536df26cacSmrg	    case $hardcode_action in
26546df26cacSmrg	    immediate | unsupported)
26556df26cacSmrg	      if test "$hardcode_direct" = no; then
26566df26cacSmrg		add="$dir/$linklib"
26576df26cacSmrg		case $host in
26586df26cacSmrg		  *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;;
26596df26cacSmrg		  *-*-sysv4*uw2*) add_dir="-L$dir" ;;
26606df26cacSmrg		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
26616df26cacSmrg		    *-*-unixware7*) add_dir="-L$dir" ;;
26626df26cacSmrg		  *-*-darwin* )
26636df26cacSmrg		    # if the lib is a module then we can not link against
26646df26cacSmrg		    # it, someone is ignoring the new warnings I added
26656df26cacSmrg		    if /usr/bin/file -L $add 2> /dev/null |
26666df26cacSmrg                      $EGREP ": [^:]* bundle" >/dev/null ; then
26676df26cacSmrg		      $echo "** Warning, lib $linklib is a module, not a shared library"
26686df26cacSmrg		      if test -z "$old_library" ; then
26696df26cacSmrg		        $echo
26706df26cacSmrg		        $echo "** And there doesn't seem to be a static archive available"
26716df26cacSmrg		        $echo "** The link will probably fail, sorry"
26726df26cacSmrg		      else
26736df26cacSmrg		        add="$dir/$old_library"
26746df26cacSmrg		      fi
26756df26cacSmrg		    fi
26766df26cacSmrg		esac
26776df26cacSmrg	      elif test "$hardcode_minus_L" = no; then
26786df26cacSmrg		case $host in
26796df26cacSmrg		*-*-sunos*) add_shlibpath="$dir" ;;
26806df26cacSmrg		esac
26816df26cacSmrg		add_dir="-L$dir"
26826df26cacSmrg		add="-l$name"
26836df26cacSmrg	      elif test "$hardcode_shlibpath_var" = no; then
26846df26cacSmrg		add_shlibpath="$dir"
26856df26cacSmrg		add="-l$name"
26866df26cacSmrg	      else
26876df26cacSmrg		lib_linked=no
26886df26cacSmrg	      fi
26896df26cacSmrg	      ;;
26906df26cacSmrg	    relink)
26916df26cacSmrg	      if test "$hardcode_direct" = yes; then
26926df26cacSmrg		add="$dir/$linklib"
26936df26cacSmrg	      elif test "$hardcode_minus_L" = yes; then
26946df26cacSmrg		add_dir="-L$dir"
26956df26cacSmrg		# Try looking first in the location we're being installed to.
26966df26cacSmrg		if test -n "$inst_prefix_dir"; then
26976df26cacSmrg		  case $libdir in
26986df26cacSmrg		    [\\/]*)
26996df26cacSmrg		      add_dir="$add_dir -L$inst_prefix_dir$libdir"
27006df26cacSmrg		      ;;
27016df26cacSmrg		  esac
27026df26cacSmrg		fi
27036df26cacSmrg		add="-l$name"
27046df26cacSmrg	      elif test "$hardcode_shlibpath_var" = yes; then
27056df26cacSmrg		add_shlibpath="$dir"
27066df26cacSmrg		add="-l$name"
27076df26cacSmrg	      else
27086df26cacSmrg		lib_linked=no
27096df26cacSmrg	      fi
27106df26cacSmrg	      ;;
27116df26cacSmrg	    *) lib_linked=no ;;
27126df26cacSmrg	    esac
27136df26cacSmrg
27146df26cacSmrg	    if test "$lib_linked" != yes; then
27156df26cacSmrg	      $echo "$modename: configuration error: unsupported hardcode properties"
27166df26cacSmrg	      exit $EXIT_FAILURE
27176df26cacSmrg	    fi
27186df26cacSmrg
27196df26cacSmrg	    if test -n "$add_shlibpath"; then
27206df26cacSmrg	      case :$compile_shlibpath: in
27216df26cacSmrg	      *":$add_shlibpath:"*) ;;
27226df26cacSmrg	      *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
27236df26cacSmrg	      esac
27246df26cacSmrg	    fi
27256df26cacSmrg	    if test "$linkmode" = prog; then
27266df26cacSmrg	      test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs"
27276df26cacSmrg	      test -n "$add" && compile_deplibs="$add $compile_deplibs"
27286df26cacSmrg	    else
27296df26cacSmrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
27306df26cacSmrg	      test -n "$add" && deplibs="$add $deplibs"
27316df26cacSmrg	      if test "$hardcode_direct" != yes && \
27326df26cacSmrg		 test "$hardcode_minus_L" != yes && \
27336df26cacSmrg		 test "$hardcode_shlibpath_var" = yes; then
27346df26cacSmrg		case :$finalize_shlibpath: in
27356df26cacSmrg		*":$libdir:"*) ;;
27366df26cacSmrg		*) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
27376df26cacSmrg		esac
27386df26cacSmrg	      fi
27396df26cacSmrg	    fi
27406df26cacSmrg	  fi
27416df26cacSmrg
27426df26cacSmrg	  if test "$linkmode" = prog || test "$mode" = relink; then
27436df26cacSmrg	    add_shlibpath=
27446df26cacSmrg	    add_dir=
27456df26cacSmrg	    add=
27466df26cacSmrg	    # Finalize command for both is simple: just hardcode it.
27476df26cacSmrg	    if test "$hardcode_direct" = yes; then
27486df26cacSmrg	      add="$libdir/$linklib"
27496df26cacSmrg	    elif test "$hardcode_minus_L" = yes; then
27506df26cacSmrg	      add_dir="-L$libdir"
27516df26cacSmrg	      add="-l$name"
27526df26cacSmrg	    elif test "$hardcode_shlibpath_var" = yes; then
27536df26cacSmrg	      case :$finalize_shlibpath: in
27546df26cacSmrg	      *":$libdir:"*) ;;
27556df26cacSmrg	      *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
27566df26cacSmrg	      esac
27576df26cacSmrg	      add="-l$name"
27586df26cacSmrg	    elif test "$hardcode_automatic" = yes; then
27596df26cacSmrg	      if test -n "$inst_prefix_dir" &&
27606df26cacSmrg		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
27616df26cacSmrg	        add="$inst_prefix_dir$libdir/$linklib"
27626df26cacSmrg	      else
27636df26cacSmrg	        add="$libdir/$linklib"
27646df26cacSmrg	      fi
27656df26cacSmrg	    else
27666df26cacSmrg	      # We cannot seem to hardcode it, guess we'll fake it.
27676df26cacSmrg	      add_dir="-L$libdir"
27686df26cacSmrg	      # Try looking first in the location we're being installed to.
27696df26cacSmrg	      if test -n "$inst_prefix_dir"; then
27706df26cacSmrg		case $libdir in
27716df26cacSmrg		  [\\/]*)
27726df26cacSmrg		    add_dir="$add_dir -L$inst_prefix_dir$libdir"
27736df26cacSmrg		    ;;
27746df26cacSmrg		esac
27756df26cacSmrg	      fi
27766df26cacSmrg	      add="-l$name"
27776df26cacSmrg	    fi
27786df26cacSmrg
27796df26cacSmrg	    if test "$linkmode" = prog; then
27806df26cacSmrg	      test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs"
27816df26cacSmrg	      test -n "$add" && finalize_deplibs="$add $finalize_deplibs"
27826df26cacSmrg	    else
27836df26cacSmrg	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
27846df26cacSmrg	      test -n "$add" && deplibs="$add $deplibs"
27856df26cacSmrg	    fi
27866df26cacSmrg	  fi
27876df26cacSmrg	elif test "$linkmode" = prog; then
27886df26cacSmrg	  # Here we assume that one of hardcode_direct or hardcode_minus_L
27896df26cacSmrg	  # is not unsupported.  This is valid on all known static and
27906df26cacSmrg	  # shared platforms.
27916df26cacSmrg	  if test "$hardcode_direct" != unsupported; then
27926df26cacSmrg	    test -n "$old_library" && linklib="$old_library"
27936df26cacSmrg	    compile_deplibs="$dir/$linklib $compile_deplibs"
27946df26cacSmrg	    finalize_deplibs="$dir/$linklib $finalize_deplibs"
27956df26cacSmrg	  else
27966df26cacSmrg	    compile_deplibs="-l$name -L$dir $compile_deplibs"
27976df26cacSmrg	    finalize_deplibs="-l$name -L$dir $finalize_deplibs"
27986df26cacSmrg	  fi
27996df26cacSmrg	elif test "$build_libtool_libs" = yes; then
28006df26cacSmrg	  # Not a shared library
28016df26cacSmrg	  if test "$deplibs_check_method" != pass_all; then
28026df26cacSmrg	    # We're trying link a shared library against a static one
28036df26cacSmrg	    # but the system doesn't support it.
28046df26cacSmrg
28056df26cacSmrg	    # Just print a warning and add the library to dependency_libs so
28066df26cacSmrg	    # that the program can be linked against the static library.
28076df26cacSmrg	    $echo
28086df26cacSmrg	    $echo "*** Warning: This system can not link to static lib archive $lib."
28096df26cacSmrg	    $echo "*** I have the capability to make that library automatically link in when"
28106df26cacSmrg	    $echo "*** you link to this library.  But I can only do this if you have a"
28116df26cacSmrg	    $echo "*** shared version of the library, which you do not appear to have."
28126df26cacSmrg	    if test "$module" = yes; then
28136df26cacSmrg	      $echo "*** But as you try to build a module library, libtool will still create "
28146df26cacSmrg	      $echo "*** a static module, that should work as long as the dlopening application"
28156df26cacSmrg	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
28166df26cacSmrg	      if test -z "$global_symbol_pipe"; then
28176df26cacSmrg		$echo
28186df26cacSmrg		$echo "*** However, this would only work if libtool was able to extract symbol"
28196df26cacSmrg		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
28206df26cacSmrg		$echo "*** not find such a program.  So, this module is probably useless."
28216df26cacSmrg		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
28226df26cacSmrg	      fi
28236df26cacSmrg	      if test "$build_old_libs" = no; then
28246df26cacSmrg		build_libtool_libs=module
28256df26cacSmrg		build_old_libs=yes
28266df26cacSmrg	      else
28276df26cacSmrg		build_libtool_libs=no
28286df26cacSmrg	      fi
28296df26cacSmrg	    fi
28306df26cacSmrg	  else
28316df26cacSmrg	    deplibs="$dir/$old_library $deplibs"
28326df26cacSmrg	    link_static=yes
28336df26cacSmrg	  fi
28346df26cacSmrg	fi # link shared/static library?
28356df26cacSmrg
28366df26cacSmrg	if test "$linkmode" = lib; then
28376df26cacSmrg	  if test -n "$dependency_libs" &&
28386df26cacSmrg	     { test "$hardcode_into_libs" != yes ||
28396df26cacSmrg	       test "$build_old_libs" = yes ||
28406df26cacSmrg	       test "$link_static" = yes; }; then
28416df26cacSmrg	    # Extract -R from dependency_libs
28426df26cacSmrg	    temp_deplibs=
28436df26cacSmrg	    for libdir in $dependency_libs; do
28446df26cacSmrg	      case $libdir in
28456df26cacSmrg	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
28466df26cacSmrg		   case " $xrpath " in
28476df26cacSmrg		   *" $temp_xrpath "*) ;;
28486df26cacSmrg		   *) xrpath="$xrpath $temp_xrpath";;
28496df26cacSmrg		   esac;;
28506df26cacSmrg	      *) temp_deplibs="$temp_deplibs $libdir";;
28516df26cacSmrg	      esac
28526df26cacSmrg	    done
28536df26cacSmrg	    dependency_libs="$temp_deplibs"
28546df26cacSmrg	  fi
28556df26cacSmrg
28566df26cacSmrg	  newlib_search_path="$newlib_search_path $absdir"
28576df26cacSmrg	  # Link against this library
28586df26cacSmrg	  test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
28596df26cacSmrg	  # ... and its dependency_libs
28606df26cacSmrg	  tmp_libs=
28616df26cacSmrg	  for deplib in $dependency_libs; do
28626df26cacSmrg	    newdependency_libs="$deplib $newdependency_libs"
28636df26cacSmrg	    if test "X$duplicate_deps" = "Xyes" ; then
28646df26cacSmrg	      case "$tmp_libs " in
28656df26cacSmrg	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
28666df26cacSmrg	      esac
28676df26cacSmrg	    fi
28686df26cacSmrg	    tmp_libs="$tmp_libs $deplib"
28696df26cacSmrg	  done
28706df26cacSmrg
28716df26cacSmrg	  if test "$link_all_deplibs" != no; then
28726df26cacSmrg	    # Add the search paths of all dependency libraries
28736df26cacSmrg	    for deplib in $dependency_libs; do
28746df26cacSmrg	      case $deplib in
28756df26cacSmrg	      -L*) path="$deplib" ;;
28766df26cacSmrg	      *.la)
28776df26cacSmrg		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
28786df26cacSmrg		test "X$dir" = "X$deplib" && dir="."
28796df26cacSmrg		# We need an absolute path.
28806df26cacSmrg		case $dir in
28816df26cacSmrg		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
28826df26cacSmrg		*)
28836df26cacSmrg		  absdir=`cd "$dir" && pwd`
28846df26cacSmrg		  if test -z "$absdir"; then
28856df26cacSmrg		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
28866df26cacSmrg		    absdir="$dir"
28876df26cacSmrg		  fi
28886df26cacSmrg		  ;;
28896df26cacSmrg		esac
28906df26cacSmrg		if grep "^installed=no" $deplib > /dev/null; then
28916df26cacSmrg		  path="$absdir/$objdir"
28926df26cacSmrg		else
28936df26cacSmrg		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
28946df26cacSmrg		  if test -z "$libdir"; then
28956df26cacSmrg		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
28966df26cacSmrg		    exit $EXIT_FAILURE
28976df26cacSmrg		  fi
28986df26cacSmrg		  if test "$absdir" != "$libdir"; then
28996df26cacSmrg		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
29006df26cacSmrg		  fi
29016df26cacSmrg		  path="$absdir"
29026df26cacSmrg		fi
29036df26cacSmrg		depdepl=
29046df26cacSmrg		case $host in
29056df26cacSmrg		*-*-darwin*)
29066df26cacSmrg		  # we do not want to link against static libs,
29076df26cacSmrg		  # but need to link against shared
29086df26cacSmrg		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
29096df26cacSmrg		  if test -n "$deplibrary_names" ; then
29106df26cacSmrg		    for tmp in $deplibrary_names ; do
29116df26cacSmrg		      depdepl=$tmp
29126df26cacSmrg		    done
29136df26cacSmrg		    if test -f "$path/$depdepl" ; then
29146df26cacSmrg		      depdepl="$path/$depdepl"
29156df26cacSmrg		    fi
29166df26cacSmrg		    # do not add paths which are already there
29176df26cacSmrg		    case " $newlib_search_path " in
29186df26cacSmrg		    *" $path "*) ;;
29196df26cacSmrg		    *) newlib_search_path="$newlib_search_path $path";;
29206df26cacSmrg		    esac
29216df26cacSmrg		  fi
29226df26cacSmrg		  path=""
29236df26cacSmrg		  ;;
29246df26cacSmrg		*)
29256df26cacSmrg		  path="-L$path"
29266df26cacSmrg		  ;;
29276df26cacSmrg		esac
29286df26cacSmrg		;;
29296df26cacSmrg	      -l*)
29306df26cacSmrg		case $host in
29316df26cacSmrg		*-*-darwin*)
29326df26cacSmrg		  # Again, we only want to link against shared libraries
29336df26cacSmrg		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
29346df26cacSmrg		  for tmp in $newlib_search_path ; do
29356df26cacSmrg		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
29366df26cacSmrg		      eval depdepl="$tmp/lib$tmp_libs.dylib"
29376df26cacSmrg		      break
29386df26cacSmrg		    fi
29396df26cacSmrg		  done
29406df26cacSmrg		  path=""
29416df26cacSmrg		  ;;
29426df26cacSmrg		*) continue ;;
29436df26cacSmrg		esac
29446df26cacSmrg		;;
29456df26cacSmrg	      *) continue ;;
29466df26cacSmrg	      esac
29476df26cacSmrg	      case " $deplibs " in
29486df26cacSmrg	      *" $path "*) ;;
29496df26cacSmrg	      *) deplibs="$path $deplibs" ;;
29506df26cacSmrg	      esac
29516df26cacSmrg	      case " $deplibs " in
29526df26cacSmrg	      *" $depdepl "*) ;;
29536df26cacSmrg	      *) deplibs="$depdepl $deplibs" ;;
29546df26cacSmrg	      esac
29556df26cacSmrg	    done
29566df26cacSmrg	  fi # link_all_deplibs != no
29576df26cacSmrg	fi # linkmode = lib
29586df26cacSmrg      done # for deplib in $libs
29596df26cacSmrg      dependency_libs="$newdependency_libs"
29606df26cacSmrg      if test "$pass" = dlpreopen; then
29616df26cacSmrg	# Link the dlpreopened libraries before other libraries
29626df26cacSmrg	for deplib in $save_deplibs; do
29636df26cacSmrg	  deplibs="$deplib $deplibs"
29646df26cacSmrg	done
29656df26cacSmrg      fi
29666df26cacSmrg      if test "$pass" != dlopen; then
29676df26cacSmrg	if test "$pass" != conv; then
29686df26cacSmrg	  # Make sure lib_search_path contains only unique directories.
29696df26cacSmrg	  lib_search_path=
29706df26cacSmrg	  for dir in $newlib_search_path; do
29716df26cacSmrg	    case "$lib_search_path " in
29726df26cacSmrg	    *" $dir "*) ;;
29736df26cacSmrg	    *) lib_search_path="$lib_search_path $dir" ;;
29746df26cacSmrg	    esac
29756df26cacSmrg	  done
29766df26cacSmrg	  newlib_search_path=
29776df26cacSmrg	fi
29786df26cacSmrg
29796df26cacSmrg	if test "$linkmode,$pass" != "prog,link"; then
29806df26cacSmrg	  vars="deplibs"
29816df26cacSmrg	else
29826df26cacSmrg	  vars="compile_deplibs finalize_deplibs"
29836df26cacSmrg	fi
29846df26cacSmrg	for var in $vars dependency_libs; do
29856df26cacSmrg	  # Add libraries to $var in reverse order
29866df26cacSmrg	  eval tmp_libs=\"\$$var\"
29876df26cacSmrg	  new_libs=
29886df26cacSmrg	  for deplib in $tmp_libs; do
29896df26cacSmrg	    # FIXME: Pedantically, this is the right thing to do, so
29906df26cacSmrg	    #        that some nasty dependency loop isn't accidentally
29916df26cacSmrg	    #        broken:
29926df26cacSmrg	    #new_libs="$deplib $new_libs"
29936df26cacSmrg	    # Pragmatically, this seems to cause very few problems in
29946df26cacSmrg	    # practice:
29956df26cacSmrg	    case $deplib in
29966df26cacSmrg	    -L*) new_libs="$deplib $new_libs" ;;
29976df26cacSmrg	    -R*) ;;
29986df26cacSmrg	    *)
29996df26cacSmrg	      # And here is the reason: when a library appears more
30006df26cacSmrg	      # than once as an explicit dependence of a library, or
30016df26cacSmrg	      # is implicitly linked in more than once by the
30026df26cacSmrg	      # compiler, it is considered special, and multiple
30036df26cacSmrg	      # occurrences thereof are not removed.  Compare this
30046df26cacSmrg	      # with having the same library being listed as a
30056df26cacSmrg	      # dependency of multiple other libraries: in this case,
30066df26cacSmrg	      # we know (pedantically, we assume) the library does not
30076df26cacSmrg	      # need to be listed more than once, so we keep only the
30086df26cacSmrg	      # last copy.  This is not always right, but it is rare
30096df26cacSmrg	      # enough that we require users that really mean to play
30106df26cacSmrg	      # such unportable linking tricks to link the library
30116df26cacSmrg	      # using -Wl,-lname, so that libtool does not consider it
30126df26cacSmrg	      # for duplicate removal.
30136df26cacSmrg	      case " $specialdeplibs " in
30146df26cacSmrg	      *" $deplib "*) new_libs="$deplib $new_libs" ;;
30156df26cacSmrg	      *)
30166df26cacSmrg		case " $new_libs " in
30176df26cacSmrg		*" $deplib "*) ;;
30186df26cacSmrg		*) new_libs="$deplib $new_libs" ;;
30196df26cacSmrg		esac
30206df26cacSmrg		;;
30216df26cacSmrg	      esac
30226df26cacSmrg	      ;;
30236df26cacSmrg	    esac
30246df26cacSmrg	  done
30256df26cacSmrg	  tmp_libs=
30266df26cacSmrg	  for deplib in $new_libs; do
30276df26cacSmrg	    case $deplib in
30286df26cacSmrg	    -L*)
30296df26cacSmrg	      case " $tmp_libs " in
30306df26cacSmrg	      *" $deplib "*) ;;
30316df26cacSmrg	      *) tmp_libs="$tmp_libs $deplib" ;;
30326df26cacSmrg	      esac
30336df26cacSmrg	      ;;
30346df26cacSmrg	    *) tmp_libs="$tmp_libs $deplib" ;;
30356df26cacSmrg	    esac
30366df26cacSmrg	  done
30376df26cacSmrg	  eval $var=\"$tmp_libs\"
30386df26cacSmrg	done # for var
30396df26cacSmrg      fi
30406df26cacSmrg      # Last step: remove runtime libs from dependency_libs
30416df26cacSmrg      # (they stay in deplibs)
30426df26cacSmrg      tmp_libs=
30436df26cacSmrg      for i in $dependency_libs ; do
30446df26cacSmrg	case " $predeps $postdeps $compiler_lib_search_path " in
30456df26cacSmrg	*" $i "*)
30466df26cacSmrg	  i=""
30476df26cacSmrg	  ;;
30486df26cacSmrg	esac
30496df26cacSmrg	if test -n "$i" ; then
30506df26cacSmrg	  tmp_libs="$tmp_libs $i"
30516df26cacSmrg	fi
30526df26cacSmrg      done
30536df26cacSmrg      dependency_libs=$tmp_libs
30546df26cacSmrg    done # for pass
30556df26cacSmrg    if test "$linkmode" = prog; then
30566df26cacSmrg      dlfiles="$newdlfiles"
30576df26cacSmrg      dlprefiles="$newdlprefiles"
30586df26cacSmrg    fi
30596df26cacSmrg
30606df26cacSmrg    case $linkmode in
30616df26cacSmrg    oldlib)
30626df26cacSmrg      if test -n "$deplibs"; then
30636df26cacSmrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
30646df26cacSmrg      fi
30656df26cacSmrg
30666df26cacSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
30676df26cacSmrg	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
30686df26cacSmrg      fi
30696df26cacSmrg
30706df26cacSmrg      if test -n "$rpath"; then
30716df26cacSmrg	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
30726df26cacSmrg      fi
30736df26cacSmrg
30746df26cacSmrg      if test -n "$xrpath"; then
30756df26cacSmrg	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
30766df26cacSmrg      fi
30776df26cacSmrg
30786df26cacSmrg      if test -n "$vinfo"; then
30796df26cacSmrg	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
30806df26cacSmrg      fi
30816df26cacSmrg
30826df26cacSmrg      if test -n "$release"; then
30836df26cacSmrg	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
30846df26cacSmrg      fi
30856df26cacSmrg
30866df26cacSmrg      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
30876df26cacSmrg	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
30886df26cacSmrg      fi
30896df26cacSmrg
30906df26cacSmrg      # Now set the variables for building old libraries.
30916df26cacSmrg      build_libtool_libs=no
30926df26cacSmrg      oldlibs="$output"
30936df26cacSmrg      objs="$objs$old_deplibs"
30946df26cacSmrg      ;;
30956df26cacSmrg
30966df26cacSmrg    lib)
30976df26cacSmrg      # Make sure we only generate libraries of the form `libNAME.la'.
30986df26cacSmrg      case $outputname in
30996df26cacSmrg      lib*)
31006df26cacSmrg	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
31016df26cacSmrg	eval shared_ext=\"$shrext_cmds\"
31026df26cacSmrg	eval libname=\"$libname_spec\"
31036df26cacSmrg	;;
31046df26cacSmrg      *)
31056df26cacSmrg	if test "$module" = no; then
31066df26cacSmrg	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
31076df26cacSmrg	  $echo "$help" 1>&2
31086df26cacSmrg	  exit $EXIT_FAILURE
31096df26cacSmrg	fi
31106df26cacSmrg	if test "$need_lib_prefix" != no; then
31116df26cacSmrg	  # Add the "lib" prefix for modules if required
31126df26cacSmrg	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
31136df26cacSmrg	  eval shared_ext=\"$shrext_cmds\"
31146df26cacSmrg	  eval libname=\"$libname_spec\"
31156df26cacSmrg	else
31166df26cacSmrg	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
31176df26cacSmrg	fi
31186df26cacSmrg	;;
31196df26cacSmrg      esac
31206df26cacSmrg
31216df26cacSmrg      if test -n "$objs"; then
31226df26cacSmrg	if test "$deplibs_check_method" != pass_all; then
31236df26cacSmrg	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
31246df26cacSmrg	  exit $EXIT_FAILURE
31256df26cacSmrg	else
31266df26cacSmrg	  $echo
31276df26cacSmrg	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
31286df26cacSmrg	  $echo "*** objects $objs is not portable!"
31296df26cacSmrg	  libobjs="$libobjs $objs"
31306df26cacSmrg	fi
31316df26cacSmrg      fi
31326df26cacSmrg
31336df26cacSmrg      if test "$dlself" != no; then
31346df26cacSmrg	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
31356df26cacSmrg      fi
31366df26cacSmrg
31376df26cacSmrg      set dummy $rpath
31386df26cacSmrg      if test "$#" -gt 2; then
31396df26cacSmrg	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
31406df26cacSmrg      fi
31416df26cacSmrg      install_libdir="$2"
31426df26cacSmrg
31436df26cacSmrg      oldlibs=
31446df26cacSmrg      if test -z "$rpath"; then
31456df26cacSmrg	if test "$build_libtool_libs" = yes; then
31466df26cacSmrg	  # Building a libtool convenience library.
31476df26cacSmrg	  # Some compilers have problems with a `.al' extension so
31486df26cacSmrg	  # convenience libraries should have the same extension an
31496df26cacSmrg	  # archive normally would.
31506df26cacSmrg	  oldlibs="$output_objdir/$libname.$libext $oldlibs"
31516df26cacSmrg	  build_libtool_libs=convenience
31526df26cacSmrg	  build_old_libs=yes
31536df26cacSmrg	fi
31546df26cacSmrg
31556df26cacSmrg	if test -n "$vinfo"; then
31566df26cacSmrg	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
31576df26cacSmrg	fi
31586df26cacSmrg
31596df26cacSmrg	if test -n "$release"; then
31606df26cacSmrg	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
31616df26cacSmrg	fi
31626df26cacSmrg      else
31636df26cacSmrg
31646df26cacSmrg	# Parse the version information argument.
31656df26cacSmrg	save_ifs="$IFS"; IFS=':'
31666df26cacSmrg	set dummy $vinfo 0 0 0
31676df26cacSmrg	IFS="$save_ifs"
31686df26cacSmrg
31696df26cacSmrg	if test -n "$8"; then
31706df26cacSmrg	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
31716df26cacSmrg	  $echo "$help" 1>&2
31726df26cacSmrg	  exit $EXIT_FAILURE
31736df26cacSmrg	fi
31746df26cacSmrg
31756df26cacSmrg	# convert absolute version numbers to libtool ages
31766df26cacSmrg	# this retains compatibility with .la files and attempts
31776df26cacSmrg	# to make the code below a bit more comprehensible
31786df26cacSmrg
31796df26cacSmrg	case $vinfo_number in
31806df26cacSmrg	yes)
31816df26cacSmrg	  number_major="$2"
31826df26cacSmrg	  number_minor="$3"
31836df26cacSmrg	  number_revision="$4"
31846df26cacSmrg	  #
31856df26cacSmrg	  # There are really only two kinds -- those that
31866df26cacSmrg	  # use the current revision as the major version
31876df26cacSmrg	  # and those that subtract age and use age as
31886df26cacSmrg	  # a minor version.  But, then there is irix
31896df26cacSmrg	  # which has an extra 1 added just for fun
31906df26cacSmrg	  #
31916df26cacSmrg	  case $version_type in
31926df26cacSmrg	  darwin|linux|osf|windows)
31936df26cacSmrg	    current=`expr $number_major + $number_minor`
31946df26cacSmrg	    age="$number_minor"
31956df26cacSmrg	    revision="$number_revision"
31966df26cacSmrg	    ;;
31976df26cacSmrg	  freebsd-aout|freebsd-elf|sunos)
31986df26cacSmrg	    current="$number_major"
31996df26cacSmrg	    revision="$number_minor"
32006df26cacSmrg	    age="0"
32016df26cacSmrg	    ;;
32026df26cacSmrg	  irix|nonstopux)
32036df26cacSmrg	    current=`expr $number_major + $number_minor - 1`
32046df26cacSmrg	    age="$number_minor"
32056df26cacSmrg	    revision="$number_minor"
32066df26cacSmrg	    ;;
32076df26cacSmrg	  *)
32086df26cacSmrg	    $echo "$modename: unknown library version type \`$version_type'" 1>&2
32096df26cacSmrg	    $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
32106df26cacSmrg	    exit $EXIT_FAILURE
32116df26cacSmrg	    ;;
32126df26cacSmrg	  esac
32136df26cacSmrg	  ;;
32146df26cacSmrg	no)
32156df26cacSmrg	  current="$2"
32166df26cacSmrg	  revision="$3"
32176df26cacSmrg	  age="$4"
32186df26cacSmrg	  ;;
32196df26cacSmrg	esac
32206df26cacSmrg
32216df26cacSmrg	# Check that each of the things are valid numbers.
32226df26cacSmrg	case $current in
32236df26cacSmrg	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]) ;;
32246df26cacSmrg	*)
32256df26cacSmrg	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
32266df26cacSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
32276df26cacSmrg	  exit $EXIT_FAILURE
32286df26cacSmrg	  ;;
32296df26cacSmrg	esac
32306df26cacSmrg
32316df26cacSmrg	case $revision in
32326df26cacSmrg	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]) ;;
32336df26cacSmrg	*)
32346df26cacSmrg	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
32356df26cacSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
32366df26cacSmrg	  exit $EXIT_FAILURE
32376df26cacSmrg	  ;;
32386df26cacSmrg	esac
32396df26cacSmrg
32406df26cacSmrg	case $age in
32416df26cacSmrg	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]) ;;
32426df26cacSmrg	*)
32436df26cacSmrg	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
32446df26cacSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
32456df26cacSmrg	  exit $EXIT_FAILURE
32466df26cacSmrg	  ;;
32476df26cacSmrg	esac
32486df26cacSmrg
32496df26cacSmrg	if test "$age" -gt "$current"; then
32506df26cacSmrg	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
32516df26cacSmrg	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
32526df26cacSmrg	  exit $EXIT_FAILURE
32536df26cacSmrg	fi
32546df26cacSmrg
32556df26cacSmrg	# Calculate the version variables.
32566df26cacSmrg	major=
32576df26cacSmrg	versuffix=
32586df26cacSmrg	verstring=
32596df26cacSmrg	case $version_type in
32606df26cacSmrg	none) ;;
32616df26cacSmrg
32626df26cacSmrg	darwin)
32636df26cacSmrg	  # Like Linux, but with the current version available in
32646df26cacSmrg	  # verstring for coding it into the library header
32656df26cacSmrg	  major=.`expr $current - $age`
32666df26cacSmrg	  versuffix="$major.$age.$revision"
32676df26cacSmrg	  # Darwin ld doesn't like 0 for these options...
32686df26cacSmrg	  minor_current=`expr $current + 1`
32696df26cacSmrg	  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
32706df26cacSmrg	  ;;
32716df26cacSmrg
32726df26cacSmrg	freebsd-aout)
32736df26cacSmrg	  major=".$current"
32746df26cacSmrg	  versuffix=".$current.$revision";
32756df26cacSmrg	  ;;
32766df26cacSmrg
32776df26cacSmrg	freebsd-elf)
32786df26cacSmrg	  major=".$current"
32796df26cacSmrg	  versuffix=".$current";
32806df26cacSmrg	  ;;
32816df26cacSmrg
32826df26cacSmrg	irix | nonstopux)
32836df26cacSmrg	  major=`expr $current - $age + 1`
32846df26cacSmrg
32856df26cacSmrg	  case $version_type in
32866df26cacSmrg	    nonstopux) verstring_prefix=nonstopux ;;
32876df26cacSmrg	    *)         verstring_prefix=sgi ;;
32886df26cacSmrg	  esac
32896df26cacSmrg	  verstring="$verstring_prefix$major.$revision"
32906df26cacSmrg
32916df26cacSmrg	  # Add in all the interfaces that we are compatible with.
32926df26cacSmrg	  loop=$revision
32936df26cacSmrg	  while test "$loop" -ne 0; do
32946df26cacSmrg	    iface=`expr $revision - $loop`
32956df26cacSmrg	    loop=`expr $loop - 1`
32966df26cacSmrg	    verstring="$verstring_prefix$major.$iface:$verstring"
32976df26cacSmrg	  done
32986df26cacSmrg
32996df26cacSmrg	  # Before this point, $major must not contain `.'.
33006df26cacSmrg	  major=.$major
33016df26cacSmrg	  versuffix="$major.$revision"
33026df26cacSmrg	  ;;
33036df26cacSmrg
33046df26cacSmrg	linux)
33056df26cacSmrg	  major=.`expr $current - $age`
33066df26cacSmrg	  versuffix="$major.$age.$revision"
33076df26cacSmrg	  ;;
33086df26cacSmrg
33096df26cacSmrg	osf)
33106df26cacSmrg	  major=.`expr $current - $age`
33116df26cacSmrg	  versuffix=".$current.$age.$revision"
33126df26cacSmrg	  verstring="$current.$age.$revision"
33136df26cacSmrg
33146df26cacSmrg	  # Add in all the interfaces that we are compatible with.
33156df26cacSmrg	  loop=$age
33166df26cacSmrg	  while test "$loop" -ne 0; do
33176df26cacSmrg	    iface=`expr $current - $loop`
33186df26cacSmrg	    loop=`expr $loop - 1`
33196df26cacSmrg	    verstring="$verstring:${iface}.0"
33206df26cacSmrg	  done
33216df26cacSmrg
33226df26cacSmrg	  # Make executables depend on our current version.
33236df26cacSmrg	  verstring="$verstring:${current}.0"
33246df26cacSmrg	  ;;
33256df26cacSmrg
33266df26cacSmrg	sunos)
33276df26cacSmrg	  major=".$current"
33286df26cacSmrg	  versuffix=".$current.$revision"
33296df26cacSmrg	  ;;
33306df26cacSmrg
33316df26cacSmrg	windows)
33326df26cacSmrg	  # Use '-' rather than '.', since we only want one
33336df26cacSmrg	  # extension on DOS 8.3 filesystems.
33346df26cacSmrg	  major=`expr $current - $age`
33356df26cacSmrg	  versuffix="-$major"
33366df26cacSmrg	  ;;
33376df26cacSmrg
33386df26cacSmrg	*)
33396df26cacSmrg	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
33406df26cacSmrg	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
33416df26cacSmrg	  exit $EXIT_FAILURE
33426df26cacSmrg	  ;;
33436df26cacSmrg	esac
33446df26cacSmrg
33456df26cacSmrg	# Clear the version info if we defaulted, and they specified a release.
33466df26cacSmrg	if test -z "$vinfo" && test -n "$release"; then
33476df26cacSmrg	  major=
33486df26cacSmrg	  case $version_type in
33496df26cacSmrg	  darwin)
33506df26cacSmrg	    # we can't check for "0.0" in archive_cmds due to quoting
33516df26cacSmrg	    # problems, so we reset it completely
33526df26cacSmrg	    verstring=
33536df26cacSmrg	    ;;
33546df26cacSmrg	  *)
33556df26cacSmrg	    verstring="0.0"
33566df26cacSmrg	    ;;
33576df26cacSmrg	  esac
33586df26cacSmrg	  if test "$need_version" = no; then
33596df26cacSmrg	    versuffix=
33606df26cacSmrg	  else
33616df26cacSmrg	    versuffix=".0.0"
33626df26cacSmrg	  fi
33636df26cacSmrg	fi
33646df26cacSmrg
33656df26cacSmrg	# Remove version info from name if versioning should be avoided
33666df26cacSmrg	if test "$avoid_version" = yes && test "$need_version" = no; then
33676df26cacSmrg	  major=
33686df26cacSmrg	  versuffix=
33696df26cacSmrg	  verstring=""
33706df26cacSmrg	fi
33716df26cacSmrg
33726df26cacSmrg	# Check to see if the archive will have undefined symbols.
33736df26cacSmrg	if test "$allow_undefined" = yes; then
33746df26cacSmrg	  if test "$allow_undefined_flag" = unsupported; then
33756df26cacSmrg	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
33766df26cacSmrg	    build_libtool_libs=no
33776df26cacSmrg	    build_old_libs=yes
33786df26cacSmrg	  fi
33796df26cacSmrg	else
33806df26cacSmrg	  # Don't allow undefined symbols.
33816df26cacSmrg	  allow_undefined_flag="$no_undefined_flag"
33826df26cacSmrg	fi
33836df26cacSmrg      fi
33846df26cacSmrg
33856df26cacSmrg      if test "$mode" != relink; then
33866df26cacSmrg	# Remove our outputs, but don't remove object files since they
33876df26cacSmrg	# may have been created when compiling PIC objects.
33886df26cacSmrg	removelist=
33896df26cacSmrg	tempremovelist=`$echo "$output_objdir/*"`
33906df26cacSmrg	for p in $tempremovelist; do
33916df26cacSmrg	  case $p in
33926df26cacSmrg	    *.$objext)
33936df26cacSmrg	       ;;
33946df26cacSmrg	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
33956df26cacSmrg	       if test "X$precious_files_regex" != "X"; then
33966df26cacSmrg	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
33976df26cacSmrg	         then
33986df26cacSmrg		   continue
33996df26cacSmrg		 fi
34006df26cacSmrg	       fi
34016df26cacSmrg	       removelist="$removelist $p"
34026df26cacSmrg	       ;;
34036df26cacSmrg	    *) ;;
34046df26cacSmrg	  esac
34056df26cacSmrg	done
34066df26cacSmrg	if test -n "$removelist"; then
34076df26cacSmrg	  $show "${rm}r $removelist"
34086df26cacSmrg	  $run ${rm}r $removelist
34096df26cacSmrg	fi
34106df26cacSmrg      fi
34116df26cacSmrg
34126df26cacSmrg      # Now set the variables for building old libraries.
34136df26cacSmrg      if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
34146df26cacSmrg	oldlibs="$oldlibs $output_objdir/$libname.$libext"
34156df26cacSmrg
34166df26cacSmrg	# Transform .lo files to .o files.
34176df26cacSmrg	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
34186df26cacSmrg      fi
34196df26cacSmrg
34206df26cacSmrg      # Eliminate all temporary directories.
34216df26cacSmrg      for path in $notinst_path; do
34226df26cacSmrg	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
34236df26cacSmrg	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
34246df26cacSmrg	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
34256df26cacSmrg      done
34266df26cacSmrg
34276df26cacSmrg      if test -n "$xrpath"; then
34286df26cacSmrg	# If the user specified any rpath flags, then add them.
34296df26cacSmrg	temp_xrpath=
34306df26cacSmrg	for libdir in $xrpath; do
34316df26cacSmrg	  temp_xrpath="$temp_xrpath -R$libdir"
34326df26cacSmrg	  case "$finalize_rpath " in
34336df26cacSmrg	  *" $libdir "*) ;;
34346df26cacSmrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
34356df26cacSmrg	  esac
34366df26cacSmrg	done
34376df26cacSmrg	if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
34386df26cacSmrg	  dependency_libs="$temp_xrpath $dependency_libs"
34396df26cacSmrg	fi
34406df26cacSmrg      fi
34416df26cacSmrg
34426df26cacSmrg      # Make sure dlfiles contains only unique files that won't be dlpreopened
34436df26cacSmrg      old_dlfiles="$dlfiles"
34446df26cacSmrg      dlfiles=
34456df26cacSmrg      for lib in $old_dlfiles; do
34466df26cacSmrg	case " $dlprefiles $dlfiles " in
34476df26cacSmrg	*" $lib "*) ;;
34486df26cacSmrg	*) dlfiles="$dlfiles $lib" ;;
34496df26cacSmrg	esac
34506df26cacSmrg      done
34516df26cacSmrg
34526df26cacSmrg      # Make sure dlprefiles contains only unique files
34536df26cacSmrg      old_dlprefiles="$dlprefiles"
34546df26cacSmrg      dlprefiles=
34556df26cacSmrg      for lib in $old_dlprefiles; do
34566df26cacSmrg	case "$dlprefiles " in
34576df26cacSmrg	*" $lib "*) ;;
34586df26cacSmrg	*) dlprefiles="$dlprefiles $lib" ;;
34596df26cacSmrg	esac
34606df26cacSmrg      done
34616df26cacSmrg
34626df26cacSmrg      if test "$build_libtool_libs" = yes; then
34636df26cacSmrg	if test -n "$rpath"; then
34646df26cacSmrg	  case $host in
34656df26cacSmrg	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
34666df26cacSmrg	    # these systems don't actually have a c library (as such)!
34676df26cacSmrg	    ;;
34686df26cacSmrg	  *-*-rhapsody* | *-*-darwin1.[012])
34696df26cacSmrg	    # Rhapsody C library is in the System framework
34706df26cacSmrg	    deplibs="$deplibs -framework System"
34716df26cacSmrg	    ;;
34726df26cacSmrg	  *-*-netbsd*)
34736df26cacSmrg	    # Don't link with libc until the a.out ld.so is fixed.
34746df26cacSmrg	    ;;
34756df26cacSmrg	  *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*)
34766df26cacSmrg	    # Do not include libc due to us having libc/libc_r.
34776df26cacSmrg	    ;;
34786df26cacSmrg	  *-*-sco3.2v5* | *-*-sco5v6*)
34796df26cacSmrg	    # Causes problems with __ctype
34806df26cacSmrg	    ;;
34816df26cacSmrg	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
34826df26cacSmrg	    # Compiler inserts libc in the correct place for threads to work
34836df26cacSmrg	    ;;
34846df26cacSmrg 	  *)
34856df26cacSmrg	    # Add libc to deplibs on all other systems if necessary.
34866df26cacSmrg	    if test "$build_libtool_need_lc" = "yes"; then
34876df26cacSmrg	      deplibs="$deplibs -lc"
34886df26cacSmrg	    fi
34896df26cacSmrg	    ;;
34906df26cacSmrg	  esac
34916df26cacSmrg	fi
34926df26cacSmrg
34936df26cacSmrg	# Transform deplibs into only deplibs that can be linked in shared.
34946df26cacSmrg	name_save=$name
34956df26cacSmrg	libname_save=$libname
34966df26cacSmrg	release_save=$release
34976df26cacSmrg	versuffix_save=$versuffix
34986df26cacSmrg	major_save=$major
34996df26cacSmrg	# I'm not sure if I'm treating the release correctly.  I think
35006df26cacSmrg	# release should show up in the -l (ie -lgmp5) so we don't want to
35016df26cacSmrg	# add it in twice.  Is that correct?
35026df26cacSmrg	release=""
35036df26cacSmrg	versuffix=""
35046df26cacSmrg	major=""
35056df26cacSmrg	newdeplibs=
35066df26cacSmrg	droppeddeps=no
35076df26cacSmrg	case $deplibs_check_method in
35086df26cacSmrg	pass_all)
35096df26cacSmrg	  # Don't check for shared/static.  Everything works.
35106df26cacSmrg	  # This might be a little naive.  We might want to check
35116df26cacSmrg	  # whether the library exists or not.  But this is on
35126df26cacSmrg	  # osf3 & osf4 and I'm not really sure... Just
35136df26cacSmrg	  # implementing what was already the behavior.
35146df26cacSmrg	  newdeplibs=$deplibs
35156df26cacSmrg	  ;;
35166df26cacSmrg	test_compile)
35176df26cacSmrg	  # This code stresses the "libraries are programs" paradigm to its
35186df26cacSmrg	  # limits. Maybe even breaks it.  We compile a program, linking it
35196df26cacSmrg	  # against the deplibs as a proxy for the library.  Then we can check
35206df26cacSmrg	  # whether they linked in statically or dynamically with ldd.
35216df26cacSmrg	  $rm conftest.c
35226df26cacSmrg	  cat > conftest.c <<EOF
35236df26cacSmrg	  int main() { return 0; }
35246df26cacSmrgEOF
35256df26cacSmrg	  $rm conftest
35266df26cacSmrg	  $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
35276df26cacSmrg	  if test "$?" -eq 0 ; then
35286df26cacSmrg	    ldd_output=`ldd conftest`
35296df26cacSmrg	    for i in $deplibs; do
35306df26cacSmrg	      name=`expr $i : '-l\(.*\)'`
35316df26cacSmrg	      # If $name is empty we are operating on a -L argument.
35326df26cacSmrg              if test "$name" != "" && test "$name" -ne "0"; then
35336df26cacSmrg		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
35346df26cacSmrg		  case " $predeps $postdeps " in
35356df26cacSmrg		  *" $i "*)
35366df26cacSmrg		    newdeplibs="$newdeplibs $i"
35376df26cacSmrg		    i=""
35386df26cacSmrg		    ;;
35396df26cacSmrg		  esac
35406df26cacSmrg	        fi
35416df26cacSmrg		if test -n "$i" ; then
35426df26cacSmrg		  libname=`eval \\$echo \"$libname_spec\"`
35436df26cacSmrg		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
35446df26cacSmrg		  set dummy $deplib_matches
35456df26cacSmrg		  deplib_match=$2
35466df26cacSmrg		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
35476df26cacSmrg		    newdeplibs="$newdeplibs $i"
35486df26cacSmrg		  else
35496df26cacSmrg		    droppeddeps=yes
35506df26cacSmrg		    $echo
35516df26cacSmrg		    $echo "*** Warning: dynamic linker does not accept needed library $i."
35526df26cacSmrg		    $echo "*** I have the capability to make that library automatically link in when"
35536df26cacSmrg		    $echo "*** you link to this library.  But I can only do this if you have a"
35546df26cacSmrg		    $echo "*** shared version of the library, which I believe you do not have"
35556df26cacSmrg		    $echo "*** because a test_compile did reveal that the linker did not use it for"
35566df26cacSmrg		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
35576df26cacSmrg		  fi
35586df26cacSmrg		fi
35596df26cacSmrg	      else
35606df26cacSmrg		newdeplibs="$newdeplibs $i"
35616df26cacSmrg	      fi
35626df26cacSmrg	    done
35636df26cacSmrg	  else
35646df26cacSmrg	    # Error occurred in the first compile.  Let's try to salvage
35656df26cacSmrg	    # the situation: Compile a separate program for each library.
35666df26cacSmrg	    for i in $deplibs; do
35676df26cacSmrg	      name=`expr $i : '-l\(.*\)'`
35686df26cacSmrg	      # If $name is empty we are operating on a -L argument.
35696df26cacSmrg              if test "$name" != "" && test "$name" != "0"; then
35706df26cacSmrg		$rm conftest
35716df26cacSmrg		$LTCC $LTCFLAGS -o conftest conftest.c $i
35726df26cacSmrg		# Did it work?
35736df26cacSmrg		if test "$?" -eq 0 ; then
35746df26cacSmrg		  ldd_output=`ldd conftest`
35756df26cacSmrg		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
35766df26cacSmrg		    case " $predeps $postdeps " in
35776df26cacSmrg		    *" $i "*)
35786df26cacSmrg		      newdeplibs="$newdeplibs $i"
35796df26cacSmrg		      i=""
35806df26cacSmrg		      ;;
35816df26cacSmrg		    esac
35826df26cacSmrg		  fi
35836df26cacSmrg		  if test -n "$i" ; then
35846df26cacSmrg		    libname=`eval \\$echo \"$libname_spec\"`
35856df26cacSmrg		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
35866df26cacSmrg		    set dummy $deplib_matches
35876df26cacSmrg		    deplib_match=$2
35886df26cacSmrg		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
35896df26cacSmrg		      newdeplibs="$newdeplibs $i"
35906df26cacSmrg		    else
35916df26cacSmrg		      droppeddeps=yes
35926df26cacSmrg		      $echo
35936df26cacSmrg		      $echo "*** Warning: dynamic linker does not accept needed library $i."
35946df26cacSmrg		      $echo "*** I have the capability to make that library automatically link in when"
35956df26cacSmrg		      $echo "*** you link to this library.  But I can only do this if you have a"
35966df26cacSmrg		      $echo "*** shared version of the library, which you do not appear to have"
35976df26cacSmrg		      $echo "*** because a test_compile did reveal that the linker did not use this one"
35986df26cacSmrg		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
35996df26cacSmrg		    fi
36006df26cacSmrg		  fi
36016df26cacSmrg		else
36026df26cacSmrg		  droppeddeps=yes
36036df26cacSmrg		  $echo
36046df26cacSmrg		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
36056df26cacSmrg		  $echo "***  make it link in!  You will probably need to install it or some"
36066df26cacSmrg		  $echo "*** library that it depends on before this library will be fully"
36076df26cacSmrg		  $echo "*** functional.  Installing it before continuing would be even better."
36086df26cacSmrg		fi
36096df26cacSmrg	      else
36106df26cacSmrg		newdeplibs="$newdeplibs $i"
36116df26cacSmrg	      fi
36126df26cacSmrg	    done
36136df26cacSmrg	  fi
36146df26cacSmrg	  ;;
36156df26cacSmrg	file_magic*)
36166df26cacSmrg	  set dummy $deplibs_check_method
36176df26cacSmrg	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
36186df26cacSmrg	  for a_deplib in $deplibs; do
36196df26cacSmrg	    name=`expr $a_deplib : '-l\(.*\)'`
36206df26cacSmrg	    # If $name is empty we are operating on a -L argument.
36216df26cacSmrg            if test "$name" != "" && test  "$name" != "0"; then
36226df26cacSmrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
36236df26cacSmrg		case " $predeps $postdeps " in
36246df26cacSmrg		*" $a_deplib "*)
36256df26cacSmrg		  newdeplibs="$newdeplibs $a_deplib"
36266df26cacSmrg		  a_deplib=""
36276df26cacSmrg		  ;;
36286df26cacSmrg		esac
36296df26cacSmrg	      fi
36306df26cacSmrg	      if test -n "$a_deplib" ; then
36316df26cacSmrg		libname=`eval \\$echo \"$libname_spec\"`
36326df26cacSmrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
36336df26cacSmrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
36346df26cacSmrg		  for potent_lib in $potential_libs; do
36356df26cacSmrg		      # Follow soft links.
36366df26cacSmrg		      if ls -lLd "$potent_lib" 2>/dev/null \
36376df26cacSmrg			 | grep " -> " >/dev/null; then
36386df26cacSmrg			continue
36396df26cacSmrg		      fi
36406df26cacSmrg		      # The statement above tries to avoid entering an
36416df26cacSmrg		      # endless loop below, in case of cyclic links.
36426df26cacSmrg		      # We might still enter an endless loop, since a link
36436df26cacSmrg		      # loop can be closed while we follow links,
36446df26cacSmrg		      # but so what?
36456df26cacSmrg		      potlib="$potent_lib"
36466df26cacSmrg		      while test -h "$potlib" 2>/dev/null; do
36476df26cacSmrg			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
36486df26cacSmrg			case $potliblink in
36496df26cacSmrg			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
36506df26cacSmrg			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
36516df26cacSmrg			esac
36526df26cacSmrg		      done
36536df26cacSmrg		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
36546df26cacSmrg			 | ${SED} 10q \
36556df26cacSmrg			 | $EGREP "$file_magic_regex" > /dev/null; then
36566df26cacSmrg			newdeplibs="$newdeplibs $a_deplib"
36576df26cacSmrg			a_deplib=""
36586df26cacSmrg			break 2
36596df26cacSmrg		      fi
36606df26cacSmrg		  done
36616df26cacSmrg		done
36626df26cacSmrg	      fi
36636df26cacSmrg	      if test -n "$a_deplib" ; then
36646df26cacSmrg		droppeddeps=yes
36656df26cacSmrg		$echo
36666df26cacSmrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
36676df26cacSmrg		$echo "*** I have the capability to make that library automatically link in when"
36686df26cacSmrg		$echo "*** you link to this library.  But I can only do this if you have a"
36696df26cacSmrg		$echo "*** shared version of the library, which you do not appear to have"
36706df26cacSmrg		$echo "*** because I did check the linker path looking for a file starting"
36716df26cacSmrg		if test -z "$potlib" ; then
36726df26cacSmrg		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
36736df26cacSmrg		else
36746df26cacSmrg		  $echo "*** with $libname and none of the candidates passed a file format test"
36756df26cacSmrg		  $echo "*** using a file magic. Last file checked: $potlib"
36766df26cacSmrg		fi
36776df26cacSmrg	      fi
36786df26cacSmrg	    else
36796df26cacSmrg	      # Add a -L argument.
36806df26cacSmrg	      newdeplibs="$newdeplibs $a_deplib"
36816df26cacSmrg	    fi
36826df26cacSmrg	  done # Gone through all deplibs.
36836df26cacSmrg	  ;;
36846df26cacSmrg	match_pattern*)
36856df26cacSmrg	  set dummy $deplibs_check_method
36866df26cacSmrg	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
36876df26cacSmrg	  for a_deplib in $deplibs; do
36886df26cacSmrg	    name=`expr $a_deplib : '-l\(.*\)'`
36896df26cacSmrg	    # If $name is empty we are operating on a -L argument.
36906df26cacSmrg	    if test -n "$name" && test "$name" != "0"; then
36916df26cacSmrg	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
36926df26cacSmrg		case " $predeps $postdeps " in
36936df26cacSmrg		*" $a_deplib "*)
36946df26cacSmrg		  newdeplibs="$newdeplibs $a_deplib"
36956df26cacSmrg		  a_deplib=""
36966df26cacSmrg		  ;;
36976df26cacSmrg		esac
36986df26cacSmrg	      fi
36996df26cacSmrg	      if test -n "$a_deplib" ; then
37006df26cacSmrg		libname=`eval \\$echo \"$libname_spec\"`
37016df26cacSmrg		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
37026df26cacSmrg		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
37036df26cacSmrg		  for potent_lib in $potential_libs; do
37046df26cacSmrg		    potlib="$potent_lib" # see symlink-check above in file_magic test
37056df26cacSmrg		    if eval $echo \"$potent_lib\" 2>/dev/null \
37066df26cacSmrg		        | ${SED} 10q \
37076df26cacSmrg		        | $EGREP "$match_pattern_regex" > /dev/null; then
37086df26cacSmrg		      newdeplibs="$newdeplibs $a_deplib"
37096df26cacSmrg		      a_deplib=""
37106df26cacSmrg		      break 2
37116df26cacSmrg		    fi
37126df26cacSmrg		  done
37136df26cacSmrg		done
37146df26cacSmrg	      fi
37156df26cacSmrg	      if test -n "$a_deplib" ; then
37166df26cacSmrg		droppeddeps=yes
37176df26cacSmrg		$echo
37186df26cacSmrg		$echo "*** Warning: linker path does not have real file for library $a_deplib."
37196df26cacSmrg		$echo "*** I have the capability to make that library automatically link in when"
37206df26cacSmrg		$echo "*** you link to this library.  But I can only do this if you have a"
37216df26cacSmrg		$echo "*** shared version of the library, which you do not appear to have"
37226df26cacSmrg		$echo "*** because I did check the linker path looking for a file starting"
37236df26cacSmrg		if test -z "$potlib" ; then
37246df26cacSmrg		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
37256df26cacSmrg		else
37266df26cacSmrg		  $echo "*** with $libname and none of the candidates passed a file format test"
37276df26cacSmrg		  $echo "*** using a regex pattern. Last file checked: $potlib"
37286df26cacSmrg		fi
37296df26cacSmrg	      fi
37306df26cacSmrg	    else
37316df26cacSmrg	      # Add a -L argument.
37326df26cacSmrg	      newdeplibs="$newdeplibs $a_deplib"
37336df26cacSmrg	    fi
37346df26cacSmrg	  done # Gone through all deplibs.
37356df26cacSmrg	  ;;
37366df26cacSmrg	none | unknown | *)
37376df26cacSmrg	  newdeplibs=""
37386df26cacSmrg	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
37396df26cacSmrg	    -e 's/ -[LR][^ ]*//g'`
37406df26cacSmrg	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
37416df26cacSmrg	    for i in $predeps $postdeps ; do
37426df26cacSmrg	      # can't use Xsed below, because $i might contain '/'
37436df26cacSmrg	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
37446df26cacSmrg	    done
37456df26cacSmrg	  fi
37466df26cacSmrg	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
37476df26cacSmrg	    | grep . >/dev/null; then
37486df26cacSmrg	    $echo
37496df26cacSmrg	    if test "X$deplibs_check_method" = "Xnone"; then
37506df26cacSmrg	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
37516df26cacSmrg	    else
37526df26cacSmrg	      $echo "*** Warning: inter-library dependencies are not known to be supported."
37536df26cacSmrg	    fi
37546df26cacSmrg	    $echo "*** All declared inter-library dependencies are being dropped."
37556df26cacSmrg	    droppeddeps=yes
37566df26cacSmrg	  fi
37576df26cacSmrg	  ;;
37586df26cacSmrg	esac
37596df26cacSmrg	versuffix=$versuffix_save
37606df26cacSmrg	major=$major_save
37616df26cacSmrg	release=$release_save
37626df26cacSmrg	libname=$libname_save
37636df26cacSmrg	name=$name_save
37646df26cacSmrg
37656df26cacSmrg	case $host in
37666df26cacSmrg	*-*-rhapsody* | *-*-darwin1.[012])
37676df26cacSmrg	  # On Rhapsody replace the C library is the System framework
37686df26cacSmrg	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
37696df26cacSmrg	  ;;
37706df26cacSmrg	esac
37716df26cacSmrg
37726df26cacSmrg	if test "$droppeddeps" = yes; then
37736df26cacSmrg	  if test "$module" = yes; then
37746df26cacSmrg	    $echo
37756df26cacSmrg	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
37766df26cacSmrg	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
37776df26cacSmrg	    $echo "*** a static module, that should work as long as the dlopening"
37786df26cacSmrg	    $echo "*** application is linked with the -dlopen flag."
37796df26cacSmrg	    if test -z "$global_symbol_pipe"; then
37806df26cacSmrg	      $echo
37816df26cacSmrg	      $echo "*** However, this would only work if libtool was able to extract symbol"
37826df26cacSmrg	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
37836df26cacSmrg	      $echo "*** not find such a program.  So, this module is probably useless."
37846df26cacSmrg	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
37856df26cacSmrg	    fi
37866df26cacSmrg	    if test "$build_old_libs" = no; then
37876df26cacSmrg	      oldlibs="$output_objdir/$libname.$libext"
37886df26cacSmrg	      build_libtool_libs=module
37896df26cacSmrg	      build_old_libs=yes
37906df26cacSmrg	    else
37916df26cacSmrg	      build_libtool_libs=no
37926df26cacSmrg	    fi
37936df26cacSmrg	  else
37946df26cacSmrg	    $echo "*** The inter-library dependencies that have been dropped here will be"
37956df26cacSmrg	    $echo "*** automatically added whenever a program is linked with this library"
37966df26cacSmrg	    $echo "*** or is declared to -dlopen it."
37976df26cacSmrg
37986df26cacSmrg	    if test "$allow_undefined" = no; then
37996df26cacSmrg	      $echo
38006df26cacSmrg	      $echo "*** Since this library must not contain undefined symbols,"
38016df26cacSmrg	      $echo "*** because either the platform does not support them or"
38026df26cacSmrg	      $echo "*** it was explicitly requested with -no-undefined,"
38036df26cacSmrg	      $echo "*** libtool will only create a static version of it."
38046df26cacSmrg	      if test "$build_old_libs" = no; then
38056df26cacSmrg		oldlibs="$output_objdir/$libname.$libext"
38066df26cacSmrg		build_libtool_libs=module
38076df26cacSmrg		build_old_libs=yes
38086df26cacSmrg	      else
38096df26cacSmrg		build_libtool_libs=no
38106df26cacSmrg	      fi
38116df26cacSmrg	    fi
38126df26cacSmrg	  fi
38136df26cacSmrg	fi
38146df26cacSmrg	# Done checking deplibs!
38156df26cacSmrg	deplibs=$newdeplibs
38166df26cacSmrg      fi
38176df26cacSmrg
38186df26cacSmrg
38196df26cacSmrg      # move library search paths that coincide with paths to not yet
38206df26cacSmrg      # installed libraries to the beginning of the library search list
38216df26cacSmrg      new_libs=
38226df26cacSmrg      for path in $notinst_path; do
38236df26cacSmrg	case " $new_libs " in
38246df26cacSmrg	*" -L$path/$objdir "*) ;;
38256df26cacSmrg	*)
38266df26cacSmrg	  case " $deplibs " in
38276df26cacSmrg	  *" -L$path/$objdir "*)
38286df26cacSmrg	    new_libs="$new_libs -L$path/$objdir" ;;
38296df26cacSmrg	  esac
38306df26cacSmrg	  ;;
38316df26cacSmrg	esac
38326df26cacSmrg      done
38336df26cacSmrg      for deplib in $deplibs; do
38346df26cacSmrg	case $deplib in
38356df26cacSmrg	-L*)
38366df26cacSmrg	  case " $new_libs " in
38376df26cacSmrg	  *" $deplib "*) ;;
38386df26cacSmrg	  *) new_libs="$new_libs $deplib" ;;
38396df26cacSmrg	  esac
38406df26cacSmrg	  ;;
38416df26cacSmrg	*) new_libs="$new_libs $deplib" ;;
38426df26cacSmrg	esac
38436df26cacSmrg      done
38446df26cacSmrg      deplibs="$new_libs"
38456df26cacSmrg
38466df26cacSmrg
38476df26cacSmrg      # All the library-specific variables (install_libdir is set above).
38486df26cacSmrg      library_names=
38496df26cacSmrg      old_library=
38506df26cacSmrg      dlname=
38516df26cacSmrg
38526df26cacSmrg      # Test again, we may have decided not to build it any more
38536df26cacSmrg      if test "$build_libtool_libs" = yes; then
38546df26cacSmrg	if test "$hardcode_into_libs" = yes; then
38556df26cacSmrg	  # Hardcode the library paths
38566df26cacSmrg	  hardcode_libdirs=
38576df26cacSmrg	  dep_rpath=
38586df26cacSmrg	  rpath="$finalize_rpath"
38596df26cacSmrg	  test "$mode" != relink && rpath="$compile_rpath$rpath"
38606df26cacSmrg	  for libdir in $rpath; do
38616df26cacSmrg	    if test -n "$hardcode_libdir_flag_spec"; then
38626df26cacSmrg	      if test -n "$hardcode_libdir_separator"; then
38636df26cacSmrg		if test -z "$hardcode_libdirs"; then
38646df26cacSmrg		  hardcode_libdirs="$libdir"
38656df26cacSmrg		else
38666df26cacSmrg		  # Just accumulate the unique libdirs.
38676df26cacSmrg		  case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
38686df26cacSmrg		  *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
38696df26cacSmrg		    ;;
38706df26cacSmrg		  *)
38716df26cacSmrg		    hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
38726df26cacSmrg		    ;;
38736df26cacSmrg		  esac
38746df26cacSmrg		fi
38756df26cacSmrg	      else
38766df26cacSmrg		eval flag=\"$hardcode_libdir_flag_spec\"
38776df26cacSmrg		dep_rpath="$dep_rpath $flag"
38786df26cacSmrg	      fi
38796df26cacSmrg	    elif test -n "$runpath_var"; then
38806df26cacSmrg	      case "$perm_rpath " in
38816df26cacSmrg	      *" $libdir "*) ;;
38826df26cacSmrg	      *) perm_rpath="$perm_rpath $libdir" ;;
38836df26cacSmrg	      esac
38846df26cacSmrg	    fi
38856df26cacSmrg	  done
38866df26cacSmrg	  # Substitute the hardcoded libdirs into the rpath.
38876df26cacSmrg	  if test -n "$hardcode_libdir_separator" &&
38886df26cacSmrg	     test -n "$hardcode_libdirs"; then
38896df26cacSmrg	    libdir="$hardcode_libdirs"
38906df26cacSmrg	    if test -n "$hardcode_libdir_flag_spec_ld"; then
38916df26cacSmrg	      eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\"
38926df26cacSmrg	    else
38936df26cacSmrg	      eval dep_rpath=\"$hardcode_libdir_flag_spec\"
38946df26cacSmrg	    fi
38956df26cacSmrg	  fi
38966df26cacSmrg	  if test -n "$runpath_var" && test -n "$perm_rpath"; then
38976df26cacSmrg	    # We should set the runpath_var.
38986df26cacSmrg	    rpath=
38996df26cacSmrg	    for dir in $perm_rpath; do
39006df26cacSmrg	      rpath="$rpath$dir:"
39016df26cacSmrg	    done
39026df26cacSmrg	    eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
39036df26cacSmrg	  fi
39046df26cacSmrg	  test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs"
39056df26cacSmrg	fi
39066df26cacSmrg
39076df26cacSmrg	shlibpath="$finalize_shlibpath"
39086df26cacSmrg	test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
39096df26cacSmrg	if test -n "$shlibpath"; then
39106df26cacSmrg	  eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
39116df26cacSmrg	fi
39126df26cacSmrg
39136df26cacSmrg	# Get the real and link names of the library.
39146df26cacSmrg	eval shared_ext=\"$shrext_cmds\"
39156df26cacSmrg	eval library_names=\"$library_names_spec\"
39166df26cacSmrg	set dummy $library_names
39176df26cacSmrg	realname="$2"
39186df26cacSmrg	shift; shift
39196df26cacSmrg
39206df26cacSmrg	if test -n "$soname_spec"; then
39216df26cacSmrg	  eval soname=\"$soname_spec\"
39226df26cacSmrg	else
39236df26cacSmrg	  soname="$realname"
39246df26cacSmrg	fi
39256df26cacSmrg	if test -z "$dlname"; then
39266df26cacSmrg	  dlname=$soname
39276df26cacSmrg	fi
39286df26cacSmrg
39296df26cacSmrg	lib="$output_objdir/$realname"
39306df26cacSmrg	linknames=
39316df26cacSmrg	for link
39326df26cacSmrg	do
39336df26cacSmrg	  linknames="$linknames $link"
39346df26cacSmrg	done
39356df26cacSmrg
39366df26cacSmrg	# Use standard objects if they are pic
39376df26cacSmrg	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
39386df26cacSmrg
39396df26cacSmrg	# Prepare the list of exported symbols
39406df26cacSmrg	if test -z "$export_symbols"; then
39416df26cacSmrg	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
39426df26cacSmrg	    $show "generating symbol list for \`$libname.la'"
39436df26cacSmrg	    export_symbols="$output_objdir/$libname.exp"
39446df26cacSmrg	    $run $rm $export_symbols
39456df26cacSmrg	    cmds=$export_symbols_cmds
39466df26cacSmrg	    save_ifs="$IFS"; IFS='~'
39476df26cacSmrg	    for cmd in $cmds; do
39486df26cacSmrg	      IFS="$save_ifs"
39496df26cacSmrg	      eval cmd=\"$cmd\"
39506df26cacSmrg	      if len=`expr "X$cmd" : ".*"` &&
39516df26cacSmrg	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
39526df26cacSmrg	        $show "$cmd"
39536df26cacSmrg	        $run eval "$cmd" || exit $?
39546df26cacSmrg	        skipped_export=false
39556df26cacSmrg	      else
39566df26cacSmrg	        # The command line is too long to execute in one step.
39576df26cacSmrg	        $show "using reloadable object file for export list..."
39586df26cacSmrg	        skipped_export=:
39596df26cacSmrg		# Break out early, otherwise skipped_export may be
39606df26cacSmrg		# set to false by a later but shorter cmd.
39616df26cacSmrg		break
39626df26cacSmrg	      fi
39636df26cacSmrg	    done
39646df26cacSmrg	    IFS="$save_ifs"
39656df26cacSmrg	    if test -n "$export_symbols_regex"; then
39666df26cacSmrg	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
39676df26cacSmrg	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
39686df26cacSmrg	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
39696df26cacSmrg	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
39706df26cacSmrg	    fi
39716df26cacSmrg	  fi
39726df26cacSmrg	fi
39736df26cacSmrg
39746df26cacSmrg	if test -n "$export_symbols" && test -n "$include_expsyms"; then
39756df26cacSmrg	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
39766df26cacSmrg	fi
39776df26cacSmrg
39786df26cacSmrg	tmp_deplibs=
39796df26cacSmrg	for test_deplib in $deplibs; do
39806df26cacSmrg		case " $convenience " in
39816df26cacSmrg		*" $test_deplib "*) ;;
39826df26cacSmrg		*)
39836df26cacSmrg			tmp_deplibs="$tmp_deplibs $test_deplib"
39846df26cacSmrg			;;
39856df26cacSmrg		esac
39866df26cacSmrg	done
39876df26cacSmrg	deplibs="$tmp_deplibs"
39886df26cacSmrg
39896df26cacSmrg	if test -n "$convenience"; then
39906df26cacSmrg	  if test -n "$whole_archive_flag_spec"; then
39916df26cacSmrg	    save_libobjs=$libobjs
39926df26cacSmrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
39936df26cacSmrg	  else
39946df26cacSmrg	    gentop="$output_objdir/${outputname}x"
39956df26cacSmrg	    generated="$generated $gentop"
39966df26cacSmrg
39976df26cacSmrg	    func_extract_archives $gentop $convenience
39986df26cacSmrg	    libobjs="$libobjs $func_extract_archives_result"
39996df26cacSmrg	  fi
40006df26cacSmrg	fi
40016df26cacSmrg	
40026df26cacSmrg	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
40036df26cacSmrg	  eval flag=\"$thread_safe_flag_spec\"
40046df26cacSmrg	  linker_flags="$linker_flags $flag"
40056df26cacSmrg	fi
40066df26cacSmrg
40076df26cacSmrg	# Make a backup of the uninstalled library when relinking
40086df26cacSmrg	if test "$mode" = relink; then
40096df26cacSmrg	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
40106df26cacSmrg	fi
40116df26cacSmrg
40126df26cacSmrg	# Do each of the archive commands.
40136df26cacSmrg	if test "$module" = yes && test -n "$module_cmds" ; then
40146df26cacSmrg	  if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
40156df26cacSmrg	    eval test_cmds=\"$module_expsym_cmds\"
40166df26cacSmrg	    cmds=$module_expsym_cmds
40176df26cacSmrg	  else
40186df26cacSmrg	    eval test_cmds=\"$module_cmds\"
40196df26cacSmrg	    cmds=$module_cmds
40206df26cacSmrg	  fi
40216df26cacSmrg	else
40226df26cacSmrg	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
40236df26cacSmrg	  eval test_cmds=\"$archive_expsym_cmds\"
40246df26cacSmrg	  cmds=$archive_expsym_cmds
40256df26cacSmrg	else
40266df26cacSmrg	  eval test_cmds=\"$archive_cmds\"
40276df26cacSmrg	  cmds=$archive_cmds
40286df26cacSmrg	  fi
40296df26cacSmrg	fi
40306df26cacSmrg
40316df26cacSmrg	if test "X$skipped_export" != "X:" &&
40326df26cacSmrg	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
40336df26cacSmrg	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
40346df26cacSmrg	  :
40356df26cacSmrg	else
40366df26cacSmrg	  # The command line is too long to link in one step, link piecewise.
40376df26cacSmrg	  $echo "creating reloadable object files..."
40386df26cacSmrg
40396df26cacSmrg	  # Save the value of $output and $libobjs because we want to
40406df26cacSmrg	  # use them later.  If we have whole_archive_flag_spec, we
40416df26cacSmrg	  # want to use save_libobjs as it was before
40426df26cacSmrg	  # whole_archive_flag_spec was expanded, because we can't
40436df26cacSmrg	  # assume the linker understands whole_archive_flag_spec.
40446df26cacSmrg	  # This may have to be revisited, in case too many
40456df26cacSmrg	  # convenience libraries get linked in and end up exceeding
40466df26cacSmrg	  # the spec.
40476df26cacSmrg	  if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then
40486df26cacSmrg	    save_libobjs=$libobjs
40496df26cacSmrg	  fi
40506df26cacSmrg	  save_output=$output
40516df26cacSmrg	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
40526df26cacSmrg
40536df26cacSmrg	  # Clear the reloadable object creation command queue and
40546df26cacSmrg	  # initialize k to one.
40556df26cacSmrg	  test_cmds=
40566df26cacSmrg	  concat_cmds=
40576df26cacSmrg	  objlist=
40586df26cacSmrg	  delfiles=
40596df26cacSmrg	  last_robj=
40606df26cacSmrg	  k=1
40616df26cacSmrg	  output=$output_objdir/$output_la-${k}.$objext
40626df26cacSmrg	  # Loop over the list of objects to be linked.
40636df26cacSmrg	  for obj in $save_libobjs
40646df26cacSmrg	  do
40656df26cacSmrg	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
40666df26cacSmrg	    if test "X$objlist" = X ||
40676df26cacSmrg	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
40686df26cacSmrg		 test "$len" -le "$max_cmd_len"; }; then
40696df26cacSmrg	      objlist="$objlist $obj"
40706df26cacSmrg	    else
40716df26cacSmrg	      # The command $test_cmds is almost too long, add a
40726df26cacSmrg	      # command to the queue.
40736df26cacSmrg	      if test "$k" -eq 1 ; then
40746df26cacSmrg		# The first file doesn't have a previous command to add.
40756df26cacSmrg		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
40766df26cacSmrg	      else
40776df26cacSmrg		# All subsequent reloadable object files will link in
40786df26cacSmrg		# the last one created.
40796df26cacSmrg		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
40806df26cacSmrg	      fi
40816df26cacSmrg	      last_robj=$output_objdir/$output_la-${k}.$objext
40826df26cacSmrg	      k=`expr $k + 1`
40836df26cacSmrg	      output=$output_objdir/$output_la-${k}.$objext
40846df26cacSmrg	      objlist=$obj
40856df26cacSmrg	      len=1
40866df26cacSmrg	    fi
40876df26cacSmrg	  done
40886df26cacSmrg	  # Handle the remaining objects by creating one last
40896df26cacSmrg	  # reloadable object file.  All subsequent reloadable object
40906df26cacSmrg	  # files will link in the last one created.
40916df26cacSmrg	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
40926df26cacSmrg	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
40936df26cacSmrg
40946df26cacSmrg	  if ${skipped_export-false}; then
40956df26cacSmrg	    $show "generating symbol list for \`$libname.la'"
40966df26cacSmrg	    export_symbols="$output_objdir/$libname.exp"
40976df26cacSmrg	    $run $rm $export_symbols
40986df26cacSmrg	    libobjs=$output
40996df26cacSmrg	    # Append the command to create the export file.
41006df26cacSmrg	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
41016df26cacSmrg          fi
41026df26cacSmrg
41036df26cacSmrg	  # Set up a command to remove the reloadable object files
41046df26cacSmrg	  # after they are used.
41056df26cacSmrg	  i=0
41066df26cacSmrg	  while test "$i" -lt "$k"
41076df26cacSmrg	  do
41086df26cacSmrg	    i=`expr $i + 1`
41096df26cacSmrg	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
41106df26cacSmrg	  done
41116df26cacSmrg
41126df26cacSmrg	  $echo "creating a temporary reloadable object file: $output"
41136df26cacSmrg
41146df26cacSmrg	  # Loop through the commands generated above and execute them.
41156df26cacSmrg	  save_ifs="$IFS"; IFS='~'
41166df26cacSmrg	  for cmd in $concat_cmds; do
41176df26cacSmrg	    IFS="$save_ifs"
41186df26cacSmrg	    $show "$cmd"
41196df26cacSmrg	    $run eval "$cmd" || exit $?
41206df26cacSmrg	  done
41216df26cacSmrg	  IFS="$save_ifs"
41226df26cacSmrg
41236df26cacSmrg	  libobjs=$output
41246df26cacSmrg	  # Restore the value of output.
41256df26cacSmrg	  output=$save_output
41266df26cacSmrg
41276df26cacSmrg	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
41286df26cacSmrg	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
41296df26cacSmrg	  fi
41306df26cacSmrg	  # Expand the library linking commands again to reset the
41316df26cacSmrg	  # value of $libobjs for piecewise linking.
41326df26cacSmrg
41336df26cacSmrg	  # Do each of the archive commands.
41346df26cacSmrg	  if test "$module" = yes && test -n "$module_cmds" ; then
41356df26cacSmrg	    if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then
41366df26cacSmrg	      cmds=$module_expsym_cmds
41376df26cacSmrg	    else
41386df26cacSmrg	      cmds=$module_cmds
41396df26cacSmrg	    fi
41406df26cacSmrg	  else
41416df26cacSmrg	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
41426df26cacSmrg	    cmds=$archive_expsym_cmds
41436df26cacSmrg	  else
41446df26cacSmrg	    cmds=$archive_cmds
41456df26cacSmrg	    fi
41466df26cacSmrg	  fi
41476df26cacSmrg
41486df26cacSmrg	  # Append the command to remove the reloadable object files
41496df26cacSmrg	  # to the just-reset $cmds.
41506df26cacSmrg	  eval cmds=\"\$cmds~\$rm $delfiles\"
41516df26cacSmrg	fi
41526df26cacSmrg	save_ifs="$IFS"; IFS='~'
41536df26cacSmrg	for cmd in $cmds; do
41546df26cacSmrg	  IFS="$save_ifs"
41556df26cacSmrg	  eval cmd=\"$cmd\"
41566df26cacSmrg	  $show "$cmd"
41576df26cacSmrg	  $run eval "$cmd" || {
41586df26cacSmrg	    lt_exit=$?
41596df26cacSmrg
41606df26cacSmrg	    # Restore the uninstalled library and exit
41616df26cacSmrg	    if test "$mode" = relink; then
41626df26cacSmrg	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
41636df26cacSmrg	    fi
41646df26cacSmrg
41656df26cacSmrg	    exit $lt_exit
41666df26cacSmrg	  }
41676df26cacSmrg	done
41686df26cacSmrg	IFS="$save_ifs"
41696df26cacSmrg
41706df26cacSmrg	# Restore the uninstalled library and exit
41716df26cacSmrg	if test "$mode" = relink; then
41726df26cacSmrg	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
41736df26cacSmrg
41746df26cacSmrg	  if test -n "$convenience"; then
41756df26cacSmrg	    if test -z "$whole_archive_flag_spec"; then
41766df26cacSmrg	      $show "${rm}r $gentop"
41776df26cacSmrg	      $run ${rm}r "$gentop"
41786df26cacSmrg	    fi
41796df26cacSmrg	  fi
41806df26cacSmrg
41816df26cacSmrg	  exit $EXIT_SUCCESS
41826df26cacSmrg	fi
41836df26cacSmrg
41846df26cacSmrg	# Create links to the real library.
41856df26cacSmrg	for linkname in $linknames; do
41866df26cacSmrg	  if test "$realname" != "$linkname"; then
41876df26cacSmrg	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
41886df26cacSmrg	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
41896df26cacSmrg	  fi
41906df26cacSmrg	done
41916df26cacSmrg
41926df26cacSmrg	# If -module or -export-dynamic was specified, set the dlname.
41936df26cacSmrg	if test "$module" = yes || test "$export_dynamic" = yes; then
41946df26cacSmrg	  # On all known operating systems, these are identical.
41956df26cacSmrg	  dlname="$soname"
41966df26cacSmrg	fi
41976df26cacSmrg      fi
41986df26cacSmrg      ;;
41996df26cacSmrg
42006df26cacSmrg    obj)
42016df26cacSmrg      if test -n "$deplibs"; then
42026df26cacSmrg	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
42036df26cacSmrg      fi
42046df26cacSmrg
42056df26cacSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
42066df26cacSmrg	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
42076df26cacSmrg      fi
42086df26cacSmrg
42096df26cacSmrg      if test -n "$rpath"; then
42106df26cacSmrg	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
42116df26cacSmrg      fi
42126df26cacSmrg
42136df26cacSmrg      if test -n "$xrpath"; then
42146df26cacSmrg	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
42156df26cacSmrg      fi
42166df26cacSmrg
42176df26cacSmrg      if test -n "$vinfo"; then
42186df26cacSmrg	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
42196df26cacSmrg      fi
42206df26cacSmrg
42216df26cacSmrg      if test -n "$release"; then
42226df26cacSmrg	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
42236df26cacSmrg      fi
42246df26cacSmrg
42256df26cacSmrg      case $output in
42266df26cacSmrg      *.lo)
42276df26cacSmrg	if test -n "$objs$old_deplibs"; then
42286df26cacSmrg	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
42296df26cacSmrg	  exit $EXIT_FAILURE
42306df26cacSmrg	fi
42316df26cacSmrg	libobj="$output"
42326df26cacSmrg	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
42336df26cacSmrg	;;
42346df26cacSmrg      *)
42356df26cacSmrg	libobj=
42366df26cacSmrg	obj="$output"
42376df26cacSmrg	;;
42386df26cacSmrg      esac
42396df26cacSmrg
42406df26cacSmrg      # Delete the old objects.
42416df26cacSmrg      $run $rm $obj $libobj
42426df26cacSmrg
42436df26cacSmrg      # Objects from convenience libraries.  This assumes
42446df26cacSmrg      # single-version convenience libraries.  Whenever we create
42456df26cacSmrg      # different ones for PIC/non-PIC, this we'll have to duplicate
42466df26cacSmrg      # the extraction.
42476df26cacSmrg      reload_conv_objs=
42486df26cacSmrg      gentop=
42496df26cacSmrg      # reload_cmds runs $LD directly, so let us get rid of
42506df26cacSmrg      # -Wl from whole_archive_flag_spec
42516df26cacSmrg      wl=
42526df26cacSmrg
42536df26cacSmrg      if test -n "$convenience"; then
42546df26cacSmrg	if test -n "$whole_archive_flag_spec"; then
42556df26cacSmrg	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
42566df26cacSmrg	else
42576df26cacSmrg	  gentop="$output_objdir/${obj}x"
42586df26cacSmrg	  generated="$generated $gentop"
42596df26cacSmrg
42606df26cacSmrg	  func_extract_archives $gentop $convenience
42616df26cacSmrg	  reload_conv_objs="$reload_objs $func_extract_archives_result"
42626df26cacSmrg	fi
42636df26cacSmrg      fi
42646df26cacSmrg
42656df26cacSmrg      # Create the old-style object.
42666df26cacSmrg      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
42676df26cacSmrg
42686df26cacSmrg      output="$obj"
42696df26cacSmrg      cmds=$reload_cmds
42706df26cacSmrg      save_ifs="$IFS"; IFS='~'
42716df26cacSmrg      for cmd in $cmds; do
42726df26cacSmrg	IFS="$save_ifs"
42736df26cacSmrg	eval cmd=\"$cmd\"
42746df26cacSmrg	$show "$cmd"
42756df26cacSmrg	$run eval "$cmd" || exit $?
42766df26cacSmrg      done
42776df26cacSmrg      IFS="$save_ifs"
42786df26cacSmrg
42796df26cacSmrg      # Exit if we aren't doing a library object file.
42806df26cacSmrg      if test -z "$libobj"; then
42816df26cacSmrg	if test -n "$gentop"; then
42826df26cacSmrg	  $show "${rm}r $gentop"
42836df26cacSmrg	  $run ${rm}r $gentop
42846df26cacSmrg	fi
42856df26cacSmrg
42866df26cacSmrg	exit $EXIT_SUCCESS
42876df26cacSmrg      fi
42886df26cacSmrg
42896df26cacSmrg      if test "$build_libtool_libs" != yes; then
42906df26cacSmrg	if test -n "$gentop"; then
42916df26cacSmrg	  $show "${rm}r $gentop"
42926df26cacSmrg	  $run ${rm}r $gentop
42936df26cacSmrg	fi
42946df26cacSmrg
42956df26cacSmrg	# Create an invalid libtool object if no PIC, so that we don't
42966df26cacSmrg	# accidentally link it into a program.
42976df26cacSmrg	# $show "echo timestamp > $libobj"
42986df26cacSmrg	# $run eval "echo timestamp > $libobj" || exit $?
42996df26cacSmrg	exit $EXIT_SUCCESS
43006df26cacSmrg      fi
43016df26cacSmrg
43026df26cacSmrg      if test -n "$pic_flag" || test "$pic_mode" != default; then
43036df26cacSmrg	# Only do commands if we really have different PIC objects.
43046df26cacSmrg	reload_objs="$libobjs $reload_conv_objs"
43056df26cacSmrg	output="$libobj"
43066df26cacSmrg	cmds=$reload_cmds
43076df26cacSmrg	save_ifs="$IFS"; IFS='~'
43086df26cacSmrg	for cmd in $cmds; do
43096df26cacSmrg	  IFS="$save_ifs"
43106df26cacSmrg	  eval cmd=\"$cmd\"
43116df26cacSmrg	  $show "$cmd"
43126df26cacSmrg	  $run eval "$cmd" || exit $?
43136df26cacSmrg	done
43146df26cacSmrg	IFS="$save_ifs"
43156df26cacSmrg      fi
43166df26cacSmrg
43176df26cacSmrg      if test -n "$gentop"; then
43186df26cacSmrg	$show "${rm}r $gentop"
43196df26cacSmrg	$run ${rm}r $gentop
43206df26cacSmrg      fi
43216df26cacSmrg
43226df26cacSmrg      exit $EXIT_SUCCESS
43236df26cacSmrg      ;;
43246df26cacSmrg
43256df26cacSmrg    prog)
43266df26cacSmrg      case $host in
43276df26cacSmrg	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
43286df26cacSmrg      esac
43296df26cacSmrg      if test -n "$vinfo"; then
43306df26cacSmrg	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
43316df26cacSmrg      fi
43326df26cacSmrg
43336df26cacSmrg      if test -n "$release"; then
43346df26cacSmrg	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
43356df26cacSmrg      fi
43366df26cacSmrg
43376df26cacSmrg      if test "$preload" = yes; then
43386df26cacSmrg	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
43396df26cacSmrg	   test "$dlopen_self_static" = unknown; then
43406df26cacSmrg	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
43416df26cacSmrg	fi
43426df26cacSmrg      fi
43436df26cacSmrg
43446df26cacSmrg      case $host in
43456df26cacSmrg      *-*-rhapsody* | *-*-darwin1.[012])
43466df26cacSmrg	# On Rhapsody replace the C library is the System framework
43476df26cacSmrg	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
43486df26cacSmrg	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
43496df26cacSmrg	;;
43506df26cacSmrg      esac
43516df26cacSmrg
43526df26cacSmrg      case $host in
43536df26cacSmrg      *darwin*)
43546df26cacSmrg        # Don't allow lazy linking, it breaks C++ global constructors
43556df26cacSmrg        if test "$tagname" = CXX ; then
43566df26cacSmrg        compile_command="$compile_command ${wl}-bind_at_load"
43576df26cacSmrg        finalize_command="$finalize_command ${wl}-bind_at_load"
43586df26cacSmrg        fi
43596df26cacSmrg        ;;
43606df26cacSmrg      esac
43616df26cacSmrg
43626df26cacSmrg
43636df26cacSmrg      # move library search paths that coincide with paths to not yet
43646df26cacSmrg      # installed libraries to the beginning of the library search list
43656df26cacSmrg      new_libs=
43666df26cacSmrg      for path in $notinst_path; do
43676df26cacSmrg	case " $new_libs " in
43686df26cacSmrg	*" -L$path/$objdir "*) ;;
43696df26cacSmrg	*)
43706df26cacSmrg	  case " $compile_deplibs " in
43716df26cacSmrg	  *" -L$path/$objdir "*)
43726df26cacSmrg	    new_libs="$new_libs -L$path/$objdir" ;;
43736df26cacSmrg	  esac
43746df26cacSmrg	  ;;
43756df26cacSmrg	esac
43766df26cacSmrg      done
43776df26cacSmrg      for deplib in $compile_deplibs; do
43786df26cacSmrg	case $deplib in
43796df26cacSmrg	-L*)
43806df26cacSmrg	  case " $new_libs " in
43816df26cacSmrg	  *" $deplib "*) ;;
43826df26cacSmrg	  *) new_libs="$new_libs $deplib" ;;
43836df26cacSmrg	  esac
43846df26cacSmrg	  ;;
43856df26cacSmrg	*) new_libs="$new_libs $deplib" ;;
43866df26cacSmrg	esac
43876df26cacSmrg      done
43886df26cacSmrg      compile_deplibs="$new_libs"
43896df26cacSmrg
43906df26cacSmrg
43916df26cacSmrg      compile_command="$compile_command $compile_deplibs"
43926df26cacSmrg      finalize_command="$finalize_command $finalize_deplibs"
43936df26cacSmrg
43946df26cacSmrg      if test -n "$rpath$xrpath"; then
43956df26cacSmrg	# If the user specified any rpath flags, then add them.
43966df26cacSmrg	for libdir in $rpath $xrpath; do
43976df26cacSmrg	  # This is the magic to use -rpath.
43986df26cacSmrg	  case "$finalize_rpath " in
43996df26cacSmrg	  *" $libdir "*) ;;
44006df26cacSmrg	  *) finalize_rpath="$finalize_rpath $libdir" ;;
44016df26cacSmrg	  esac
44026df26cacSmrg	done
44036df26cacSmrg      fi
44046df26cacSmrg
44056df26cacSmrg      # Now hardcode the library paths
44066df26cacSmrg      rpath=
44076df26cacSmrg      hardcode_libdirs=
44086df26cacSmrg      for libdir in $compile_rpath $finalize_rpath; do
44096df26cacSmrg	if test -n "$hardcode_libdir_flag_spec"; then
44106df26cacSmrg	  if test -n "$hardcode_libdir_separator"; then
44116df26cacSmrg	    if test -z "$hardcode_libdirs"; then
44126df26cacSmrg	      hardcode_libdirs="$libdir"
44136df26cacSmrg	    else
44146df26cacSmrg	      # Just accumulate the unique libdirs.
44156df26cacSmrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
44166df26cacSmrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
44176df26cacSmrg		;;
44186df26cacSmrg	      *)
44196df26cacSmrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
44206df26cacSmrg		;;
44216df26cacSmrg	      esac
44226df26cacSmrg	    fi
44236df26cacSmrg	  else
44246df26cacSmrg	    eval flag=\"$hardcode_libdir_flag_spec\"
44256df26cacSmrg	    rpath="$rpath $flag"
44266df26cacSmrg	  fi
44276df26cacSmrg	elif test -n "$runpath_var"; then
44286df26cacSmrg	  case "$perm_rpath " in
44296df26cacSmrg	  *" $libdir "*) ;;
44306df26cacSmrg	  *) perm_rpath="$perm_rpath $libdir" ;;
44316df26cacSmrg	  esac
44326df26cacSmrg	fi
44336df26cacSmrg	case $host in
44346df26cacSmrg	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
44356df26cacSmrg	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
44366df26cacSmrg	  case :$dllsearchpath: in
44376df26cacSmrg	  *":$libdir:"*) ;;
44386df26cacSmrg	  *) dllsearchpath="$dllsearchpath:$libdir";;
44396df26cacSmrg	  esac
44406df26cacSmrg	  case :$dllsearchpath: in
44416df26cacSmrg	  *":$testbindir:"*) ;;
44426df26cacSmrg	  *) dllsearchpath="$dllsearchpath:$testbindir";;
44436df26cacSmrg	  esac
44446df26cacSmrg	  ;;
44456df26cacSmrg	esac
44466df26cacSmrg      done
44476df26cacSmrg      # Substitute the hardcoded libdirs into the rpath.
44486df26cacSmrg      if test -n "$hardcode_libdir_separator" &&
44496df26cacSmrg	 test -n "$hardcode_libdirs"; then
44506df26cacSmrg	libdir="$hardcode_libdirs"
44516df26cacSmrg	eval rpath=\" $hardcode_libdir_flag_spec\"
44526df26cacSmrg      fi
44536df26cacSmrg      compile_rpath="$rpath"
44546df26cacSmrg
44556df26cacSmrg      rpath=
44566df26cacSmrg      hardcode_libdirs=
44576df26cacSmrg      for libdir in $finalize_rpath; do
44586df26cacSmrg	if test -n "$hardcode_libdir_flag_spec"; then
44596df26cacSmrg	  if test -n "$hardcode_libdir_separator"; then
44606df26cacSmrg	    if test -z "$hardcode_libdirs"; then
44616df26cacSmrg	      hardcode_libdirs="$libdir"
44626df26cacSmrg	    else
44636df26cacSmrg	      # Just accumulate the unique libdirs.
44646df26cacSmrg	      case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in
44656df26cacSmrg	      *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
44666df26cacSmrg		;;
44676df26cacSmrg	      *)
44686df26cacSmrg		hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
44696df26cacSmrg		;;
44706df26cacSmrg	      esac
44716df26cacSmrg	    fi
44726df26cacSmrg	  else
44736df26cacSmrg	    eval flag=\"$hardcode_libdir_flag_spec\"
44746df26cacSmrg	    rpath="$rpath $flag"
44756df26cacSmrg	  fi
44766df26cacSmrg	elif test -n "$runpath_var"; then
44776df26cacSmrg	  case "$finalize_perm_rpath " in
44786df26cacSmrg	  *" $libdir "*) ;;
44796df26cacSmrg	  *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
44806df26cacSmrg	  esac
44816df26cacSmrg	fi
44826df26cacSmrg      done
44836df26cacSmrg      # Substitute the hardcoded libdirs into the rpath.
44846df26cacSmrg      if test -n "$hardcode_libdir_separator" &&
44856df26cacSmrg	 test -n "$hardcode_libdirs"; then
44866df26cacSmrg	libdir="$hardcode_libdirs"
44876df26cacSmrg	eval rpath=\" $hardcode_libdir_flag_spec\"
44886df26cacSmrg      fi
44896df26cacSmrg      finalize_rpath="$rpath"
44906df26cacSmrg
44916df26cacSmrg      if test -n "$libobjs" && test "$build_old_libs" = yes; then
44926df26cacSmrg	# Transform all the library objects into standard objects.
44936df26cacSmrg	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
44946df26cacSmrg	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
44956df26cacSmrg      fi
44966df26cacSmrg
44976df26cacSmrg      dlsyms=
44986df26cacSmrg      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
44996df26cacSmrg	if test -n "$NM" && test -n "$global_symbol_pipe"; then
45006df26cacSmrg	  dlsyms="${outputname}S.c"
45016df26cacSmrg	else
45026df26cacSmrg	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
45036df26cacSmrg	fi
45046df26cacSmrg      fi
45056df26cacSmrg
45066df26cacSmrg      if test -n "$dlsyms"; then
45076df26cacSmrg	case $dlsyms in
45086df26cacSmrg	"") ;;
45096df26cacSmrg	*.c)
45106df26cacSmrg	  # Discover the nlist of each of the dlfiles.
45116df26cacSmrg	  nlist="$output_objdir/${outputname}.nm"
45126df26cacSmrg
45136df26cacSmrg	  $show "$rm $nlist ${nlist}S ${nlist}T"
45146df26cacSmrg	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
45156df26cacSmrg
45166df26cacSmrg	  # Parse the name list into a source file.
45176df26cacSmrg	  $show "creating $output_objdir/$dlsyms"
45186df26cacSmrg
45196df26cacSmrg	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
45206df26cacSmrg/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
45216df26cacSmrg/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
45226df26cacSmrg
45236df26cacSmrg#ifdef __cplusplus
45246df26cacSmrgextern \"C\" {
45256df26cacSmrg#endif
45266df26cacSmrg
45276df26cacSmrg/* Prevent the only kind of declaration conflicts we can make. */
45286df26cacSmrg#define lt_preloaded_symbols some_other_symbol
45296df26cacSmrg
45306df26cacSmrg/* External symbol declarations for the compiler. */\
45316df26cacSmrg"
45326df26cacSmrg
45336df26cacSmrg	  if test "$dlself" = yes; then
45346df26cacSmrg	    $show "generating symbol list for \`$output'"
45356df26cacSmrg
45366df26cacSmrg	    test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
45376df26cacSmrg
45386df26cacSmrg	    # Add our own program objects to the symbol list.
45396df26cacSmrg	    progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
45406df26cacSmrg	    for arg in $progfiles; do
45416df26cacSmrg	      $show "extracting global C symbols from \`$arg'"
45426df26cacSmrg	      $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
45436df26cacSmrg	    done
45446df26cacSmrg
45456df26cacSmrg	    if test -n "$exclude_expsyms"; then
45466df26cacSmrg	      $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
45476df26cacSmrg	      $run eval '$mv "$nlist"T "$nlist"'
45486df26cacSmrg	    fi
45496df26cacSmrg
45506df26cacSmrg	    if test -n "$export_symbols_regex"; then
45516df26cacSmrg	      $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
45526df26cacSmrg	      $run eval '$mv "$nlist"T "$nlist"'
45536df26cacSmrg	    fi
45546df26cacSmrg
45556df26cacSmrg	    # Prepare the list of exported symbols
45566df26cacSmrg	    if test -z "$export_symbols"; then
45576df26cacSmrg	      export_symbols="$output_objdir/$outputname.exp"
45586df26cacSmrg	      $run $rm $export_symbols
45596df26cacSmrg	      $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
45606df26cacSmrg              case $host in
45616df26cacSmrg              *cygwin* | *mingw* )
45626df26cacSmrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
45636df26cacSmrg		$run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
45646df26cacSmrg                ;;
45656df26cacSmrg              esac
45666df26cacSmrg	    else
45676df26cacSmrg	      $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
45686df26cacSmrg	      $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
45696df26cacSmrg	      $run eval 'mv "$nlist"T "$nlist"'
45706df26cacSmrg              case $host in
45716df26cacSmrg              *cygwin* | *mingw* )
45726df26cacSmrg	        $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
45736df26cacSmrg		$run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
45746df26cacSmrg                ;;
45756df26cacSmrg              esac
45766df26cacSmrg	    fi
45776df26cacSmrg	  fi
45786df26cacSmrg
45796df26cacSmrg	  for arg in $dlprefiles; do
45806df26cacSmrg	    $show "extracting global C symbols from \`$arg'"
45816df26cacSmrg	    name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
45826df26cacSmrg	    $run eval '$echo ": $name " >> "$nlist"'
45836df26cacSmrg	    $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
45846df26cacSmrg	  done
45856df26cacSmrg
45866df26cacSmrg	  if test -z "$run"; then
45876df26cacSmrg	    # Make sure we have at least an empty file.
45886df26cacSmrg	    test -f "$nlist" || : > "$nlist"
45896df26cacSmrg
45906df26cacSmrg	    if test -n "$exclude_expsyms"; then
45916df26cacSmrg	      $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
45926df26cacSmrg	      $mv "$nlist"T "$nlist"
45936df26cacSmrg	    fi
45946df26cacSmrg
45956df26cacSmrg	    # Try sorting and uniquifying the output.
45966df26cacSmrg	    if grep -v "^: " < "$nlist" |
45976df26cacSmrg		if sort -k 3 </dev/null >/dev/null 2>&1; then
45986df26cacSmrg		  sort -k 3
45996df26cacSmrg		else
46006df26cacSmrg		  sort +2
46016df26cacSmrg		fi |
46026df26cacSmrg		uniq > "$nlist"S; then
46036df26cacSmrg	      :
46046df26cacSmrg	    else
46056df26cacSmrg	      grep -v "^: " < "$nlist" > "$nlist"S
46066df26cacSmrg	    fi
46076df26cacSmrg
46086df26cacSmrg	    if test -f "$nlist"S; then
46096df26cacSmrg	      eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
46106df26cacSmrg	    else
46116df26cacSmrg	      $echo '/* NONE */' >> "$output_objdir/$dlsyms"
46126df26cacSmrg	    fi
46136df26cacSmrg
46146df26cacSmrg	    $echo >> "$output_objdir/$dlsyms" "\
46156df26cacSmrg
46166df26cacSmrg#undef lt_preloaded_symbols
46176df26cacSmrg
46186df26cacSmrg#if defined (__STDC__) && __STDC__
46196df26cacSmrg# define lt_ptr void *
46206df26cacSmrg#else
46216df26cacSmrg# define lt_ptr char *
46226df26cacSmrg# define const
46236df26cacSmrg#endif
46246df26cacSmrg
46256df26cacSmrg/* The mapping between symbol names and symbols. */
46266df26cacSmrg"
46276df26cacSmrg
46286df26cacSmrg	    case $host in
46296df26cacSmrg	    *cygwin* | *mingw* )
46306df26cacSmrg	  $echo >> "$output_objdir/$dlsyms" "\
46316df26cacSmrg/* DATA imports from DLLs on WIN32 can't be const, because
46326df26cacSmrg   runtime relocations are performed -- see ld's documentation
46336df26cacSmrg   on pseudo-relocs */
46346df26cacSmrgstruct {
46356df26cacSmrg"
46366df26cacSmrg	      ;;
46376df26cacSmrg	    * )
46386df26cacSmrg	  $echo >> "$output_objdir/$dlsyms" "\
46396df26cacSmrgconst struct {
46406df26cacSmrg"
46416df26cacSmrg	      ;;
46426df26cacSmrg	    esac
46436df26cacSmrg
46446df26cacSmrg
46456df26cacSmrg	  $echo >> "$output_objdir/$dlsyms" "\
46466df26cacSmrg  const char *name;
46476df26cacSmrg  lt_ptr address;
46486df26cacSmrg}
46496df26cacSmrglt_preloaded_symbols[] =
46506df26cacSmrg{\
46516df26cacSmrg"
46526df26cacSmrg
46536df26cacSmrg	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
46546df26cacSmrg
46556df26cacSmrg	    $echo >> "$output_objdir/$dlsyms" "\
46566df26cacSmrg  {0, (lt_ptr) 0}
46576df26cacSmrg};
46586df26cacSmrg
46596df26cacSmrg/* This works around a problem in FreeBSD linker */
46606df26cacSmrg#ifdef FREEBSD_WORKAROUND
46616df26cacSmrgstatic const void *lt_preloaded_setup() {
46626df26cacSmrg  return lt_preloaded_symbols;
46636df26cacSmrg}
46646df26cacSmrg#endif
46656df26cacSmrg
46666df26cacSmrg#ifdef __cplusplus
46676df26cacSmrg}
46686df26cacSmrg#endif\
46696df26cacSmrg"
46706df26cacSmrg	  fi
46716df26cacSmrg
46726df26cacSmrg	  pic_flag_for_symtable=
46736df26cacSmrg	  case $host in
46746df26cacSmrg	  # compiling the symbol table file with pic_flag works around
46756df26cacSmrg	  # a FreeBSD bug that causes programs to crash when -lm is
46766df26cacSmrg	  # linked before any other PIC object.  But we must not use
46776df26cacSmrg	  # pic_flag when linking with -static.  The problem exists in
46786df26cacSmrg	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
46796df26cacSmrg	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
46806df26cacSmrg	    case "$compile_command " in
46816df26cacSmrg	    *" -static "*) ;;
46826df26cacSmrg	    *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
46836df26cacSmrg	    esac;;
46846df26cacSmrg	  *-*-hpux*)
46856df26cacSmrg	    case "$compile_command " in
46866df26cacSmrg	    *" -static "*) ;;
46876df26cacSmrg	    *) pic_flag_for_symtable=" $pic_flag";;
46886df26cacSmrg	    esac
46896df26cacSmrg	  esac
46906df26cacSmrg
46916df26cacSmrg	  # Now compile the dynamic symbol file.
46926df26cacSmrg	  $show "(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
46936df26cacSmrg	  $run eval '(cd $output_objdir && $LTCC  $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
46946df26cacSmrg
46956df26cacSmrg	  # Clean up the generated files.
46966df26cacSmrg	  $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
46976df26cacSmrg	  $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
46986df26cacSmrg
46996df26cacSmrg	  # Transform the symbol file into the correct name.
47006df26cacSmrg          case $host in
47016df26cacSmrg          *cygwin* | *mingw* )
47026df26cacSmrg            if test -f "$output_objdir/${outputname}.def" ; then
47036df26cacSmrg              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
47046df26cacSmrg              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%"`
47056df26cacSmrg            else
47066df26cacSmrg              compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
47076df26cacSmrg              finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
47086df26cacSmrg             fi
47096df26cacSmrg            ;;
47106df26cacSmrg          * )
47116df26cacSmrg            compile_command=`$echo "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
47126df26cacSmrg            finalize_command=`$echo "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%"`
47136df26cacSmrg            ;;
47146df26cacSmrg          esac
47156df26cacSmrg	  ;;
47166df26cacSmrg	*)
47176df26cacSmrg	  $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
47186df26cacSmrg	  exit $EXIT_FAILURE
47196df26cacSmrg	  ;;
47206df26cacSmrg	esac
47216df26cacSmrg      else
47226df26cacSmrg	# We keep going just in case the user didn't refer to
47236df26cacSmrg	# lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
47246df26cacSmrg	# really was required.
47256df26cacSmrg
47266df26cacSmrg	# Nullify the symbol file.
47276df26cacSmrg	compile_command=`$echo "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
47286df26cacSmrg	finalize_command=`$echo "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
47296df26cacSmrg      fi
47306df26cacSmrg
47316df26cacSmrg      if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
47326df26cacSmrg	# Replace the output file specification.
47336df26cacSmrg	compile_command=`$echo "X$compile_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
47346df26cacSmrg	link_command="$compile_command$compile_rpath"
47356df26cacSmrg
47366df26cacSmrg	# We have no uninstalled library dependencies, so finalize right now.
47376df26cacSmrg	$show "$link_command"
47386df26cacSmrg	$run eval "$link_command"
47396df26cacSmrg	exit_status=$?
47406df26cacSmrg
47416df26cacSmrg	# Delete the generated files.
47426df26cacSmrg	if test -n "$dlsyms"; then
47436df26cacSmrg	  $show "$rm $output_objdir/${outputname}S.${objext}"
47446df26cacSmrg	  $run $rm "$output_objdir/${outputname}S.${objext}"
47456df26cacSmrg	fi
47466df26cacSmrg
47476df26cacSmrg	exit $exit_status
47486df26cacSmrg      fi
47496df26cacSmrg
47506df26cacSmrg      if test -n "$shlibpath_var"; then
47516df26cacSmrg	# We should set the shlibpath_var
47526df26cacSmrg	rpath=
47536df26cacSmrg	for dir in $temp_rpath; do
47546df26cacSmrg	  case $dir in
47556df26cacSmrg	  [\\/]* | [A-Za-z]:[\\/]*)
47566df26cacSmrg	    # Absolute path.
47576df26cacSmrg	    rpath="$rpath$dir:"
47586df26cacSmrg	    ;;
47596df26cacSmrg	  *)
47606df26cacSmrg	    # Relative path: add a thisdir entry.
47616df26cacSmrg	    rpath="$rpath\$thisdir/$dir:"
47626df26cacSmrg	    ;;
47636df26cacSmrg	  esac
47646df26cacSmrg	done
47656df26cacSmrg	temp_rpath="$rpath"
47666df26cacSmrg      fi
47676df26cacSmrg
47686df26cacSmrg      if test -n "$compile_shlibpath$finalize_shlibpath"; then
47696df26cacSmrg	compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
47706df26cacSmrg      fi
47716df26cacSmrg      if test -n "$finalize_shlibpath"; then
47726df26cacSmrg	finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command"
47736df26cacSmrg      fi
47746df26cacSmrg
47756df26cacSmrg      compile_var=
47766df26cacSmrg      finalize_var=
47776df26cacSmrg      if test -n "$runpath_var"; then
47786df26cacSmrg	if test -n "$perm_rpath"; then
47796df26cacSmrg	  # We should set the runpath_var.
47806df26cacSmrg	  rpath=
47816df26cacSmrg	  for dir in $perm_rpath; do
47826df26cacSmrg	    rpath="$rpath$dir:"
47836df26cacSmrg	  done
47846df26cacSmrg	  compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
47856df26cacSmrg	fi
47866df26cacSmrg	if test -n "$finalize_perm_rpath"; then
47876df26cacSmrg	  # We should set the runpath_var.
47886df26cacSmrg	  rpath=
47896df26cacSmrg	  for dir in $finalize_perm_rpath; do
47906df26cacSmrg	    rpath="$rpath$dir:"
47916df26cacSmrg	  done
47926df26cacSmrg	  finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
47936df26cacSmrg	fi
47946df26cacSmrg      fi
47956df26cacSmrg
47966df26cacSmrg      if test "$no_install" = yes; then
47976df26cacSmrg	# We don't need to create a wrapper script.
47986df26cacSmrg	link_command="$compile_var$compile_command$compile_rpath"
47996df26cacSmrg	# Replace the output file specification.
48006df26cacSmrg	link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
48016df26cacSmrg	# Delete the old output file.
48026df26cacSmrg	$run $rm $output
48036df26cacSmrg	# Link the executable and exit
48046df26cacSmrg	$show "$link_command"
48056df26cacSmrg	$run eval "$link_command" || exit $?
48066df26cacSmrg	exit $EXIT_SUCCESS
48076df26cacSmrg      fi
48086df26cacSmrg
48096df26cacSmrg      if test "$hardcode_action" = relink; then
48106df26cacSmrg	# Fast installation is not supported
48116df26cacSmrg	link_command="$compile_var$compile_command$compile_rpath"
48126df26cacSmrg	relink_command="$finalize_var$finalize_command$finalize_rpath"
48136df26cacSmrg
48146df26cacSmrg	$echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
48156df26cacSmrg	$echo "$modename: \`$output' will be relinked during installation" 1>&2
48166df26cacSmrg      else
48176df26cacSmrg	if test "$fast_install" != no; then
48186df26cacSmrg	  link_command="$finalize_var$compile_command$finalize_rpath"
48196df26cacSmrg	  if test "$fast_install" = yes; then
48206df26cacSmrg	    relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g'`
48216df26cacSmrg	  else
48226df26cacSmrg	    # fast_install is set to needless
48236df26cacSmrg	    relink_command=
48246df26cacSmrg	  fi
48256df26cacSmrg	else
48266df26cacSmrg	  link_command="$compile_var$compile_command$compile_rpath"
48276df26cacSmrg	  relink_command="$finalize_var$finalize_command$finalize_rpath"
48286df26cacSmrg	fi
48296df26cacSmrg      fi
48306df26cacSmrg
48316df26cacSmrg      # Replace the output file specification.
48326df26cacSmrg      link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
48336df26cacSmrg
48346df26cacSmrg      # Delete the old output files.
48356df26cacSmrg      $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
48366df26cacSmrg
48376df26cacSmrg      $show "$link_command"
48386df26cacSmrg      $run eval "$link_command" || exit $?
48396df26cacSmrg
48406df26cacSmrg      # Now create the wrapper script.
48416df26cacSmrg      $show "creating $output"
48426df26cacSmrg
48436df26cacSmrg      # Quote the relink command for shipping.
48446df26cacSmrg      if test -n "$relink_command"; then
48456df26cacSmrg	# Preserve any variables that may affect compiler behavior
48466df26cacSmrg	for var in $variables_saved_for_relink; do
48476df26cacSmrg	  if eval test -z \"\${$var+set}\"; then
48486df26cacSmrg	    relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
48496df26cacSmrg	  elif eval var_value=\$$var; test -z "$var_value"; then
48506df26cacSmrg	    relink_command="$var=; export $var; $relink_command"
48516df26cacSmrg	  else
48526df26cacSmrg	    var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
48536df26cacSmrg	    relink_command="$var=\"$var_value\"; export $var; $relink_command"
48546df26cacSmrg	  fi
48556df26cacSmrg	done
48566df26cacSmrg	relink_command="(cd `pwd`; $relink_command)"
48576df26cacSmrg	relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
48586df26cacSmrg      fi
48596df26cacSmrg
48606df26cacSmrg      # Quote $echo for shipping.
48616df26cacSmrg      if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
48626df26cacSmrg	case $progpath in
48636df26cacSmrg	[\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
48646df26cacSmrg	*) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
48656df26cacSmrg	esac
48666df26cacSmrg	qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
48676df26cacSmrg      else
48686df26cacSmrg	qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
48696df26cacSmrg      fi
48706df26cacSmrg
48716df26cacSmrg      # Only actually do things if our run command is non-null.
48726df26cacSmrg      if test -z "$run"; then
48736df26cacSmrg	# win32 will think the script is a binary if it has
48746df26cacSmrg	# a .exe suffix, so we strip it off here.
48756df26cacSmrg	case $output in
48766df26cacSmrg	  *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
48776df26cacSmrg	esac
48786df26cacSmrg	# test for cygwin because mv fails w/o .exe extensions
48796df26cacSmrg	case $host in
48806df26cacSmrg	  *cygwin*)
48816df26cacSmrg	    exeext=.exe
48826df26cacSmrg	    outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
48836df26cacSmrg	  *) exeext= ;;
48846df26cacSmrg	esac
48856df26cacSmrg	case $host in
48866df26cacSmrg	  *cygwin* | *mingw* )
48876df26cacSmrg            output_name=`basename $output`
48886df26cacSmrg            output_path=`dirname $output`
48896df26cacSmrg            cwrappersource="$output_path/$objdir/lt-$output_name.c"
48906df26cacSmrg            cwrapper="$output_path/$output_name.exe"
48916df26cacSmrg            $rm $cwrappersource $cwrapper
48926df26cacSmrg            trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
48936df26cacSmrg
48946df26cacSmrg	    cat > $cwrappersource <<EOF
48956df26cacSmrg
48966df26cacSmrg/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
48976df26cacSmrg   Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
48986df26cacSmrg
48996df26cacSmrg   The $output program cannot be directly executed until all the libtool
49006df26cacSmrg   libraries that it depends on are installed.
49016df26cacSmrg
49026df26cacSmrg   This wrapper executable should never be moved out of the build directory.
49036df26cacSmrg   If it is, it will not operate correctly.
49046df26cacSmrg
49056df26cacSmrg   Currently, it simply execs the wrapper *script* "/bin/sh $output",
49066df26cacSmrg   but could eventually absorb all of the scripts functionality and
49076df26cacSmrg   exec $objdir/$outputname directly.
49086df26cacSmrg*/
49096df26cacSmrgEOF
49106df26cacSmrg	    cat >> $cwrappersource<<"EOF"
49116df26cacSmrg#include <stdio.h>
49126df26cacSmrg#include <stdlib.h>
49136df26cacSmrg#include <unistd.h>
49146df26cacSmrg#include <malloc.h>
49156df26cacSmrg#include <stdarg.h>
49166df26cacSmrg#include <assert.h>
49176df26cacSmrg#include <string.h>
49186df26cacSmrg#include <ctype.h>
49196df26cacSmrg#include <sys/stat.h>
49206df26cacSmrg
49216df26cacSmrg#if defined(PATH_MAX)
49226df26cacSmrg# define LT_PATHMAX PATH_MAX
49236df26cacSmrg#elif defined(MAXPATHLEN)
49246df26cacSmrg# define LT_PATHMAX MAXPATHLEN
49256df26cacSmrg#else
49266df26cacSmrg# define LT_PATHMAX 1024
49276df26cacSmrg#endif
49286df26cacSmrg
49296df26cacSmrg#ifndef DIR_SEPARATOR
49306df26cacSmrg# define DIR_SEPARATOR '/'
49316df26cacSmrg# define PATH_SEPARATOR ':'
49326df26cacSmrg#endif
49336df26cacSmrg
49346df26cacSmrg#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
49356df26cacSmrg  defined (__OS2__)
49366df26cacSmrg# define HAVE_DOS_BASED_FILE_SYSTEM
49376df26cacSmrg# ifndef DIR_SEPARATOR_2
49386df26cacSmrg#  define DIR_SEPARATOR_2 '\\'
49396df26cacSmrg# endif
49406df26cacSmrg# ifndef PATH_SEPARATOR_2
49416df26cacSmrg#  define PATH_SEPARATOR_2 ';'
49426df26cacSmrg# endif
49436df26cacSmrg#endif
49446df26cacSmrg
49456df26cacSmrg#ifndef DIR_SEPARATOR_2
49466df26cacSmrg# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
49476df26cacSmrg#else /* DIR_SEPARATOR_2 */
49486df26cacSmrg# define IS_DIR_SEPARATOR(ch) \
49496df26cacSmrg        (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
49506df26cacSmrg#endif /* DIR_SEPARATOR_2 */
49516df26cacSmrg
49526df26cacSmrg#ifndef PATH_SEPARATOR_2
49536df26cacSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
49546df26cacSmrg#else /* PATH_SEPARATOR_2 */
49556df26cacSmrg# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
49566df26cacSmrg#endif /* PATH_SEPARATOR_2 */
49576df26cacSmrg
49586df26cacSmrg#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
49596df26cacSmrg#define XFREE(stale) do { \
49606df26cacSmrg  if (stale) { free ((void *) stale); stale = 0; } \
49616df26cacSmrg} while (0)
49626df26cacSmrg
49636df26cacSmrg/* -DDEBUG is fairly common in CFLAGS.  */
49646df26cacSmrg#undef DEBUG
49656df26cacSmrg#if defined DEBUGWRAPPER
49666df26cacSmrg# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
49676df26cacSmrg#else
49686df26cacSmrg# define DEBUG(format, ...)
49696df26cacSmrg#endif
49706df26cacSmrg
49716df26cacSmrgconst char *program_name = NULL;
49726df26cacSmrg
49736df26cacSmrgvoid * xmalloc (size_t num);
49746df26cacSmrgchar * xstrdup (const char *string);
49756df26cacSmrgconst char * base_name (const char *name);
49766df26cacSmrgchar * find_executable(const char *wrapper);
49776df26cacSmrgint    check_executable(const char *path);
49786df26cacSmrgchar * strendzap(char *str, const char *pat);
49796df26cacSmrgvoid lt_fatal (const char *message, ...);
49806df26cacSmrg
49816df26cacSmrgint
49826df26cacSmrgmain (int argc, char *argv[])
49836df26cacSmrg{
49846df26cacSmrg  char **newargz;
49856df26cacSmrg  int i;
49866df26cacSmrg
49876df26cacSmrg  program_name = (char *) xstrdup (base_name (argv[0]));
49886df26cacSmrg  DEBUG("(main) argv[0]      : %s\n",argv[0]);
49896df26cacSmrg  DEBUG("(main) program_name : %s\n",program_name);
49906df26cacSmrg  newargz = XMALLOC(char *, argc+2);
49916df26cacSmrgEOF
49926df26cacSmrg
49936df26cacSmrg            cat >> $cwrappersource <<EOF
49946df26cacSmrg  newargz[0] = (char *) xstrdup("$SHELL");
49956df26cacSmrgEOF
49966df26cacSmrg
49976df26cacSmrg            cat >> $cwrappersource <<"EOF"
49986df26cacSmrg  newargz[1] = find_executable(argv[0]);
49996df26cacSmrg  if (newargz[1] == NULL)
50006df26cacSmrg    lt_fatal("Couldn't find %s", argv[0]);
50016df26cacSmrg  DEBUG("(main) found exe at : %s\n",newargz[1]);
50026df26cacSmrg  /* we know the script has the same name, without the .exe */
50036df26cacSmrg  /* so make sure newargz[1] doesn't end in .exe */
50046df26cacSmrg  strendzap(newargz[1],".exe");
50056df26cacSmrg  for (i = 1; i < argc; i++)
50066df26cacSmrg    newargz[i+1] = xstrdup(argv[i]);
50076df26cacSmrg  newargz[argc+1] = NULL;
50086df26cacSmrg
50096df26cacSmrg  for (i=0; i<argc+1; i++)
50106df26cacSmrg  {
50116df26cacSmrg    DEBUG("(main) newargz[%d]   : %s\n",i,newargz[i]);
50126df26cacSmrg    ;
50136df26cacSmrg  }
50146df26cacSmrg
50156df26cacSmrgEOF
50166df26cacSmrg
50176df26cacSmrg            case $host_os in
50186df26cacSmrg              mingw*)
50196df26cacSmrg                cat >> $cwrappersource <<EOF
50206df26cacSmrg  execv("$SHELL",(char const **)newargz);
50216df26cacSmrgEOF
50226df26cacSmrg              ;;
50236df26cacSmrg              *)
50246df26cacSmrg                cat >> $cwrappersource <<EOF
50256df26cacSmrg  execv("$SHELL",newargz);
50266df26cacSmrgEOF
50276df26cacSmrg              ;;
50286df26cacSmrg            esac
50296df26cacSmrg
50306df26cacSmrg            cat >> $cwrappersource <<"EOF"
50316df26cacSmrg  return 127;
50326df26cacSmrg}
50336df26cacSmrg
50346df26cacSmrgvoid *
50356df26cacSmrgxmalloc (size_t num)
50366df26cacSmrg{
50376df26cacSmrg  void * p = (void *) malloc (num);
50386df26cacSmrg  if (!p)
50396df26cacSmrg    lt_fatal ("Memory exhausted");
50406df26cacSmrg
50416df26cacSmrg  return p;
50426df26cacSmrg}
50436df26cacSmrg
50446df26cacSmrgchar *
50456df26cacSmrgxstrdup (const char *string)
50466df26cacSmrg{
50476df26cacSmrg  return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
50486df26cacSmrg;
50496df26cacSmrg}
50506df26cacSmrg
50516df26cacSmrgconst char *
50526df26cacSmrgbase_name (const char *name)
50536df26cacSmrg{
50546df26cacSmrg  const char *base;
50556df26cacSmrg
50566df26cacSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
50576df26cacSmrg  /* Skip over the disk name in MSDOS pathnames. */
50586df26cacSmrg  if (isalpha ((unsigned char)name[0]) && name[1] == ':')
50596df26cacSmrg    name += 2;
50606df26cacSmrg#endif
50616df26cacSmrg
50626df26cacSmrg  for (base = name; *name; name++)
50636df26cacSmrg    if (IS_DIR_SEPARATOR (*name))
50646df26cacSmrg      base = name + 1;
50656df26cacSmrg  return base;
50666df26cacSmrg}
50676df26cacSmrg
50686df26cacSmrgint
50696df26cacSmrgcheck_executable(const char * path)
50706df26cacSmrg{
50716df26cacSmrg  struct stat st;
50726df26cacSmrg
50736df26cacSmrg  DEBUG("(check_executable)  : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
50746df26cacSmrg  if ((!path) || (!*path))
50756df26cacSmrg    return 0;
50766df26cacSmrg
50776df26cacSmrg  if ((stat (path, &st) >= 0) &&
50786df26cacSmrg      (
50796df26cacSmrg        /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
50806df26cacSmrg#if defined (S_IXOTH)
50816df26cacSmrg       ((st.st_mode & S_IXOTH) == S_IXOTH) ||
50826df26cacSmrg#endif
50836df26cacSmrg#if defined (S_IXGRP)
50846df26cacSmrg       ((st.st_mode & S_IXGRP) == S_IXGRP) ||
50856df26cacSmrg#endif
50866df26cacSmrg       ((st.st_mode & S_IXUSR) == S_IXUSR))
50876df26cacSmrg      )
50886df26cacSmrg    return 1;
50896df26cacSmrg  else
50906df26cacSmrg    return 0;
50916df26cacSmrg}
50926df26cacSmrg
50936df26cacSmrg/* Searches for the full path of the wrapper.  Returns
50946df26cacSmrg   newly allocated full path name if found, NULL otherwise */
50956df26cacSmrgchar *
50966df26cacSmrgfind_executable (const char* wrapper)
50976df26cacSmrg{
50986df26cacSmrg  int has_slash = 0;
50996df26cacSmrg  const char* p;
51006df26cacSmrg  const char* p_next;
51016df26cacSmrg  /* static buffer for getcwd */
51026df26cacSmrg  char tmp[LT_PATHMAX + 1];
51036df26cacSmrg  int tmp_len;
51046df26cacSmrg  char* concat_name;
51056df26cacSmrg
51066df26cacSmrg  DEBUG("(find_executable)  : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
51076df26cacSmrg
51086df26cacSmrg  if ((wrapper == NULL) || (*wrapper == '\0'))
51096df26cacSmrg    return NULL;
51106df26cacSmrg
51116df26cacSmrg  /* Absolute path? */
51126df26cacSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
51136df26cacSmrg  if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
51146df26cacSmrg  {
51156df26cacSmrg    concat_name = xstrdup (wrapper);
51166df26cacSmrg    if (check_executable(concat_name))
51176df26cacSmrg      return concat_name;
51186df26cacSmrg    XFREE(concat_name);
51196df26cacSmrg  }
51206df26cacSmrg  else
51216df26cacSmrg  {
51226df26cacSmrg#endif
51236df26cacSmrg    if (IS_DIR_SEPARATOR (wrapper[0]))
51246df26cacSmrg    {
51256df26cacSmrg      concat_name = xstrdup (wrapper);
51266df26cacSmrg      if (check_executable(concat_name))
51276df26cacSmrg        return concat_name;
51286df26cacSmrg      XFREE(concat_name);
51296df26cacSmrg    }
51306df26cacSmrg#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
51316df26cacSmrg  }
51326df26cacSmrg#endif
51336df26cacSmrg
51346df26cacSmrg  for (p = wrapper; *p; p++)
51356df26cacSmrg    if (*p == '/')
51366df26cacSmrg    {
51376df26cacSmrg      has_slash = 1;
51386df26cacSmrg      break;
51396df26cacSmrg    }
51406df26cacSmrg  if (!has_slash)
51416df26cacSmrg  {
51426df26cacSmrg    /* no slashes; search PATH */
51436df26cacSmrg    const char* path = getenv ("PATH");
51446df26cacSmrg    if (path != NULL)
51456df26cacSmrg    {
51466df26cacSmrg      for (p = path; *p; p = p_next)
51476df26cacSmrg      {
51486df26cacSmrg        const char* q;
51496df26cacSmrg        size_t p_len;
51506df26cacSmrg        for (q = p; *q; q++)
51516df26cacSmrg          if (IS_PATH_SEPARATOR(*q))
51526df26cacSmrg            break;
51536df26cacSmrg        p_len = q - p;
51546df26cacSmrg        p_next = (*q == '\0' ? q : q + 1);
51556df26cacSmrg        if (p_len == 0)
51566df26cacSmrg        {
51576df26cacSmrg          /* empty path: current directory */
51586df26cacSmrg          if (getcwd (tmp, LT_PATHMAX) == NULL)
51596df26cacSmrg            lt_fatal ("getcwd failed");
51606df26cacSmrg          tmp_len = strlen(tmp);
51616df26cacSmrg          concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
51626df26cacSmrg          memcpy (concat_name, tmp, tmp_len);
51636df26cacSmrg          concat_name[tmp_len] = '/';
51646df26cacSmrg          strcpy (concat_name + tmp_len + 1, wrapper);
51656df26cacSmrg        }
51666df26cacSmrg        else
51676df26cacSmrg        {
51686df26cacSmrg          concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
51696df26cacSmrg          memcpy (concat_name, p, p_len);
51706df26cacSmrg          concat_name[p_len] = '/';
51716df26cacSmrg          strcpy (concat_name + p_len + 1, wrapper);
51726df26cacSmrg        }
51736df26cacSmrg        if (check_executable(concat_name))
51746df26cacSmrg          return concat_name;
51756df26cacSmrg        XFREE(concat_name);
51766df26cacSmrg      }
51776df26cacSmrg    }
51786df26cacSmrg    /* not found in PATH; assume curdir */
51796df26cacSmrg  }
51806df26cacSmrg  /* Relative path | not found in path: prepend cwd */
51816df26cacSmrg  if (getcwd (tmp, LT_PATHMAX) == NULL)
51826df26cacSmrg    lt_fatal ("getcwd failed");
51836df26cacSmrg  tmp_len = strlen(tmp);
51846df26cacSmrg  concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
51856df26cacSmrg  memcpy (concat_name, tmp, tmp_len);
51866df26cacSmrg  concat_name[tmp_len] = '/';
51876df26cacSmrg  strcpy (concat_name + tmp_len + 1, wrapper);
51886df26cacSmrg
51896df26cacSmrg  if (check_executable(concat_name))
51906df26cacSmrg    return concat_name;
51916df26cacSmrg  XFREE(concat_name);
51926df26cacSmrg  return NULL;
51936df26cacSmrg}
51946df26cacSmrg
51956df26cacSmrgchar *
51966df26cacSmrgstrendzap(char *str, const char *pat)
51976df26cacSmrg{
51986df26cacSmrg  size_t len, patlen;
51996df26cacSmrg
52006df26cacSmrg  assert(str != NULL);
52016df26cacSmrg  assert(pat != NULL);
52026df26cacSmrg
52036df26cacSmrg  len = strlen(str);
52046df26cacSmrg  patlen = strlen(pat);
52056df26cacSmrg
52066df26cacSmrg  if (patlen <= len)
52076df26cacSmrg  {
52086df26cacSmrg    str += len - patlen;
52096df26cacSmrg    if (strcmp(str, pat) == 0)
52106df26cacSmrg      *str = '\0';
52116df26cacSmrg  }
52126df26cacSmrg  return str;
52136df26cacSmrg}
52146df26cacSmrg
52156df26cacSmrgstatic void
52166df26cacSmrglt_error_core (int exit_status, const char * mode,
52176df26cacSmrg          const char * message, va_list ap)
52186df26cacSmrg{
52196df26cacSmrg  fprintf (stderr, "%s: %s: ", program_name, mode);
52206df26cacSmrg  vfprintf (stderr, message, ap);
52216df26cacSmrg  fprintf (stderr, ".\n");
52226df26cacSmrg
52236df26cacSmrg  if (exit_status >= 0)
52246df26cacSmrg    exit (exit_status);
52256df26cacSmrg}
52266df26cacSmrg
52276df26cacSmrgvoid
52286df26cacSmrglt_fatal (const char *message, ...)
52296df26cacSmrg{
52306df26cacSmrg  va_list ap;
52316df26cacSmrg  va_start (ap, message);
52326df26cacSmrg  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
52336df26cacSmrg  va_end (ap);
52346df26cacSmrg}
52356df26cacSmrgEOF
52366df26cacSmrg          # we should really use a build-platform specific compiler
52376df26cacSmrg          # here, but OTOH, the wrappers (shell script and this C one)
52386df26cacSmrg          # are only useful if you want to execute the "real" binary.
52396df26cacSmrg          # Since the "real" binary is built for $host, then this
52406df26cacSmrg          # wrapper might as well be built for $host, too.
52416df26cacSmrg          $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
52426df26cacSmrg          ;;
52436df26cacSmrg        esac
52446df26cacSmrg        $rm $output
52456df26cacSmrg        trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
52466df26cacSmrg
52476df26cacSmrg	$echo > $output "\
52486df26cacSmrg#! $SHELL
52496df26cacSmrg
52506df26cacSmrg# $output - temporary wrapper script for $objdir/$outputname
52516df26cacSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
52526df26cacSmrg#
52536df26cacSmrg# The $output program cannot be directly executed until all the libtool
52546df26cacSmrg# libraries that it depends on are installed.
52556df26cacSmrg#
52566df26cacSmrg# This wrapper script should never be moved out of the build directory.
52576df26cacSmrg# If it is, it will not operate correctly.
52586df26cacSmrg
52596df26cacSmrg# Sed substitution that helps us do robust quoting.  It backslashifies
52606df26cacSmrg# metacharacters that are still active within double-quoted strings.
52616df26cacSmrgXsed='${SED} -e 1s/^X//'
52626df26cacSmrgsed_quote_subst='$sed_quote_subst'
52636df26cacSmrg
52646df26cacSmrg# The HP-UX ksh and POSIX shell print the target directory to stdout
52656df26cacSmrg# if CDPATH is set.
52666df26cacSmrg(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
52676df26cacSmrg
52686df26cacSmrgrelink_command=\"$relink_command\"
52696df26cacSmrg
52706df26cacSmrg# This environment variable determines our operation mode.
52716df26cacSmrgif test \"\$libtool_install_magic\" = \"$magic\"; then
52726df26cacSmrg  # install mode needs the following variable:
52736df26cacSmrg  notinst_deplibs='$notinst_deplibs'
52746df26cacSmrgelse
52756df26cacSmrg  # When we are sourced in execute mode, \$file and \$echo are already set.
52766df26cacSmrg  if test \"\$libtool_execute_magic\" != \"$magic\"; then
52776df26cacSmrg    echo=\"$qecho\"
52786df26cacSmrg    file=\"\$0\"
52796df26cacSmrg    # Make sure echo works.
52806df26cacSmrg    if test \"X\$1\" = X--no-reexec; then
52816df26cacSmrg      # Discard the --no-reexec flag, and continue.
52826df26cacSmrg      shift
52836df26cacSmrg    elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
52846df26cacSmrg      # Yippee, \$echo works!
52856df26cacSmrg      :
52866df26cacSmrg    else
52876df26cacSmrg      # Restart under the correct shell, and then maybe \$echo will work.
52886df26cacSmrg      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
52896df26cacSmrg    fi
52906df26cacSmrg  fi\
52916df26cacSmrg"
52926df26cacSmrg	$echo >> $output "\
52936df26cacSmrg
52946df26cacSmrg  # Find the directory that this script lives in.
52956df26cacSmrg  thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
52966df26cacSmrg  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
52976df26cacSmrg
52986df26cacSmrg  # Follow symbolic links until we get to the real thisdir.
52996df26cacSmrg  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
53006df26cacSmrg  while test -n \"\$file\"; do
53016df26cacSmrg    destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
53026df26cacSmrg
53036df26cacSmrg    # If there was a directory component, then change thisdir.
53046df26cacSmrg    if test \"x\$destdir\" != \"x\$file\"; then
53056df26cacSmrg      case \"\$destdir\" in
53066df26cacSmrg      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
53076df26cacSmrg      *) thisdir=\"\$thisdir/\$destdir\" ;;
53086df26cacSmrg      esac
53096df26cacSmrg    fi
53106df26cacSmrg
53116df26cacSmrg    file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
53126df26cacSmrg    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
53136df26cacSmrg  done
53146df26cacSmrg
53156df26cacSmrg  # Try to get the absolute directory name.
53166df26cacSmrg  absdir=\`cd \"\$thisdir\" && pwd\`
53176df26cacSmrg  test -n \"\$absdir\" && thisdir=\"\$absdir\"
53186df26cacSmrg"
53196df26cacSmrg
53206df26cacSmrg	if test "$fast_install" = yes; then
53216df26cacSmrg	  $echo >> $output "\
53226df26cacSmrg  program=lt-'$outputname'$exeext
53236df26cacSmrg  progdir=\"\$thisdir/$objdir\"
53246df26cacSmrg
53256df26cacSmrg  if test ! -f \"\$progdir/\$program\" || \\
53266df26cacSmrg     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
53276df26cacSmrg       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
53286df26cacSmrg
53296df26cacSmrg    file=\"\$\$-\$program\"
53306df26cacSmrg
53316df26cacSmrg    if test ! -d \"\$progdir\"; then
53326df26cacSmrg      $mkdir \"\$progdir\"
53336df26cacSmrg    else
53346df26cacSmrg      $rm \"\$progdir/\$file\"
53356df26cacSmrg    fi"
53366df26cacSmrg
53376df26cacSmrg	  $echo >> $output "\
53386df26cacSmrg
53396df26cacSmrg    # relink executable if necessary
53406df26cacSmrg    if test -n \"\$relink_command\"; then
53416df26cacSmrg      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
53426df26cacSmrg      else
53436df26cacSmrg	$echo \"\$relink_command_output\" >&2
53446df26cacSmrg	$rm \"\$progdir/\$file\"
53456df26cacSmrg	exit $EXIT_FAILURE
53466df26cacSmrg      fi
53476df26cacSmrg    fi
53486df26cacSmrg
53496df26cacSmrg    $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
53506df26cacSmrg    { $rm \"\$progdir/\$program\";
53516df26cacSmrg      $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
53526df26cacSmrg    $rm \"\$progdir/\$file\"
53536df26cacSmrg  fi"
53546df26cacSmrg	else
53556df26cacSmrg	  $echo >> $output "\
53566df26cacSmrg  program='$outputname'
53576df26cacSmrg  progdir=\"\$thisdir/$objdir\"
53586df26cacSmrg"
53596df26cacSmrg	fi
53606df26cacSmrg
53616df26cacSmrg	$echo >> $output "\
53626df26cacSmrg
53636df26cacSmrg  if test -f \"\$progdir/\$program\"; then"
53646df26cacSmrg
53656df26cacSmrg	# Export our shlibpath_var if we have one.
53666df26cacSmrg	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
53676df26cacSmrg	  $echo >> $output "\
53686df26cacSmrg    # Add our own library path to $shlibpath_var
53696df26cacSmrg    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
53706df26cacSmrg
53716df26cacSmrg    # Some systems cannot cope with colon-terminated $shlibpath_var
53726df26cacSmrg    # The second colon is a workaround for a bug in BeOS R4 sed
53736df26cacSmrg    $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
53746df26cacSmrg
53756df26cacSmrg    export $shlibpath_var
53766df26cacSmrg"
53776df26cacSmrg	fi
53786df26cacSmrg
53796df26cacSmrg	# fixup the dll searchpath if we need to.
53806df26cacSmrg	if test -n "$dllsearchpath"; then
53816df26cacSmrg	  $echo >> $output "\
53826df26cacSmrg    # Add the dll search path components to the executable PATH
53836df26cacSmrg    PATH=$dllsearchpath:\$PATH
53846df26cacSmrg"
53856df26cacSmrg	fi
53866df26cacSmrg
53876df26cacSmrg	$echo >> $output "\
53886df26cacSmrg    if test \"\$libtool_execute_magic\" != \"$magic\"; then
53896df26cacSmrg      # Run the actual program with our arguments.
53906df26cacSmrg"
53916df26cacSmrg	case $host in
53926df26cacSmrg	# Backslashes separate directories on plain windows
53936df26cacSmrg	*-*-mingw | *-*-os2*)
53946df26cacSmrg	  $echo >> $output "\
53956df26cacSmrg      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
53966df26cacSmrg"
53976df26cacSmrg	  ;;
53986df26cacSmrg
53996df26cacSmrg	*)
54006df26cacSmrg	  $echo >> $output "\
54016df26cacSmrg      exec \"\$progdir/\$program\" \${1+\"\$@\"}
54026df26cacSmrg"
54036df26cacSmrg	  ;;
54046df26cacSmrg	esac
54056df26cacSmrg	$echo >> $output "\
54066df26cacSmrg      \$echo \"\$0: cannot exec \$program \${1+\"\$@\"}\"
54076df26cacSmrg      exit $EXIT_FAILURE
54086df26cacSmrg    fi
54096df26cacSmrg  else
54106df26cacSmrg    # The program doesn't exist.
54116df26cacSmrg    \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
54126df26cacSmrg    \$echo \"This script is just a wrapper for \$program.\" 1>&2
54136df26cacSmrg    $echo \"See the $PACKAGE documentation for more information.\" 1>&2
54146df26cacSmrg    exit $EXIT_FAILURE
54156df26cacSmrg  fi
54166df26cacSmrgfi\
54176df26cacSmrg"
54186df26cacSmrg	chmod +x $output
54196df26cacSmrg      fi
54206df26cacSmrg      exit $EXIT_SUCCESS
54216df26cacSmrg      ;;
54226df26cacSmrg    esac
54236df26cacSmrg
54246df26cacSmrg    # See if we need to build an old-fashioned archive.
54256df26cacSmrg    for oldlib in $oldlibs; do
54266df26cacSmrg
54276df26cacSmrg      if test "$build_libtool_libs" = convenience; then
54286df26cacSmrg	oldobjs="$libobjs_save"
54296df26cacSmrg	addlibs="$convenience"
54306df26cacSmrg	build_libtool_libs=no
54316df26cacSmrg      else
54326df26cacSmrg	if test "$build_libtool_libs" = module; then
54336df26cacSmrg	  oldobjs="$libobjs_save"
54346df26cacSmrg	  build_libtool_libs=no
54356df26cacSmrg	else
54366df26cacSmrg	  oldobjs="$old_deplibs $non_pic_objects"
54376df26cacSmrg	fi
54386df26cacSmrg	addlibs="$old_convenience"
54396df26cacSmrg      fi
54406df26cacSmrg
54416df26cacSmrg      if test -n "$addlibs"; then
54426df26cacSmrg	gentop="$output_objdir/${outputname}x"
54436df26cacSmrg	generated="$generated $gentop"
54446df26cacSmrg
54456df26cacSmrg	func_extract_archives $gentop $addlibs
54466df26cacSmrg	oldobjs="$oldobjs $func_extract_archives_result"
54476df26cacSmrg      fi
54486df26cacSmrg
54496df26cacSmrg      # Do each command in the archive commands.
54506df26cacSmrg      if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
54516df26cacSmrg       cmds=$old_archive_from_new_cmds
54526df26cacSmrg      else
54536df26cacSmrg	# POSIX demands no paths to be encoded in archives.  We have
54546df26cacSmrg	# to avoid creating archives with duplicate basenames if we
54556df26cacSmrg	# might have to extract them afterwards, e.g., when creating a
54566df26cacSmrg	# static archive out of a convenience library, or when linking
54576df26cacSmrg	# the entirety of a libtool archive into another (currently
54586df26cacSmrg	# not supported by libtool).
54596df26cacSmrg	if (for obj in $oldobjs
54606df26cacSmrg	    do
54616df26cacSmrg	      $echo "X$obj" | $Xsed -e 's%^.*/%%'
54626df26cacSmrg	    done | sort | sort -uc >/dev/null 2>&1); then
54636df26cacSmrg	  :
54646df26cacSmrg	else
54656df26cacSmrg	  $echo "copying selected object files to avoid basename conflicts..."
54666df26cacSmrg
54676df26cacSmrg	  if test -z "$gentop"; then
54686df26cacSmrg	    gentop="$output_objdir/${outputname}x"
54696df26cacSmrg	    generated="$generated $gentop"
54706df26cacSmrg
54716df26cacSmrg	    $show "${rm}r $gentop"
54726df26cacSmrg	    $run ${rm}r "$gentop"
54736df26cacSmrg	    $show "$mkdir $gentop"
54746df26cacSmrg	    $run $mkdir "$gentop"
54756df26cacSmrg	    exit_status=$?
54766df26cacSmrg	    if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
54776df26cacSmrg	      exit $exit_status
54786df26cacSmrg	    fi
54796df26cacSmrg	  fi
54806df26cacSmrg
54816df26cacSmrg	  save_oldobjs=$oldobjs
54826df26cacSmrg	  oldobjs=
54836df26cacSmrg	  counter=1
54846df26cacSmrg	  for obj in $save_oldobjs
54856df26cacSmrg	  do
54866df26cacSmrg	    objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
54876df26cacSmrg	    case " $oldobjs " in
54886df26cacSmrg	    " ") oldobjs=$obj ;;
54896df26cacSmrg	    *[\ /]"$objbase "*)
54906df26cacSmrg	      while :; do
54916df26cacSmrg		# Make sure we don't pick an alternate name that also
54926df26cacSmrg		# overlaps.
54936df26cacSmrg		newobj=lt$counter-$objbase
54946df26cacSmrg		counter=`expr $counter + 1`
54956df26cacSmrg		case " $oldobjs " in
54966df26cacSmrg		*[\ /]"$newobj "*) ;;
54976df26cacSmrg		*) if test ! -f "$gentop/$newobj"; then break; fi ;;
54986df26cacSmrg		esac
54996df26cacSmrg	      done
55006df26cacSmrg	      $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
55016df26cacSmrg	      $run ln "$obj" "$gentop/$newobj" ||
55026df26cacSmrg	      $run cp "$obj" "$gentop/$newobj"
55036df26cacSmrg	      oldobjs="$oldobjs $gentop/$newobj"
55046df26cacSmrg	      ;;
55056df26cacSmrg	    *) oldobjs="$oldobjs $obj" ;;
55066df26cacSmrg	    esac
55076df26cacSmrg	  done
55086df26cacSmrg	fi
55096df26cacSmrg
55106df26cacSmrg	eval cmds=\"$old_archive_cmds\"
55116df26cacSmrg
55126df26cacSmrg	if len=`expr "X$cmds" : ".*"` &&
55136df26cacSmrg	     test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
55146df26cacSmrg	  cmds=$old_archive_cmds
55156df26cacSmrg	else
55166df26cacSmrg	  # the command line is too long to link in one step, link in parts
55176df26cacSmrg	  $echo "using piecewise archive linking..."
55186df26cacSmrg	  save_RANLIB=$RANLIB
55196df26cacSmrg	  RANLIB=:
55206df26cacSmrg	  objlist=
55216df26cacSmrg	  concat_cmds=
55226df26cacSmrg	  save_oldobjs=$oldobjs
55236df26cacSmrg
55246df26cacSmrg	  # Is there a better way of finding the last object in the list?
55256df26cacSmrg	  for obj in $save_oldobjs
55266df26cacSmrg	  do
55276df26cacSmrg	    last_oldobj=$obj
55286df26cacSmrg	  done
55296df26cacSmrg	  for obj in $save_oldobjs
55306df26cacSmrg	  do
55316df26cacSmrg	    oldobjs="$objlist $obj"
55326df26cacSmrg	    objlist="$objlist $obj"
55336df26cacSmrg	    eval test_cmds=\"$old_archive_cmds\"
55346df26cacSmrg	    if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
55356df26cacSmrg	       test "$len" -le "$max_cmd_len"; then
55366df26cacSmrg	      :
55376df26cacSmrg	    else
55386df26cacSmrg	      # the above command should be used before it gets too long
55396df26cacSmrg	      oldobjs=$objlist
55406df26cacSmrg	      if test "$obj" = "$last_oldobj" ; then
55416df26cacSmrg	        RANLIB=$save_RANLIB
55426df26cacSmrg	      fi
55436df26cacSmrg	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
55446df26cacSmrg	      eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
55456df26cacSmrg	      objlist=
55466df26cacSmrg	    fi
55476df26cacSmrg	  done
55486df26cacSmrg	  RANLIB=$save_RANLIB
55496df26cacSmrg	  oldobjs=$objlist
55506df26cacSmrg	  if test "X$oldobjs" = "X" ; then
55516df26cacSmrg	    eval cmds=\"\$concat_cmds\"
55526df26cacSmrg	  else
55536df26cacSmrg	    eval cmds=\"\$concat_cmds~\$old_archive_cmds\"
55546df26cacSmrg	  fi
55556df26cacSmrg	fi
55566df26cacSmrg      fi
55576df26cacSmrg      save_ifs="$IFS"; IFS='~'
55586df26cacSmrg      for cmd in $cmds; do
55596df26cacSmrg        eval cmd=\"$cmd\"
55606df26cacSmrg	IFS="$save_ifs"
55616df26cacSmrg	$show "$cmd"
55626df26cacSmrg	$run eval "$cmd" || exit $?
55636df26cacSmrg      done
55646df26cacSmrg      IFS="$save_ifs"
55656df26cacSmrg    done
55666df26cacSmrg
55676df26cacSmrg    if test -n "$generated"; then
55686df26cacSmrg      $show "${rm}r$generated"
55696df26cacSmrg      $run ${rm}r$generated
55706df26cacSmrg    fi
55716df26cacSmrg
55726df26cacSmrg    # Now create the libtool archive.
55736df26cacSmrg    case $output in
55746df26cacSmrg    *.la)
55756df26cacSmrg      old_library=
55766df26cacSmrg      test "$build_old_libs" = yes && old_library="$libname.$libext"
55776df26cacSmrg      $show "creating $output"
55786df26cacSmrg
55796df26cacSmrg      # Preserve any variables that may affect compiler behavior
55806df26cacSmrg      for var in $variables_saved_for_relink; do
55816df26cacSmrg	if eval test -z \"\${$var+set}\"; then
55826df26cacSmrg	  relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
55836df26cacSmrg	elif eval var_value=\$$var; test -z "$var_value"; then
55846df26cacSmrg	  relink_command="$var=; export $var; $relink_command"
55856df26cacSmrg	else
55866df26cacSmrg	  var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
55876df26cacSmrg	  relink_command="$var=\"$var_value\"; export $var; $relink_command"
55886df26cacSmrg	fi
55896df26cacSmrg      done
55906df26cacSmrg      # Quote the link command for shipping.
55916df26cacSmrg      relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
55926df26cacSmrg      relink_command=`$echo "X$relink_command" | $Xsed -e "$sed_quote_subst"`
55936df26cacSmrg      if test "$hardcode_automatic" = yes ; then
55946df26cacSmrg	relink_command=
55956df26cacSmrg      fi
55966df26cacSmrg
55976df26cacSmrg
55986df26cacSmrg      # Only create the output if not a dry run.
55996df26cacSmrg      if test -z "$run"; then
56006df26cacSmrg	for installed in no yes; do
56016df26cacSmrg	  if test "$installed" = yes; then
56026df26cacSmrg	    if test -z "$install_libdir"; then
56036df26cacSmrg	      break
56046df26cacSmrg	    fi
56056df26cacSmrg	    output="$output_objdir/$outputname"i
56066df26cacSmrg	    # Replace all uninstalled libtool libraries with the installed ones
56076df26cacSmrg	    newdependency_libs=
56086df26cacSmrg	    for deplib in $dependency_libs; do
56096df26cacSmrg	      case $deplib in
56106df26cacSmrg	      *.la)
56116df26cacSmrg		name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
56126df26cacSmrg		eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
56136df26cacSmrg		if test -z "$libdir"; then
56146df26cacSmrg		  $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
56156df26cacSmrg		  exit $EXIT_FAILURE
56166df26cacSmrg		fi
56176df26cacSmrg		newdependency_libs="$newdependency_libs $libdir/$name"
56186df26cacSmrg		;;
56196df26cacSmrg	      *) newdependency_libs="$newdependency_libs $deplib" ;;
56206df26cacSmrg	      esac
56216df26cacSmrg	    done
56226df26cacSmrg	    dependency_libs="$newdependency_libs"
56236df26cacSmrg	    newdlfiles=
56246df26cacSmrg	    for lib in $dlfiles; do
56256df26cacSmrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
56266df26cacSmrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
56276df26cacSmrg	      if test -z "$libdir"; then
56286df26cacSmrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
56296df26cacSmrg		exit $EXIT_FAILURE
56306df26cacSmrg	      fi
56316df26cacSmrg	      newdlfiles="$newdlfiles $libdir/$name"
56326df26cacSmrg	    done
56336df26cacSmrg	    dlfiles="$newdlfiles"
56346df26cacSmrg	    newdlprefiles=
56356df26cacSmrg	    for lib in $dlprefiles; do
56366df26cacSmrg	      name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
56376df26cacSmrg	      eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
56386df26cacSmrg	      if test -z "$libdir"; then
56396df26cacSmrg		$echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
56406df26cacSmrg		exit $EXIT_FAILURE
56416df26cacSmrg	      fi
56426df26cacSmrg	      newdlprefiles="$newdlprefiles $libdir/$name"
56436df26cacSmrg	    done
56446df26cacSmrg	    dlprefiles="$newdlprefiles"
56456df26cacSmrg	  else
56466df26cacSmrg	    newdlfiles=
56476df26cacSmrg	    for lib in $dlfiles; do
56486df26cacSmrg	      case $lib in
56496df26cacSmrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
56506df26cacSmrg		*) abs=`pwd`"/$lib" ;;
56516df26cacSmrg	      esac
56526df26cacSmrg	      newdlfiles="$newdlfiles $abs"
56536df26cacSmrg	    done
56546df26cacSmrg	    dlfiles="$newdlfiles"
56556df26cacSmrg	    newdlprefiles=
56566df26cacSmrg	    for lib in $dlprefiles; do
56576df26cacSmrg	      case $lib in
56586df26cacSmrg		[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
56596df26cacSmrg		*) abs=`pwd`"/$lib" ;;
56606df26cacSmrg	      esac
56616df26cacSmrg	      newdlprefiles="$newdlprefiles $abs"
56626df26cacSmrg	    done
56636df26cacSmrg	    dlprefiles="$newdlprefiles"
56646df26cacSmrg	  fi
56656df26cacSmrg	  $rm $output
56666df26cacSmrg	  # place dlname in correct position for cygwin
56676df26cacSmrg	  tdlname=$dlname
56686df26cacSmrg	  case $host,$output,$installed,$module,$dlname in
56696df26cacSmrg	    *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
56706df26cacSmrg	  esac
56716df26cacSmrg	  $echo > $output "\
56726df26cacSmrg# $outputname - a libtool library file
56736df26cacSmrg# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
56746df26cacSmrg#
56756df26cacSmrg# Please DO NOT delete this file!
56766df26cacSmrg# It is necessary for linking the library.
56776df26cacSmrg
56786df26cacSmrg# The name that we can dlopen(3).
56796df26cacSmrgdlname='$tdlname'
56806df26cacSmrg
56816df26cacSmrg# Names of this library.
56826df26cacSmrglibrary_names='$library_names'
56836df26cacSmrg
56846df26cacSmrg# The name of the static archive.
56856df26cacSmrgold_library='$old_library'
56866df26cacSmrg
56876df26cacSmrg# Libraries that this one depends upon.
56886df26cacSmrgdependency_libs='$dependency_libs'
56896df26cacSmrg
56906df26cacSmrg# Version information for $libname.
56916df26cacSmrgcurrent=$current
56926df26cacSmrgage=$age
56936df26cacSmrgrevision=$revision
56946df26cacSmrg
56956df26cacSmrg# Is this an already installed library?
56966df26cacSmrginstalled=$installed
56976df26cacSmrg
56986df26cacSmrg# Should we warn about portability when linking against -modules?
56996df26cacSmrgshouldnotlink=$module
57006df26cacSmrg
57016df26cacSmrg# Files to dlopen/dlpreopen
57026df26cacSmrgdlopen='$dlfiles'
57036df26cacSmrgdlpreopen='$dlprefiles'
57046df26cacSmrg
57056df26cacSmrg# Directory that this library needs to be installed in:
57066df26cacSmrglibdir='$install_libdir'"
57076df26cacSmrg	  if test "$installed" = no && test "$need_relink" = yes; then
57086df26cacSmrg	    $echo >> $output "\
57096df26cacSmrgrelink_command=\"$relink_command\""
57106df26cacSmrg	  fi
57116df26cacSmrg	done
57126df26cacSmrg      fi
57136df26cacSmrg
57146df26cacSmrg      # Do a symbolic link so that the libtool archive can be found in
57156df26cacSmrg      # LD_LIBRARY_PATH before the program is installed.
57166df26cacSmrg      $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
57176df26cacSmrg      $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
57186df26cacSmrg      ;;
57196df26cacSmrg    esac
57206df26cacSmrg    exit $EXIT_SUCCESS
57216df26cacSmrg    ;;
57226df26cacSmrg
57236df26cacSmrg  # libtool install mode
57246df26cacSmrg  install)
57256df26cacSmrg    modename="$modename: install"
57266df26cacSmrg
57276df26cacSmrg    # There may be an optional sh(1) argument at the beginning of
57286df26cacSmrg    # install_prog (especially on Windows NT).
57296df26cacSmrg    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
57306df26cacSmrg       # Allow the use of GNU shtool's install command.
57316df26cacSmrg       $echo "X$nonopt" | grep shtool > /dev/null; then
57326df26cacSmrg      # Aesthetically quote it.
57336df26cacSmrg      arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
57346df26cacSmrg      case $arg in
57356df26cacSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
57366df26cacSmrg	arg="\"$arg\""
57376df26cacSmrg	;;
57386df26cacSmrg      esac
57396df26cacSmrg      install_prog="$arg "
57406df26cacSmrg      arg="$1"
57416df26cacSmrg      shift
57426df26cacSmrg    else
57436df26cacSmrg      install_prog=
57446df26cacSmrg      arg=$nonopt
57456df26cacSmrg    fi
57466df26cacSmrg
57476df26cacSmrg    # The real first argument should be the name of the installation program.
57486df26cacSmrg    # Aesthetically quote it.
57496df26cacSmrg    arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
57506df26cacSmrg    case $arg in
57516df26cacSmrg    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
57526df26cacSmrg      arg="\"$arg\""
57536df26cacSmrg      ;;
57546df26cacSmrg    esac
57556df26cacSmrg    install_prog="$install_prog$arg"
57566df26cacSmrg
57576df26cacSmrg    # We need to accept at least all the BSD install flags.
57586df26cacSmrg    dest=
57596df26cacSmrg    files=
57606df26cacSmrg    opts=
57616df26cacSmrg    prev=
57626df26cacSmrg    install_type=
57636df26cacSmrg    isdir=no
57646df26cacSmrg    stripme=
57656df26cacSmrg    for arg
57666df26cacSmrg    do
57676df26cacSmrg      if test -n "$dest"; then
57686df26cacSmrg	files="$files $dest"
57696df26cacSmrg	dest=$arg
57706df26cacSmrg	continue
57716df26cacSmrg      fi
57726df26cacSmrg
57736df26cacSmrg      case $arg in
57746df26cacSmrg      -d) isdir=yes ;;
57756df26cacSmrg      -f) 
57766df26cacSmrg      	case " $install_prog " in
57776df26cacSmrg	*[\\\ /]cp\ *) ;;
57786df26cacSmrg	*) prev=$arg ;;
57796df26cacSmrg	esac
57806df26cacSmrg	;;
57816df26cacSmrg      -g | -m | -o) prev=$arg ;;
57826df26cacSmrg      -s)
57836df26cacSmrg	stripme=" -s"
57846df26cacSmrg	continue
57856df26cacSmrg	;;
57866df26cacSmrg      -*)
57876df26cacSmrg	;;
57886df26cacSmrg      *)
57896df26cacSmrg	# If the previous option needed an argument, then skip it.
57906df26cacSmrg	if test -n "$prev"; then
57916df26cacSmrg	  prev=
57926df26cacSmrg	else
57936df26cacSmrg	  dest=$arg
57946df26cacSmrg	  continue
57956df26cacSmrg	fi
57966df26cacSmrg	;;
57976df26cacSmrg      esac
57986df26cacSmrg
57996df26cacSmrg      # Aesthetically quote the argument.
58006df26cacSmrg      arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
58016df26cacSmrg      case $arg in
58026df26cacSmrg      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
58036df26cacSmrg	arg="\"$arg\""
58046df26cacSmrg	;;
58056df26cacSmrg      esac
58066df26cacSmrg      install_prog="$install_prog $arg"
58076df26cacSmrg    done
58086df26cacSmrg
58096df26cacSmrg    if test -z "$install_prog"; then
58106df26cacSmrg      $echo "$modename: you must specify an install program" 1>&2
58116df26cacSmrg      $echo "$help" 1>&2
58126df26cacSmrg      exit $EXIT_FAILURE
58136df26cacSmrg    fi
58146df26cacSmrg
58156df26cacSmrg    if test -n "$prev"; then
58166df26cacSmrg      $echo "$modename: the \`$prev' option requires an argument" 1>&2
58176df26cacSmrg      $echo "$help" 1>&2
58186df26cacSmrg      exit $EXIT_FAILURE
58196df26cacSmrg    fi
58206df26cacSmrg
58216df26cacSmrg    if test -z "$files"; then
58226df26cacSmrg      if test -z "$dest"; then
58236df26cacSmrg	$echo "$modename: no file or destination specified" 1>&2
58246df26cacSmrg      else
58256df26cacSmrg	$echo "$modename: you must specify a destination" 1>&2
58266df26cacSmrg      fi
58276df26cacSmrg      $echo "$help" 1>&2
58286df26cacSmrg      exit $EXIT_FAILURE
58296df26cacSmrg    fi
58306df26cacSmrg
58316df26cacSmrg    # Strip any trailing slash from the destination.
58326df26cacSmrg    dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
58336df26cacSmrg
58346df26cacSmrg    # Check to see that the destination is a directory.
58356df26cacSmrg    test -d "$dest" && isdir=yes
58366df26cacSmrg    if test "$isdir" = yes; then
58376df26cacSmrg      destdir="$dest"
58386df26cacSmrg      destname=
58396df26cacSmrg    else
58406df26cacSmrg      destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
58416df26cacSmrg      test "X$destdir" = "X$dest" && destdir=.
58426df26cacSmrg      destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
58436df26cacSmrg
58446df26cacSmrg      # Not a directory, so check to see that there is only one file specified.
58456df26cacSmrg      set dummy $files
58466df26cacSmrg      if test "$#" -gt 2; then
58476df26cacSmrg	$echo "$modename: \`$dest' is not a directory" 1>&2
58486df26cacSmrg	$echo "$help" 1>&2
58496df26cacSmrg	exit $EXIT_FAILURE
58506df26cacSmrg      fi
58516df26cacSmrg    fi
58526df26cacSmrg    case $destdir in
58536df26cacSmrg    [\\/]* | [A-Za-z]:[\\/]*) ;;
58546df26cacSmrg    *)
58556df26cacSmrg      for file in $files; do
58566df26cacSmrg	case $file in
58576df26cacSmrg	*.lo) ;;
58586df26cacSmrg	*)
58596df26cacSmrg	  $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
58606df26cacSmrg	  $echo "$help" 1>&2
58616df26cacSmrg	  exit $EXIT_FAILURE
58626df26cacSmrg	  ;;
58636df26cacSmrg	esac
58646df26cacSmrg      done
58656df26cacSmrg      ;;
58666df26cacSmrg    esac
58676df26cacSmrg
58686df26cacSmrg    # This variable tells wrapper scripts just to set variables rather
58696df26cacSmrg    # than running their programs.
58706df26cacSmrg    libtool_install_magic="$magic"
58716df26cacSmrg
58726df26cacSmrg    staticlibs=
58736df26cacSmrg    future_libdirs=
58746df26cacSmrg    current_libdirs=
58756df26cacSmrg    for file in $files; do
58766df26cacSmrg
58776df26cacSmrg      # Do each installation.
58786df26cacSmrg      case $file in
58796df26cacSmrg      *.$libext)
58806df26cacSmrg	# Do the static libraries later.
58816df26cacSmrg	staticlibs="$staticlibs $file"
58826df26cacSmrg	;;
58836df26cacSmrg
58846df26cacSmrg      *.la)
58856df26cacSmrg	# Check to see that this really is a libtool archive.
58866df26cacSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
58876df26cacSmrg	else
58886df26cacSmrg	  $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
58896df26cacSmrg	  $echo "$help" 1>&2
58906df26cacSmrg	  exit $EXIT_FAILURE
58916df26cacSmrg	fi
58926df26cacSmrg
58936df26cacSmrg	library_names=
58946df26cacSmrg	old_library=
58956df26cacSmrg	relink_command=
58966df26cacSmrg	# If there is no directory component, then add one.
58976df26cacSmrg	case $file in
58986df26cacSmrg	*/* | *\\*) . $file ;;
58996df26cacSmrg	*) . ./$file ;;
59006df26cacSmrg	esac
59016df26cacSmrg
59026df26cacSmrg	# Add the libdir to current_libdirs if it is the destination.
59036df26cacSmrg	if test "X$destdir" = "X$libdir"; then
59046df26cacSmrg	  case "$current_libdirs " in
59056df26cacSmrg	  *" $libdir "*) ;;
59066df26cacSmrg	  *) current_libdirs="$current_libdirs $libdir" ;;
59076df26cacSmrg	  esac
59086df26cacSmrg	else
59096df26cacSmrg	  # Note the libdir as a future libdir.
59106df26cacSmrg	  case "$future_libdirs " in
59116df26cacSmrg	  *" $libdir "*) ;;
59126df26cacSmrg	  *) future_libdirs="$future_libdirs $libdir" ;;
59136df26cacSmrg	  esac
59146df26cacSmrg	fi
59156df26cacSmrg
59166df26cacSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
59176df26cacSmrg	test "X$dir" = "X$file/" && dir=
59186df26cacSmrg	dir="$dir$objdir"
59196df26cacSmrg
59206df26cacSmrg	if test -n "$relink_command"; then
59216df26cacSmrg	  # Determine the prefix the user has applied to our future dir.
59226df26cacSmrg	  inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
59236df26cacSmrg
59246df26cacSmrg	  # Don't allow the user to place us outside of our expected
59256df26cacSmrg	  # location b/c this prevents finding dependent libraries that
59266df26cacSmrg	  # are installed to the same prefix.
59276df26cacSmrg	  # At present, this check doesn't affect windows .dll's that
59286df26cacSmrg	  # are installed into $libdir/../bin (currently, that works fine)
59296df26cacSmrg	  # but it's something to keep an eye on.
59306df26cacSmrg	  if test "$inst_prefix_dir" = "$destdir"; then
59316df26cacSmrg	    $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
59326df26cacSmrg	    exit $EXIT_FAILURE
59336df26cacSmrg	  fi
59346df26cacSmrg
59356df26cacSmrg	  if test -n "$inst_prefix_dir"; then
59366df26cacSmrg	    # Stick the inst_prefix_dir data into the link command.
59376df26cacSmrg	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
59386df26cacSmrg	  else
59396df26cacSmrg	    relink_command=`$echo "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
59406df26cacSmrg	  fi
59416df26cacSmrg
59426df26cacSmrg	  $echo "$modename: warning: relinking \`$file'" 1>&2
59436df26cacSmrg	  $show "$relink_command"
59446df26cacSmrg	  if $run eval "$relink_command"; then :
59456df26cacSmrg	  else
59466df26cacSmrg	    $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
59476df26cacSmrg	    exit $EXIT_FAILURE
59486df26cacSmrg	  fi
59496df26cacSmrg	fi
59506df26cacSmrg
59516df26cacSmrg	# See the names of the shared library.
59526df26cacSmrg	set dummy $library_names
59536df26cacSmrg	if test -n "$2"; then
59546df26cacSmrg	  realname="$2"
59556df26cacSmrg	  shift
59566df26cacSmrg	  shift
59576df26cacSmrg
59586df26cacSmrg	  srcname="$realname"
59596df26cacSmrg	  test -n "$relink_command" && srcname="$realname"T
59606df26cacSmrg
59616df26cacSmrg	  # Install the shared library and build the symlinks.
59626df26cacSmrg	  $show "$install_prog $dir/$srcname $destdir/$realname"
59636df26cacSmrg	  $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
59646df26cacSmrg	  if test -n "$stripme" && test -n "$striplib"; then
59656df26cacSmrg	    $show "$striplib $destdir/$realname"
59666df26cacSmrg	    $run eval "$striplib $destdir/$realname" || exit $?
59676df26cacSmrg	  fi
59686df26cacSmrg
59696df26cacSmrg	  if test "$#" -gt 0; then
59706df26cacSmrg	    # Delete the old symlinks, and create new ones.
59716df26cacSmrg	    # Try `ln -sf' first, because the `ln' binary might depend on
59726df26cacSmrg	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
59736df26cacSmrg	    # so we also need to try rm && ln -s.
59746df26cacSmrg	    for linkname
59756df26cacSmrg	    do
59766df26cacSmrg	      if test "$linkname" != "$realname"; then
59776df26cacSmrg                $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
59786df26cacSmrg                $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
59796df26cacSmrg	      fi
59806df26cacSmrg	    done
59816df26cacSmrg	  fi
59826df26cacSmrg
59836df26cacSmrg	  # Do each command in the postinstall commands.
59846df26cacSmrg	  lib="$destdir/$realname"
59856df26cacSmrg	  cmds=$postinstall_cmds
59866df26cacSmrg	  save_ifs="$IFS"; IFS='~'
59876df26cacSmrg	  for cmd in $cmds; do
59886df26cacSmrg	    IFS="$save_ifs"
59896df26cacSmrg	    eval cmd=\"$cmd\"
59906df26cacSmrg	    $show "$cmd"
59916df26cacSmrg	    $run eval "$cmd" || {
59926df26cacSmrg	      lt_exit=$?
59936df26cacSmrg
59946df26cacSmrg	      # Restore the uninstalled library and exit
59956df26cacSmrg	      if test "$mode" = relink; then
59966df26cacSmrg		$run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
59976df26cacSmrg	      fi
59986df26cacSmrg
59996df26cacSmrg	      exit $lt_exit
60006df26cacSmrg	    }
60016df26cacSmrg	  done
60026df26cacSmrg	  IFS="$save_ifs"
60036df26cacSmrg	fi
60046df26cacSmrg
60056df26cacSmrg	# Install the pseudo-library for information purposes.
60066df26cacSmrg	name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
60076df26cacSmrg	instname="$dir/$name"i
60086df26cacSmrg	$show "$install_prog $instname $destdir/$name"
60096df26cacSmrg	$run eval "$install_prog $instname $destdir/$name" || exit $?
60106df26cacSmrg
60116df26cacSmrg	# Maybe install the static library, too.
60126df26cacSmrg	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
60136df26cacSmrg	;;
60146df26cacSmrg
60156df26cacSmrg      *.lo)
60166df26cacSmrg	# Install (i.e. copy) a libtool object.
60176df26cacSmrg
60186df26cacSmrg	# Figure out destination file name, if it wasn't already specified.
60196df26cacSmrg	if test -n "$destname"; then
60206df26cacSmrg	  destfile="$destdir/$destname"
60216df26cacSmrg	else
60226df26cacSmrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
60236df26cacSmrg	  destfile="$destdir/$destfile"
60246df26cacSmrg	fi
60256df26cacSmrg
60266df26cacSmrg	# Deduce the name of the destination old-style object file.
60276df26cacSmrg	case $destfile in
60286df26cacSmrg	*.lo)
60296df26cacSmrg	  staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
60306df26cacSmrg	  ;;
60316df26cacSmrg	*.$objext)
60326df26cacSmrg	  staticdest="$destfile"
60336df26cacSmrg	  destfile=
60346df26cacSmrg	  ;;
60356df26cacSmrg	*)
60366df26cacSmrg	  $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
60376df26cacSmrg	  $echo "$help" 1>&2
60386df26cacSmrg	  exit $EXIT_FAILURE
60396df26cacSmrg	  ;;
60406df26cacSmrg	esac
60416df26cacSmrg
60426df26cacSmrg	# Install the libtool object if requested.
60436df26cacSmrg	if test -n "$destfile"; then
60446df26cacSmrg	  $show "$install_prog $file $destfile"
60456df26cacSmrg	  $run eval "$install_prog $file $destfile" || exit $?
60466df26cacSmrg	fi
60476df26cacSmrg
60486df26cacSmrg	# Install the old object if enabled.
60496df26cacSmrg	if test "$build_old_libs" = yes; then
60506df26cacSmrg	  # Deduce the name of the old-style object file.
60516df26cacSmrg	  staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
60526df26cacSmrg
60536df26cacSmrg	  $show "$install_prog $staticobj $staticdest"
60546df26cacSmrg	  $run eval "$install_prog \$staticobj \$staticdest" || exit $?
60556df26cacSmrg	fi
60566df26cacSmrg	exit $EXIT_SUCCESS
60576df26cacSmrg	;;
60586df26cacSmrg
60596df26cacSmrg      *)
60606df26cacSmrg	# Figure out destination file name, if it wasn't already specified.
60616df26cacSmrg	if test -n "$destname"; then
60626df26cacSmrg	  destfile="$destdir/$destname"
60636df26cacSmrg	else
60646df26cacSmrg	  destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
60656df26cacSmrg	  destfile="$destdir/$destfile"
60666df26cacSmrg	fi
60676df26cacSmrg
60686df26cacSmrg	# If the file is missing, and there is a .exe on the end, strip it
60696df26cacSmrg	# because it is most likely a libtool script we actually want to
60706df26cacSmrg	# install
60716df26cacSmrg	stripped_ext=""
60726df26cacSmrg	case $file in
60736df26cacSmrg	  *.exe)
60746df26cacSmrg	    if test ! -f "$file"; then
60756df26cacSmrg	      file=`$echo $file|${SED} 's,.exe$,,'`
60766df26cacSmrg	      stripped_ext=".exe"
60776df26cacSmrg	    fi
60786df26cacSmrg	    ;;
60796df26cacSmrg	esac
60806df26cacSmrg
60816df26cacSmrg	# Do a test to see if this is really a libtool program.
60826df26cacSmrg	case $host in
60836df26cacSmrg	*cygwin*|*mingw*)
60846df26cacSmrg	    wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
60856df26cacSmrg	    ;;
60866df26cacSmrg	*)
60876df26cacSmrg	    wrapper=$file
60886df26cacSmrg	    ;;
60896df26cacSmrg	esac
60906df26cacSmrg	if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
60916df26cacSmrg	  notinst_deplibs=
60926df26cacSmrg	  relink_command=
60936df26cacSmrg
60946df26cacSmrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
60956df26cacSmrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
60966df26cacSmrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
60976df26cacSmrg	  # `FILE.' does not work on cygwin managed mounts.
60986df26cacSmrg	  #
60996df26cacSmrg	  # If there is no directory component, then add one.
61006df26cacSmrg	  case $wrapper in
61016df26cacSmrg	  */* | *\\*) . ${wrapper} ;;
61026df26cacSmrg	  *) . ./${wrapper} ;;
61036df26cacSmrg	  esac
61046df26cacSmrg
61056df26cacSmrg	  # Check the variables that should have been set.
61066df26cacSmrg	  if test -z "$notinst_deplibs"; then
61076df26cacSmrg	    $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
61086df26cacSmrg	    exit $EXIT_FAILURE
61096df26cacSmrg	  fi
61106df26cacSmrg
61116df26cacSmrg	  finalize=yes
61126df26cacSmrg	  for lib in $notinst_deplibs; do
61136df26cacSmrg	    # Check to see that each library is installed.
61146df26cacSmrg	    libdir=
61156df26cacSmrg	    if test -f "$lib"; then
61166df26cacSmrg	      # If there is no directory component, then add one.
61176df26cacSmrg	      case $lib in
61186df26cacSmrg	      */* | *\\*) . $lib ;;
61196df26cacSmrg	      *) . ./$lib ;;
61206df26cacSmrg	      esac
61216df26cacSmrg	    fi
61226df26cacSmrg	    libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
61236df26cacSmrg	    if test -n "$libdir" && test ! -f "$libfile"; then
61246df26cacSmrg	      $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
61256df26cacSmrg	      finalize=no
61266df26cacSmrg	    fi
61276df26cacSmrg	  done
61286df26cacSmrg
61296df26cacSmrg	  relink_command=
61306df26cacSmrg	  # Note that it is not necessary on cygwin/mingw to append a dot to
61316df26cacSmrg	  # foo even if both foo and FILE.exe exist: automatic-append-.exe
61326df26cacSmrg	  # behavior happens only for exec(3), not for open(2)!  Also, sourcing
61336df26cacSmrg	  # `FILE.' does not work on cygwin managed mounts.
61346df26cacSmrg	  #
61356df26cacSmrg	  # If there is no directory component, then add one.
61366df26cacSmrg	  case $wrapper in
61376df26cacSmrg	  */* | *\\*) . ${wrapper} ;;
61386df26cacSmrg	  *) . ./${wrapper} ;;
61396df26cacSmrg	  esac
61406df26cacSmrg
61416df26cacSmrg	  outputname=
61426df26cacSmrg	  if test "$fast_install" = no && test -n "$relink_command"; then
61436df26cacSmrg	    if test "$finalize" = yes && test -z "$run"; then
61446df26cacSmrg	      tmpdir=`func_mktempdir`
61456df26cacSmrg	      file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
61466df26cacSmrg	      outputname="$tmpdir/$file"
61476df26cacSmrg	      # Replace the output file specification.
61486df26cacSmrg	      relink_command=`$echo "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
61496df26cacSmrg
61506df26cacSmrg	      $show "$relink_command"
61516df26cacSmrg	      if $run eval "$relink_command"; then :
61526df26cacSmrg	      else
61536df26cacSmrg		$echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
61546df26cacSmrg		${rm}r "$tmpdir"
61556df26cacSmrg		continue
61566df26cacSmrg	      fi
61576df26cacSmrg	      file="$outputname"
61586df26cacSmrg	    else
61596df26cacSmrg	      $echo "$modename: warning: cannot relink \`$file'" 1>&2
61606df26cacSmrg	    fi
61616df26cacSmrg	  else
61626df26cacSmrg	    # Install the binary that we compiled earlier.
61636df26cacSmrg	    file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
61646df26cacSmrg	  fi
61656df26cacSmrg	fi
61666df26cacSmrg
61676df26cacSmrg	# remove .exe since cygwin /usr/bin/install will append another
61686df26cacSmrg	# one anyway 
61696df26cacSmrg	case $install_prog,$host in
61706df26cacSmrg	*/usr/bin/install*,*cygwin*)
61716df26cacSmrg	  case $file:$destfile in
61726df26cacSmrg	  *.exe:*.exe)
61736df26cacSmrg	    # this is ok
61746df26cacSmrg	    ;;
61756df26cacSmrg	  *.exe:*)
61766df26cacSmrg	    destfile=$destfile.exe
61776df26cacSmrg	    ;;
61786df26cacSmrg	  *:*.exe)
61796df26cacSmrg	    destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
61806df26cacSmrg	    ;;
61816df26cacSmrg	  esac
61826df26cacSmrg	  ;;
61836df26cacSmrg	esac
61846df26cacSmrg	$show "$install_prog$stripme $file $destfile"
61856df26cacSmrg	$run eval "$install_prog\$stripme \$file \$destfile" || exit $?
61866df26cacSmrg	test -n "$outputname" && ${rm}r "$tmpdir"
61876df26cacSmrg	;;
61886df26cacSmrg      esac
61896df26cacSmrg    done
61906df26cacSmrg
61916df26cacSmrg    for file in $staticlibs; do
61926df26cacSmrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
61936df26cacSmrg
61946df26cacSmrg      # Set up the ranlib parameters.
61956df26cacSmrg      oldlib="$destdir/$name"
61966df26cacSmrg
61976df26cacSmrg      $show "$install_prog $file $oldlib"
61986df26cacSmrg      $run eval "$install_prog \$file \$oldlib" || exit $?
61996df26cacSmrg
62006df26cacSmrg      if test -n "$stripme" && test -n "$old_striplib"; then
62016df26cacSmrg	$show "$old_striplib $oldlib"
62026df26cacSmrg	$run eval "$old_striplib $oldlib" || exit $?
62036df26cacSmrg      fi
62046df26cacSmrg
62056df26cacSmrg      # Do each command in the postinstall commands.
62066df26cacSmrg      cmds=$old_postinstall_cmds
62076df26cacSmrg      save_ifs="$IFS"; IFS='~'
62086df26cacSmrg      for cmd in $cmds; do
62096df26cacSmrg	IFS="$save_ifs"
62106df26cacSmrg	eval cmd=\"$cmd\"
62116df26cacSmrg	$show "$cmd"
62126df26cacSmrg	$run eval "$cmd" || exit $?
62136df26cacSmrg      done
62146df26cacSmrg      IFS="$save_ifs"
62156df26cacSmrg    done
62166df26cacSmrg
62176df26cacSmrg    if test -n "$future_libdirs"; then
62186df26cacSmrg      $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
62196df26cacSmrg    fi
62206df26cacSmrg
62216df26cacSmrg    if test -n "$current_libdirs"; then
62226df26cacSmrg      # Maybe just do a dry run.
62236df26cacSmrg      test -n "$run" && current_libdirs=" -n$current_libdirs"
62246df26cacSmrg      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
62256df26cacSmrg    else
62266df26cacSmrg      exit $EXIT_SUCCESS
62276df26cacSmrg    fi
62286df26cacSmrg    ;;
62296df26cacSmrg
62306df26cacSmrg  # libtool finish mode
62316df26cacSmrg  finish)
62326df26cacSmrg    modename="$modename: finish"
62336df26cacSmrg    libdirs="$nonopt"
62346df26cacSmrg    admincmds=
62356df26cacSmrg
62366df26cacSmrg    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
62376df26cacSmrg      for dir
62386df26cacSmrg      do
62396df26cacSmrg	libdirs="$libdirs $dir"
62406df26cacSmrg      done
62416df26cacSmrg
62426df26cacSmrg      for libdir in $libdirs; do
62436df26cacSmrg	if test -n "$finish_cmds"; then
62446df26cacSmrg	  # Do each command in the finish commands.
62456df26cacSmrg	  cmds=$finish_cmds
62466df26cacSmrg	  save_ifs="$IFS"; IFS='~'
62476df26cacSmrg	  for cmd in $cmds; do
62486df26cacSmrg	    IFS="$save_ifs"
62496df26cacSmrg	    eval cmd=\"$cmd\"
62506df26cacSmrg	    $show "$cmd"
62516df26cacSmrg	    $run eval "$cmd" || admincmds="$admincmds
62526df26cacSmrg       $cmd"
62536df26cacSmrg	  done
62546df26cacSmrg	  IFS="$save_ifs"
62556df26cacSmrg	fi
62566df26cacSmrg	if test -n "$finish_eval"; then
62576df26cacSmrg	  # Do the single finish_eval.
62586df26cacSmrg	  eval cmds=\"$finish_eval\"
62596df26cacSmrg	  $run eval "$cmds" || admincmds="$admincmds
62606df26cacSmrg       $cmds"
62616df26cacSmrg	fi
62626df26cacSmrg      done
62636df26cacSmrg    fi
62646df26cacSmrg
62656df26cacSmrg    # Exit here if they wanted silent mode.
62666df26cacSmrg    test "$show" = : && exit $EXIT_SUCCESS
62676df26cacSmrg
62686df26cacSmrg    $echo "X----------------------------------------------------------------------" | $Xsed
62696df26cacSmrg    $echo "Libraries have been installed in:"
62706df26cacSmrg    for libdir in $libdirs; do
62716df26cacSmrg      $echo "   $libdir"
62726df26cacSmrg    done
62736df26cacSmrg    $echo
62746df26cacSmrg    $echo "If you ever happen to want to link against installed libraries"
62756df26cacSmrg    $echo "in a given directory, LIBDIR, you must either use libtool, and"
62766df26cacSmrg    $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
62776df26cacSmrg    $echo "flag during linking and do at least one of the following:"
62786df26cacSmrg    if test -n "$shlibpath_var"; then
62796df26cacSmrg      $echo "   - add LIBDIR to the \`$shlibpath_var' environment variable"
62806df26cacSmrg      $echo "     during execution"
62816df26cacSmrg    fi
62826df26cacSmrg    if test -n "$runpath_var"; then
62836df26cacSmrg      $echo "   - add LIBDIR to the \`$runpath_var' environment variable"
62846df26cacSmrg      $echo "     during linking"
62856df26cacSmrg    fi
62866df26cacSmrg    if test -n "$hardcode_libdir_flag_spec"; then
62876df26cacSmrg      libdir=LIBDIR
62886df26cacSmrg      eval flag=\"$hardcode_libdir_flag_spec\"
62896df26cacSmrg
62906df26cacSmrg      $echo "   - use the \`$flag' linker flag"
62916df26cacSmrg    fi
62926df26cacSmrg    if test -n "$admincmds"; then
62936df26cacSmrg      $echo "   - have your system administrator run these commands:$admincmds"
62946df26cacSmrg    fi
62956df26cacSmrg    if test -f /etc/ld.so.conf; then
62966df26cacSmrg      $echo "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
62976df26cacSmrg    fi
62986df26cacSmrg    $echo
62996df26cacSmrg    $echo "See any operating system documentation about shared libraries for"
63006df26cacSmrg    $echo "more information, such as the ld(1) and ld.so(8) manual pages."
63016df26cacSmrg    $echo "X----------------------------------------------------------------------" | $Xsed
63026df26cacSmrg    exit $EXIT_SUCCESS
63036df26cacSmrg    ;;
63046df26cacSmrg
63056df26cacSmrg  # libtool execute mode
63066df26cacSmrg  execute)
63076df26cacSmrg    modename="$modename: execute"
63086df26cacSmrg
63096df26cacSmrg    # The first argument is the command name.
63106df26cacSmrg    cmd="$nonopt"
63116df26cacSmrg    if test -z "$cmd"; then
63126df26cacSmrg      $echo "$modename: you must specify a COMMAND" 1>&2
63136df26cacSmrg      $echo "$help"
63146df26cacSmrg      exit $EXIT_FAILURE
63156df26cacSmrg    fi
63166df26cacSmrg
63176df26cacSmrg    # Handle -dlopen flags immediately.
63186df26cacSmrg    for file in $execute_dlfiles; do
63196df26cacSmrg      if test ! -f "$file"; then
63206df26cacSmrg	$echo "$modename: \`$file' is not a file" 1>&2
63216df26cacSmrg	$echo "$help" 1>&2
63226df26cacSmrg	exit $EXIT_FAILURE
63236df26cacSmrg      fi
63246df26cacSmrg
63256df26cacSmrg      dir=
63266df26cacSmrg      case $file in
63276df26cacSmrg      *.la)
63286df26cacSmrg	# Check to see that this really is a libtool archive.
63296df26cacSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
63306df26cacSmrg	else
63316df26cacSmrg	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
63326df26cacSmrg	  $echo "$help" 1>&2
63336df26cacSmrg	  exit $EXIT_FAILURE
63346df26cacSmrg	fi
63356df26cacSmrg
63366df26cacSmrg	# Read the libtool library.
63376df26cacSmrg	dlname=
63386df26cacSmrg	library_names=
63396df26cacSmrg
63406df26cacSmrg	# If there is no directory component, then add one.
63416df26cacSmrg	case $file in
63426df26cacSmrg	*/* | *\\*) . $file ;;
63436df26cacSmrg	*) . ./$file ;;
63446df26cacSmrg	esac
63456df26cacSmrg
63466df26cacSmrg	# Skip this library if it cannot be dlopened.
63476df26cacSmrg	if test -z "$dlname"; then
63486df26cacSmrg	  # Warn if it was a shared library.
63496df26cacSmrg	  test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
63506df26cacSmrg	  continue
63516df26cacSmrg	fi
63526df26cacSmrg
63536df26cacSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
63546df26cacSmrg	test "X$dir" = "X$file" && dir=.
63556df26cacSmrg
63566df26cacSmrg	if test -f "$dir/$objdir/$dlname"; then
63576df26cacSmrg	  dir="$dir/$objdir"
63586df26cacSmrg	else
63596df26cacSmrg	  $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
63606df26cacSmrg	  exit $EXIT_FAILURE
63616df26cacSmrg	fi
63626df26cacSmrg	;;
63636df26cacSmrg
63646df26cacSmrg      *.lo)
63656df26cacSmrg	# Just add the directory containing the .lo file.
63666df26cacSmrg	dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
63676df26cacSmrg	test "X$dir" = "X$file" && dir=.
63686df26cacSmrg	;;
63696df26cacSmrg
63706df26cacSmrg      *)
63716df26cacSmrg	$echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
63726df26cacSmrg	continue
63736df26cacSmrg	;;
63746df26cacSmrg      esac
63756df26cacSmrg
63766df26cacSmrg      # Get the absolute pathname.
63776df26cacSmrg      absdir=`cd "$dir" && pwd`
63786df26cacSmrg      test -n "$absdir" && dir="$absdir"
63796df26cacSmrg
63806df26cacSmrg      # Now add the directory to shlibpath_var.
63816df26cacSmrg      if eval "test -z \"\$$shlibpath_var\""; then
63826df26cacSmrg	eval "$shlibpath_var=\"\$dir\""
63836df26cacSmrg      else
63846df26cacSmrg	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
63856df26cacSmrg      fi
63866df26cacSmrg    done
63876df26cacSmrg
63886df26cacSmrg    # This variable tells wrapper scripts just to set shlibpath_var
63896df26cacSmrg    # rather than running their programs.
63906df26cacSmrg    libtool_execute_magic="$magic"
63916df26cacSmrg
63926df26cacSmrg    # Check if any of the arguments is a wrapper script.
63936df26cacSmrg    args=
63946df26cacSmrg    for file
63956df26cacSmrg    do
63966df26cacSmrg      case $file in
63976df26cacSmrg      -*) ;;
63986df26cacSmrg      *)
63996df26cacSmrg	# Do a test to see if this is really a libtool program.
64006df26cacSmrg	if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
64016df26cacSmrg	  # If there is no directory component, then add one.
64026df26cacSmrg	  case $file in
64036df26cacSmrg	  */* | *\\*) . $file ;;
64046df26cacSmrg	  *) . ./$file ;;
64056df26cacSmrg	  esac
64066df26cacSmrg
64076df26cacSmrg	  # Transform arg to wrapped name.
64086df26cacSmrg	  file="$progdir/$program"
64096df26cacSmrg	fi
64106df26cacSmrg	;;
64116df26cacSmrg      esac
64126df26cacSmrg      # Quote arguments (to preserve shell metacharacters).
64136df26cacSmrg      file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
64146df26cacSmrg      args="$args \"$file\""
64156df26cacSmrg    done
64166df26cacSmrg
64176df26cacSmrg    if test -z "$run"; then
64186df26cacSmrg      if test -n "$shlibpath_var"; then
64196df26cacSmrg	# Export the shlibpath_var.
64206df26cacSmrg	eval "export $shlibpath_var"
64216df26cacSmrg      fi
64226df26cacSmrg
64236df26cacSmrg      # Restore saved environment variables
64246df26cacSmrg      if test "${save_LC_ALL+set}" = set; then
64256df26cacSmrg	LC_ALL="$save_LC_ALL"; export LC_ALL
64266df26cacSmrg      fi
64276df26cacSmrg      if test "${save_LANG+set}" = set; then
64286df26cacSmrg	LANG="$save_LANG"; export LANG
64296df26cacSmrg      fi
64306df26cacSmrg
64316df26cacSmrg      # Now prepare to actually exec the command.
64326df26cacSmrg      exec_cmd="\$cmd$args"
64336df26cacSmrg    else
64346df26cacSmrg      # Display what would be done.
64356df26cacSmrg      if test -n "$shlibpath_var"; then
64366df26cacSmrg	eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
64376df26cacSmrg	$echo "export $shlibpath_var"
64386df26cacSmrg      fi
64396df26cacSmrg      $echo "$cmd$args"
64406df26cacSmrg      exit $EXIT_SUCCESS
64416df26cacSmrg    fi
64426df26cacSmrg    ;;
64436df26cacSmrg
64446df26cacSmrg  # libtool clean and uninstall mode
64456df26cacSmrg  clean | uninstall)
64466df26cacSmrg    modename="$modename: $mode"
64476df26cacSmrg    rm="$nonopt"
64486df26cacSmrg    files=
64496df26cacSmrg    rmforce=
64506df26cacSmrg    exit_status=0
64516df26cacSmrg
64526df26cacSmrg    # This variable tells wrapper scripts just to set variables rather
64536df26cacSmrg    # than running their programs.
64546df26cacSmrg    libtool_install_magic="$magic"
64556df26cacSmrg
64566df26cacSmrg    for arg
64576df26cacSmrg    do
64586df26cacSmrg      case $arg in
64596df26cacSmrg      -f) rm="$rm $arg"; rmforce=yes ;;
64606df26cacSmrg      -*) rm="$rm $arg" ;;
64616df26cacSmrg      *) files="$files $arg" ;;
64626df26cacSmrg      esac
64636df26cacSmrg    done
64646df26cacSmrg
64656df26cacSmrg    if test -z "$rm"; then
64666df26cacSmrg      $echo "$modename: you must specify an RM program" 1>&2
64676df26cacSmrg      $echo "$help" 1>&2
64686df26cacSmrg      exit $EXIT_FAILURE
64696df26cacSmrg    fi
64706df26cacSmrg
64716df26cacSmrg    rmdirs=
64726df26cacSmrg
64736df26cacSmrg    origobjdir="$objdir"
64746df26cacSmrg    for file in $files; do
64756df26cacSmrg      dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
64766df26cacSmrg      if test "X$dir" = "X$file"; then
64776df26cacSmrg	dir=.
64786df26cacSmrg	objdir="$origobjdir"
64796df26cacSmrg      else
64806df26cacSmrg	objdir="$dir/$origobjdir"
64816df26cacSmrg      fi
64826df26cacSmrg      name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
64836df26cacSmrg      test "$mode" = uninstall && objdir="$dir"
64846df26cacSmrg
64856df26cacSmrg      # Remember objdir for removal later, being careful to avoid duplicates
64866df26cacSmrg      if test "$mode" = clean; then
64876df26cacSmrg	case " $rmdirs " in
64886df26cacSmrg	  *" $objdir "*) ;;
64896df26cacSmrg	  *) rmdirs="$rmdirs $objdir" ;;
64906df26cacSmrg	esac
64916df26cacSmrg      fi
64926df26cacSmrg
64936df26cacSmrg      # Don't error if the file doesn't exist and rm -f was used.
64946df26cacSmrg      if (test -L "$file") >/dev/null 2>&1 \
64956df26cacSmrg	|| (test -h "$file") >/dev/null 2>&1 \
64966df26cacSmrg	|| test -f "$file"; then
64976df26cacSmrg	:
64986df26cacSmrg      elif test -d "$file"; then
64996df26cacSmrg	exit_status=1
65006df26cacSmrg	continue
65016df26cacSmrg      elif test "$rmforce" = yes; then
65026df26cacSmrg	continue
65036df26cacSmrg      fi
65046df26cacSmrg
65056df26cacSmrg      rmfiles="$file"
65066df26cacSmrg
65076df26cacSmrg      case $name in
65086df26cacSmrg      *.la)
65096df26cacSmrg	# Possibly a libtool archive, so verify it.
65106df26cacSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
65116df26cacSmrg	  . $dir/$name
65126df26cacSmrg
65136df26cacSmrg	  # Delete the libtool libraries and symlinks.
65146df26cacSmrg	  for n in $library_names; do
65156df26cacSmrg	    rmfiles="$rmfiles $objdir/$n"
65166df26cacSmrg	  done
65176df26cacSmrg	  test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
65186df26cacSmrg
65196df26cacSmrg	  case "$mode" in
65206df26cacSmrg	  clean)
65216df26cacSmrg	    case "  $library_names " in
65226df26cacSmrg	    # "  " in the beginning catches empty $dlname
65236df26cacSmrg	    *" $dlname "*) ;;
65246df26cacSmrg	    *) rmfiles="$rmfiles $objdir/$dlname" ;;
65256df26cacSmrg	    esac
65266df26cacSmrg	     test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
65276df26cacSmrg	    ;;
65286df26cacSmrg	  uninstall)
65296df26cacSmrg	    if test -n "$library_names"; then
65306df26cacSmrg	      # Do each command in the postuninstall commands.
65316df26cacSmrg	      cmds=$postuninstall_cmds
65326df26cacSmrg	      save_ifs="$IFS"; IFS='~'
65336df26cacSmrg	      for cmd in $cmds; do
65346df26cacSmrg		IFS="$save_ifs"
65356df26cacSmrg		eval cmd=\"$cmd\"
65366df26cacSmrg		$show "$cmd"
65376df26cacSmrg		$run eval "$cmd"
65386df26cacSmrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
65396df26cacSmrg		  exit_status=1
65406df26cacSmrg		fi
65416df26cacSmrg	      done
65426df26cacSmrg	      IFS="$save_ifs"
65436df26cacSmrg	    fi
65446df26cacSmrg
65456df26cacSmrg	    if test -n "$old_library"; then
65466df26cacSmrg	      # Do each command in the old_postuninstall commands.
65476df26cacSmrg	      cmds=$old_postuninstall_cmds
65486df26cacSmrg	      save_ifs="$IFS"; IFS='~'
65496df26cacSmrg	      for cmd in $cmds; do
65506df26cacSmrg		IFS="$save_ifs"
65516df26cacSmrg		eval cmd=\"$cmd\"
65526df26cacSmrg		$show "$cmd"
65536df26cacSmrg		$run eval "$cmd"
65546df26cacSmrg		if test "$?" -ne 0 && test "$rmforce" != yes; then
65556df26cacSmrg		  exit_status=1
65566df26cacSmrg		fi
65576df26cacSmrg	      done
65586df26cacSmrg	      IFS="$save_ifs"
65596df26cacSmrg	    fi
65606df26cacSmrg	    # FIXME: should reinstall the best remaining shared library.
65616df26cacSmrg	    ;;
65626df26cacSmrg	  esac
65636df26cacSmrg	fi
65646df26cacSmrg	;;
65656df26cacSmrg
65666df26cacSmrg      *.lo)
65676df26cacSmrg	# Possibly a libtool object, so verify it.
65686df26cacSmrg	if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
65696df26cacSmrg
65706df26cacSmrg	  # Read the .lo file
65716df26cacSmrg	  . $dir/$name
65726df26cacSmrg
65736df26cacSmrg	  # Add PIC object to the list of files to remove.
65746df26cacSmrg	  if test -n "$pic_object" \
65756df26cacSmrg	     && test "$pic_object" != none; then
65766df26cacSmrg	    rmfiles="$rmfiles $dir/$pic_object"
65776df26cacSmrg	  fi
65786df26cacSmrg
65796df26cacSmrg	  # Add non-PIC object to the list of files to remove.
65806df26cacSmrg	  if test -n "$non_pic_object" \
65816df26cacSmrg	     && test "$non_pic_object" != none; then
65826df26cacSmrg	    rmfiles="$rmfiles $dir/$non_pic_object"
65836df26cacSmrg	  fi
65846df26cacSmrg	fi
65856df26cacSmrg	;;
65866df26cacSmrg
65876df26cacSmrg      *)
65886df26cacSmrg	if test "$mode" = clean ; then
65896df26cacSmrg	  noexename=$name
65906df26cacSmrg	  case $file in
65916df26cacSmrg	  *.exe)
65926df26cacSmrg	    file=`$echo $file|${SED} 's,.exe$,,'`
65936df26cacSmrg	    noexename=`$echo $name|${SED} 's,.exe$,,'`
65946df26cacSmrg	    # $file with .exe has already been added to rmfiles,
65956df26cacSmrg	    # add $file without .exe
65966df26cacSmrg	    rmfiles="$rmfiles $file"
65976df26cacSmrg	    ;;
65986df26cacSmrg	  esac
65996df26cacSmrg	  # Do a test to see if this is a libtool program.
66006df26cacSmrg	  if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
66016df26cacSmrg	    relink_command=
66026df26cacSmrg	    . $dir/$noexename
66036df26cacSmrg
66046df26cacSmrg	    # note $name still contains .exe if it was in $file originally
66056df26cacSmrg	    # as does the version of $file that was added into $rmfiles
66066df26cacSmrg	    rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
66076df26cacSmrg	    if test "$fast_install" = yes && test -n "$relink_command"; then
66086df26cacSmrg	      rmfiles="$rmfiles $objdir/lt-$name"
66096df26cacSmrg	    fi
66106df26cacSmrg	    if test "X$noexename" != "X$name" ; then
66116df26cacSmrg	      rmfiles="$rmfiles $objdir/lt-${noexename}.c"
66126df26cacSmrg	    fi
66136df26cacSmrg	  fi
66146df26cacSmrg	fi
66156df26cacSmrg	;;
66166df26cacSmrg      esac
66176df26cacSmrg      $show "$rm $rmfiles"
66186df26cacSmrg      $run $rm $rmfiles || exit_status=1
66196df26cacSmrg    done
66206df26cacSmrg    objdir="$origobjdir"
66216df26cacSmrg
66226df26cacSmrg    # Try to remove the ${objdir}s in the directories where we deleted files
66236df26cacSmrg    for dir in $rmdirs; do
66246df26cacSmrg      if test -d "$dir"; then
66256df26cacSmrg	$show "rmdir $dir"
66266df26cacSmrg	$run rmdir $dir >/dev/null 2>&1
66276df26cacSmrg      fi
66286df26cacSmrg    done
66296df26cacSmrg
66306df26cacSmrg    exit $exit_status
66316df26cacSmrg    ;;
66326df26cacSmrg
66336df26cacSmrg  "")
66346df26cacSmrg    $echo "$modename: you must specify a MODE" 1>&2
66356df26cacSmrg    $echo "$generic_help" 1>&2
66366df26cacSmrg    exit $EXIT_FAILURE
66376df26cacSmrg    ;;
66386df26cacSmrg  esac
66396df26cacSmrg
66406df26cacSmrg  if test -z "$exec_cmd"; then
66416df26cacSmrg    $echo "$modename: invalid operation mode \`$mode'" 1>&2
66426df26cacSmrg    $echo "$generic_help" 1>&2
66436df26cacSmrg    exit $EXIT_FAILURE
66446df26cacSmrg  fi
66456df26cacSmrgfi # test -z "$show_help"
66466df26cacSmrg
66476df26cacSmrgif test -n "$exec_cmd"; then
66486df26cacSmrg  eval exec $exec_cmd
66496df26cacSmrg  exit $EXIT_FAILURE
66506df26cacSmrgfi
66516df26cacSmrg
66526df26cacSmrg# We need to display help for each of the modes.
66536df26cacSmrgcase $mode in
66546df26cacSmrg"") $echo \
66556df26cacSmrg"Usage: $modename [OPTION]... [MODE-ARG]...
66566df26cacSmrg
66576df26cacSmrgProvide generalized library-building support services.
66586df26cacSmrg
66596df26cacSmrg    --config          show all configuration variables
66606df26cacSmrg    --debug           enable verbose shell tracing
66616df26cacSmrg-n, --dry-run         display commands without modifying any files
66626df26cacSmrg    --features        display basic configuration information and exit
66636df26cacSmrg    --finish          same as \`--mode=finish'
66646df26cacSmrg    --help            display this help message and exit
66656df26cacSmrg    --mode=MODE       use operation mode MODE [default=inferred from MODE-ARGS]
66666df26cacSmrg    --quiet           same as \`--silent'
66676df26cacSmrg    --silent          don't print informational messages
66686df26cacSmrg    --tag=TAG         use configuration variables from tag TAG
66696df26cacSmrg    --version         print version information
66706df26cacSmrg
66716df26cacSmrgMODE must be one of the following:
66726df26cacSmrg
66736df26cacSmrg      clean           remove files from the build directory
66746df26cacSmrg      compile         compile a source file into a libtool object
66756df26cacSmrg      execute         automatically set library path, then run a program
66766df26cacSmrg      finish          complete the installation of libtool libraries
66776df26cacSmrg      install         install libraries or executables
66786df26cacSmrg      link            create a library or an executable
66796df26cacSmrg      uninstall       remove libraries from an installed directory
66806df26cacSmrg
66816df26cacSmrgMODE-ARGS vary depending on the MODE.  Try \`$modename --help --mode=MODE' for
66826df26cacSmrga more detailed description of MODE.
66836df26cacSmrg
66846df26cacSmrgReport bugs to <bug-libtool@gnu.org>."
66856df26cacSmrg  exit $EXIT_SUCCESS
66866df26cacSmrg  ;;
66876df26cacSmrg
66886df26cacSmrgclean)
66896df26cacSmrg  $echo \
66906df26cacSmrg"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
66916df26cacSmrg
66926df26cacSmrgRemove files from the build directory.
66936df26cacSmrg
66946df26cacSmrgRM is the name of the program to use to delete files associated with each FILE
66956df26cacSmrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
66966df26cacSmrgto RM.
66976df26cacSmrg
66986df26cacSmrgIf FILE is a libtool library, object or program, all the files associated
66996df26cacSmrgwith it are deleted. Otherwise, only FILE itself is deleted using RM."
67006df26cacSmrg  ;;
67016df26cacSmrg
67026df26cacSmrgcompile)
67036df26cacSmrg  $echo \
67046df26cacSmrg"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
67056df26cacSmrg
67066df26cacSmrgCompile a source file into a libtool library object.
67076df26cacSmrg
67086df26cacSmrgThis mode accepts the following additional options:
67096df26cacSmrg
67106df26cacSmrg  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
67116df26cacSmrg  -prefer-pic       try to building PIC objects only
67126df26cacSmrg  -prefer-non-pic   try to building non-PIC objects only
67136df26cacSmrg  -static           always build a \`.o' file suitable for static linking
67146df26cacSmrg
67156df26cacSmrgCOMPILE-COMMAND is a command to be used in creating a \`standard' object file
67166df26cacSmrgfrom the given SOURCEFILE.
67176df26cacSmrg
67186df26cacSmrgThe output file name is determined by removing the directory component from
67196df26cacSmrgSOURCEFILE, then substituting the C source code suffix \`.c' with the
67206df26cacSmrglibrary object suffix, \`.lo'."
67216df26cacSmrg  ;;
67226df26cacSmrg
67236df26cacSmrgexecute)
67246df26cacSmrg  $echo \
67256df26cacSmrg"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
67266df26cacSmrg
67276df26cacSmrgAutomatically set library path, then run a program.
67286df26cacSmrg
67296df26cacSmrgThis mode accepts the following additional options:
67306df26cacSmrg
67316df26cacSmrg  -dlopen FILE      add the directory containing FILE to the library path
67326df26cacSmrg
67336df26cacSmrgThis mode sets the library path environment variable according to \`-dlopen'
67346df26cacSmrgflags.
67356df26cacSmrg
67366df26cacSmrgIf any of the ARGS are libtool executable wrappers, then they are translated
67376df26cacSmrginto their corresponding uninstalled binary, and any of their required library
67386df26cacSmrgdirectories are added to the library path.
67396df26cacSmrg
67406df26cacSmrgThen, COMMAND is executed, with ARGS as arguments."
67416df26cacSmrg  ;;
67426df26cacSmrg
67436df26cacSmrgfinish)
67446df26cacSmrg  $echo \
67456df26cacSmrg"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
67466df26cacSmrg
67476df26cacSmrgComplete the installation of libtool libraries.
67486df26cacSmrg
67496df26cacSmrgEach LIBDIR is a directory that contains libtool libraries.
67506df26cacSmrg
67516df26cacSmrgThe commands that this mode executes may require superuser privileges.  Use
67526df26cacSmrgthe \`--dry-run' option if you just want to see what would be executed."
67536df26cacSmrg  ;;
67546df26cacSmrg
67556df26cacSmrginstall)
67566df26cacSmrg  $echo \
67576df26cacSmrg"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
67586df26cacSmrg
67596df26cacSmrgInstall executables or libraries.
67606df26cacSmrg
67616df26cacSmrgINSTALL-COMMAND is the installation command.  The first component should be
67626df26cacSmrgeither the \`install' or \`cp' program.
67636df26cacSmrg
67646df26cacSmrgThe rest of the components are interpreted as arguments to that command (only
67656df26cacSmrgBSD-compatible install options are recognized)."
67666df26cacSmrg  ;;
67676df26cacSmrg
67686df26cacSmrglink)
67696df26cacSmrg  $echo \
67706df26cacSmrg"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
67716df26cacSmrg
67726df26cacSmrgLink object files or libraries together to form another library, or to
67736df26cacSmrgcreate an executable program.
67746df26cacSmrg
67756df26cacSmrgLINK-COMMAND is a command using the C compiler that you would use to create
67766df26cacSmrga program from several object files.
67776df26cacSmrg
67786df26cacSmrgThe following components of LINK-COMMAND are treated specially:
67796df26cacSmrg
67806df26cacSmrg  -all-static       do not do any dynamic linking at all
67816df26cacSmrg  -avoid-version    do not add a version suffix if possible
67826df26cacSmrg  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
67836df26cacSmrg  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
67846df26cacSmrg  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
67856df26cacSmrg  -export-symbols SYMFILE
67866df26cacSmrg		    try to export only the symbols listed in SYMFILE
67876df26cacSmrg  -export-symbols-regex REGEX
67886df26cacSmrg		    try to export only the symbols matching REGEX
67896df26cacSmrg  -LLIBDIR          search LIBDIR for required installed libraries
67906df26cacSmrg  -lNAME            OUTPUT-FILE requires the installed library libNAME
67916df26cacSmrg  -module           build a library that can dlopened
67926df26cacSmrg  -no-fast-install  disable the fast-install mode
67936df26cacSmrg  -no-install       link a not-installable executable
67946df26cacSmrg  -no-undefined     declare that a library does not refer to external symbols
67956df26cacSmrg  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
67966df26cacSmrg  -objectlist FILE  Use a list of object files found in FILE to specify objects
67976df26cacSmrg  -precious-files-regex REGEX
67986df26cacSmrg                    don't remove output files matching REGEX
67996df26cacSmrg  -release RELEASE  specify package release information
68006df26cacSmrg  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
68016df26cacSmrg  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
68026df26cacSmrg  -static           do not do any dynamic linking of libtool libraries
68036df26cacSmrg  -version-info CURRENT[:REVISION[:AGE]]
68046df26cacSmrg		    specify library version info [each variable defaults to 0]
68056df26cacSmrg
68066df26cacSmrgAll other options (arguments beginning with \`-') are ignored.
68076df26cacSmrg
68086df26cacSmrgEvery other argument is treated as a filename.  Files ending in \`.la' are
68096df26cacSmrgtreated as uninstalled libtool libraries, other files are standard or library
68106df26cacSmrgobject files.
68116df26cacSmrg
68126df26cacSmrgIf the OUTPUT-FILE ends in \`.la', then a libtool library is created,
68136df26cacSmrgonly library objects (\`.lo' files) may be specified, and \`-rpath' is
68146df26cacSmrgrequired, except when creating a convenience library.
68156df26cacSmrg
68166df26cacSmrgIf OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
68176df26cacSmrgusing \`ar' and \`ranlib', or on Windows using \`lib'.
68186df26cacSmrg
68196df26cacSmrgIf OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
68206df26cacSmrgis created, otherwise an executable program is created."
68216df26cacSmrg  ;;
68226df26cacSmrg
68236df26cacSmrguninstall)
68246df26cacSmrg  $echo \
68256df26cacSmrg"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
68266df26cacSmrg
68276df26cacSmrgRemove libraries from an installation directory.
68286df26cacSmrg
68296df26cacSmrgRM is the name of the program to use to delete files associated with each FILE
68306df26cacSmrg(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
68316df26cacSmrgto RM.
68326df26cacSmrg
68336df26cacSmrgIf FILE is a libtool library, all the files associated with it are deleted.
68346df26cacSmrgOtherwise, only FILE itself is deleted using RM."
68356df26cacSmrg  ;;
68366df26cacSmrg
68376df26cacSmrg*)
68386df26cacSmrg  $echo "$modename: invalid operation mode \`$mode'" 1>&2
68396df26cacSmrg  $echo "$help" 1>&2
68406df26cacSmrg  exit $EXIT_FAILURE
68416df26cacSmrg  ;;
68426df26cacSmrgesac
68436df26cacSmrg
68446df26cacSmrg$echo
68456df26cacSmrg$echo "Try \`$modename --help' for more information about other modes."
68466df26cacSmrg
68476df26cacSmrgexit $?
68486df26cacSmrg
68496df26cacSmrg# The TAGs below are defined such that we never get into a situation
68506df26cacSmrg# in which we disable both kinds of libraries.  Given conflicting
68516df26cacSmrg# choices, we go for a static library, that is the most portable,
68526df26cacSmrg# since we can't tell whether shared libraries were disabled because
68536df26cacSmrg# the user asked for that or because the platform doesn't support
68546df26cacSmrg# them.  This is particularly important on AIX, because we don't
68556df26cacSmrg# support having both static and shared libraries enabled at the same
68566df26cacSmrg# time on that platform, so we default to a shared-only configuration.
68576df26cacSmrg# If a disable-shared tag is given, we'll fallback to a static-only
68586df26cacSmrg# configuration.  But we'll never go from static-only to shared-only.
68596df26cacSmrg
68606df26cacSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
68616df26cacSmrgdisable_libs=shared
68626df26cacSmrg# ### END LIBTOOL TAG CONFIG: disable-shared
68636df26cacSmrg
68646df26cacSmrg# ### BEGIN LIBTOOL TAG CONFIG: disable-static
68656df26cacSmrgdisable_libs=static
68666df26cacSmrg# ### END LIBTOOL TAG CONFIG: disable-static
68676df26cacSmrg
68686df26cacSmrg# Local Variables:
68696df26cacSmrg# mode:shell-script
68706df26cacSmrg# sh-indentation:2
68716df26cacSmrg# End:
6872