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