build-scripts/ltmain.sh
branchSDL-1.2
changeset 4277 803eeeeaa8a0
parent 1761 39715a34a0be
child 5101 3500563bb2f8
     1.1 --- a/build-scripts/ltmain.sh	Sun Oct 04 20:45:55 2009 +0000
     1.2 +++ b/build-scripts/ltmain.sh	Sun Oct 04 22:31:25 2009 +0000
     1.3 @@ -1,31 +1,174 @@
     1.4 -# Based on libtool-1.5.22
     1.5 -# ltmain.sh - Provide generalized library-building support services.
     1.6 -# NOTE: Changing this file will not affect anything until you rerun configure.
     1.7 -#
     1.8 -# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005
     1.9 -# Free Software Foundation, Inc.
    1.10 -# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
    1.11 -#
    1.12 -# This program is free software; you can redistribute it and/or modify
    1.13 +# Generated from ltmain.m4sh.
    1.14 +
    1.15 +# ltmain.sh (GNU libtool) 2.2.6
    1.16 +# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
    1.17 +
    1.18 +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2007 2008 Free Software Foundation, Inc.
    1.19 +# This is free software; see the source for copying conditions.  There is NO
    1.20 +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
    1.21 +
    1.22 +# GNU Libtool is free software; you can redistribute it and/or modify
    1.23  # it under the terms of the GNU General Public License as published by
    1.24  # the Free Software Foundation; either version 2 of the License, or
    1.25  # (at your option) any later version.
    1.26  #
    1.27 -# This program is distributed in the hope that it will be useful, but
    1.28 +# As a special exception to the GNU General Public License,
    1.29 +# if you distribute this file as part of a program or library that
    1.30 +# is built using GNU Libtool, you may include this file under the
    1.31 +# same distribution terms that you use for the rest of that program.
    1.32 +#
    1.33 +# GNU Libtool is distributed in the hope that it will be useful, but
    1.34  # WITHOUT ANY WARRANTY; without even the implied warranty of
    1.35  # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
    1.36  # General Public License for more details.
    1.37  #
    1.38  # You should have received a copy of the GNU General Public License
    1.39 -# along with this program; if not, write to the Free Software
    1.40 -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
    1.41 +# along with GNU Libtool; see the file COPYING.  If not, a copy
    1.42 +# can be downloaded from http://www.gnu.org/licenses/gpl.html,
    1.43 +# or obtained by writing to the Free Software Foundation, Inc.,
    1.44 +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
    1.45 +
    1.46 +# Usage: $progname [OPTION]... [MODE-ARG]...
    1.47 +#
    1.48 +# Provide generalized library-building support services.
    1.49 +#
    1.50 +#     --config             show all configuration variables
    1.51 +#     --debug              enable verbose shell tracing
    1.52 +# -n, --dry-run            display commands without modifying any files
    1.53 +#     --features           display basic configuration information and exit
    1.54 +#     --mode=MODE          use operation mode MODE
    1.55 +#     --preserve-dup-deps  don't remove duplicate dependency libraries
    1.56 +#     --quiet, --silent    don't print informational messages
    1.57 +#     --tag=TAG            use configuration variables from tag TAG
    1.58 +# -v, --verbose            print informational messages (default)
    1.59 +#     --version            print version information
    1.60 +# -h, --help               print short or long help message
    1.61 +#
    1.62 +# MODE must be one of the following:
    1.63 +#
    1.64 +#       clean              remove files from the build directory
    1.65 +#       compile            compile a source file into a libtool object
    1.66 +#       execute            automatically set library path, then run a program
    1.67 +#       finish             complete the installation of libtool libraries
    1.68 +#       install            install libraries or executables
    1.69 +#       link               create a library or an executable
    1.70 +#       uninstall          remove libraries from an installed directory
    1.71 +#
    1.72 +# MODE-ARGS vary depending on the MODE.
    1.73 +# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
    1.74 +#
    1.75 +# When reporting a bug, please describe a test case to reproduce it and
    1.76 +# include the following information:
    1.77 +#
    1.78 +#       host-triplet:	$host
    1.79 +#       shell:		$SHELL
    1.80 +#       compiler:		$LTCC
    1.81 +#       compiler flags:		$LTCFLAGS
    1.82 +#       linker:		$LD (gnu? $with_gnu_ld)
    1.83 +#       $progname:		(GNU libtool) 2.2.6
    1.84 +#       automake:		$automake_version
    1.85 +#       autoconf:		$autoconf_version
    1.86  #
    1.87 -# As a special exception to the GNU General Public License, if you
    1.88 -# distribute this file as part of a program that contains a
    1.89 -# configuration script generated by Autoconf, you may include it under
    1.90 -# the same distribution terms that you use for the rest of that program.
    1.91 -
    1.92 -basename="s,^.*/,,g"
    1.93 +# Report bugs to <bug-libtool@gnu.org>.
    1.94 +
    1.95 +PROGRAM=ltmain.sh
    1.96 +PACKAGE=libtool
    1.97 +VERSION=2.2.6
    1.98 +TIMESTAMP=""
    1.99 +package_revision=1.3012
   1.100 +
   1.101 +# Be Bourne compatible
   1.102 +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
   1.103 +  emulate sh
   1.104 +  NULLCMD=:
   1.105 +  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
   1.106 +  # is contrary to our usage.  Disable this feature.
   1.107 +  alias -g '${1+"$@"}'='"$@"'
   1.108 +  setopt NO_GLOB_SUBST
   1.109 +else
   1.110 +  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
   1.111 +fi
   1.112 +BIN_SH=xpg4; export BIN_SH # for Tru64
   1.113 +DUALCASE=1; export DUALCASE # for MKS sh
   1.114 +
   1.115 +# NLS nuisances: We save the old values to restore during execute mode.
   1.116 +# Only set LANG and LC_ALL to C if already set.
   1.117 +# These must not be set unconditionally because not all systems understand
   1.118 +# e.g. LANG=C (notably SCO).
   1.119 +lt_user_locale=
   1.120 +lt_safe_locale=
   1.121 +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
   1.122 +do
   1.123 +  eval "if test \"\${$lt_var+set}\" = set; then
   1.124 +          save_$lt_var=\$$lt_var
   1.125 +          $lt_var=C
   1.126 +	  export $lt_var
   1.127 +	  lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
   1.128 +	  lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
   1.129 +	fi"
   1.130 +done
   1.131 +
   1.132 +$lt_unset CDPATH
   1.133 +
   1.134 +
   1.135 +
   1.136 +
   1.137 +
   1.138 +: ${CP="cp -f"}
   1.139 +: ${ECHO="echo"}
   1.140 +: ${EGREP="/usr/bin/grep -E"}
   1.141 +: ${FGREP="/usr/bin/grep -F"}
   1.142 +: ${GREP="/usr/bin/grep"}
   1.143 +: ${LN_S="ln -s"}
   1.144 +: ${MAKE="make"}
   1.145 +: ${MKDIR="mkdir"}
   1.146 +: ${MV="mv -f"}
   1.147 +: ${RM="rm -f"}
   1.148 +: ${SED="/opt/local/bin/gsed"}
   1.149 +: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
   1.150 +: ${Xsed="$SED -e 1s/^X//"}
   1.151 +
   1.152 +# Global variables:
   1.153 +EXIT_SUCCESS=0
   1.154 +EXIT_FAILURE=1
   1.155 +EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
   1.156 +EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
   1.157 +
   1.158 +exit_status=$EXIT_SUCCESS
   1.159 +
   1.160 +# Make sure IFS has a sensible default
   1.161 +lt_nl='
   1.162 +'
   1.163 +IFS=" 	$lt_nl"
   1.164 +
   1.165 +dirname="s,/[^/]*$,,"
   1.166 +basename="s,^.*/,,"
   1.167 +
   1.168 +# func_dirname_and_basename file append nondir_replacement
   1.169 +# perform func_basename and func_dirname in a single function
   1.170 +# call:
   1.171 +#   dirname:  Compute the dirname of FILE.  If nonempty,
   1.172 +#             add APPEND to the result, otherwise set result
   1.173 +#             to NONDIR_REPLACEMENT.
   1.174 +#             value returned in "$func_dirname_result"
   1.175 +#   basename: Compute filename of FILE.
   1.176 +#             value retuned in "$func_basename_result"
   1.177 +# Implementation must be kept synchronized with func_dirname
   1.178 +# and func_basename. For efficiency, we do not delegate to
   1.179 +# those functions but instead duplicate the functionality here.
   1.180 +func_dirname_and_basename ()
   1.181 +{
   1.182 +  # Extract subdirectory from the argument.
   1.183 +  func_dirname_result=`$ECHO "X${1}" | $Xsed -e "$dirname"`
   1.184 +  if test "X$func_dirname_result" = "X${1}"; then
   1.185 +    func_dirname_result="${3}"
   1.186 +  else
   1.187 +    func_dirname_result="$func_dirname_result${2}"
   1.188 +  fi
   1.189 +  func_basename_result=`$ECHO "X${1}" | $Xsed -e "$basename"`
   1.190 +}
   1.191 +
   1.192 +# Generated shell functions inserted here.
   1.193  
   1.194  # Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
   1.195  # is ksh but when the shell is invoked as "sh" and the current value of
   1.196 @@ -35,36 +178,396 @@
   1.197  progpath="$0"
   1.198  
   1.199  # The name of this program:
   1.200 -progname=`echo "$progpath" | $SED $basename`
   1.201 -modename="$progname"
   1.202 -
   1.203 -# Global variables:
   1.204 -EXIT_SUCCESS=0
   1.205 -EXIT_FAILURE=1
   1.206 -
   1.207 -PROGRAM=ltmain.sh
   1.208 -PACKAGE=libtool
   1.209 -VERSION=1.5.22
   1.210 -TIMESTAMP=" (1.1220.2.365 2005/12/18 22:14:06)"
   1.211 -
   1.212 -# See if we are running on zsh, and set the options which allow our
   1.213 -# commands through without removal of \ escapes.
   1.214 -if test -n "${ZSH_VERSION+set}" ; then
   1.215 -  setopt NO_GLOB_SUBST
   1.216 -fi
   1.217 -
   1.218 -# Check that we have a working $echo.
   1.219 +# In the unlikely event $progname began with a '-', it would play havoc with
   1.220 +# func_echo (imagine progname=-n), so we prepend ./ in that case:
   1.221 +func_dirname_and_basename "$progpath"
   1.222 +progname=$func_basename_result
   1.223 +case $progname in
   1.224 +  -*) progname=./$progname ;;
   1.225 +esac
   1.226 +
   1.227 +# Make sure we have an absolute path for reexecution:
   1.228 +case $progpath in
   1.229 +  [\\/]*|[A-Za-z]:\\*) ;;
   1.230 +  *[\\/]*)
   1.231 +     progdir=$func_dirname_result
   1.232 +     progdir=`cd "$progdir" && pwd`
   1.233 +     progpath="$progdir/$progname"
   1.234 +     ;;
   1.235 +  *)
   1.236 +     save_IFS="$IFS"
   1.237 +     IFS=:
   1.238 +     for progdir in $PATH; do
   1.239 +       IFS="$save_IFS"
   1.240 +       test -x "$progdir/$progname" && break
   1.241 +     done
   1.242 +     IFS="$save_IFS"
   1.243 +     test -n "$progdir" || progdir=`pwd`
   1.244 +     progpath="$progdir/$progname"
   1.245 +     ;;
   1.246 +esac
   1.247 +
   1.248 +# Sed substitution that helps us do robust quoting.  It backslashifies
   1.249 +# metacharacters that are still active within double-quoted strings.
   1.250 +Xsed="${SED}"' -e 1s/^X//'
   1.251 +sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
   1.252 +
   1.253 +# Same as above, but do not quote variable references.
   1.254 +double_quote_subst='s/\(["`\\]\)/\\\1/g'
   1.255 +
   1.256 +# Re-`\' parameter expansions in output of double_quote_subst that were
   1.257 +# `\'-ed in input to the same.  If an odd number of `\' preceded a '$'
   1.258 +# in input to double_quote_subst, that '$' was protected from expansion.
   1.259 +# Since each input `\' is now two `\'s, look for any number of runs of
   1.260 +# four `\'s followed by two `\'s and then a '$'.  `\' that '$'.
   1.261 +bs='\\'
   1.262 +bs2='\\\\'
   1.263 +bs4='\\\\\\\\'
   1.264 +dollar='\$'
   1.265 +sed_double_backslash="\
   1.266 +  s/$bs4/&\\
   1.267 +/g
   1.268 +  s/^$bs2$dollar/$bs&/
   1.269 +  s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
   1.270 +  s/\n//g"
   1.271 +
   1.272 +# Standard options:
   1.273 +opt_dry_run=false
   1.274 +opt_help=false
   1.275 +opt_quiet=false
   1.276 +opt_verbose=false
   1.277 +opt_warning=:
   1.278 +
   1.279 +# func_echo arg...
   1.280 +# Echo program name prefixed message, along with the current mode
   1.281 +# name if it has been set yet.
   1.282 +func_echo ()
   1.283 +{
   1.284 +    $ECHO "$progname${mode+: }$mode: $*"
   1.285 +}
   1.286 +
   1.287 +# func_verbose arg...
   1.288 +# Echo program name prefixed message in verbose mode only.
   1.289 +func_verbose ()
   1.290 +{
   1.291 +    $opt_verbose && func_echo ${1+"$@"}
   1.292 +
   1.293 +    # A bug in bash halts the script if the last line of a function
   1.294 +    # fails when set -e is in force, so we need another command to
   1.295 +    # work around that:
   1.296 +    :
   1.297 +}
   1.298 +
   1.299 +# func_error arg...
   1.300 +# Echo program name prefixed message to standard error.
   1.301 +func_error ()
   1.302 +{
   1.303 +    $ECHO "$progname${mode+: }$mode: "${1+"$@"} 1>&2
   1.304 +}
   1.305 +
   1.306 +# func_warning arg...
   1.307 +# Echo program name prefixed warning message to standard error.
   1.308 +func_warning ()
   1.309 +{
   1.310 +    $opt_warning && $ECHO "$progname${mode+: }$mode: warning: "${1+"$@"} 1>&2
   1.311 +
   1.312 +    # bash bug again:
   1.313 +    :
   1.314 +}
   1.315 +
   1.316 +# func_fatal_error arg...
   1.317 +# Echo program name prefixed message to standard error, and exit.
   1.318 +func_fatal_error ()
   1.319 +{
   1.320 +    func_error ${1+"$@"}
   1.321 +    exit $EXIT_FAILURE
   1.322 +}
   1.323 +
   1.324 +# func_fatal_help arg...
   1.325 +# Echo program name prefixed message to standard error, followed by
   1.326 +# a help hint, and exit.
   1.327 +func_fatal_help ()
   1.328 +{
   1.329 +    func_error ${1+"$@"}
   1.330 +    func_fatal_error "$help"
   1.331 +}
   1.332 +help="Try \`$progname --help' for more information."  ## default
   1.333 +
   1.334 +
   1.335 +# func_grep expression filename
   1.336 +# Check whether EXPRESSION matches any line of FILENAME, without output.
   1.337 +func_grep ()
   1.338 +{
   1.339 +    $GREP "$1" "$2" >/dev/null 2>&1
   1.340 +}
   1.341 +
   1.342 +
   1.343 +# func_mkdir_p directory-path
   1.344 +# Make sure the entire path to DIRECTORY-PATH is available.
   1.345 +func_mkdir_p ()
   1.346 +{
   1.347 +    my_directory_path="$1"
   1.348 +    my_dir_list=
   1.349 +
   1.350 +    if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
   1.351 +
   1.352 +      # Protect directory names starting with `-'
   1.353 +      case $my_directory_path in
   1.354 +        -*) my_directory_path="./$my_directory_path" ;;
   1.355 +      esac
   1.356 +
   1.357 +      # While some portion of DIR does not yet exist...
   1.358 +      while test ! -d "$my_directory_path"; do
   1.359 +        # ...make a list in topmost first order.  Use a colon delimited
   1.360 +	# list incase some portion of path contains whitespace.
   1.361 +        my_dir_list="$my_directory_path:$my_dir_list"
   1.362 +
   1.363 +        # If the last portion added has no slash in it, the list is done
   1.364 +        case $my_directory_path in */*) ;; *) break ;; esac
   1.365 +
   1.366 +        # ...otherwise throw away the child directory and loop
   1.367 +        my_directory_path=`$ECHO "X$my_directory_path" | $Xsed -e "$dirname"`
   1.368 +      done
   1.369 +      my_dir_list=`$ECHO "X$my_dir_list" | $Xsed -e 's,:*$,,'`
   1.370 +
   1.371 +      save_mkdir_p_IFS="$IFS"; IFS=':'
   1.372 +      for my_dir in $my_dir_list; do
   1.373 +	IFS="$save_mkdir_p_IFS"
   1.374 +        # mkdir can fail with a `File exist' error if two processes
   1.375 +        # try to create one of the directories concurrently.  Don't
   1.376 +        # stop in that case!
   1.377 +        $MKDIR "$my_dir" 2>/dev/null || :
   1.378 +      done
   1.379 +      IFS="$save_mkdir_p_IFS"
   1.380 +
   1.381 +      # Bail out if we (or some other process) failed to create a directory.
   1.382 +      test -d "$my_directory_path" || \
   1.383 +        func_fatal_error "Failed to create \`$1'"
   1.384 +    fi
   1.385 +}
   1.386 +
   1.387 +
   1.388 +# func_mktempdir [string]
   1.389 +# Make a temporary directory that won't clash with other running
   1.390 +# libtool processes, and avoids race conditions if possible.  If
   1.391 +# given, STRING is the basename for that directory.
   1.392 +func_mktempdir ()
   1.393 +{
   1.394 +    my_template="${TMPDIR-/tmp}/${1-$progname}"
   1.395 +
   1.396 +    if test "$opt_dry_run" = ":"; then
   1.397 +      # Return a directory name, but don't create it in dry-run mode
   1.398 +      my_tmpdir="${my_template}-$$"
   1.399 +    else
   1.400 +
   1.401 +      # If mktemp works, use that first and foremost
   1.402 +      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
   1.403 +
   1.404 +      if test ! -d "$my_tmpdir"; then
   1.405 +        # Failing that, at least try and use $RANDOM to avoid a race
   1.406 +        my_tmpdir="${my_template}-${RANDOM-0}$$"
   1.407 +
   1.408 +        save_mktempdir_umask=`umask`
   1.409 +        umask 0077
   1.410 +        $MKDIR "$my_tmpdir"
   1.411 +        umask $save_mktempdir_umask
   1.412 +      fi
   1.413 +
   1.414 +      # If we're not in dry-run mode, bomb out on failure
   1.415 +      test -d "$my_tmpdir" || \
   1.416 +        func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
   1.417 +    fi
   1.418 +
   1.419 +    $ECHO "X$my_tmpdir" | $Xsed
   1.420 +}
   1.421 +
   1.422 +
   1.423 +# func_quote_for_eval arg
   1.424 +# Aesthetically quote ARG to be evaled later.
   1.425 +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
   1.426 +# is double-quoted, suitable for a subsequent eval, whereas
   1.427 +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
   1.428 +# which are still active within double quotes backslashified.
   1.429 +func_quote_for_eval ()
   1.430 +{
   1.431 +    case $1 in
   1.432 +      *[\\\`\"\$]*)
   1.433 +	func_quote_for_eval_unquoted_result=`$ECHO "X$1" | $Xsed -e "$sed_quote_subst"` ;;
   1.434 +      *)
   1.435 +        func_quote_for_eval_unquoted_result="$1" ;;
   1.436 +    esac
   1.437 +
   1.438 +    case $func_quote_for_eval_unquoted_result in
   1.439 +      # Double-quote args containing shell metacharacters to delay
   1.440 +      # word splitting, command substitution and and variable
   1.441 +      # expansion for a subsequent eval.
   1.442 +      # Many Bourne shells cannot handle close brackets correctly
   1.443 +      # in scan sets, so we specify it separately.
   1.444 +      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   1.445 +        func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
   1.446 +        ;;
   1.447 +      *)
   1.448 +        func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
   1.449 +    esac
   1.450 +}
   1.451 +
   1.452 +
   1.453 +# func_quote_for_expand arg
   1.454 +# Aesthetically quote ARG to be evaled later; same as above,
   1.455 +# but do not quote variable references.
   1.456 +func_quote_for_expand ()
   1.457 +{
   1.458 +    case $1 in
   1.459 +      *[\\\`\"]*)
   1.460 +	my_arg=`$ECHO "X$1" | $Xsed \
   1.461 +	    -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
   1.462 +      *)
   1.463 +        my_arg="$1" ;;
   1.464 +    esac
   1.465 +
   1.466 +    case $my_arg in
   1.467 +      # Double-quote args containing shell metacharacters to delay
   1.468 +      # word splitting and command substitution for a subsequent eval.
   1.469 +      # Many Bourne shells cannot handle close brackets correctly
   1.470 +      # in scan sets, so we specify it separately.
   1.471 +      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
   1.472 +        my_arg="\"$my_arg\""
   1.473 +        ;;
   1.474 +    esac
   1.475 +
   1.476 +    func_quote_for_expand_result="$my_arg"
   1.477 +}
   1.478 +
   1.479 +
   1.480 +# func_show_eval cmd [fail_exp]
   1.481 +# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
   1.482 +# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
   1.483 +# is given, then evaluate it.
   1.484 +func_show_eval ()
   1.485 +{
   1.486 +    my_cmd="$1"
   1.487 +    my_fail_exp="${2-:}"
   1.488 +
   1.489 +    ${opt_silent-false} || {
   1.490 +      func_quote_for_expand "$my_cmd"
   1.491 +      eval "func_echo $func_quote_for_expand_result"
   1.492 +    }
   1.493 +
   1.494 +    if ${opt_dry_run-false}; then :; else
   1.495 +      eval "$my_cmd"
   1.496 +      my_status=$?
   1.497 +      if test "$my_status" -eq 0; then :; else
   1.498 +	eval "(exit $my_status); $my_fail_exp"
   1.499 +      fi
   1.500 +    fi
   1.501 +}
   1.502 +
   1.503 +
   1.504 +# func_show_eval_locale cmd [fail_exp]
   1.505 +# Unless opt_silent is true, then output CMD.  Then, if opt_dryrun is
   1.506 +# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
   1.507 +# is given, then evaluate it.  Use the saved locale for evaluation.
   1.508 +func_show_eval_locale ()
   1.509 +{
   1.510 +    my_cmd="$1"
   1.511 +    my_fail_exp="${2-:}"
   1.512 +
   1.513 +    ${opt_silent-false} || {
   1.514 +      func_quote_for_expand "$my_cmd"
   1.515 +      eval "func_echo $func_quote_for_expand_result"
   1.516 +    }
   1.517 +
   1.518 +    if ${opt_dry_run-false}; then :; else
   1.519 +      eval "$lt_user_locale
   1.520 +	    $my_cmd"
   1.521 +      my_status=$?
   1.522 +      eval "$lt_safe_locale"
   1.523 +      if test "$my_status" -eq 0; then :; else
   1.524 +	eval "(exit $my_status); $my_fail_exp"
   1.525 +      fi
   1.526 +    fi
   1.527 +}
   1.528 +
   1.529 +
   1.530 +
   1.531 +
   1.532 +
   1.533 +# func_version
   1.534 +# Echo version message to standard output and exit.
   1.535 +func_version ()
   1.536 +{
   1.537 +    $SED -n '/^# '$PROGRAM' (GNU /,/# warranty; / {
   1.538 +        s/^# //
   1.539 +	s/^# *$//
   1.540 +        s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
   1.541 +        p
   1.542 +     }' < "$progpath"
   1.543 +     exit $?
   1.544 +}
   1.545 +
   1.546 +# func_usage
   1.547 +# Echo short help message to standard output and exit.
   1.548 +func_usage ()
   1.549 +{
   1.550 +    $SED -n '/^# Usage:/,/# -h/ {
   1.551 +        s/^# //
   1.552 +	s/^# *$//
   1.553 +	s/\$progname/'$progname'/
   1.554 +	p
   1.555 +    }' < "$progpath"
   1.556 +    $ECHO
   1.557 +    $ECHO "run \`$progname --help | more' for full usage"
   1.558 +    exit $?
   1.559 +}
   1.560 +
   1.561 +# func_help
   1.562 +# Echo long help message to standard output and exit.
   1.563 +func_help ()
   1.564 +{
   1.565 +    $SED -n '/^# Usage:/,/# Report bugs to/ {
   1.566 +        s/^# //
   1.567 +	s/^# *$//
   1.568 +	s*\$progname*'$progname'*
   1.569 +	s*\$host*'"$host"'*
   1.570 +	s*\$SHELL*'"$SHELL"'*
   1.571 +	s*\$LTCC*'"$LTCC"'*
   1.572 +	s*\$LTCFLAGS*'"$LTCFLAGS"'*
   1.573 +	s*\$LD*'"$LD"'*
   1.574 +	s/\$with_gnu_ld/'"$with_gnu_ld"'/
   1.575 +	s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/
   1.576 +	s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/
   1.577 +	p
   1.578 +     }' < "$progpath"
   1.579 +    exit $?
   1.580 +}
   1.581 +
   1.582 +# func_missing_arg argname
   1.583 +# Echo program name prefixed message to standard error and set global
   1.584 +# exit_cmd.
   1.585 +func_missing_arg ()
   1.586 +{
   1.587 +    func_error "missing argument for $1"
   1.588 +    exit_cmd=exit
   1.589 +}
   1.590 +
   1.591 +exit_cmd=:
   1.592 +
   1.593 +
   1.594 +
   1.595 +
   1.596 +
   1.597 +# Check that we have a working $ECHO.
   1.598  if test "X$1" = X--no-reexec; then
   1.599    # Discard the --no-reexec flag, and continue.
   1.600    shift
   1.601  elif test "X$1" = X--fallback-echo; then
   1.602    # Avoid inline document here, it may be left over
   1.603    :
   1.604 -elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
   1.605 -  # Yippee, $echo works!
   1.606 +elif test "X`{ $ECHO '\t'; } 2>/dev/null`" = 'X\t'; then
   1.607 +  # Yippee, $ECHO works!
   1.608    :
   1.609  else
   1.610 -  # Restart under the correct shell, and then maybe $echo will work.
   1.611 +  # Restart under the correct shell, and then maybe $ECHO will work.
   1.612    exec $SHELL "$progpath" --no-reexec ${1+"$@"}
   1.613  fi
   1.614  
   1.615 @@ -77,145 +580,424 @@
   1.616    exit $EXIT_SUCCESS
   1.617  fi
   1.618  
   1.619 -default_mode=
   1.620 -help="Try \`$progname --help' for more information."
   1.621  magic="%%%MAGIC variable%%%"
   1.622 -mkdir="mkdir"
   1.623 -mv="mv -f"
   1.624 -rm="rm -f"
   1.625 -
   1.626 -# Sed substitution that helps us do robust quoting.  It backslashifies
   1.627 -# metacharacters that are still active within double-quoted strings.
   1.628 -Xsed="${SED}"' -e 1s/^X//'
   1.629 -sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
   1.630 -# test EBCDIC or ASCII
   1.631 -case `echo X|tr X '\101'` in
   1.632 - A) # ASCII based system
   1.633 -    # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
   1.634 -  SP2NL='tr \040 \012'
   1.635 -  NL2SP='tr \015\012 \040\040'
   1.636 -  ;;
   1.637 - *) # EBCDIC based system
   1.638 -  SP2NL='tr \100 \n'
   1.639 -  NL2SP='tr \r\n \100\100'
   1.640 -  ;;
   1.641 -esac
   1.642 -
   1.643 -# NLS nuisances.
   1.644 -# Only set LANG and LC_ALL to C if already set.
   1.645 -# These must not be set unconditionally because not all systems understand
   1.646 -# e.g. LANG=C (notably SCO).
   1.647 -# We save the old values to restore during execute mode.
   1.648 -if test "${LC_ALL+set}" = set; then
   1.649 -  save_LC_ALL="$LC_ALL"; LC_ALL=C; export LC_ALL
   1.650 -fi
   1.651 -if test "${LANG+set}" = set; then
   1.652 -  save_LANG="$LANG"; LANG=C; export LANG
   1.653 -fi
   1.654 -
   1.655 -# Make sure IFS has a sensible default
   1.656 -lt_nl='
   1.657 -'
   1.658 -IFS=" 	$lt_nl"
   1.659 -
   1.660 -if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
   1.661 -  $echo "$modename: not configured to build any kind of library" 1>&2
   1.662 -  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
   1.663 -  exit $EXIT_FAILURE
   1.664 -fi
   1.665 +magic_exe="%%%MAGIC EXE variable%%%"
   1.666  
   1.667  # Global variables.
   1.668 -mode=$default_mode
   1.669 +# $mode is unset
   1.670  nonopt=
   1.671 -prev=
   1.672 -prevopt=
   1.673 -run=
   1.674 -show="$echo"
   1.675 -show_help=
   1.676  execute_dlfiles=
   1.677 -duplicate_deps=no
   1.678  preserve_args=
   1.679  lo2o="s/\\.lo\$/.${objext}/"
   1.680  o2lo="s/\\.${objext}\$/.lo/"
   1.681 -
   1.682 -#####################################
   1.683 -# Shell function definitions:
   1.684 -# This seems to be the best place for them
   1.685 -
   1.686 -# func_mktempdir [string]
   1.687 -# Make a temporary directory that won't clash with other running
   1.688 -# libtool processes, and avoids race conditions if possible.  If
   1.689 -# given, STRING is the basename for that directory.
   1.690 -func_mktempdir ()
   1.691 +extracted_archives=
   1.692 +extracted_serial=0
   1.693 +
   1.694 +opt_dry_run=false
   1.695 +opt_duplicate_deps=false
   1.696 +opt_silent=false
   1.697 +opt_debug=:
   1.698 +
   1.699 +# If this variable is set in any of the actions, the command in it
   1.700 +# will be execed at the end.  This prevents here-documents from being
   1.701 +# left over by shells.
   1.702 +exec_cmd=
   1.703 +
   1.704 +# func_fatal_configuration arg...
   1.705 +# Echo program name prefixed message to standard error, followed by
   1.706 +# a configuration failure hint, and exit.
   1.707 +func_fatal_configuration ()
   1.708  {
   1.709 -    my_template="${TMPDIR-/tmp}/${1-$progname}"
   1.710 -
   1.711 -    if test "$run" = ":"; then
   1.712 -      # Return a directory name, but don't create it in dry-run mode
   1.713 -      my_tmpdir="${my_template}-$$"
   1.714 +    func_error ${1+"$@"}
   1.715 +    func_error "See the $PACKAGE documentation for more information."
   1.716 +    func_fatal_error "Fatal configuration error."
   1.717 +}
   1.718 +
   1.719 +
   1.720 +# func_config
   1.721 +# Display the configuration for all the tags in this script.
   1.722 +func_config ()
   1.723 +{
   1.724 +    re_begincf='^# ### BEGIN LIBTOOL'
   1.725 +    re_endcf='^# ### END LIBTOOL'
   1.726 +
   1.727 +    # Default configuration.
   1.728 +    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
   1.729 +
   1.730 +    # Now print the configurations for the tags.
   1.731 +    for tagname in $taglist; do
   1.732 +      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
   1.733 +    done
   1.734 +
   1.735 +    exit $?
   1.736 +}
   1.737 +
   1.738 +# func_features
   1.739 +# Display the features supported by this script.
   1.740 +func_features ()
   1.741 +{
   1.742 +    $ECHO "host: $host"
   1.743 +    if test "$build_libtool_libs" = yes; then
   1.744 +      $ECHO "enable shared libraries"
   1.745      else
   1.746 -
   1.747 -      # If mktemp works, use that first and foremost
   1.748 -      my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
   1.749 -
   1.750 -      if test ! -d "$my_tmpdir"; then
   1.751 -	# Failing that, at least try and use $RANDOM to avoid a race
   1.752 -	my_tmpdir="${my_template}-${RANDOM-0}$$"
   1.753 -
   1.754 -	save_mktempdir_umask=`umask`
   1.755 -	umask 0077
   1.756 -	$mkdir "$my_tmpdir"
   1.757 -	umask $save_mktempdir_umask
   1.758 -      fi
   1.759 -
   1.760 -      # If we're not in dry-run mode, bomb out on failure
   1.761 -      test -d "$my_tmpdir" || {
   1.762 -        $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
   1.763 -	exit $EXIT_FAILURE
   1.764 -      }
   1.765 +      $ECHO "disable shared libraries"
   1.766 +    fi
   1.767 +    if test "$build_old_libs" = yes; then
   1.768 +      $ECHO "enable static libraries"
   1.769 +    else
   1.770 +      $ECHO "disable static libraries"
   1.771      fi
   1.772  
   1.773 -    $echo "X$my_tmpdir" | $Xsed
   1.774 +    exit $?
   1.775  }
   1.776  
   1.777 -
   1.778 -# func_win32_libid arg
   1.779 -# return the library type of file 'arg'
   1.780 -#
   1.781 -# Need a lot of goo to handle *both* DLLs and import libs
   1.782 -# Has to be a shell function in order to 'eat' the argument
   1.783 -# that is supplied when $file_magic_command is called.
   1.784 -func_win32_libid ()
   1.785 +# func_enable_tag tagname
   1.786 +# Verify that TAGNAME is valid, and either flag an error and exit, or
   1.787 +# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
   1.788 +# variable here.
   1.789 +func_enable_tag ()
   1.790  {
   1.791 -  win32_libid_type="unknown"
   1.792 -  win32_fileres=`file -L $1 2>/dev/null`
   1.793 -  case $win32_fileres in
   1.794 -  *ar\ archive\ import\ library*) # definitely import
   1.795 -    win32_libid_type="x86 archive import"
   1.796 +  # Global variable:
   1.797 +  tagname="$1"
   1.798 +
   1.799 +  re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
   1.800 +  re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
   1.801 +  sed_extractcf="/$re_begincf/,/$re_endcf/p"
   1.802 +
   1.803 +  # Validate tagname.
   1.804 +  case $tagname in
   1.805 +    *[!-_A-Za-z0-9,/]*)
   1.806 +      func_fatal_error "invalid tag name: $tagname"
   1.807 +      ;;
   1.808 +  esac
   1.809 +
   1.810 +  # Don't test for the "default" C tag, as we know it's
   1.811 +  # there but not specially marked.
   1.812 +  case $tagname in
   1.813 +    CC) ;;
   1.814 +    *)
   1.815 +      if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
   1.816 +	taglist="$taglist $tagname"
   1.817 +
   1.818 +	# Evaluate the configuration.  Be careful to quote the path
   1.819 +	# and the sed script, to avoid splitting on whitespace, but
   1.820 +	# also don't use non-portable quotes within backquotes within
   1.821 +	# quotes we have to do it in 2 steps:
   1.822 +	extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
   1.823 +	eval "$extractedcf"
   1.824 +      else
   1.825 +	func_error "ignoring unknown tag $tagname"
   1.826 +      fi
   1.827 +      ;;
   1.828 +  esac
   1.829 +}
   1.830 +
   1.831 +# Parse options once, thoroughly.  This comes as soon as possible in
   1.832 +# the script to make things like `libtool --version' happen quickly.
   1.833 +{
   1.834 +
   1.835 +  # Shorthand for --mode=foo, only valid as the first argument
   1.836 +  case $1 in
   1.837 +  clean|clea|cle|cl)
   1.838 +    shift; set dummy --mode clean ${1+"$@"}; shift
   1.839      ;;
   1.840 -  *ar\ archive*) # could be an import, or static
   1.841 -    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
   1.842 -      $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
   1.843 -      win32_nmres=`eval $NM -f posix -A $1 | \
   1.844 -	$SED -n -e '1,100{/ I /{s,.*,import,;p;q;};}'`
   1.845 -      case $win32_nmres in
   1.846 -      import*)  win32_libid_type="x86 archive import";;
   1.847 -      *)        win32_libid_type="x86 archive static";;
   1.848 -      esac
   1.849 -    fi
   1.850 +  compile|compil|compi|comp|com|co|c)
   1.851 +    shift; set dummy --mode compile ${1+"$@"}; shift
   1.852 +    ;;
   1.853 +  execute|execut|execu|exec|exe|ex|e)
   1.854 +    shift; set dummy --mode execute ${1+"$@"}; shift
   1.855 +    ;;
   1.856 +  finish|finis|fini|fin|fi|f)
   1.857 +    shift; set dummy --mode finish ${1+"$@"}; shift
   1.858      ;;
   1.859 -  *DLL*)
   1.860 -    win32_libid_type="x86 DLL"
   1.861 +  install|instal|insta|inst|ins|in|i)
   1.862 +    shift; set dummy --mode install ${1+"$@"}; shift
   1.863      ;;
   1.864 -  *executable*) # but shell scripts are "executable" too...
   1.865 -    case $win32_fileres in
   1.866 -    *MS\ Windows\ PE\ Intel*)
   1.867 -      win32_libid_type="x86 DLL"
   1.868 -      ;;
   1.869 -    esac
   1.870 +  link|lin|li|l)
   1.871 +    shift; set dummy --mode link ${1+"$@"}; shift
   1.872 +    ;;
   1.873 +  uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
   1.874 +    shift; set dummy --mode uninstall ${1+"$@"}; shift
   1.875      ;;
   1.876    esac
   1.877 -  $echo $win32_libid_type
   1.878 +
   1.879 +  # Parse non-mode specific arguments:
   1.880 +  while test "$#" -gt 0; do
   1.881 +    opt="$1"
   1.882 +    shift
   1.883 +
   1.884 +    case $opt in
   1.885 +      --config)		func_config					;;
   1.886 +
   1.887 +      --debug)		preserve_args="$preserve_args $opt"
   1.888 +			func_echo "enabling shell trace mode"
   1.889 +			opt_debug='set -x'
   1.890 +			$opt_debug
   1.891 +			;;
   1.892 +
   1.893 +      -dlopen)		test "$#" -eq 0 && func_missing_arg "$opt" && break
   1.894 +			execute_dlfiles="$execute_dlfiles $1"
   1.895 +			shift
   1.896 +			;;
   1.897 +
   1.898 +      --dry-run | -n)	opt_dry_run=:					;;
   1.899 +      --features)       func_features					;;
   1.900 +      --finish)		mode="finish"					;;
   1.901 +
   1.902 +      --mode)		test "$#" -eq 0 && func_missing_arg "$opt" && break
   1.903 +			case $1 in
   1.904 +			  # Valid mode arguments:
   1.905 +			  clean)	;;
   1.906 +			  compile)	;;
   1.907 +			  execute)	;;
   1.908 +			  finish)	;;
   1.909 +			  install)	;;
   1.910 +			  link)		;;
   1.911 +			  relink)	;;
   1.912 +			  uninstall)	;;
   1.913 +
   1.914 +			  # Catch anything else as an error
   1.915 +			  *) func_error "invalid argument for $opt"
   1.916 +			     exit_cmd=exit
   1.917 +			     break
   1.918 +			     ;;
   1.919 +		        esac
   1.920 +
   1.921 +			mode="$1"
   1.922 +			shift
   1.923 +			;;
   1.924 +
   1.925 +      --preserve-dup-deps)
   1.926 +			opt_duplicate_deps=:				;;
   1.927 +
   1.928 +      --quiet|--silent)	preserve_args="$preserve_args $opt"
   1.929 +			opt_silent=:
   1.930 +			;;
   1.931 +
   1.932 +      --verbose| -v)	preserve_args="$preserve_args $opt"
   1.933 +			opt_silent=false
   1.934 +			;;
   1.935 +
   1.936 +      --tag)		test "$#" -eq 0 && func_missing_arg "$opt" && break
   1.937 +			preserve_args="$preserve_args $opt $1"
   1.938 +			func_enable_tag "$1"	# tagname is set here
   1.939 +			shift
   1.940 +			;;
   1.941 +
   1.942 +      # Separate optargs to long options:
   1.943 +      -dlopen=*|--mode=*|--tag=*)
   1.944 +			func_opt_split "$opt"
   1.945 +			set dummy "$func_opt_split_opt" "$func_opt_split_arg" ${1+"$@"}
   1.946 +			shift
   1.947 +			;;
   1.948 +
   1.949 +      -\?|-h)		func_usage					;;
   1.950 +      --help)		opt_help=:					;;
   1.951 +      --version)	func_version					;;
   1.952 +
   1.953 +      -*)		func_fatal_help "unrecognized option \`$opt'"	;;
   1.954 +
   1.955 +      *)		nonopt="$opt"
   1.956 +			break
   1.957 +			;;
   1.958 +    esac
   1.959 +  done
   1.960 +
   1.961 +
   1.962 +  case $host in
   1.963 +    *cygwin* | *mingw* | *pw32* | *cegcc*)
   1.964 +      # don't eliminate duplications in $postdeps and $predeps
   1.965 +      opt_duplicate_compiler_generated_deps=:
   1.966 +      ;;
   1.967 +    *)
   1.968 +      opt_duplicate_compiler_generated_deps=$opt_duplicate_deps
   1.969 +      ;;
   1.970 +  esac
   1.971 +
   1.972 +  # Having warned about all mis-specified options, bail out if
   1.973 +  # anything was wrong.
   1.974 +  $exit_cmd $EXIT_FAILURE
   1.975 +}
   1.976 +
   1.977 +# func_check_version_match
   1.978 +# Ensure that we are using m4 macros, and libtool script from the same
   1.979 +# release of libtool.
   1.980 +func_check_version_match ()
   1.981 +{
   1.982 +  if test "$package_revision" != "$macro_revision"; then
   1.983 +    if test "$VERSION" != "$macro_version"; then
   1.984 +      if test -z "$macro_version"; then
   1.985 +        cat >&2 <<_LT_EOF
   1.986 +$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
   1.987 +$progname: definition of this LT_INIT comes from an older release.
   1.988 +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
   1.989 +$progname: and run autoconf again.
   1.990 +_LT_EOF
   1.991 +      else
   1.992 +        cat >&2 <<_LT_EOF
   1.993 +$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
   1.994 +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
   1.995 +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
   1.996 +$progname: and run autoconf again.
   1.997 +_LT_EOF
   1.998 +      fi
   1.999 +    else
  1.1000 +      cat >&2 <<_LT_EOF
  1.1001 +$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
  1.1002 +$progname: but the definition of this LT_INIT comes from revision $macro_revision.
  1.1003 +$progname: You should recreate aclocal.m4 with macros from revision $package_revision
  1.1004 +$progname: of $PACKAGE $VERSION and run autoconf again.
  1.1005 +_LT_EOF
  1.1006 +    fi
  1.1007 +
  1.1008 +    exit $EXIT_MISMATCH
  1.1009 +  fi
  1.1010 +}
  1.1011 +
  1.1012 +
  1.1013 +## ----------- ##
  1.1014 +##    Main.    ##
  1.1015 +## ----------- ##
  1.1016 +
  1.1017 +$opt_help || {
  1.1018 +  # Sanity checks first:
  1.1019 +  func_check_version_match
  1.1020 +
  1.1021 +  if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
  1.1022 +    func_fatal_configuration "not configured to build any kind of library"
  1.1023 +  fi
  1.1024 +
  1.1025 +  test -z "$mode" && func_fatal_error "error: you must specify a MODE."
  1.1026 +
  1.1027 +
  1.1028 +  # Darwin sucks
  1.1029 +  eval std_shrext=\"$shrext_cmds\"
  1.1030 +
  1.1031 +
  1.1032 +  # Only execute mode is allowed to have -dlopen flags.
  1.1033 +  if test -n "$execute_dlfiles" && test "$mode" != execute; then
  1.1034 +    func_error "unrecognized option \`-dlopen'"
  1.1035 +    $ECHO "$help" 1>&2
  1.1036 +    exit $EXIT_FAILURE
  1.1037 +  fi
  1.1038 +
  1.1039 +  # Change the help message to a mode-specific one.
  1.1040 +  generic_help="$help"
  1.1041 +  help="Try \`$progname --help --mode=$mode' for more information."
  1.1042 +}
  1.1043 +
  1.1044 +
  1.1045 +# func_lalib_p file
  1.1046 +# True iff FILE is a libtool `.la' library or `.lo' object file.
  1.1047 +# This function is only a basic sanity check; it will hardly flush out
  1.1048 +# determined imposters.
  1.1049 +func_lalib_p ()
  1.1050 +{
  1.1051 +    test -f "$1" &&
  1.1052 +      $SED -e 4q "$1" 2>/dev/null \
  1.1053 +        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
  1.1054 +}
  1.1055 +
  1.1056 +# func_lalib_unsafe_p file
  1.1057 +# True iff FILE is a libtool `.la' library or `.lo' object file.
  1.1058 +# This function implements the same check as func_lalib_p without
  1.1059 +# resorting to external programs.  To this end, it redirects stdin and
  1.1060 +# closes it afterwards, without saving the original file descriptor.
  1.1061 +# As a safety measure, use it only where a negative result would be
  1.1062 +# fatal anyway.  Works if `file' does not exist.
  1.1063 +func_lalib_unsafe_p ()
  1.1064 +{
  1.1065 +    lalib_p=no
  1.1066 +    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
  1.1067 +	for lalib_p_l in 1 2 3 4
  1.1068 +	do
  1.1069 +	    read lalib_p_line
  1.1070 +	    case "$lalib_p_line" in
  1.1071 +		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
  1.1072 +	    esac
  1.1073 +	done
  1.1074 +	exec 0<&5 5<&-
  1.1075 +    fi
  1.1076 +    test "$lalib_p" = yes
  1.1077 +}
  1.1078 +
  1.1079 +# func_ltwrapper_script_p file
  1.1080 +# True iff FILE is a libtool wrapper script
  1.1081 +# This function is only a basic sanity check; it will hardly flush out
  1.1082 +# determined imposters.
  1.1083 +func_ltwrapper_script_p ()
  1.1084 +{
  1.1085 +    func_lalib_p "$1"
  1.1086 +}
  1.1087 +
  1.1088 +# func_ltwrapper_executable_p file
  1.1089 +# True iff FILE is a libtool wrapper executable
  1.1090 +# This function is only a basic sanity check; it will hardly flush out
  1.1091 +# determined imposters.
  1.1092 +func_ltwrapper_executable_p ()
  1.1093 +{
  1.1094 +    func_ltwrapper_exec_suffix=
  1.1095 +    case $1 in
  1.1096 +    *.exe) ;;
  1.1097 +    *) func_ltwrapper_exec_suffix=.exe ;;
  1.1098 +    esac
  1.1099 +    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
  1.1100 +}
  1.1101 +
  1.1102 +# func_ltwrapper_scriptname file
  1.1103 +# Assumes file is an ltwrapper_executable
  1.1104 +# uses $file to determine the appropriate filename for a
  1.1105 +# temporary ltwrapper_script.
  1.1106 +func_ltwrapper_scriptname ()
  1.1107 +{
  1.1108 +    func_ltwrapper_scriptname_result=""
  1.1109 +    if func_ltwrapper_executable_p "$1"; then
  1.1110 +	func_dirname_and_basename "$1" "" "."
  1.1111 +	func_stripname '' '.exe' "$func_basename_result"
  1.1112 +	func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
  1.1113 +    fi
  1.1114 +}
  1.1115 +
  1.1116 +# func_ltwrapper_p file
  1.1117 +# True iff FILE is a libtool wrapper script or wrapper executable
  1.1118 +# This function is only a basic sanity check; it will hardly flush out
  1.1119 +# determined imposters.
  1.1120 +func_ltwrapper_p ()
  1.1121 +{
  1.1122 +    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
  1.1123 +}
  1.1124 +
  1.1125 +
  1.1126 +# func_execute_cmds commands fail_cmd
  1.1127 +# Execute tilde-delimited COMMANDS.
  1.1128 +# If FAIL_CMD is given, eval that upon failure.
  1.1129 +# FAIL_CMD may read-access the current command in variable CMD!
  1.1130 +func_execute_cmds ()
  1.1131 +{
  1.1132 +    $opt_debug
  1.1133 +    save_ifs=$IFS; IFS='~'
  1.1134 +    for cmd in $1; do
  1.1135 +      IFS=$save_ifs
  1.1136 +      eval cmd=\"$cmd\"
  1.1137 +      func_show_eval "$cmd" "${2-:}"
  1.1138 +    done
  1.1139 +    IFS=$save_ifs
  1.1140 +}
  1.1141 +
  1.1142 +
  1.1143 +# func_source file
  1.1144 +# Source FILE, adding directory component if necessary.
  1.1145 +# Note that it is not necessary on cygwin/mingw to append a dot to
  1.1146 +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
  1.1147 +# behavior happens only for exec(3), not for open(2)!  Also, sourcing
  1.1148 +# `FILE.' does not work on cygwin managed mounts.
  1.1149 +func_source ()
  1.1150 +{
  1.1151 +    $opt_debug
  1.1152 +    case $1 in
  1.1153 +    */* | *\\*)	. "$1" ;;
  1.1154 +    *)		. "./$1" ;;
  1.1155 +    esac
  1.1156  }
  1.1157  
  1.1158  
  1.1159 @@ -227,39 +1009,32 @@
  1.1160  # arg is usually of the form 'gcc ...'
  1.1161  func_infer_tag ()
  1.1162  {
  1.1163 +    $opt_debug
  1.1164      if test -n "$available_tags" && test -z "$tagname"; then
  1.1165        CC_quoted=
  1.1166        for arg in $CC; do
  1.1167 -	case $arg in
  1.1168 -	  *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.1169 -	  arg="\"$arg\""
  1.1170 -	  ;;
  1.1171 -	esac
  1.1172 -	CC_quoted="$CC_quoted $arg"
  1.1173 +        func_quote_for_eval "$arg"
  1.1174 +	CC_quoted="$CC_quoted $func_quote_for_eval_result"
  1.1175        done
  1.1176        case $@ in
  1.1177        # Blanks in the command may have been stripped by the calling shell,
  1.1178        # but not from the CC environment variable when configure was run.
  1.1179 -      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
  1.1180 +      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*) ;;
  1.1181        # Blanks at the start of $base_compile will cause this to fail
  1.1182        # if we don't check for them as well.
  1.1183        *)
  1.1184  	for z in $available_tags; do
  1.1185 -	  if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  1.1186 +	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
  1.1187  	    # Evaluate the configuration.
  1.1188  	    eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
  1.1189  	    CC_quoted=
  1.1190  	    for arg in $CC; do
  1.1191 -	    # Double-quote args containing other shell metacharacters.
  1.1192 -	    case $arg in
  1.1193 -	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.1194 -	      arg="\"$arg\""
  1.1195 -	      ;;
  1.1196 -	    esac
  1.1197 -	    CC_quoted="$CC_quoted $arg"
  1.1198 -	  done
  1.1199 +	      # Double-quote args containing other shell metacharacters.
  1.1200 +	      func_quote_for_eval "$arg"
  1.1201 +	      CC_quoted="$CC_quoted $func_quote_for_eval_result"
  1.1202 +	    done
  1.1203  	    case "$@ " in
  1.1204 -	      " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
  1.1205 +	      " $CC "* | "$CC "* | " `$ECHO $CC` "* | "`$ECHO $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$ECHO $CC_quoted` "* | "`$ECHO $CC_quoted` "*)
  1.1206  	      # The compiler in the base compile command matches
  1.1207  	      # the one in the tagged configuration.
  1.1208  	      # Assume this is the tagged configuration we want.
  1.1209 @@ -273,11 +1048,10 @@
  1.1210  	# was found and let the user know that the "--tag" command
  1.1211  	# line option must be used.
  1.1212  	if test -z "$tagname"; then
  1.1213 -	  $echo "$modename: unable to infer tagged configuration"
  1.1214 -	  $echo "$modename: specify a tag with \`--tag'" 1>&2
  1.1215 -	  exit $EXIT_FAILURE
  1.1216 -#        else
  1.1217 -#          $echo "$modename: using $tagname tagged configuration"
  1.1218 +	  func_echo "unable to infer tagged configuration"
  1.1219 +	  func_fatal_error "specify a tag with \`--tag'"
  1.1220 +#	else
  1.1221 +#	  func_verbose "using $tagname tagged configuration"
  1.1222  	fi
  1.1223  	;;
  1.1224        esac
  1.1225 @@ -285,343 +1059,48 @@
  1.1226  }
  1.1227  
  1.1228  
  1.1229 -# func_extract_an_archive dir oldlib
  1.1230 -func_extract_an_archive ()
  1.1231 +
  1.1232 +# func_write_libtool_object output_name pic_name nonpic_name
  1.1233 +# Create a libtool object file (analogous to a ".la" file),
  1.1234 +# but don't create it if we're doing a dry run.
  1.1235 +func_write_libtool_object ()
  1.1236  {
  1.1237 -    f_ex_an_ar_dir="$1"; shift
  1.1238 -    f_ex_an_ar_oldlib="$1"
  1.1239 -
  1.1240 -    $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
  1.1241 -    $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
  1.1242 -    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
  1.1243 -     :
  1.1244 +    write_libobj=${1}
  1.1245 +    if test "$build_libtool_libs" = yes; then
  1.1246 +      write_lobj=\'${2}\'
  1.1247      else
  1.1248 -      $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
  1.1249 -      exit $EXIT_FAILURE
  1.1250 +      write_lobj=none
  1.1251      fi
  1.1252 -}
  1.1253 -
  1.1254 -# func_extract_archives gentop oldlib ...
  1.1255 -func_extract_archives ()
  1.1256 -{
  1.1257 -    my_gentop="$1"; shift
  1.1258 -    my_oldlibs=${1+"$@"}
  1.1259 -    my_oldobjs=""
  1.1260 -    my_xlib=""
  1.1261 -    my_xabs=""
  1.1262 -    my_xdir=""
  1.1263 -    my_status=""
  1.1264 -
  1.1265 -    $show "${rm}r $my_gentop"
  1.1266 -    $run ${rm}r "$my_gentop"
  1.1267 -    $show "$mkdir $my_gentop"
  1.1268 -    $run $mkdir "$my_gentop"
  1.1269 -    my_status=$?
  1.1270 -    if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
  1.1271 -      exit $my_status
  1.1272 +
  1.1273 +    if test "$build_old_libs" = yes; then
  1.1274 +      write_oldobj=\'${3}\'
  1.1275 +    else
  1.1276 +      write_oldobj=none
  1.1277      fi
  1.1278  
  1.1279 -    for my_xlib in $my_oldlibs; do
  1.1280 -      # Extract the objects.
  1.1281 -      case $my_xlib in
  1.1282 -	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
  1.1283 -	*) my_xabs=`pwd`"/$my_xlib" ;;
  1.1284 -      esac
  1.1285 -      my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
  1.1286 -      my_xdir="$my_gentop/$my_xlib"
  1.1287 -
  1.1288 -      $show "${rm}r $my_xdir"
  1.1289 -      $run ${rm}r "$my_xdir"
  1.1290 -      $show "$mkdir $my_xdir"
  1.1291 -      $run $mkdir "$my_xdir"
  1.1292 -      exit_status=$?
  1.1293 -      if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
  1.1294 -	exit $exit_status
  1.1295 -      fi
  1.1296 -      case $host in
  1.1297 -      *-darwin*)
  1.1298 -	$show "Extracting $my_xabs"
  1.1299 -	# Do not bother doing anything if just a dry run
  1.1300 -	if test -z "$run"; then
  1.1301 -	  darwin_orig_dir=`pwd`
  1.1302 -	  cd $my_xdir || exit $?
  1.1303 -	  darwin_archive=$my_xabs
  1.1304 -	  darwin_curdir=`pwd`
  1.1305 -	  darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
  1.1306 -	  darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
  1.1307 -	  if test -n "$darwin_arches"; then 
  1.1308 -	    darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
  1.1309 -	    darwin_arch=
  1.1310 -	    $show "$darwin_base_archive has multiple architectures $darwin_arches"
  1.1311 -	    for darwin_arch in  $darwin_arches ; do
  1.1312 -	      mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
  1.1313 -	      lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
  1.1314 -	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
  1.1315 -	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
  1.1316 -	      cd "$darwin_curdir"
  1.1317 -	      $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
  1.1318 -	    done # $darwin_arches
  1.1319 -      ## Okay now we have a bunch of thin objects, gotta fatten them up :)
  1.1320 -	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
  1.1321 -	    darwin_file=
  1.1322 -	    darwin_files=
  1.1323 -	    for darwin_file in $darwin_filelist; do
  1.1324 -	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
  1.1325 -	      lipo -create -output "$darwin_file" $darwin_files
  1.1326 -	    done # $darwin_filelist
  1.1327 -	    ${rm}r unfat-$$
  1.1328 -	    cd "$darwin_orig_dir"
  1.1329 -	  else
  1.1330 -	    cd "$darwin_orig_dir"
  1.1331 - 	    func_extract_an_archive "$my_xdir" "$my_xabs"
  1.1332 -	  fi # $darwin_arches
  1.1333 -	fi # $run
  1.1334 -	;;
  1.1335 -      *)
  1.1336 -        func_extract_an_archive "$my_xdir" "$my_xabs"
  1.1337 -        ;;
  1.1338 -      esac
  1.1339 -      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
  1.1340 -    done
  1.1341 -    func_extract_archives_result="$my_oldobjs"
  1.1342 +    $opt_dry_run || {
  1.1343 +      cat >${write_libobj}T <<EOF
  1.1344 +# $write_libobj - a libtool object file
  1.1345 +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  1.1346 +#
  1.1347 +# Please DO NOT delete this file!
  1.1348 +# It is necessary for linking the library.
  1.1349 +
  1.1350 +# Name of the PIC object.
  1.1351 +pic_object=$write_lobj
  1.1352 +
  1.1353 +# Name of the non-PIC object
  1.1354 +non_pic_object=$write_oldobj
  1.1355 +
  1.1356 +EOF
  1.1357 +      $MV "${write_libobj}T" "${write_libobj}"
  1.1358 +    }
  1.1359  }
  1.1360 -# End of Shell function definitions
  1.1361 -#####################################
  1.1362 -
  1.1363 -# Darwin sucks
  1.1364 -eval std_shrext=\"$shrext_cmds\"
  1.1365 -
  1.1366 -disable_libs=no
  1.1367 -
  1.1368 -# Parse our command line options once, thoroughly.
  1.1369 -while test "$#" -gt 0
  1.1370 -do
  1.1371 -  arg="$1"
  1.1372 -  shift
  1.1373 -
  1.1374 -  case $arg in
  1.1375 -  -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
  1.1376 -  *) optarg= ;;
  1.1377 -  esac
  1.1378 -
  1.1379 -  # If the previous option needs an argument, assign it.
  1.1380 -  if test -n "$prev"; then
  1.1381 -    case $prev in
  1.1382 -    execute_dlfiles)
  1.1383 -      execute_dlfiles="$execute_dlfiles $arg"
  1.1384 -      ;;
  1.1385 -    tag)
  1.1386 -      tagname="$arg"
  1.1387 -      preserve_args="${preserve_args}=$arg"
  1.1388 -
  1.1389 -      # Check whether tagname contains only valid characters
  1.1390 -      case $tagname in
  1.1391 -      *[!-_A-Za-z0-9,/]*)
  1.1392 -	$echo "$progname: invalid tag name: $tagname" 1>&2
  1.1393 -	exit $EXIT_FAILURE
  1.1394 -	;;
  1.1395 -      esac
  1.1396 -
  1.1397 -      case $tagname in
  1.1398 -      CC)
  1.1399 -	# Don't test for the "default" C tag, as we know, it's there, but
  1.1400 -	# not specially marked.
  1.1401 -	;;
  1.1402 -      *)
  1.1403 -	if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
  1.1404 -	  taglist="$taglist $tagname"
  1.1405 -	  # Evaluate the configuration.
  1.1406 -	  eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
  1.1407 -	else
  1.1408 -	  $echo "$progname: ignoring unknown tag $tagname" 1>&2
  1.1409 -	fi
  1.1410 -	;;
  1.1411 -      esac
  1.1412 -      ;;
  1.1413 -    *)
  1.1414 -      eval "$prev=\$arg"
  1.1415 -      ;;
  1.1416 -    esac
  1.1417 -
  1.1418 -    prev=
  1.1419 -    prevopt=
  1.1420 -    continue
  1.1421 -  fi
  1.1422 -
  1.1423 -  # Have we seen a non-optional argument yet?
  1.1424 -  case $arg in
  1.1425 -  --help)
  1.1426 -    show_help=yes
  1.1427 -    ;;
  1.1428 -
  1.1429 -  --version)
  1.1430 -    $echo "$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP"
  1.1431 -    $echo
  1.1432 -    $echo "Copyright (C) 2005  Free Software Foundation, Inc."
  1.1433 -    $echo "This is free software; see the source for copying conditions.  There is NO"
  1.1434 -    $echo "warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
  1.1435 -    exit $?
  1.1436 -    ;;
  1.1437 -
  1.1438 -  --config)
  1.1439 -    ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
  1.1440 -    # Now print the configurations for the tags.
  1.1441 -    for tagname in $taglist; do
  1.1442 -      ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
  1.1443 -    done
  1.1444 -    exit $?
  1.1445 -    ;;
  1.1446 -
  1.1447 -  --debug)
  1.1448 -    $echo "$progname: enabling shell trace mode"
  1.1449 -    set -x
  1.1450 -    preserve_args="$preserve_args $arg"
  1.1451 -    ;;
  1.1452 -
  1.1453 -  --dry-run | -n)
  1.1454 -    run=:
  1.1455 -    ;;
  1.1456 -
  1.1457 -  --features)
  1.1458 -    $echo "host: $host"
  1.1459 -    if test "$build_libtool_libs" = yes; then
  1.1460 -      $echo "enable shared libraries"
  1.1461 -    else
  1.1462 -      $echo "disable shared libraries"
  1.1463 -    fi
  1.1464 -    if test "$build_old_libs" = yes; then
  1.1465 -      $echo "enable static libraries"
  1.1466 -    else
  1.1467 -      $echo "disable static libraries"
  1.1468 -    fi
  1.1469 -    exit $?
  1.1470 -    ;;
  1.1471 -
  1.1472 -  --finish) mode="finish" ;;
  1.1473 -
  1.1474 -  --mode) prevopt="--mode" prev=mode ;;
  1.1475 -  --mode=*) mode="$optarg" ;;
  1.1476 -
  1.1477 -  --preserve-dup-deps) duplicate_deps="yes" ;;
  1.1478 -
  1.1479 -  --quiet | --silent)
  1.1480 -    show=:
  1.1481 -    preserve_args="$preserve_args $arg"
  1.1482 -    ;;
  1.1483 -
  1.1484 -  --tag)
  1.1485 -    prevopt="--tag"
  1.1486 -    prev=tag
  1.1487 -    preserve_args="$preserve_args --tag"
  1.1488 -    ;;
  1.1489 -  --tag=*)
  1.1490 -    set tag "$optarg" ${1+"$@"}
  1.1491 -    shift
  1.1492 -    prev=tag
  1.1493 -    preserve_args="$preserve_args --tag"
  1.1494 -    ;;
  1.1495 -
  1.1496 -  -dlopen)
  1.1497 -    prevopt="-dlopen"
  1.1498 -    prev=execute_dlfiles
  1.1499 -    ;;
  1.1500 -
  1.1501 -  -*)
  1.1502 -    $echo "$modename: unrecognized option \`$arg'" 1>&2
  1.1503 -    $echo "$help" 1>&2
  1.1504 -    exit $EXIT_FAILURE
  1.1505 -    ;;
  1.1506 -
  1.1507 -  *)
  1.1508 -    nonopt="$arg"
  1.1509 -    break
  1.1510 -    ;;
  1.1511 -  esac
  1.1512 -done
  1.1513 -
  1.1514 -if test -n "$prevopt"; then
  1.1515 -  $echo "$modename: option \`$prevopt' requires an argument" 1>&2
  1.1516 -  $echo "$help" 1>&2
  1.1517 -  exit $EXIT_FAILURE
  1.1518 -fi
  1.1519 -
  1.1520 -case $disable_libs in
  1.1521 -no) 
  1.1522 -  ;;
  1.1523 -shared)
  1.1524 -  build_libtool_libs=no
  1.1525 -  build_old_libs=yes
  1.1526 -  ;;
  1.1527 -static)
  1.1528 -  build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
  1.1529 -  ;;
  1.1530 -esac
  1.1531 -
  1.1532 -# If this variable is set in any of the actions, the command in it
  1.1533 -# will be execed at the end.  This prevents here-documents from being
  1.1534 -# left over by shells.
  1.1535 -exec_cmd=
  1.1536 -
  1.1537 -if test -z "$show_help"; then
  1.1538 -
  1.1539 -  # Infer the operation mode.
  1.1540 -  if test -z "$mode"; then
  1.1541 -    $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
  1.1542 -    $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
  1.1543 -    case $nonopt in
  1.1544 -    *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
  1.1545 -      mode=link
  1.1546 -      for arg
  1.1547 -      do
  1.1548 -	case $arg in
  1.1549 -	-c)
  1.1550 -	   mode=compile
  1.1551 -	   break
  1.1552 -	   ;;
  1.1553 -	esac
  1.1554 -      done
  1.1555 -      ;;
  1.1556 -    *db | *dbx | *strace | *truss)
  1.1557 -      mode=execute
  1.1558 -      ;;
  1.1559 -    *install*|cp|mv)
  1.1560 -      mode=install
  1.1561 -      ;;
  1.1562 -    *rm)
  1.1563 -      mode=uninstall
  1.1564 -      ;;
  1.1565 -    *)
  1.1566 -      # If we have no mode, but dlfiles were specified, then do execute mode.
  1.1567 -      test -n "$execute_dlfiles" && mode=execute
  1.1568 -
  1.1569 -      # Just use the default operation mode.
  1.1570 -      if test -z "$mode"; then
  1.1571 -	if test -n "$nonopt"; then
  1.1572 -	  $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
  1.1573 -	else
  1.1574 -	  $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
  1.1575 -	fi
  1.1576 -      fi
  1.1577 -      ;;
  1.1578 -    esac
  1.1579 -  fi
  1.1580 -
  1.1581 -  # Only execute mode is allowed to have -dlopen flags.
  1.1582 -  if test -n "$execute_dlfiles" && test "$mode" != execute; then
  1.1583 -    $echo "$modename: unrecognized option \`-dlopen'" 1>&2
  1.1584 -    $echo "$help" 1>&2
  1.1585 -    exit $EXIT_FAILURE
  1.1586 -  fi
  1.1587 -
  1.1588 -  # Change the help message to a mode-specific one.
  1.1589 -  generic_help="$help"
  1.1590 -  help="Try \`$modename --help --mode=$mode' for more information."
  1.1591 -
  1.1592 -  # These modes are in order of execution frequency so that they run quickly.
  1.1593 -  case $mode in
  1.1594 -  # libtool compile mode
  1.1595 -  compile)
  1.1596 -    modename="$modename: compile"
  1.1597 +
  1.1598 +# func_mode_compile arg...
  1.1599 +func_mode_compile ()
  1.1600 +{
  1.1601 +    $opt_debug
  1.1602      # Get the compilation command and the source file.
  1.1603      base_compile=
  1.1604      srcfile="$nonopt"  #  always keep a non-empty value in "srcfile"
  1.1605 @@ -630,6 +1109,7 @@
  1.1606      arg_mode=normal
  1.1607      libobj=
  1.1608      later=
  1.1609 +    pie_flag=
  1.1610  
  1.1611      for arg
  1.1612      do
  1.1613 @@ -650,15 +1130,18 @@
  1.1614  	# Accept any command-line options.
  1.1615  	case $arg in
  1.1616  	-o)
  1.1617 -	  if test -n "$libobj" ; then
  1.1618 -	    $echo "$modename: you cannot specify \`-o' more than once" 1>&2
  1.1619 -	    exit $EXIT_FAILURE
  1.1620 -	  fi
  1.1621 +	  test -n "$libobj" && \
  1.1622 +	    func_fatal_error "you cannot specify \`-o' more than once"
  1.1623  	  arg_mode=target
  1.1624  	  continue
  1.1625  	  ;;
  1.1626  
  1.1627 -	-static | -prefer-pic | -prefer-non-pic)
  1.1628 +	-pie | -fpie | -fPIE)
  1.1629 +          pie_flag="$pie_flag $arg"
  1.1630 +	  continue
  1.1631 +	  ;;
  1.1632 +
  1.1633 +	-shared | -static | -prefer-pic | -prefer-non-pic)
  1.1634  	  later="$later $arg"
  1.1635  	  continue
  1.1636  	  ;;
  1.1637 @@ -674,31 +1157,25 @@
  1.1638  	  ;;            #  replaced later.  I would guess that would be a bug.
  1.1639  
  1.1640  	-Wc,*)
  1.1641 -	  args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
  1.1642 +	  func_stripname '-Wc,' '' "$arg"
  1.1643 +	  args=$func_stripname_result
  1.1644  	  lastarg=
  1.1645  	  save_ifs="$IFS"; IFS=','
  1.1646 - 	  for arg in $args; do
  1.1647 +	  for arg in $args; do
  1.1648  	    IFS="$save_ifs"
  1.1649 -
  1.1650 -	    # Double-quote args containing other shell metacharacters.
  1.1651 -	    # Many Bourne shells cannot handle close brackets correctly
  1.1652 -	    # in scan sets, so we specify it separately.
  1.1653 -	    case $arg in
  1.1654 -	      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.1655 -	      arg="\"$arg\""
  1.1656 -	      ;;
  1.1657 -	    esac
  1.1658 -	    lastarg="$lastarg $arg"
  1.1659 +	    func_quote_for_eval "$arg"
  1.1660 +	    lastarg="$lastarg $func_quote_for_eval_result"
  1.1661  	  done
  1.1662  	  IFS="$save_ifs"
  1.1663 -	  lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
  1.1664 +	  func_stripname ' ' '' "$lastarg"
  1.1665 +	  lastarg=$func_stripname_result
  1.1666  
  1.1667  	  # Add the arguments to base_compile.
  1.1668  	  base_compile="$base_compile $lastarg"
  1.1669  	  continue
  1.1670  	  ;;
  1.1671  
  1.1672 -	* )
  1.1673 +	*)
  1.1674  	  # Accept the current argument as the source file.
  1.1675  	  # The previous "srcfile" becomes the current argument.
  1.1676  	  #
  1.1677 @@ -710,64 +1187,42 @@
  1.1678        esac    #  case $arg_mode
  1.1679  
  1.1680        # Aesthetically quote the previous argument.
  1.1681 -      lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
  1.1682 -
  1.1683 -      case $lastarg in
  1.1684 -      # Double-quote args containing other shell metacharacters.
  1.1685 -      # Many Bourne shells cannot handle close brackets correctly
  1.1686 -      # in scan sets, and some SunOS ksh mistreat backslash-escaping
  1.1687 -      # in scan sets (worked around with variable expansion),
  1.1688 -      # and furthermore cannot handle '|' '&' '(' ')' in scan sets 
  1.1689 -      # at all, so we specify them separately.
  1.1690 -      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.1691 -	lastarg="\"$lastarg\""
  1.1692 -	;;
  1.1693 -      esac
  1.1694 -
  1.1695 -      base_compile="$base_compile $lastarg"
  1.1696 +      func_quote_for_eval "$lastarg"
  1.1697 +      base_compile="$base_compile $func_quote_for_eval_result"
  1.1698      done # for arg
  1.1699  
  1.1700      case $arg_mode in
  1.1701      arg)
  1.1702 -      $echo "$modename: you must specify an argument for -Xcompile"
  1.1703 -      exit $EXIT_FAILURE
  1.1704 +      func_fatal_error "you must specify an argument for -Xcompile"
  1.1705        ;;
  1.1706      target)
  1.1707 -      $echo "$modename: you must specify a target with \`-o'" 1>&2
  1.1708 -      exit $EXIT_FAILURE
  1.1709 +      func_fatal_error "you must specify a target with \`-o'"
  1.1710        ;;
  1.1711      *)
  1.1712        # Get the name of the library object.
  1.1713 -      [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
  1.1714 +      test -z "$libobj" && {
  1.1715 +	func_basename "$srcfile"
  1.1716 +	libobj="$func_basename_result"
  1.1717 +      }
  1.1718        ;;
  1.1719      esac
  1.1720  
  1.1721      # Recognize several different file suffixes.
  1.1722      # If the user specifies -o file.o, it is replaced with file.lo
  1.1723 -    xform='[cCFSifmso]'
  1.1724      case $libobj in
  1.1725 -    *.ada) xform=ada ;;
  1.1726 -    *.adb) xform=adb ;;
  1.1727 -    *.ads) xform=ads ;;
  1.1728 -    *.asm) xform=asm ;;
  1.1729 -    *.c++) xform=c++ ;;
  1.1730 -    *.cc) xform=cc ;;
  1.1731 -    *.ii) xform=ii ;;
  1.1732 -    *.class) xform=class ;;
  1.1733 -    *.cpp) xform=cpp ;;
  1.1734 -    *.cxx) xform=cxx ;;
  1.1735 -    *.f90) xform=f90 ;;
  1.1736 -    *.for) xform=for ;;
  1.1737 -    *.java) xform=java ;;
  1.1738 +    *.[cCFSifmso] | \
  1.1739 +    *.ada | *.adb | *.ads | *.asm | \
  1.1740 +    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
  1.1741 +    *.[fF][09]? | *.for | *.java | *.obj | *.sx)
  1.1742 +      func_xform "$libobj"
  1.1743 +      libobj=$func_xform_result
  1.1744 +      ;;
  1.1745      esac
  1.1746  
  1.1747 -    libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
  1.1748 -
  1.1749      case $libobj in
  1.1750 -    *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
  1.1751 +    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
  1.1752      *)
  1.1753 -      $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
  1.1754 -      exit $EXIT_FAILURE
  1.1755 +      func_fatal_error "cannot determine name of library object from \`$libobj'"
  1.1756        ;;
  1.1757      esac
  1.1758  
  1.1759 @@ -775,7 +1230,15 @@
  1.1760  
  1.1761      for arg in $later; do
  1.1762        case $arg in
  1.1763 +      -shared)
  1.1764 +	test "$build_libtool_libs" != yes && \
  1.1765 +	  func_fatal_configuration "can not build a shared library"
  1.1766 +	build_old_libs=no
  1.1767 +	continue
  1.1768 +	;;
  1.1769 +
  1.1770        -static)
  1.1771 +	build_libtool_libs=no
  1.1772  	build_old_libs=yes
  1.1773  	continue
  1.1774  	;;
  1.1775 @@ -792,28 +1255,17 @@
  1.1776        esac
  1.1777      done
  1.1778  
  1.1779 -    qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
  1.1780 -    case $qlibobj in
  1.1781 -      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.1782 -	qlibobj="\"$qlibobj\"" ;;
  1.1783 -    esac
  1.1784 -    test "X$libobj" != "X$qlibobj" \
  1.1785 -	&& $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' 	&()|`$[]' \
  1.1786 -	&& $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
  1.1787 -    objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
  1.1788 -    xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
  1.1789 -    if test "X$xdir" = "X$obj"; then
  1.1790 -      xdir=
  1.1791 -    else
  1.1792 -      xdir=$xdir/
  1.1793 -    fi
  1.1794 +    func_quote_for_eval "$libobj"
  1.1795 +    test "X$libobj" != "X$func_quote_for_eval_result" \
  1.1796 +      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'	 &()|`$[]' \
  1.1797 +      && func_warning "libobj name \`$libobj' may not contain shell special characters."
  1.1798 +    func_dirname_and_basename "$obj" "/" ""
  1.1799 +    objname="$func_basename_result"
  1.1800 +    xdir="$func_dirname_result"
  1.1801      lobj=${xdir}$objdir/$objname
  1.1802  
  1.1803 -    if test -z "$base_compile"; then
  1.1804 -      $echo "$modename: you must specify a compilation command" 1>&2
  1.1805 -      $echo "$help" 1>&2
  1.1806 -      exit $EXIT_FAILURE
  1.1807 -    fi
  1.1808 +    test -z "$base_compile" && \
  1.1809 +      func_fatal_help "you must specify a compilation command"
  1.1810  
  1.1811      # Delete any leftover library objects.
  1.1812      if test "$build_old_libs" = yes; then
  1.1813 @@ -822,12 +1274,9 @@
  1.1814        removelist="$lobj $libobj ${libobj}T"
  1.1815      fi
  1.1816  
  1.1817 -    $run $rm $removelist
  1.1818 -    trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
  1.1819 -
  1.1820      # On Cygwin there's no "real" PIC flag so we must build both object types
  1.1821      case $host_os in
  1.1822 -    cygwin* | mingw* | pw32* | os2*)
  1.1823 +    cygwin* | mingw* | pw32* | os2* | cegcc*)
  1.1824        pic_mode=default
  1.1825        ;;
  1.1826      esac
  1.1827 @@ -839,10 +1288,8 @@
  1.1828      # Calculate the filename of the output object if compiler does
  1.1829      # not support -o with -c
  1.1830      if test "$compiler_c_o" = no; then
  1.1831 -      output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
  1.1832 +      output_obj=`$ECHO "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
  1.1833        lockfile="$output_obj.lock"
  1.1834 -      removelist="$removelist $output_obj $lockfile"
  1.1835 -      trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
  1.1836      else
  1.1837        output_obj=
  1.1838        need_locks=no
  1.1839 @@ -852,13 +1299,13 @@
  1.1840      # Lock this critical section if it is needed
  1.1841      # We use this script file to make the link, it avoids creating a new file
  1.1842      if test "$need_locks" = yes; then
  1.1843 -      until $run ln "$progpath" "$lockfile" 2>/dev/null; do
  1.1844 -	$show "Waiting for $lockfile to be removed"
  1.1845 +      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
  1.1846 +	func_echo "Waiting for $lockfile to be removed"
  1.1847  	sleep 2
  1.1848        done
  1.1849      elif test "$need_locks" = warn; then
  1.1850        if test -f "$lockfile"; then
  1.1851 -	$echo "\
  1.1852 +	$ECHO "\
  1.1853  *** ERROR, $lockfile exists and contains:
  1.1854  `cat $lockfile 2>/dev/null`
  1.1855  
  1.1856 @@ -869,34 +1316,22 @@
  1.1857  avoid parallel builds (make -j) in this platform, or get a better
  1.1858  compiler."
  1.1859  
  1.1860 -	$run $rm $removelist
  1.1861 +	$opt_dry_run || $RM $removelist
  1.1862  	exit $EXIT_FAILURE
  1.1863        fi
  1.1864 -      $echo "$srcfile" > "$lockfile"
  1.1865 +      removelist="$removelist $output_obj"
  1.1866 +      $ECHO "$srcfile" > "$lockfile"
  1.1867      fi
  1.1868  
  1.1869 +    $opt_dry_run || $RM $removelist
  1.1870 +    removelist="$removelist $lockfile"
  1.1871 +    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
  1.1872 +
  1.1873      if test -n "$fix_srcfile_path"; then
  1.1874        eval srcfile=\"$fix_srcfile_path\"
  1.1875      fi
  1.1876 -    qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
  1.1877 -    case $qsrcfile in
  1.1878 -      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.1879 -      qsrcfile="\"$qsrcfile\"" ;;
  1.1880 -    esac
  1.1881 -
  1.1882 -    $run $rm "$libobj" "${libobj}T"
  1.1883 -
  1.1884 -    # Create a libtool object file (analogous to a ".la" file),
  1.1885 -    # but don't create it if we're doing a dry run.
  1.1886 -    test -z "$run" && cat > ${libobj}T <<EOF
  1.1887 -# $libobj - a libtool object file
  1.1888 -# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
  1.1889 -#
  1.1890 -# Please DO NOT delete this file!
  1.1891 -# It is necessary for linking the library.
  1.1892 -
  1.1893 -# Name of the PIC object.
  1.1894 -EOF
  1.1895 +    func_quote_for_eval "$srcfile"
  1.1896 +    qsrcfile=$func_quote_for_eval_result
  1.1897  
  1.1898      # Only build a PIC object if we are building libtool libraries.
  1.1899      if test "$build_libtool_libs" = yes; then
  1.1900 @@ -910,32 +1345,68 @@
  1.1901  	command="$base_compile $qsrcfile"
  1.1902        fi
  1.1903  
  1.1904 -      if test ! -d "${xdir}$objdir"; then
  1.1905 -	$show "$mkdir ${xdir}$objdir"
  1.1906 -	$run $mkdir ${xdir}$objdir
  1.1907 -	exit_status=$?
  1.1908 -	if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
  1.1909 -	  exit $exit_status
  1.1910 -	fi
  1.1911 -      fi
  1.1912 +      func_mkdir_p "$xdir$objdir"
  1.1913  
  1.1914        if test -z "$output_obj"; then
  1.1915  	# Place PIC objects in $objdir
  1.1916  	command="$command -o $lobj"
  1.1917        fi
  1.1918  
  1.1919 -      $run $rm "$lobj" "$output_obj"
  1.1920 -
  1.1921 -      $show "$command"
  1.1922 -      if $run eval "$command"; then :
  1.1923 -      else
  1.1924 -	test -n "$output_obj" && $run $rm $removelist
  1.1925 -	exit $EXIT_FAILURE
  1.1926 -      fi
  1.1927 +      func_show_eval_locale "$command"	\
  1.1928 +          'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
  1.1929  
  1.1930        if test "$need_locks" = warn &&
  1.1931  	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  1.1932 -	$echo "\
  1.1933 +	$ECHO "\
  1.1934 +*** ERROR, $lockfile contains:
  1.1935 +`cat $lockfile 2>/dev/null`
  1.1936 +
  1.1937 +but it should contain:
  1.1938 +$srcfile
  1.1939 +
  1.1940 +This indicates that another process is trying to use the same
  1.1941 +temporary object file, and libtool could not work around it because
  1.1942 +your compiler does not support \`-c' and \`-o' together.  If you
  1.1943 +repeat this compilation, it may succeed, by chance, but you had better
  1.1944 +avoid parallel builds (make -j) in this platform, or get a better
  1.1945 +compiler."
  1.1946 +
  1.1947 +	$opt_dry_run || $RM $removelist
  1.1948 +	exit $EXIT_FAILURE
  1.1949 +      fi
  1.1950 +
  1.1951 +      # Just move the object if needed, then go on to compile the next one
  1.1952 +      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  1.1953 +	func_show_eval '$MV "$output_obj" "$lobj"' \
  1.1954 +	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  1.1955 +      fi
  1.1956 +
  1.1957 +      # Allow error messages only from the first compilation.
  1.1958 +      if test "$suppress_opt" = yes; then
  1.1959 +	suppress_output=' >/dev/null 2>&1'
  1.1960 +      fi
  1.1961 +    fi
  1.1962 +
  1.1963 +    # Only build a position-dependent object if we build old libraries.
  1.1964 +    if test "$build_old_libs" = yes; then
  1.1965 +      if test "$pic_mode" != yes; then
  1.1966 +	# Don't build PIC code
  1.1967 +	command="$base_compile $qsrcfile$pie_flag"
  1.1968 +      else
  1.1969 +	command="$base_compile $qsrcfile $pic_flag"
  1.1970 +      fi
  1.1971 +      if test "$compiler_c_o" = yes; then
  1.1972 +	command="$command -o $obj"
  1.1973 +      fi
  1.1974 +
  1.1975 +      # Suppress compiler output if we already did a PIC compilation.
  1.1976 +      command="$command$suppress_output"
  1.1977 +      func_show_eval_locale "$command" \
  1.1978 +        '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
  1.1979 +
  1.1980 +      if test "$need_locks" = warn &&
  1.1981 +	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  1.1982 +	$ECHO "\
  1.1983  *** ERROR, $lockfile contains:
  1.1984  `cat $lockfile 2>/dev/null`
  1.1985  
  1.1986 @@ -949,125 +1420,2621 @@
  1.1987  avoid parallel builds (make -j) in this platform, or get a better
  1.1988  compiler."
  1.1989  
  1.1990 -	$run $rm $removelist
  1.1991 -	exit $EXIT_FAILURE
  1.1992 -      fi
  1.1993 -
  1.1994 -      # Just move the object if needed, then go on to compile the next one
  1.1995 -      if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
  1.1996 -	$show "$mv $output_obj $lobj"
  1.1997 -	if $run $mv $output_obj $lobj; then :
  1.1998 -	else
  1.1999 -	  error=$?
  1.2000 -	  $run $rm $removelist
  1.2001 -	  exit $error
  1.2002 -	fi
  1.2003 -      fi
  1.2004 -
  1.2005 -      # Append the name of the PIC object to the libtool object file.
  1.2006 -      test -z "$run" && cat >> ${libobj}T <<EOF
  1.2007 -pic_object='$objdir/$objname'
  1.2008 -
  1.2009 -EOF
  1.2010 -
  1.2011 -      # Allow error messages only from the first compilation.
  1.2012 -      if test "$suppress_opt" = yes; then
  1.2013 -        suppress_output=' >/dev/null 2>&1'
  1.2014 -      fi
  1.2015 -    else
  1.2016 -      # No PIC object so indicate it doesn't exist in the libtool
  1.2017 -      # object file.
  1.2018 -      test -z "$run" && cat >> ${libobj}T <<EOF
  1.2019 -pic_object=none
  1.2020 -
  1.2021 -EOF
  1.2022 -    fi
  1.2023 -
  1.2024 -    # Only build a position-dependent object if we build old libraries.
  1.2025 -    if test "$build_old_libs" = yes; then
  1.2026 -      if test "$pic_mode" != yes; then
  1.2027 -	# Don't build PIC code
  1.2028 -	command="$base_compile $qsrcfile"
  1.2029 -      else
  1.2030 -	command="$base_compile $qsrcfile $pic_flag"
  1.2031 -      fi
  1.2032 -      if test "$compiler_c_o" = yes; then
  1.2033 -	command="$command -o $obj"
  1.2034 -      fi
  1.2035 -
  1.2036 -      # Suppress compiler output if we already did a PIC compilation.
  1.2037 -      command="$command$suppress_output"
  1.2038 -      $run $rm "$obj" "$output_obj"
  1.2039 -      $show "$command"
  1.2040 -      if $run eval "$command"; then :
  1.2041 -      else
  1.2042 -	$run $rm $removelist
  1.2043 -	exit $EXIT_FAILURE
  1.2044 -      fi
  1.2045 -
  1.2046 -      if test "$need_locks" = warn &&
  1.2047 -	 test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
  1.2048 -	$echo "\
  1.2049 -*** ERROR, $lockfile contains:
  1.2050 -`cat $lockfile 2>/dev/null`
  1.2051 -
  1.2052 -but it should contain:
  1.2053 -$srcfile
  1.2054 -
  1.2055 -This indicates that another process is trying to use the same
  1.2056 -temporary object file, and libtool could not work around it because
  1.2057 -your compiler does not support \`-c' and \`-o' together.  If you
  1.2058 -repeat this compilation, it may succeed, by chance, but you had better
  1.2059 -avoid parallel builds (make -j) in this platform, or get a better
  1.2060 -compiler."
  1.2061 -
  1.2062 -	$run $rm $removelist
  1.2063 +	$opt_dry_run || $RM $removelist
  1.2064  	exit $EXIT_FAILURE
  1.2065        fi
  1.2066  
  1.2067        # Just move the object if needed
  1.2068        if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
  1.2069 -	$show "$mv $output_obj $obj"
  1.2070 -	if $run $mv $output_obj $obj; then :
  1.2071 +	func_show_eval '$MV "$output_obj" "$obj"' \
  1.2072 +	  'error=$?; $opt_dry_run || $RM $removelist; exit $error'
  1.2073 +      fi
  1.2074 +    fi
  1.2075 +
  1.2076 +    $opt_dry_run || {
  1.2077 +      func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
  1.2078 +
  1.2079 +      # Unlock the critical section if it was locked
  1.2080 +      if test "$need_locks" != no; then
  1.2081 +	removelist=$lockfile
  1.2082 +        $RM "$lockfile"
  1.2083 +      fi
  1.2084 +    }
  1.2085 +
  1.2086 +    exit $EXIT_SUCCESS
  1.2087 +}
  1.2088 +
  1.2089 +$opt_help || {
  1.2090 +test "$mode" = compile && func_mode_compile ${1+"$@"}
  1.2091 +}
  1.2092 +
  1.2093 +func_mode_help ()
  1.2094 +{
  1.2095 +    # We need to display help for each of the modes.
  1.2096 +    case $mode in
  1.2097 +      "")
  1.2098 +        # Generic help is extracted from the usage comments
  1.2099 +        # at the start of this file.
  1.2100 +        func_help
  1.2101 +        ;;
  1.2102 +
  1.2103 +      clean)
  1.2104 +        $ECHO \
  1.2105 +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
  1.2106 +
  1.2107 +Remove files from the build directory.
  1.2108 +
  1.2109 +RM is the name of the program to use to delete files associated with each FILE
  1.2110 +(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
  1.2111 +to RM.
  1.2112 +
  1.2113 +If FILE is a libtool library, object or program, all the files associated
  1.2114 +with it are deleted. Otherwise, only FILE itself is deleted using RM."
  1.2115 +        ;;
  1.2116 +
  1.2117 +      compile)
  1.2118 +      $ECHO \
  1.2119 +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
  1.2120 +
  1.2121 +Compile a source file into a libtool library object.
  1.2122 +
  1.2123 +This mode accepts the following additional options:
  1.2124 +
  1.2125 +  -o OUTPUT-FILE    set the output file name to OUTPUT-FILE
  1.2126 +  -no-suppress      do not suppress compiler output for multiple passes
  1.2127 +  -prefer-pic       try to building PIC objects only
  1.2128 +  -prefer-non-pic   try to building non-PIC objects only
  1.2129 +  -shared           do not build a \`.o' file suitable for static linking
  1.2130 +  -static           only build a \`.o' file suitable for static linking
  1.2131 +
  1.2132 +COMPILE-COMMAND is a command to be used in creating a \`standard' object file
  1.2133 +from the given SOURCEFILE.
  1.2134 +
  1.2135 +The output file name is determined by removing the directory component from
  1.2136 +SOURCEFILE, then substituting the C source code suffix \`.c' with the
  1.2137 +library object suffix, \`.lo'."
  1.2138 +        ;;
  1.2139 +
  1.2140 +      execute)
  1.2141 +        $ECHO \
  1.2142 +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
  1.2143 +
  1.2144 +Automatically set library path, then run a program.
  1.2145 +
  1.2146 +This mode accepts the following additional options:
  1.2147 +
  1.2148 +  -dlopen FILE      add the directory containing FILE to the library path
  1.2149 +
  1.2150 +This mode sets the library path environment variable according to \`-dlopen'
  1.2151 +flags.
  1.2152 +
  1.2153 +If any of the ARGS are libtool executable wrappers, then they are translated
  1.2154 +into their corresponding uninstalled binary, and any of their required library
  1.2155 +directories are added to the library path.
  1.2156 +
  1.2157 +Then, COMMAND is executed, with ARGS as arguments."
  1.2158 +        ;;
  1.2159 +
  1.2160 +      finish)
  1.2161 +        $ECHO \
  1.2162 +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
  1.2163 +
  1.2164 +Complete the installation of libtool libraries.
  1.2165 +
  1.2166 +Each LIBDIR is a directory that contains libtool libraries.
  1.2167 +
  1.2168 +The commands that this mode executes may require superuser privileges.  Use
  1.2169 +the \`--dry-run' option if you just want to see what would be executed."
  1.2170 +        ;;
  1.2171 +
  1.2172 +      install)
  1.2173 +        $ECHO \
  1.2174 +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
  1.2175 +
  1.2176 +Install executables or libraries.
  1.2177 +
  1.2178 +INSTALL-COMMAND is the installation command.  The first component should be
  1.2179 +either the \`install' or \`cp' program.
  1.2180 +
  1.2181 +The following components of INSTALL-COMMAND are treated specially:
  1.2182 +
  1.2183 +  -inst-prefix PREFIX-DIR  Use PREFIX-DIR as a staging area for installation
  1.2184 +
  1.2185 +The rest of the components are interpreted as arguments to that command (only
  1.2186 +BSD-compatible install options are recognized)."
  1.2187 +        ;;
  1.2188 +
  1.2189 +      link)
  1.2190 +        $ECHO \
  1.2191 +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
  1.2192 +
  1.2193 +Link object files or libraries together to form another library, or to
  1.2194 +create an executable program.
  1.2195 +
  1.2196 +LINK-COMMAND is a command using the C compiler that you would use to create
  1.2197 +a program from several object files.
  1.2198 +
  1.2199 +The following components of LINK-COMMAND are treated specially:
  1.2200 +
  1.2201 +  -all-static       do not do any dynamic linking at all
  1.2202 +  -avoid-version    do not add a version suffix if possible
  1.2203 +  -dlopen FILE      \`-dlpreopen' FILE if it cannot be dlopened at runtime
  1.2204 +  -dlpreopen FILE   link in FILE and add its symbols to lt_preloaded_symbols
  1.2205 +  -export-dynamic   allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
  1.2206 +  -export-symbols SYMFILE
  1.2207 +                    try to export only the symbols listed in SYMFILE
  1.2208 +  -export-symbols-regex REGEX
  1.2209 +                    try to export only the symbols matching REGEX
  1.2210 +  -LLIBDIR          search LIBDIR for required installed libraries
  1.2211 +  -lNAME            OUTPUT-FILE requires the installed library libNAME
  1.2212 +  -module           build a library that can dlopened
  1.2213 +  -no-fast-install  disable the fast-install mode
  1.2214 +  -no-install       link a not-installable executable
  1.2215 +  -no-undefined     declare that a library does not refer to external symbols
  1.2216 +  -o OUTPUT-FILE    create OUTPUT-FILE from the specified objects
  1.2217 +  -objectlist FILE  Use a list of object files found in FILE to specify objects
  1.2218 +  -precious-files-regex REGEX
  1.2219 +                    don't remove output files matching REGEX
  1.2220 +  -release RELEASE  specify package release information
  1.2221 +  -rpath LIBDIR     the created library will eventually be installed in LIBDIR
  1.2222 +  -R[ ]LIBDIR       add LIBDIR to the runtime path of programs and libraries
  1.2223 +  -shared           only do dynamic linking of libtool libraries
  1.2224 +  -shrext SUFFIX    override the standard shared library file extension
  1.2225 +  -static           do not do any dynamic linking of uninstalled libtool libraries
  1.2226 +  -static-libtool-libs
  1.2227 +                    do not do any dynamic linking of libtool libraries
  1.2228 +  -version-info CURRENT[:REVISION[:AGE]]
  1.2229 +                    specify library version info [each variable defaults to 0]
  1.2230 +  -weak LIBNAME     declare that the target provides the LIBNAME interface
  1.2231 +
  1.2232 +All other options (arguments beginning with \`-') are ignored.
  1.2233 +
  1.2234 +Every other argument is treated as a filename.  Files ending in \`.la' are
  1.2235 +treated as uninstalled libtool libraries, other files are standard or library
  1.2236 +object files.
  1.2237 +
  1.2238 +If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
  1.2239 +only library objects (\`.lo' files) may be specified, and \`-rpath' is
  1.2240 +required, except when creating a convenience library.
  1.2241 +
  1.2242 +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
  1.2243 +using \`ar' and \`ranlib', or on Windows using \`lib'.
  1.2244 +
  1.2245 +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
  1.2246 +is created, otherwise an executable program is created."
  1.2247 +        ;;
  1.2248 +
  1.2249 +      uninstall)
  1.2250 +        $ECHO \
  1.2251 +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
  1.2252 +
  1.2253 +Remove libraries from an installation directory.
  1.2254 +
  1.2255 +RM is the name of the program to use to delete files associated with each FILE
  1.2256 +(typically \`/bin/rm').  RM-OPTIONS are options (such as \`-f') to be passed
  1.2257 +to RM.
  1.2258 +
  1.2259 +If FILE is a libtool library, all the files associated with it are deleted.
  1.2260 +Otherwise, only FILE itself is deleted using RM."
  1.2261 +        ;;
  1.2262 +
  1.2263 +      *)
  1.2264 +        func_fatal_help "invalid operation mode \`$mode'"
  1.2265 +        ;;
  1.2266 +    esac
  1.2267 +
  1.2268 +    $ECHO
  1.2269 +    $ECHO "Try \`$progname --help' for more information about other modes."
  1.2270 +
  1.2271 +    exit $?
  1.2272 +}
  1.2273 +
  1.2274 +  # Now that we've collected a possible --mode arg, show help if necessary
  1.2275 +  $opt_help && func_mode_help
  1.2276 +
  1.2277 +
  1.2278 +# func_mode_execute arg...
  1.2279 +func_mode_execute ()
  1.2280 +{
  1.2281 +    $opt_debug
  1.2282 +    # The first argument is the command name.
  1.2283 +    cmd="$nonopt"
  1.2284 +    test -z "$cmd" && \
  1.2285 +      func_fatal_help "you must specify a COMMAND"
  1.2286 +
  1.2287 +    # Handle -dlopen flags immediately.
  1.2288 +    for file in $execute_dlfiles; do
  1.2289 +      test -f "$file" \
  1.2290 +	|| func_fatal_help "\`$file' is not a file"
  1.2291 +
  1.2292 +      dir=
  1.2293 +      case $file in
  1.2294 +      *.la)
  1.2295 +	# Check to see that this really is a libtool archive.
  1.2296 +	func_lalib_unsafe_p "$file" \
  1.2297 +	  || func_fatal_help "\`$lib' is not a valid libtool archive"
  1.2298 +
  1.2299 +	# Read the libtool library.
  1.2300 +	dlname=
  1.2301 +	library_names=
  1.2302 +	func_source "$file"
  1.2303 +
  1.2304 +	# Skip this library if it cannot be dlopened.
  1.2305 +	if test -z "$dlname"; then
  1.2306 +	  # Warn if it was a shared library.
  1.2307 +	  test -n "$library_names" && \
  1.2308 +	    func_warning "\`$file' was not linked with \`-export-dynamic'"
  1.2309 +	  continue
  1.2310 +	fi
  1.2311 +
  1.2312 +	func_dirname "$file" "" "."
  1.2313 +	dir="$func_dirname_result"
  1.2314 +
  1.2315 +	if test -f "$dir/$objdir/$dlname"; then
  1.2316 +	  dir="$dir/$objdir"
  1.2317  	else
  1.2318 -	  error=$?
  1.2319 -	  $run $rm $removelist
  1.2320 -	  exit $error
  1.2321 +	  if test ! -f "$dir/$dlname"; then
  1.2322 +	    func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
  1.2323 +	  fi
  1.2324 +	fi
  1.2325 +	;;
  1.2326 +
  1.2327 +      *.lo)
  1.2328 +	# Just add the directory containing the .lo file.
  1.2329 +	func_dirname "$file" "" "."
  1.2330 +	dir="$func_dirname_result"
  1.2331 +	;;
  1.2332 +
  1.2333 +      *)
  1.2334 +	func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
  1.2335 +	continue
  1.2336 +	;;
  1.2337 +      esac
  1.2338 +
  1.2339 +      # Get the absolute pathname.
  1.2340 +      absdir=`cd "$dir" && pwd`
  1.2341 +      test -n "$absdir" && dir="$absdir"
  1.2342 +
  1.2343 +      # Now add the directory to shlibpath_var.
  1.2344 +      if eval "test -z \"\$$shlibpath_var\""; then
  1.2345 +	eval "$shlibpath_var=\"\$dir\""
  1.2346 +      else
  1.2347 +	eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
  1.2348 +      fi
  1.2349 +    done
  1.2350 +
  1.2351 +    # This variable tells wrapper scripts just to set shlibpath_var
  1.2352 +    # rather than running their programs.
  1.2353 +    libtool_execute_magic="$magic"
  1.2354 +
  1.2355 +    # Check if any of the arguments is a wrapper script.
  1.2356 +    args=
  1.2357 +    for file
  1.2358 +    do
  1.2359 +      case $file in
  1.2360 +      -*) ;;
  1.2361 +      *)
  1.2362 +	# Do a test to see if this is really a libtool program.
  1.2363 +	if func_ltwrapper_script_p "$file"; then
  1.2364 +	  func_source "$file"
  1.2365 +	  # Transform arg to wrapped name.
  1.2366 +	  file="$progdir/$program"
  1.2367 +	elif func_ltwrapper_executable_p "$file"; then
  1.2368 +	  func_ltwrapper_scriptname "$file"
  1.2369 +	  func_source "$func_ltwrapper_scriptname_result"
  1.2370 +	  # Transform arg to wrapped name.
  1.2371 +	  file="$progdir/$program"
  1.2372 +	fi
  1.2373 +	;;
  1.2374 +      esac
  1.2375 +      # Quote arguments (to preserve shell metacharacters).
  1.2376 +      func_quote_for_eval "$file"
  1.2377 +      args="$args $func_quote_for_eval_result"
  1.2378 +    done
  1.2379 +
  1.2380 +    if test "X$opt_dry_run" = Xfalse; then
  1.2381 +      if test -n "$shlibpath_var"; then
  1.2382 +	# Export the shlibpath_var.
  1.2383 +	eval "export $shlibpath_var"
  1.2384 +      fi
  1.2385 +
  1.2386 +      # Restore saved environment variables
  1.2387 +      for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
  1.2388 +      do
  1.2389 +	eval "if test \"\${save_$lt_var+set}\" = set; then
  1.2390 +                $lt_var=\$save_$lt_var; export $lt_var
  1.2391 +	      else
  1.2392 +		$lt_unset $lt_var
  1.2393 +	      fi"
  1.2394 +      done
  1.2395 +
  1.2396 +      # Now prepare to actually exec the command.
  1.2397 +      exec_cmd="\$cmd$args"
  1.2398 +    else
  1.2399 +      # Display what would be done.
  1.2400 +      if test -n "$shlibpath_var"; then
  1.2401 +	eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
  1.2402 +	$ECHO "export $shlibpath_var"
  1.2403 +      fi
  1.2404 +      $ECHO "$cmd$args"
  1.2405 +      exit $EXIT_SUCCESS
  1.2406 +    fi
  1.2407 +}
  1.2408 +
  1.2409 +test "$mode" = execute && func_mode_execute ${1+"$@"}
  1.2410 +
  1.2411 +
  1.2412 +# func_mode_finish arg...
  1.2413 +func_mode_finish ()
  1.2414 +{
  1.2415 +    $opt_debug
  1.2416 +    libdirs="$nonopt"
  1.2417 +    admincmds=
  1.2418 +
  1.2419 +    if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
  1.2420 +      for dir
  1.2421 +      do
  1.2422 +	libdirs="$libdirs $dir"
  1.2423 +      done
  1.2424 +
  1.2425 +      for libdir in $libdirs; do
  1.2426 +	if test -n "$finish_cmds"; then
  1.2427 +	  # Do each command in the finish commands.
  1.2428 +	  func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
  1.2429 +'"$cmd"'"'
  1.2430 +	fi
  1.2431 +	if test -n "$finish_eval"; then
  1.2432 +	  # Do the single finish_eval.
  1.2433 +	  eval cmds=\"$finish_eval\"
  1.2434 +	  $opt_dry_run || eval "$cmds" || admincmds="$admincmds
  1.2435 +       $cmds"
  1.2436 +	fi
  1.2437 +      done
  1.2438 +    fi
  1.2439 +
  1.2440 +    # Exit here if they wanted silent mode.
  1.2441 +    $opt_silent && exit $EXIT_SUCCESS
  1.2442 +
  1.2443 +    $ECHO "X----------------------------------------------------------------------" | $Xsed
  1.2444 +    $ECHO "Libraries have been installed in:"
  1.2445 +    for libdir in $libdirs; do
  1.2446 +      $ECHO "   $libdir"
  1.2447 +    done
  1.2448 +    $ECHO
  1.2449 +    $ECHO "If you ever happen to want to link against installed libraries"
  1.2450 +    $ECHO "in a given directory, LIBDIR, you must either use libtool, and"
  1.2451 +    $ECHO "specify the full pathname of the library, or use the \`-LLIBDIR'"
  1.2452 +    $ECHO "flag during linking and do at least one of the following:"
  1.2453 +    if test -n "$shlibpath_var"; then
  1.2454 +      $ECHO "   - add LIBDIR to the \`$shlibpath_var' environment variable"
  1.2455 +      $ECHO "     during execution"
  1.2456 +    fi
  1.2457 +    if test -n "$runpath_var"; then
  1.2458 +      $ECHO "   - add LIBDIR to the \`$runpath_var' environment variable"
  1.2459 +      $ECHO "     during linking"
  1.2460 +    fi
  1.2461 +    if test -n "$hardcode_libdir_flag_spec"; then
  1.2462 +      libdir=LIBDIR
  1.2463 +      eval flag=\"$hardcode_libdir_flag_spec\"
  1.2464 +
  1.2465 +      $ECHO "   - use the \`$flag' linker flag"
  1.2466 +    fi
  1.2467 +    if test -n "$admincmds"; then
  1.2468 +      $ECHO "   - have your system administrator run these commands:$admincmds"
  1.2469 +    fi
  1.2470 +    if test -f /etc/ld.so.conf; then
  1.2471 +      $ECHO "   - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
  1.2472 +    fi
  1.2473 +    $ECHO
  1.2474 +
  1.2475 +    $ECHO "See any operating system documentation about shared libraries for"
  1.2476 +    case $host in
  1.2477 +      solaris2.[6789]|solaris2.1[0-9])
  1.2478 +        $ECHO "more information, such as the ld(1), crle(1) and ld.so(8) manual"
  1.2479 +	$ECHO "pages."
  1.2480 +	;;
  1.2481 +      *)
  1.2482 +        $ECHO "more information, such as the ld(1) and ld.so(8) manual pages."
  1.2483 +        ;;
  1.2484 +    esac
  1.2485 +    $ECHO "X----------------------------------------------------------------------" | $Xsed
  1.2486 +    exit $EXIT_SUCCESS
  1.2487 +}
  1.2488 +
  1.2489 +test "$mode" = finish && func_mode_finish ${1+"$@"}
  1.2490 +
  1.2491 +
  1.2492 +# func_mode_install arg...
  1.2493 +func_mode_install ()
  1.2494 +{
  1.2495 +    $opt_debug
  1.2496 +    # There may be an optional sh(1) argument at the beginning of
  1.2497 +    # install_prog (especially on Windows NT).
  1.2498 +    if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
  1.2499 +       # Allow the use of GNU shtool's install command.
  1.2500 +       $ECHO "X$nonopt" | $GREP shtool >/dev/null; then
  1.2501 +      # Aesthetically quote it.
  1.2502 +      func_quote_for_eval "$nonopt"
  1.2503 +      install_prog="$func_quote_for_eval_result "
  1.2504 +      arg=$1
  1.2505 +      shift
  1.2506 +    else
  1.2507 +      install_prog=
  1.2508 +      arg=$nonopt
  1.2509 +    fi
  1.2510 +
  1.2511 +    # The real first argument should be the name of the installation program.
  1.2512 +    # Aesthetically quote it.
  1.2513 +    func_quote_for_eval "$arg"
  1.2514 +    install_prog="$install_prog$func_quote_for_eval_result"
  1.2515 +
  1.2516 +    # We need to accept at least all the BSD install flags.
  1.2517 +    dest=
  1.2518 +    files=
  1.2519 +    opts=
  1.2520 +    prev=
  1.2521 +    install_type=
  1.2522 +    isdir=no
  1.2523 +    stripme=
  1.2524 +    for arg
  1.2525 +    do
  1.2526 +      if test -n "$dest"; then
  1.2527 +	files="$files $dest"
  1.2528 +	dest=$arg
  1.2529 +	continue
  1.2530 +      fi
  1.2531 +
  1.2532 +      case $arg in
  1.2533 +      -d) isdir=yes ;;
  1.2534 +      -f)
  1.2535 +	case " $install_prog " in
  1.2536 +	*[\\\ /]cp\ *) ;;
  1.2537 +	*) prev=$arg ;;
  1.2538 +	esac
  1.2539 +	;;
  1.2540 +      -g | -m | -o)
  1.2541 +	prev=$arg
  1.2542 +	;;
  1.2543 +      -s)
  1.2544 +	stripme=" -s"
  1.2545 +	continue
  1.2546 +	;;
  1.2547 +      -*)
  1.2548 +	;;
  1.2549 +      *)
  1.2550 +	# If the previous option needed an argument, then skip it.
  1.2551 +	if test -n "$prev"; then
  1.2552 +	  prev=
  1.2553 +	else
  1.2554 +	  dest=$arg
  1.2555 +	  continue
  1.2556 +	fi
  1.2557 +	;;
  1.2558 +      esac
  1.2559 +
  1.2560 +      # Aesthetically quote the argument.
  1.2561 +      func_quote_for_eval "$arg"
  1.2562 +      install_prog="$install_prog $func_quote_for_eval_result"
  1.2563 +    done
  1.2564 +
  1.2565 +    test -z "$install_prog" && \
  1.2566 +      func_fatal_help "you must specify an install program"
  1.2567 +
  1.2568 +    test -n "$prev" && \
  1.2569 +      func_fatal_help "the \`$prev' option requires an argument"
  1.2570 +
  1.2571 +    if test -z "$files"; then
  1.2572 +      if test -z "$dest"; then
  1.2573 +	func_fatal_help "no file or destination specified"
  1.2574 +      else
  1.2575 +	func_fatal_help "you must specify a destination"
  1.2576 +      fi
  1.2577 +    fi
  1.2578 +
  1.2579 +    # Strip any trailing slash from the destination.
  1.2580 +    func_stripname '' '/' "$dest"
  1.2581 +    dest=$func_stripname_result
  1.2582 +
  1.2583 +    # Check to see that the destination is a directory.
  1.2584 +    test -d "$dest" && isdir=yes
  1.2585 +    if test "$isdir" = yes; then
  1.2586 +      destdir="$dest"
  1.2587 +      destname=
  1.2588 +    else
  1.2589 +      func_dirname_and_basename "$dest" "" "."
  1.2590 +      destdir="$func_dirname_result"
  1.2591 +      destname="$func_basename_result"
  1.2592 +
  1.2593 +      # Not a directory, so check to see that there is only one file specified.
  1.2594 +      set dummy $files; shift
  1.2595 +      test "$#" -gt 1 && \
  1.2596 +	func_fatal_help "\`$dest' is not a directory"
  1.2597 +    fi
  1.2598 +    case $destdir in
  1.2599 +    [\\/]* | [A-Za-z]:[\\/]*) ;;
  1.2600 +    *)
  1.2601 +      for file in $files; do
  1.2602 +	case $file in
  1.2603 +	*.lo) ;;
  1.2604 +	*)
  1.2605 +	  func_fatal_help "\`$destdir' must be an absolute directory name"
  1.2606 +	  ;;
  1.2607 +	esac
  1.2608 +      done
  1.2609 +      ;;
  1.2610 +    esac
  1.2611 +
  1.2612 +    # This variable tells wrapper scripts just to set variables rather
  1.2613 +    # than running their programs.
  1.2614 +    libtool_install_magic="$magic"
  1.2615 +
  1.2616 +    staticlibs=
  1.2617 +    future_libdirs=
  1.2618 +    current_libdirs=
  1.2619 +    for file in $files; do
  1.2620 +
  1.2621 +      # Do each installation.
  1.2622 +      case $file in
  1.2623 +      *.$libext)
  1.2624 +	# Do the static libraries later.
  1.2625 +	staticlibs="$staticlibs $file"
  1.2626 +	;;
  1.2627 +
  1.2628 +      *.la)
  1.2629 +	# Check to see that this really is a libtool archive.
  1.2630 +	func_lalib_unsafe_p "$file" \
  1.2631 +	  || func_fatal_help "\`$file' is not a valid libtool archive"
  1.2632 +
  1.2633 +	library_names=
  1.2634 +	old_library=
  1.2635 +	relink_command=
  1.2636 +	func_source "$file"
  1.2637 +
  1.2638 +	# Add the libdir to current_libdirs if it is the destination.
  1.2639 +	if test "X$destdir" = "X$libdir"; then
  1.2640 +	  case "$current_libdirs " in
  1.2641 +	  *" $libdir "*) ;;
  1.2642 +	  *) current_libdirs="$current_libdirs $libdir" ;;
  1.2643 +	  esac
  1.2644 +	else
  1.2645 +	  # Note the libdir as a future libdir.
  1.2646 +	  case "$future_libdirs " in
  1.2647 +	  *" $libdir "*) ;;
  1.2648 +	  *) future_libdirs="$future_libdirs $libdir" ;;
  1.2649 +	  esac
  1.2650 +	fi
  1.2651 +
  1.2652 +	func_dirname "$file" "/" ""
  1.2653 +	dir="$func_dirname_result"
  1.2654 +	dir="$dir$objdir"
  1.2655 +
  1.2656 +	if test -n "$relink_command"; then
  1.2657 +	  # Determine the prefix the user has applied to our future dir.
  1.2658 +	  inst_prefix_dir=`$ECHO "X$destdir" | $Xsed -e "s%$libdir\$%%"`
  1.2659 +
  1.2660 +	  # Don't allow the user to place us outside of our expected
  1.2661 +	  # location b/c this prevents finding dependent libraries that
  1.2662 +	  # are installed to the same prefix.
  1.2663 +	  # At present, this check doesn't affect windows .dll's that
  1.2664 +	  # are installed into $libdir/../bin (currently, that works fine)
  1.2665 +	  # but it's something to keep an eye on.
  1.2666 +	  test "$inst_prefix_dir" = "$destdir" && \
  1.2667 +	    func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
  1.2668 +
  1.2669 +	  if test -n "$inst_prefix_dir"; then
  1.2670 +	    # Stick the inst_prefix_dir data into the link command.
  1.2671 +	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
  1.2672 +	  else
  1.2673 +	    relink_command=`$ECHO "X$relink_command" | $Xsed -e "s%@inst_prefix_dir@%%"`
  1.2674 +	  fi
  1.2675 +
  1.2676 +	  func_warning "relinking \`$file'"
  1.2677 +	  func_show_eval "$relink_command" \
  1.2678 +	    'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
  1.2679 +	fi
  1.2680 +
  1.2681 +	# See the names of the shared library.
  1.2682 +	set dummy $library_names; shift
  1.2683 +	if test -n "$1"; then
  1.2684 +	  realname="$1"
  1.2685 +	  shift
  1.2686 +
  1.2687 +	  srcname="$realname"
  1.2688 +	  test -n "$relink_command" && srcname="$realname"T
  1.2689 +
  1.2690 +	  # Install the shared library and build the symlinks.
  1.2691 +	  func_show_eval "$install_prog $dir/$srcname $destdir/$realname" \
  1.2692 +	      'exit $?'
  1.2693 +	  tstripme="$stripme"
  1.2694 +	  case $host_os in
  1.2695 +	  cygwin* | mingw* | pw32* | cegcc*)
  1.2696 +	    case $realname in
  1.2697 +	    *.dll.a)
  1.2698 +	      tstripme=""
  1.2699 +	      ;;
  1.2700 +	    esac
  1.2701 +	    ;;
  1.2702 +	  esac
  1.2703 +	  if test -n "$tstripme" && test -n "$striplib"; then
  1.2704 +	    func_show_eval "$striplib $destdir/$realname" 'exit $?'
  1.2705 +	  fi
  1.2706 +
  1.2707 +	  if test "$#" -gt 0; then
  1.2708 +	    # Delete the old symlinks, and create new ones.
  1.2709 +	    # Try `ln -sf' first, because the `ln' binary might depend on
  1.2710 +	    # the symlink we replace!  Solaris /bin/ln does not understand -f,
  1.2711 +	    # so we also need to try rm && ln -s.
  1.2712 +	    for linkname
  1.2713 +	    do
  1.2714 +	      test "$linkname" != "$realname" \
  1.2715 +		&& func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
  1.2716 +	    done
  1.2717 +	  fi
  1.2718 +
  1.2719 +	  # Do each command in the postinstall commands.
  1.2720 +	  lib="$destdir/$realname"
  1.2721 +	  func_execute_cmds "$postinstall_cmds" 'exit $?'
  1.2722 +	fi
  1.2723 +
  1.2724 +	# Install the pseudo-library for information purposes.
  1.2725 +	func_basename "$file"
  1.2726 +	name="$func_basename_result"
  1.2727 +	instname="$dir/$name"i
  1.2728 +	func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
  1.2729 +
  1.2730 +	# Maybe install the static library, too.
  1.2731 +	test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
  1.2732 +	;;
  1.2733 +
  1.2734 +      *.lo)
  1.2735 +	# Install (i.e. copy) a libtool object.
  1.2736 +
  1.2737 +	# Figure out destination file name, if it wasn't already specified.
  1.2738 +	if test -n "$destname"; then
  1.2739 +	  destfile="$destdir/$destname"
  1.2740 +	else
  1.2741 +	  func_basename "$file"
  1.2742 +	  destfile="$func_basename_result"
  1.2743 +	  destfile="$destdir/$destfile"
  1.2744 +	fi
  1.2745 +
  1.2746 +	# Deduce the name of the destination old-style object file.
  1.2747 +	case $destfile in
  1.2748 +	*.lo)
  1.2749 +	  func_lo2o "$destfile"
  1.2750 +	  staticdest=$func_lo2o_result
  1.2751 +	  ;;
  1.2752 +	*.$objext)
  1.2753 +	  staticdest="$destfile"
  1.2754 +	  destfile=
  1.2755 +	  ;;
  1.2756 +	*)
  1.2757 +	  func_fatal_help "cannot copy a libtool object to \`$destfile'"
  1.2758 +	  ;;
  1.2759 +	esac
  1.2760 +
  1.2761 +	# Install the libtool object if requested.
  1.2762 +	test -n "$destfile" && \
  1.2763 +	  func_show_eval "$install_prog $file $destfile" 'exit $?'
  1.2764 +
  1.2765 +	# Install the old object if enabled.
  1.2766 +	if test "$build_old_libs" = yes; then
  1.2767 +	  # Deduce the name of the old-style object file.
  1.2768 +	  func_lo2o "$file"
  1.2769 +	  staticobj=$func_lo2o_result
  1.2770 +	  func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
  1.2771 +	fi
  1.2772 +	exit $EXIT_SUCCESS
  1.2773 +	;;
  1.2774 +
  1.2775 +      *)
  1.2776 +	# Figure out destination file name, if it wasn't already specified.
  1.2777 +	if test -n "$destname"; then
  1.2778 +	  destfile="$destdir/$destname"
  1.2779 +	else
  1.2780 +	  func_basename "$file"
  1.2781 +	  destfile="$func_basename_result"
  1.2782 +	  destfile="$destdir/$destfile"
  1.2783 +	fi
  1.2784 +
  1.2785 +	# If the file is missing, and there is a .exe on the end, strip it
  1.2786 +	# because it is most likely a libtool script we actually want to
  1.2787 +	# install
  1.2788 +	stripped_ext=""
  1.2789 +	case $file in
  1.2790 +	  *.exe)
  1.2791 +	    if test ! -f "$file"; then
  1.2792 +	      func_stripname '' '.exe' "$file"
  1.2793 +	      file=$func_stripname_result
  1.2794 +	      stripped_ext=".exe"
  1.2795 +	    fi
  1.2796 +	    ;;
  1.2797 +	esac
  1.2798 +
  1.2799 +	# Do a test to see if this is really a libtool program.
  1.2800 +	case $host in
  1.2801 +	*cygwin* | *mingw*)
  1.2802 +	    if func_ltwrapper_executable_p "$file"; then
  1.2803 +	      func_ltwrapper_scriptname "$file"
  1.2804 +	      wrapper=$func_ltwrapper_scriptname_result
  1.2805 +	    else
  1.2806 +	      func_stripname '' '.exe' "$file"
  1.2807 +	      wrapper=$func_stripname_result
  1.2808 +	    fi
  1.2809 +	    ;;
  1.2810 +	*)
  1.2811 +	    wrapper=$file
  1.2812 +	    ;;
  1.2813 +	esac
  1.2814 +	if func_ltwrapper_script_p "$wrapper"; then
  1.2815 +	  notinst_deplibs=
  1.2816 +	  relink_command=
  1.2817 +
  1.2818 +	  func_source "$wrapper"
  1.2819 +
  1.2820 +	  # Check the variables that should have been set.
  1.2821 +	  test -z "$generated_by_libtool_version" && \
  1.2822 +	    func_fatal_error "invalid libtool wrapper script \`$wrapper'"
  1.2823 +
  1.2824 +	  finalize=yes
  1.2825 +	  for lib in $notinst_deplibs; do
  1.2826 +	    # Check to see that each library is installed.
  1.2827 +	    libdir=
  1.2828 +	    if test -f "$lib"; then
  1.2829 +	      func_source "$lib"
  1.2830 +	    fi
  1.2831 +	    libfile="$libdir/"`$ECHO "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
  1.2832 +	    if test -n "$libdir" && test ! -f "$libfile"; then
  1.2833 +	      func_warning "\`$lib' has not been installed in \`$libdir'"
  1.2834 +	      finalize=no
  1.2835 +	    fi
  1.2836 +	  done
  1.2837 +
  1.2838 +	  relink_command=
  1.2839 +	  func_source "$wrapper"
  1.2840 +
  1.2841 +	  outputname=
  1.2842 +	  if test "$fast_install" = no && test -n "$relink_command"; then
  1.2843 +	    $opt_dry_run || {
  1.2844 +	      if test "$finalize" = yes; then
  1.2845 +	        tmpdir=`func_mktempdir`
  1.2846 +		func_basename "$file$stripped_ext"
  1.2847 +		file="$func_basename_result"
  1.2848 +	        outputname="$tmpdir/$file"
  1.2849 +	        # Replace the output file specification.
  1.2850 +	        relink_command=`$ECHO "X$relink_command" | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g'`
  1.2851 +
  1.2852 +	        $opt_silent || {
  1.2853 +	          func_quote_for_expand "$relink_command"
  1.2854 +		  eval "func_echo $func_quote_for_expand_result"
  1.2855 +	        }
  1.2856 +	        if eval "$relink_command"; then :
  1.2857 +	          else
  1.2858 +		  func_error "error: relink \`$file' with the above command before installing it"
  1.2859 +		  $opt_dry_run || ${RM}r "$tmpdir"
  1.2860 +		  continue
  1.2861 +	        fi
  1.2862 +	        file="$outputname"
  1.2863 +	      else
  1.2864 +	        func_warning "cannot relink \`$file'"
  1.2865 +	      fi
  1.2866 +	    }
  1.2867 +	  else
  1.2868 +	    # Install the binary that we compiled earlier.
  1.2869 +	    file=`$ECHO "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
  1.2870 +	  fi
  1.2871 +	fi
  1.2872 +
  1.2873 +	# remove .exe since cygwin /usr/bin/install will append another
  1.2874 +	# one anyway
  1.2875 +	case $install_prog,$host in
  1.2876 +	*/usr/bin/install*,*cygwin*)
  1.2877 +	  case $file:$destfile in
  1.2878 +	  *.exe:*.exe)
  1.2879 +	    # this is ok
  1.2880 +	    ;;
  1.2881 +	  *.exe:*)
  1.2882 +	    destfile=$destfile.exe
  1.2883 +	    ;;
  1.2884 +	  *:*.exe)
  1.2885 +	    func_stripname '' '.exe' "$destfile"
  1.2886 +	    destfile=$func_stripname_result
  1.2887 +	    ;;
  1.2888 +	  esac
  1.2889 +	  ;;
  1.2890 +	esac
  1.2891 +	func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
  1.2892 +	$opt_dry_run || if test -n "$outputname"; then
  1.2893 +	  ${RM}r "$tmpdir"
  1.2894 +	fi
  1.2895 +	;;
  1.2896 +      esac
  1.2897 +    done
  1.2898 +
  1.2899 +    for file in $staticlibs; do
  1.2900 +      func_basename "$file"
  1.2901 +      name="$func_basename_result"
  1.2902 +
  1.2903 +      # Set up the ranlib parameters.
  1.2904 +      oldlib="$destdir/$name"
  1.2905 +
  1.2906 +      func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
  1.2907 +
  1.2908 +      if test -n "$stripme" && test -n "$old_striplib"; then
  1.2909 +	func_show_eval "$old_striplib $oldlib" 'exit $?'
  1.2910 +      fi
  1.2911 +
  1.2912 +      # Do each command in the postinstall commands.
  1.2913 +      func_execute_cmds "$old_postinstall_cmds" 'exit $?'
  1.2914 +    done
  1.2915 +
  1.2916 +    test -n "$future_libdirs" && \
  1.2917 +      func_warning "remember to run \`$progname --finish$future_libdirs'"
  1.2918 +
  1.2919 +    if test -n "$current_libdirs"; then
  1.2920 +      # Maybe just do a dry run.
  1.2921 +      $opt_dry_run && current_libdirs=" -n$current_libdirs"
  1.2922 +      exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
  1.2923 +    else
  1.2924 +      exit $EXIT_SUCCESS
  1.2925 +    fi
  1.2926 +}
  1.2927 +
  1.2928 +test "$mode" = install && func_mode_install ${1+"$@"}
  1.2929 +
  1.2930 +
  1.2931 +# func_generate_dlsyms outputname originator pic_p
  1.2932 +# Extract symbols from dlprefiles and create ${outputname}S.o with
  1.2933 +# a dlpreopen symbol table.
  1.2934 +func_generate_dlsyms ()
  1.2935 +{
  1.2936 +    $opt_debug
  1.2937 +    my_outputname="$1"
  1.2938 +    my_originator="$2"
  1.2939 +    my_pic_p="${3-no}"
  1.2940 +    my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
  1.2941 +    my_dlsyms=
  1.2942 +
  1.2943 +    if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1.2944 +      if test -n "$NM" && test -n "$global_symbol_pipe"; then
  1.2945 +	my_dlsyms="${my_outputname}S.c"
  1.2946 +      else
  1.2947 +	func_error "not configured to extract global symbols from dlpreopened files"
  1.2948 +      fi
  1.2949 +    fi
  1.2950 +
  1.2951 +    if test -n "$my_dlsyms"; then
  1.2952 +      case $my_dlsyms in
  1.2953 +      "") ;;
  1.2954 +      *.c)
  1.2955 +	# Discover the nlist of each of the dlfiles.
  1.2956 +	nlist="$output_objdir/${my_outputname}.nm"
  1.2957 +
  1.2958 +	func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
  1.2959 +
  1.2960 +	# Parse the name list into a source file.
  1.2961 +	func_verbose "creating $output_objdir/$my_dlsyms"
  1.2962 +
  1.2963 +	$opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
  1.2964 +/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
  1.2965 +/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
  1.2966 +
  1.2967 +#ifdef __cplusplus
  1.2968 +extern \"C\" {
  1.2969 +#endif
  1.2970 +
  1.2971 +/* External symbol declarations for the compiler. */\
  1.2972 +"
  1.2973 +
  1.2974 +	if test "$dlself" = yes; then
  1.2975 +	  func_verbose "generating symbol list for \`$output'"
  1.2976 +
  1.2977 +	  $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
  1.2978 +
  1.2979 +	  # Add our own program objects to the symbol list.
  1.2980 +	  progfiles=`$ECHO "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1.2981 +	  for progfile in $progfiles; do
  1.2982 +	    func_verbose "extracting global C symbols from \`$progfile'"
  1.2983 +	    $opt_dry_run || eval "$NM $progfile | $global_symbol_pipe >> '$nlist'"
  1.2984 +	  done
  1.2985 +
  1.2986 +	  if test -n "$exclude_expsyms"; then
  1.2987 +	    $opt_dry_run || {
  1.2988 +	      eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
  1.2989 +	      eval '$MV "$nlist"T "$nlist"'
  1.2990 +	    }
  1.2991 +	  fi
  1.2992 +
  1.2993 +	  if test -n "$export_symbols_regex"; then
  1.2994 +	    $opt_dry_run || {
  1.2995 +	      eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
  1.2996 +	      eval '$MV "$nlist"T "$nlist"'
  1.2997 +	    }
  1.2998 +	  fi
  1.2999 +
  1.3000 +	  # Prepare the list of exported symbols
  1.3001 +	  if test -z "$export_symbols"; then
  1.3002 +	    export_symbols="$output_objdir/$outputname.exp"
  1.3003 +	    $opt_dry_run || {
  1.3004 +	      $RM $export_symbols
  1.3005 +	      eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
  1.3006 +	      case $host in
  1.3007 +	      *cygwin* | *mingw* | *cegcc* )
  1.3008 +                eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  1.3009 +                eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
  1.3010 +	        ;;
  1.3011 +	      esac
  1.3012 +	    }
  1.3013 +	  else
  1.3014 +	    $opt_dry_run || {
  1.3015 +	      eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
  1.3016 +	      eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
  1.3017 +	      eval '$MV "$nlist"T "$nlist"'
  1.3018 +	      case $host in
  1.3019 +	        *cygwin | *mingw* | *cegcc* )
  1.3020 +	          eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
  1.3021 +	          eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
  1.3022 +	          ;;
  1.3023 +	      esac
  1.3024 +	    }
  1.3025 +	  fi
  1.3026  	fi
  1.3027 +
  1.3028 +	for dlprefile in $dlprefiles; do
  1.3029 +	  func_verbose "extracting global C symbols from \`$dlprefile'"
  1.3030 +	  func_basename "$dlprefile"
  1.3031 +	  name="$func_basename_result"
  1.3032 +	  $opt_dry_run || {
  1.3033 +	    eval '$ECHO ": $name " >> "$nlist"'
  1.3034 +	    eval "$NM $dlprefile 2>/dev/null | $global_symbol_pipe >> '$nlist'"
  1.3035 +	  }
  1.3036 +	done
  1.3037 +
  1.3038 +	$opt_dry_run || {
  1.3039 +	  # Make sure we have at least an empty file.
  1.3040 +	  test -f "$nlist" || : > "$nlist"
  1.3041 +
  1.3042 +	  if test -n "$exclude_expsyms"; then
  1.3043 +	    $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
  1.3044 +	    $MV "$nlist"T "$nlist"
  1.3045 +	  fi
  1.3046 +
  1.3047 +	  # Try sorting and uniquifying the output.
  1.3048 +	  if $GREP -v "^: " < "$nlist" |
  1.3049 +	      if sort -k 3 </dev/null >/dev/null 2>&1; then
  1.3050 +		sort -k 3
  1.3051 +	      else
  1.3052 +		sort +2
  1.3053 +	      fi |
  1.3054 +	      uniq > "$nlist"S; then
  1.3055 +	    :
  1.3056 +	  else
  1.3057 +	    $GREP -v "^: " < "$nlist" > "$nlist"S
  1.3058 +	  fi
  1.3059 +
  1.3060 +	  if test -f "$nlist"S; then
  1.3061 +	    eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
  1.3062 +	  else
  1.3063 +	    $ECHO '/* NONE */' >> "$output_objdir/$my_dlsyms"
  1.3064 +	  fi
  1.3065 +
  1.3066 +	  $ECHO >> "$output_objdir/$my_dlsyms" "\
  1.3067 +
  1.3068 +/* The mapping between symbol names and symbols.  */
  1.3069 +typedef struct {
  1.3070 +  const char *name;
  1.3071 +  void *address;
  1.3072 +} lt_dlsymlist;
  1.3073 +"
  1.3074 +	  case $host in
  1.3075 +	  *cygwin* | *mingw* | *cegcc* )
  1.3076 +	    $ECHO >> "$output_objdir/$my_dlsyms" "\
  1.3077 +/* DATA imports from DLLs on WIN32 con't be const, because
  1.3078 +   runtime relocations are performed -- see ld's documentation
  1.3079 +   on pseudo-relocs.  */"
  1.3080 +	    lt_dlsym_const= ;;
  1.3081 +	  *osf5*)
  1.3082 +	    echo >> "$output_objdir/$my_dlsyms" "\
  1.3083 +/* This system does not cope well with relocations in const data */"
  1.3084 +	    lt_dlsym_const= ;;
  1.3085 +	  *)
  1.3086 +	    lt_dlsym_const=const ;;
  1.3087 +	  esac
  1.3088 +
  1.3089 +	  $ECHO >> "$output_objdir/$my_dlsyms" "\
  1.3090 +extern $lt_dlsym_const lt_dlsymlist
  1.3091 +lt_${my_prefix}_LTX_preloaded_symbols[];
  1.3092 +$lt_dlsym_const lt_dlsymlist
  1.3093 +lt_${my_prefix}_LTX_preloaded_symbols[] =
  1.3094 +{\
  1.3095 +  { \"$my_originator\", (void *) 0 },"
  1.3096 +
  1.3097 +	  case $need_lib_prefix in
  1.3098 +	  no)
  1.3099 +	    eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
  1.3100 +	    ;;
  1.3101 +	  *)
  1.3102 +	    eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
  1.3103 +	    ;;
  1.3104 +	  esac
  1.3105 +	  $ECHO >> "$output_objdir/$my_dlsyms" "\
  1.3106 +  {0, (void *) 0}
  1.3107 +};
  1.3108 +
  1.3109 +/* This works around a problem in FreeBSD linker */
  1.3110 +#ifdef FREEBSD_WORKAROUND
  1.3111 +static const void *lt_preloaded_setup() {
  1.3112 +  return lt_${my_prefix}_LTX_preloaded_symbols;
  1.3113 +}
  1.3114 +#endif
  1.3115 +
  1.3116 +#ifdef __cplusplus
  1.3117 +}
  1.3118 +#endif\
  1.3119 +"
  1.3120 +	} # !$opt_dry_run
  1.3121 +
  1.3122 +	pic_flag_for_symtable=
  1.3123 +	case "$compile_command " in
  1.3124 +	*" -static "*) ;;
  1.3125 +	*)
  1.3126 +	  case $host in
  1.3127 +	  # compiling the symbol table file with pic_flag works around
  1.3128 +	  # a FreeBSD bug that causes programs to crash when -lm is
  1.3129 +	  # linked before any other PIC object.  But we must not use
  1.3130 +	  # pic_flag when linking with -static.  The problem exists in
  1.3131 +	  # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
  1.3132 +	  *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
  1.3133 +	    pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
  1.3134 +	  *-*-hpux*)
  1.3135 +	    pic_flag_for_symtable=" $pic_flag"  ;;
  1.3136 +	  *)
  1.3137 +	    if test "X$my_pic_p" != Xno; then
  1.3138 +	      pic_flag_for_symtable=" $pic_flag"
  1.3139 +	    fi
  1.3140 +	    ;;
  1.3141 +	  esac
  1.3142 +	  ;;
  1.3143 +	esac
  1.3144 +	symtab_cflags=
  1.3145 +	for arg in $LTCFLAGS; do
  1.3146 +	  case $arg in
  1.3147 +	  -pie | -fpie | -fPIE) ;;
  1.3148 +	  *) symtab_cflags="$symtab_cflags $arg" ;;
  1.3149 +	  esac
  1.3150 +	done
  1.3151 +
  1.3152 +	# Now compile the dynamic symbol file.
  1.3153 +	func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
  1.3154 +
  1.3155 +	# Clean up the generated files.
  1.3156 +	func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
  1.3157 +
  1.3158 +	# Transform the symbol file into the correct name.
  1.3159 +	symfileobj="$output_objdir/${my_outputname}S.$objext"
  1.3160 +	case $host in
  1.3161 +	*cygwin* | *mingw* | *cegcc* )
  1.3162 +	  if test -f "$output_objdir/$my_outputname.def"; then
  1.3163 +	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  1.3164 +	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
  1.3165 +	  else
  1.3166 +	    compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
  1.3167 +	    finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
  1.3168 +	  fi
  1.3169 +	  ;;
  1.3170 +	*)
  1.3171 +	  compile_command=`$ECHO "X$compile_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
  1.3172 +	  finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s%@SYMFILE@%$symfileobj%"`
  1.3173 +	  ;;
  1.3174 +	esac
  1.3175 +	;;
  1.3176 +      *)
  1.3177 +	func_fatal_error "unknown suffix for \`$my_dlsyms'"
  1.3178 +	;;
  1.3179 +      esac
  1.3180 +    else
  1.3181 +      # We keep going just in case the user didn't refer to
  1.3182 +      # lt_preloaded_symbols.  The linker will fail if global_symbol_pipe
  1.3183 +      # really was required.
  1.3184 +
  1.3185 +      # Nullify the symbol file.
  1.3186 +      compile_command=`$ECHO "X$compile_command" | $Xsed -e "s% @SYMFILE@%%"`
  1.3187 +      finalize_command=`$ECHO "X$finalize_command" | $Xsed -e "s% @SYMFILE@%%"`
  1.3188 +    fi
  1.3189 +}
  1.3190 +
  1.3191 +# func_win32_libid arg
  1.3192 +# return the library type of file 'arg'
  1.3193 +#
  1.3194 +# Need a lot of goo to handle *both* DLLs and import libs
  1.3195 +# Has to be a shell function in order to 'eat' the argument
  1.3196 +# that is supplied when $file_magic_command is called.
  1.3197 +func_win32_libid ()
  1.3198 +{
  1.3199 +  $opt_debug
  1.3200 +  win32_libid_type="unknown"
  1.3201 +  win32_fileres=`file -L $1 2>/dev/null`
  1.3202 +  case $win32_fileres in
  1.3203 +  *ar\ archive\ import\ library*) # definitely import
  1.3204 +    win32_libid_type="x86 archive import"
  1.3205 +    ;;
  1.3206 +  *ar\ archive*) # could be an import, or static
  1.3207 +    if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
  1.3208 +       $EGREP 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
  1.3209 +      win32_nmres=`eval $NM -f posix -A $1 |
  1.3210 +	$SED -n -e '
  1.3211 +	    1,100{
  1.3212 +		/ I /{
  1.3213 +		    s,.*,import,
  1.3214 +		    p
  1.3215 +		    q
  1.3216 +		}
  1.3217 +	    }'`
  1.3218 +      case $win32_nmres in
  1.3219 +      import*)  win32_libid_type="x86 archive import";;
  1.3220 +      *)        win32_libid_type="x86 archive static";;
  1.3221 +      esac
  1.3222 +    fi
  1.3223 +    ;;
  1.3224 +  *DLL*)
  1.3225 +    win32_libid_type="x86 DLL"
  1.3226 +    ;;
  1.3227 +  *executable*) # but shell scripts are "executable" too...
  1.3228 +    case $win32_fileres in
  1.3229 +    *MS\ Windows\ PE\ Intel*)
  1.3230 +      win32_libid_type="x86 DLL"
  1.3231 +      ;;
  1.3232 +    esac
  1.3233 +    ;;
  1.3234 +  esac
  1.3235 +  $ECHO "$win32_libid_type"
  1.3236 +}
  1.3237 +
  1.3238 +
  1.3239 +
  1.3240 +# func_extract_an_archive dir oldlib
  1.3241 +func_extract_an_archive ()
  1.3242 +{
  1.3243 +    $opt_debug
  1.3244 +    f_ex_an_ar_dir="$1"; shift
  1.3245 +    f_ex_an_ar_oldlib="$1"
  1.3246 +    func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" 'exit $?'
  1.3247 +    if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
  1.3248 +     :
  1.3249 +    else
  1.3250 +      func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
  1.3251 +    fi
  1.3252 +}
  1.3253 +
  1.3254 +
  1.3255 +# func_extract_archives gentop oldlib ...
  1.3256 +func_extract_archives ()
  1.3257 +{
  1.3258 +    $opt_debug
  1.3259 +    my_gentop="$1"; shift
  1.3260 +    my_oldlibs=${1+"$@"}
  1.3261 +    my_oldobjs=""
  1.3262 +    my_xlib=""
  1.3263 +    my_xabs=""
  1.3264 +    my_xdir=""
  1.3265 +
  1.3266 +    for my_xlib in $my_oldlibs; do
  1.3267 +      # Extract the objects.
  1.3268 +      case $my_xlib in
  1.3269 +	[\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
  1.3270 +	*) my_xabs=`pwd`"/$my_xlib" ;;
  1.3271 +      esac
  1.3272 +      func_basename "$my_xlib"
  1.3273 +      my_xlib="$func_basename_result"
  1.3274 +      my_xlib_u=$my_xlib
  1.3275 +      while :; do
  1.3276 +        case " $extracted_archives " in
  1.3277 +	*" $my_xlib_u "*)
  1.3278 +	  func_arith $extracted_serial + 1
  1.3279 +	  extracted_serial=$func_arith_result
  1.3280 +	  my_xlib_u=lt$extracted_serial-$my_xlib ;;
  1.3281 +	*) break ;;
  1.3282 +	esac
  1.3283 +      done
  1.3284 +      extracted_archives="$extracted_archives $my_xlib_u"
  1.3285 +      my_xdir="$my_gentop/$my_xlib_u"
  1.3286 +
  1.3287 +      func_mkdir_p "$my_xdir"
  1.3288 +
  1.3289 +      case $host in
  1.3290 +      *-darwin*)
  1.3291 +	func_verbose "Extracting $my_xabs"
  1.3292 +	# Do not bother doing anything if just a dry run
  1.3293 +	$opt_dry_run || {
  1.3294 +	  darwin_orig_dir=`pwd`
  1.3295 +	  cd $my_xdir || exit $?
  1.3296 +	  darwin_archive=$my_xabs
  1.3297 +	  darwin_curdir=`pwd`
  1.3298 +	  darwin_base_archive=`basename "$darwin_archive"`
  1.3299 +	  darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
  1.3300 +	  if test -n "$darwin_arches"; then
  1.3301 +	    darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
  1.3302 +	    darwin_arch=
  1.3303 +	    func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
  1.3304 +	    for darwin_arch in  $darwin_arches ; do
  1.3305 +	      func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
  1.3306 +	      $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
  1.3307 +	      cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
  1.3308 +	      func_extract_an_archive "`pwd`" "${darwin_base_archive}"
  1.3309 +	      cd "$darwin_curdir"
  1.3310 +	      $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
  1.3311 +	    done # $darwin_arches
  1.3312 +            ## Okay now we've a bunch of thin objects, gotta fatten them up :)
  1.3313 +	    darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
  1.3314 +	    darwin_file=
  1.3315 +	    darwin_files=
  1.3316 +	    for darwin_file in $darwin_filelist; do
  1.3317 +	      darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
  1.3318 +	      $LIPO -create -output "$darwin_file" $darwin_files
  1.3319 +	    done # $darwin_filelist
  1.3320 +	    $RM -rf unfat-$$
  1.3321 +	    cd "$darwin_orig_dir"
  1.3322 +	  else
  1.3323 +	    cd $darwin_orig_dir
  1.3324 +	    func_extract_an_archive "$my_xdir" "$my_xabs"
  1.3325 +	  fi # $darwin_arches
  1.3326 +	} # !$opt_dry_run
  1.3327 +	;;
  1.3328 +      *)
  1.3329 +        func_extract_an_archive "$my_xdir" "$my_xabs"
  1.3330 +	;;
  1.3331 +      esac
  1.3332 +      my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
  1.3333 +    done
  1.3334 +
  1.3335 +    func_extract_archives_result="$my_oldobjs"
  1.3336 +}
  1.3337 +
  1.3338 +
  1.3339 +
  1.3340 +# func_emit_wrapper_part1 [arg=no]
  1.3341 +#
  1.3342 +# Emit the first part of a libtool wrapper script on stdout.
  1.3343 +# For more information, see the description associated with
  1.3344 +# func_emit_wrapper(), below.
  1.3345 +func_emit_wrapper_part1 ()
  1.3346 +{
  1.3347 +	func_emit_wrapper_part1_arg1=no
  1.3348 +	if test -n "$1" ; then
  1.3349 +	  func_emit_wrapper_part1_arg1=$1
  1.3350 +	fi
  1.3351 +
  1.3352 +	$ECHO "\
  1.3353 +#! $SHELL
  1.3354 +
  1.3355 +# $output - temporary wrapper script for $objdir/$outputname
  1.3356 +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  1.3357 +#
  1.3358 +# The $output program cannot be directly executed until all the libtool
  1.3359 +# libraries that it depends on are installed.
  1.3360 +#
  1.3361 +# This wrapper script should never be moved out of the build directory.
  1.3362 +# If it is, it will not operate correctly.
  1.3363 +
  1.3364 +# Sed substitution that helps us do robust quoting.  It backslashifies
  1.3365 +# metacharacters that are still active within double-quoted strings.
  1.3366 +Xsed='${SED} -e 1s/^X//'
  1.3367 +sed_quote_subst='$sed_quote_subst'
  1.3368 +
  1.3369 +# Be Bourne compatible
  1.3370 +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
  1.3371 +  emulate sh
  1.3372 +  NULLCMD=:
  1.3373 +  # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
  1.3374 +  # is contrary to our usage.  Disable this feature.
  1.3375 +  alias -g '\${1+\"\$@\"}'='\"\$@\"'
  1.3376 +  setopt NO_GLOB_SUBST
  1.3377 +else
  1.3378 +  case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
  1.3379 +fi
  1.3380 +BIN_SH=xpg4; export BIN_SH # for Tru64
  1.3381 +DUALCASE=1; export DUALCASE # for MKS sh
  1.3382 +
  1.3383 +# The HP-UX ksh and POSIX shell print the target directory to stdout
  1.3384 +# if CDPATH is set.
  1.3385 +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
  1.3386 +
  1.3387 +relink_command=\"$relink_command\"
  1.3388 +
  1.3389 +# This environment variable determines our operation mode.
  1.3390 +if test \"\$libtool_install_magic\" = \"$magic\"; then
  1.3391 +  # install mode needs the following variables:
  1.3392 +  generated_by_libtool_version='$macro_version'
  1.3393 +  notinst_deplibs='$notinst_deplibs'
  1.3394 +else
  1.3395 +  # When we are sourced in execute mode, \$file and \$ECHO are already set.
  1.3396 +  if test \"\$libtool_execute_magic\" != \"$magic\"; then
  1.3397 +    ECHO=\"$qecho\"
  1.3398 +    file=\"\$0\"
  1.3399 +    # Make sure echo works.
  1.3400 +    if test \"X\$1\" = X--no-reexec; then
  1.3401 +      # Discard the --no-reexec flag, and continue.
  1.3402 +      shift
  1.3403 +    elif test \"X\`{ \$ECHO '\t'; } 2>/dev/null\`\" = 'X\t'; then
  1.3404 +      # Yippee, \$ECHO works!
  1.3405 +      :
  1.3406 +    else
  1.3407 +      # Restart under the correct shell, and then maybe \$ECHO will work.
  1.3408 +      exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
  1.3409 +    fi
  1.3410 +  fi\
  1.3411 +"
  1.3412 +	$ECHO "\
  1.3413 +
  1.3414 +  # Find the directory that this script lives in.
  1.3415 +  thisdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
  1.3416 +  test \"x\$thisdir\" = \"x\$file\" && thisdir=.
  1.3417 +
  1.3418 +  # Follow symbolic links until we get to the real thisdir.
  1.3419 +  file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
  1.3420 +  while test -n \"\$file\"; do
  1.3421 +    destdir=\`\$ECHO \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
  1.3422 +
  1.3423 +    # If there was a directory component, then change thisdir.
  1.3424 +    if test \"x\$destdir\" != \"x\$file\"; then
  1.3425 +      case \"\$destdir\" in
  1.3426 +      [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
  1.3427 +      *) thisdir=\"\$thisdir/\$destdir\" ;;
  1.3428 +      esac
  1.3429 +    fi
  1.3430 +
  1.3431 +    file=\`\$ECHO \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
  1.3432 +    file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
  1.3433 +  done
  1.3434 +"
  1.3435 +}
  1.3436 +# end: func_emit_wrapper_part1
  1.3437 +
  1.3438 +# func_emit_wrapper_part2 [arg=no]
  1.3439 +#
  1.3440 +# Emit the second part of a libtool wrapper script on stdout.
  1.3441 +# For more information, see the description associated with
  1.3442 +# func_emit_wrapper(), below.
  1.3443 +func_emit_wrapper_part2 ()
  1.3444 +{
  1.3445 +	func_emit_wrapper_part2_arg1=no
  1.3446 +	if test -n "$1" ; then
  1.3447 +	  func_emit_wrapper_part2_arg1=$1
  1.3448 +	fi
  1.3449 +
  1.3450 +	$ECHO "\
  1.3451 +
  1.3452 +  # Usually 'no', except on cygwin/mingw when embedded into
  1.3453 +  # the cwrapper.
  1.3454 +  WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_part2_arg1
  1.3455 +  if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
  1.3456 +    # special case for '.'
  1.3457 +    if test \"\$thisdir\" = \".\"; then
  1.3458 +      thisdir=\`pwd\`
  1.3459 +    fi
  1.3460 +    # remove .libs from thisdir
  1.3461 +    case \"\$thisdir\" in
  1.3462 +    *[\\\\/]$objdir ) thisdir=\`\$ECHO \"X\$thisdir\" | \$Xsed -e 's%[\\\\/][^\\\\/]*$%%'\` ;;
  1.3463 +    $objdir )   thisdir=. ;;
  1.3464 +    esac
  1.3465 +  fi
  1.3466 +
  1.3467 +  # Try to get the absolute directory name.
  1.3468 +  absdir=\`cd \"\$thisdir\" && pwd\`
  1.3469 +  test -n \"\$absdir\" && thisdir=\"\$absdir\"
  1.3470 +"
  1.3471 +
  1.3472 +	if test "$fast_install" = yes; then
  1.3473 +	  $ECHO "\
  1.3474 +  program=lt-'$outputname'$exeext
  1.3475 +  progdir=\"\$thisdir/$objdir\"
  1.3476 +
  1.3477 +  if test ! -f \"\$progdir/\$program\" ||
  1.3478 +     { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
  1.3479 +       test \"X\$file\" != \"X\$progdir/\$program\"; }; then
  1.3480 +
  1.3481 +    file=\"\$\$-\$program\"
  1.3482 +
  1.3483 +    if test ! -d \"\$progdir\"; then
  1.3484 +      $MKDIR \"\$progdir\"
  1.3485 +    else
  1.3486 +      $RM \"\$progdir/\$file\"
  1.3487 +    fi"
  1.3488 +
  1.3489 +	  $ECHO "\
  1.3490 +
  1.3491 +    # relink executable if necessary
  1.3492 +    if test -n \"\$relink_command\"; then
  1.3493 +      if relink_command_output=\`eval \$relink_command 2>&1\`; then :
  1.3494 +      else
  1.3495 +	$ECHO \"\$relink_command_output\" >&2
  1.3496 +	$RM \"\$progdir/\$file\"
  1.3497 +	exit 1
  1.3498        fi
  1.3499 -
  1.3500 -      # Append the name of the non-PIC object the libtool object file.
  1.3501 -      # Only append if the libtool object file exists.
  1.3502 -      test -z "$run" && cat >> ${libobj}T <<EOF
  1.3503 -# Name of the non-PIC object.
  1.3504 -non_pic_object='$objname'
  1.3505 +    fi
  1.3506 +
  1.3507 +    $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
  1.3508 +    { $RM \"\$progdir/\$program\";
  1.3509 +      $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
  1.3510 +    $RM \"\$progdir/\$file\"
  1.3511 +  fi"
  1.3512 +	else
  1.3513 +	  $ECHO "\
  1.3514 +  program='$outputname'
  1.3515 +  progdir=\"\$thisdir/$objdir\"
  1.3516 +"
  1.3517 +	fi
  1.3518 +
  1.3519 +	$ECHO "\
  1.3520 +
  1.3521 +  if test -f \"\$progdir/\$program\"; then"
  1.3522 +
  1.3523 +	# Export our shlibpath_var if we have one.
  1.3524 +	if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  1.3525 +	  $ECHO "\
  1.3526 +    # Add our own library path to $shlibpath_var
  1.3527 +    $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
  1.3528 +
  1.3529 +    # Some systems cannot cope with colon-terminated $shlibpath_var
  1.3530 +    # The second colon is a workaround for a bug in BeOS R4 sed
  1.3531 +    $shlibpath_var=\`\$ECHO \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
  1.3532 +
  1.3533 +    export $shlibpath_var
  1.3534 +"
  1.3535 +	fi
  1.3536 +
  1.3537 +	# fixup the dll searchpath if we need to.
  1.3538 +	if test -n "$dllsearchpath"; then
  1.3539 +	  $ECHO "\
  1.3540 +    # Add the dll search path components to the executable PATH
  1.3541 +    PATH=$dllsearchpath:\$PATH
  1.3542 +"
  1.3543 +	fi
  1.3544 +
  1.3545 +	$ECHO "\
  1.3546 +    if test \"\$libtool_execute_magic\" != \"$magic\"; then
  1.3547 +      # Run the actual program with our arguments.
  1.3548 +"
  1.3549 +	case $host in
  1.3550 +	# Backslashes separate directories on plain windows
  1.3551 +	*-*-mingw | *-*-os2* | *-cegcc*)
  1.3552 +	  $ECHO "\
  1.3553 +      exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
  1.3554 +"
  1.3555 +	  ;;
  1.3556 +
  1.3557 +	*)
  1.3558 +	  $ECHO "\
  1.3559 +      exec \"\$progdir/\$program\" \${1+\"\$@\"}
  1.3560 +"
  1.3561 +	  ;;
  1.3562 +	esac
  1.3563 +	$ECHO "\
  1.3564 +      \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
  1.3565 +      exit 1
  1.3566 +    fi
  1.3567 +  else
  1.3568 +    # The program doesn't exist.
  1.3569 +    \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
  1.3570 +    \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
  1.3571 +    $ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
  1.3572 +    exit 1
  1.3573 +  fi
  1.3574 +fi\
  1.3575 +"
  1.3576 +}
  1.3577 +# end: func_emit_wrapper_part2
  1.3578 +
  1.3579 +
  1.3580 +# func_emit_wrapper [arg=no]
  1.3581 +#
  1.3582 +# Emit a libtool wrapper script on stdout.
  1.3583 +# Don't directly open a file because we may want to
  1.3584 +# incorporate the script contents within a cygwin/mingw
  1.3585 +# wrapper executable.  Must ONLY be called from within
  1.3586 +# func_mode_link because it depends on a number of variables
  1.3587 +# set therein.
  1.3588 +#
  1.3589 +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
  1.3590 +# variable will take.  If 'yes', then the emitted script
  1.3591 +# will assume that the directory in which it is stored is
  1.3592 +# the $objdir directory.  This is a cygwin/mingw-specific
  1.3593 +# behavior.
  1.3594 +func_emit_wrapper ()
  1.3595 +{
  1.3596 +	func_emit_wrapper_arg1=no
  1.3597 +	if test -n "$1" ; then
  1.3598 +	  func_emit_wrapper_arg1=$1
  1.3599 +	fi
  1.3600 +
  1.3601 +	# split this up so that func_emit_cwrapperexe_src
  1.3602 +	# can call each part independently.
  1.3603 +	func_emit_wrapper_part1 "${func_emit_wrapper_arg1}"
  1.3604 +	func_emit_wrapper_part2 "${func_emit_wrapper_arg1}"
  1.3605 +}
  1.3606 +
  1.3607 +
  1.3608 +# func_to_host_path arg
  1.3609 +#
  1.3610 +# Convert paths to host format when used with build tools.
  1.3611 +# Intended for use with "native" mingw (where libtool itself
  1.3612 +# is running under the msys shell), or in the following cross-
  1.3613 +# build environments:
  1.3614 +#    $build          $host
  1.3615 +#    mingw (msys)    mingw  [e.g. native]
  1.3616 +#    cygwin          mingw
  1.3617 +#    *nix + wine     mingw
  1.3618 +# where wine is equipped with the `winepath' executable.
  1.3619 +# In the native mingw case, the (msys) shell automatically
  1.3620 +# converts paths for any non-msys applications it launches,
  1.3621 +# but that facility isn't available from inside the cwrapper.
  1.3622 +# Similar accommodations are necessary for $host mingw and
  1.3623 +# $build cygwin.  Calling this function does no harm for other
  1.3624 +# $host/$build combinations not listed above.
  1.3625 +#
  1.3626 +# ARG is the path (on $build) that should be converted to
  1.3627 +# the proper representation for $host. The result is stored
  1.3628 +# in $func_to_host_path_result.
  1.3629 +func_to_host_path ()
  1.3630 +{
  1.3631 +  func_to_host_path_result="$1"
  1.3632 +  if test -n "$1" ; then
  1.3633 +    case $host in
  1.3634 +      *mingw* )
  1.3635 +        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
  1.3636 +        case $build in
  1.3637 +          *mingw* ) # actually, msys
  1.3638 +            # awkward: cmd appends spaces to result
  1.3639 +            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
  1.3640 +            func_to_host_path_tmp1=`( cmd //c echo "$1" |\
  1.3641 +              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
  1.3642 +            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
  1.3643 +              $SED -e "$lt_sed_naive_backslashify"`
  1.3644 +            ;;
  1.3645 +          *cygwin* )
  1.3646 +            func_to_host_path_tmp1=`cygpath -w "$1"`
  1.3647 +            func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
  1.3648 +              $SED -e "$lt_sed_naive_backslashify"`
  1.3649 +            ;;
  1.3650 +          * )
  1.3651 +            # Unfortunately, winepath does not exit with a non-zero
  1.3652 +            # error code, so we are forced to check the contents of
  1.3653 +            # stdout. On the other hand, if the command is not
  1.3654 +            # found, the shell will set an exit code of 127 and print
  1.3655 +            # *an error message* to stdout. So we must check for both
  1.3656 +            # error code of zero AND non-empty stdout, which explains
  1.3657 +            # the odd construction:
  1.3658 +            func_to_host_path_tmp1=`winepath -w "$1" 2>/dev/null`
  1.3659 +            if test "$?" -eq 0 && test -n "${func_to_host_path_tmp1}"; then
  1.3660 +              func_to_host_path_result=`echo "$func_to_host_path_tmp1" |\
  1.3661 +                $SED -e "$lt_sed_naive_backslashify"`
  1.3662 +            else
  1.3663 +              # Allow warning below.
  1.3664 +              func_to_host_path_result=""
  1.3665 +            fi
  1.3666 +            ;;
  1.3667 +        esac
  1.3668 +        if test -z "$func_to_host_path_result" ; then
  1.3669 +          #func_error "Could not determine host path corresponding to"
  1.3670 +          #func_error "  '$1'"
  1.3671 +          #func_error "Continuing, but uninstalled executables may not work."
  1.3672 +          # Fallback:
  1.3673 +          func_to_host_path_result="$1"
  1.3674 +        fi
  1.3675 +        ;;
  1.3676 +    esac
  1.3677 +  fi
  1.3678 +}
  1.3679 +# end: func_to_host_path
  1.3680 +
  1.3681 +# func_to_host_pathlist arg
  1.3682 +#
  1.3683 +# Convert pathlists to host format when used with build tools.
  1.3684 +# See func_to_host_path(), above. This function supports the
  1.3685 +# following $build/$host combinations (but does no harm for
  1.3686 +# combinations not listed here):
  1.3687 +#    $build          $host
  1.3688 +#    mingw (msys)    mingw  [e.g. native]
  1.3689 +#    cygwin          mingw
  1.3690 +#    *nix + wine     mingw
  1.3691 +#
  1.3692 +# Path separators are also converted from $build format to
  1.3693 +# $host format. If ARG begins or ends with a path separator
  1.3694 +# character, it is preserved (but converted to $host format)
  1.3695 +# on output.
  1.3696 +#
  1.3697 +# ARG is a pathlist (on $build) that should be converted to
  1.3698 +# the proper representation on $host. The result is stored
  1.3699 +# in $func_to_host_pathlist_result.
  1.3700 +func_to_host_pathlist ()
  1.3701 +{
  1.3702 +  func_to_host_pathlist_result="$1"
  1.3703 +  if test -n "$1" ; then
  1.3704 +    case $host in
  1.3705 +      *mingw* )
  1.3706 +        lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
  1.3707 +        # Remove leading and trailing path separator characters from
  1.3708 +        # ARG. msys behavior is inconsistent here, cygpath turns them
  1.3709 +        # into '.;' and ';.', and winepath ignores them completely.
  1.3710 +        func_to_host_pathlist_tmp2="$1"
  1.3711 +        # Once set for this call, this variable should not be
  1.3712 +        # reassigned. It is used in tha fallback case.
  1.3713 +        func_to_host_pathlist_tmp1=`echo "$func_to_host_pathlist_tmp2" |\
  1.3714 +          $SED -e 's|^:*||' -e 's|:*$||'`
  1.3715 +        case $build in
  1.3716 +          *mingw* ) # Actually, msys.
  1.3717 +            # Awkward: cmd appends spaces to result.
  1.3718 +            lt_sed_strip_trailing_spaces="s/[ ]*\$//"
  1.3719 +            func_to_host_pathlist_tmp2=`( cmd //c echo "$func_to_host_pathlist_tmp1" |\
  1.3720 +              $SED -e "$lt_sed_strip_trailing_spaces" ) 2>/dev/null || echo ""`
  1.3721 +            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
  1.3722 +              $SED -e "$lt_sed_naive_backslashify"`
  1.3723 +            ;;
  1.3724 +          *cygwin* )
  1.3725 +            func_to_host_pathlist_tmp2=`cygpath -w -p "$func_to_host_pathlist_tmp1"`
  1.3726 +            func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp2" |\
  1.3727 +              $SED -e "$lt_sed_naive_backslashify"`
  1.3728 +            ;;
  1.3729 +          * )
  1.3730 +            # unfortunately, winepath doesn't convert pathlists
  1.3731 +            func_to_host_pathlist_result=""
  1.3732 +            func_to_host_pathlist_oldIFS=$IFS
  1.3733 +            IFS=:
  1.3734 +            for func_to_host_pathlist_f in $func_to_host_pathlist_tmp1 ; do
  1.3735 +              IFS=$func_to_host_pathlist_oldIFS
  1.3736 +              if test -n "$func_to_host_pathlist_f" ; then
  1.3737 +                func_to_host_path "$func_to_host_pathlist_f"
  1.3738 +                if test -n "$func_to_host_path_result" ; then
  1.3739 +                  if test -z "$func_to_host_pathlist_result" ; then
  1.3740 +                    func_to_host_pathlist_result="$func_to_host_path_result"
  1.3741 +                  else
  1.3742 +                    func_to_host_pathlist_result="$func_to_host_pathlist_result;$func_to_host_path_result"
  1.3743 +                  fi
  1.3744 +                fi
  1.3745 +              fi
  1.3746 +              IFS=:
  1.3747 +            done
  1.3748 +            IFS=$func_to_host_pathlist_oldIFS
  1.3749 +            ;;
  1.3750 +        esac
  1.3751 +        if test -z "$func_to_host_pathlist_result" ; then
  1.3752 +          func_error "Could not determine the host path(s) corresponding to"
  1.3753 +          func_error "  '$1'"
  1.3754 +          func_error "Continuing, but uninstalled executables may not work."
  1.3755 +          # Fallback. This may break if $1 contains DOS-style drive
  1.3756 +          # specifications. The fix is not to complicate the expression
  1.3757 +          # below, but for the user to provide a working wine installation
  1.3758 +          # with winepath so that path translation in the cross-to-mingw
  1.3759 +          # case works properly.
  1.3760 +          lt_replace_pathsep_nix_to_dos="s|:|;|g"
  1.3761 +          func_to_host_pathlist_result=`echo "$func_to_host_pathlist_tmp1" |\
  1.3762 +            $SED -e "$lt_replace_pathsep_nix_to_dos"`
  1.3763 +        fi
  1.3764 +        # Now, add the leading and trailing path separators back
  1.3765 +        case "$1" in
  1.3766 +          :* ) func_to_host_pathlist_result=";$func_to_host_pathlist_result"
  1.3767 +            ;;
  1.3768 +        esac
  1.3769 +        case "$1" in
  1.3770 +          *: ) func_to_host_pathlist_result="$func_to_host_pathlist_result;"
  1.3771 +            ;;
  1.3772 +        esac
  1.3773 +        ;;
  1.3774 +    esac
  1.3775 +  fi
  1.3776 +}
  1.3777 +# end: func_to_host_pathlist
  1.3778 +
  1.3779 +# func_emit_cwrapperexe_src
  1.3780 +# emit the source code for a wrapper executable on stdout
  1.3781 +# Must ONLY be called from within func_mode_link because
  1.3782 +# it depends on a number of variable set therein.
  1.3783 +func_emit_cwrapperexe_src ()
  1.3784 +{
  1.3785 +	cat <<EOF
  1.3786 +
  1.3787 +/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
  1.3788 +   Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
  1.3789 +
  1.3790 +   The $output program cannot be directly executed until all the libtool
  1.3791 +   libraries that it depends on are installed.
  1.3792 +
  1.3793 +   This wrapper executable should never be moved out of the build directory.
  1.3794 +   If it is, it will not operate correctly.
  1.3795 +
  1.3796 +   Currently, it simply execs the wrapper *script* "$SHELL $output",
  1.3797 +   but could eventually absorb all of the scripts functionality and
  1.3798 +   exec $objdir/$outputname directly.
  1.3799 +*/
  1.3800 +EOF
  1.3801 +	    cat <<"EOF"
  1.3802 +#include <stdio.h>
  1.3803 +#include <stdlib.h>
  1.3804 +#ifdef _MSC_VER
  1.3805 +# include <direct.h>
  1.3806 +# include <process.h>
  1.3807 +# include <io.h>
  1.3808 +# define setmode _setmode
  1.3809 +#else
  1.3810 +# include <unistd.h>
  1.3811 +# include <stdint.h>
  1.3812 +# ifdef __CYGWIN__
  1.3813 +#  include <io.h>
  1.3814 +#  define HAVE_SETENV
  1.3815 +#  ifdef __STRICT_ANSI__
  1.3816 +char *realpath (const char *, char *);
  1.3817 +int putenv (char *);
  1.3818 +int setenv (const char *, const char *, int);
  1.3819 +#  endif
  1.3820 +# endif
  1.3821 +#endif
  1.3822 +#include <malloc.h>
  1.3823 +#include <stdarg.h>
  1.3824 +#include <assert.h>
  1.3825 +#include <string.h>
  1.3826 +#include <ctype.h>
  1.3827 +#include <errno.h>
  1.3828 +#include <fcntl.h>
  1.3829 +#include <sys/stat.h>
  1.3830 +
  1.3831 +#if defined(PATH_MAX)
  1.3832 +# define LT_PATHMAX PATH_MAX
  1.3833 +#elif defined(MAXPATHLEN)
  1.3834 +# define LT_PATHMAX MAXPATHLEN
  1.3835 +#else
  1.3836 +# define LT_PATHMAX 1024
  1.3837 +#endif
  1.3838 +
  1.3839 +#ifndef S_IXOTH
  1.3840 +# define S_IXOTH 0
  1.3841 +#endif
  1.3842 +#ifndef S_IXGRP
  1.3843 +# define S_IXGRP 0
  1.3844 +#endif
  1.3845 +
  1.3846 +#ifdef _MSC_VER
  1.3847 +# define S_IXUSR _S_IEXEC
  1.3848 +# define stat _stat
  1.3849 +# ifndef _INTPTR_T_DEFINED
  1.3850 +#  define intptr_t int
  1.3851 +# endif
  1.3852 +#endif
  1.3853 +
  1.3854 +#ifndef DIR_SEPARATOR
  1.3855 +# define DIR_SEPARATOR '/'
  1.3856 +# define PATH_SEPARATOR ':'
  1.3857 +#endif
  1.3858 +
  1.3859 +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
  1.3860 +  defined (__OS2__)
  1.3861 +# define HAVE_DOS_BASED_FILE_SYSTEM
  1.3862 +# define FOPEN_WB "wb"
  1.3863 +# ifndef DIR_SEPARATOR_2
  1.3864 +#  define DIR_SEPARATOR_2 '\\'
  1.3865 +# endif
  1.3866 +# ifndef PATH_SEPARATOR_2
  1.3867 +#  define PATH_SEPARATOR_2 ';'
  1.3868 +# endif
  1.3869 +#endif
  1.3870 +
  1.3871 +#ifndef DIR_SEPARATOR_2
  1.3872 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
  1.3873 +#else /* DIR_SEPARATOR_2 */
  1.3874 +# define IS_DIR_SEPARATOR(ch) \
  1.3875 +	(((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
  1.3876 +#endif /* DIR_SEPARATOR_2 */
  1.3877 +
  1.3878 +#ifndef PATH_SEPARATOR_2
  1.3879 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
  1.3880 +#else /* PATH_SEPARATOR_2 */
  1.3881 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
  1.3882 +#endif /* PATH_SEPARATOR_2 */
  1.3883 +
  1.3884 +#ifdef __CYGWIN__
  1.3885 +# define FOPEN_WB "wb"
  1.3886 +#endif
  1.3887 +
  1.3888 +#ifndef FOPEN_WB
  1.3889 +# define FOPEN_WB "w"
  1.3890 +#endif
  1.3891 +#ifndef _O_BINARY
  1.3892 +# define _O_BINARY 0
  1.3893 +#endif
  1.3894 +
  1.3895 +#define XMALLOC(type, num)      ((type *) xmalloc ((num) * sizeof(type)))
  1.3896 +#define XFREE(stale) do { \
  1.3897 +  if (stale) { free ((void *) stale); stale = 0; } \
  1.3898 +} while (0)
  1.3899 +
  1.3900 +#undef LTWRAPPER_DEBUGPRINTF
  1.3901 +#if defined DEBUGWRAPPER
  1.3902 +# define LTWRAPPER_DEBUGPRINTF(args) ltwrapper_debugprintf args
  1.3903 +static void
  1.3904 +ltwrapper_debugprintf (const char *fmt, ...)
  1.3905 +{
  1.3906 +    va_list args;
  1.3907 +    va_start (args, fmt);
  1.3908 +    (void) vfprintf (stderr, fmt, args);
  1.3909 +    va_end (args);
  1.3910 +}
  1.3911 +#else
  1.3912 +# define LTWRAPPER_DEBUGPRINTF(args)
  1.3913 +#endif
  1.3914 +
  1.3915 +const char *program_name = NULL;
  1.3916 +
  1.3917 +void *xmalloc (size_t num);
  1.3918 +char *xstrdup (const char *string);
  1.3919 +const char *base_name (const char *name);
  1.3920 +char *find_executable (const char *wrapper);
  1.3921 +char *chase_symlinks (const char *pathspec);
  1.3922 +int make_executable (const char *path);
  1.3923 +int check_executable (const char *path);
  1.3924 +char *strendzap (char *str, const char *pat);
  1.3925 +void lt_fatal (const char *message, ...);
  1.3926 +void lt_setenv (const char *name, const char *value);
  1.3927 +char *lt_extend_str (const char *orig_value, const char *add, int to_end);
  1.3928 +void lt_opt_process_env_set (const char *arg);
  1.3929 +void lt_opt_process_env_prepend (const char *arg);
  1.3930 +void lt_opt_process_env_append (const char *arg);
  1.3931 +int lt_split_name_value (const char *arg, char** name, char** value);
  1.3932 +void lt_update_exe_path (const char *name, const char *value);
  1.3933 +void lt_update_lib_path (const char *name, const char *value);
  1.3934 +
  1.3935 +static const char *script_text_part1 =
  1.3936 +EOF
  1.3937 +
  1.3938 +	    func_emit_wrapper_part1 yes |
  1.3939 +	        $SED -e 's/\([\\"]\)/\\\1/g' \
  1.3940 +	             -e 's/^/  "/' -e 's/$/\\n"/'
  1.3941 +	    echo ";"
  1.3942 +	    cat <<EOF
  1.3943 +
  1.3944 +static const char *script_text_part2 =
  1.3945 +EOF
  1.3946 +	    func_emit_wrapper_part2 yes |
  1.3947 +	        $SED -e 's/\([\\"]\)/\\\1/g' \
  1.3948 +	             -e 's/^/  "/' -e 's/$/\\n"/'
  1.3949 +	    echo ";"
  1.3950 +
  1.3951 +	    cat <<EOF
  1.3952 +const char * MAGIC_EXE = "$magic_exe";
  1.3953 +const char * LIB_PATH_VARNAME = "$shlibpath_var";
  1.3954 +EOF
  1.3955 +
  1.3956 +	    if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
  1.3957 +              func_to_host_pathlist "$temp_rpath"
  1.3958 +	      cat <<EOF
  1.3959 +const char * LIB_PATH_VALUE   = "$func_to_host_pathlist_result";
  1.3960 +EOF
  1.3961 +	    else
  1.3962 +	      cat <<"EOF"
  1.3963 +const char * LIB_PATH_VALUE   = "";
  1.3964 +EOF
  1.3965 +	    fi
  1.3966 +
  1.3967 +	    if test -n "$dllsearchpath"; then
  1.3968 +              func_to_host_pathlist "$dllsearchpath:"
  1.3969 +	      cat <<EOF
  1.3970 +const char * EXE_PATH_VARNAME = "PATH";
  1.3971 +const char * EXE_PATH_VALUE   = "$func_to_host_pathlist_result";
  1.3972 +EOF
  1.3973 +	    else
  1.3974 +	      cat <<"EOF"
  1.3975 +const char * EXE_PATH_VARNAME = "";
  1.3976 +const char * EXE_PATH_VALUE   = "";
  1.3977 +EOF
  1.3978 +	    fi
  1.3979 +
  1.3980 +	    if test "$fast_install" = yes; then
  1.3981 +	      cat <<EOF
  1.3982 +const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
  1.3983 +EOF
  1.3984 +	    else
  1.3985 +	      cat <<EOF
  1.3986 +const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
  1.3987 +EOF
  1.3988 +	    fi
  1.3989 +
  1.3990 +
  1.3991 +	    cat <<"EOF"
  1.3992 +
  1.3993 +#define LTWRAPPER_OPTION_PREFIX         "--lt-"
  1.3994 +#define LTWRAPPER_OPTION_PREFIX_LENGTH  5
  1.3995 +
  1.3996 +static const size_t opt_prefix_len         = LTWRAPPER_OPTION_PREFIX_LENGTH;
  1.3997 +static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
  1.3998 +
  1.3999 +static const char *dumpscript_opt       = LTWRAPPER_OPTION_PREFIX "dump-script";
  1.4000 +
  1.4001 +static const size_t env_set_opt_len     = LTWRAPPER_OPTION_PREFIX_LENGTH + 7;
  1.4002 +static const char *env_set_opt          = LTWRAPPER_OPTION_PREFIX "env-set";
  1.4003 +  /* argument is putenv-style "foo=bar", value of foo is set to bar */
  1.4004 +
  1.4005 +static const size_t env_prepend_opt_len = LTWRAPPER_OPTION_PREFIX_LENGTH + 11;
  1.4006 +static const char *env_prepend_opt      = LTWRAPPER_OPTION_PREFIX "env-prepend";
  1.4007 +  /* argument is putenv-style "foo=bar", new value of foo is bar${foo} */
  1.4008 +
  1.4009 +static const size_t env_append_opt_len  = LTWRAPPER_OPTION_PREFIX_LENGTH + 10;
  1.4010 +static const char *env_append_opt       = LTWRAPPER_OPTION_PREFIX "env-append";
  1.4011 +  /* argument is putenv-style "foo=bar", new value of foo is ${foo}bar */
  1.4012 +
  1.4013 +#undef main
  1.4014 +int
  1.4015 +main (int argc, char *argv[])
  1.4016 +{
  1.4017 +  char **newargz;
  1.4018 +  int  newargc;
  1.4019 +  char *tmp_pathspec;
  1.4020 +  char *actual_cwrapper_path;
  1.4021 +  char *actual_cwrapper_name;
  1.4022 +  char *target_name;
  1.4023 +  char *lt_argv_zero;
  1.4024 +  intptr_t rval = 127;
  1.4025 +
  1.4026 +  int i;
  1.4027 +
  1.4028 +  program_name = (char *) xstrdup (base_name (argv[0]));
  1.4029 +  LTWRAPPER_DEBUGPRINTF (("(main) argv[0]      : %s\n", argv[0]));
  1.4030 +  LTWRAPPER_DEBUGPRINTF (("(main) program_name : %s\n", program_name));
  1.4031 +
  1.4032 +  /* very simple arg parsing; don't want to rely on getopt */
  1.4033 +  for (i = 1; i < argc; i++)
  1.4034 +    {
  1.4035 +      if (strcmp (argv[i], dumpscript_opt) == 0)
  1.4036 +	{
  1.4037 +EOF
  1.4038 +	    case "$host" in
  1.4039 +	      *mingw* | *cygwin* )
  1.4040 +		# make stdout use "unix" line endings
  1.4041 +		echo "          setmode(1,_O_BINARY);"
  1.4042 +		;;
  1.4043 +	      esac
  1.4044 +
  1.4045 +	    cat <<"EOF"
  1.4046 +	  printf ("%s", script_text_part1);
  1.4047 +	  printf ("%s", script_text_part2);
  1.4048 +	  return 0;
  1.4049 +	}
  1.4050 +    }
  1.4051 +
  1.4052 +  newargz = XMALLOC (char *, argc + 1);
  1.4053 +  tmp_pathspec = find_executable (argv[0]);
  1.4054 +  if (tmp_pathspec == NULL)
  1.4055 +    lt_fatal ("Couldn't find %s", argv[0]);
  1.4056 +  LTWRAPPER_DEBUGPRINTF (("(main) found exe (before symlink chase) at : %s\n",
  1.4057 +			  tmp_pathspec));
  1.4058 +
  1.4059 +  actual_cwrapper_path = chase_symlinks (tmp_pathspec);
  1.4060 +  LTWRAPPER_DEBUGPRINTF (("(main) found exe (after symlink chase) at : %s\n",
  1.4061 +			  actual_cwrapper_path));
  1.4062 +  XFREE (tmp_pathspec);
  1.4063 +
  1.4064 +  actual_cwrapper_name = xstrdup( base_name (actual_cwrapper_path));
  1.4065 +  strendzap (actual_cwrapper_path, actual_cwrapper_name);
  1.4066 +
  1.4067 +  /* wrapper name transforms */
  1.4068 +  strendzap (actual_cwrapper_name, ".exe");
  1.4069 +  tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
  1.4070 +  XFREE (actual_cwrapper_name);
  1.4071 +  actual_cwrapper_name = tmp_pathspec;
  1.4072 +  tmp_pathspec = 0;
  1.4073 +
  1.4074 +  /* target_name transforms -- use actual target program name; might have lt- prefix */
  1.4075 +  target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
  1.4076 +  strendzap (target_name, ".exe");
  1.4077 +  tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
  1.4078 +  XFREE (target_name);
  1.4079 +  target_name = tmp_pathspec;
  1.4080 +  tmp_pathspec = 0;
  1.4081 +
  1.4082 +  LTWRAPPER_DEBUGPRINTF (("(main) libtool target name: %s\n",
  1.4083 +			  target_name));
  1.4084 +EOF
  1.4085 +
  1.4086 +	    cat <<EOF
  1.4087 +  newargz[0] =
  1.4088 +    XMALLOC (char, (strlen (actual_cwrapper_path) +
  1.4089 +		    strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
  1.4090 +  strcpy (newargz[0], actual_cwrapper_path);
  1.4091 +  strcat (newargz[0], "$objdir");
  1.4092 +  strcat (newargz[0], "/");
  1.4093 +EOF
  1.4094 +
  1.4095 +	    cat <<"EOF"
  1.4096 +  /* stop here, and copy so we don't have to do this twice */
  1.4097 +  tmp_pathspec = xstrdup (newargz[0]);
  1.4098 +
  1.4099 +  /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
  1.4100 +  strcat (newargz[0], actual_cwrapper_name);
  1.4101 +
  1.4102 +  /* DO want the lt- prefix here if it exists, so use target_name */
  1.4103 +  lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
  1.4104 +  XFREE (tmp_pathspec);
  1.4105 +  tmp_pathspec = NULL;
  1.4106 +EOF
  1.4107 +
  1.4108 +	    case $host_os in
  1.4109 +	      mingw*)
  1.4110 +	    cat <<"EOF"
  1.4111 +  {
  1.4112 +    char* p;
  1.4113 +    while ((p = strchr (newargz[0], '\\')) != NULL)
  1.4114 +      {
  1.4115 +	*p = '/';
  1.4116 +      }
  1.4117 +    while ((p = strchr (lt_argv_zero, '\\')) != NULL)
  1.4118 +      {
  1.4119 +	*p = '/';
  1.4120 +      }
  1.4121 +  }
  1.4122 +EOF
  1.4123 +	    ;;
  1.4124 +	    esac
  1.4125 +
  1.4126 +	    cat <<"EOF"
  1.4127 +  XFREE (target_name);
  1.4128 +  XFREE (actual_cwrapper_path);
  1.4129 +  XFREE (actual_cwrapper_name);
  1.4130 +
  1.4131 +  lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
  1.4132 +  lt_setenv ("DUALCASE", "1");  /* for MSK sh */
  1.4133 +  lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
  1.4134 +  lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
  1.4135 +
  1.4136 +  newargc=0;
  1.4137 +  for (i = 1; i < argc; i++)
  1.4138 +    {
  1.4139 +      if (strncmp (argv[i], env_set_opt, env_set_opt_len) == 0)
  1.4140 +        {
  1.4141 +          if (argv[i][env_set_opt_len] == '=')
  1.4142 +            {
  1.4143 +              const char *p = argv[i] + env_set_opt_len + 1;
  1.4144 +              lt_opt_process_env_set (p);
  1.4145 +            }
  1.4146 +          else if (argv[i][env_set_opt_len] == '\0' && i + 1 < argc)
  1.4147 +            {
  1.4148 +              lt_opt_process_env_set (argv[++i]); /* don't copy */
  1.4149 +            }
  1.4150 +          else
  1.4151 +            lt_fatal ("%s missing required argument", env_set_opt);
  1.4152 +          continue;
  1.4153 +        }
  1.4154 +      if (strncmp (argv[i], env_prepend_opt, env_prepend_opt_len) == 0)
  1.4155 +        {
  1.4156 +          if (argv[i][env_prepend_opt_len] == '=')
  1.4157 +            {
  1.4158 +              const char *p = argv[i] + env_prepend_opt_len + 1;
  1.4159 +              lt_opt_process_env_prepend (p);
  1.4160 +            }
  1.4161 +          else if (argv[i][env_prepend_opt_len] == '\0' && i + 1 < argc)
  1.4162 +            {
  1.4163 +              lt_opt_process_env_prepend (argv[++i]); /* don't copy */
  1.4164 +            }
  1.4165 +          else
  1.4166 +            lt_fatal ("%s missing required argument", env_prepend_opt);
  1.4167 +          continue;
  1.4168 +        }
  1.4169 +      if (strncmp (argv[i], env_append_opt, env_append_opt_len) == 0)
  1.4170 +        {
  1.4171 +          if (argv[i][env_append_opt_len] == '=')
  1.4172 +            {
  1.4173 +              const char *p = argv[i] + env_append_opt_len + 1;
  1.4174 +              lt_opt_process_env_append (p);
  1.4175 +            }
  1.4176 +          else if (argv[i][env_append_opt_len] == '\0' && i + 1 < argc)
  1.4177 +            {
  1.4178 +              lt_opt_process_env_append (argv[++i]); /* don't copy */
  1.4179 +            }
  1.4180 +          else
  1.4181 +            lt_fatal ("%s missing required argument", env_append_opt);
  1.4182 +          continue;
  1.4183 +        }
  1.4184 +      if (strncmp (argv[i], ltwrapper_option_prefix, opt_prefix_len) == 0)
  1.4185 +        {
  1.4186 +          /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
  1.4187 +             namespace, but it is not one of the ones we know about and
  1.4188 +             have already dealt with, above (inluding dump-script), then
  1.4189 +             report an error. Otherwise, targets might begin to believe
  1.4190 +             they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
  1.4191 +             namespace. The first time any user complains about this, we'll
  1.4192 +             need to make LTWRAPPER_OPTION_PREFIX a configure-time option
  1.4193 +             or a configure.ac-settable value.
  1.4194 +           */
  1.4195 +          lt_fatal ("Unrecognized option in %s namespace: '%s'",
  1.4196 +                    ltwrapper_option_prefix, argv[i]);
  1.4197 +        }
  1.4198 +      /* otherwise ... */
  1.4199 +      newargz[++newargc] = xstrdup (argv[i]);
  1.4200 +    }
  1.4201 +  newargz[++newargc] = NULL;
  1.4202 +
  1.4203 +  LTWRAPPER_DEBUGPRINTF     (("(main) lt_argv_zero : %s\n", (lt_argv_zero ? lt_argv_zero : "<NULL>")));
  1.4204 +  for (i = 0; i < newargc; i++)
  1.4205 +    {
  1.4206 +      LTWRAPPER_DEBUGPRINTF (("(main) newargz[%d]   : %s\n", i, (newargz[i] ? newargz[i] : "<NULL>")));
  1.4207 +    }
  1.4208  
  1.4209  EOF
  1.4210 -    else
  1.4211 -      # Append the name of the non-PIC object the libtool object file.
  1.4212 -      # Only append if the libtool object file exists.
  1.4213 -      test -z "$run" && cat >> ${libobj}T <<EOF
  1.4214 -# Name of the non-PIC object.
  1.4215 -non_pic_object=none
  1.4216 +
  1.4217 +	    case $host_os in
  1.4218 +	      mingw*)
  1.4219 +		cat <<"EOF"
  1.4220 +  /* execv doesn't actually work on mingw as expected on unix */
  1.4221 +  rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
  1.4222 +  if (rval == -1)
  1.4223 +    {
  1.4224 +      /* failed to start process */
  1.4225 +      LTWRAPPER_DEBUGPRINTF (("(main) failed to launch target \"%s\": errno = %d\n", lt_argv_zero, errno));
  1.4226 +      return 127;
  1.4227 +    }
  1.4228 +  return rval;
  1.4229 +EOF
  1.4230 +		;;
  1.4231 +	      *)
  1.4232 +		cat <<"EOF"
  1.4233 +  execv (lt_argv_zero, newargz);
  1.4234 +  return rval; /* =127, but avoids unused variable warning */
  1.4235 +EOF
  1.4236 +		;;
  1.4237 +	    esac
  1.4238 +
  1.4239 +	    cat <<"EOF"
  1.4240 +}
  1.4241 +
  1.4242 +void *
  1.4243 +xmalloc (size_t num)
  1.4244 +{
  1.4245 +  void *p = (void *) malloc (num);
  1.4246 +  if (!p)
  1.4247 +    lt_fatal ("Memory exhausted");
  1.4248 +
  1.4249 +  return p;
  1.4250 +}
  1.4251 +
  1.4252 +char *
  1.4253 +xstrdup (const char *string)
  1.4254 +{
  1.4255 +  return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
  1.4256 +			  string) : NULL;
  1.4257 +}
  1.4258 +
  1.4259 +const char *
  1.4260 +base_name (const char *name)
  1.4261 +{
  1.4262 +  const char *base;
  1.4263 +
  1.4264 +#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  1.4265 +  /* Skip over the disk name in MSDOS pathnames. */
  1.4266 +  if (isalpha ((unsigned char) name[0]) && name[1] == ':')
  1.4267 +    name += 2;
  1.4268 +#endif
  1.4269 +
  1.4270 +  for (base = name; *name; name++)
  1.4271 +    if (IS_DIR_SEPARATOR (*name))
  1.4272 +      base = name + 1;
  1.4273 +  return base;
  1.4274 +}
  1.4275 +
  1.4276 +int
  1.4277 +check_executable (const char *path)
  1.4278 +{
  1.4279 +  struct stat st;
  1.4280 +
  1.4281 +  LTWRAPPER_DEBUGPRINTF (("(check_executable)  : %s\n",
  1.4282 +			  path ? (*path ? path : "EMPTY!") : "NULL!"));
  1.4283 +  if ((!path) || (!*path))
  1.4284 +    return 0;
  1.4285 +
  1.4286 +  if ((stat (path, &st) >= 0)
  1.4287 +      && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
  1.4288 +    return 1;
  1.4289 +  else
  1.4290 +    return 0;
  1.4291 +}
  1.4292 +
  1.4293 +int
  1.4294 +make_executable (const char *path)
  1.4295 +{
  1.4296 +  int rval = 0;
  1.4297 +  struct stat st;
  1.4298 +
  1.4299 +  LTWRAPPER_DEBUGPRINTF (("(make_executable)   : %s\n",
  1.4300 +			  path ? (*path ? path : "EMPTY!") : "NULL!"));
  1.4301 +  if ((!path) || (!*path))
  1.4302 +    return 0;
  1.4303 +
  1.4304 +  if (stat (path, &st) >= 0)
  1.4305 +    {
  1.4306 +      rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
  1.4307 +    }
  1.4308 +  return rval;
  1.4309 +}
  1.4310 +
  1.4311 +/* Searches for the full path of the wrapper.  Returns
  1.4312 +   newly allocated full path name if found, NULL otherwise
  1.4313 +   Does not chase symlinks, even on platforms that support them.
  1.4314 +*/
  1.4315 +char *
  1.4316 +find_executable (const char *wrapper)
  1.4317 +{
  1.4318 +  int has_slash = 0;
  1.4319 +  const char *p;
  1.4320 +  const char *p_next;
  1.4321 +  /* static buffer for getcwd */
  1.4322 +  char tmp[LT_PATHMAX + 1];
  1.4323 +  int tmp_len;
  1.4324 +  char *concat_name;
  1.4325 +
  1.4326 +  LTWRAPPER_DEBUGPRINTF (("(find_executable)   : %s\n",
  1.4327 +			  wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!"));
  1.4328 +
  1.4329 +  if ((wrapper == NULL) || (*wrapper == '\0'))
  1.4330 +    return NULL;
  1.4331 +
  1.4332 +  /* Absolute path? */
  1.4333 +#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  1.4334 +  if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
  1.4335 +    {
  1.4336 +      concat_name = xstrdup (wrapper);
  1.4337 +      if (check_executable (concat_name))
  1.4338 +	return concat_name;
  1.4339 +      XFREE (concat_name);
  1.4340 +    }
  1.4341 +  else
  1.4342 +    {
  1.4343 +#endif
  1.4344 +      if (IS_DIR_SEPARATOR (wrapper[0]))
  1.4345 +	{
  1.4346 +	  concat_name = xstrdup (wrapper);
  1.4347 +	  if (check_executable (concat_name))
  1.4348 +	    return concat_name;
  1.4349 +	  XFREE (concat_name);
  1.4350 +	}
  1.4351 +#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
  1.4352 +    }
  1.4353 +#endif
  1.4354 +
  1.4355 +  for (p = wrapper; *p; p++)
  1.4356 +    if (*p == '/')
  1.4357 +      {
  1.4358 +	has_slash = 1;
  1.4359 +	break;
  1.4360 +      }
  1.4361 +  if (!has_slash)
  1.4362 +    {
  1.4363 +      /* no slashes; search PATH */
  1.4364 +      const char *path = getenv ("PATH");
  1.4365 +      if (path != NULL)
  1.4366 +	{
  1.4367 +	  for (p = path; *p; p = p_next)
  1.4368 +	    {
  1.4369 +	      const char *q;
  1.4370 +	      size_t p_len;
  1.4371 +	      for (q = p; *q; q++)
  1.4372 +		if (IS_PATH_SEPARATOR (*q))
  1.4373 +		  break;
  1.4374 +	      p_len = q - p;
  1.4375 +	      p_next = (*q == '\0' ? q : q + 1);
  1.4376 +	      if (p_len == 0)
  1.4377 +		{
  1.4378 +		  /* empty path: current directory */
  1.4379 +		  if (getcwd (tmp, LT_PATHMAX) == NULL)
  1.4380 +		    lt_fatal ("getcwd failed");
  1.4381 +		  tmp_len = strlen (tmp);
  1.4382 +		  concat_name =
  1.4383 +		    XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  1.4384 +		  memcpy (concat_name, tmp, tmp_len);
  1.4385 +		  concat_name[tmp_len] = '/';
  1.4386 +		  strcpy (concat_name + tmp_len + 1, wrapper);
  1.4387 +		}
  1.4388 +	      else
  1.4389 +		{
  1.4390 +		  concat_name =
  1.4391 +		    XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
  1.4392 +		  memcpy (concat_name, p, p_len);
  1.4393 +		  concat_name[p_len] = '/';
  1.4394 +		  strcpy (concat_name + p_len + 1, wrapper);
  1.4395 +		}
  1.4396 +	      if (check_executable (concat_name))
  1.4397 +		return concat_name;
  1.4398 +	      XFREE (concat_name);
  1.4399 +	    }
  1.4400 +	}
  1.4401 +      /* not found in PATH; assume curdir */
  1.4402 +    }
  1.4403 +  /* Relative path | not found in path: prepend cwd */
  1.4404 +  if (getcwd (tmp, LT_PATHMAX) == NULL)
  1.4405 +    lt_fatal ("getcwd failed");
  1.4406 +  tmp_len = strlen (tmp);
  1.4407 +  concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
  1.4408 +  memcpy (concat_name, tmp, tmp_len);
  1.4409 +  concat_name[tmp_len] = '/';
  1.4410 +  strcpy (concat_name + tmp_len + 1, wrapper);
  1.4411 +
  1.4412 +  if (check_executable (concat_name))
  1.4413 +    return concat_name;
  1.4414 +  XFREE (concat_name);
  1.4415 +  return NULL;
  1.4416 +}
  1.4417 +
  1.4418 +char *
  1.4419 +chase_symlinks (const char *pathspec)
  1.4420 +{
  1.4421 +#ifndef S_ISLNK
  1.4422 +  return xstrdup (pathspec);
  1.4423 +#else
  1.4424 +  char buf[LT_PATHMAX];
  1.4425 +  struct stat s;
  1.4426 +  char *tmp_pathspec = xstrdup (pathspec);
  1.4427 +  char *p;
  1.4428 +  int has_symlinks = 0;
  1.4429 +  while (strlen (tmp_pathspec) && !has_symlinks)
  1.4430 +    {
  1.4431 +      LTWRAPPER_DEBUGPRINTF (("checking path component for symlinks: %s\n",
  1.4432 +			      tmp_pathspec));
  1.4433 +      if (lstat (tmp_pathspec, &s) == 0)
  1.4434 +	{
  1.4435 +	  if (S_ISLNK (s.st_mode) != 0)
  1.4436 +	    {
  1.4437 +	      has_symlinks = 1;
  1.4438 +	      break;
  1.4439 +	    }
  1.4440 +
  1.4441 +	  /* search backwards for last DIR_SEPARATOR */
  1.4442 +	  p = tmp_pathspec + strlen (tmp_pathspec) - 1;
  1.4443 +	  while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  1.4444 +	    p--;
  1.4445 +	  if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
  1.4446 +	    {
  1.4447 +	      /* no more DIR_SEPARATORS left */
  1.4448 +	      break;
  1.4449 +	    }
  1.4450 +	  *p = '\0';
  1.4451 +	}
  1.4452 +      else
  1.4453 +	{
  1.4454 +	  char *errstr = strerror (errno);
  1.4455 +	  lt_fatal ("Error accessing file %s (%s)", tmp_pathspec, errstr);
  1.4456 +	}
  1.4457 +    }
  1.4458 +  XFREE (tmp_pathspec);
  1.4459 +
  1.4460 +  if (!has_symlinks)
  1.4461 +    {
  1.4462 +      return xstrdup (pathspec);
  1.4463 +    }
  1.4464 +
  1.4465 +  tmp_pathspec = realpath (pathspec, buf);
  1.4466 +  if (tmp_pathspec == 0)
  1.4467 +    {
  1.4468 +      lt_fatal ("Could not follow symlinks for %s", pathspec);
  1.4469 +    }
  1.4470 +  return xstrdup (tmp_pathspec);
  1.4471 +#endif
  1.4472 +}
  1.4473 +
  1.4474 +char *
  1.4475 +strendzap (char *str, const char *pat)
  1.4476 +{
  1.4477 +  size_t len, patlen;
  1.4478 +
  1.4479 +  assert (str != NULL);
  1.4480 +  assert (pat != NULL);
  1.4481 +
  1.4482 +  len = strlen (str);
  1.4483 +  patlen = strlen (pat);
  1.4484 +
  1.4485 +  if (patlen <= len)
  1.4486 +    {
  1.4487 +      str += len - patlen;
  1.4488 +      if (strcmp (str, pat) == 0)
  1.4489 +	*str = '\0';
  1.4490 +    }
  1.4491 +  return str;
  1.4492 +}
  1.4493 +
  1.4494 +static void
  1.4495 +lt_error_core (int exit_status, const char *mode,
  1.4496 +	       const char *message, va_list ap)
  1.4497 +{
  1.4498 +  fprintf (stderr, "%s: %s: ", program_name, mode);
  1.4499 +  vfprintf (stderr, message, ap);
  1.4500 +  fprintf (stderr, ".\n");
  1.4501 +
  1.4502 +  if (exit_status >= 0)
  1.4503 +    exit (exit_status);
  1.4504 +}
  1.4505 +
  1.4506 +void
  1.4507 +lt_fatal (const char *message, ...)
  1.4508 +{
  1.4509 +  va_list ap;
  1.4510 +  va_start (ap, message);
  1.4511 +  lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
  1.4512 +  va_end (ap);
  1.4513 +}
  1.4514 +
  1.4515 +void
  1.4516 +lt_setenv (const char *name, const char *value)
  1.4517 +{
  1.4518 +  LTWRAPPER_DEBUGPRINTF (("(lt_setenv) setting '%s' to '%s'\n",
  1.4519 +                          (name ? name : "<NULL>"),
  1.4520 +                          (value ? value : "<NULL>")));
  1.4521 +  {
  1.4522 +#ifdef HAVE_SETENV
  1.4523 +    /* always make a copy, for consistency with !HAVE_SETENV */
  1.4524 +    char *str = xstrdup (value);
  1.4525 +    setenv (name, str, 1);
  1.4526 +#else
  1.4527 +    int len = strlen (name) + 1 + strlen (value) + 1;
  1.4528 +    char *str = XMALLOC (char, len);
  1.4529 +    sprintf (str, "%s=%s", name, value);
  1.4530 +    if (putenv (str) != EXIT_SUCCESS)
  1.4531 +      {
  1.4532 +        XFREE (str);
  1.4533 +      }
  1.4534 +#endif
  1.4535 +  }
  1.4536 +}
  1.4537 +
  1.4538 +char *
  1.4539 +lt_extend_str (const char *orig_value, const char *add, int to_end)
  1.4540 +{
  1.4541 +  char *new_value;
  1.4542 +  if (orig_value && *orig_value)
  1.4543 +    {
  1.4544 +      int orig_value_len = strlen (orig_value);
  1.4545 +      int add_len = strlen (add);
  1.4546 +      new_value = XMALLOC (char, add_len + orig_value_len + 1);
  1.4547 +      if (to_end)
  1.4548 +        {
  1.4549 +          strcpy (new_value, orig_value);
  1.4550 +          strcpy (new_value + orig_value_len, add);
  1.4551 +        }
  1.4552 +      else
  1.4553 +        {
  1.4554 +          strcpy (new_value, add);
  1.4555 +          strcpy (new_value + add_len, orig_value);
  1.4556 +        }
  1.4557 +    }
  1.4558 +  else
  1.4559 +    {
  1.4560 +      new_value = xstrdup (add);
  1.4561 +    }
  1.4562 +  return new_value;
  1.4563 +}
  1.4564 +
  1.4565 +int
  1.4566 +lt_split_name_value (const char *arg, char** name, char** value)
  1.4567 +{
  1.4568 +  const char *p;
  1.4569 +  int len;
  1.4570 +  if (!arg || !*arg)
  1.4571 +    return 1;
  1.4572 +
  1.4573 +  p = strchr (arg, (int)'=');
  1.4574 +
  1.4575 +  if (!p)
  1.4576 +    return 1;
  1.4577 +
  1.4578 +  *value = xstrdup (++p);
  1.4579 +
  1.4580 +  len = strlen (arg) - strlen (*value);
  1.4581 +  *name = XMALLOC (char, len);
  1.4582 +  strncpy (*name, arg, len-1);
  1.4583 +  (*name)[len - 1] = '\0';
  1.4584 +
  1.4585 +  return 0;
  1.4586 +}
  1.4587 +
  1.4588 +void
  1.4589 +lt_opt_process_env_set (const char *arg)
  1.4590 +{
  1.4591 +  char *name = NULL;
  1.4592 +  char *value = NULL;
  1.4593 +
  1.4594 +  if (lt_split_name_value (arg, &name, &value) != 0)
  1.4595 +    {
  1.4596 +      XFREE (name);
  1.4597 +      XFREE (value);
  1.4598 +      lt_fatal ("bad argument for %s: '%s'", env_set_opt, arg);
  1.4599 +    }
  1.4600 +
  1.4601 +  lt_setenv (name, value);
  1.4602 +  XFREE (name);
  1.4603 +  XFREE (value);
  1.4604 +}
  1.4605 +
  1.4606 +void
  1.4607 +lt_opt_process_env_prepend (const char *arg)
  1.4608 +{
  1.4609 +  char *name = NULL;
  1.4610 +  char *value = NULL;
  1.4611 +  char *new_value = NULL;
  1.4612 +
  1.4613 +  if (lt_split_name_value (arg, &name, &value) != 0)
  1.4614 +    {
  1.4615 +      XFREE (name);
  1.4616 +      XFREE (value);
  1.4617 +      lt_fatal ("bad argument for %s: '%s'", env_prepend_opt, arg);
  1.4618 +    }
  1.4619 +
  1.4620 +  new_value = lt_extend_str (getenv (name), value, 0);
  1.4621 +  lt_setenv (name, new_value);
  1.4622 +  XFREE (new_value);
  1.4623 +  XFREE (name);
  1.4624 +  XFREE (value);
  1.4625 +}
  1.4626 +
  1.4627 +void
  1.4628 +lt_opt_process_env_append (const char *arg)
  1.4629 +{
  1.4630 +  char *name = NULL;
  1.4631 +  char *value = NULL;
  1.4632 +  char *new_value = NULL;
  1.4633 +
  1.4634 +  if (lt_split_name_value (arg, &name, &value) != 0)
  1.4635 +    {
  1.4636 +      XFREE (name);
  1.4637 +      XFREE (value);
  1.4638 +      lt_fatal ("bad argument for %s: '%s'", env_append_opt, arg);
  1.4639 +    }
  1.4640 +
  1.4641 +  new_value = lt_extend_str (getenv (name), value, 1);
  1.4642 +  lt_setenv (name, new_value);
  1.4643 +  XFREE (new_value);
  1.4644 +  XFREE (name);
  1.4645 +  XFREE (value);
  1.4646 +}
  1.4647 +
  1.4648 +void
  1.4649 +lt_update_exe_path (const char *name, const char *value)
  1.4650 +{
  1.4651 +  LTWRAPPER_DEBUGPRINTF (("(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
  1.4652 +                          (name ? name : "<NULL>"),
  1.4653 +                          (value ? value : "<NULL>")));
  1.4654 +
  1.4655 +  if (name && *name && value && *value)
  1.4656 +    {
  1.4657 +      char *new_value = lt_extend_str (getenv (name), value, 0);
  1.4658 +      /* some systems can't cope with a ':'-terminated path #' */
  1.4659 +      int len = strlen (new_value);
  1.4660 +      while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
  1.4661 +        {
  1.4662 +          new_value[len-1] = '\0';
  1.4663 +        }
  1.4664 +      lt_setenv (name, new_value);
  1.4665 +      XFREE (new_value);
  1.4666 +    }
  1.4667 +}
  1.4668 +
  1.4669 +void
  1.4670 +lt_update_lib_path (const char *name, const char *value)
  1.4671 +{
  1.4672 +  LTWRAPPER_DEBUGPRINTF (("(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
  1.4673 +                          (name ? name : "<NULL>"),
  1.4674 +                          (value ? value : "<NULL>")));
  1.4675 +
  1.4676 +  if (name && *name && value && *value)
  1.4677 +    {
  1.4678 +      char *new_value = lt_extend_str (getenv (name), value, 0);
  1.4679 +      lt_setenv (name, new_value);
  1.4680 +      XFREE (new_value);
  1.4681 +    }
  1.4682 +}
  1.4683 +
  1.4684  
  1.4685  EOF
  1.4686 -    fi
  1.4687 -
  1.4688 -    $run $mv "${libobj}T" "${libobj}"
  1.4689 -
  1.4690 -    # Unlock the critical section if it was locked
  1.4691 -    if test "$need_locks" != no; then
  1.4692 -      $run $rm "$lockfile"
  1.4693 -    fi
  1.4694 -
  1.4695 -    exit $EXIT_SUCCESS
  1.4696 -    ;;
  1.4697 -
  1.4698 -  # libtool link mode
  1.4699 -  link | relink)
  1.4700 -    modename="$modename: link"
  1.4701 +}
  1.4702 +# end: func_emit_cwrapperexe_src
  1.4703 +
  1.4704 +# func_mode_link arg...
  1.4705 +func_mode_link ()
  1.4706 +{
  1.4707 +    $opt_debug
  1.4708      case $host in
  1.4709 -    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1.4710 +    *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  1.4711        # It is impossible to link a dll without this setting, and
  1.4712        # we shouldn't force the makefile maintainer to figure out
  1.4713        # which system we are compiling for in order to pass an extra
  1.4714 @@ -1085,10 +4052,10 @@
  1.4715        allow_undefined=yes
  1.4716        ;;
  1.4717      esac
  1.4718 -    libtool_args="$nonopt"
  1.4719 +    libtool_args=$nonopt
  1.4720      base_compile="$nonopt $@"
  1.4721 -    compile_command="$nonopt"
  1.4722 -    finalize_command="$nonopt"
  1.4723 +    compile_command=$nonopt
  1.4724 +    finalize_command=$nonopt
  1.4725  
  1.4726      compile_rpath=
  1.4727      finalize_rpath=
  1.4728 @@ -1103,6 +4070,7 @@
  1.4729      dllsearchpath=
  1.4730      lib_search_path=`pwd`
  1.4731      inst_prefix_dir=
  1.4732 +    new_inherited_linker_flags=
  1.4733  
  1.4734      avoid_version=no
  1.4735      dlfiles=
  1.4736 @@ -1118,7 +4086,6 @@
  1.4737      no_install=no
  1.4738      objs=
  1.4739      non_pic_objects=
  1.4740 -    notinst_path= # paths that contain not-installed libtool libraries
  1.4741      precious_files_regex=
  1.4742      prefer_static_libs=no
  1.4743      preload=no
  1.4744 @@ -1132,28 +4099,44 @@
  1.4745      thread_safe=no
  1.4746      vinfo=
  1.4747      vinfo_number=no
  1.4748 -
  1.4749 +    weak_libs=
  1.4750 +    single_module="${wl}-single_module"
  1.4751      func_infer_tag $base_compile
  1.4752  
  1.4753      # We need to know -static, to get the right output filenames.
  1.4754      for arg
  1.4755      do
  1.4756        case $arg in
  1.4757 -      -all-static | -static)
  1.4758 -	if test "X$arg" = "X-all-static"; then
  1.4759 +      -shared)
  1.4760 +	test "$build_libtool_libs" != yes && \
  1.4761 +	  func_fatal_configuration "can not build a shared library"
  1.4762 +	build_old_libs=no
  1.4763 +	break
  1.4764 +	;;
  1.4765 +      -all-static | -static | -static-libtool-libs)
  1.4766 +	case $arg in
  1.4767 +	-all-static)
  1.4768  	  if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
  1.4769 -	    $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
  1.4770 +	    func_warning "complete static linking is impossible in this configuration"
  1.4771  	  fi
  1.4772  	  if test -n "$link_static_flag"; then
  1.4773  	    dlopen_self=$dlopen_self_static
  1.4774  	  fi
  1.4775  	  prefer_static_libs=yes
  1.4776 -	else
  1.4777 +	  ;;
  1.4778 +	-static)
  1.4779  	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
  1.4780  	    dlopen_self=$dlopen_self_static
  1.4781  	  fi
  1.4782  	  prefer_static_libs=built
  1.4783 -	fi
  1.4784 +	  ;;
  1.4785 +	-static-libtool-libs)
  1.4786 +	  if test -z "$pic_flag" && test -n "$link_static_flag"; then
  1.4787 +	    dlopen_self=$dlopen_self_static
  1.4788 +	  fi
  1.4789 +	  prefer_static_libs=yes
  1.4790 +	  ;;
  1.4791 +	esac
  1.4792  	build_libtool_libs=no
  1.4793  	build_old_libs=yes
  1.4794  	break
  1.4795 @@ -1168,20 +4151,16 @@
  1.4796      while test "$#" -gt 0; do
  1.4797        arg="$1"
  1.4798        shift
  1.4799 -      case $arg in
  1.4800 -      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.4801 -	qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
  1.4802 -	;;
  1.4803 -      *) qarg=$arg ;;
  1.4804 -      esac
  1.4805 -      libtool_args="$libtool_args $qarg"
  1.4806 +      func_quote_for_eval "$arg"
  1.4807 +      qarg=$func_quote_for_eval_unquoted_result
  1.4808 +      func_append libtool_args " $func_quote_for_eval_result"
  1.4809  
  1.4810        # If the previous option needs an argument, assign it.
  1.4811        if test -n "$prev"; then
  1.4812  	case $prev in
  1.4813  	output)
  1.4814 -	  compile_command="$compile_command @OUTPUT@"
  1.4815 -	  finalize_command="$finalize_command @OUTPUT@"
  1.4816 +	  func_append compile_command " @OUTPUT@"
  1.4817 +	  func_append finalize_command " @OUTPUT@"
  1.4818  	  ;;
  1.4819  	esac
  1.4820  
  1.4821 @@ -1189,8 +4168,8 @@
  1.4822  	dlfiles|dlprefiles)
  1.4823  	  if test "$preload" = no; then
  1.4824  	    # Add the symbol object into the linking commands.
  1.4825 -	    compile_command="$compile_command @SYMFILE@"
  1.4826 -	    finalize_command="$finalize_command @SYMFILE@"
  1.4827 +	    func_append compile_command " @SYMFILE@"
  1.4828 +	    func_append finalize_command " @SYMFILE@"
  1.4829  	    preload=yes
  1.4830  	  fi
  1.4831  	  case $arg in
  1.4832 @@ -1228,10 +4207,8 @@
  1.4833  	  ;;
  1.4834  	expsyms)
  1.4835  	  export_symbols="$arg"
  1.4836 -	  if test ! -f "$arg"; then
  1.4837 -	    $echo "$modename: symbol file \`$arg' does not exist"
  1.4838 -	    exit $EXIT_FAILURE
  1.4839 -	  fi
  1.4840 +	  test -f "$arg" \
  1.4841 +	    || func_fatal_error "symbol file \`$arg' does not exist"
  1.4842  	  prev=
  1.4843  	  continue
  1.4844  	  ;;
  1.4845 @@ -1240,58 +4217,52 @@
  1.4846  	  prev=
  1.4847  	  continue
  1.4848  	  ;;
  1.4849 +	framework)
  1.4850 +	  case $host in
  1.4851 +	    *-*-darwin*)
  1.4852 +	      case "$deplibs " in
  1.4853 +		*" $qarg.ltframework "*) ;;
  1.4854 +		*) deplibs="$deplibs $qarg.ltframework" # this is fixed later
  1.4855 +		   ;;
  1.4856 +	      esac
  1.4857 +	      ;;
  1.4858 +	  esac
  1.4859 +	  prev=
  1.4860 +	  continue
  1.4861 +	  ;;
  1.4862  	inst_prefix)
  1.4863  	  inst_prefix_dir="$arg"
  1.4864  	  prev=
  1.4865  	  continue
  1.4866  	  ;;
  1.4867 -	precious_regex)
  1.4868 -	  precious_files_regex="$arg"
  1.4869 -	  prev=
  1.4870 -	  continue
  1.4871 -	  ;;
  1.4872 -	release)
  1.4873 -	  release="-$arg"
  1.4874 -	  prev=
  1.4875 -	  continue
  1.4876 -	  ;;
  1.4877  	objectlist)
  1.4878  	  if test -f "$arg"; then
  1.4879  	    save_arg=$arg
  1.4880  	    moreargs=
  1.4881 -	    for fil in `cat $save_arg`
  1.4882 +	    for fil in `cat "$save_arg"`
  1.4883  	    do
  1.4884  #	      moreargs="$moreargs $fil"
  1.4885  	      arg=$fil
  1.4886  	      # A libtool-controlled object.
  1.4887  
  1.4888  	      # Check to see that this really is a libtool object.
  1.4889 -	      if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.4890 +	      if func_lalib_unsafe_p "$arg"; then
  1.4891  		pic_object=
  1.4892  		non_pic_object=
  1.4893  
  1.4894  		# Read the .lo file
  1.4895 -		# If there is no directory component, then add one.
  1.4896 -		case $arg in
  1.4897 -		*/* | *\\*) . $arg ;;
  1.4898 -		*) . ./$arg ;;
  1.4899 -		esac
  1.4900 -
  1.4901 -		if test -z "$pic_object" || \
  1.4902 +		func_source "$arg"
  1.4903 +
  1.4904 +		if test -z "$pic_object" ||
  1.4905  		   test -z "$non_pic_object" ||
  1.4906 -		   test "$pic_object" = none && \
  1.4907 +		   test "$pic_object" = none &&
  1.4908  		   test "$non_pic_object" = none; then
  1.4909 -		  $echo "$modename: cannot find name of object for \`$arg'" 1>&2
  1.4910 -		  exit $EXIT_FAILURE
  1.4911 +		  func_fatal_error "cannot find name of object for \`$arg'"
  1.4912  		fi
  1.4913  
  1.4914  		# Extract subdirectory from the argument.
  1.4915 -		xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1.4916 -		if test "X$xdir" = "X$arg"; then
  1.4917 -		  xdir=
  1.4918 -		else
  1.4919 -		  xdir="$xdir/"
  1.4920 -		fi
  1.4921 +		func_dirname "$arg" "/" ""
  1.4922 +		xdir="$func_dirname_result"
  1.4923  
  1.4924  		if test "$pic_object" != none; then
  1.4925  		  # Prepend the subdirectory the object is found in.
  1.4926 @@ -1316,7 +4287,7 @@
  1.4927  		  fi
  1.4928  
  1.4929  		  # A PIC object.
  1.4930 -		  libobjs="$libobjs $pic_object"
  1.4931 +		  func_append libobjs " $pic_object"
  1.4932  		  arg="$pic_object"
  1.4933  		fi
  1.4934  
  1.4935 @@ -1326,7 +4297,7 @@
  1.4936  		  non_pic_object="$xdir$non_pic_object"
  1.4937  
  1.4938  		  # A standard non-PIC object
  1.4939 -		  non_pic_objects="$non_pic_objects $non_pic_object"
  1.4940 +		  func_append non_pic_objects " $non_pic_object"
  1.4941  		  if test -z "$pic_object" || test "$pic_object" = none ; then
  1.4942  		    arg="$non_pic_object"
  1.4943  		  fi
  1.4944 @@ -1334,46 +4305,48 @@
  1.4945  		  # If the PIC object exists, use it instead.
  1.4946  		  # $xdir was prepended to $pic_object above.
  1.4947  		  non_pic_object="$pic_object"
  1.4948 -		  non_pic_objects="$non_pic_objects $non_pic_object"
  1.4949 +		  func_append non_pic_objects " $non_pic_object"
  1.4950  		fi
  1.4951  	      else
  1.4952  		# Only an error if not doing a dry-run.
  1.4953 -		if test -z "$run"; then
  1.4954 -		  $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
  1.4955 -		  exit $EXIT_FAILURE
  1.4956 -		else
  1.4957 -		  # Dry-run case.
  1.4958 -
  1.4959 +		if $opt_dry_run; then
  1.4960  		  # Extract subdirectory from the argument.
  1.4961 -		  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1.4962 -		  if test "X$xdir" = "X$arg"; then
  1.4963 -		    xdir=
  1.4964 -		  else
  1.4965 -		    xdir="$xdir/"
  1.4966 -		  fi
  1.4967 -
  1.4968 -		  pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1.4969 -		  non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1.4970 -		  libobjs="$libobjs $pic_object"
  1.4971 -		  non_pic_objects="$non_pic_objects $non_pic_object"
  1.4972 +		  func_dirname "$arg" "/" ""
  1.4973 +		  xdir="$func_dirname_result"
  1.4974 +
  1.4975 +		  func_lo2o "$arg"
  1.4976 +		  pic_object=$xdir$objdir/$func_lo2o_result
  1.4977 +		  non_pic_object=$xdir$func_lo2o_result
  1.4978 +		  func_append libobjs " $pic_object"
  1.4979 +		  func_append non_pic_objects " $non_pic_object"
  1.4980 +	        else
  1.4981 +		  func_fatal_error "\`$arg' is not a valid libtool object"
  1.4982  		fi
  1.4983  	      fi
  1.4984  	    done
  1.4985  	  else
  1.4986 -	    $echo "$modename: link input file \`$save_arg' does not exist"
  1.4987 -	    exit $EXIT_FAILURE
  1.4988 +	    func_fatal_error "link input file \`$arg' does not exist"
  1.4989  	  fi
  1.4990  	  arg=$save_arg
  1.4991  	  prev=
  1.4992  	  continue
  1.4993  	  ;;
  1.4994 +	precious_regex)
  1.4995 +	  precious_files_regex="$arg"
  1.4996 +	  prev=
  1.4997 +	  continue
  1.4998 +	  ;;
  1.4999 +	release)
  1.5000 +	  release="-$arg"
  1.5001 +	  prev=
  1.5002 +	  continue
  1.5003 +	  ;;
  1.5004  	rpath | xrpath)
  1.5005  	  # We need an absolute path.
  1.5006  	  case $arg in
  1.5007  	  [\\/]* | [A-Za-z]:[\\/]*) ;;
  1.5008  	  *)
  1.5009 -	    $echo "$modename: only absolute run-paths are allowed" 1>&2
  1.5010 -	    exit $EXIT_FAILURE
  1.5011 +	    func_fatal_error "only absolute run-paths are allowed"
  1.5012  	    ;;
  1.5013  	  esac
  1.5014  	  if test "$prev" = rpath; then
  1.5015 @@ -1390,39 +4363,37 @@
  1.5016  	  prev=
  1.5017  	  continue
  1.5018  	  ;;
  1.5019 +	shrext)
  1.5020 +	  shrext_cmds="$arg"
  1.5021 +	  prev=
  1.5022 +	  continue
  1.5023 +	  ;;
  1.5024 +	weak)
  1.5025 +	  weak_libs="$weak_libs $arg"
  1.5026 +	  prev=
  1.5027 +	  continue
  1.5028 +	  ;;
  1.5029 +	xcclinker)
  1.5030 +	  linker_flags="$linker_flags $qarg"
  1.5031 +	  compiler_flags="$compiler_flags $qarg"
  1.5032 +	  prev=
  1.5033 +	  func_append compile_command " $qarg"
  1.5034 +	  func_append finalize_command " $qarg"
  1.5035 +	  continue
  1.5036 +	  ;;
  1.5037  	xcompiler)
  1.5038  	  compiler_flags="$compiler_flags $qarg"
  1.5039  	  prev=
  1.5040 -	  compile_command="$compile_command $qarg"
  1.5041 -	  finalize_command="$finalize_command $qarg"
  1.5042 +	  func_append compile_command " $qarg"
  1.5043 +	  func_append finalize_command " $qarg"
  1.5044  	  continue
  1.5045  	  ;;
  1.5046  	xlinker)
  1.5047  	  linker_flags="$linker_flags $qarg"
  1.5048  	  compiler_flags="$compiler_flags $wl$qarg"
  1.5049  	  prev=
  1.5050 -	  compile_command="$compile_command $wl$qarg"
  1.5051 -	  finalize_command="$finalize_command $wl$qarg"
  1.5052 -	  continue
  1.5053 -	  ;;
  1.5054 -	xcclinker)
  1.5055 -	  linker_flags="$linker_flags $qarg"
  1.5056 -	  compiler_flags="$compiler_flags $qarg"
  1.5057 -	  prev=
  1.5058 -	  compile_command="$compile_command $qarg"
  1.5059 -	  finalize_command="$finalize_command $qarg"
  1.5060 -	  continue
  1.5061 -	  ;;
  1.5062 -	shrext)
  1.5063 -  	  shrext_cmds="$arg"
  1.5064 -	  prev=
  1.5065 -	  continue
  1.5066 -	  ;;
  1.5067 -	darwin_framework|darwin_framework_skip)
  1.5068 -	  test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
  1.5069 -	  compile_command="$compile_command $arg"
  1.5070 -	  finalize_command="$finalize_command $arg"
  1.5071 -	  prev=
  1.5072 +	  func_append compile_command " $wl$qarg"
  1.5073 +	  func_append finalize_command " $wl$qarg"
  1.5074  	  continue
  1.5075  	  ;;
  1.5076  	*)
  1.5077 @@ -1438,16 +4409,16 @@
  1.5078        case $arg in
  1.5079        -all-static)
  1.5080  	if test -n "$link_static_flag"; then
  1.5081 -	  compile_command="$compile_command $link_static_flag"
  1.5082 -	  finalize_command="$finalize_command $link_static_flag"
  1.5083 +	  # See comment for -static flag below, for more details.
  1.5084 +	  func_append compile_command " $link_static_flag"
  1.5085 +	  func_append finalize_command " $link_static_flag"
  1.5086  	fi
  1.5087  	continue
  1.5088  	;;
  1.5089  
  1.5090        -allow-undefined)
  1.5091  	# FIXME: remove this flag sometime in the future.
  1.5092 -	$echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
  1.5093 -	continue
  1.5094 +	func_fatal_error "\`-allow-undefined' must not be used because it is the default"
  1.5095  	;;
  1.5096  
  1.5097        -avoid-version)
  1.5098 @@ -1472,8 +4443,7 @@
  1.5099  
  1.5100        -export-symbols | -export-symbols-regex)
  1.5101  	if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1.5102 -	  $echo "$modename: more than one -exported-symbols argument is not allowed"
  1.5103 -	  exit $EXIT_FAILURE
  1.5104 +	  func_fatal_error "more than one -exported-symbols argument is not allowed"
  1.5105  	fi
  1.5106  	if test "X$arg" = "X-export-symbols"; then
  1.5107  	  prev=expsyms
  1.5108 @@ -1483,15 +4453,8 @@
  1.5109  	continue
  1.5110  	;;
  1.5111  
  1.5112 -      -framework|-arch|-isysroot)
  1.5113 -	case " $CC " in
  1.5114 -	  *" ${arg} ${1} "* | *" ${arg}	${1} "*) 
  1.5115 -		prev=darwin_framework_skip ;;
  1.5116 -	  *) compiler_flags="$compiler_flags $arg"
  1.5117 -	     prev=darwin_framework ;;
  1.5118 -	esac
  1.5119 -	compile_command="$compile_command $arg"
  1.5120 -	finalize_command="$finalize_command $arg"
  1.5121 +      -framework)
  1.5122 +	prev=framework
  1.5123  	continue
  1.5124  	;;
  1.5125  
  1.5126 @@ -1505,25 +4468,30 @@
  1.5127        -L[A-Z][A-Z]*:*)
  1.5128  	case $with_gcc/$host in
  1.5129  	no/*-*-irix* | /*-*-irix*)
  1.5130 -	  compile_command="$compile_command $arg"
  1.5131 -	  finalize_command="$finalize_command $arg"
  1.5132 +	  func_append compile_command " $arg"
  1.5133 +	  func_append finalize_command " $arg"
  1.5134  	  ;;
  1.5135  	esac
  1.5136  	continue
  1.5137  	;;
  1.5138  
  1.5139        -L*)
  1.5140 -	dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
  1.5141 +	func_stripname '-L' '' "$arg"
  1.5142 +	dir=$func_stripname_result
  1.5143 +	if test -z "$dir"; then
  1.5144 +	  if test "$#" -gt 0; then
  1.5145 +	    func_fatal_error "require no space between \`-L' and \`$1'"
  1.5146 +	  else
  1.5147 +	    func_fatal_error "need path for \`-L' option"
  1.5148 +	  fi
  1.5149 +	fi
  1.5150  	# We need an absolute path.
  1.5151  	case $dir in
  1.5152  	[\\/]* | [A-Za-z]:[\\/]*) ;;
  1.5153  	*)
  1.5154  	  absdir=`cd "$dir" && pwd`
  1.5155 -	  if test -z "$absdir"; then
  1.5156 -	    $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
  1.5157 -	    absdir="$dir"
  1.5158 -	    notinst_path="$notinst_path $dir"
  1.5159 -	  fi
  1.5160 +	  test -z "$absdir" && \
  1.5161 +	    func_fatal_error "cannot determine absolute directory name of \`$dir'"
  1.5162  	  dir="$absdir"
  1.5163  	  ;;
  1.5164  	esac
  1.5165 @@ -1535,14 +4503,16 @@
  1.5166  	  ;;
  1.5167  	esac
  1.5168  	case $host in
  1.5169 -	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1.5170 -	  testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
  1.5171 +	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  1.5172 +	  testbindir=`$ECHO "X$dir" | $Xsed -e 's*/lib$*/bin*'`
  1.5173  	  case :$dllsearchpath: in
  1.5174  	  *":$dir:"*) ;;
  1.5175 +	  ::) dllsearchpath=$dir;;
  1.5176  	  *) dllsearchpath="$dllsearchpath:$dir";;
  1.5177  	  esac
  1.5178  	  case :$dllsearchpath: in
  1.5179  	  *":$testbindir:"*) ;;
  1.5180 +	  ::) dllsearchpath=$testbindir;;
  1.5181  	  *) dllsearchpath="$dllsearchpath:$testbindir";;
  1.5182  	  esac
  1.5183  	  ;;
  1.5184 @@ -1553,7 +4523,7 @@
  1.5185        -l*)
  1.5186  	if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
  1.5187  	  case $host in
  1.5188 -	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
  1.5189 +	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc*)
  1.5190  	    # These systems don't actually have a C or math library (as such)
  1.5191  	    continue
  1.5192  	    ;;
  1.5193 @@ -1567,7 +4537,7 @@
  1.5194  	    ;;
  1.5195  	  *-*-rhapsody* | *-*-darwin1.[012])
  1.5196  	    # Rhapsody C and math libraries are in the System framework
  1.5197 -	    deplibs="$deplibs -framework System"
  1.5198 +	    deplibs="$deplibs System.ltframework"
  1.5199  	    continue
  1.5200  	    ;;
  1.5201  	  *-*-sco3.2v5* | *-*-sco5v6*)
  1.5202 @@ -1591,57 +4561,35 @@
  1.5203  	continue
  1.5204  	;;
  1.5205  
  1.5206 -      # Tru64 UNIX uses -model [arg] to determine the layout of C++
  1.5207 -      # classes, name mangling, and exception handling.
  1.5208 -      -model)
  1.5209 -	compile_command="$compile_command $arg"
  1.5210 -	compiler_flags="$compiler_flags $arg"
  1.5211 -	finalize_command="$finalize_command $arg"
  1.5212 -	prev=xcompiler
  1.5213 -	continue
  1.5214 -	;;
  1.5215 -
  1.5216 -     -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
  1.5217 -	compiler_flags="$compiler_flags $arg"
  1.5218 -	compile_command="$compile_command $arg"
  1.5219 -	finalize_command="$finalize_command $arg"
  1.5220 -	continue
  1.5221 -	;;
  1.5222 -
  1.5223        -module)
  1.5224  	module=yes
  1.5225  	continue
  1.5226  	;;
  1.5227  
  1.5228 -      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
  1.5229 -      # -r[0-9][0-9]* specifies the processor on the SGI compiler
  1.5230 -      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
  1.5231 -      # +DA*, +DD* enable 64-bit mode on the HP compiler
  1.5232 -      # -q* pass through compiler args for the IBM compiler
  1.5233 -      # -m* pass through architecture-specific compiler args for GCC
  1.5234 -      # -m*, -t[45]*, -txscale* pass through architecture-specific
  1.5235 -      # compiler args for GCC
  1.5236 -      # -pg pass through profiling flag for GCC
  1.5237 -      # @file GCC response files
  1.5238 -      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*|-pg| \
  1.5239 -      -t[45]*|-txscale*|@*)
  1.5240 -
  1.5241 -	# Unknown arguments in both finalize_command and compile_command need
  1.5242 -	# to be aesthetically quoted because they are evaled later.
  1.5243 -	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1.5244 -	case $arg in
  1.5245 -	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.5246 -	  arg="\"$arg\""
  1.5247 -	  ;;
  1.5248 +      # Tru64 UNIX uses -model [arg] to determine the layout of C++
  1.5249 +      # classes, name mangling, and exception handling.
  1.5250 +      # Darwin uses the -arch flag to determine output architecture.
  1.5251 +      -model|-arch|-isysroot)
  1.5252 +	compiler_flags="$compiler_flags $arg"
  1.5253 +	func_append compile_command " $arg"
  1.5254 +	func_append finalize_command " $arg"
  1.5255 +	prev=xcompiler
  1.5256 +	continue
  1.5257 +	;;
  1.5258 +
  1.5259 +      -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
  1.5260 +	compiler_flags="$compiler_flags $arg"
  1.5261 +	func_append compile_command " $arg"
  1.5262 +	func_append finalize_command " $arg"
  1.5263 +	case "$new_inherited_linker_flags " in
  1.5264 +	    *" $arg "*) ;;
  1.5265 +	    * ) new_inherited_linker_flags="$new_inherited_linker_flags $arg" ;;
  1.5266  	esac
  1.5267 -        compile_command="$compile_command $arg"
  1.5268 -        finalize_command="$finalize_command $arg"
  1.5269 -        compiler_flags="$compiler_flags $arg"
  1.5270 -        continue
  1.5271 -        ;;
  1.5272 -
  1.5273 -      -shrext)
  1.5274 -	prev=shrext
  1.5275 +	continue
  1.5276 +	;;
  1.5277 +
  1.5278 +      -multi_module)
  1.5279 +	single_module="${wl}-multi_module"
  1.5280  	continue
  1.5281  	;;
  1.5282  
  1.5283 @@ -1652,11 +4600,11 @@
  1.5284  
  1.5285        -no-install)
  1.5286  	case $host in
  1.5287 -	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1.5288 +	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
  1.5289  	  # The PATH hackery in wrapper scripts is required on Windows
  1.5290 -	  # in order for the loader to find any dlls it needs.
  1.5291 -	  $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
  1.5292 -	  $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
  1.5293 +	  # and Darwin in order for the loader to find any dlls it needs.
  1.5294 +	  func_warning "\`-no-install' is ignored for $host"
  1.5295 +	  func_warning "assuming \`-no-fast-install' instead"
  1.5296  	  fast_install=no
  1.5297  	  ;;
  1.5298  	*) no_install=yes ;;
  1.5299 @@ -1697,13 +4645,13 @@
  1.5300  	;;
  1.5301  
  1.5302        -R*)
  1.5303 -	dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
  1.5304 +	func_stripname '-R' '' "$arg"
  1.5305 +	dir=$func_stripname_result
  1.5306  	# We need an absolute path.
  1.5307  	case $dir in
  1.5308  	[\\/]* | [A-Za-z]:[\\/]*) ;;
  1.5309  	*)
  1.5310 -	  $echo "$modename: only absolute run-paths are allowed" 1>&2
  1.5311 -	  exit $EXIT_FAILURE
  1.5312 +	  func_fatal_error "only absolute run-paths are allowed"
  1.5313  	  ;;
  1.5314  	esac
  1.5315  	case "$xrpath " in
  1.5316 @@ -1713,7 +4661,17 @@
  1.5317  	continue
  1.5318  	;;
  1.5319  
  1.5320 -      -static)
  1.5321 +      -shared)
  1.5322 +	# The effects of -shared are defined in a previous loop.
  1.5323 +	continue
  1.5324 +	;;
  1.5325 +
  1.5326 +      -shrext)
  1.5327 +	prev=shrext
  1.5328 +	continue
  1.5329 +	;;
  1.5330 +
  1.5331 +      -static | -static-libtool-libs)
  1.5332  	# The effects of -static are defined in a previous loop.
  1.5333  	# We used to do the same as -all-static on platforms that
  1.5334  	# didn't have a PIC flag, but the assumption that the effects
  1.5335 @@ -1731,47 +4689,49 @@
  1.5336  	prev=vinfo
  1.5337  	continue
  1.5338  	;;
  1.5339 +
  1.5340        -version-number)
  1.5341  	prev=vinfo
  1.5342  	vinfo_number=yes
  1.5343  	continue
  1.5344  	;;
  1.5345  
  1.5346 +      -weak)
  1.5347 +        prev=weak
  1.5348 +	continue
  1.5349 +	;;
  1.5350 +
  1.5351        -Wc,*)
  1.5352 -	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
  1.5353 +	func_stripname '-Wc,' '' "$arg"
  1.5354 +	args=$func_stripname_result
  1.5355  	arg=
  1.5356  	save_ifs="$IFS"; IFS=','
  1.5357  	for flag in $args; do
  1.5358  	  IFS="$save_ifs"
  1.5359 -	  case $flag in
  1.5360 -	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.5361 -	    flag="\"$flag\""
  1.5362 -	    ;;
  1.5363 -	  esac
  1.5364 -	  arg="$arg $wl$flag"
  1.5365 -	  compiler_flags="$compiler_flags $flag"
  1.5366 +          func_quote_for_eval "$flag"
  1.5367 +	  arg="$arg $wl$func_quote_for_eval_result"
  1.5368 +	  compiler_flags="$compiler_flags $func_quote_for_eval_result"
  1.5369  	done
  1.5370  	IFS="$save_ifs"
  1.5371 -	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1.5372 +	func_stripname ' ' '' "$arg"
  1.5373 +	arg=$func_stripname_result
  1.5374  	;;
  1.5375  
  1.5376        -Wl,*)
  1.5377 -	args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
  1.5378 +	func_stripname '-Wl,' '' "$arg"
  1.5379 +	args=$func_stripname_result
  1.5380  	arg=
  1.5381  	save_ifs="$IFS"; IFS=','
  1.5382  	for flag in $args; do
  1.5383  	  IFS="$save_ifs"
  1.5384 -	  case $flag in
  1.5385 -	    *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.5386 -	    flag="\"$flag\""
  1.5387 -	    ;;
  1.5388 -	  esac
  1.5389 -	  arg="$arg $wl$flag"
  1.5390 -	  compiler_flags="$compiler_flags $wl$flag"
  1.5391 -	  linker_flags="$linker_flags $flag"
  1.5392 +          func_quote_for_eval "$flag"
  1.5393 +	  arg="$arg $wl$func_quote_for_eval_result"
  1.5394 +	  compiler_flags="$compiler_flags $wl$func_quote_for_eval_result"
  1.5395 +	  linker_flags="$linker_flags $func_quote_for_eval_result"
  1.5396  	done
  1.5397  	IFS="$save_ifs"
  1.5398 -	arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
  1.5399 +	func_stripname ' ' '' "$arg"
  1.5400 +	arg=$func_stripname_result
  1.5401  	;;
  1.5402  
  1.5403        -Xcompiler)
  1.5404 @@ -1789,16 +4749,36 @@
  1.5405  	continue
  1.5406  	;;
  1.5407  
  1.5408 +      # -msg_* for osf cc
  1.5409 +      -msg_*)
  1.5410 +	func_quote_for_eval "$arg"
  1.5411 +	arg="$func_quote_for_eval_result"
  1.5412 +	;;
  1.5413 +
  1.5414 +      # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
  1.5415 +      # -r[0-9][0-9]* specifies the processor on the SGI compiler
  1.5416 +      # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
  1.5417 +      # +DA*, +DD* enable 64-bit mode on the HP compiler
  1.5418 +      # -q* pass through compiler args for the IBM compiler
  1.5419 +      # -m*, -t[45]*, -txscale* pass through architecture-specific
  1.5420 +      # compiler args for GCC
  1.5421 +      # -F/path gives path to uninstalled frameworks, gcc on darwin
  1.5422 +      # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
  1.5423 +      # @file GCC response files
  1.5424 +      -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
  1.5425 +      -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
  1.5426 +        func_quote_for_eval "$arg"
  1.5427 +	arg="$func_quote_for_eval_result"
  1.5428 +        func_append compile_command " $arg"
  1.5429 +        func_append finalize_command " $arg"
  1.5430 +        compiler_flags="$compiler_flags $arg"
  1.5431 +        continue
  1.5432 +        ;;
  1.5433 +
  1.5434        # Some other compiler flag.
  1.5435        -* | +*)
  1.5436 -	# Unknown arguments in both finalize_command and compile_command need
  1.5437 -	# to be aesthetically quoted because they are evaled later.
  1.5438 -	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1.5439 -	case $arg in
  1.5440 -	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.5441 -	  arg="\"$arg\""
  1.5442 -	  ;;
  1.5443 -	esac
  1.5444 +        func_quote_for_eval "$arg"
  1.5445 +	arg="$func_quote_for_eval_result"
  1.5446  	;;
  1.5447  
  1.5448        *.$objext)
  1.5449 @@ -1810,32 +4790,23 @@
  1.5450  	# A libtool-controlled object.
  1.5451  
  1.5452  	# Check to see that this really is a libtool object.
  1.5453 -	if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.5454 +	if func_lalib_unsafe_p "$arg"; then
  1.5455  	  pic_object=
  1.5456  	  non_pic_object=
  1.5457  
  1.5458  	  # Read the .lo file
  1.5459 -	  # If there is no directory component, then add one.
  1.5460 -	  case $arg in
  1.5461 -	  */* | *\\*) . $arg ;;
  1.5462 -	  *) . ./$arg ;;
  1.5463 -	  esac
  1.5464 -
  1.5465 -	  if test -z "$pic_object" || \
  1.5466 +	  func_source "$arg"
  1.5467 +
  1.5468 +	  if test -z "$pic_object" ||
  1.5469  	     test -z "$non_pic_object" ||
  1.5470 -	     test "$pic_object" = none && \
  1.5471 +	     test "$pic_object" = none &&
  1.5472  	     test "$non_pic_object" = none; then
  1.5473 -	    $echo "$modename: cannot find name of object for \`$arg'" 1>&2
  1.5474 -	    exit $EXIT_FAILURE
  1.5475 +	    func_fatal_error "cannot find name of object for \`$arg'"
  1.5476  	  fi
  1.5477  
  1.5478  	  # Extract subdirectory from the argument.
  1.5479 -	  xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1.5480 -	  if test "X$xdir" = "X$arg"; then
  1.5481 -	    xdir=
  1.5482 - 	  else
  1.5483 -	    xdir="$xdir/"
  1.5484 -	  fi
  1.5485 +	  func_dirname "$arg" "/" ""
  1.5486 +	  xdir="$func_dirname_result"
  1.5487  
  1.5488  	  if test "$pic_object" != none; then
  1.5489  	    # Prepend the subdirectory the object is found in.
  1.5490 @@ -1860,7 +4831,7 @@
  1.5491  	    fi
  1.5492  
  1.5493  	    # A PIC object.
  1.5494 -	    libobjs="$libobjs $pic_object"
  1.5495 +	    func_append libobjs " $pic_object"
  1.5496  	    arg="$pic_object"
  1.5497  	  fi
  1.5498  
  1.5499 @@ -1870,7 +4841,7 @@
  1.5500  	    non_pic_object="$xdir$non_pic_object"
  1.5501  
  1.5502  	    # A standard non-PIC object
  1.5503 -	    non_pic_objects="$non_pic_objects $non_pic_object"
  1.5504 +	    func_append non_pic_objects " $non_pic_object"
  1.5505  	    if test -z "$pic_object" || test "$pic_object" = none ; then
  1.5506  	      arg="$non_pic_object"
  1.5507  	    fi
  1.5508 @@ -1878,28 +4849,22 @@
  1.5509  	    # If the PIC object exists, use it instead.
  1.5510  	    # $xdir was prepended to $pic_object above.
  1.5511  	    non_pic_object="$pic_object"
  1.5512 -	    non_pic_objects="$non_pic_objects $non_pic_object"
  1.5513 +	    func_append non_pic_objects " $non_pic_object"
  1.5514  	  fi
  1.5515  	else
  1.5516  	  # Only an error if not doing a dry-run.
  1.5517 -	  if test -z "$run"; then
  1.5518 -	    $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
  1.5519 -	    exit $EXIT_FAILURE
  1.5520 -	  else
  1.5521 -	    # Dry-run case.
  1.5522 -
  1.5523 +	  if $opt_dry_run; then
  1.5524  	    # Extract subdirectory from the argument.
  1.5525 -	    xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
  1.5526 -	    if test "X$xdir" = "X$arg"; then
  1.5527 -	      xdir=
  1.5528 -	    else
  1.5529 -	      xdir="$xdir/"
  1.5530 -	    fi
  1.5531 -
  1.5532 -	    pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
  1.5533 -	    non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
  1.5534 -	    libobjs="$libobjs $pic_object"
  1.5535 -	    non_pic_objects="$non_pic_objects $non_pic_object"
  1.5536 +	    func_dirname "$arg" "/" ""
  1.5537 +	    xdir="$func_dirname_result"
  1.5538 +
  1.5539 +	    func_lo2o "$arg"
  1.5540 +	    pic_object=$xdir$objdir/$func_lo2o_result
  1.5541 +	    non_pic_object=$xdir$func_lo2o_result
  1.5542 +	    func_append libobjs " $pic_object"
  1.5543 +	    func_append non_pic_objects " $non_pic_object"
  1.5544 +	  else
  1.5545 +	    func_fatal_error "\`$arg' is not a valid libtool object"
  1.5546  	  fi
  1.5547  	fi
  1.5548  	;;
  1.5549 @@ -1932,70 +4897,51 @@
  1.5550        *)
  1.5551  	# Unknown arguments in both finalize_command and compile_command need
  1.5552  	# to be aesthetically quoted because they are evaled later.
  1.5553 -	arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
  1.5554 -	case $arg in
  1.5555 -	*[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
  1.5556 -	  arg="\"$arg\""
  1.5557 -	  ;;
  1.5558 -	esac
  1.5559 +	func_quote_for_eval "$arg"
  1.5560 +	arg="$func_quote_for_eval_result"
  1.5561  	;;
  1.5562        esac # arg
  1.5563  
  1.5564        # Now actually substitute the argument into the commands.
  1.5565        if test -n "$arg"; then
  1.5566 -	compile_command="$compile_command $arg"
  1.5567 -	finalize_command="$finalize_command $arg"
  1.5568 +	func_append compile_command " $arg"
  1.5569 +	func_append finalize_command " $arg"
  1.5570        fi
  1.5571      done # argument parsing loop
  1.5572  
  1.5573 -    if test -n "$prev"; then
  1.5574 -      $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
  1.5575 -      $echo "$help" 1>&2
  1.5576 -      exit $EXIT_FAILURE
  1.5577 -    fi
  1.5578 +    test -n "$prev" && \
  1.5579 +      func_fatal_help "the \`$prevarg' option requires an argument"
  1.5580  
  1.5581      if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
  1.5582        eval arg=\"$export_dynamic_flag_spec\"
  1.5583 -      compile_command="$compile_command $arg"
  1.5584 -      finalize_command="$finalize_command $arg"
  1.5585 +      func_append compile_command " $arg"
  1.5586 +      func_append finalize_command " $arg"
  1.5587      fi
  1.5588  
  1.5589      oldlibs=
  1.5590      # calculate the name of the file, without its directory
  1.5591 -    outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
  1.5592 +    func_basename "$output"
  1.5593 +    outputname="$func_basename_result"
  1.5594      libobjs_save="$libobjs"
  1.5595  
  1.5596      if test -n "$shlibpath_var"; then
  1.5597        # get the directories listed in $shlibpath_var
  1.5598 -      eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  1.5599 +      eval shlib_search_path=\`\$ECHO \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
  1.5600      else
  1.5601        shlib_search_path=
  1.5602      fi
  1.5603      eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
  1.5604      eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
  1.5605  
  1.5606 -    output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
  1.5607 -    if test "X$output_objdir" = "X$output"; then
  1.5608 -      output_objdir="$objdir"
  1.5609 -    else
  1.5610 -      output_objdir="$output_objdir/$objdir"
  1.5611 -    fi
  1.5612 +    func_dirname "$output" "/" ""
  1.5613 +    output_objdir="$func_dirname_result$objdir"
  1.5614      # Create the object directory.
  1.5615 -    if test ! -d "$output_objdir"; then
  1.5616 -      $show "$mkdir $output_objdir"
  1.5617 -      $run $mkdir $output_objdir
  1.5618 -      exit_status=$?
  1.5619 -      if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
  1.5620 -	exit $exit_status
  1.5621 -      fi
  1.5622 -    fi
  1.5623 +    func_mkdir_p "$output_objdir"
  1.5624  
  1.5625      # Determine the type of output
  1.5626      case $output in
  1.5627      "")
  1.5628 -      $echo "$modename: you must specify an output file" 1>&2
  1.5629 -      $echo "$help" 1>&2
  1.5630 -      exit $EXIT_FAILURE
  1.5631 +      func_fatal_help "you must specify an output file"
  1.5632        ;;
  1.5633      *.$libext) linkmode=oldlib ;;
  1.5634      *.lo | *.$objext) linkmode=obj ;;
  1.5635 @@ -2003,22 +4949,13 @@
  1.5636      *) linkmode=prog ;; # Anything else should be a program.
  1.5637      esac
  1.5638  
  1.5639 -    case $host in
  1.5640 -    *cygwin* | *mingw* | *pw32*)
  1.5641 -      # don't eliminate duplications in $postdeps and $predeps
  1.5642 -      duplicate_compiler_generated_deps=yes
  1.5643 -      ;;
  1.5644 -    *)
  1.5645 -      duplicate_compiler_generated_deps=$duplicate_deps
  1.5646 -      ;;
  1.5647 -    esac
  1.5648      specialdeplibs=
  1.5649  
  1.5650      libs=
  1.5651      # Find all interdependent deplibs by searching for libraries
  1.5652      # that are linked more than once (e.g. -la -lb -la)
  1.5653      for deplib in $deplibs; do
  1.5654 -      if test "X$duplicate_deps" = "Xyes" ; then
  1.5655 +      if $opt_duplicate_deps ; then
  1.5656  	case "$libs " in
  1.5657  	*" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1.5658  	esac
  1.5659 @@ -2033,7 +4970,7 @@
  1.5660        # $postdeps and mark them as special (i.e., whose duplicates are
  1.5661        # not to be eliminated).
  1.5662        pre_post_deps=
  1.5663 -      if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
  1.5664 +      if $opt_duplicate_compiler_generated_deps; then
  1.5665  	for pre_post_dep in $predeps $postdeps; do
  1.5666  	  case "$pre_post_deps " in
  1.5667  	  *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
  1.5668 @@ -2049,15 +4986,16 @@
  1.5669      newlib_search_path=
  1.5670      need_relink=no # whether we're linking any uninstalled libtool libraries
  1.5671      notinst_deplibs= # not-installed libtool libraries
  1.5672 +    notinst_path= # paths that contain not-installed libtool libraries
  1.5673 +
  1.5674      case $linkmode in
  1.5675      lib)
  1.5676 -	passes="conv link"
  1.5677 +	passes="conv dlpreopen link"
  1.5678  	for file in $dlfiles $dlprefiles; do
  1.5679  	  case $file in
  1.5680  	  *.la) ;;
  1.5681  	  *)
  1.5682 -	    $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
  1.5683 -	    exit $EXIT_FAILURE
  1.5684 +	    func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
  1.5685  	    ;;
  1.5686  	  esac
  1.5687  	done
  1.5688 @@ -2073,7 +5011,20 @@
  1.5689      *)  passes="conv"
  1.5690  	;;
  1.5691      esac
  1.5692 +
  1.5693      for pass in $passes; do
  1.5694 +      # The preopen pass in lib mode reverses $deplibs; put it back here
  1.5695 +      # so that -L comes before libs that need it for instance...
  1.5696 +      if test "$linkmode,$pass" = "lib,link"; then
  1.5697 +	## FIXME: Find the place where the list is rebuilt in the wrong
  1.5698 +	##        order, and fix it there properly
  1.5699 +        tmp_deplibs=
  1.5700 +	for deplib in $deplibs; do
  1.5701 +	  tmp_deplibs="$deplib $tmp_deplibs"
  1.5702 +	done
  1.5703 +	deplibs="$tmp_deplibs"
  1.5704 +      fi
  1.5705 +
  1.5706        if test "$linkmode,$pass" = "lib,link" ||
  1.5707  	 test "$linkmode,$pass" = "prog,scan"; then
  1.5708  	libs="$deplibs"
  1.5709 @@ -2086,31 +5037,65 @@
  1.5710  	link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
  1.5711  	esac
  1.5712        fi
  1.5713 +      if test "$linkmode,$pass" = "lib,dlpreopen"; then
  1.5714 +	# Collect and forward deplibs of preopened libtool libs
  1.5715 +	for lib in $dlprefiles; do
  1.5716 +	  # Ignore non-libtool-libs
  1.5717 +	  dependency_libs=
  1.5718 +	  case $lib in
  1.5719 +	  *.la)	func_source "$lib" ;;
  1.5720 +	  esac
  1.5721 +
  1.5722 +	  # Collect preopened libtool deplibs, except any this library
  1.5723 +	  # has declared as weak libs
  1.5724 +	  for deplib in $dependency_libs; do
  1.5725 +            deplib_base=`$ECHO "X$deplib" | $Xsed -e "$basename"`
  1.5726 +	    case " $weak_libs " in
  1.5727 +	    *" $deplib_base "*) ;;
  1.5728 +	    *) deplibs="$deplibs $deplib" ;;
  1.5729 +	    esac
  1.5730 +	  done
  1.5731 +	done
  1.5732 +	libs="$dlprefiles"
  1.5733 +      fi
  1.5734        if test "$pass" = dlopen; then
  1.5735  	# Collect dlpreopened libraries
  1.5736  	save_deplibs="$deplibs"
  1.5737  	deplibs=
  1.5738        fi
  1.5739 +
  1.5740        for deplib in $libs; do
  1.5741  	lib=
  1.5742  	found=no
  1.5743  	case $deplib in
  1.5744 -	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe)
  1.5745 +	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
  1.5746  	  if test "$linkmode,$pass" = "prog,link"; then
  1.5747  	    compile_deplibs="$deplib $compile_deplibs"
  1.5748  	    finalize_deplibs="$deplib $finalize_deplibs"
  1.5749  	  else
  1.5750  	    compiler_flags="$compiler_flags $deplib"
  1.5751 +	    if test "$linkmode" = lib ; then
  1.5752 +		case "$new_inherited_linker_flags " in
  1.5753 +		    *" $deplib "*) ;;
  1.5754 +		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
  1.5755 +		esac
  1.5756 +	    fi
  1.5757  	  fi
  1.5758  	  continue
  1.5759  	  ;;
  1.5760  	-l*)
  1.5761  	  if test "$linkmode" != lib && test "$linkmode" != prog; then
  1.5762 -	    $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
  1.5763 +	    func_warning "\`-l' is ignored for archives/objects"
  1.5764  	    continue
  1.5765  	  fi
  1.5766 -	  name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
  1.5767 -	  for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
  1.5768 +	  func_stripname '-l' '' "$deplib"
  1.5769 +	  name=$func_stripname_result
  1.5770 +	  if test "$linkmode" = lib; then
  1.5771 +	    searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
  1.5772 +	  else
  1.5773 +	    searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
  1.5774 +	  fi
  1.5775 +	  for searchdir in $searchdirs; do
  1.5776  	    for search_ext in .la $std_shrext .so .a; do
  1.5777  	      # Search the libtool library
  1.5778  	      lib="$searchdir/lib${name}${search_ext}"
  1.5779 @@ -2140,21 +5125,17 @@
  1.5780  	    if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1.5781  	      case " $predeps $postdeps " in
  1.5782  	      *" $deplib "*)
  1.5783 -		if (${SED} -e '2q' $lib |
  1.5784 -                    grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
  1.5785 +		if func_lalib_p "$lib"; then
  1.5786  		  library_names=
  1.5787  		  old_library=
  1.5788 -		  case $lib in
  1.5789 -		  */* | *\\*) . $lib ;;
  1.5790 -		  *) . ./$lib ;;
  1.5791 -		  esac
  1.5792 +		  func_source "$lib"
  1.5793  		  for l in $old_library $library_names; do
  1.5794  		    ll="$l"
  1.5795  		  done
  1.5796  		  if test "X$ll" = "X$old_library" ; then # only static version available
  1.5797  		    found=no
  1.5798 -		    ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1.5799 -		    test "X$ladir" = "X$lib" && ladir="."
  1.5800 +		    func_dirname "$lib" "" "."
  1.5801 +		    ladir="$func_dirname_result"
  1.5802  		    lib=$ladir/$old_library
  1.5803  		    if test "$linkmode,$pass" = "prog,link"; then
  1.5804  		      compile_deplibs="$deplib $compile_deplibs"
  1.5805 @@ -2166,19 +5147,35 @@
  1.5806  		    continue
  1.5807  		  fi
  1.5808  		fi
  1.5809 -	        ;;
  1.5810 +		;;
  1.5811  	      *) ;;
  1.5812  	      esac
  1.5813  	    fi
  1.5814  	  fi
  1.5815  	  ;; # -l
  1.5816 +	*.ltframework)
  1.5817 +	  if test "$linkmode,$pass" = "prog,link"; then
  1.5818 +	    compile_deplibs="$deplib $compile_deplibs"
  1.5819 +	    finalize_deplibs="$deplib $finalize_deplibs"
  1.5820 +	  else
  1.5821 +	    deplibs="$deplib $deplibs"
  1.5822 +	    if test "$linkmode" = lib ; then
  1.5823 +		case "$new_inherited_linker_flags " in
  1.5824 +		    *" $deplib "*) ;;
  1.5825 +		    * ) new_inherited_linker_flags="$new_inherited_linker_flags $deplib" ;;
  1.5826 +		esac
  1.5827 +	    fi
  1.5828 +	  fi
  1.5829 +	  continue
  1.5830 +	  ;;
  1.5831  	-L*)
  1.5832  	  case $linkmode in
  1.5833  	  lib)
  1.5834  	    deplibs="$deplib $deplibs"
  1.5835  	    test "$pass" = conv && continue
  1.5836  	    newdependency_libs="$deplib $newdependency_libs"
  1.5837 -	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1.5838 +	    func_stripname '-L' '' "$deplib"
  1.5839 +	    newlib_search_path="$newlib_search_path $func_stripname_result"
  1.5840  	    ;;
  1.5841  	  prog)
  1.5842  	    if test "$pass" = conv; then
  1.5843 @@ -2191,17 +5188,19 @@
  1.5844  	      compile_deplibs="$deplib $compile_deplibs"
  1.5845  	      finalize_deplibs="$deplib $finalize_deplibs"
  1.5846  	    fi
  1.5847 -	    newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
  1.5848 +	    func_stripname '-L' '' "$deplib"
  1.5849 +	    newlib_search_path="$newlib_search_path $func_stripname_result"
  1.5850  	    ;;
  1.5851  	  *)
  1.5852 -	    $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
  1.5853 +	    func_warning "\`-L' is ignored for archives/objects"
  1.5854  	    ;;
  1.5855  	  esac # linkmode
  1.5856  	  continue
  1.5857  	  ;; # -L
  1.5858  	-R*)
  1.5859  	  if test "$pass" = link; then
  1.5860 -	    dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
  1.5861 +	    func_stripname '-R' '' "$deplib"
  1.5862 +	    dir=$func_stripname_result
  1.5863  	    # Make sure the xrpath contains only unique directories.
  1.5864  	    case "$xrpath " in
  1.5865  	    *" $dir "*) ;;
  1.5866 @@ -2219,35 +5218,41 @@
  1.5867  	  fi
  1.5868  	  case $linkmode in
  1.5869  	  lib)
  1.5870 -	    valid_a_lib=no
  1.5871 -	    case $deplibs_check_method in
  1.5872 -	      match_pattern*)
  1.5873 -		set dummy $deplibs_check_method
  1.5874 -	        match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  1.5875 -		if eval $echo \"$deplib\" 2>/dev/null \
  1.5876 -		    | $SED 10q \
  1.5877 +	    # Linking convenience modules into shared libraries is allowed,
  1.5878 +	    # but linking other static libraries is non-portable.
  1.5879 +	    case " $dlpreconveniencelibs " in
  1.5880 +	    *" $deplib "*) ;;
  1.5881 +	    *)
  1.5882 +	      valid_a_lib=no
  1.5883 +	      case $deplibs_check_method in
  1.5884 +		match_pattern*)
  1.5885 +		  set dummy $deplibs_check_method; shift
  1.5886 +		  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  1.5887 +		  if eval "\$ECHO \"X$deplib\"" 2>/dev/null | $Xsed -e 10q \
  1.5888  		    | $EGREP "$match_pattern_regex" > /dev/null; then
  1.5889 -		  valid_a_lib=yes
  1.5890 -		fi
  1.5891 +		    valid_a_lib=yes
  1.5892 +		  fi
  1.5893  		;;
  1.5894 -	      pass_all)
  1.5895 -		valid_a_lib=yes
  1.5896 +		pass_all)
  1.5897 +		  valid_a_lib=yes
  1.5898  		;;
  1.5899 -            esac
  1.5900 -	    if test "$valid_a_lib" != yes; then
  1.5901 -	      $echo
  1.5902 -	      $echo "*** Warning: Trying to link with static lib archive $deplib."
  1.5903 -	      $echo "*** I have the capability to make that library automatically link in when"
  1.5904 -	      $echo "*** you link to this library.  But I can only do this if you have a"
  1.5905 -	      $echo "*** shared version of the library, which you do not appear to have"
  1.5906 -	      $echo "*** because the file extensions .$libext of this argument makes me believe"
  1.5907 -	      $echo "*** that it is just a static archive that I should not used here."
  1.5908 -	    else
  1.5909 -	      $echo
  1.5910 -	      $echo "*** Warning: Linking the shared library $output against the"
  1.5911 -	      $echo "*** static library $deplib is not portable!"
  1.5912 -	      deplibs="$deplib $deplibs"
  1.5913 -	    fi
  1.5914 +	      esac
  1.5915 +	      if test "$valid_a_lib" != yes; then
  1.5916 +		$ECHO
  1.5917 +		$ECHO "*** Warning: Trying to link with static lib archive $deplib."
  1.5918 +		$ECHO "*** I have the capability to make that library automatically link in when"
  1.5919 +		$ECHO "*** you link to this library.  But I can only do this if you have a"
  1.5920 +		$ECHO "*** shared version of the library, which you do not appear to have"
  1.5921 +		$ECHO "*** because the file extensions .$libext of this argument makes me believe"
  1.5922 +		$ECHO "*** that it is just a static archive that I should not use here."
  1.5923 +	      else
  1.5924 +		$ECHO
  1.5925 +		$ECHO "*** Warning: Linking the shared library $output against the"
  1.5926 +		$ECHO "*** static library $deplib is not portable!"
  1.5927 +		deplibs="$deplib $deplibs"
  1.5928 +	      fi
  1.5929 +	      ;;
  1.5930 +	    esac
  1.5931  	    continue
  1.5932  	    ;;
  1.5933  	  prog)
  1.5934 @@ -2282,21 +5287,18 @@
  1.5935  	  continue
  1.5936  	  ;;
  1.5937  	esac # case $deplib
  1.5938 +
  1.5939  	if test "$found" = yes || test -f "$lib"; then :
  1.5940  	else
  1.5941 -	  $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
  1.5942 -	  exit $EXIT_FAILURE
  1.5943 +	  func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
  1.5944  	fi
  1.5945  
  1.5946  	# Check to see that this really is a libtool archive.
  1.5947 -	if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
  1.5948 -	else
  1.5949 -	  $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
  1.5950 -	  exit $EXIT_FAILURE
  1.5951 -	fi
  1.5952 -
  1.5953 -	ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
  1.5954 -	test "X$ladir" = "X$lib" && ladir="."
  1.5955 +	func_lalib_unsafe_p "$lib" \
  1.5956 +	  || func_fatal_error "\`$lib' is not a valid libtool archive"
  1.5957 +
  1.5958 +	func_dirname "$lib" "" "."
  1.5959 +	ladir="$func_dirname_result"
  1.5960  
  1.5961  	dlname=
  1.5962  	dlopen=
  1.5963 @@ -2304,6 +5306,7 @@
  1.5964  	libdir=
  1.5965  	library_names=
  1.5966  	old_library=
  1.5967 +	inherited_linker_flags=
  1.5968  	# If the library was installed with an old release of libtool,
  1.5969  	# it will not redefine variables installed, or shouldnotlink
  1.5970  	installed=yes
  1.5971 @@ -2312,11 +5315,19 @@
  1.5972  
  1.5973  
  1.5974  	# Read the .la file
  1.5975 -	case $lib in
  1.5976 -	*/* | *\\*) . $lib ;;
  1.5977 -	*) . ./$lib ;;
  1.5978 -	esac
  1.5979 -
  1.5980 +	func_source "$lib"
  1.5981 +
  1.5982 +	# Convert "-framework foo" to "foo.ltframework"
  1.5983 +	if test -n "$inherited_linker_flags"; then
  1.5984 +	  tmp_inherited_linker_flags=`$ECHO "X$inherited_linker_flags" | $Xsed -e 's/-framework \([^ $]*\)/\1.ltframework/g'`
  1.5985 +	  for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
  1.5986 +	    case " $new_inherited_linker_flags " in
  1.5987 +	      *" $tmp_inherited_linker_flag "*) ;;
  1.5988 +	      *) new_inherited_linker_flags="$new_inherited_linker_flags $tmp_inherited_linker_flag";;
  1.5989 +	    esac
  1.5990 +	  done
  1.5991 +	fi
  1.5992 +	dependency_libs=`$ECHO "X $dependency_libs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  1.5993  	if test "$linkmode,$pass" = "lib,link" ||
  1.5994  	   test "$linkmode,$pass" = "prog,scan" ||
  1.5995  	   { test "$linkmode" != prog && test "$linkmode" != lib; }; then
  1.5996 @@ -2329,26 +5340,24 @@
  1.5997  	  deplibs="$lib $deplibs"
  1.5998  	  if test -z "$libdir"; then
  1.5999  	    if test -z "$old_library"; then
  1.6000 -	      $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  1.6001 -	      exit $EXIT_FAILURE
  1.6002 +	      func_fatal_error "cannot find name of link library for \`$lib'"
  1.6003  	    fi
  1.6004  	    # It is a libtool convenience library, so add in its objects.
  1.6005  	    convenience="$convenience $ladir/$objdir/$old_library"
  1.6006  	    old_convenience="$old_convenience $ladir/$objdir/$old_library"
  1.6007 -	    tmp_libs=
  1.6008 -	    for deplib in $dependency_libs; do
  1.6009 -	      deplibs="$deplib $deplibs"
  1.6010 -              if test "X$duplicate_deps" = "Xyes" ; then
  1.6011 -	        case "$tmp_libs " in
  1.6012 -	        *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1.6013 -	        esac
  1.6014 -              fi
  1.6015 -	      tmp_libs="$tmp_libs $deplib"
  1.6016 -	    done
  1.6017  	  elif test "$linkmode" != prog && test "$linkmode" != lib; then
  1.6018 -	    $echo "$modename: \`$lib' is not a convenience library" 1>&2
  1.6019 -	    exit $EXIT_FAILURE
  1.6020 +	    func_fatal_error "\`$lib' is not a convenience library"
  1.6021  	  fi
  1.6022 +	  tmp_libs=
  1.6023 +	  for deplib in $dependency_libs; do
  1.6024 +	    deplibs="$deplib $deplibs"
  1.6025 +	    if $opt_duplicate_deps ; then
  1.6026 +	      case "$tmp_libs " in
  1.6027 +	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1.6028 +	      esac
  1.6029 +	    fi
  1.6030 +	    tmp_libs="$tmp_libs $deplib"
  1.6031 +	  done
  1.6032  	  continue
  1.6033  	fi # $pass = conv
  1.6034  
  1.6035 @@ -2359,15 +5368,13 @@
  1.6036  	  linklib="$l"
  1.6037  	done
  1.6038  	if test -z "$linklib"; then
  1.6039 -	  $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
  1.6040 -	  exit $EXIT_FAILURE
  1.6041 +	  func_fatal_error "cannot find name of link library for \`$lib'"
  1.6042  	fi
  1.6043  
  1.6044  	# This library was specified with -dlopen.
  1.6045  	if test "$pass" = dlopen; then
  1.6046  	  if test -z "$libdir"; then
  1.6047 -	    $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
  1.6048 -	    exit $EXIT_FAILURE
  1.6049 +	    func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
  1.6050  	  fi
  1.6051  	  if test -z "$dlname" ||
  1.6052  	     test "$dlopen_support" != yes ||
  1.6053 @@ -2389,18 +5396,19 @@
  1.6054  	*)
  1.6055  	  abs_ladir=`cd "$ladir" && pwd`
  1.6056  	  if test -z "$abs_ladir"; then
  1.6057 -	    $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
  1.6058 -	    $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
  1.6059 +	    func_warning "cannot determine absolute directory name of \`$ladir'"
  1.6060 +	    func_warning "passing it literally to the linker, although it might fail"
  1.6061  	    abs_ladir="$ladir"
  1.6062  	  fi
  1.6063  	  ;;
  1.6064  	esac
  1.6065 -	laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
  1.6066 +	func_basename "$lib"
  1.6067 +	laname="$func_basename_result"
  1.6068  
  1.6069  	# Find the relevant object directory and library name.
  1.6070  	if test "X$installed" = Xyes; then
  1.6071  	  if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
  1.6072 -	    $echo "$modename: warning: library \`$lib' was moved." 1>&2
  1.6073 +	    func_warning "library \`$lib' was moved."
  1.6074  	    dir="$ladir"
  1.6075  	    absdir="$abs_ladir"
  1.6076  	    libdir="$abs_ladir"
  1.6077 @@ -2422,18 +5430,22 @@
  1.6078  	    notinst_path="$notinst_path $abs_ladir"
  1.6079  	  fi
  1.6080  	fi # $installed = yes
  1.6081 -	name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1.6082 +	func_stripname 'lib' '.la' "$laname"
  1.6083 +	name=$func_stripname_result
  1.6084  
  1.6085  	# This library was specified with -dlpreopen.
  1.6086  	if test "$pass" = dlpreopen; then
  1.6087 -	  if test -z "$libdir"; then
  1.6088 -	    $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
  1.6089 -	    exit $EXIT_FAILURE
  1.6090 +	  if test -z "$libdir" && test "$linkmode" = prog; then
  1.6091 +	    func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
  1.6092  	  fi
  1.6093  	  # Prefer using a static library (so that no silly _DYNAMIC symbols
  1.6094  	  # are required to link).
  1.6095  	  if test -n "$old_library"; then
  1.6096  	    newdlprefiles="$newdlprefiles $dir/$old_library"
  1.6097 +	    # Keep a list of preopened convenience libraries to check
  1.6098 +	    # that they are being used correctly in the link pass.
  1.6099 +	    test -z "$libdir" && \
  1.6100 +		dlpreconveniencelibs="$dlpreconveniencelibs $dir/$old_library"
  1.6101  	  # Otherwise, use the dlname, so that lt_dlopen finds it.
  1.6102  	  elif test -n "$dlname"; then
  1.6103  	    newdlprefiles="$newdlprefiles $dir/$dlname"
  1.6104 @@ -2469,7 +5481,9 @@
  1.6105  	  tmp_libs=
  1.6106  	  for deplib in $dependency_libs; do
  1.6107  	    case $deplib in
  1.6108 -	    -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
  1.6109 +	    -L*) func_stripname '-L' '' "$deplib"
  1.6110 +	         newlib_search_path="$newlib_search_path $func_stripname_result"
  1.6111 +		 ;;
  1.6112  	    esac
  1.6113  	    # Need to link against all dependency_libs?
  1.6114  	    if test "$linkalldeplibs" = yes; then
  1.6115 @@ -2479,7 +5493,7 @@
  1.6116  	      # or/and link against static libraries
  1.6117  	      newdependency_libs="$deplib $newdependency_libs"
  1.6118  	    fi
  1.6119 -	    if test "X$duplicate_deps" = "Xyes" ; then
  1.6120 +	    if $opt_duplicate_deps ; then
  1.6121  	      case "$tmp_libs " in
  1.6122  	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1.6123  	      esac
  1.6124 @@ -2491,14 +5505,15 @@
  1.6125  
  1.6126  	if test "$linkmode,$pass" = "prog,link"; then
  1.6127  	  if test -n "$library_names" &&
  1.6128 -	     { test "$prefer_static_libs" = no || test -z "$old_library"; }; then
  1.6129 +	     { { test "$prefer_static_libs" = no ||
  1.6130 +	         test "$prefer_static_libs,$installed" = "built,yes"; } ||
  1.6131 +	       test -z "$old_library"; }; then
  1.6132  	    # We need to hardcode the library path
  1.6133  	    if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
  1.6134  	      # Make sure the rpath contains only unique directories.
  1.6135 -	      case "$temp_rpath " in
  1.6136 -	      *" $dir "*) ;;
  1.6137 -	      *" $absdir "*) ;;
  1.6138 -	      *) temp_rpath="$temp_rpath $absdir" ;;
  1.6139 +	      case "$temp_rpath:" in
  1.6140 +	      *"$absdir:"*) ;;
  1.6141 +	      *) temp_rpath="$temp_rpath$absdir:" ;;
  1.6142  	      esac
  1.6143  	    fi
  1.6144  
  1.6145 @@ -2536,27 +5551,43 @@
  1.6146  
  1.6147  	link_static=no # Whether the deplib will be linked statically
  1.6148  	use_static_libs=$prefer_static_libs
  1.6149 -	if test "$use_static_libs" = built && test "$installed" = yes ; then
  1.6150 +	if test "$use_static_libs" = built && test "$installed" = yes; then
  1.6151  	  use_static_libs=no
  1.6152  	fi
  1.6153  	if test -n "$library_names" &&
  1.6154  	   { test "$use_static_libs" = no || test -z "$old_library"; }; then
  1.6155 -	  if test "$installed" = no; then
  1.6156 -	    notinst_deplibs="$notinst_deplibs $lib"
  1.6157 -	    need_relink=yes
  1.6158 -	  fi
  1.6159 +	  case $host in
  1.6160 +	  *cygwin* | *mingw* | *cegcc*)
  1.6161 +	      # No point in relinking DLLs because paths are not encoded
  1.6162 +	      notinst_deplibs="$notinst_deplibs $lib"
  1.6163 +	      need_relink=no
  1.6164 +	    ;;
  1.6165 +	  *)
  1.6166 +	    if test "$installed" = no; then
  1.6167 +	      notinst_deplibs="$notinst_deplibs $lib"
  1.6168 +	      need_relink=yes
  1.6169 +	    fi
  1.6170 +	    ;;
  1.6171 +	  esac
  1.6172  	  # This is a shared library
  1.6173  
  1.6174 -	  # Warn about portability, can't link against -module's on
  1.6175 -	  # some systems (darwin)
  1.6176 -	  if test "$shouldnotlink" = yes && test "$pass" = link ; then
  1.6177 -	    $echo
  1.6178 +	  # Warn about portability, can't link against -module's on some
  1.6179 +	  # systems (darwin).  Don't bleat about dlopened modules though!
  1.6180 +	  dlopenmodule=""
  1.6181 +	  for dlpremoduletest in $dlprefiles; do
  1.6182 +	    if test "X$dlpremoduletest" = "X$lib"; then
  1.6183 +	      dlopenmodule="$dlpremoduletest"
  1.6184 +	      break
  1.6185 +	    fi
  1.6186 +	  done
  1.6187 +	  if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
  1.6188 +	    $ECHO
  1.6189  	    if test "$linkmode" = prog; then
  1.6190 -	      $echo "*** Warning: Linking the executable $output against the loadable module"
  1.6191 +	      $ECHO "*** Warning: Linking the executable $output against the loadable module"
  1.6192  	    else
  1.6193 -	      $echo "*** Warning: Linking the shared library $output against the loadable module"
  1.6194 +	      $ECHO "*** Warning: Linking the shared library $output against the loadable module"
  1.6195  	    fi
  1.6196 -	    $echo "*** $linklib is not portable!"
  1.6197 +	    $ECHO "*** $linklib is not portable!"
  1.6198  	  fi
  1.6199  	  if test "$linkmode" = lib &&
  1.6200  	     test "$hardcode_into_libs" = yes; then
  1.6201 @@ -2586,17 +5617,19 @@
  1.6202  	  if test -n "$old_archive_from_expsyms_cmds"; then
  1.6203  	    # figure out the soname
  1.6204  	    set dummy $library_names
  1.6205 -	    realname="$2"
  1.6206 -	    shift; shift
  1.6207 -	    libname=`eval \\$echo \"$libname_spec\"`
  1.6208 +	    shift
  1.6209 +	    realname="$1"
  1.6210 +	    shift
  1.6211 +	    libname=`eval "\\$ECHO \"$libname_spec\""`
  1.6212  	    # use dlname if we got it. it's perfectly good, no?
  1.6213  	    if test -n "$dlname"; then
  1.6214  	      soname="$dlname"
  1.6215  	    elif test -n "$soname_spec"; then
  1.6216  	      # bleh windows
  1.6217  	      case $host in
  1.6218 -	      *cygwin* | mingw*)
  1.6219 -		major=`expr $current - $age`
  1.6220 +	      *cygwin* | mingw* | *cegcc*)
  1.6221 +	        func_arith $current - $age
  1.6222 +		major=$func_arith_result
  1.6223  		versuffix="-$major"
  1.6224  		;;
  1.6225  	      esac
  1.6226 @@ -2607,36 +5640,22 @@
  1.6227  
  1.6228  	    # Make a new name for the extract_expsyms_cmds to use
  1.6229  	    soroot="$soname"
  1.6230 -	    soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
  1.6231 -	    newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
  1.6232 +	    func_basename "$soroot"
  1.6233 +	    soname="$func_basename_result"
  1.6234 +	    func_stripname 'lib' '.dll' "$soname"
  1.6235 +	    newlib=libimp-$func_stripname_result.a
  1.6236  
  1.6237  	    # If the library has no export list, then create one now
  1.6238  	    if test -f "$output_objdir/$soname-def"; then :
  1.6239  	    else
  1.6240 -	      $show "extracting exported symbol list from \`$soname'"
  1.6241 -	      save_ifs="$IFS"; IFS='~'
  1.6242 -	      cmds=$extract_expsyms_cmds
  1.6243 -	      for cmd in $cmds; do
  1.6244 -		IFS="$save_ifs"
  1.6245 -		eval cmd=\"$cmd\"
  1.6246 -		$show "$cmd"
  1.6247 -		$run eval "$cmd" || exit $?
  1.6248 -	      done
  1.6249 -	      IFS="$save_ifs"
  1.6250 +	      func_verbose "extracting exported symbol list from \`$soname'"
  1.6251 +	      func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
  1.6252  	    fi
  1.6253  
  1.6254  	    # Create $newlib
  1.6255  	    if test -f "$output_objdir/$newlib"; then :; else
  1.6256 -	      $show "generating import library for \`$soname'"
  1.6257 -	      save_ifs="$IFS"; IFS='~'
  1.6258 -	      cmds=$old_archive_from_expsyms_cmds
  1.6259 -	      for cmd in $cmds; do
  1.6260 -		IFS="$save_ifs"
  1.6261 -		eval cmd=\"$cmd\"
  1.6262 -		$show "$cmd"
  1.6263 -		$run eval "$cmd" || exit $?
  1.6264 -	      done
  1.6265 -	      IFS="$save_ifs"
  1.6266 +	      func_verbose "generating import library for \`$soname'"
  1.6267 +	      func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
  1.6268  	    fi
  1.6269  	    # make sure the library variables are pointing to the new library
  1.6270  	    dir=$output_objdir
  1.6271 @@ -2658,17 +5677,21 @@
  1.6272  		  *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
  1.6273  		    *-*-unixware7*) add_dir="-L$dir" ;;
  1.6274  		  *-*-darwin* )
  1.6275 -		    # if the lib is a module then we can not link against
  1.6276 -		    # it, someone is ignoring the new warnings I added
  1.6277 +		    # if the lib is a (non-dlopened) module then we can not
  1.6278 +		    # link against it, someone is ignoring the earlier warnings
  1.6279  		    if /usr/bin/file -L $add 2> /dev/null |
  1.6280 -                      $EGREP ": [^:]* bundle" >/dev/null ; then
  1.6281 -		      $echo "** Warning, lib $linklib is a module, not a shared library"
  1.6282 -		      if test -z "$old_library" ; then
  1.6283 -		        $echo
  1.6284 -		        $echo "** And there doesn't seem to be a static archive available"
  1.6285 -		        $echo "** The link will probably fail, sorry"
  1.6286 -		      else
  1.6287 -		        add="$dir/$old_library"
  1.6288 +			 $GREP ": [^:]* bundle" >/dev/null ; then
  1.6289 +		      if test "X$dlopenmodule" != "X$lib"; then
  1.6290 +			$ECHO "*** Warning: lib $linklib is a module, not a shared library"
  1.6291 +			if test -z "$old_library" ; then
  1.6292 +			  $ECHO
  1.6293 +			  $ECHO "*** And there doesn't seem to be a static archive available"
  1.6294 +			  $ECHO "*** The link will probably fail, sorry"
  1.6295 +			else
  1.6296 +			  add="$dir/$old_library"
  1.6297 +			fi
  1.6298 +		      elif test -n "$old_library"; then
  1.6299 +			add="$dir/$old_library"
  1.6300  		      fi
  1.6301  		    fi
  1.6302  		esac
  1.6303 @@ -2686,7 +5709,8 @@
  1.6304  	      fi
  1.6305  	      ;;
  1.6306  	    relink)
  1.6307 -	      if test "$hardcode_direct" = yes; then
  1.6308 +	      if test "$hardcode_direct" = yes &&
  1.6309 +	         test "$hardcode_direct_absolute" = no; then
  1.6310  		add="$dir/$linklib"
  1.6311  	      elif test "$hardcode_minus_L" = yes; then
  1.6312  		add_dir="-L$dir"
  1.6313 @@ -2710,8 +5734,7 @@
  1.6314  	    esac
  1.6315  
  1.6316  	    if test "$lib_linked" != yes; then
  1.6317 -	      $echo "$modename: configuration error: unsupported hardcode properties"
  1.6318 -	      exit $EXIT_FAILURE
  1.6319 +	      func_fatal_configuration "unsupported hardcode properties"
  1.6320  	    fi
  1.6321  
  1.6322  	    if test -n "$add_shlibpath"; then
  1.6323 @@ -2726,8 +5749,8 @@
  1.6324  	    else
  1.6325  	      test -n "$add_dir" && deplibs="$add_dir $deplibs"
  1.6326  	      test -n "$add" && deplibs="$add $deplibs"
  1.6327 -	      if test "$hardcode_direct" != yes && \
  1.6328 -		 test "$hardcode_minus_L" != yes && \
  1.6329 +	      if test "$hardcode_direct" != yes &&
  1.6330 +		 test "$hardcode_minus_L" != yes &&
  1.6331  		 test "$hardcode_shlibpath_var" = yes; then
  1.6332  		case :$finalize_shlibpath: in
  1.6333  		*":$libdir:"*) ;;
  1.6334 @@ -2742,7 +5765,8 @@
  1.6335  	    add_dir=
  1.6336  	    add=
  1.6337  	    # Finalize command for both is simple: just hardcode it.
  1.6338 -	    if test "$hardcode_direct" = yes; then
  1.6339 +	    if test "$hardcode_direct" = yes &&
  1.6340 +	       test "$hardcode_direct_absolute" = no; then
  1.6341  	      add="$libdir/$linklib"
  1.6342  	    elif test "$hardcode_minus_L" = yes; then
  1.6343  	      add_dir="-L$libdir"
  1.6344 @@ -2756,9 +5780,9 @@
  1.6345  	    elif test "$hardcode_automatic" = yes; then
  1.6346  	      if test -n "$inst_prefix_dir" &&
  1.6347  		 test -f "$inst_prefix_dir$libdir/$linklib" ; then
  1.6348 -	        add="$inst_prefix_dir$libdir/$linklib"
  1.6349 +		add="$inst_prefix_dir$libdir/$linklib"
  1.6350  	      else
  1.6351 -	        add="$libdir/$linklib"
  1.6352 +		add="$libdir/$linklib"
  1.6353  	      fi
  1.6354  	    else
  1.6355  	      # We cannot seem to hardcode it, guess we'll fake it.
  1.6356 @@ -2802,21 +5826,21 @@
  1.6357  
  1.6358  	    # Just print a warning and add the library to dependency_libs so
  1.6359  	    # that the program can be linked against the static library.
  1.6360 -	    $echo
  1.6361 -	    $echo "*** Warning: This system can not link to static lib archive $lib."
  1.6362 -	    $echo "*** I have the capability to make that library automatically link in when"
  1.6363 -	    $echo "*** you link to this library.  But I can only do this if you have a"
  1.6364 -	    $echo "*** shared version of the library, which you do not appear to have."
  1.6365 +	    $ECHO
  1.6366 +	    $ECHO "*** Warning: This system can not link to static lib archive $lib."
  1.6367 +	    $ECHO "*** I have the capability to make that library automatically link in when"
  1.6368 +	    $ECHO "*** you link to this library.  But I can only do this if you have a"
  1.6369 +	    $ECHO "*** shared version of the library, which you do not appear to have."
  1.6370  	    if test "$module" = yes; then
  1.6371 -	      $echo "*** But as you try to build a module library, libtool will still create "
  1.6372 -	      $echo "*** a static module, that should work as long as the dlopening application"
  1.6373 -	      $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
  1.6374 +	      $ECHO "*** But as you try to build a module library, libtool will still create "
  1.6375 +	      $ECHO "*** a static module, that should work as long as the dlopening application"
  1.6376 +	      $ECHO "*** is linked with the -dlopen flag to resolve symbols at runtime."
  1.6377  	      if test -z "$global_symbol_pipe"; then
  1.6378 -		$echo
  1.6379 -		$echo "*** However, this would only work if libtool was able to extract symbol"
  1.6380 -		$echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  1.6381 -		$echo "*** not find such a program.  So, this module is probably useless."
  1.6382 -		$echo "*** \`nm' from GNU binutils and a full rebuild may help."
  1.6383 +		$ECHO
  1.6384 +		$ECHO "*** However, this would only work if libtool was able to extract symbol"
  1.6385 +		$ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
  1.6386 +		$ECHO "*** not find such a program.  So, this module is probably useless."
  1.6387 +		$ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
  1.6388  	      fi
  1.6389  	      if test "$build_old_libs" = no; then
  1.6390  		build_libtool_libs=module
  1.6391 @@ -2840,7 +5864,8 @@
  1.6392  	    temp_deplibs=
  1.6393  	    for libdir in $dependency_libs; do
  1.6394  	      case $libdir in
  1.6395 -	      -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
  1.6396 +	      -R*) func_stripname '-R' '' "$libdir"
  1.6397 +	           temp_xrpath=$func_stripname_result
  1.6398  		   case " $xrpath " in
  1.6399  		   *" $temp_xrpath "*) ;;
  1.6400  		   *) xrpath="$xrpath $temp_xrpath";;
  1.6401 @@ -2858,7 +5883,7 @@
  1.6402  	  tmp_libs=
  1.6403  	  for deplib in $dependency_libs; do
  1.6404  	    newdependency_libs="$deplib $newdependency_libs"
  1.6405 -	    if test "X$duplicate_deps" = "Xyes" ; then
  1.6406 +	    if $opt_duplicate_deps ; then
  1.6407  	      case "$tmp_libs " in
  1.6408  	      *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
  1.6409  	      esac
  1.6410 @@ -2872,88 +5897,71 @@
  1.6411  	      case $deplib in
  1.6412  	      -L*) path="$deplib" ;;
  1.6413  	      *.la)
  1.6414 -		dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
  1.6415 -		test "X$dir" = "X$deplib" && dir="."
  1.6416 +	        func_dirname "$deplib" "" "."
  1.6417 +		dir="$func_dirname_result"
  1.6418  		# We need an absolute path.
  1.6419  		case $dir in
  1.6420  		[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
  1.6421  		*)
  1.6422  		  absdir=`cd "$dir" && pwd`
  1.6423  		  if test -z "$absdir"; then
  1.6424 -		    $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
  1.6425 +		    func_warning "cannot determine absolute directory name of \`$dir'"
  1.6426  		    absdir="$dir"
  1.6427  		  fi
  1.6428  		  ;;
  1.6429  		esac
  1.6430 -		if grep "^installed=no" $deplib > /dev/null; then
  1.6431 -		  path="$absdir/$objdir"
  1.6432 -		else
  1.6433 -		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  1.6434 -		  if test -z "$libdir"; then
  1.6435 -		    $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
  1.6436 -		    exit $EXIT_FAILURE
  1.6437 -		  fi
  1.6438 -		  if test "$absdir" != "$libdir"; then
  1.6439 -		    $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
  1.6440 -		  fi
  1.6441 -		  path="$absdir"
  1.6442 -		fi
  1.6443 -		depdepl=
  1.6444 +		if $GREP "^installed=no" $deplib > /dev/null; then
  1.6445  		case $host in
  1.6446  		*-*-darwin*)
  1.6447 -		  # we do not want to link against static libs,
  1.6448 -		  # but need to link against shared
  1.6449 +		  depdepl=
  1.6450  		  eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
  1.6451  		  if test -n "$deplibrary_names" ; then
  1.6452  		    for tmp in $deplibrary_names ; do
  1.6453  		      depdepl=$tmp
  1.6454  		    done
  1.6455 -		    if test -f "$path/$depdepl" ; then
  1.6456 -		      depdepl="$path/$depdepl"
  1.6457 +		    if test -f "$absdir/$objdir/$depdepl" ; then
  1.6458 +		      depdepl="$absdir/$objdir/$depdepl"
  1.6459 +		      darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
  1.6460 +                      if test -z "$darwin_install_name"; then
  1.6461 +                          darwin_install_name=`${OTOOL64} -L $depdepl  | awk '{if (NR == 2) {print $1;exit}}'`
  1.6462 +                      fi
  1.6463 +		      compiler_flags="$compiler_flags ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
  1.6464 +		      linker_flags="$linker_flags -dylib_file ${darwin_install_name}:${depdepl}"
  1.6465 +		      path=
  1.6466  		    fi
  1.6467 -		    # do not add paths which are already there
  1.6468 -		    case " $newlib_search_path " in
  1.6469 -		    *" $path "*) ;;
  1.6470 -		    *) newlib_search_path="$newlib_search_path $path";;
  1.6471 -		    esac
  1.6472  		  fi
  1.6473 -		  path=""
  1.6474  		  ;;
  1.6475  		*)
  1.6476 -		  path="-L$path"
  1.6477 +		  path="-L$absdir/$objdir"
  1.6478  		  ;;
  1.6479  		esac
  1.6480 +		else
  1.6481 +		  eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
  1.6482 +		  test -z "$libdir" && \
  1.6483 +		    func_fatal_error "\`$deplib' is not a valid libtool archive"
  1.6484 +		  test "$absdir" != "$libdir" && \
  1.6485 +		    func_warning "\`$deplib' seems to be moved"
  1.6486 +
  1.6487 +		  path="-L$absdir"
  1.6488 +		fi
  1.6489  		;;
  1.6490 -	      -l*)
  1.6491 -		case $host in
  1.6492 -		*-*-darwin*)
  1.6493 -		  # Again, we only want to link against shared libraries
  1.6494 -		  eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
  1.6495 -		  for tmp in $newlib_search_path ; do
  1.6496 -		    if test -f "$tmp/lib$tmp_libs.dylib" ; then
  1.6497 -		      eval depdepl="$tmp/lib$tmp_libs.dylib"
  1.6498 -		      break
  1.6499 -		    fi
  1.6500 -		  done
  1.6501 -		  path=""
  1.6502 -		  ;;
  1.6503 -		*) continue ;;
  1.6504 -		esac
  1.6505 -		;;
  1.6506 -	      *) continue ;;
  1.6507  	      esac
  1.6508  	      case " $deplibs " in
  1.6509  	      *" $path "*) ;;
  1.6510  	      *) deplibs="$path $deplibs" ;;
  1.6511  	      esac
  1.6512 -	      case " $deplibs " in
  1.6513 -	      *" $depdepl "*) ;;
  1.6514 -	      *) deplibs="$depdepl $deplibs" ;;
  1.6515 -	      esac
  1.6516  	    done
  1.6517  	  fi # link_all_deplibs != no
  1.6518  	fi # linkmode = lib
  1.6519        done # for deplib in $libs
  1.6520 +      if test "$pass" = link; then
  1.6521 +	if test "$linkmode" = "prog"; then
  1.6522 +	  compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
  1.6523 +	  finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
  1.6524 +	else
  1.6525 +	  compiler_flags="$compiler_flags "`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  1.6526 +	fi
  1.6527 +      fi
  1.6528        dependency_libs="$newdependency_libs"
  1.6529        if test "$pass" = dlpreopen; then
  1.6530  	# Link the dlpreopened libraries before other libraries
  1.6531 @@ -3052,38 +6060,36 @@
  1.6532      done # for pass
  1.6533      if test "$linkmode" = prog; then
  1.6534        dlfiles="$newdlfiles"
  1.6535 +    fi
  1.6536 +    if test "$linkmode" = prog || test "$linkmode" = lib; then
  1.6537        dlprefiles="$newdlprefiles"
  1.6538      fi
  1.6539  
  1.6540      case $linkmode in
  1.6541      oldlib)
  1.6542 -      if test -n "$deplibs"; then
  1.6543 -	$echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
  1.6544 -      fi
  1.6545 -
  1.6546        if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1.6547 -	$echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
  1.6548 -      fi
  1.6549 -
  1.6550 -      if test -n "$rpath"; then
  1.6551 -	$echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
  1.6552 +	func_warning "\`-dlopen' is ignored for archives"
  1.6553        fi
  1.6554  
  1.6555 -      if test -n "$xrpath"; then
  1.6556 -	$echo "$modename: warning: \`-R' is ignored for archives" 1>&2
  1.6557 -      fi
  1.6558 -
  1.6559 -      if test -n "$vinfo"; then
  1.6560 -	$echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
  1.6561 -      fi
  1.6562 -
  1.6563 -      if test -n "$release"; then
  1.6564 -	$echo "$modename: warning: \`-release' is ignored for archives" 1>&2
  1.6565 -      fi
  1.6566 -
  1.6567 -      if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
  1.6568 -	$echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
  1.6569 -      fi
  1.6570 +      case " $deplibs" in
  1.6571 +      *\ -l* | *\ -L*)
  1.6572 +	func_warning "\`-l' and \`-L' are ignored for archives" ;;
  1.6573 +      esac
  1.6574 +
  1.6575 +      test -n "$rpath" && \
  1.6576 +	func_warning "\`-rpath' is ignored for archives"
  1.6577 +
  1.6578 +      test -n "$xrpath" && \
  1.6579 +	func_warning "\`-R' is ignored for archives"
  1.6580 +
  1.6581 +      test -n "$vinfo" && \
  1.6582 +	func_warning "\`-version-info/-version-number' is ignored for archives"
  1.6583 +
  1.6584 +      test -n "$release" && \
  1.6585 +	func_warning "\`-release' is ignored for archives"
  1.6586 +
  1.6587 +      test -n "$export_symbols$export_symbols_regex" && \
  1.6588 +	func_warning "\`-export-symbols' is ignored for archives"
  1.6589  
  1.6590        # Now set the variables for building old libraries.
  1.6591        build_libtool_libs=no
  1.6592 @@ -3095,48 +6101,48 @@
  1.6593        # Make sure we only generate libraries of the form `libNAME.la'.
  1.6594        case $outputname in
  1.6595        lib*)
  1.6596 -	name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
  1.6597 +	func_stripname 'lib' '.la' "$outputname"
  1.6598 +	name=$func_stripname_result
  1.6599  	eval shared_ext=\"$shrext_cmds\"
  1.6600  	eval libname=\"$libname_spec\"
  1.6601  	;;
  1.6602        *)
  1.6603 -	if test "$module" = no; then
  1.6604 -	  $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
  1.6605 -	  $echo "$help" 1>&2
  1.6606 -	  exit $EXIT_FAILURE
  1.6607 -	fi
  1.6608 +	test "$module" = no && \
  1.6609 +	  func_fatal_help "libtool library \`$output' must begin with \`lib'"
  1.6610 +
  1.6611  	if test "$need_lib_prefix" != no; then
  1.6612  	  # Add the "lib" prefix for modules if required
  1.6613 -	  name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1.6614 +	  func_stripname '' '.la' "$outputname"
  1.6615 +	  name=$func_stripname_result
  1.6616  	  eval shared_ext=\"$shrext_cmds\"
  1.6617  	  eval libname=\"$libname_spec\"
  1.6618  	else
  1.6619 -	  libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
  1.6620 +	  func_stripname '' '.la' "$outputname"
  1.6621 +	  libname=$func_stripname_result
  1.6622  	fi
  1.6623  	;;
  1.6624        esac
  1.6625  
  1.6626        if test -n "$objs"; then
  1.6627  	if test "$deplibs_check_method" != pass_all; then
  1.6628 -	  $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
  1.6629 -	  exit $EXIT_FAILURE
  1.6630 +	  func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
  1.6631  	else
  1.6632 -	  $echo
  1.6633 -	  $echo "*** Warning: Linking the shared library $output against the non-libtool"
  1.6634 -	  $echo "*** objects $objs is not portable!"
  1.6635 +	  $ECHO
  1.6636 +	  $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
  1.6637 +	  $ECHO "*** objects $objs is not portable!"
  1.6638  	  libobjs="$libobjs $objs"
  1.6639  	fi
  1.6640        fi
  1.6641  
  1.6642 -      if test "$dlself" != no; then
  1.6643 -	$echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
  1.6644 -      fi
  1.6645 +      test "$dlself" != no && \
  1.6646 +	func_warning "\`-dlopen self' is ignored for libtool libraries"
  1.6647  
  1.6648        set dummy $rpath
  1.6649 -      if test "$#" -gt 2; then
  1.6650 -	$echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
  1.6651 -      fi
  1.6652 -      install_libdir="$2"
  1.6653 +      shift
  1.6654 +      test "$#" -gt 1 && \
  1.6655 +	func_warning "ignoring multiple \`-rpath's for a libtool library"
  1.6656 +
  1.6657 +      install_libdir="$1"
  1.6658  
  1.6659        oldlibs=
  1.6660        if test -z "$rpath"; then
  1.6661 @@ -3150,25 +6156,21 @@
  1.6662  	  build_old_libs=yes
  1.6663  	fi
  1.6664  
  1.6665 -	if test -n "$vinfo"; then
  1.6666 -	  $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
  1.6667 -	fi
  1.6668 -
  1.6669 -	if test -n "$release"; then
  1.6670 -	  $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
  1.6671 -	fi
  1.6672 +	test -n "$vinfo" && \
  1.6673 +	  func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
  1.6674 +
  1.6675 +	test -n "$release" && \
  1.6676 +	  func_warning "\`-release' is ignored for convenience libraries"
  1.6677        else
  1.6678  
  1.6679  	# Parse the version information argument.
  1.6680  	save_ifs="$IFS"; IFS=':'
  1.6681  	set dummy $vinfo 0 0 0
  1.6682 +	shift
  1.6683  	IFS="$save_ifs"
  1.6684  
  1.6685 -	if test -n "$8"; then
  1.6686 -	  $echo "$modename: too many parameters to \`-version-info'" 1>&2
  1.6687 -	  $echo "$help" 1>&2
  1.6688 -	  exit $EXIT_FAILURE
  1.6689 -	fi
  1.6690 +	test -n "$7" && \
  1.6691 +	  func_fatal_help "too many parameters to \`-version-info'"
  1.6692  
  1.6693  	# convert absolute version numbers to libtool ages
  1.6694  	# this retains compatibility with .la files and attempts
  1.6695 @@ -3176,9 +6178,9 @@
  1.6696  
  1.6697  	case $vinfo_number in
  1.6698  	yes)
  1.6699 -	  number_major="$2"
  1.6700 -	  number_minor="$3"
  1.6701 -	  number_revision="$4"
  1.6702 +	  number_major="$1"
  1.6703 +	  number_minor="$2"
  1.6704 +	  number_revision="$3"
  1.6705  	  #
  1.6706  	  # There are really only two kinds -- those that
  1.6707  	  # use the current revision as the major version
  1.6708 @@ -3187,8 +6189,9 @@
  1.6709  	  # which has an extra 1 added just for fun
  1.6710  	  #
  1.6711  	  case $version_type in
  1.6712 -	  darwin|linux|osf|windows)
  1.6713 -	    current=`expr $number_major + $number_minor`
  1.6714 +	  darwin|linux|osf|windows|none)
  1.6715 +	    func_arith $number_major + $number_minor
  1.6716 +	    current=$func_arith_result
  1.6717  	    age="$number_minor"
  1.6718  	    revision="$number_revision"
  1.6719  	    ;;
  1.6720 @@ -3198,16 +6201,18 @@
  1.6721  	    age="0"
  1.6722  	    ;;
  1.6723  	  irix|nonstopux)
  1.6724 -	    current=`expr $number_major + $number_minor - 1`
  1.6725 +	    func_arith $number_major + $number_minor
  1.6726 +	    current=$func_arith_result
  1.6727  	    age="$number_minor"
  1.6728  	    revision="$number_minor"
  1.6729 +	    lt_irix_increment=no
  1.6730  	    ;;
  1.6731  	  esac
  1.6732  	  ;;
  1.6733  	no)
  1.6734 -	  current="$2"
  1.6735 -	  revision="$3"
  1.6736 -	  age="$4"
  1.6737 +	  current="$1"
  1.6738 +	  revision="$2"
  1.6739 +	  age="$3"
  1.6740  	  ;;
  1.6741  	esac
  1.6742  
  1.6743 @@ -3215,34 +6220,30 @@
  1.6744  	case $current in
  1.6745  	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]) ;;
  1.6746  	*)
  1.6747 -	  $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
  1.6748 -	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1.6749 -	  exit $EXIT_FAILURE
  1.6750 +	  func_error "CURRENT \`$current' must be a nonnegative integer"
  1.6751 +	  func_fatal_error "\`$vinfo' is not valid version information"
  1.6752  	  ;;
  1.6753  	esac
  1.6754  
  1.6755  	case $revision in
  1.6756  	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]) ;;
  1.6757  	*)
  1.6758 -	  $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
  1.6759 -	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1.6760 -	  exit $EXIT_FAILURE
  1.6761 +	  func_error "REVISION \`$revision' must be a nonnegative integer"
  1.6762 +	  func_fatal_error "\`$vinfo' is not valid version information"
  1.6763  	  ;;
  1.6764  	esac
  1.6765  
  1.6766  	case $age in
  1.6767  	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]) ;;
  1.6768  	*)
  1.6769 -	  $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
  1.6770 -	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1.6771 -	  exit $EXIT_FAILURE
  1.6772 +	  func_error "AGE \`$age' must be a nonnegative integer"
  1.6773 +	  func_fatal_error "\`$vinfo' is not valid version information"
  1.6774  	  ;;
  1.6775  	esac
  1.6776  
  1.6777  	if test "$age" -gt "$current"; then
  1.6778 -	  $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
  1.6779 -	  $echo "$modename: \`$vinfo' is not valid version information" 1>&2
  1.6780 -	  exit $EXIT_FAILURE
  1.6781 +	  func_error "AGE \`$age' is greater than the current interface number \`$current'"
  1.6782 +	  func_fatal_error "\`$vinfo' is not valid version information"
  1.6783  	fi
  1.6784  
  1.6785  	# Calculate the version variables.
  1.6786 @@ -3255,11 +6256,14 @@
  1.6787  	darwin)
  1.6788  	  # Like Linux, but with the current version available in
  1.6789  	  # verstring for coding it into the library header
  1.6790 -	  major=.`expr $current - $age`
  1.6791 +	  func_arith $current - $age
  1.6792 +	  major=.$func_arith_result
  1.6793  	  versuffix="$major.$age.$revision"
  1.6794  	  # Darwin ld doesn't like 0 for these options...
  1.6795 -	  minor_current=`expr $current + 1`
  1.6796 -	  verstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
  1.6797 +	  func_arith $current + 1
  1.6798 +	  minor_current=$func_arith_result
  1.6799 +	  xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
  1.6800 +	  verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
  1.6801  	  ;;
  1.6802  
  1.6803  	freebsd-aout)
  1.6804 @@ -3269,11 +6273,16 @@
  1.6805  
  1.6806  	freebsd-elf)
  1.6807  	  major=".$current"
  1.6808 -	  versuffix=".$current";
  1.6809 +	  versuffix=".$current"
  1.6810  	  ;;
  1.6811  
  1.6812  	irix | nonstopux)
  1.6813 -	  major=`expr $current - $age + 1`
  1.6814 +	  if test "X$lt_irix_increment" = "Xno"; then
  1.6815 +	    func_arith $current - $age
  1.6816 +	  else
  1.6817 +	    func_arith $current - $age + 1
  1.6818 +	  fi
  1.6819 +	  major=$func_arith_result
  1.6820  
  1.6821  	  case $version_type in
  1.6822  	    nonstopux) verstring_prefix=nonstopux ;;
  1.6823 @@ -3284,8 +6293,10 @@
  1.6824  	  # Add in all the interfaces that we are compatible with.
  1.6825  	  loop=$revision
  1.6826  	  while test "$loop" -ne 0; do
  1.6827 -	    iface=`expr $revision - $loop`
  1.6828 -	    loop=`expr $loop - 1`
  1.6829 +	    func_arith $revision - $loop
  1.6830 +	    iface=$func_arith_result
  1.6831 +	    func_arith $loop - 1
  1.6832 +	    loop=$func_arith_result
  1.6833  	    verstring="$verstring_prefix$major.$iface:$verstring"
  1.6834  	  done
  1.6835  
  1.6836 @@ -3295,20 +6306,24 @@
  1.6837  	  ;;
  1.6838  
  1.6839  	linux)
  1.6840 -	  major=.`expr $current - $age`
  1.6841 +	  func_arith $current - $age
  1.6842 +	  major=.$func_arith_result
  1.6843  	  versuffix="$major.$age.$revision"
  1.6844  	  ;;
  1.6845  
  1.6846  	osf)
  1.6847 -	  major=.`expr $current - $age`
  1.6848 +	  func_arith $current - $age
  1.6849 +	  major=.$func_arith_result
  1.6850  	  versuffix=".$current.$age.$revision"
  1.6851  	  verstring="$current.$age.$revision"
  1.6852  
  1.6853  	  # Add in all the interfaces that we are compatible with.
  1.6854  	  loop=$age
  1.6855  	  while test "$loop" -ne 0; do
  1.6856 -	    iface=`expr $current - $loop`
  1.6857 -	    loop=`expr $loop - 1`
  1.6858 +	    func_arith $current - $loop
  1.6859 +	    iface=$func_arith_result
  1.6860 +	    func_arith $loop - 1
  1.6861 +	    loop=$func_arith_result
  1.6862  	    verstring="$verstring:${iface}.0"
  1.6863  	  done
  1.6864  
  1.6865 @@ -3316,6 +6331,11 @@
  1.6866  	  verstring="$verstring:${current}.0"
  1.6867  	  ;;
  1.6868  
  1.6869 +	qnx)
  1.6870 +	  major=".$current"
  1.6871 +	  versuffix=".$current"
  1.6872 +	  ;;
  1.6873 +
  1.6874  	sunos)
  1.6875  	  major=".$current"
  1.6876  	  versuffix=".$current.$revision"
  1.6877 @@ -3324,14 +6344,13 @@
  1.6878  	windows)
  1.6879  	  # Use '-' rather than '.', since we only want one
  1.6880  	  # extension on DOS 8.3 filesystems.
  1.6881 -	  major=`expr $current - $age`
  1.6882 +	  func_arith $current - $age
  1.6883 +	  major=$func_arith_result
  1.6884  	  versuffix="-$major"
  1.6885  	  ;;
  1.6886  
  1.6887  	*)
  1.6888 -	  $echo "$modename: unknown library version type \`$version_type'" 1>&2
  1.6889 -	  $echo "Fatal configuration error.  See the $PACKAGE docs for more information." 1>&2
  1.6890 -	  exit $EXIT_FAILURE
  1.6891 +	  func_fatal_configuration "unknown library version type \`$version_type'"
  1.6892  	  ;;
  1.6893  	esac
  1.6894  
  1.6895 @@ -3365,7 +6384,7 @@
  1.6896  	# Check to see if the archive will have undefined symbols.
  1.6897  	if test "$allow_undefined" = yes; then
  1.6898  	  if test "$allow_undefined_flag" = unsupported; then
  1.6899 -	    $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
  1.6900 +	    func_warning "undefined symbols not allowed in $host shared libraries"
  1.6901  	    build_libtool_libs=no
  1.6902  	    build_old_libs=yes
  1.6903  	  fi
  1.6904 @@ -3373,21 +6392,26 @@
  1.6905  	  # Don't allow undefined symbols.
  1.6906  	  allow_undefined_flag="$no_undefined_flag"
  1.6907  	fi
  1.6908 +
  1.6909        fi
  1.6910  
  1.6911 +      func_generate_dlsyms "$libname" "$libname" "yes"
  1.6912 +      libobjs="$libobjs $symfileobj"
  1.6913 +      test "X$libobjs" = "X " && libobjs=
  1.6914 +
  1.6915        if test "$mode" != relink; then
  1.6916  	# Remove our outputs, but don't remove object files since they
  1.6917  	# may have been created when compiling PIC objects.
  1.6918  	removelist=
  1.6919 -	tempremovelist=`$echo "$output_objdir/*"`
  1.6920 +	tempremovelist=`$ECHO "$output_objdir/*"`
  1.6921  	for p in $tempremovelist; do
  1.6922  	  case $p in
  1.6923 -	    *.$objext)
  1.6924 +	    *.$objext | *.gcno)
  1.6925  	       ;;
  1.6926  	    $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
  1.6927  	       if test "X$precious_files_regex" != "X"; then
  1.6928 -	         if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  1.6929 -	         then
  1.6930 +		 if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
  1.6931 +		 then
  1.6932  		   continue
  1.6933  		 fi
  1.6934  	       fi
  1.6935 @@ -3396,10 +6420,8 @@
  1.6936  	    *) ;;
  1.6937  	  esac
  1.6938  	done
  1.6939 -	if test -n "$removelist"; then
  1.6940 -	  $show "${rm}r $removelist"
  1.6941 -	  $run ${rm}r $removelist
  1.6942 -	fi
  1.6943 +	test -n "$removelist" && \
  1.6944 +	  func_show_eval "${RM}r \$removelist"
  1.6945        fi
  1.6946  
  1.6947        # Now set the variables for building old libraries.
  1.6948 @@ -3407,15 +6429,15 @@
  1.6949  	oldlibs="$oldlibs $output_objdir/$libname.$libext"
  1.6950  
  1.6951  	# Transform .lo files to .o files.
  1.6952 -	oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  1.6953 +	oldobjs="$objs "`$ECHO "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
  1.6954        fi
  1.6955  
  1.6956        # Eliminate all temporary directories.
  1.6957 -      for path in $notinst_path; do
  1.6958 -	lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
  1.6959 -	deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
  1.6960 -	dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
  1.6961 -      done
  1.6962 +      #for path in $notinst_path; do
  1.6963 +      #	lib_search_path=`$ECHO "X$lib_search_path " | $Xsed -e "s% $path % %g"`
  1.6964 +      #	deplibs=`$ECHO "X$deplibs " | $Xsed -e "s% -L$path % %g"`
  1.6965 +      #	dependency_libs=`$ECHO "X$dependency_libs " | $Xsed -e "s% -L$path % %g"`
  1.6966 +      #done
  1.6967  
  1.6968        if test -n "$xrpath"; then
  1.6969  	# If the user specified any rpath flags, then add them.
  1.6970 @@ -3455,12 +6477,12 @@
  1.6971        if test "$build_libtool_libs" = yes; then
  1.6972  	if test -n "$rpath"; then
  1.6973  	  case $host in
  1.6974 -	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
  1.6975 +	  *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc*)
  1.6976  	    # these systems don't actually have a c library (as such)!
  1.6977  	    ;;
  1.6978  	  *-*-rhapsody* | *-*-darwin1.[012])
  1.6979  	    # Rhapsody C library is in the System framework
  1.6980 -	    deplibs="$deplibs -framework System"
  1.6981 +	    deplibs="$deplibs System.ltframework"
  1.6982  	    ;;
  1.6983  	  *-*-netbsd*)
  1.6984  	    # Don't link with libc until the a.out ld.so is fixed.
  1.6985 @@ -3474,7 +6496,7 @@
  1.6986  	  *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
  1.6987  	    # Compiler inserts libc in the correct place for threads to work
  1.6988  	    ;;
  1.6989 - 	  *)
  1.6990 +	  *)
  1.6991  	    # Add libc to deplibs on all other systems if necessary.
  1.6992  	    if test "$build_libtool_need_lc" = "yes"; then
  1.6993  	      deplibs="$deplibs -lc"
  1.6994 @@ -3511,18 +6533,18 @@
  1.6995  	  # limits. Maybe even breaks it.  We compile a program, linking it
  1.6996  	  # against the deplibs as a proxy for the library.  Then we can check
  1.6997  	  # whether they linked in statically or dynamically with ldd.
  1.6998 -	  $rm conftest.c
  1.6999 +	  $opt_dry_run || $RM conftest.c
  1.7000  	  cat > conftest.c <<EOF
  1.7001  	  int main() { return 0; }
  1.7002  EOF
  1.7003 -	  $rm conftest
  1.7004 -	  $LTCC $LTCFLAGS -o conftest conftest.c $deplibs
  1.7005 -	  if test "$?" -eq 0 ; then
  1.7006 +	  $opt_dry_run || $RM conftest
  1.7007 +	  if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
  1.7008  	    ldd_output=`ldd conftest`
  1.7009  	    for i in $deplibs; do
  1.7010 -	      name=`expr $i : '-l\(.*\)'`
  1.7011 -	      # If $name is empty we are operating on a -L argument.
  1.7012 -              if test "$name" != "" && test "$name" -ne "0"; then
  1.7013 +	      case $i in
  1.7014 +	      -l*)
  1.7015 +		func_stripname -l '' "$i"
  1.7016 +		name=$func_stripname_result
  1.7017  		if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1.7018  		  case " $predeps $postdeps " in
  1.7019  		  *" $i "*)
  1.7020 @@ -3530,40 +6552,41 @@
  1.7021  		    i=""
  1.7022  		    ;;
  1.7023  		  esac
  1.7024 -	        fi
  1.7025 +		fi
  1.7026  		if test -n "$i" ; then
  1.7027 -		  libname=`eval \\$echo \"$libname_spec\"`
  1.7028 -		  deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1.7029 -		  set dummy $deplib_matches
  1.7030 -		  deplib_match=$2
  1.7031 +		  libname=`eval "\\$ECHO \"$libname_spec\""`
  1.7032 +		  deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  1.7033 +		  set dummy $deplib_matches; shift
  1.7034 +		  deplib_match=$1
  1.7035  		  if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1.7036  		    newdeplibs="$newdeplibs $i"
  1.7037  		  else
  1.7038  		    droppeddeps=yes
  1.7039 -		    $echo
  1.7040 -		    $echo "*** Warning: dynamic linker does not accept needed library $i."
  1.7041 -		    $echo "*** I have the capability to make that library automatically link in when"
  1.7042 -		    $echo "*** you link to this library.  But I can only do this if you have a"
  1.7043 -		    $echo "*** shared version of the library, which I believe you do not have"
  1.7044 -		    $echo "*** because a test_compile did reveal that the linker did not use it for"
  1.7045 -		    $echo "*** its dynamic dependency list that programs get resolved with at runtime."
  1.7046 +		    $ECHO
  1.7047 +		    $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  1.7048 +		    $ECHO "*** I have the capability to make that library automatically link in when"
  1.7049 +		    $ECHO "*** you link to this library.  But I can only do this if you have a"
  1.7050 +		    $ECHO "*** shared version of the library, which I believe you do not have"
  1.7051 +		    $ECHO "*** because a test_compile did reveal that the linker did not use it for"
  1.7052 +		    $ECHO "*** its dynamic dependency list that programs get resolved with at runtime."
  1.7053  		  fi
  1.7054  		fi
  1.7055 -	      else
  1.7056 +		;;
  1.7057 +	      *)
  1.7058  		newdeplibs="$newdeplibs $i"
  1.7059 -	      fi
  1.7060 +		;;
  1.7061 +	      esac
  1.7062  	    done
  1.7063  	  else
  1.7064  	    # Error occurred in the first compile.  Let's try to salvage
  1.7065  	    # the situation: Compile a separate program for each library.
  1.7066  	    for i in $deplibs; do
  1.7067 -	      name=`expr $i : '-l\(.*\)'`
  1.7068 -	      # If $name is empty we are operating on a -L argument.
  1.7069 -              if test "$name" != "" && test "$name" != "0"; then
  1.7070 -		$rm conftest
  1.7071 -		$LTCC $LTCFLAGS -o conftest conftest.c $i
  1.7072 -		# Did it work?
  1.7073 -		if test "$?" -eq 0 ; then
  1.7074 +	      case $i in
  1.7075 +	      -l*)
  1.7076 +		func_stripname -l '' "$i"
  1.7077 +		name=$func_stripname_result
  1.7078 +		$opt_dry_run || $RM conftest
  1.7079 +		if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
  1.7080  		  ldd_output=`ldd conftest`
  1.7081  		  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1.7082  		    case " $predeps $postdeps " in
  1.7083 @@ -3574,44 +6597,47 @@
  1.7084  		    esac
  1.7085  		  fi
  1.7086  		  if test -n "$i" ; then
  1.7087 -		    libname=`eval \\$echo \"$libname_spec\"`
  1.7088 -		    deplib_matches=`eval \\$echo \"$library_names_spec\"`
  1.7089 -		    set dummy $deplib_matches
  1.7090 -		    deplib_match=$2
  1.7091 +		    libname=`eval "\\$ECHO \"$libname_spec\""`
  1.7092 +		    deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
  1.7093 +		    set dummy $deplib_matches; shift
  1.7094 +		    deplib_match=$1
  1.7095  		    if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
  1.7096  		      newdeplibs="$newdeplibs $i"
  1.7097  		    else
  1.7098  		      droppeddeps=yes
  1.7099 -		      $echo
  1.7100 -		      $echo "*** Warning: dynamic linker does not accept needed library $i."
  1.7101 -		      $echo "*** I have the capability to make that library automatically link in when"
  1.7102 -		      $echo "*** you link to this library.  But I can only do this if you have a"
  1.7103 -		      $echo "*** shared version of the library, which you do not appear to have"
  1.7104 -		      $echo "*** because a test_compile did reveal that the linker did not use this one"
  1.7105 -		      $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
  1.7106 +		      $ECHO
  1.7107 +		      $ECHO "*** Warning: dynamic linker does not accept needed library $i."
  1.7108 +		      $ECHO "*** I have the capability to make that library automatically link in when"
  1.7109 +		      $ECHO "*** you link to this library.  But I can only do this if you have a"
  1.7110 +		      $ECHO "*** shared version of the library, which you do not appear to have"
  1.7111 +		      $ECHO "*** because a test_compile did reveal that the linker did not use this one"
  1.7112 +		      $ECHO "*** as a dynamic dependency that programs can get resolved with at runtime."
  1.7113  		    fi
  1.7114  		  fi
  1.7115  		else
  1.7116  		  droppeddeps=yes
  1.7117 -		  $echo
  1.7118 -		  $echo "*** Warning!  Library $i is needed by this library but I was not able to"
  1.7119 -		  $echo "***  make it link in!  You will probably need to install it or some"
  1.7120 -		  $echo "*** library that it depends on before this library will be fully"
  1.7121 -		  $echo "*** functional.  Installing it before continuing would be even better."
  1.7122 +		  $ECHO
  1.7123 +		  $ECHO "*** Warning!  Library $i is needed by this library but I was not able to"
  1.7124 +		  $ECHO "*** make it link in!  You will probably need to install it or some"
  1.7125 +		  $ECHO "*** library that it depends on before this library will be fully"
  1.7126 +		  $ECHO "*** functional.  Installing it before continuing would be even better."
  1.7127  		fi
  1.7128 -	      else
  1.7129 +		;;
  1.7130 +	      *)
  1.7131  		newdeplibs="$newdeplibs $i"
  1.7132 -	      fi
  1.7133 +		;;
  1.7134 +	      esac
  1.7135  	    done
  1.7136  	  fi
  1.7137  	  ;;
  1.7138  	file_magic*)
  1.7139 -	  set dummy $deplibs_check_method
  1.7140 -	  file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  1.7141 +	  set dummy $deplibs_check_method; shift
  1.7142 +	  file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  1.7143  	  for a_deplib in $deplibs; do
  1.7144 -	    name=`expr $a_deplib : '-l\(.*\)'`
  1.7145 -	    # If $name is empty we are operating on a -L argument.
  1.7146 -            if test "$name" != "" && test  "$name" != "0"; then
  1.7147 +	    case $a_deplib in
  1.7148 +	    -l*)
  1.7149 +	      func_stripname -l '' "$a_deplib"
  1.7150 +	      name=$func_stripname_result
  1.7151  	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1.7152  		case " $predeps $postdeps " in
  1.7153  		*" $a_deplib "*)
  1.7154 @@ -3621,13 +6647,13 @@
  1.7155  		esac
  1.7156  	      fi
  1.7157  	      if test -n "$a_deplib" ; then
  1.7158 -		libname=`eval \\$echo \"$libname_spec\"`
  1.7159 +		libname=`eval "\\$ECHO \"$libname_spec\""`
  1.7160  		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  1.7161  		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  1.7162  		  for potent_lib in $potential_libs; do
  1.7163  		      # Follow soft links.
  1.7164 -		      if ls -lLd "$potent_lib" 2>/dev/null \
  1.7165 -			 | grep " -> " >/dev/null; then
  1.7166 +		      if ls -lLd "$potent_lib" 2>/dev/null |
  1.7167 +			 $GREP " -> " >/dev/null; then
  1.7168  			continue
  1.7169  		      fi
  1.7170  		      # The statement above tries to avoid entering an
  1.7171 @@ -3640,12 +6666,12 @@
  1.7172  			potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
  1.7173  			case $potliblink in
  1.7174  			[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
  1.7175 -			*) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
  1.7176 +			*) potlib=`$ECHO "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
  1.7177  			esac
  1.7178  		      done
  1.7179 -		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
  1.7180 -			 | ${SED} 10q \
  1.7181 -			 | $EGREP "$file_magic_regex" > /dev/null; then
  1.7182 +		      if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
  1.7183 +			 $SED -e 10q |
  1.7184 +			 $EGREP "$file_magic_regex" > /dev/null; then
  1.7185  			newdeplibs="$newdeplibs $a_deplib"
  1.7186  			a_deplib=""
  1.7187  			break 2
  1.7188 @@ -3655,32 +6681,35 @@
  1.7189  	      fi
  1.7190  	      if test -n "$a_deplib" ; then
  1.7191  		droppeddeps=yes
  1.7192 -		$echo
  1.7193 -		$echo "*** Warning: linker path does not have real file for library $a_deplib."
  1.7194 -		$echo "*** I have the capability to make that library automatically link in when"
  1.7195 -		$echo "*** you link to this library.  But I can only do this if you have a"
  1.7196 -		$echo "*** shared version of the library, which you do not appear to have"
  1.7197 -		$echo "*** because I did check the linker path looking for a file starting"
  1.7198 +		$ECHO
  1.7199 +		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  1.7200 +		$ECHO "*** I have the capability to make that library automatically link in when"
  1.7201 +		$ECHO "*** you link to this library.  But I can only do this if you have a"
  1.7202 +		$ECHO "*** shared version of the library, which you do not appear to have"
  1.7203 +		$ECHO "*** because I did check the linker path looking for a file starting"
  1.7204  		if test -z "$potlib" ; then
  1.7205 -		  $echo "*** with $libname but no candidates were found. (...for file magic test)"
  1.7206 +		  $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
  1.7207  		else
  1.7208 -		  $echo "*** with $libname and none of the candidates passed a file format test"
  1.7209 -		  $echo "*** using a file magic. Last file checked: $potlib"
  1.7210 +		  $ECHO "*** with $libname and none of the candidates passed a file format test"
  1.7211 +		  $ECHO "*** using a file magic. Last file checked: $potlib"
  1.7212  		fi
  1.7213  	      fi
  1.7214 -	    else
  1.7215 +	      ;;
  1.7216 +	    *)
  1.7217  	      # Add a -L argument.
  1.7218  	      newdeplibs="$newdeplibs $a_deplib"
  1.7219 -	    fi
  1.7220 +	      ;;
  1.7221 +	    esac
  1.7222  	  done # Gone through all deplibs.
  1.7223  	  ;;
  1.7224  	match_pattern*)
  1.7225 -	  set dummy $deplibs_check_method
  1.7226 -	  match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
  1.7227 +	  set dummy $deplibs_check_method; shift
  1.7228 +	  match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
  1.7229  	  for a_deplib in $deplibs; do
  1.7230 -	    name=`expr $a_deplib : '-l\(.*\)'`
  1.7231 -	    # If $name is empty we are operating on a -L argument.
  1.7232 -	    if test -n "$name" && test "$name" != "0"; then
  1.7233 +	    case $a_deplib in
  1.7234 +	    -l*)
  1.7235 +	      func_stripname -l '' "$a_deplib"
  1.7236 +	      name=$func_stripname_result
  1.7237  	      if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1.7238  		case " $predeps $postdeps " in
  1.7239  		*" $a_deplib "*)
  1.7240 @@ -3690,14 +6719,13 @@
  1.7241  		esac
  1.7242  	      fi
  1.7243  	      if test -n "$a_deplib" ; then
  1.7244 -		libname=`eval \\$echo \"$libname_spec\"`
  1.7245 +		libname=`eval "\\$ECHO \"$libname_spec\""`
  1.7246  		for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
  1.7247  		  potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
  1.7248  		  for potent_lib in $potential_libs; do
  1.7249  		    potlib="$potent_lib" # see symlink-check above in file_magic test
  1.7250 -		    if eval $echo \"$potent_lib\" 2>/dev/null \
  1.7251 -		        | ${SED} 10q \
  1.7252 -		        | $EGREP "$match_pattern_regex" > /dev/null; then
  1.7253 +		    if eval "\$ECHO \"X$potent_lib\"" 2>/dev/null | $Xsed -e 10q | \
  1.7254 +		       $EGREP "$match_pattern_regex" > /dev/null; then
  1.7255  		      newdeplibs="$newdeplibs $a_deplib"
  1.7256  		      a_deplib=""
  1.7257  		      break 2
  1.7258 @@ -3707,44 +6735,46 @@
  1.7259  	      fi
  1.7260  	      if test -n "$a_deplib" ; then
  1.7261  		droppeddeps=yes
  1.7262 -		$echo
  1.7263 -		$echo "*** Warning: linker path does not have real file for library $a_deplib."
  1.7264 -		$echo "*** I have the capability to make that library automatically link in when"
  1.7265 -		$echo "*** you link to this library.  But I can only do this if you have a"
  1.7266 -		$echo "*** shared version of the library, which you do not appear to have"
  1.7267 -		$echo "*** because I did check the linker path looking for a file starting"
  1.7268 +		$ECHO
  1.7269 +		$ECHO "*** Warning: linker path does not have real file for library $a_deplib."
  1.7270 +		$ECHO "*** I have the capability to make that library automatically link in when"
  1.7271 +		$ECHO "*** you link to this library.  But I can only do this if you have a"
  1.7272 +		$ECHO "*** shared version of the library, which you do not appear to have"
  1.7273 +		$ECHO "*** because I did check the linker path looking for a file starting"
  1.7274  		if test -z "$potlib" ; then
  1.7275 -		  $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
  1.7276 +		  $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
  1.7277  		else
  1.7278 -		  $echo "*** with $libname and none of the candidates passed a file format test"
  1.7279 -		  $echo "*** using a regex pattern. Last file checked: $potlib"
  1.7280 +		  $ECHO "*** with $libname and none of the candidates passed a file format test"
  1.7281 +		  $ECHO "*** using a regex pattern. Last file checked: $potlib"
  1.7282  		fi
  1.7283  	      fi
  1.7284 -	    else
  1.7285 +	      ;;
  1.7286 +	    *)
  1.7287  	      # Add a -L argument.
  1.7288  	      newdeplibs="$newdeplibs $a_deplib"
  1.7289 -	    fi
  1.7290 +	      ;;
  1.7291 +	    esac
  1.7292  	  done # Gone through all deplibs.
  1.7293  	  ;;
  1.7294  	none | unknown | *)
  1.7295  	  newdeplibs=""
  1.7296 -	  tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
  1.7297 -	    -e 's/ -[LR][^ ]*//g'`
  1.7298 +	  tmp_deplibs=`$ECHO "X $deplibs" | $Xsed \
  1.7299 +	      -e 's/ -lc$//' -e 's/ -[LR][^ ]*//g'`
  1.7300  	  if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
  1.7301  	    for i in $predeps $postdeps ; do
  1.7302  	      # can't use Xsed below, because $i might contain '/'
  1.7303 -	      tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
  1.7304 +	      tmp_deplibs=`$ECHO "X $tmp_deplibs" | $Xsed -e "s,$i,,"`
  1.7305  	    done
  1.7306  	  fi
  1.7307 -	  if $echo "X $tmp_deplibs" | $Xsed -e 's/[ 	]//g' \
  1.7308 -	    | grep . >/dev/null; then
  1.7309 -	    $echo
  1.7310 +	  if $ECHO "X $tmp_deplibs" | $Xsed -e 's/[	 ]//g' |
  1.7311 +	     $GREP . >/dev/null; then
  1.7312 +	    $ECHO
  1.7313  	    if test "X$deplibs_check_method" = "Xnone"; then
  1.7314 -	      $echo "*** Warning: inter-library dependencies are not supported in this platform."
  1.7315 +	      $ECHO "*** Warning: inter-library dependencies are not supported in this platform."
  1.7316  	    else
  1.7317 -	      $echo "*** Warning: inter-library dependencies are not known to be supported."
  1.7318 +	      $ECHO "*** Warning: inter-library dependencies are not known to be supported."
  1.7319  	    fi
  1.7320 -	    $echo "*** All declared inter-library dependencies are being dropped."
  1.7321 +	    $ECHO "*** All declared inter-library dependencies are being dropped."
  1.7322  	    droppeddeps=yes
  1.7323  	  fi
  1.7324  	  ;;
  1.7325 @@ -3757,24 +6787,24 @@
  1.7326  
  1.7327  	case $host in
  1.7328  	*-*-rhapsody* | *-*-darwin1.[012])
  1.7329 -	  # On Rhapsody replace the C library is the System framework
  1.7330 -	  newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
  1.7331 +	  # On Rhapsody replace the C library with the System framework
  1.7332 +	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
  1.7333  	  ;;
  1.7334  	esac
  1.7335  
  1.7336  	if test "$droppeddeps" = yes; then
  1.7337  	  if test "$module" = yes; then
  1.7338 -	    $echo
  1.7339 -	    $echo "*** Warning: libtool could not satisfy all declared inter-library"
  1.7340 -	    $echo "*** dependencies of module $libname.  Therefore, libtool will create"
  1.7341 -	    $echo "*** a static module, that should work as long as the dlopening"
  1.7342 -	    $echo "*** application is linked with the -dlopen flag."
  1.7343 +	    $ECHO
  1.7344 +	    $ECHO "*** Warning: libtool could not satisfy all declared inter-library"
  1.7345 +	    $ECHO "*** dependencies of module $libname.  Therefore, libtool will create"
  1.7346 +	    $ECHO "*** a static module, that should work as long as the dlopening"
  1.7347 +	    $ECHO "*** application is linked with the -dlopen flag."
  1.7348  	    if test -z "$global_symbol_pipe"; then
  1.7349 -	      $echo
  1.7350 -	      $echo "*** However, this would only work if libtool was able to extract symbol"
  1.7351 -	      $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
  1.7352 -	      $echo "*** not find such a program.  So, this module is probably useless."
  1.7353 -	      $echo "*** \`nm' from GNU binutils and a full rebuild may help."
  1.7354 +	      $ECHO
  1.7355 +	      $ECHO "*** However, this would only work if libtool was able to extract symbol"
  1.7356 +	      $ECHO "*** lists from a program, using \`nm' or equivalent, but libtool could"
  1.7357 +	      $ECHO "*** not find such a program.  So, this module is probably useless."
  1.7358 +	      $ECHO "*** \`nm' from GNU binutils and a full rebuild may help."
  1.7359  	    fi
  1.7360  	    if test "$build_old_libs" = no; then
  1.7361  	      oldlibs="$output_objdir/$libname.$libext"
  1.7362 @@ -3784,16 +6814,16 @@
  1.7363  	      build_libtool_libs=no
  1.7364  	    fi
  1.7365  	  else
  1.7366 -	    $echo "*** The inter-library dependencies that have been dropped here will be"
  1.7367 -	    $echo "*** automatically added whenever a program is linked with this library"
  1.7368 -	    $echo "*** or is declared to -dlopen it."
  1.7369 +	    $ECHO "*** The inter-library dependencies that have been dropped here will be"
  1.7370 +	    $ECHO "*** automatically added whenever a program is linked with this library"
  1.7371 +	    $ECHO "*** or is declared to -dlopen it."
  1.7372  
  1.7373  	    if test "$allow_undefined" = no; then
  1.7374 -	      $echo
  1.7375 -	      $echo "*** Since this library must not contain undefined symbols,"
  1.7376 -	      $echo "*** because either the platform does not support them or"
  1.7377 -	      $echo "*** it was explicitly requested with -no-undefined,"
  1.7378 -	      $echo "*** libtool will only create a static version of it."
  1.7379 +	      $ECHO
  1.7380 +	      $ECHO "*** Since this library must not contain undefined symbols,"
  1.7381 +	      $ECHO "*** because either the platform does not support them or"
  1.7382 +	      $ECHO "*** it was explicitly requested with -no-undefined,"
  1.7383 +	      $ECHO "*** libtool will only create a static version of it."
  1.7384  	      if test "$build_old_libs" = no; then
  1.7385  		oldlibs="$output_objdir/$libname.$libext"
  1.7386  		build_libtool_libs=module
  1.7387 @@ -3807,7 +6837,14 @@
  1.7388  	# Done checking deplibs!
  1.7389  	deplibs=$newdeplibs
  1.7390        fi
  1.7391 -
  1.7392 +      # Time to change all our "foo.ltframework" stuff back to "-framework foo"
  1.7393 +      case $host in
  1.7394 +	*-*-darwin*)
  1.7395 +	  newdeplibs=`$ECHO "X $newdeplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  1.7396 +	  new_inherited_linker_flags=`$ECHO "X $new_inherited_linker_flags" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  1.7397 +	  deplibs=`$ECHO "X $deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  1.7398 +	  ;;
  1.7399 +      esac
  1.7400  
  1.7401        # move library search paths that coincide with paths to not yet
  1.7402        # installed libraries to the beginning of the library search list
  1.7403 @@ -3836,7 +6873,6 @@
  1.7404        done
  1.7405        deplibs="$new_libs"
  1.7406  
  1.7407 -
  1.7408        # All the library-specific variables (install_libdir is set above).
  1.7409        library_names=
  1.7410        old_library=
  1.7411 @@ -3907,8 +6943,9 @@
  1.7412  	eval shared_ext=\"$shrext_cmds\"
  1.7413  	eval library_names=\"$library_names_spec\"
  1.7414  	set dummy $library_names
  1.7415 -	realname="$2"
  1.7416 -	shift; shift
  1.7417 +	shift
  1.7418 +	realname="$1"
  1.7419 +	shift
  1.7420  
  1.7421  	if test -n "$soname_spec"; then
  1.7422  	  eval soname=\"$soname_spec\"
  1.7423 @@ -3927,71 +6964,122 @@
  1.7424  	done
  1.7425  
  1.7426  	# Use standard objects if they are pic
  1.7427 -	test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1.7428 +	test -z "$pic_flag" && libobjs=`$ECHO "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1.7429 +	test "X$libobjs" = "X " && libobjs=
  1.7430 +
  1.7431 +	delfiles=
  1.7432 +	if test -n "$export_symbols" && test -n "$include_expsyms"; then
  1.7433 +	  $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
  1.7434 +	  export_symbols="$output_objdir/$libname.uexp"
  1.7435 +	  delfiles="$delfiles $export_symbols"
  1.7436 +	fi
  1.7437 +
  1.7438 +	orig_export_symbols=
  1.7439 +	case $host_os in
  1.7440 +	cygwin* | mingw* | cegcc*)
  1.7441 +	  if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
  1.7442 +	    # exporting using user supplied symfile
  1.7443 +	    if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
  1.7444 +	      # and it's NOT already a .def file. Must figure out
  1.7445 +	      # which of the given symbols are data symbols and tag
  1.7446 +	      # them as such. So, trigger use of export_symbols_cmds.
  1.7447 +	      # export_symbols gets reassigned inside the "prepare
  1.7448 +	      # the list of exported symbols" if statement, so the
  1.7449 +	      # include_expsyms logic still works.
  1.7450 +	      orig_export_symbols="$export_symbols"
  1.7451 +	      export_symbols=
  1.7452 +	      always_export_symbols=yes
  1.7453 +	    fi
  1.7454 +	  fi
  1.7455 +	  ;;
  1.7456 +	esac
  1.7457  
  1.7458  	# Prepare the list of exported symbols
  1.7459  	if test -z "$export_symbols"; then
  1.7460  	  if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
  1.7461 -	    $show "generating symbol list for \`$libname.la'"
  1.7462 +	    func_verbose "generating symbol list for \`$libname.la'"
  1.7463  	    export_symbols="$output_objdir/$libname.exp"
  1.7464 -	    $run $rm $export_symbols
  1.7465 +	    $opt_dry_run || $RM $export_symbols
  1.7466  	    cmds=$export_symbols_cmds
  1.7467  	    save_ifs="$IFS"; IFS='~'
  1.7468  	    for cmd in $cmds; do
  1.7469  	      IFS="$save_ifs"
  1.7470  	      eval cmd=\"$cmd\"
  1.7471 -	      if len=`expr "X$cmd" : ".*"` &&
  1.7472 -	       test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  1.7473 -	        $show "$cmd"
  1.7474 -	        $run eval "$cmd" || exit $?
  1.7475 -	        skipped_export=false
  1.7476 +	      func_len " $cmd"
  1.7477 +	      len=$func_len_result
  1.7478 +	      if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  1.7479 +		func_show_eval "$cmd" 'exit $?'
  1.7480 +		skipped_export=false
  1.7481  	      else
  1.7482 -	        # The command line is too long to execute in one step.
  1.7483 -	        $show "using reloadable object file for export list..."
  1.7484 -	        skipped_export=:
  1.7485 +		# The command line is too long to execute in one step.
  1.7486 +		func_verbose "using reloadable object file for export list..."
  1.7487 +		skipped_export=:
  1.7488  		# Break out early, otherwise skipped_export may be
  1.7489  		# set to false by a later but shorter cmd.
  1.7490  		break
  1.7491  	      fi
  1.7492  	    done
  1.7493  	    IFS="$save_ifs"
  1.7494 -	    if test -n "$export_symbols_regex"; then
  1.7495 -	      $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
  1.7496 -	      $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  1.7497 -	      $show "$mv \"${export_symbols}T\" \"$export_symbols\""
  1.7498 -	      $run eval '$mv "${export_symbols}T" "$export_symbols"'
  1.7499 +	    if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
  1.7500 +	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  1.7501 +	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  1.7502  	    fi
  1.7503  	  fi
  1.7504  	fi
  1.7505  
  1.7506  	if test -n "$export_symbols" && test -n "$include_expsyms"; then
  1.7507 -	  $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
  1.7508 +	  tmp_export_symbols="$export_symbols"
  1.7509 +	  test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
  1.7510 +	  $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
  1.7511 +	fi
  1.7512 +
  1.7513 +	if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
  1.7514 +	  # The given exports_symbols file has to be filtered, so filter it.
  1.7515 +	  func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
  1.7516 +	  # FIXME: $output_objdir/$libname.filter potentially contains lots of
  1.7517 +	  # 's' commands which not all seds can handle. GNU sed should be fine
  1.7518 +	  # though. Also, the filter scales superlinearly with the number of
  1.7519 +	  # global variables. join(1) would be nice here, but unfortunately
  1.7520 +	  # isn't a blessed tool.
  1.7521 +	  $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  1.7522 +	  delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
  1.7523 +	  export_symbols=$output_objdir/$libname.def
  1.7524 +	  $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  1.7525  	fi
  1.7526  
  1.7527  	tmp_deplibs=
  1.7528  	for test_deplib in $deplibs; do
  1.7529 -		case " $convenience " in
  1.7530 -		*" $test_deplib "*) ;;
  1.7531 -		*)
  1.7532 -			tmp_deplibs="$tmp_deplibs $test_deplib"
  1.7533 -			;;
  1.7534 -		esac
  1.7535 +	  case " $convenience " in
  1.7536 +	  *" $test_deplib "*) ;;
  1.7537 +	  *)
  1.7538 +	    tmp_deplibs="$tmp_deplibs $test_deplib"
  1.7539 +	    ;;
  1.7540 +	  esac
  1.7541  	done
  1.7542  	deplibs="$tmp_deplibs"
  1.7543  
  1.7544  	if test -n "$convenience"; then
  1.7545 +	  if test -n "$whole_archive_flag_spec" &&
  1.7546 +	    test "$compiler_needs_object" = yes &&
  1.7547 +	    test -z "$libobjs"; then
  1.7548 +	    # extract the archives, so we have objects to list.
  1.7549 +	    # TODO: could optimize this to just extract one archive.
  1.7550 +	    whole_archive_flag_spec=
  1.7551 +	  fi
  1.7552  	  if test -n "$whole_archive_flag_spec"; then
  1.7553  	    save_libobjs=$libobjs
  1.7554  	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  1.7555 +	    test "X$libobjs" = "X " && libobjs=
  1.7556  	  else
  1.7557  	    gentop="$output_objdir/${outputname}x"
  1.7558  	    generated="$generated $gentop"
  1.7559  
  1.7560  	    func_extract_archives $gentop $convenience
  1.7561  	    libobjs="$libobjs $func_extract_archives_result"
  1.7562 +	    test "X$libobjs" = "X " && libobjs=
  1.7563  	  fi
  1.7564  	fi
  1.7565 -	
  1.7566 +
  1.7567  	if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
  1.7568  	  eval flag=\"$thread_safe_flag_spec\"
  1.7569  	  linker_flags="$linker_flags $flag"
  1.7570 @@ -3999,7 +7087,7 @@
  1.7571  
  1.7572  	# Make a backup of the uninstalled library when relinking
  1.7573  	if test "$mode" = relink; then
  1.7574 -	  $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
  1.7575 +	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
  1.7576  	fi
  1.7577  
  1.7578  	# Do each of the archive commands.
  1.7579 @@ -4012,22 +7100,24 @@
  1.7580  	    cmds=$module_cmds
  1.7581  	  fi
  1.7582  	else
  1.7583 -	if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  1.7584 -	  eval test_cmds=\"$archive_expsym_cmds\"
  1.7585 -	  cmds=$archive_expsym_cmds
  1.7586 -	else
  1.7587 -	  eval test_cmds=\"$archive_cmds\"
  1.7588 -	  cmds=$archive_cmds
  1.7589 +	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  1.7590 +	    eval test_cmds=\"$archive_expsym_cmds\"
  1.7591 +	    cmds=$archive_expsym_cmds
  1.7592 +	  else
  1.7593 +	    eval test_cmds=\"$archive_cmds\"
  1.7594 +	    cmds=$archive_cmds
  1.7595  	  fi
  1.7596  	fi
  1.7597  
  1.7598  	if test "X$skipped_export" != "X:" &&
  1.7599 -	   len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
  1.7600 -	   test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  1.7601 +	   func_len " $test_cmds" &&
  1.7602 +	   len=$func_len_result &&
  1.7603 +	   test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
  1.7604  	  :
  1.7605  	else
  1.7606 -	  # The command line is too long to link in one step, link piecewise.
  1.7607 -	  $echo "creating reloadable object files..."
  1.7608 +	  # The command line is too long to link in one step, link piecewise
  1.7609 +	  # or, if using GNU ld and skipped_export is not :, use a linker
  1.7610 +	  # script.
  1.7611  
  1.7612  	  # Save the value of $output and $libobjs because we want to
  1.7613  	  # use them later.  If we have whole_archive_flag_spec, we
  1.7614 @@ -4041,77 +7131,162 @@
  1.7615  	    save_libobjs=$libobjs
  1.7616  	  fi
  1.7617  	  save_output=$output
  1.7618 -	  output_la=`$echo "X$output" | $Xsed -e "$basename"`
  1.7619 +	  output_la=`$ECHO "X$output" | $Xsed -e "$basename"`
  1.7620  
  1.7621  	  # Clear the reloadable object creation command queue and
  1.7622  	  # initialize k to one.
  1.7623  	  test_cmds=
  1.7624  	  concat_cmds=
  1.7625  	  objlist=
  1.7626 -	  delfiles=
  1.7627  	  last_robj=
  1.7628  	  k=1
  1.7629 -	  output=$output_objdir/$output_la-${k}.$objext
  1.7630 -	  # Loop over the list of objects to be linked.
  1.7631 -	  for obj in $save_libobjs
  1.7632 -	  do
  1.7633 -	    eval test_cmds=\"$reload_cmds $objlist $last_robj\"
  1.7634 -	    if test "X$objlist" = X ||
  1.7635 -	       { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
  1.7636 -		 test "$len" -le "$max_cmd_len"; }; then
  1.7637 -	      objlist="$objlist $obj"
  1.7638 -	    else
  1.7639 -	      # The command $test_cmds is almost too long, add a
  1.7640 -	      # command to the queue.
  1.7641 -	      if test "$k" -eq 1 ; then
  1.7642 -		# The first file doesn't have a previous command to add.
  1.7643 -		eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
  1.7644 -	      else
  1.7645 -		# All subsequent reloadable object files will link in
  1.7646 -		# the last one created.
  1.7647 -		eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
  1.7648 -	      fi
  1.7649 -	      last_robj=$output_objdir/$output_la-${k}.$objext
  1.7650 -	      k=`expr $k + 1`
  1.7651 -	      output=$output_objdir/$output_la-${k}.$objext
  1.7652 -	      objlist=$obj
  1.7653 -	      len=1
  1.7654 +
  1.7655 +	  if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
  1.7656 +	    output=${output_objdir}/${output_la}.lnkscript
  1.7657 +	    func_verbose "creating GNU ld script: $output"
  1.7658 +	    $ECHO 'INPUT (' > $output
  1.7659 +	    for obj in $save_libobjs
  1.7660 +	    do
  1.7661 +	      $ECHO "$obj" >> $output
  1.7662 +	    done
  1.7663 +	    $ECHO ')' >> $output
  1.7664 +	    delfiles="$delfiles $output"
  1.7665 +	  elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
  1.7666 +	    output=${output_objdir}/${output_la}.lnk
  1.7667 +	    func_verbose "creating linker input file list: $output"
  1.7668 +	    : > $output
  1.7669 +	    set x $save_libobjs
  1.7670 +	    shift
  1.7671 +	    firstobj=
  1.7672 +	    if test "$compiler_needs_object" = yes; then
  1.7673 +	      firstobj="$1 "
  1.7674 +	      shift
  1.7675  	    fi
  1.7676 -	  done
  1.7677 -	  # Handle the remaining objects by creating one last
  1.7678 -	  # reloadable object file.  All subsequent reloadable object
  1.7679 -	  # files will link in the last one created.
  1.7680 -	  test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  1.7681 -	  eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
  1.7682 -
  1.7683 -	  if ${skipped_export-false}; then
  1.7684 -	    $show "generating symbol list for \`$libname.la'"
  1.7685 -	    export_symbols="$output_objdir/$libname.exp"
  1.7686 -	    $run $rm $export_symbols
  1.7687 -	    libobjs=$output
  1.7688 -	    # Append the command to create the export file.
  1.7689 -	    eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
  1.7690 -          fi
  1.7691 -
  1.7692 -	  # Set up a command to remove the reloadable object files
  1.7693 -	  # after they are used.
  1.7694 -	  i=0
  1.7695 -	  while test "$i" -lt "$k"
  1.7696 -	  do
  1.7697 -	    i=`expr $i + 1`
  1.7698 -	    delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
  1.7699 -	  done
  1.7700 -
  1.7701 -	  $echo "creating a temporary reloadable object file: $output"
  1.7702 -
  1.7703 -	  # Loop through the commands generated above and execute them.
  1.7704 -	  save_ifs="$IFS"; IFS='~'
  1.7705 -	  for cmd in $concat_cmds; do
  1.7706 +	    for obj
  1.7707 +	    do
  1.7708 +	      $ECHO "$obj" >> $output
  1.7709 +	    done
  1.7710 +	    delfiles="$delfiles $output"
  1.7711 +	    output=$firstobj\"$file_list_spec$output\"
  1.7712 +	  else
  1.7713 +	    if test -n "$save_libobjs"; then
  1.7714 +	      func_verbose "creating reloadable object files..."
  1.7715 +	      output=$output_objdir/$output_la-${k}.$objext
  1.7716 +	      eval test_cmds=\"$reload_cmds\"
  1.7717 +	      func_len " $test_cmds"
  1.7718 +	      len0=$func_len_result
  1.7719 +	      len=$len0
  1.7720 +
  1.7721 +	      # Loop over the list of objects to be linked.
  1.7722 +	      for obj in $save_libobjs
  1.7723 +	      do
  1.7724 +		func_len " $obj"
  1.7725 +		func_arith $len + $func_len_result
  1.7726 +		len=$func_arith_result
  1.7727 +		if test "X$objlist" = X ||
  1.7728 +		   test "$len" -lt "$max_cmd_len"; then
  1.7729 +		  func_append objlist " $obj"
  1.7730 +		else
  1.7731 +		  # The command $test_cmds is almost too long, add a
  1.7732 +		  # command to the queue.
  1.7733 +		  if test "$k" -eq 1 ; then
  1.7734 +		    # The first file doesn't have a previous command to add.
  1.7735 +		    eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
  1.7736 +		  else
  1.7737 +		    # All subsequent reloadable object files will link in
  1.7738 +		    # the last one created.
  1.7739 +		    eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj~\$RM $last_robj\"
  1.7740 +		  fi
  1.7741 +		  last_robj=$output_objdir/$output_la-${k}.$objext
  1.7742 +		  func_arith $k + 1
  1.7743 +		  k=$func_arith_result
  1.7744 +		  output=$output_objdir/$output_la-${k}.$objext
  1.7745 +		  objlist=$obj
  1.7746 +		  func_len " $last_robj"
  1.7747 +		  func_arith $len0 + $func_len_result
  1.7748 +		  len=$func_arith_result
  1.7749 +		fi
  1.7750 +	      done
  1.7751 +	      # Handle the remaining objects by creating one last
  1.7752 +	      # reloadable object file.  All subsequent reloadable object
  1.7753 +	      # files will link in the last one created.
  1.7754 +	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  1.7755 +	      eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
  1.7756 +	      if test -n "$last_robj"; then
  1.7757 +	        eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
  1.7758 +	      fi
  1.7759 +	      delfiles="$delfiles $output"
  1.7760 +
  1.7761 +	    else
  1.7762 +	      output=
  1.7763 +	    fi
  1.7764 +
  1.7765 +	    if ${skipped_export-false}; then
  1.7766 +	      func_verbose "generating symbol list for \`$libname.la'"
  1.7767 +	      export_symbols="$output_objdir/$libname.exp"
  1.7768 +	      $opt_dry_run || $RM $export_symbols
  1.7769 +	      libobjs=$output
  1.7770 +	      # Append the command to create the export file.
  1.7771 +	      test -z "$concat_cmds" || concat_cmds=$concat_cmds~
  1.7772 +	      eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
  1.7773 +	      if test -n "$last_robj"; then
  1.7774 +		eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
  1.7775 +	      fi
  1.7776 +	    fi
  1.7777 +
  1.7778 +	    test -n "$save_libobjs" &&
  1.7779 +	      func_verbose "creating a temporary reloadable object file: $output"
  1.7780 +
  1.7781 +	    # Loop through the commands generated above and execute them.
  1.7782 +	    save_ifs="$IFS"; IFS='~'
  1.7783 +	    for cmd in $concat_cmds; do
  1.7784 +	      IFS="$save_ifs"
  1.7785 +	      $opt_silent || {
  1.7786 +		  func_quote_for_expand "$cmd"
  1.7787 +		  eval "func_echo $func_quote_for_expand_result"
  1.7788 +	      }
  1.7789 +	      $opt_dry_run || eval "$cmd" || {
  1.7790 +		lt_exit=$?
  1.7791 +
  1.7792 +		# Restore the uninstalled library and exit
  1.7793 +		if test "$mode" = relink; then
  1.7794 +		  ( cd "$output_objdir" && \
  1.7795 +		    $RM "${realname}T" && \
  1.7796 +		    $MV "${realname}U" "$realname" )
  1.7797 +		fi
  1.7798 +
  1.7799 +		exit $lt_exit
  1.7800 +	      }
  1.7801 +	    done
  1.7802  	    IFS="$save_ifs"
  1.7803 -	    $show "$cmd"
  1.7804 -	    $run eval "$cmd" || exit $?
  1.7805 -	  done
  1.7806 -	  IFS="$save_ifs"
  1.7807 +
  1.7808 +	    if test -n "$export_symbols_regex" && ${skipped_export-false}; then
  1.7809 +	      func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
  1.7810 +	      func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
  1.7811 +	    fi
  1.7812 +	  fi
  1.7813 +
  1.7814 +          if ${skipped_export-false}; then
  1.7815 +	    if test -n "$export_symbols" && test -n "$include_expsyms"; then
  1.7816 +	      tmp_export_symbols="$export_symbols"
  1.7817 +	      test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
  1.7818 +	      $opt_dry_run || eval '$ECHO "X$include_expsyms" | $Xsed | $SP2NL >> "$tmp_export_symbols"'
  1.7819 +	    fi
  1.7820 +
  1.7821 +	    if test -n "$orig_export_symbols"; then
  1.7822 +	      # The given exports_symbols file has to be filtered, so filter it.
  1.7823 +	      func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
  1.7824 +	      # FIXME: $output_objdir/$libname.filter potentially contains lots of
  1.7825 +	      # 's' commands which not all seds can handle. GNU sed should be fine
  1.7826 +	      # though. Also, the filter scales superlinearly with the number of
  1.7827 +	      # global variables. join(1) would be nice here, but unfortunately
  1.7828 +	      # isn't a blessed tool.
  1.7829 +	      $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
  1.7830 +	      delfiles="$delfiles $export_symbols $output_objdir/$libname.filter"
  1.7831 +	      export_symbols=$output_objdir/$libname.def
  1.7832 +	      $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
  1.7833 +	    fi
  1.7834 +	  fi
  1.7835  
  1.7836  	  libobjs=$output
  1.7837  	  # Restore the value of output.
  1.7838 @@ -4119,6 +7294,7 @@
  1.7839  
  1.7840  	  if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
  1.7841  	    eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
  1.7842 +	    test "X$libobjs" = "X " && libobjs=
  1.7843  	  fi
  1.7844  	  # Expand the library linking commands again to reset the
  1.7845  	  # value of $libobjs for piecewise linking.
  1.7846 @@ -4131,28 +7307,45 @@
  1.7847  	      cmds=$module_cmds
  1.7848  	    fi
  1.7849  	  else
  1.7850 -	  if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  1.7851 -	    cmds=$archive_expsym_cmds
  1.7852 -	  else
  1.7853 -	    cmds=$archive_cmds
  1.7854 +	    if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
  1.7855 +	      cmds=$archive_expsym_cmds
  1.7856 +	    else
  1.7857 +	      cmds=$archive_cmds
  1.7858  	    fi
  1.7859  	  fi
  1.7860 -
  1.7861 -	  # Append the command to remove the reloadable object files
  1.7862 -	  # to the just-reset $cmds.
  1.7863 -	  eval cmds=\"\$cmds~\$rm $delfiles\"
  1.7864 +	fi
  1.7865 +
  1.7866 +	if test -n "$delfiles"; then
  1.7867 +	  # Append the command to remove temporary files to $cmds.
  1.7868 +	  eval cmds=\"\$cmds~\$RM $delfiles\"
  1.7869  	fi
  1.7870 +
  1.7871 +	# Add any objects from preloaded convenience libraries
  1.7872 +	if test -n "$dlprefiles"; then
  1.7873 +	  gentop="$output_objdir/${outputname}x"
  1.7874 +	  generated="$generated $gentop"
  1.7875 +
  1.7876 +	  func_extract_archives $gentop $dlprefiles
  1.7877 +	  libobjs="$libobjs $func_extract_archives_result"
  1.7878 +	  test "X$libobjs" = "X " && libobjs=
  1.7879 +	fi
  1.7880 +
  1.7881  	save_ifs="$IFS"; IFS='~'
  1.7882  	for cmd in $cmds; do
  1.7883  	  IFS="$save_ifs"
  1.7884  	  eval cmd=\"$cmd\"
  1.7885 -	  $show "$cmd"
  1.7886 -	  $run eval "$cmd" || {
  1.7887 +	  $opt_silent || {
  1.7888 +	    func_quote_for_expand "$cmd"
  1.7889 +	    eval "func_echo $func_quote_for_expand_result"
  1.7890 +	  }
  1.7891 +	  $opt_dry_run || eval "$cmd" || {
  1.7892  	    lt_exit=$?
  1.7893  
  1.7894  	    # Restore the uninstalled library and exit
  1.7895  	    if test "$mode" = relink; then
  1.7896 -	      $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
  1.7897 +	      ( cd "$output_objdir" && \
  1.7898 +	        $RM "${realname}T" && \
  1.7899 +		$MV "${realname}U" "$realname" )
  1.7900  	    fi
  1.7901  
  1.7902  	    exit $lt_exit
  1.7903 @@ -4162,12 +7355,11 @@
  1.7904  
  1.7905  	# Restore the uninstalled library and exit
  1.7906  	if test "$mode" = relink; then
  1.7907 -	  $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
  1.7908 +	  $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
  1.7909  
  1.7910  	  if test -n "$convenience"; then
  1.7911  	    if test -z "$whole_archive_flag_spec"; then
  1.7912 -	      $show "${rm}r $gentop"
  1.7913 -	      $run ${rm}r "$gentop"
  1.7914 +	      func_show_eval '${RM}r "$gentop"'
  1.7915  	    fi
  1.7916  	  fi
  1.7917  
  1.7918 @@ -4177,8 +7369,7 @@
  1.7919  	# Create links to the real library.
  1.7920  	for linkname in $linknames; do
  1.7921  	  if test "$realname" != "$linkname"; then
  1.7922 -	    $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
  1.7923 -	    $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
  1.7924 +	    func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
  1.7925  	  fi
  1.7926  	done
  1.7927  
  1.7928 @@ -4191,38 +7382,35 @@
  1.7929        ;;
  1.7930  
  1.7931      obj)
  1.7932 -      if test -n "$deplibs"; then
  1.7933 -	$echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
  1.7934 -      fi
  1.7935 -
  1.7936        if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1.7937 -	$echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
  1.7938 -      fi
  1.7939 -
  1.7940 -      if test -n "$rpath"; then
  1.7941 -	$echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
  1.7942 +	func_warning "\`-dlopen' is ignored for objects"
  1.7943        fi
  1.7944  
  1.7945 -      if test -n "$xrpath"; then
  1.7946 -	$echo "$modename: warning: \`-R' is ignored for objects" 1>&2
  1.7947 -      fi
  1.7948 -
  1.7949 -      if test -n "$vinfo"; then
  1.7950 -	$echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
  1.7951 -      fi
  1.7952 -
  1.7953 -      if test -n "$release"; then
  1.7954 -	$echo "$modename: warning: \`-release' is ignored for objects" 1>&2
  1.7955 -      fi
  1.7956 +      case " $deplibs" in
  1.7957 +      *\ -l* | *\ -L*)
  1.7958 +	func_warning "\`-l' and \`-L' are ignored for objects" ;;
  1.7959 +      esac
  1.7960 +
  1.7961 +      test -n "$rpath" && \
  1.7962 +	func_warning "\`-rpath' is ignored for objects"
  1.7963 +
  1.7964 +      test -n "$xrpath" && \
  1.7965 +	func_warning "\`-R' is ignored for objects"
  1.7966 +
  1.7967 +      test -n "$vinfo" && \
  1.7968 +	func_warning "\`-version-info' is ignored for objects"
  1.7969 +
  1.7970 +      test -n "$release" && \
  1.7971 +	func_warning "\`-release' is ignored for objects"
  1.7972  
  1.7973        case $output in
  1.7974        *.lo)
  1.7975 -	if test -n "$objs$old_deplibs"; then
  1.7976 -	  $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
  1.7977 -	  exit $EXIT_FAILURE
  1.7978 -	fi
  1.7979 -	libobj="$output"
  1.7980 -	obj=`$echo "X$output" | $Xsed -e "$lo2o"`
  1.7981 +	test -n "$objs$old_deplibs" && \
  1.7982 +	  func_fatal_error "cannot build library object \`$output' from non-libtool objects"
  1.7983 +
  1.7984 +	libobj=$output
  1.7985 +	func_lo2o "$libobj"
  1.7986 +	obj=$func_lo2o_result
  1.7987  	;;
  1.7988        *)
  1.7989  	libobj=
  1.7990 @@ -4231,7 +7419,7 @@
  1.7991        esac
  1.7992  
  1.7993        # Delete the old objects.
  1.7994 -      $run $rm $obj $libobj
  1.7995 +      $opt_dry_run || $RM $obj $libobj
  1.7996  
  1.7997        # Objects from convenience libraries.  This assumes
  1.7998        # single-version convenience libraries.  Whenever we create
  1.7999 @@ -4240,12 +7428,14 @@
  1.8000        reload_conv_objs=
  1.8001        gentop=
  1.8002        # reload_cmds runs $LD directly, so let us get rid of
  1.8003 -      # -Wl from whole_archive_flag_spec
  1.8004 +      # -Wl from whole_archive_flag_spec and hope we can get by with
  1.8005 +      # turning comma into space..
  1.8006        wl=
  1.8007  
  1.8008        if test -n "$convenience"; then
  1.8009  	if test -n "$whole_archive_flag_spec"; then
  1.8010 -	  eval reload_conv_objs=\"\$reload_objs $whole_archive_flag_spec\"
  1.8011 +	  eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
  1.8012 +	  reload_conv_objs=$reload_objs\ `$ECHO "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
  1.8013  	else
  1.8014  	  gentop="$output_objdir/${obj}x"
  1.8015  	  generated="$generated $gentop"
  1.8016 @@ -4256,24 +7446,15 @@
  1.8017        fi
  1.8018  
  1.8019        # Create the old-style object.
  1.8020 -      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
  1.8021 +      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
  1.8022  
  1.8023        output="$obj"
  1.8024 -      cmds=$reload_cmds
  1.8025 -      save_ifs="$IFS"; IFS='~'
  1.8026 -      for cmd in $cmds; do
  1.8027 -	IFS="$save_ifs"
  1.8028 -	eval cmd=\"$cmd\"
  1.8029 -	$show "$cmd"
  1.8030 -	$run eval "$cmd" || exit $?
  1.8031 -      done
  1.8032 -      IFS="$save_ifs"
  1.8033 +      func_execute_cmds "$reload_cmds" 'exit $?'
  1.8034  
  1.8035        # Exit if we aren't doing a library object file.
  1.8036        if test -z "$libobj"; then
  1.8037  	if test -n "$gentop"; then
  1.8038 -	  $show "${rm}r $gentop"
  1.8039 -	  $run ${rm}r $gentop
  1.8040 +	  func_show_eval '${RM}r "$gentop"'
  1.8041  	fi
  1.8042  
  1.8043  	exit $EXIT_SUCCESS
  1.8044 @@ -4281,14 +7462,13 @@
  1.8045  
  1.8046        if test "$build_libtool_libs" != yes; then
  1.8047  	if test -n "$gentop"; then
  1.8048 -	  $show "${rm}r $gentop"
  1.8049 -	  $run ${rm}r $gentop
  1.8050 +	  func_show_eval '${RM}r "$gentop"'
  1.8051  	fi
  1.8052  
  1.8053  	# Create an invalid libtool object if no PIC, so that we don't
  1.8054  	# accidentally link it into a program.
  1.8055  	# $show "echo timestamp > $libobj"
  1.8056 -	# $run eval "echo timestamp > $libobj" || exit $?
  1.8057 +	# $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
  1.8058  	exit $EXIT_SUCCESS
  1.8059        fi
  1.8060  
  1.8061 @@ -4296,20 +7476,11 @@
  1.8062  	# Only do commands if we really have different PIC objects.
  1.8063  	reload_objs="$libobjs $reload_conv_objs"
  1.8064  	output="$libobj"
  1.8065 -	cmds=$reload_cmds
  1.8066 -	save_ifs="$IFS"; IFS='~'
  1.8067 -	for cmd in $cmds; do
  1.8068 -	  IFS="$save_ifs"
  1.8069 -	  eval cmd=\"$cmd\"
  1.8070 -	  $show "$cmd"
  1.8071 -	  $run eval "$cmd" || exit $?
  1.8072 -	done
  1.8073 -	IFS="$save_ifs"
  1.8074 +	func_execute_cmds "$reload_cmds" 'exit $?'
  1.8075        fi
  1.8076  
  1.8077        if test -n "$gentop"; then
  1.8078 -	$show "${rm}r $gentop"
  1.8079 -	$run ${rm}r $gentop
  1.8080 +	func_show_eval '${RM}r "$gentop"'
  1.8081        fi
  1.8082  
  1.8083        exit $EXIT_SUCCESS
  1.8084 @@ -4317,39 +7488,45 @@
  1.8085  
  1.8086      prog)
  1.8087        case $host in
  1.8088 -	*cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
  1.8089 +	*cygwin*) func_stripname '' '.exe' "$output"
  1.8090 +	          output=$func_stripname_result.exe;;
  1.8091        esac
  1.8092 -      if test -n "$vinfo"; then
  1.8093 -	$echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
  1.8094 -      fi
  1.8095 -
  1.8096 -      if test -n "$release"; then
  1.8097 -	$echo "$modename: warning: \`-release' is ignored for programs" 1>&2
  1.8098 -      fi
  1.8099 -
  1.8100 -      if test "$preload" = yes; then
  1.8101 -	if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
  1.8102 -	   test "$dlopen_self_static" = unknown; then
  1.8103 -	  $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
  1.8104 -	fi
  1.8105 -      fi
  1.8106 +      test -n "$vinfo" && \
  1.8107 +	func_warning "\`-version-info' is ignored for programs"
  1.8108 +
  1.8109 +      test -n "$release" && \
  1.8110 +	func_warning "\`-release' is ignored for programs"
  1.8111 +
  1.8112 +      test "$preload" = yes \
  1.8113 +        && test "$dlopen_support" = unknown \
  1.8114 +	&& test "$dlopen_self" = unknown \
  1.8115 +	&& test "$dlopen_self_static" = unknown && \
  1.8116 +	  func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
  1.8117  
  1.8118        case $host in
  1.8119        *-*-rhapsody* | *-*-darwin1.[012])
  1.8120  	# On Rhapsody replace the C library is the System framework
  1.8121 -	compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
  1.8122 -	finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
  1.8123 +	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
  1.8124 +	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's/ -lc / System.ltframework /'`
  1.8125  	;;
  1.8126        esac
  1.8127  
  1.8128        case $host in
  1.8129 -      *darwin*)
  1.8130 -        # Don't allow lazy linking, it breaks C++ global constructors
  1.8131 -        if test "$tagname" = CXX ; then
  1.8132 -        compile_command="$compile_command ${wl}-bind_at_load"
  1.8133 -        finalize_command="$finalize_command ${wl}-bind_at_load"
  1.8134 -        fi
  1.8135 -        ;;
  1.8136 +      *-*-darwin*)
  1.8137 +	# Don't allow lazy linking, it breaks C++ global constructors
  1.8138 +	# But is supposedly fixed on 10.4 or later (yay!).
  1.8139 +	if test "$tagname" = CXX ; then
  1.8140 +	  case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
  1.8141 +	    10.[0123])
  1.8142 +	      compile_command="$compile_command ${wl}-bind_at_load"
  1.8143 +	      finalize_command="$finalize_command ${wl}-bind_at_load"
  1.8144 +	    ;;
  1.8145 +	  esac
  1.8146 +	fi
  1.8147 +	# Time to change all our "foo.ltframework" stuff back to "-framework foo"
  1.8148 +	compile_deplibs=`$ECHO "X $compile_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  1.8149 +	finalize_deplibs=`$ECHO "X $finalize_deplibs" | $Xsed -e 's% \([^ $]*\).ltframework% -framework \1%g'`
  1.8150 +	;;
  1.8151        esac
  1.8152  
  1.8153  
  1.8154 @@ -4424,14 +7601,16 @@
  1.8155  	  esac
  1.8156  	fi
  1.8157  	case $host in
  1.8158 -	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
  1.8159 -	  testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
  1.8160 +	*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
  1.8161 +	  testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
  1.8162  	  case :$dllsearchpath: in
  1.8163  	  *":$libdir:"*) ;;
  1.8164 +	  ::) dllsearchpath=$libdir;;
  1.8165  	  *) dllsearchpath="$dllsearchpath:$libdir";;
  1.8166  	  esac
  1.8167  	  case :$dllsearchpath: in
  1.8168  	  *":$testbindir:"*) ;;
  1.8169 +	  ::) dllsearchpath=$testbindir;;
  1.8170  	  *) dllsearchpath="$dllsearchpath:$testbindir";;
  1.8171  	  esac
  1.8172  	  ;;
  1.8173 @@ -4483,281 +7662,51 @@
  1.8174  
  1.8175        if test -n "$libobjs" && test "$build_old_libs" = yes; then
  1.8176  	# Transform all the library objects into standard objects.
  1.8177 -	compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1.8178 -	finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1.8179 +	compile_command=`$ECHO "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1.8180 +	finalize_command=`$ECHO "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
  1.8181        fi
  1.8182  
  1.8183 -      dlsyms=
  1.8184 -      if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
  1.8185 -	if test -n "$NM" && test -n "$global_symbol_pipe"; then
  1.8186 -	  dlsyms="${outputname}S.c"
  1.8187 -	else
  1.8188 -	  $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
  1.8189 -	fi
  1.8190 +      func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
  1.8191 +
  1.8192 +      # template prelinking step
  1.8193 +      if test -n "$prelink_cmds"; then
  1.8194 +	func_execute_cmds "$prelink_cmds" 'exit $?'
  1.8195        fi
  1.8196  
  1.8197 -      if test -n "$dlsyms"; then
  1.8198 -	case $dlsyms in
  1.8199 -	"") ;;
  1.8200 -	*.c)
  1.8201 -	  # Discover the nlist of each of the dlfiles.
  1.8202 -	  nlist="$output_objdir/${outputname}.nm"
  1.8203 -
  1.8204 -	  $show "$rm $nlist ${nlist}S ${nlist}T"
  1.8205 -	  $run $rm "$nlist" "${nlist}S" "${nlist}T"
  1.8206 -
  1.8207 -	  # Parse the name list into a source file.
  1.8208 -	  $show "creating $output_objdir/$dlsyms"
  1.8209 -
  1.8210 -	  test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
  1.8211 -/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
  1.8212 -/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
  1.8213 -
  1.8214 -#ifdef __cplusplus
  1.8215 -extern \"C\" {
  1.8216 -#endif
  1.8217 -
  1.8218 -/* Prevent the only kind of declaration conflicts we can make. */
  1.8219 -#define lt_preloaded_symbols some_other_symbol
  1.8220 -
  1.8221 -/* Ex