Blame autoconf/ltmain.sh

Packit 679830
#! /bin/sh
Packit 679830
Packit 679830
# libtool (GNU libtool) 2.4.2.418
Packit 679830
# Provide generalized library-building support services.
Packit 679830
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
Packit 679830
Packit 679830
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
Packit 679830
# This is free software; see the source for copying conditions.  There is NO
Packit 679830
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Packit 679830
Packit 679830
# GNU Libtool is free software; you can redistribute it and/or modify
Packit 679830
# it under the terms of the GNU General Public License as published by
Packit 679830
# the Free Software Foundation; either version 2 of the License, or
Packit 679830
# (at your option) any later version.
Packit 679830
#
Packit 679830
# As a special exception to the GNU General Public License,
Packit 679830
# if you distribute this file as part of a program or library that
Packit 679830
# is built using GNU Libtool, you may include this file under the
Packit 679830
# same distribution terms that you use for the rest of that program.
Packit 679830
#
Packit 679830
# GNU Libtool is distributed in the hope that it will be useful, but
Packit 679830
# WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 679830
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 679830
# General Public License for more details.
Packit 679830
#
Packit 679830
# You should have received a copy of the GNU General Public License
Packit 679830
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 679830
Packit 679830
Packit 679830
PROGRAM=libtool
Packit 679830
PACKAGE=libtool
Packit 679830
VERSION=2.4.2.418
Packit 679830
package_revision=2.4.2.418
Packit 679830
Packit 679830
Packit 679830
## ------ ##
Packit 679830
## Usage. ##
Packit 679830
## ------ ##
Packit 679830
Packit 679830
# Run './libtool --help' for help with using this script from the
Packit 679830
# command line.
Packit 679830
Packit 679830
Packit 679830
## ------------------------------- ##
Packit 679830
## User overridable command paths. ##
Packit 679830
## ------------------------------- ##
Packit 679830
Packit 679830
# After configure completes, it has a better idea of some of the
Packit 679830
# shell tools we need than the defaults used by the functions shared
Packit 679830
# with bootstrap, so set those here where they can still be over-
Packit 679830
# ridden by the user, but otherwise take precedence.
Packit 679830
Packit 679830
: ${AUTOCONF="autoconf"}
Packit 679830
: ${AUTOMAKE="automake"}
Packit 679830
Packit 679830
Packit 679830
## -------------------------- ##
Packit 679830
## Source external libraries. ##
Packit 679830
## -------------------------- ##
Packit 679830
Packit 679830
# Much of our low-level functionality needs to be sourced from external
Packit 679830
# libraries, which are installed to $pkgauxdir.
Packit 679830
Packit 679830
# Set a version string for this script.
Packit 679830
scriptversion=2013-08-23.20; # UTC
Packit 679830
Packit 679830
# General shell script boiler plate, and helper functions.
Packit 679830
# Written by Gary V. Vaughan, 2004
Packit 679830
Packit 679830
# Copyright (C) 2004-2013 Free Software Foundation, Inc.
Packit 679830
# This is free software; see the source for copying conditions.  There is NO
Packit 679830
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Packit 679830
Packit 679830
# This program is free software; you can redistribute it and/or modify
Packit 679830
# it under the terms of the GNU General Public License as published by
Packit 679830
# the Free Software Foundation; either version 3 of the License, or
Packit 679830
# (at your option) any later version.
Packit 679830
Packit 679830
# As a special exception to the GNU General Public License, if you distribute
Packit 679830
# this file as part of a program or library that is built using GNU Libtool,
Packit 679830
# you may include this file under the same distribution terms that you use
Packit 679830
# for the rest of that program.
Packit 679830
Packit 679830
# This program is distributed in the hope that it will be useful,
Packit 679830
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 679830
# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
Packit 679830
# General Public License for more details.
Packit 679830
Packit 679830
# You should have received a copy of the GNU General Public License
Packit 679830
# along with this program. If not, see <http://www.gnu.org/licenses/>.
Packit 679830
Packit 679830
# Please report bugs or propose patches to gary@gnu.org.
Packit 679830
Packit 679830
Packit 679830
## ------ ##
Packit 679830
## Usage. ##
Packit 679830
## ------ ##
Packit 679830
Packit 679830
# Evaluate this file near the top of your script to gain access to
Packit 679830
# the functions and variables defined here:
Packit 679830
#
Packit 679830
#   . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
Packit 679830
#
Packit 679830
# If you need to override any of the default environment variable
Packit 679830
# settings, do that before evaluating this file.
Packit 679830
Packit 679830
Packit 679830
## -------------------- ##
Packit 679830
## Shell normalisation. ##
Packit 679830
## -------------------- ##
Packit 679830
Packit 679830
# Some shells need a little help to be as Bourne compatible as possible.
Packit 679830
# Before doing anything else, make sure all that help has been provided!
Packit 679830
Packit 679830
DUALCASE=1; export DUALCASE # for MKS sh
Packit 679830
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
Packit 679830
  emulate sh
Packit 679830
  NULLCMD=:
Packit 679830
  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
Packit 679830
  # is contrary to our usage.  Disable this feature.
Packit 679830
  alias -g '${1+"$@"}'='"$@"'
Packit 679830
  setopt NO_GLOB_SUBST
Packit 679830
else
Packit 679830
  case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
Packit 679830
fi
Packit 679830
Packit 679830
# NLS nuisances: We save the old values in case they are required later.
Packit 679830
_G_user_locale=
Packit 679830
_G_safe_locale=
Packit 679830
for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
Packit 679830
do
Packit 679830
  eval "if test set = \"\${$_G_var+set}\"; then
Packit 679830
          save_$_G_var=\$$_G_var
Packit 679830
          $_G_var=C
Packit 679830
	  export $_G_var
Packit 679830
	  _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
Packit 679830
	  _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
Packit 679830
	fi"
Packit 679830
done
Packit 679830
Packit 679830
# CDPATH.
Packit 679830
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
Packit 679830
Packit 679830
# Make sure IFS has a sensible default
Packit 679830
sp=' '
Packit 679830
nl='
Packit 679830
'
Packit 679830
IFS="$sp	$nl"
Packit 679830
Packit 679830
# There are still modern systems that have problems with 'echo' mis-
Packit 679830
# handling backslashes, among others, so make sure $bs_echo is set to a
Packit 679830
# command that correctly interprets backslashes.
Packit 679830
# (this code from Autoconf 2.68)
Packit 679830
Packit 679830
# Printing a long string crashes Solaris 7 /usr/bin/printf.
Packit 679830
bs_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
Packit 679830
bs_echo=$bs_echo$bs_echo$bs_echo$bs_echo$bs_echo
Packit 679830
bs_echo=$bs_echo$bs_echo$bs_echo$bs_echo$bs_echo$bs_echo
Packit 679830
# Prefer a ksh shell builtin over an external printf program on Solaris,
Packit 679830
# but without wasting forks for bash or zsh.
Packit 679830
if test -z "$BASH_VERSION$ZSH_VERSION" \
Packit 679830
    && (test "X`print -r -- $bs_echo`" = "X$bs_echo") 2>/dev/null; then
Packit 679830
  bs_echo='print -r --'
Packit 679830
  bs_echo_n='print -rn --'
Packit 679830
elif (test "X`printf %s $bs_echo`" = "X$bs_echo") 2>/dev/null; then
Packit 679830
  bs_echo='printf %s\n'
Packit 679830
  bs_echo_n='printf %s'
Packit 679830
else
Packit 679830
  if test "X`(/usr/ucb/echo -n -n $bs_echo) 2>/dev/null`" = "X-n $bs_echo"; then
Packit 679830
    bs_echo_body='eval /usr/ucb/echo -n "$1$nl"'
Packit 679830
    bs_echo_n='/usr/ucb/echo -n'
Packit 679830
  else
Packit 679830
    bs_echo_body='eval expr "X$1" : "X\\(.*\\)"'
Packit 679830
    bs_echo_n_body='eval
Packit 679830
      arg=$1;
Packit 679830
      case $arg in #(
Packit 679830
      *"$nl"*)
Packit 679830
	expr "X$arg" : "X\\(.*\\)$nl";
Packit 679830
	arg=`expr "X$arg" : ".*$nl\\(.*\\)"`;;
Packit 679830
      esac;
Packit 679830
      expr "X$arg" : "X\\(.*\\)" | tr -d "$nl"
Packit 679830
    '
Packit 679830
    export bs_echo_n_body
Packit 679830
    bs_echo_n='sh -c $bs_echo_n_body bs_echo'
Packit 679830
  fi
Packit 679830
  export bs_echo_body
Packit 679830
  bs_echo='sh -c $bs_echo_body bs_echo'
Packit 679830
fi
Packit 679830
Packit 679830
Packit 679830
## ------------------------------- ##
Packit 679830
## User overridable command paths. ##
Packit 679830
## ------------------------------- ##
Packit 679830
Packit 679830
# All uppercase variable names are used for environment variables.  These
Packit 679830
# variables can be overridden by the user before calling a script that
Packit 679830
# uses them if a suitable command of that name is not already available
Packit 679830
# in the command search PATH.
Packit 679830
Packit 679830
: ${CP="cp -f"}
Packit 679830
: ${ECHO="$bs_echo"}
Packit 679830
: ${EGREP="grep -E"}
Packit 679830
: ${FGREP="grep -F"}
Packit 679830
: ${GREP="grep"}
Packit 679830
: ${LN_S="ln -s"}
Packit 679830
: ${MAKE="make"}
Packit 679830
: ${MKDIR="mkdir"}
Packit 679830
: ${MV="mv -f"}
Packit 679830
: ${RM="rm -f"}
Packit 679830
: ${SED="sed"}
Packit 679830
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
Packit 679830
Packit 679830
Packit 679830
## -------------------- ##
Packit 679830
## Useful sed snippets. ##
Packit 679830
## -------------------- ##
Packit 679830
Packit 679830
sed_dirname='s|/[^/]*$||'
Packit 679830
sed_basename='s|^.*/||'
Packit 679830
Packit 679830
# Sed substitution that helps us do robust quoting.  It backslashifies
Packit 679830
# metacharacters that are still active within double-quoted strings.
Packit 679830
sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
Packit 679830
Packit 679830
# Same as above, but do not quote variable references.
Packit 679830
sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
Packit 679830
Packit 679830
# Sed substitution that turns a string into a regex matching for the
Packit 679830
# string literally.
Packit 679830
sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
Packit 679830
Packit 679830
# Sed substitution that converts a w32 file name or path
Packit 679830
# that contains forward slashes, into one that contains
Packit 679830
# (escaped) backslashes.  A very naive implementation.
Packit 679830
sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
Packit 679830
Packit 679830
# Re-'\' parameter expansions in output of sed_double_quote_subst that
Packit 679830
# were '\'-ed in input to the same.  If an odd number of '\' preceded a
Packit 679830
# '$' in input to sed_double_quote_subst, that '$' was protected from
Packit 679830
# expansion.  Since each input '\' is now two '\'s, look for any number
Packit 679830
# of runs of four '\'s followed by two '\'s and then a '$'.  '\' that '$'.
Packit 679830
_G_bs='\\'
Packit 679830
_G_bs2='\\\\'
Packit 679830
_G_bs4='\\\\\\\\'
Packit 679830
_G_dollar='\$'
Packit 679830
sed_double_backslash="\
Packit 679830
  s/$_G_bs4/&\\
Packit 679830
/g
Packit 679830
  s/^$_G_bs2$_G_dollar/$_G_bs&/
Packit 679830
  s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
Packit 679830
  s/\n//g"
Packit 679830
Packit 679830
Packit 679830
## ----------------- ##
Packit 679830
## Global variables. ##
Packit 679830
## ----------------- ##
Packit 679830
Packit 679830
# Except for the global variables explicitly listed below, the following
Packit 679830
# functions in the '^func_' namespace, and the '^require_' namespace
Packit 679830
# variables initialised in the 'Resource management' section, sourcing
Packit 679830
# this file will not pollute your global namespace with anything
Packit 679830
# else. There's no portable way to scope variables in Bourne shell
Packit 679830
# though, so actually running these functions will sometimes place
Packit 679830
# results into a variable named after the function, and often use
Packit 679830
# temporary variables in the '^_G_' namespace. If you are careful to
Packit 679830
# avoid using those namespaces casually in your sourcing script, things
Packit 679830
# should continue to work as you expect. And, of course, you can freely
Packit 679830
# overwrite any of the functions or variables defined here before
Packit 679830
# calling anything to customize them.
Packit 679830
Packit 679830
EXIT_SUCCESS=0
Packit 679830
EXIT_FAILURE=1
Packit 679830
EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
Packit 679830
EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
Packit 679830
Packit 679830
# Allow overriding, eg assuming that you follow the convention of
Packit 679830
# putting '$debug_cmd' at the start of all your functions, you can get
Packit 679830
# bash to show function call trace with:
Packit 679830
#
Packit 679830
#    debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
Packit 679830
debug_cmd=${debug_cmd-":"}
Packit 679830
exit_cmd=:
Packit 679830
Packit 679830
# By convention, finish your script with:
Packit 679830
#
Packit 679830
#    exit $exit_status
Packit 679830
#
Packit 679830
# so that you can set exit_status to non-zero if you want to indicate
Packit 679830
# something went wrong during execution without actually bailing out at
Packit 679830
# the point of failure.
Packit 679830
exit_status=$EXIT_SUCCESS
Packit 679830
Packit 679830
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
Packit 679830
# is ksh but when the shell is invoked as "sh" and the current value of
Packit 679830
# the _XPG environment variable is not equal to 1 (one), the special
Packit 679830
# positional parameter $0, within a function call, is the name of the
Packit 679830
# function.
Packit 679830
progpath=$0
Packit 679830
Packit 679830
# The name of this program.
Packit 679830
progname=`$bs_echo "$progpath" |$SED "$sed_basename"`
Packit 679830
Packit 679830
# Make sure we have an absolute progpath for reexecution:
Packit 679830
case $progpath in
Packit 679830
  [\\/]*|[A-Za-z]:\\*) ;;
Packit 679830
  *[\\/]*)
Packit 679830
     progdir=`$bs_echo "$progpath" |$SED "$sed_dirname"`
Packit 679830
     progdir=`cd "$progdir" && pwd`
Packit 679830
     progpath=$progdir/$progname
Packit 679830
     ;;
Packit 679830
  *)
Packit 679830
     _G_IFS=$IFS
Packit 679830
     IFS=${PATH_SEPARATOR-:}
Packit 679830
     for progdir in $PATH; do
Packit 679830
       IFS=$_G_IFS
Packit 679830
       test -x "$progdir/$progname" && break
Packit 679830
     done
Packit 679830
     IFS=$_G_IFS
Packit 679830
     test -n "$progdir" || progdir=`pwd`
Packit 679830
     progpath=$progdir/$progname
Packit 679830
     ;;
Packit 679830
esac
Packit 679830
Packit 679830
Packit 679830
## ----------------- ##
Packit 679830
## Standard options. ##
Packit 679830
## ----------------- ##
Packit 679830
Packit 679830
# The following options affect the operation of the functions defined
Packit 679830
# below, and should be set appropriately depending on run-time para-
Packit 679830
# meters passed on the command line.
Packit 679830
Packit 679830
opt_dry_run=false
Packit 679830
opt_quiet=false
Packit 679830
opt_verbose=false
Packit 679830
Packit 679830
# Categories 'all' and 'none' are always available.  Append any others
Packit 679830
# you will pass as the first argument to func_warning from your own
Packit 679830
# code.
Packit 679830
warning_categories=
Packit 679830
Packit 679830
# By default, display warnings according to 'opt_warning_types'.  Set
Packit 679830
# 'warning_func'  to ':' to elide all warnings, or func_fatal_error to
Packit 679830
# treat the next displayed warning as a fatal error.
Packit 679830
warning_func=func_warn_and_continue
Packit 679830
Packit 679830
# Set to 'all' to display all warnings, 'none' to suppress all
Packit 679830
# warnings, or a space delimited list of some subset of
Packit 679830
# 'warning_categories' to display only the listed warnings.
Packit 679830
opt_warning_types=all
Packit 679830
Packit 679830
Packit 679830
## -------------------- ##
Packit 679830
## Resource management. ##
Packit 679830
## -------------------- ##
Packit 679830
Packit 679830
# This section contains definitions for functions that each ensure a
Packit 679830
# particular resource (a file, or a non-empty configuration variable for
Packit 679830
# example) is available, and if appropriate to extract default values
Packit 679830
# from pertinent package files. Call them using their associated
Packit 679830
# 'require_*' variable to ensure that they are executed, at most, once.
Packit 679830
#
Packit 679830
# It's entirely deliberate that calling these functions can set
Packit 679830
# variables that don't obey the namespace limitations obeyed by the rest
Packit 679830
# of this file, in order that that they be as useful as possible to
Packit 679830
# callers.
Packit 679830
Packit 679830
Packit 679830
# require_term_colors
Packit 679830
# -------------------
Packit 679830
# Allow display of bold text on terminals that support it.
Packit 679830
require_term_colors=func_require_term_colors
Packit 679830
func_require_term_colors ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    test -t 1 && {
Packit 679830
      # COLORTERM and USE_ANSI_COLORS environment variables take
Packit 679830
      # precedence, because most terminfo databases neglect to describe
Packit 679830
      # whether color sequences are supported.
Packit 679830
      test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
Packit 679830
Packit 679830
      if test 1 = "$USE_ANSI_COLORS"; then
Packit 679830
        # Standard ANSI escape sequences
Packit 679830
        tc_reset='?[0m'
Packit 679830
        tc_bold='?[1m';   tc_standout='?[7m'
Packit 679830
        tc_red='?[31m';   tc_green='?[32m'
Packit 679830
        tc_blue='?[34m';  tc_cyan='?[36m'
Packit 679830
      else
Packit 679830
        # Otherwise trust the terminfo database after all.
Packit 679830
        test -n "`tput sgr0 2>/dev/null`" && {
Packit 679830
          tc_reset=`tput sgr0`
Packit 679830
          test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
Packit 679830
          tc_standout=$tc_bold
Packit 679830
          test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
Packit 679830
          test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
Packit 679830
          test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
Packit 679830
          test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
Packit 679830
          test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
Packit 679830
        }
Packit 679830
      fi
Packit 679830
    }
Packit 679830
Packit 679830
    require_term_colors=:
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
## ----------------- ##
Packit 679830
## Function library. ##
Packit 679830
## ----------------- ##
Packit 679830
Packit 679830
# This section contains a variety of useful functions to call in your
Packit 679830
# scripts. Take note of the portable wrappers for features provided by
Packit 679830
# some modern shells, which will fall back to slower equivalents on
Packit 679830
# less featureful shells.
Packit 679830
Packit 679830
Packit 679830
# func_append VAR VALUE
Packit 679830
# ---------------------
Packit 679830
# Append VALUE onto the existing contents of VAR.
Packit 679830
Packit 679830
  # We should try to minimise forks, especially on Windows where they are
Packit 679830
  # unreasonably slow, so skip the feature probes when bash or zsh are
Packit 679830
  # being used:
Packit 679830
  if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
Packit 679830
    : ${_G_HAVE_ARITH_OP="yes"}
Packit 679830
    : ${_G_HAVE_XSI_OPS="yes"}
Packit 679830
    # The += operator was introduced in bash 3.1
Packit 679830
    case $BASH_VERSION in
Packit 679830
      [12].* | 3.0 | 3.0*) ;;
Packit 679830
      *)
Packit 679830
        : ${_G_HAVE_PLUSEQ_OP="yes"}
Packit 679830
        ;;
Packit 679830
    esac
Packit 679830
  fi
Packit 679830
Packit 679830
  # _G_HAVE_PLUSEQ_OP
Packit 679830
  # Can be empty, in which case the shell is probed, "yes" if += is
Packit 679830
  # useable or anything else if it does not work.
Packit 679830
  test -z "$_G_HAVE_PLUSEQ_OP" \
Packit 679830
    && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
Packit 679830
    && _G_HAVE_PLUSEQ_OP=yes
Packit 679830
Packit 679830
if test yes = "$_G_HAVE_PLUSEQ_OP"
Packit 679830
then
Packit 679830
  # This is an XSI compatible shell, allowing a faster implementation...
Packit 679830
  eval 'func_append ()
Packit 679830
  {
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    eval "$1+=\$2"
Packit 679830
  }'
Packit 679830
else
Packit 679830
  # ...otherwise fall back to using expr, which is often a shell builtin.
Packit 679830
  func_append ()
Packit 679830
  {
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    eval "$1=\$$1\$2"
Packit 679830
  }
Packit 679830
fi
Packit 679830
Packit 679830
Packit 679830
# func_append_quoted VAR VALUE
Packit 679830
# ----------------------------
Packit 679830
# Quote VALUE and append to the end of shell variable VAR, separated
Packit 679830
# by a space.
Packit 679830
if test yes = "$_G_HAVE_PLUSEQ_OP"; then
Packit 679830
  eval 'func_append_quoted ()
Packit 679830
  {
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    func_quote_for_eval "$2"
Packit 679830
    eval "$1+=\\ \$func_quote_for_eval_result"
Packit 679830
  }'
Packit 679830
else
Packit 679830
  func_append_quoted ()
Packit 679830
  {
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    func_quote_for_eval "$2"
Packit 679830
    eval "$1=\$$1\\ \$func_quote_for_eval_result"
Packit 679830
  }
Packit 679830
fi
Packit 679830
Packit 679830
Packit 679830
# func_append_uniq VAR VALUE
Packit 679830
# --------------------------
Packit 679830
# Append unique VALUE onto the existing contents of VAR, assuming
Packit 679830
# entries are delimited by the first character of VALUE.  For example:
Packit 679830
#
Packit 679830
#   func_append_uniq options " --another-option option-argument"
Packit 679830
#
Packit 679830
# will only append to $options if " --another-option option-argument "
Packit 679830
# is not already present somewhere in $options already (note spaces at
Packit 679830
# each end implied by leading space in second argument).
Packit 679830
func_append_uniq ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    eval _G_current_value='`$bs_echo $'$1'`'
Packit 679830
    _G_delim=`expr "$2" : '\(.\)'`
Packit 679830
Packit 679830
    case $_G_delim$_G_current_value$_G_delim in
Packit 679830
      *"$2$_G_delim"*) ;;
Packit 679830
      *) func_append "$@" ;;
Packit 679830
    esac
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_arith TERM...
Packit 679830
# ------------------
Packit 679830
# Set func_arith_result to the result of evaluating TERMs.
Packit 679830
  test -z "$_G_HAVE_ARITH_OP" \
Packit 679830
    && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
Packit 679830
    && _G_HAVE_ARITH_OP=yes
Packit 679830
Packit 679830
if test yes = "$_G_HAVE_ARITH_OP"; then
Packit 679830
  eval 'func_arith ()
Packit 679830
  {
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    func_arith_result=$(( $* ))
Packit 679830
  }'
Packit 679830
else
Packit 679830
  func_arith ()
Packit 679830
  {
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    func_arith_result=`expr "$@"`
Packit 679830
  }
Packit 679830
fi
Packit 679830
Packit 679830
Packit 679830
# func_basename FILE
Packit 679830
# ------------------
Packit 679830
# Set func_basename_result to FILE with everything up to and including
Packit 679830
# the last / stripped.
Packit 679830
if test yes = "$_G_HAVE_XSI_OPS"; then
Packit 679830
  # If this shell supports suffix pattern removal, then use it to avoid
Packit 679830
  # forking. Hide the definitions single quotes in case the shell chokes
Packit 679830
  # on unsupported syntax...
Packit 679830
  _b='func_basename_result=${1##*/}'
Packit 679830
  _d='case $1 in
Packit 679830
        */*) func_dirname_result=${1%/*}$2 ;;
Packit 679830
        *  ) func_dirname_result=$3        ;;
Packit 679830
      esac'
Packit 679830
Packit 679830
else
Packit 679830
  # ...otherwise fall back to using sed.
Packit 679830
  _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
Packit 679830
  _d='func_dirname_result=`$ECHO "$1"  |$SED "$sed_dirname"`
Packit 679830
      if test "X$func_dirname_result" = "X$1"; then
Packit 679830
        func_dirname_result=$3
Packit 679830
      else
Packit 679830
        func_append func_dirname_result "$2"
Packit 679830
      fi'
Packit 679830
fi
Packit 679830
Packit 679830
eval 'func_basename ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    '"$_b"'
Packit 679830
}'
Packit 679830
Packit 679830
Packit 679830
# func_dirname FILE APPEND NONDIR_REPLACEMENT
Packit 679830
# -------------------------------------------
Packit 679830
# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
Packit 679830
# otherwise set result to NONDIR_REPLACEMENT.
Packit 679830
eval 'func_dirname ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    '"$_d"'
Packit 679830
}'
Packit 679830
Packit 679830
Packit 679830
# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
Packit 679830
# --------------------------------------------------------
Packit 679830
# Perform func_basename and func_dirname in a single function
Packit 679830
# call:
Packit 679830
#   dirname:  Compute the dirname of FILE.  If nonempty,
Packit 679830
#             add APPEND to the result, otherwise set result
Packit 679830
#             to NONDIR_REPLACEMENT.
Packit 679830
#             value returned in "$func_dirname_result"
Packit 679830
#   basename: Compute filename of FILE.
Packit 679830
#             value retuned in "$func_basename_result"
Packit 679830
# For efficiency, we do not delegate to the functions above but instead
Packit 679830
# duplicate the functionality here.
Packit 679830
eval 'func_dirname_and_basename ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    '"$_b"'
Packit 679830
    '"$_d"'
Packit 679830
}'
Packit 679830
Packit 679830
Packit 679830
# func_echo ARG...
Packit 679830
# ----------------
Packit 679830
# Echo program name prefixed message.
Packit 679830
func_echo ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    _G_message=$*
Packit 679830
Packit 679830
    func_echo_IFS=$IFS
Packit 679830
    IFS=$nl
Packit 679830
    for _G_line in $_G_message; do
Packit 679830
      IFS=$func_echo_IFS
Packit 679830
      $bs_echo "$progname: $_G_line"
Packit 679830
    done
Packit 679830
    IFS=$func_echo_IFS
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_echo_all ARG...
Packit 679830
# --------------------
Packit 679830
# Invoke $ECHO with all args, space-separated.
Packit 679830
func_echo_all ()
Packit 679830
{
Packit 679830
    $ECHO "$*"
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_echo_infix_1 INFIX ARG...
Packit 679830
# ------------------------------
Packit 679830
# Echo program name, followed by INFIX on the first line, with any
Packit 679830
# additional lines not showing INFIX.
Packit 679830
func_echo_infix_1 ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    $require_term_colors
Packit 679830
Packit 679830
    _G_infix=$1; shift
Packit 679830
    _G_indent=$_G_infix
Packit 679830
    _G_prefix="$progname: $_G_infix: "
Packit 679830
    _G_message=$*
Packit 679830
Packit 679830
    # Strip color escape sequences before counting printable length
Packit 679830
    for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
Packit 679830
    do
Packit 679830
      test -n "$_G_tc" && {
Packit 679830
        _G_esc_tc=`$bs_echo "$_G_tc" | sed "$sed_make_literal_regex"`
Packit 679830
        _G_indent=`$bs_echo "$_G_indent" | sed "s|$_G_esc_tc||g"`
Packit 679830
      }
Packit 679830
    done
Packit 679830
    _G_indent="$progname: "`echo "$_G_indent" | sed 's|.| |g'`"  " ## exclude from sc_prohibit_nested_quotes
Packit 679830
Packit 679830
    func_echo_infix_1_IFS=$IFS
Packit 679830
    IFS=$nl
Packit 679830
    for _G_line in $_G_message; do
Packit 679830
      IFS=$func_echo_infix_1_IFS
Packit 679830
      $bs_echo "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
Packit 679830
      _G_prefix=$_G_indent
Packit 679830
    done
Packit 679830
    IFS=$func_echo_infix_1_IFS
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_error ARG...
Packit 679830
# -----------------
Packit 679830
# Echo program name prefixed message to standard error.
Packit 679830
func_error ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    $require_term_colors
Packit 679830
Packit 679830
    func_echo_infix_1 "  $tc_standout${tc_red}error$tc_reset" "$*" >&2
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_fatal_error ARG...
Packit 679830
# -----------------------
Packit 679830
# Echo program name prefixed message to standard error, and exit.
Packit 679830
func_fatal_error ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    func_error "$*"
Packit 679830
    exit $EXIT_FAILURE
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_grep EXPRESSION FILENAME
Packit 679830
# -----------------------------
Packit 679830
# Check whether EXPRESSION matches any line of FILENAME, without output.
Packit 679830
func_grep ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    $GREP "$1" "$2" >/dev/null 2>&1
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_len STRING
Packit 679830
# ---------------
Packit 679830
# Set func_len_result to the length of STRING. STRING may not
Packit 679830
# start with a hyphen.
Packit 679830
  test -z "$_G_HAVE_XSI_OPS" \
Packit 679830
    && (eval 'x=a/b/c;
Packit 679830
      test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
Packit 679830
    && _G_HAVE_XSI_OPS=yes
Packit 679830
Packit 679830
if test yes = "$_G_HAVE_XSI_OPS"; then
Packit 679830
  eval 'func_len ()
Packit 679830
  {
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    func_len_result=${#1}
Packit 679830
  }'
Packit 679830
else
Packit 679830
  func_len ()
Packit 679830
  {
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
Packit 679830
  }
Packit 679830
fi
Packit 679830
Packit 679830
Packit 679830
# func_mkdir_p DIRECTORY-PATH
Packit 679830
# ---------------------------
Packit 679830
# Make sure the entire path to DIRECTORY-PATH is available.
Packit 679830
func_mkdir_p ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    _G_directory_path=$1
Packit 679830
    _G_dir_list=
Packit 679830
Packit 679830
    if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
Packit 679830
Packit 679830
      # Protect directory names starting with '-'
Packit 679830
      case $_G_directory_path in
Packit 679830
        -*) _G_directory_path=./$_G_directory_path ;;
Packit 679830
      esac
Packit 679830
Packit 679830
      # While some portion of DIR does not yet exist...
Packit 679830
      while test ! -d "$_G_directory_path"; do
Packit 679830
        # ...make a list in topmost first order.  Use a colon delimited
Packit 679830
	# list incase some portion of path contains whitespace.
Packit 679830
        _G_dir_list=$_G_directory_path:$_G_dir_list
Packit 679830
Packit 679830
        # If the last portion added has no slash in it, the list is done
Packit 679830
        case $_G_directory_path in */*) ;; *) break ;; esac
Packit 679830
Packit 679830
        # ...otherwise throw away the child directory and loop
Packit 679830
        _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
Packit 679830
      done
Packit 679830
      _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
Packit 679830
Packit 679830
      func_mkdir_p_IFS=$IFS; IFS=:
Packit 679830
      for _G_dir in $_G_dir_list; do
Packit 679830
	IFS=$func_mkdir_p_IFS
Packit 679830
        # mkdir can fail with a 'File exist' error if two processes
Packit 679830
        # try to create one of the directories concurrently.  Don't
Packit 679830
        # stop in that case!
Packit 679830
        $MKDIR "$_G_dir" 2>/dev/null || :
Packit 679830
      done
Packit 679830
      IFS=$func_mkdir_p_IFS
Packit 679830
Packit 679830
      # Bail out if we (or some other process) failed to create a directory.
Packit 679830
      test -d "$_G_directory_path" || \
Packit 679830
        func_fatal_error "Failed to create '$1'"
Packit 679830
    fi
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_mktempdir [BASENAME]
Packit 679830
# -------------------------
Packit 679830
# Make a temporary directory that won't clash with other running
Packit 679830
# libtool processes, and avoids race conditions if possible.  If
Packit 679830
# given, BASENAME is the basename for that directory.
Packit 679830
func_mktempdir ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    _G_template=${TMPDIR-/tmp}/${1-$progname}
Packit 679830
Packit 679830
    if test : = "$opt_dry_run"; then
Packit 679830
      # Return a directory name, but don't create it in dry-run mode
Packit 679830
      _G_tmpdir=$_G_template-$$
Packit 679830
    else
Packit 679830
Packit 679830
      # If mktemp works, use that first and foremost
Packit 679830
      _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
Packit 679830
Packit 679830
      if test ! -d "$_G_tmpdir"; then
Packit 679830
        # Failing that, at least try and use $RANDOM to avoid a race
Packit 679830
        _G_tmpdir=$_G_template-${RANDOM-0}$$
Packit 679830
Packit 679830
        func_mktempdir_umask=`umask`
Packit 679830
        umask 0077
Packit 679830
        $MKDIR "$_G_tmpdir"
Packit 679830
        umask $func_mktempdir_umask
Packit 679830
      fi
Packit 679830
Packit 679830
      # If we're not in dry-run mode, bomb out on failure
Packit 679830
      test -d "$_G_tmpdir" || \
Packit 679830
        func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
Packit 679830
    fi
Packit 679830
Packit 679830
    $ECHO "$_G_tmpdir"
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_normal_abspath PATH
Packit 679830
# ------------------------
Packit 679830
# Remove doubled-up and trailing slashes, "." path components,
Packit 679830
# and cancel out any ".." path components in PATH after making
Packit 679830
# it an absolute path.
Packit 679830
func_normal_abspath ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    # These SED scripts presuppose an absolute path with a trailing slash.
Packit 679830
    _G_pathcar='s|^/\([^/]*\).*$|\1|'
Packit 679830
    _G_pathcdr='s|^/[^/]*||'
Packit 679830
    _G_removedotparts=':dotsl
Packit 679830
		s|/\./|/|g
Packit 679830
		t dotsl
Packit 679830
		s|/\.$|/|'
Packit 679830
    _G_collapseslashes='s|/\{1,\}|/|g'
Packit 679830
    _G_finalslash='s|/*$|/|'
Packit 679830
Packit 679830
    # Start from root dir and reassemble the path.
Packit 679830
    func_normal_abspath_result=
Packit 679830
    func_normal_abspath_tpath=$1
Packit 679830
    func_normal_abspath_altnamespace=
Packit 679830
    case $func_normal_abspath_tpath in
Packit 679830
      "")
Packit 679830
        # Empty path, that just means $cwd.
Packit 679830
        func_stripname '' '/' "`pwd`"
Packit 679830
        func_normal_abspath_result=$func_stripname_result
Packit 679830
        return
Packit 679830
        ;;
Packit 679830
      # The next three entries are used to spot a run of precisely
Packit 679830
      # two leading slashes without using negated character classes;
Packit 679830
      # we take advantage of case's first-match behaviour.
Packit 679830
      ///*)
Packit 679830
        # Unusual form of absolute path, do nothing.
Packit 679830
        ;;
Packit 679830
      //*)
Packit 679830
        # Not necessarily an ordinary path; POSIX reserves leading '//'
Packit 679830
        # and for example Cygwin uses it to access remote file shares
Packit 679830
        # over CIFS/SMB, so we conserve a leading double slash if found.
Packit 679830
        func_normal_abspath_altnamespace=/
Packit 679830
        ;;
Packit 679830
      /*)
Packit 679830
        # Absolute path, do nothing.
Packit 679830
        ;;
Packit 679830
      *)
Packit 679830
        # Relative path, prepend $cwd.
Packit 679830
        func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
Packit 679830
        ;;
Packit 679830
    esac
Packit 679830
Packit 679830
    # Cancel out all the simple stuff to save iterations.  We also want
Packit 679830
    # the path to end with a slash for ease of parsing, so make sure
Packit 679830
    # there is one (and only one) here.
Packit 679830
    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
Packit 679830
          -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
Packit 679830
    while :; do
Packit 679830
      # Processed it all yet?
Packit 679830
      if test / = "$func_normal_abspath_tpath"; then
Packit 679830
        # If we ascended to the root using ".." the result may be empty now.
Packit 679830
        if test -z "$func_normal_abspath_result"; then
Packit 679830
          func_normal_abspath_result=/
Packit 679830
        fi
Packit 679830
        break
Packit 679830
      fi
Packit 679830
      func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
Packit 679830
          -e "$_G_pathcar"`
Packit 679830
      func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
Packit 679830
          -e "$_G_pathcdr"`
Packit 679830
      # Figure out what to do with it
Packit 679830
      case $func_normal_abspath_tcomponent in
Packit 679830
        "")
Packit 679830
          # Trailing empty path component, ignore it.
Packit 679830
          ;;
Packit 679830
        ..)
Packit 679830
          # Parent dir; strip last assembled component from result.
Packit 679830
          func_dirname "$func_normal_abspath_result"
Packit 679830
          func_normal_abspath_result=$func_dirname_result
Packit 679830
          ;;
Packit 679830
        *)
Packit 679830
          # Actual path component, append it.
Packit 679830
          func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
Packit 679830
          ;;
Packit 679830
      esac
Packit 679830
    done
Packit 679830
    # Restore leading double-slash if one was found on entry.
Packit 679830
    func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_notquiet ARG...
Packit 679830
# --------------------
Packit 679830
# Echo program name prefixed message only when not in quiet mode.
Packit 679830
func_notquiet ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    $opt_quiet || func_echo ${1+"$@"}
Packit 679830
Packit 679830
    # A bug in bash halts the script if the last line of a function
Packit 679830
    # fails when set -e is in force, so we need another command to
Packit 679830
    # work around that:
Packit 679830
    :
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_relative_path SRCDIR DSTDIR
Packit 679830
# --------------------------------
Packit 679830
# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
Packit 679830
func_relative_path ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    func_relative_path_result=
Packit 679830
    func_normal_abspath "$1"
Packit 679830
    func_relative_path_tlibdir=$func_normal_abspath_result
Packit 679830
    func_normal_abspath "$2"
Packit 679830
    func_relative_path_tbindir=$func_normal_abspath_result
Packit 679830
Packit 679830
    # Ascend the tree starting from libdir
Packit 679830
    while :; do
Packit 679830
      # check if we have found a prefix of bindir
Packit 679830
      case $func_relative_path_tbindir in
Packit 679830
        $func_relative_path_tlibdir)
Packit 679830
          # found an exact match
Packit 679830
          func_relative_path_tcancelled=
Packit 679830
          break
Packit 679830
          ;;
Packit 679830
        $func_relative_path_tlibdir*)
Packit 679830
          # found a matching prefix
Packit 679830
          func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
Packit 679830
          func_relative_path_tcancelled=$func_stripname_result
Packit 679830
          if test -z "$func_relative_path_result"; then
Packit 679830
            func_relative_path_result=.
Packit 679830
          fi
Packit 679830
          break
Packit 679830
          ;;
Packit 679830
        *)
Packit 679830
          func_dirname $func_relative_path_tlibdir
Packit 679830
          func_relative_path_tlibdir=$func_dirname_result
Packit 679830
          if test -z "$func_relative_path_tlibdir"; then
Packit 679830
            # Have to descend all the way to the root!
Packit 679830
            func_relative_path_result=../$func_relative_path_result
Packit 679830
            func_relative_path_tcancelled=$func_relative_path_tbindir
Packit 679830
            break
Packit 679830
          fi
Packit 679830
          func_relative_path_result=../$func_relative_path_result
Packit 679830
          ;;
Packit 679830
      esac
Packit 679830
    done
Packit 679830
Packit 679830
    # Now calculate path; take care to avoid doubling-up slashes.
Packit 679830
    func_stripname '' '/' "$func_relative_path_result"
Packit 679830
    func_relative_path_result=$func_stripname_result
Packit 679830
    func_stripname '/' '/' "$func_relative_path_tcancelled"
Packit 679830
    if test -n "$func_stripname_result"; then
Packit 679830
      func_append func_relative_path_result "/$func_stripname_result"
Packit 679830
    fi
Packit 679830
Packit 679830
    # Normalisation. If bindir is libdir, return '.' else relative path.
Packit 679830
    if test -n "$func_relative_path_result"; then
Packit 679830
      func_stripname './' '' "$func_relative_path_result"
Packit 679830
      func_relative_path_result=$func_stripname_result
Packit 679830
    fi
Packit 679830
Packit 679830
    test -n "$func_relative_path_result" || func_relative_path_result=.
Packit 679830
Packit 679830
    :
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_quote_for_eval ARG...
Packit 679830
# --------------------------
Packit 679830
# Aesthetically quote ARGs to be evaled later.
Packit 679830
# This function returns two values:
Packit 679830
#   i) func_quote_for_eval_result
Packit 679830
#      double-quoted, suitable for a subsequent eval
Packit 679830
#  ii) func_quote_for_eval_unquoted_result
Packit 679830
#      has all characters that are still active within double
Packit 679830
#      quotes backslashified.
Packit 679830
func_quote_for_eval ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    func_quote_for_eval_unquoted_result=
Packit 679830
    func_quote_for_eval_result=
Packit 679830
    while test 0 -lt $#; do
Packit 679830
      case $1 in
Packit 679830
        *[\\\`\"\$]*)
Packit 679830
	  _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
Packit 679830
        *)
Packit 679830
          _G_unquoted_arg=$1 ;;
Packit 679830
      esac
Packit 679830
      if test -n "$func_quote_for_eval_unquoted_result"; then
Packit 679830
	func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
Packit 679830
      else
Packit 679830
        func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
Packit 679830
      fi
Packit 679830
Packit 679830
      case $_G_unquoted_arg in
Packit 679830
        # Double-quote args containing shell metacharacters to delay
Packit 679830
        # word splitting, command substitution and variable expansion
Packit 679830
        # for a subsequent eval.
Packit 679830
        # Many Bourne shells cannot handle close brackets correctly
Packit 679830
        # in scan sets, so we specify it separately.
Packit 679830
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
Packit 679830
          _G_quoted_arg=\"$_G_unquoted_arg\"
Packit 679830
          ;;
Packit 679830
        *)
Packit 679830
          _G_quoted_arg=$_G_unquoted_arg
Packit 679830
	  ;;
Packit 679830
      esac
Packit 679830
Packit 679830
      if test -n "$func_quote_for_eval_result"; then
Packit 679830
	func_append func_quote_for_eval_result " $_G_quoted_arg"
Packit 679830
      else
Packit 679830
        func_append func_quote_for_eval_result "$_G_quoted_arg"
Packit 679830
      fi
Packit 679830
      shift
Packit 679830
    done
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_quote_for_expand ARG
Packit 679830
# -------------------------
Packit 679830
# Aesthetically quote ARG to be evaled later; same as above,
Packit 679830
# but do not quote variable references.
Packit 679830
func_quote_for_expand ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    case $1 in
Packit 679830
      *[\\\`\"]*)
Packit 679830
	_G_arg=`$ECHO "$1" | $SED \
Packit 679830
	    -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
Packit 679830
      *)
Packit 679830
        _G_arg=$1 ;;
Packit 679830
    esac
Packit 679830
Packit 679830
    case $_G_arg in
Packit 679830
      # Double-quote args containing shell metacharacters to delay
Packit 679830
      # word splitting and command substitution for a subsequent eval.
Packit 679830
      # Many Bourne shells cannot handle close brackets correctly
Packit 679830
      # in scan sets, so we specify it separately.
Packit 679830
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
Packit 679830
        _G_arg=\"$_G_arg\"
Packit 679830
        ;;
Packit 679830
    esac
Packit 679830
Packit 679830
    func_quote_for_expand_result=$_G_arg
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_stripname PREFIX SUFFIX NAME
Packit 679830
# ---------------------------------
Packit 679830
# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
Packit 679830
# PREFIX and SUFFIX must not contain globbing or regex special
Packit 679830
# characters, hashes, percent signs, but SUFFIX may contain a leading
Packit 679830
# dot (in which case that matches only a dot).
Packit 679830
if test yes = "$_G_HAVE_XSI_OPS"; then
Packit 679830
  eval 'func_stripname ()
Packit 679830
  {
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
Packit 679830
    # positional parameters, so assign one to ordinary variable first.
Packit 679830
    func_stripname_result=$3
Packit 679830
    func_stripname_result=${func_stripname_result#"$1"}
Packit 679830
    func_stripname_result=${func_stripname_result%"$2"}
Packit 679830
  }'
Packit 679830
else
Packit 679830
  func_stripname ()
Packit 679830
  {
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    case $2 in
Packit 679830
      .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
Packit 679830
      *)  func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
Packit 679830
    esac
Packit 679830
  }
Packit 679830
fi
Packit 679830
Packit 679830
Packit 679830
# func_show_eval CMD [FAIL_EXP]
Packit 679830
# -----------------------------
Packit 679830
# Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
Packit 679830
# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
Packit 679830
# is given, then evaluate it.
Packit 679830
func_show_eval ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    _G_cmd=$1
Packit 679830
    _G_fail_exp=${2-':'}
Packit 679830
Packit 679830
    func_quote_for_expand "$_G_cmd"
Packit 679830
    eval "func_notquiet $func_quote_for_expand_result"
Packit 679830
Packit 679830
    $opt_dry_run || {
Packit 679830
      eval "$_G_cmd"
Packit 679830
      _G_status=$?
Packit 679830
      if test 0 -ne "$_G_status"; then
Packit 679830
	eval "(exit $_G_status); $_G_fail_exp"
Packit 679830
      fi
Packit 679830
    }
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_show_eval_locale CMD [FAIL_EXP]
Packit 679830
# ------------------------------------
Packit 679830
# Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
Packit 679830
# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
Packit 679830
# is given, then evaluate it.  Use the saved locale for evaluation.
Packit 679830
func_show_eval_locale ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    _G_cmd=$1
Packit 679830
    _G_fail_exp=${2-':'}
Packit 679830
Packit 679830
    $opt_quiet || {
Packit 679830
      func_quote_for_expand "$_G_cmd"
Packit 679830
      eval "func_echo $func_quote_for_expand_result"
Packit 679830
    }
Packit 679830
Packit 679830
    $opt_dry_run || {
Packit 679830
      eval "$_G_user_locale
Packit 679830
	    $_G_cmd"
Packit 679830
      _G_status=$?
Packit 679830
      eval "$_G_safe_locale"
Packit 679830
      if test 0 -ne "$_G_status"; then
Packit 679830
	eval "(exit $_G_status); $_G_fail_exp"
Packit 679830
      fi
Packit 679830
    }
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_tr_sh
Packit 679830
# ----------
Packit 679830
# Turn $1 into a string suitable for a shell variable name.
Packit 679830
# Result is stored in $func_tr_sh_result.  All characters
Packit 679830
# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
Packit 679830
# if $1 begins with a digit, a '_' is prepended as well.
Packit 679830
func_tr_sh ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    case $1 in
Packit 679830
    [0-9]* | *[!a-zA-Z0-9_]*)
Packit 679830
      func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
Packit 679830
      ;;
Packit 679830
    * )
Packit 679830
      func_tr_sh_result=$1
Packit 679830
      ;;
Packit 679830
    esac
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_verbose ARG...
Packit 679830
# -------------------
Packit 679830
# Echo program name prefixed message in verbose mode only.
Packit 679830
func_verbose ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    $opt_verbose && func_echo "$*"
Packit 679830
Packit 679830
    :
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_warn_and_continue ARG...
Packit 679830
# -----------------------------
Packit 679830
# Echo program name prefixed warning message to standard error.
Packit 679830
func_warn_and_continue ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    $require_term_colors
Packit 679830
Packit 679830
    func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_warning CATEGORY ARG...
Packit 679830
# ----------------------------
Packit 679830
# Echo program name prefixed warning message to standard error. Warning
Packit 679830
# messages can be filtered according to CATEGORY, where this function
Packit 679830
# elides messages where CATEGORY is not listed in the global variable
Packit 679830
# 'opt_warning_types'.
Packit 679830
func_warning ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    # CATEGORY must be in the warning_categories list!
Packit 679830
    case " $warning_categories " in
Packit 679830
      *" $1 "*) ;;
Packit 679830
      *) func_internal_error "invalid warning category '$1'" ;;
Packit 679830
    esac
Packit 679830
Packit 679830
    _G_category=$1
Packit 679830
    shift
Packit 679830
Packit 679830
    case " $opt_warning_types " in
Packit 679830
      *" $_G_category "*) $warning_func ${1+"$@"} ;;
Packit 679830
    esac
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_sort_ver VER1 VER2
Packit 679830
# -----------------------
Packit 679830
# 'sort -V' is not generally available.
Packit 679830
# Note this deviates from the version comparison in automake
Packit 679830
# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
Packit 679830
# but this should suffice as we won't be specifying old
Packit 679830
# version formats or redundant trailing .0 in bootstrap.conf.
Packit 679830
# If we did want full compatibility then we should probably
Packit 679830
# use m4_version_compare from autoconf.
Packit 679830
func_sort_ver ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    ver1=$1
Packit 679830
    ver2=$2
Packit 679830
Packit 679830
    # Split on '.' and compare each component.
Packit 679830
    i=1
Packit 679830
    while :; do
Packit 679830
      p1=`echo "$ver1" |cut -d. -f$i`
Packit 679830
      p2=`echo "$ver2" |cut -d. -f$i`
Packit 679830
      if test ! "$p1"; then
Packit 679830
        echo "$1 $2"
Packit 679830
        break
Packit 679830
      elif test ! "$p2"; then
Packit 679830
        echo "$2 $1"
Packit 679830
        break
Packit 679830
      elif test ! "$p1" = "$p2"; then
Packit 679830
        if test "$p1" -gt "$p2" 2>/dev/null; then # numeric comparison
Packit 679830
          echo "$2 $1"
Packit 679830
        elif test "$p2" -gt "$p1" 2>/dev/null; then # numeric comparison
Packit 679830
          echo "$1 $2"
Packit 679830
        else # numeric, then lexicographic comparison
Packit 679830
          lp=`printf "$p1\n$p2\n" |sort -n |tail -n1`
Packit 679830
          if test "$lp" = "$p2"; then
Packit 679830
            echo "$1 $2"
Packit 679830
          else
Packit 679830
            echo "$2 $1"
Packit 679830
          fi
Packit 679830
        fi
Packit 679830
        break
Packit 679830
      fi
Packit 679830
      i=`expr $i + 1`
Packit 679830
    done
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# Local variables:
Packit 679830
# mode: shell-script
Packit 679830
# sh-indentation: 2
Packit 679830
# eval: (add-hook 'write-file-hooks 'time-stamp)
Packit 679830
# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
Packit 679830
# time-stamp-time-zone: "UTC"
Packit 679830
# End:
Packit 679830
#! /bin/sh
Packit 679830
Packit 679830
# Set a version string for this script.
Packit 679830
scriptversion=2012-10-21.11; # UTC
Packit 679830
Packit 679830
# A portable, pluggable option parser for Bourne shell.
Packit 679830
# Written by Gary V. Vaughan, 2010
Packit 679830
Packit 679830
# Copyright (C) 2010-2013 Free Software Foundation, Inc.
Packit 679830
# This is free software; see the source for copying conditions.  There is NO
Packit 679830
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Packit 679830
Packit 679830
# This program is free software: you can redistribute it and/or modify
Packit 679830
# it under the terms of the GNU General Public License as published by
Packit 679830
# the Free Software Foundation, either version 3 of the License, or
Packit 679830
# (at your option) any later version.
Packit 679830
Packit 679830
# This program is distributed in the hope that it will be useful,
Packit 679830
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 679830
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 679830
# GNU General Public License for more details.
Packit 679830
Packit 679830
# You should have received a copy of the GNU General Public License
Packit 679830
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 679830
Packit 679830
# Please report bugs or propose patches to gary@gnu.org.
Packit 679830
Packit 679830
Packit 679830
## ------ ##
Packit 679830
## Usage. ##
Packit 679830
## ------ ##
Packit 679830
Packit 679830
# This file is a library for parsing options in your shell scripts along
Packit 679830
# with assorted other useful supporting features that you can make use
Packit 679830
# of too.
Packit 679830
#
Packit 679830
# For the simplest scripts you might need only:
Packit 679830
#
Packit 679830
#   #!/bin/sh
Packit 679830
#   . relative/path/to/funclib.sh
Packit 679830
#   . relative/path/to/options-parser
Packit 679830
#   scriptversion=1.0
Packit 679830
#   func_options ${1+"$@"}
Packit 679830
#   eval set dummy "$func_options_result"; shift
Packit 679830
#   ...rest of your script...
Packit 679830
#
Packit 679830
# In order for the '--version' option to work, you will need to have a
Packit 679830
# suitably formatted comment like the one at the top of this file
Packit 679830
# starting with '# Written by ' and ending with '# warranty; '.
Packit 679830
#
Packit 679830
# For '-h' and '--help' to work, you will also need a one line
Packit 679830
# description of your script's purpose in a comment directly above the
Packit 679830
# '# Written by ' line, like the one at the top of this file.
Packit 679830
#
Packit 679830
# The default options also support '--debug', which will turn on shell
Packit 679830
# execution tracing (see the comment above debug_cmd below for another
Packit 679830
# use), and '--verbose' and the func_verbose function to allow your script
Packit 679830
# to display verbose messages only when your user has specified
Packit 679830
# '--verbose'.
Packit 679830
#
Packit 679830
# After sourcing this file, you can plug processing for additional
Packit 679830
# options by amending the variables from the 'Configuration' section
Packit 679830
# below, and following the instructions in the 'Option parsing'
Packit 679830
# section further down.
Packit 679830
Packit 679830
## -------------- ##
Packit 679830
## Configuration. ##
Packit 679830
## -------------- ##
Packit 679830
Packit 679830
# You should override these variables in your script after sourcing this
Packit 679830
# file so that they reflect the customisations you have added to the
Packit 679830
# option parser.
Packit 679830
Packit 679830
# The usage line for option parsing errors and the start of '-h' and
Packit 679830
# '--help' output messages. You can embed shell variables for delayed
Packit 679830
# expansion at the time the message is displayed, but you will need to
Packit 679830
# quote other shell meta-characters carefully to prevent them being
Packit 679830
# expanded when the contents are evaled.
Packit 679830
usage='$progpath [OPTION]...'
Packit 679830
Packit 679830
# Short help message in response to '-h' and '--help'.  Add to this or
Packit 679830
# override it after sourcing this library to reflect the full set of
Packit 679830
# options your script accepts.
Packit 679830
usage_message="\
Packit 679830
       --debug        enable verbose shell tracing
Packit 679830
   -W, --warnings=CATEGORY
Packit 679830
                      report the warnings falling in CATEGORY [all]
Packit 679830
   -v, --verbose      verbosely report processing
Packit 679830
       --version      print version information and exit
Packit 679830
   -h, --help         print short or long help message and exit
Packit 679830
"
Packit 679830
Packit 679830
# Additional text appended to 'usage_message' in response to '--help'.
Packit 679830
long_help_message="
Packit 679830
Warning categories include:
Packit 679830
       'all'          show all warnings
Packit 679830
       'none'         turn off all the warnings
Packit 679830
       'error'        warnings are treated as fatal errors"
Packit 679830
Packit 679830
# Help message printed before fatal option parsing errors.
Packit 679830
fatal_help="Try '\$progname --help' for more information."
Packit 679830
Packit 679830
Packit 679830
Packit 679830
## ------------------------- ##
Packit 679830
## Hook function management. ##
Packit 679830
## ------------------------- ##
Packit 679830
Packit 679830
# This section contains functions for adding, removing, and running hooks
Packit 679830
# to the main code.  A hook is just a named list of of function, that can
Packit 679830
# be run in order later on.
Packit 679830
Packit 679830
# func_hookable FUNC_NAME
Packit 679830
# -----------------------
Packit 679830
# Declare that FUNC_NAME will run hooks added with
Packit 679830
# 'func_add_hook FUNC_NAME ...'.
Packit 679830
func_hookable ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    func_append hookable_fns " $1"
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_add_hook FUNC_NAME HOOK_FUNC
Packit 679830
# ---------------------------------
Packit 679830
# Request that FUNC_NAME call HOOK_FUNC before it returns.  FUNC_NAME must
Packit 679830
# first have been declared "hookable" by a call to 'func_hookable'.
Packit 679830
func_add_hook ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    case " $hookable_fns " in
Packit 679830
      *" $1 "*) ;;
Packit 679830
      *) func_fatal_error "'$1' does not accept hook functions." ;;
Packit 679830
    esac
Packit 679830
Packit 679830
    eval func_append ${1}_hooks '" $2"'
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_remove_hook FUNC_NAME HOOK_FUNC
Packit 679830
# ------------------------------------
Packit 679830
# Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
Packit 679830
func_remove_hook ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    eval ${1}_hooks='`$bs_echo "\$'$1'_hooks" |$SED "s| '$2'||"`'
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_run_hooks FUNC_NAME [ARG]...
Packit 679830
# ---------------------------------
Packit 679830
# Run all hook functions registered to FUNC_NAME.
Packit 679830
# It is assumed that the list of hook functions contains nothing more
Packit 679830
# than a whitespace-delimited list of legal shell function names, and
Packit 679830
# no effort is wasted trying to catch shell meta-characters or preserve
Packit 679830
# whitespace.
Packit 679830
func_run_hooks ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    case " $hookable_fns " in
Packit 679830
      *" $1 "*) ;;
Packit 679830
      *) func_fatal_error "'$1' does not support hook funcions.n" ;;
Packit 679830
    esac
Packit 679830
Packit 679830
    eval _G_hook_fns=\$$1_hooks; shift
Packit 679830
Packit 679830
    for _G_hook in $_G_hook_fns; do
Packit 679830
      eval $_G_hook '"$@"'
Packit 679830
Packit 679830
      # store returned options list back into positional
Packit 679830
      # parameters for next 'cmd' execution.
Packit 679830
      eval _G_hook_result=\$${_G_hook}_result
Packit 679830
      eval set dummy "$_G_hook_result"; shift
Packit 679830
    done
Packit 679830
Packit 679830
    func_quote_for_eval ${1+"$@"}
Packit 679830
    func_run_hooks_result=$func_quote_for_eval_result
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
Packit 679830
## --------------- ##
Packit 679830
## Option parsing. ##
Packit 679830
## --------------- ##
Packit 679830
Packit 679830
# In order to add your own option parsing hooks, you must accept the
Packit 679830
# full positional parameter list in your hook function, remove any
Packit 679830
# options that you action, and then pass back the remaining unprocessed
Packit 679830
# options in '<hooked_function_name>_result', escaped suitably for
Packit 679830
# 'eval'.  Like this:
Packit 679830
#
Packit 679830
#    my_options_prep ()
Packit 679830
#    {
Packit 679830
#        $debug_cmd
Packit 679830
#
Packit 679830
#        # Extend the existing usage message.
Packit 679830
#        usage_message=$usage_message'
Packit 679830
#      -s, --silent       don'\''t print informational messages
Packit 679830
#    '
Packit 679830
#
Packit 679830
#        func_quote_for_eval ${1+"$@"}
Packit 679830
#        my_options_prep_result=$func_quote_for_eval_result
Packit 679830
#    }
Packit 679830
#    func_add_hook func_options_prep my_options_prep
Packit 679830
#
Packit 679830
#
Packit 679830
#    my_silent_option ()
Packit 679830
#    {
Packit 679830
#        $debug_cmd
Packit 679830
#
Packit 679830
#        # Note that for efficiency, we parse as many options as we can
Packit 679830
#        # recognise in a loop before passing the remainder back to the
Packit 679830
#        # caller on the first unrecognised argument we encounter.
Packit 679830
#        while test $# -gt 0; do
Packit 679830
#          opt=$1; shift
Packit 679830
#          case $opt in
Packit 679830
#            --silent|-s) opt_silent=: ;;
Packit 679830
#            # Separate non-argument short options:
Packit 679830
#            -s*)         func_split_short_opt "$_G_opt"
Packit 679830
#                         set dummy "$func_split_short_opt_name" \
Packit 679830
#                             "-$func_split_short_opt_arg" ${1+"$@"}
Packit 679830
#                         shift
Packit 679830
#                         ;;
Packit 679830
#            *)            set dummy "$_G_opt" "$*"; shift; break ;;
Packit 679830
#          esac
Packit 679830
#        done
Packit 679830
#
Packit 679830
#        func_quote_for_eval ${1+"$@"}
Packit 679830
#        my_silent_option_result=$func_quote_for_eval_result
Packit 679830
#    }
Packit 679830
#    func_add_hook func_parse_options my_silent_option
Packit 679830
#
Packit 679830
#
Packit 679830
#    my_option_validation ()
Packit 679830
#    {
Packit 679830
#        $debug_cmd
Packit 679830
#
Packit 679830
#        $opt_silent && $opt_verbose && func_fatal_help "\
Packit 679830
#    '--silent' and '--verbose' options are mutually exclusive."
Packit 679830
#
Packit 679830
#        func_quote_for_eval ${1+"$@"}
Packit 679830
#        my_option_validation_result=$func_quote_for_eval_result
Packit 679830
#    }
Packit 679830
#    func_add_hook func_validate_options my_option_validation
Packit 679830
#
Packit 679830
# You'll alse need to manually amend $usage_message to reflect the extra
Packit 679830
# options you parse.  It's preferable to append if you can, so that
Packit 679830
# multiple option parsing hooks can be added safely.
Packit 679830
Packit 679830
Packit 679830
# func_options [ARG]...
Packit 679830
# ---------------------
Packit 679830
# All the functions called inside func_options are hookable. See the
Packit 679830
# individual implementations for details.
Packit 679830
func_hookable func_options
Packit 679830
func_options ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    func_options_prep ${1+"$@"}
Packit 679830
    eval func_parse_options \
Packit 679830
        ${func_options_prep_result+"$func_options_prep_result"}
Packit 679830
    eval func_validate_options \
Packit 679830
        ${func_parse_options_result+"$func_parse_options_result"}
Packit 679830
Packit 679830
    eval func_run_hooks func_options \
Packit 679830
        ${func_validate_options_result+"$func_validate_options_result"}
Packit 679830
Packit 679830
    # save modified positional parameters for caller
Packit 679830
    func_options_result=$func_run_hooks_result
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_options_prep [ARG]...
Packit 679830
# --------------------------
Packit 679830
# All initialisations required before starting the option parse loop.
Packit 679830
# Note that when calling hook functions, we pass through the list of
Packit 679830
# positional parameters.  If a hook function modifies that list, and
Packit 679830
# needs to propogate that back to rest of this script, then the complete
Packit 679830
# modified list must be put in 'func_run_hooks_result' before
Packit 679830
# returning.
Packit 679830
func_hookable func_options_prep
Packit 679830
func_options_prep ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    # Option defaults:
Packit 679830
    opt_verbose=false
Packit 679830
    opt_warning_types=
Packit 679830
Packit 679830
    func_run_hooks func_options_prep ${1+"$@"}
Packit 679830
Packit 679830
    # save modified positional parameters for caller
Packit 679830
    func_options_prep_result=$func_run_hooks_result
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_parse_options [ARG]...
Packit 679830
# ---------------------------
Packit 679830
# The main option parsing loop.
Packit 679830
func_hookable func_parse_options
Packit 679830
func_parse_options ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    func_parse_options_result=
Packit 679830
Packit 679830
    # this just eases exit handling
Packit 679830
    while test $# -gt 0; do
Packit 679830
      # Defer to hook functions for initial option parsing, so they
Packit 679830
      # get priority in the event of reusing an option name.
Packit 679830
      func_run_hooks func_parse_options ${1+"$@"}
Packit 679830
Packit 679830
      # Adjust func_parse_options positional parameters to match
Packit 679830
      eval set dummy "$func_run_hooks_result"; shift
Packit 679830
Packit 679830
      # Break out of the loop if we already parsed every option.
Packit 679830
      test $# -gt 0 || break
Packit 679830
Packit 679830
      _G_opt=$1
Packit 679830
      shift
Packit 679830
      case $_G_opt in
Packit 679830
        --debug|-x)   debug_cmd='set -x'
Packit 679830
                      func_echo "enabling shell trace mode"
Packit 679830
                      $debug_cmd
Packit 679830
                      ;;
Packit 679830
Packit 679830
        --no-warnings|--no-warning|--no-warn)
Packit 679830
                      set dummy --warnings none ${1+"$@"}
Packit 679830
                      shift
Packit 679830
		      ;;
Packit 679830
Packit 679830
        --warnings|--warning|-W)
Packit 679830
                      test $# = 0 && func_missing_arg $_G_opt && break
Packit 679830
                      case " $warning_categories $1" in
Packit 679830
                        *" $1 "*)
Packit 679830
                          # trailing space prevents matching last $1 above
Packit 679830
                          func_append_uniq opt_warning_types " $1"
Packit 679830
                          ;;
Packit 679830
                        *all)
Packit 679830
                          opt_warning_types=$warning_categories
Packit 679830
                          ;;
Packit 679830
                        *none)
Packit 679830
                          opt_warning_types=none
Packit 679830
                          warning_func=:
Packit 679830
                          ;;
Packit 679830
                        *error)
Packit 679830
                          opt_warning_types=$warning_categories
Packit 679830
                          warning_func=func_fatal_error
Packit 679830
                          ;;
Packit 679830
                        *)
Packit 679830
                          func_fatal_error \
Packit 679830
                             "unsupported warning category: '$1'"
Packit 679830
                          ;;
Packit 679830
                      esac
Packit 679830
                      shift
Packit 679830
                      ;;
Packit 679830
Packit 679830
        --verbose|-v) opt_verbose=: ;;
Packit 679830
        --version)    func_version ;;
Packit 679830
        -\?|-h)       func_usage ;;
Packit 679830
        --help)       func_help ;;
Packit 679830
Packit 679830
	# Separate optargs to long options (plugins may need this):
Packit 679830
	--*=*)        func_split_equals "$_G_opt"
Packit 679830
	              set dummy "$func_split_equals_lhs" \
Packit 679830
                          "$func_split_equals_rhs" ${1+"$@"}
Packit 679830
                      shift
Packit 679830
                      ;;
Packit 679830
Packit 679830
       # Separate optargs to short options:
Packit 679830
        -W*)
Packit 679830
                      func_split_short_opt "$_G_opt"
Packit 679830
                      set dummy "$func_split_short_opt_name" \
Packit 679830
                          "$func_split_short_opt_arg" ${1+"$@"}
Packit 679830
                      shift
Packit 679830
                      ;;
Packit 679830
Packit 679830
        # Separate non-argument short options:
Packit 679830
        -\?*|-h*|-v*|-x*)
Packit 679830
                      func_split_short_opt "$_G_opt"
Packit 679830
                      set dummy "$func_split_short_opt_name" \
Packit 679830
                          "-$func_split_short_opt_arg" ${1+"$@"}
Packit 679830
                      shift
Packit 679830
                      ;;
Packit 679830
Packit 679830
        --)           break ;;
Packit 679830
        -*)           func_fatal_help "unrecognised option: '$_G_opt'" ;;
Packit 679830
        *)            set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
Packit 679830
      esac
Packit 679830
    done
Packit 679830
Packit 679830
    # save modified positional parameters for caller
Packit 679830
    func_quote_for_eval ${1+"$@"}
Packit 679830
    func_parse_options_result=$func_quote_for_eval_result
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_validate_options [ARG]...
Packit 679830
# ------------------------------
Packit 679830
# Perform any sanity checks on option settings and/or unconsumed
Packit 679830
# arguments.
Packit 679830
func_hookable func_validate_options
Packit 679830
func_validate_options ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    # Display all warnings if -W was not given.
Packit 679830
    test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
Packit 679830
Packit 679830
    func_run_hooks func_validate_options ${1+"$@"}
Packit 679830
Packit 679830
    # Bail if the options were screwed!
Packit 679830
    $exit_cmd $EXIT_FAILURE
Packit 679830
Packit 679830
    # save modified positional parameters for caller
Packit 679830
    func_validate_options_result=$func_run_hooks_result
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
Packit 679830
## ------------------##
Packit 679830
## Helper functions. ##
Packit 679830
## ------------------##
Packit 679830
Packit 679830
# This section contains the helper functions used by the rest of the
Packit 679830
# hookable option parser framework in ascii-betical order.
Packit 679830
Packit 679830
Packit 679830
# func_fatal_help ARG...
Packit 679830
# ----------------------
Packit 679830
# Echo program name prefixed message to standard error, followed by
Packit 679830
# a help hint, and exit.
Packit 679830
func_fatal_help ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    eval \$bs_echo \""Usage: $usage"\"
Packit 679830
    eval \$bs_echo \""$fatal_help"\"
Packit 679830
    func_error ${1+"$@"}
Packit 679830
    exit $EXIT_FAILURE
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_help
Packit 679830
# ---------
Packit 679830
# Echo long help message to standard output and exit.
Packit 679830
func_help ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    func_usage_message
Packit 679830
    $bs_echo "$long_help_message"
Packit 679830
    exit 0
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_missing_arg ARGNAME
Packit 679830
# ------------------------
Packit 679830
# Echo program name prefixed message to standard error and set global
Packit 679830
# exit_cmd.
Packit 679830
func_missing_arg ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    func_error "Missing argument for '$1'."
Packit 679830
    exit_cmd=exit
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_split_equals STRING
Packit 679830
# ------------------------
Packit 679830
# Set func_split_equals_lhs and func_split_equals_rhs shell variables after
Packit 679830
# splitting STRING at the '=' sign.
Packit 679830
test -z "$_G_HAVE_XSI_OPS" \
Packit 679830
    && (eval 'x=a/b/c;
Packit 679830
      test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
Packit 679830
    && _G_HAVE_XSI_OPS=yes
Packit 679830
Packit 679830
if test yes = "$_G_HAVE_XSI_OPS"
Packit 679830
then
Packit 679830
  # This is an XSI compatible shell, allowing a faster implementation...
Packit 679830
  eval 'func_split_equals ()
Packit 679830
  {
Packit 679830
      $debug_cmd
Packit 679830
Packit 679830
      func_split_equals_lhs=${1%%=*}
Packit 679830
      func_split_equals_rhs=${1#*=}
Packit 679830
      test "x$func_split_equals_lhs" = "x$1" \
Packit 679830
        && func_split_equals_rhs=
Packit 679830
  }'
Packit 679830
else
Packit 679830
  # ...otherwise fall back to using expr, which is often a shell builtin.
Packit 679830
  func_split_equals ()
Packit 679830
  {
Packit 679830
      $debug_cmd
Packit 679830
Packit 679830
      func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
Packit 679830
      func_split_equals_rhs=
Packit 679830
      test "x$func_split_equals_lhs" = "x$1" \
Packit 679830
        || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
Packit 679830
  }
Packit 679830
fi #func_split_equals
Packit 679830
Packit 679830
Packit 679830
# func_split_short_opt SHORTOPT
Packit 679830
# -----------------------------
Packit 679830
# Set func_split_short_opt_name and func_split_short_opt_arg shell
Packit 679830
# variables after splitting SHORTOPT after the 2nd character.
Packit 679830
if test yes = "$_G_HAVE_XSI_OPS"
Packit 679830
then
Packit 679830
  # This is an XSI compatible shell, allowing a faster implementation...
Packit 679830
  eval 'func_split_short_opt ()
Packit 679830
  {
Packit 679830
      $debug_cmd
Packit 679830
Packit 679830
      func_split_short_opt_arg=${1#??}
Packit 679830
      func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
Packit 679830
  }'
Packit 679830
else
Packit 679830
  # ...otherwise fall back to using expr, which is often a shell builtin.
Packit 679830
  func_split_short_opt ()
Packit 679830
  {
Packit 679830
      $debug_cmd
Packit 679830
Packit 679830
      func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
Packit 679830
      func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
Packit 679830
  }
Packit 679830
fi #func_split_short_opt
Packit 679830
Packit 679830
Packit 679830
# func_usage
Packit 679830
# ----------
Packit 679830
# Echo short help message to standard output and exit.
Packit 679830
func_usage ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    func_usage_message
Packit 679830
    $bs_echo "Run '$progname --help |${PAGER-more}' for full usage"
Packit 679830
    exit 0
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_usage_message
Packit 679830
# ------------------
Packit 679830
# Echo short help message to standard output.
Packit 679830
func_usage_message ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    eval \$bs_echo \""Usage: $usage"\"
Packit 679830
    echo
Packit 679830
    $SED -n 's|^# ||
Packit 679830
        /^Written by/{
Packit 679830
          x;p;x
Packit 679830
        }
Packit 679830
	h
Packit 679830
	/^Written by/q' < "$progpath"
Packit 679830
    echo
Packit 679830
    eval \$bs_echo \""$usage_message"\"
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_version
Packit 679830
# ------------
Packit 679830
# Echo version message to standard output and exit.
Packit 679830
func_version ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    printf '%s\n' "$progname $scriptversion"
Packit 679830
    $SED -n '/^##/q
Packit 679830
        /(C)/!b go
Packit 679830
        :more
Packit 679830
        /\./!{
Packit 679830
          N
Packit 679830
          s|\n# | |
Packit 679830
          b more
Packit 679830
        }
Packit 679830
        :go
Packit 679830
        /^# Written by /,/# warranty; / {
Packit 679830
          s|^# ||
Packit 679830
          s|^# *$||
Packit 679830
          s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
Packit 679830
          p
Packit 679830
        }
Packit 679830
        /^# Written by / {
Packit 679830
          s|^# ||
Packit 679830
          p
Packit 679830
        }
Packit 679830
        /^warranty; /q' < "$progpath"
Packit 679830
Packit 679830
    exit $?
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# Local variables:
Packit 679830
# mode: shell-script
Packit 679830
# sh-indentation: 2
Packit 679830
# eval: (add-hook 'write-file-hooks 'time-stamp)
Packit 679830
# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
Packit 679830
# time-stamp-time-zone: "UTC"
Packit 679830
# End:
Packit 679830
Packit 679830
# Set a version string.
Packit 679830
scriptversion='(GNU libtool) 2.4.2.418'
Packit 679830
Packit 679830
Packit 679830
# func_echo ARG...
Packit 679830
# ----------------
Packit 679830
# Libtool also displays the current mode in messages, so override
Packit 679830
# funclib.sh func_echo with this custom definition.
Packit 679830
func_echo ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    _G_message=$*
Packit 679830
Packit 679830
    func_echo_IFS=$IFS
Packit 679830
    IFS=$nl
Packit 679830
    for _G_line in $_G_message; do
Packit 679830
      IFS=$func_echo_IFS
Packit 679830
      $bs_echo "$progname${opt_mode+: $opt_mode}: $_G_line"
Packit 679830
    done
Packit 679830
    IFS=$func_echo_IFS
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_warning ARG...
Packit 679830
# -------------------
Packit 679830
# Libtool warnings are not categorized, so override funclib.sh
Packit 679830
# func_warning with this simpler definition.
Packit 679830
func_warning ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    $warning_func ${1+"$@"}
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
## ---------------- ##
Packit 679830
## Options parsing. ##
Packit 679830
## ---------------- ##
Packit 679830
Packit 679830
# Hook in the functions to make sure our own options are parsed during
Packit 679830
# the option parsing loop.
Packit 679830
Packit 679830
usage='$progpath [OPTION]... [MODE-ARG]...'
Packit 679830
Packit 679830
# Short help message in response to '-h'.
Packit 679830
usage_message="Options:
Packit 679830
       --config             show all configuration variables
Packit 679830
       --debug              enable verbose shell tracing
Packit 679830
   -n, --dry-run            display commands without modifying any files
Packit 679830
       --features           display basic configuration information and exit
Packit 679830
       --mode=MODE          use operation mode MODE
Packit 679830
       --no-warnings        equivalent to '-Wnone'
Packit 679830
       --preserve-dup-deps  don't remove duplicate dependency libraries
Packit 679830
       --quiet, --silent    don't print informational messages
Packit 679830
       --tag=TAG            use configuration variables from tag TAG
Packit 679830
   -v, --verbose            print more informational messages than default
Packit 679830
       --version            print version information
Packit 679830
   -W, --warnings=CATEGORY  report the warnings falling in CATEGORY [all]
Packit 679830
   -h, --help, --help-all   print short, long, or detailed help message
Packit 679830
"
Packit 679830
Packit 679830
# Additional text appended to 'usage_message' in response to '--help'.
Packit 679830
long_help_message=$long_help_message"
Packit 679830
Packit 679830
MODE must be one of the following:
Packit 679830
Packit 679830
       clean           remove files from the build directory
Packit 679830
       compile         compile a source file into a libtool object
Packit 679830
       execute         automatically set library path, then run a program
Packit 679830
       finish          complete the installation of libtool libraries
Packit 679830
       install         install libraries or executables
Packit 679830
       link            create a library or an executable
Packit 679830
       uninstall       remove libraries from an installed directory
Packit 679830
Packit 679830
MODE-ARGS vary depending on the MODE.  When passed as first option,
Packit 679830
'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
Packit 679830
Try '$progname --help --mode=MODE' for a more detailed description of MODE.
Packit 679830
Packit 679830
When reporting a bug, please describe a test case to reproduce it and
Packit 679830
include the following information:
Packit 679830
Packit 679830
       host-triplet:   $host
Packit 679830
       shell:          $SHELL
Packit 679830
       compiler:       $LTCC
Packit 679830
       compiler flags: $LTCFLAGS
Packit 679830
       linker:         $LD (gnu? $with_gnu_ld)
Packit 679830
       version:        $progname (GNU libtool) 2.4.2.418
Packit 679830
       automake:       `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
Packit 679830
       autoconf:       `($AUTOCONF --version) 2>/dev/null |$SED 1q`
Packit 679830
Packit 679830
Report bugs to <bug-libtool@gnu.org>.
Packit 679830
GNU libtool home page: <http://www.gnu.org/software/libtool/>.
Packit 679830
General help using GNU software: <http://www.gnu.org/gethelp/>."
Packit 679830
Packit 679830
Packit 679830
# func_lo2o OBJECT-NAME
Packit 679830
# ---------------------
Packit 679830
# Transform OBJECT-NAME from a '.lo' suffix to the platform specific
Packit 679830
# object suffix.
Packit 679830
Packit 679830
lo2o=s/\\.lo\$/.$objext/
Packit 679830
o2lo=s/\\.$objext\$/.lo/
Packit 679830
Packit 679830
if test yes = "$_G_HAVE_XSI_OPS"; then
Packit 679830
  eval 'func_lo2o ()
Packit 679830
  {
Packit 679830
    case $1 in
Packit 679830
      *.lo) func_lo2o_result=${1%.lo}.$objext ;;
Packit 679830
      *   ) func_lo2o_result=$1               ;;
Packit 679830
    esac
Packit 679830
  }'
Packit 679830
Packit 679830
  # func_xform LIBOBJ-OR-SOURCE
Packit 679830
  # ---------------------------
Packit 679830
  # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
Packit 679830
  # suffix to a '.lo' libtool-object suffix.
Packit 679830
  eval 'func_xform ()
Packit 679830
  {
Packit 679830
    func_xform_result=${1%.*}.lo
Packit 679830
  }'
Packit 679830
else
Packit 679830
  # ...otherwise fall back to using sed.
Packit 679830
  func_lo2o ()
Packit 679830
  {
Packit 679830
    func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
Packit 679830
  }
Packit 679830
Packit 679830
  func_xform ()
Packit 679830
  {
Packit 679830
    func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
Packit 679830
  }
Packit 679830
fi
Packit 679830
Packit 679830
Packit 679830
# func_fatal_configuration ARG...
Packit 679830
# -------------------------------
Packit 679830
# Echo program name prefixed message to standard error, followed by
Packit 679830
# a configuration failure hint, and exit.
Packit 679830
func_fatal_configuration ()
Packit 679830
{
Packit 679830
    func__fatal_error ${1+"$@"} \
Packit 679830
      "See the $PACKAGE documentation for more information." \
Packit 679830
      "Fatal configuration error."
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_config
Packit 679830
# -----------
Packit 679830
# Display the configuration for all the tags in this script.
Packit 679830
func_config ()
Packit 679830
{
Packit 679830
    re_begincf='^# ### BEGIN LIBTOOL'
Packit 679830
    re_endcf='^# ### END LIBTOOL'
Packit 679830
Packit 679830
    # Default configuration.
Packit 679830
    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
Packit 679830
Packit 679830
    # Now print the configurations for the tags.
Packit 679830
    for tagname in $taglist; do
Packit 679830
      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
Packit 679830
    done
Packit 679830
Packit 679830
    exit $?
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_features
Packit 679830
# -------------
Packit 679830
# Display the features supported by this script.
Packit 679830
func_features ()
Packit 679830
{
Packit 679830
    echo "host: $host"
Packit 679830
    if test yes = "$build_libtool_libs"; then
Packit 679830
      echo "enable shared libraries"
Packit 679830
    else
Packit 679830
      echo "disable shared libraries"
Packit 679830
    fi
Packit 679830
    if test yes = "$build_old_libs"; then
Packit 679830
      echo "enable static libraries"
Packit 679830
    else
Packit 679830
      echo "disable static libraries"
Packit 679830
    fi
Packit 679830
Packit 679830
    exit $?
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_enable_tag TAGNAME
Packit 679830
# -----------------------
Packit 679830
# Verify that TAGNAME is valid, and either flag an error and exit, or
Packit 679830
# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
Packit 679830
# variable here.
Packit 679830
func_enable_tag ()
Packit 679830
{
Packit 679830
    # Global variable:
Packit 679830
    tagname=$1
Packit 679830
Packit 679830
    re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
Packit 679830
    re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
Packit 679830
    sed_extractcf=/$re_begincf/,/$re_endcf/p
Packit 679830
Packit 679830
    # Validate tagname.
Packit 679830
    case $tagname in
Packit 679830
      *[!-_A-Za-z0-9,/]*)
Packit 679830
        func_fatal_error "invalid tag name: $tagname"
Packit 679830
        ;;
Packit 679830
    esac
Packit 679830
Packit 679830
    # Don't test for the "default" C tag, as we know it's
Packit 679830
    # there but not specially marked.
Packit 679830
    case $tagname in
Packit 679830
        CC) ;;
Packit 679830
    *)
Packit 679830
        if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
Packit 679830
	  taglist="$taglist $tagname"
Packit 679830
Packit 679830
	  # Evaluate the configuration.  Be careful to quote the path
Packit 679830
	  # and the sed script, to avoid splitting on whitespace, but
Packit 679830
	  # also don't use non-portable quotes within backquotes within
Packit 679830
	  # quotes we have to do it in 2 steps:
Packit 679830
	  extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
Packit 679830
	  eval "$extractedcf"
Packit 679830
        else
Packit 679830
	  func_error "ignoring unknown tag $tagname"
Packit 679830
        fi
Packit 679830
        ;;
Packit 679830
    esac
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_check_version_match
Packit 679830
# ------------------------
Packit 679830
# Ensure that we are using m4 macros, and libtool script from the same
Packit 679830
# release of libtool.
Packit 679830
func_check_version_match ()
Packit 679830
{
Packit 679830
    if test "$package_revision" != "$macro_revision"; then
Packit 679830
      if test "$VERSION" != "$macro_version"; then
Packit 679830
        if test -z "$macro_version"; then
Packit 679830
          cat >&2 <<_LT_EOF
Packit 679830
$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
Packit 679830
$progname: definition of this LT_INIT comes from an older release.
Packit 679830
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
Packit 679830
$progname: and run autoconf again.
Packit 679830
_LT_EOF
Packit 679830
        else
Packit 679830
          cat >&2 <<_LT_EOF
Packit 679830
$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
Packit 679830
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
Packit 679830
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
Packit 679830
$progname: and run autoconf again.
Packit 679830
_LT_EOF
Packit 679830
        fi
Packit 679830
      else
Packit 679830
        cat >&2 <<_LT_EOF
Packit 679830
$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
Packit 679830
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
Packit 679830
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
Packit 679830
$progname: of $PACKAGE $VERSION and run autoconf again.
Packit 679830
_LT_EOF
Packit 679830
      fi
Packit 679830
Packit 679830
      exit $EXIT_MISMATCH
Packit 679830
    fi
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# libtool_options_prep [ARG]...
Packit 679830
# -----------------------------
Packit 679830
# Preparation for options parsed by libtool.
Packit 679830
libtool_options_prep ()
Packit 679830
{
Packit 679830
    $debug_mode
Packit 679830
Packit 679830
    # Option defaults:
Packit 679830
    opt_config=false
Packit 679830
    opt_dlopen=
Packit 679830
    opt_dry_run=false
Packit 679830
    opt_help=false
Packit 679830
    opt_mode=
Packit 679830
    opt_preserve_dup_deps=false
Packit 679830
    opt_quiet=false
Packit 679830
Packit 679830
    nonopt=
Packit 679830
    preserve_args=
Packit 679830
Packit 679830
    # Shorthand for --mode=foo, only valid as the first argument
Packit 679830
    case $1 in
Packit 679830
    clean|clea|cle|cl)
Packit 679830
      shift; set dummy --mode clean ${1+"$@"}; shift
Packit 679830
      ;;
Packit 679830
    compile|compil|compi|comp|com|co|c)
Packit 679830
      shift; set dummy --mode compile ${1+"$@"}; shift
Packit 679830
      ;;
Packit 679830
    execute|execut|execu|exec|exe|ex|e)
Packit 679830
      shift; set dummy --mode execute ${1+"$@"}; shift
Packit 679830
      ;;
Packit 679830
    finish|finis|fini|fin|fi|f)
Packit 679830
      shift; set dummy --mode finish ${1+"$@"}; shift
Packit 679830
      ;;
Packit 679830
    install|instal|insta|inst|ins|in|i)
Packit 679830
      shift; set dummy --mode install ${1+"$@"}; shift
Packit 679830
      ;;
Packit 679830
    link|lin|li|l)
Packit 679830
      shift; set dummy --mode link ${1+"$@"}; shift
Packit 679830
      ;;
Packit 679830
    uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
Packit 679830
      shift; set dummy --mode uninstall ${1+"$@"}; shift
Packit 679830
      ;;
Packit 679830
    esac
Packit 679830
Packit 679830
    # Pass back the list of options.
Packit 679830
    func_quote_for_eval ${1+"$@"}
Packit 679830
    libtool_options_prep_result=$func_quote_for_eval_result
Packit 679830
}
Packit 679830
func_add_hook func_options_prep libtool_options_prep
Packit 679830
Packit 679830
Packit 679830
# libtool_parse_options [ARG]...
Packit 679830
# ---------------------------------
Packit 679830
# Provide handling for libtool specific options.
Packit 679830
libtool_parse_options ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    # Perform our own loop to consume as many options as possible in
Packit 679830
    # each iteration.
Packit 679830
    while test $# -gt 0; do
Packit 679830
      _G_opt=$1
Packit 679830
      shift
Packit 679830
      case $_G_opt in
Packit 679830
        --dry-run|--dryrun|-n)
Packit 679830
                        opt_dry_run=:
Packit 679830
                        ;;
Packit 679830
Packit 679830
        --config)       func_config ;;
Packit 679830
Packit 679830
        --dlopen|-dlopen)
Packit 679830
                        opt_dlopen="${opt_dlopen+$opt_dlopen
Packit 679830
}$1"
Packit 679830
                        shift
Packit 679830
                        ;;
Packit 679830
Packit 679830
        --preserve-dup-deps)
Packit 679830
                        opt_preserve_dup_deps=: ;;
Packit 679830
Packit 679830
        --features)     func_features ;;
Packit 679830
Packit 679830
        --finish)       set dummy --mode finish ${1+"$@"}; shift ;;
Packit 679830
Packit 679830
        --help)         opt_help=: ;;
Packit 679830
Packit 679830
        --help-all)     opt_help=': help-all' ;;
Packit 679830
Packit 679830
        --mode)         test $# = 0 && func_missing_arg $_G_opt && break
Packit 679830
                        opt_mode=$1
Packit 679830
                        case $1 in
Packit 679830
                          # Valid mode arguments:
Packit 679830
                          clean|compile|execute|finish|install|link|relink|uninstall) ;;
Packit 679830
Packit 679830
                          # Catch anything else as an error
Packit 679830
                          *) func_error "invalid argument for $_G_opt"
Packit 679830
                             exit_cmd=exit
Packit 679830
                             break
Packit 679830
                             ;;
Packit 679830
                        esac
Packit 679830
                        shift
Packit 679830
                        ;;
Packit 679830
Packit 679830
        --no-silent|--no-quiet)
Packit 679830
                        opt_quiet=false
Packit 679830
                        func_append preserve_args " $_G_opt"
Packit 679830
                        ;;
Packit 679830
Packit 679830
        --no-warnings|--no-warning|--no-warn)
Packit 679830
                        opt_warning=false
Packit 679830
                        func_append preserve_args " $_G_opt"
Packit 679830
                        ;;
Packit 679830
Packit 679830
        --no-verbose)
Packit 679830
                        opt_verbose=false
Packit 679830
                        func_append preserve_args " $_G_opt"
Packit 679830
                        ;;
Packit 679830
Packit 679830
        --silent|--quiet)
Packit 679830
                        opt_quiet=:
Packit 679830
                        opt_verbose=false
Packit 679830
                        func_append preserve_args " $_G_opt"
Packit 679830
                        ;;
Packit 679830
Packit 679830
        --tag)          test $# = 0 && func_missing_arg $_G_opt && break
Packit 679830
                        opt_tag=$1
Packit 679830
                        func_append preserve_args " $_G_opt $1"
Packit 679830
                        func_enable_tag "$1"
Packit 679830
                        shift
Packit 679830
                        ;;
Packit 679830
Packit 679830
        --verbose|-v)   opt_quiet=false
Packit 679830
                        opt_verbose=:
Packit 679830
                        func_append preserve_args " $_G_opt"
Packit 679830
                        ;;
Packit 679830
Packit 679830
	# An option not handled by this hook function:
Packit 679830
        *)		set dummy "$_G_opt" ${1+"$@"};	shift; break  ;;
Packit 679830
      esac
Packit 679830
    done
Packit 679830
Packit 679830
Packit 679830
    # save modified positional parameters for caller
Packit 679830
    func_quote_for_eval ${1+"$@"}
Packit 679830
    libtool_parse_options_result=$func_quote_for_eval_result
Packit 679830
}
Packit 679830
func_add_hook func_parse_options libtool_parse_options
Packit 679830
Packit 679830
Packit 679830
Packit 679830
# libtool_validate_options [ARG]...
Packit 679830
# ---------------------------------
Packit 679830
# Perform any sanity checks on option settings and/or unconsumed
Packit 679830
# arguments.
Packit 679830
libtool_validate_options ()
Packit 679830
{
Packit 679830
    # save first non-option argument
Packit 679830
    if test 0 -lt $#; then
Packit 679830
      nonopt=$1
Packit 679830
      shift
Packit 679830
    fi
Packit 679830
Packit 679830
    # preserve --debug
Packit 679830
    test : = "$debug_cmd" || func_append preserve_args " --debug"
Packit 679830
Packit 679830
    case $host in
Packit 679830
      *cygwin* | *mingw* | *pw32* | *cegcc*)
Packit 679830
        # don't eliminate duplications in $postdeps and $predeps
Packit 679830
        opt_duplicate_compiler_generated_deps=:
Packit 679830
        ;;
Packit 679830
      *)
Packit 679830
        opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
Packit 679830
        ;;
Packit 679830
    esac
Packit 679830
Packit 679830
    $opt_help || {
Packit 679830
      # Sanity checks first:
Packit 679830
      func_check_version_match
Packit 679830
Packit 679830
      test yes != "$build_libtool_libs" \
Packit 679830
        && test yes != "$build_old_libs" \
Packit 679830
        && func_fatal_configuration "not configured to build any kind of library"
Packit 679830
Packit 679830
      # Darwin sucks
Packit 679830
      eval std_shrext=\"$shrext_cmds\"
Packit 679830
Packit 679830
      # Only execute mode is allowed to have -dlopen flags.
Packit 679830
      if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
Packit 679830
        func_error "unrecognized option '-dlopen'"
Packit 679830
        $ECHO "$help" 1>&2
Packit 679830
        exit $EXIT_FAILURE
Packit 679830
      fi
Packit 679830
Packit 679830
      # Change the help message to a mode-specific one.
Packit 679830
      generic_help=$help
Packit 679830
      help="Try '$progname --help --mode=$opt_mode' for more information."
Packit 679830
    }
Packit 679830
Packit 679830
    # Pass back the unparsed argument list
Packit 679830
    func_quote_for_eval ${1+"$@"}
Packit 679830
    libtool_validate_options_result=$func_quote_for_eval_result
Packit 679830
}
Packit 679830
func_add_hook func_validate_options libtool_validate_options
Packit 679830
Packit 679830
Packit 679830
# Process options as early as possible so that --help and --version
Packit 679830
# can return quickly.
Packit 679830
func_options ${1+"$@"}
Packit 679830
eval set dummy "$func_options_result"; shift
Packit 679830
Packit 679830
Packit 679830
Packit 679830
## ----------- ##
Packit 679830
##    Main.    ##
Packit 679830
## ----------- ##
Packit 679830
Packit 679830
magic='%%%MAGIC variable%%%'
Packit 679830
magic_exe='%%%MAGIC EXE variable%%%'
Packit 679830
Packit 679830
# Global variables.
Packit 679830
extracted_archives=
Packit 679830
extracted_serial=0
Packit 679830
Packit 679830
# If this variable is set in any of the actions, the command in it
Packit 679830
# will be execed at the end.  This prevents here-documents from being
Packit 679830
# left over by shells.
Packit 679830
exec_cmd=
Packit 679830
Packit 679830
Packit 679830
# A function that is used when there is no print builtin or printf.
Packit 679830
func_fallback_echo ()
Packit 679830
{
Packit 679830
  eval 'cat <<_LTECHO_EOF
Packit 679830
$1
Packit 679830
_LTECHO_EOF'
Packit 679830
}
Packit 679830
Packit 679830
# func_lalib_p file
Packit 679830
# True iff FILE is a libtool '.la' library or '.lo' object file.
Packit 679830
# This function is only a basic sanity check; it will hardly flush out
Packit 679830
# determined imposters.
Packit 679830
func_lalib_p ()
Packit 679830
{
Packit 679830
    test -f "$1" &&
Packit 679830
      $SED -e 4q "$1" 2>/dev/null \
Packit 679830
        | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
Packit 679830
}
Packit 679830
Packit 679830
# func_lalib_unsafe_p file
Packit 679830
# True iff FILE is a libtool '.la' library or '.lo' object file.
Packit 679830
# This function implements the same check as func_lalib_p without
Packit 679830
# resorting to external programs.  To this end, it redirects stdin and
Packit 679830
# closes it afterwards, without saving the original file descriptor.
Packit 679830
# As a safety measure, use it only where a negative result would be
Packit 679830
# fatal anyway.  Works if 'file' does not exist.
Packit 679830
func_lalib_unsafe_p ()
Packit 679830
{
Packit 679830
    lalib_p=no
Packit 679830
    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
Packit 679830
	for lalib_p_l in 1 2 3 4
Packit 679830
	do
Packit 679830
	    read lalib_p_line
Packit 679830
	    case $lalib_p_line in
Packit 679830
		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
Packit 679830
	    esac
Packit 679830
	done
Packit 679830
	exec 0<&5 5<&-
Packit 679830
    fi
Packit 679830
    test yes = "$lalib_p"
Packit 679830
}
Packit 679830
Packit 679830
# func_ltwrapper_script_p file
Packit 679830
# True iff FILE is a libtool wrapper script
Packit 679830
# This function is only a basic sanity check; it will hardly flush out
Packit 679830
# determined imposters.
Packit 679830
func_ltwrapper_script_p ()
Packit 679830
{
Packit 679830
    func_lalib_p "$1"
Packit 679830
}
Packit 679830
Packit 679830
# func_ltwrapper_executable_p file
Packit 679830
# True iff FILE is a libtool wrapper executable
Packit 679830
# This function is only a basic sanity check; it will hardly flush out
Packit 679830
# determined imposters.
Packit 679830
func_ltwrapper_executable_p ()
Packit 679830
{
Packit 679830
    func_ltwrapper_exec_suffix=
Packit 679830
    case $1 in
Packit 679830
    *.exe) ;;
Packit 679830
    *) func_ltwrapper_exec_suffix=.exe ;;
Packit 679830
    esac
Packit 679830
    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
Packit 679830
}
Packit 679830
Packit 679830
# func_ltwrapper_scriptname file
Packit 679830
# Assumes file is an ltwrapper_executable
Packit 679830
# uses $file to determine the appropriate filename for a
Packit 679830
# temporary ltwrapper_script.
Packit 679830
func_ltwrapper_scriptname ()
Packit 679830
{
Packit 679830
    func_dirname_and_basename "$1" "" "."
Packit 679830
    func_stripname '' '.exe' "$func_basename_result"
Packit 679830
    func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
Packit 679830
}
Packit 679830
Packit 679830
# func_ltwrapper_p file
Packit 679830
# True iff FILE is a libtool wrapper script or wrapper executable
Packit 679830
# This function is only a basic sanity check; it will hardly flush out
Packit 679830
# determined imposters.
Packit 679830
func_ltwrapper_p ()
Packit 679830
{
Packit 679830
    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_execute_cmds commands fail_cmd
Packit 679830
# Execute tilde-delimited COMMANDS.
Packit 679830
# If FAIL_CMD is given, eval that upon failure.
Packit 679830
# FAIL_CMD may read-access the current command in variable CMD!
Packit 679830
func_execute_cmds ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    save_ifs=$IFS; IFS='~'
Packit 679830
    for cmd in $1; do
Packit 679830
      IFS=$sp$nl
Packit 679830
      eval cmd=\"$cmd\"
Packit 679830
      IFS=$save_ifs
Packit 679830
      func_show_eval "$cmd" "${2-:}"
Packit 679830
    done
Packit 679830
    IFS=$save_ifs
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_source file
Packit 679830
# Source FILE, adding directory component if necessary.
Packit 679830
# Note that it is not necessary on cygwin/mingw to append a dot to
Packit 679830
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
Packit 679830
# behavior happens only for exec(3), not for open(2)!  Also, sourcing
Packit 679830
# 'FILE.' does not work on cygwin managed mounts.
Packit 679830
func_source ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    case $1 in
Packit 679830
    */* | *\\*)	. "$1" ;;
Packit 679830
    *)		. "./$1" ;;
Packit 679830
    esac
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_resolve_sysroot PATH
Packit 679830
# Replace a leading = in PATH with a sysroot.  Store the result into
Packit 679830
# func_resolve_sysroot_result
Packit 679830
func_resolve_sysroot ()
Packit 679830
{
Packit 679830
  func_resolve_sysroot_result=$1
Packit 679830
  case $func_resolve_sysroot_result in
Packit 679830
  =*)
Packit 679830
    func_stripname '=' '' "$func_resolve_sysroot_result"
Packit 679830
    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
Packit 679830
    ;;
Packit 679830
  esac
Packit 679830
}
Packit 679830
Packit 679830
# func_replace_sysroot PATH
Packit 679830
# If PATH begins with the sysroot, replace it with = and
Packit 679830
# store the result into func_replace_sysroot_result.
Packit 679830
func_replace_sysroot ()
Packit 679830
{
Packit 679830
  case $lt_sysroot:$1 in
Packit 679830
  ?*:"$lt_sysroot"*)
Packit 679830
    func_stripname "$lt_sysroot" '' "$1"
Packit 679830
    func_replace_sysroot_result='='$func_stripname_result
Packit 679830
    ;;
Packit 679830
  *)
Packit 679830
    # Including no sysroot.
Packit 679830
    func_replace_sysroot_result=$1
Packit 679830
    ;;
Packit 679830
  esac
Packit 679830
}
Packit 679830
Packit 679830
# func_infer_tag arg
Packit 679830
# Infer tagged configuration to use if any are available and
Packit 679830
# if one wasn't chosen via the "--tag" command line option.
Packit 679830
# Only attempt this if the compiler in the base compile
Packit 679830
# command doesn't match the default compiler.
Packit 679830
# arg is usually of the form 'gcc ...'
Packit 679830
func_infer_tag ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    if test -n "$available_tags" && test -z "$tagname"; then
Packit 679830
      CC_quoted=
Packit 679830
      for arg in $CC; do
Packit 679830
	func_append_quoted CC_quoted "$arg"
Packit 679830
      done
Packit 679830
      CC_expanded=`func_echo_all $CC`
Packit 679830
      CC_quoted_expanded=`func_echo_all $CC_quoted`
Packit 679830
      case $@ in
Packit 679830
      # Blanks in the command may have been stripped by the calling shell,
Packit 679830
      # but not from the CC environment variable when configure was run.
Packit 679830
      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
Packit 679830
      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
Packit 679830
      # Blanks at the start of $base_compile will cause this to fail
Packit 679830
      # if we don't check for them as well.
Packit 679830
      *)
Packit 679830
	for z in $available_tags; do
Packit 679830
	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
Packit 679830
	    # Evaluate the configuration.
Packit 679830
	    eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
Packit 679830
	    CC_quoted=
Packit 679830
	    for arg in $CC; do
Packit 679830
	      # Double-quote args containing other shell metacharacters.
Packit 679830
	      func_append_quoted CC_quoted "$arg"
Packit 679830
	    done
Packit 679830
	    CC_expanded=`func_echo_all $CC`
Packit 679830
	    CC_quoted_expanded=`func_echo_all $CC_quoted`
Packit 679830
	    case "$@ " in
Packit 679830
	    " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
Packit 679830
	    " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
Packit 679830
	      # The compiler in the base compile command matches
Packit 679830
	      # the one in the tagged configuration.
Packit 679830
	      # Assume this is the tagged configuration we want.
Packit 679830
	      tagname=$z
Packit 679830
	      break
Packit 679830
	      ;;
Packit 679830
	    esac
Packit 679830
	  fi
Packit 679830
	done
Packit 679830
	# If $tagname still isn't set, then no tagged configuration
Packit 679830
	# was found and let the user know that the "--tag" command
Packit 679830
	# line option must be used.
Packit 679830
	if test -z "$tagname"; then
Packit 679830
	  func_echo "unable to infer tagged configuration"
Packit 679830
	  func_fatal_error "specify a tag with '--tag'"
Packit 679830
#	else
Packit 679830
#	  func_verbose "using $tagname tagged configuration"
Packit 679830
	fi
Packit 679830
	;;
Packit 679830
      esac
Packit 679830
    fi
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
Packit 679830
# func_write_libtool_object output_name pic_name nonpic_name
Packit 679830
# Create a libtool object file (analogous to a ".la" file),
Packit 679830
# but don't create it if we're doing a dry run.
Packit 679830
func_write_libtool_object ()
Packit 679830
{
Packit 679830
    write_libobj=$1
Packit 679830
    if test yes = "$build_libtool_libs"; then
Packit 679830
      write_lobj=\'$2\'
Packit 679830
    else
Packit 679830
      write_lobj=none
Packit 679830
    fi
Packit 679830
Packit 679830
    if test yes = "$build_old_libs"; then
Packit 679830
      write_oldobj=\'$3\'
Packit 679830
    else
Packit 679830
      write_oldobj=none
Packit 679830
    fi
Packit 679830
Packit 679830
    $opt_dry_run || {
Packit 679830
      cat >${write_libobj}T <
Packit 679830
# $write_libobj - a libtool object file
Packit 679830
# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
Packit 679830
#
Packit 679830
# Please DO NOT delete this file!
Packit 679830
# It is necessary for linking the library.
Packit 679830
Packit 679830
# Name of the PIC object.
Packit 679830
pic_object=$write_lobj
Packit 679830
Packit 679830
# Name of the non-PIC object
Packit 679830
non_pic_object=$write_oldobj
Packit 679830
Packit 679830
EOF
Packit 679830
      $MV "${write_libobj}T" "$write_libobj"
Packit 679830
    }
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
##################################################
Packit 679830
# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
Packit 679830
##################################################
Packit 679830
Packit 679830
# func_convert_core_file_wine_to_w32 ARG
Packit 679830
# Helper function used by file name conversion functions when $build is *nix,
Packit 679830
# and $host is mingw, cygwin, or some other w32 environment. Relies on a
Packit 679830
# correctly configured wine environment available, with the winepath program
Packit 679830
# in $build's $PATH.
Packit 679830
#
Packit 679830
# ARG is the $build file name to be converted to w32 format.
Packit 679830
# Result is available in $func_convert_core_file_wine_to_w32_result, and will
Packit 679830
# be empty on error (or when ARG is empty)
Packit 679830
func_convert_core_file_wine_to_w32 ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  func_convert_core_file_wine_to_w32_result=$1
Packit 679830
  if test -n "$1"; then
Packit 679830
    # Unfortunately, winepath does not exit with a non-zero error code, so we
Packit 679830
    # are forced to check the contents of stdout. On the other hand, if the
Packit 679830
    # command is not found, the shell will set an exit code of 127 and print
Packit 679830
    # *an error message* to stdout. So we must check for both error code of
Packit 679830
    # zero AND non-empty stdout, which explains the odd construction:
Packit 679830
    func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
Packit 679830
    if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
Packit 679830
      func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
Packit 679830
        $SED -e "$sed_naive_backslashify"`
Packit 679830
    else
Packit 679830
      func_convert_core_file_wine_to_w32_result=
Packit 679830
    fi
Packit 679830
  fi
Packit 679830
}
Packit 679830
# end: func_convert_core_file_wine_to_w32
Packit 679830
Packit 679830
Packit 679830
# func_convert_core_path_wine_to_w32 ARG
Packit 679830
# Helper function used by path conversion functions when $build is *nix, and
Packit 679830
# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
Packit 679830
# configured wine environment available, with the winepath program in $build's
Packit 679830
# $PATH. Assumes ARG has no leading or trailing path separator characters.
Packit 679830
#
Packit 679830
# ARG is path to be converted from $build format to win32.
Packit 679830
# Result is available in $func_convert_core_path_wine_to_w32_result.
Packit 679830
# Unconvertible file (directory) names in ARG are skipped; if no directory names
Packit 679830
# are convertible, then the result may be empty.
Packit 679830
func_convert_core_path_wine_to_w32 ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  # unfortunately, winepath doesn't convert paths, only file names
Packit 679830
  func_convert_core_path_wine_to_w32_result=
Packit 679830
  if test -n "$1"; then
Packit 679830
    oldIFS=$IFS
Packit 679830
    IFS=:
Packit 679830
    for func_convert_core_path_wine_to_w32_f in $1; do
Packit 679830
      IFS=$oldIFS
Packit 679830
      func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
Packit 679830
      if test -n "$func_convert_core_file_wine_to_w32_result"; then
Packit 679830
        if test -z "$func_convert_core_path_wine_to_w32_result"; then
Packit 679830
          func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
Packit 679830
        else
Packit 679830
          func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
Packit 679830
        fi
Packit 679830
      fi
Packit 679830
    done
Packit 679830
    IFS=$oldIFS
Packit 679830
  fi
Packit 679830
}
Packit 679830
# end: func_convert_core_path_wine_to_w32
Packit 679830
Packit 679830
Packit 679830
# func_cygpath ARGS...
Packit 679830
# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
Packit 679830
# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
Packit 679830
# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
Packit 679830
# (2), returns the Cygwin file name or path in func_cygpath_result (input
Packit 679830
# file name or path is assumed to be in w32 format, as previously converted
Packit 679830
# from $build's *nix or MSYS format). In case (3), returns the w32 file name
Packit 679830
# or path in func_cygpath_result (input file name or path is assumed to be in
Packit 679830
# Cygwin format). Returns an empty string on error.
Packit 679830
#
Packit 679830
# ARGS are passed to cygpath, with the last one being the file name or path to
Packit 679830
# be converted.
Packit 679830
#
Packit 679830
# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
Packit 679830
# environment variable; do not put it in $PATH.
Packit 679830
func_cygpath ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
Packit 679830
    func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
Packit 679830
    if test "$?" -ne 0; then
Packit 679830
      # on failure, ensure result is empty
Packit 679830
      func_cygpath_result=
Packit 679830
    fi
Packit 679830
  else
Packit 679830
    func_cygpath_result=
Packit 679830
    func_error "LT_CYGPATH is empty or specifies non-existent file: '$LT_CYGPATH'"
Packit 679830
  fi
Packit 679830
}
Packit 679830
#end: func_cygpath
Packit 679830
Packit 679830
Packit 679830
# func_convert_core_msys_to_w32 ARG
Packit 679830
# Convert file name or path ARG from MSYS format to w32 format.  Return
Packit 679830
# result in func_convert_core_msys_to_w32_result.
Packit 679830
func_convert_core_msys_to_w32 ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  # awkward: cmd appends spaces to result
Packit 679830
  func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
Packit 679830
    $SED -e 's/[ ]*$//' -e "$sed_naive_backslashify"`
Packit 679830
}
Packit 679830
#end: func_convert_core_msys_to_w32
Packit 679830
Packit 679830
Packit 679830
# func_convert_file_check ARG1 ARG2
Packit 679830
# Verify that ARG1 (a file name in $build format) was converted to $host
Packit 679830
# format in ARG2. Otherwise, emit an error message, but continue (resetting
Packit 679830
# func_to_host_file_result to ARG1).
Packit 679830
func_convert_file_check ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  if test -z "$2" && test -n "$1"; then
Packit 679830
    func_error "Could not determine host file name corresponding to"
Packit 679830
    func_error "  '$1'"
Packit 679830
    func_error "Continuing, but uninstalled executables may not work."
Packit 679830
    # Fallback:
Packit 679830
    func_to_host_file_result=$1
Packit 679830
  fi
Packit 679830
}
Packit 679830
# end func_convert_file_check
Packit 679830
Packit 679830
Packit 679830
# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
Packit 679830
# Verify that FROM_PATH (a path in $build format) was converted to $host
Packit 679830
# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
Packit 679830
# func_to_host_file_result to a simplistic fallback value (see below).
Packit 679830
func_convert_path_check ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  if test -z "$4" && test -n "$3"; then
Packit 679830
    func_error "Could not determine the host path corresponding to"
Packit 679830
    func_error "  '$3'"
Packit 679830
    func_error "Continuing, but uninstalled executables may not work."
Packit 679830
    # Fallback.  This is a deliberately simplistic "conversion" and
Packit 679830
    # should not be "improved".  See libtool.info.
Packit 679830
    if test "x$1" != "x$2"; then
Packit 679830
      lt_replace_pathsep_chars="s|$1|$2|g"
Packit 679830
      func_to_host_path_result=`echo "$3" |
Packit 679830
        $SED -e "$lt_replace_pathsep_chars"`
Packit 679830
    else
Packit 679830
      func_to_host_path_result=$3
Packit 679830
    fi
Packit 679830
  fi
Packit 679830
}
Packit 679830
# end func_convert_path_check
Packit 679830
Packit 679830
Packit 679830
# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
Packit 679830
# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
Packit 679830
# and appending REPL if ORIG matches BACKPAT.
Packit 679830
func_convert_path_front_back_pathsep ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  case $4 in
Packit 679830
  $1 ) func_to_host_path_result=$3$func_to_host_path_result
Packit 679830
    ;;
Packit 679830
  esac
Packit 679830
  case $4 in
Packit 679830
  $2 ) func_append func_to_host_path_result "$3"
Packit 679830
    ;;
Packit 679830
  esac
Packit 679830
}
Packit 679830
# end func_convert_path_front_back_pathsep
Packit 679830
Packit 679830
Packit 679830
##################################################
Packit 679830
# $build to $host FILE NAME CONVERSION FUNCTIONS #
Packit 679830
##################################################
Packit 679830
# invoked via '$to_host_file_cmd ARG'
Packit 679830
#
Packit 679830
# In each case, ARG is the path to be converted from $build to $host format.
Packit 679830
# Result will be available in $func_to_host_file_result.
Packit 679830
Packit 679830
Packit 679830
# func_to_host_file ARG
Packit 679830
# Converts the file name ARG from $build format to $host format. Return result
Packit 679830
# in func_to_host_file_result.
Packit 679830
func_to_host_file ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  $to_host_file_cmd "$1"
Packit 679830
}
Packit 679830
# end func_to_host_file
Packit 679830
Packit 679830
Packit 679830
# func_to_tool_file ARG LAZY
Packit 679830
# converts the file name ARG from $build format to toolchain format. Return
Packit 679830
# result in func_to_tool_file_result.  If the conversion in use is listed
Packit 679830
# in (the comma separated) LAZY, no conversion takes place.
Packit 679830
func_to_tool_file ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  case ,$2, in
Packit 679830
    *,"$to_tool_file_cmd",*)
Packit 679830
      func_to_tool_file_result=$1
Packit 679830
      ;;
Packit 679830
    *)
Packit 679830
      $to_tool_file_cmd "$1"
Packit 679830
      func_to_tool_file_result=$func_to_host_file_result
Packit 679830
      ;;
Packit 679830
  esac
Packit 679830
}
Packit 679830
# end func_to_tool_file
Packit 679830
Packit 679830
Packit 679830
# func_convert_file_noop ARG
Packit 679830
# Copy ARG to func_to_host_file_result.
Packit 679830
func_convert_file_noop ()
Packit 679830
{
Packit 679830
  func_to_host_file_result=$1
Packit 679830
}
Packit 679830
# end func_convert_file_noop
Packit 679830
Packit 679830
Packit 679830
# func_convert_file_msys_to_w32 ARG
Packit 679830
# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
Packit 679830
# conversion to w32 is not available inside the cwrapper.  Returns result in
Packit 679830
# func_to_host_file_result.
Packit 679830
func_convert_file_msys_to_w32 ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  func_to_host_file_result=$1
Packit 679830
  if test -n "$1"; then
Packit 679830
    func_convert_core_msys_to_w32 "$1"
Packit 679830
    func_to_host_file_result=$func_convert_core_msys_to_w32_result
Packit 679830
  fi
Packit 679830
  func_convert_file_check "$1" "$func_to_host_file_result"
Packit 679830
}
Packit 679830
# end func_convert_file_msys_to_w32
Packit 679830
Packit 679830
Packit 679830
# func_convert_file_cygwin_to_w32 ARG
Packit 679830
# Convert file name ARG from Cygwin to w32 format.  Returns result in
Packit 679830
# func_to_host_file_result.
Packit 679830
func_convert_file_cygwin_to_w32 ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  func_to_host_file_result=$1
Packit 679830
  if test -n "$1"; then
Packit 679830
    # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
Packit 679830
    # LT_CYGPATH in this case.
Packit 679830
    func_to_host_file_result=`cygpath -m "$1"`
Packit 679830
  fi
Packit 679830
  func_convert_file_check "$1" "$func_to_host_file_result"
Packit 679830
}
Packit 679830
# end func_convert_file_cygwin_to_w32
Packit 679830
Packit 679830
Packit 679830
# func_convert_file_nix_to_w32 ARG
Packit 679830
# Convert file name ARG from *nix to w32 format.  Requires a wine environment
Packit 679830
# and a working winepath. Returns result in func_to_host_file_result.
Packit 679830
func_convert_file_nix_to_w32 ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  func_to_host_file_result=$1
Packit 679830
  if test -n "$1"; then
Packit 679830
    func_convert_core_file_wine_to_w32 "$1"
Packit 679830
    func_to_host_file_result=$func_convert_core_file_wine_to_w32_result
Packit 679830
  fi
Packit 679830
  func_convert_file_check "$1" "$func_to_host_file_result"
Packit 679830
}
Packit 679830
# end func_convert_file_nix_to_w32
Packit 679830
Packit 679830
Packit 679830
# func_convert_file_msys_to_cygwin ARG
Packit 679830
# Convert file name ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
Packit 679830
# Returns result in func_to_host_file_result.
Packit 679830
func_convert_file_msys_to_cygwin ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  func_to_host_file_result=$1
Packit 679830
  if test -n "$1"; then
Packit 679830
    func_convert_core_msys_to_w32 "$1"
Packit 679830
    func_cygpath -u "$func_convert_core_msys_to_w32_result"
Packit 679830
    func_to_host_file_result=$func_cygpath_result
Packit 679830
  fi
Packit 679830
  func_convert_file_check "$1" "$func_to_host_file_result"
Packit 679830
}
Packit 679830
# end func_convert_file_msys_to_cygwin
Packit 679830
Packit 679830
Packit 679830
# func_convert_file_nix_to_cygwin ARG
Packit 679830
# Convert file name ARG from *nix to Cygwin format.  Requires Cygwin installed
Packit 679830
# in a wine environment, working winepath, and LT_CYGPATH set.  Returns result
Packit 679830
# in func_to_host_file_result.
Packit 679830
func_convert_file_nix_to_cygwin ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  func_to_host_file_result=$1
Packit 679830
  if test -n "$1"; then
Packit 679830
    # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
Packit 679830
    func_convert_core_file_wine_to_w32 "$1"
Packit 679830
    func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
Packit 679830
    func_to_host_file_result=$func_cygpath_result
Packit 679830
  fi
Packit 679830
  func_convert_file_check "$1" "$func_to_host_file_result"
Packit 679830
}
Packit 679830
# end func_convert_file_nix_to_cygwin
Packit 679830
Packit 679830
Packit 679830
#############################################
Packit 679830
# $build to $host PATH CONVERSION FUNCTIONS #
Packit 679830
#############################################
Packit 679830
# invoked via '$to_host_path_cmd ARG'
Packit 679830
#
Packit 679830
# In each case, ARG is the path to be converted from $build to $host format.
Packit 679830
# The result will be available in $func_to_host_path_result.
Packit 679830
#
Packit 679830
# Path separators are also converted from $build format to $host format.  If
Packit 679830
# ARG begins or ends with a path separator character, it is preserved (but
Packit 679830
# converted to $host format) on output.
Packit 679830
#
Packit 679830
# All path conversion functions are named using the following convention:
Packit 679830
#   file name conversion function    : func_convert_file_X_to_Y ()
Packit 679830
#   path conversion function         : func_convert_path_X_to_Y ()
Packit 679830
# where, for any given $build/$host combination the 'X_to_Y' value is the
Packit 679830
# same.  If conversion functions are added for new $build/$host combinations,
Packit 679830
# the two new functions must follow this pattern, or func_init_to_host_path_cmd
Packit 679830
# will break.
Packit 679830
Packit 679830
Packit 679830
# func_init_to_host_path_cmd
Packit 679830
# Ensures that function "pointer" variable $to_host_path_cmd is set to the
Packit 679830
# appropriate value, based on the value of $to_host_file_cmd.
Packit 679830
to_host_path_cmd=
Packit 679830
func_init_to_host_path_cmd ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  if test -z "$to_host_path_cmd"; then
Packit 679830
    func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
Packit 679830
    to_host_path_cmd=func_convert_path_$func_stripname_result
Packit 679830
  fi
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_to_host_path ARG
Packit 679830
# Converts the path ARG from $build format to $host format. Return result
Packit 679830
# in func_to_host_path_result.
Packit 679830
func_to_host_path ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  func_init_to_host_path_cmd
Packit 679830
  $to_host_path_cmd "$1"
Packit 679830
}
Packit 679830
# end func_to_host_path
Packit 679830
Packit 679830
Packit 679830
# func_convert_path_noop ARG
Packit 679830
# Copy ARG to func_to_host_path_result.
Packit 679830
func_convert_path_noop ()
Packit 679830
{
Packit 679830
  func_to_host_path_result=$1
Packit 679830
}
Packit 679830
# end func_convert_path_noop
Packit 679830
Packit 679830
Packit 679830
# func_convert_path_msys_to_w32 ARG
Packit 679830
# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
Packit 679830
# conversion to w32 is not available inside the cwrapper.  Returns result in
Packit 679830
# func_to_host_path_result.
Packit 679830
func_convert_path_msys_to_w32 ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  func_to_host_path_result=$1
Packit 679830
  if test -n "$1"; then
Packit 679830
    # Remove leading and trailing path separator characters from ARG.  MSYS
Packit 679830
    # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
Packit 679830
    # and winepath ignores them completely.
Packit 679830
    func_stripname : : "$1"
Packit 679830
    func_to_host_path_tmp1=$func_stripname_result
Packit 679830
    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
Packit 679830
    func_to_host_path_result=$func_convert_core_msys_to_w32_result
Packit 679830
    func_convert_path_check : ";" \
Packit 679830
      "$func_to_host_path_tmp1" "$func_to_host_path_result"
Packit 679830
    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
Packit 679830
  fi
Packit 679830
}
Packit 679830
# end func_convert_path_msys_to_w32
Packit 679830
Packit 679830
Packit 679830
# func_convert_path_cygwin_to_w32 ARG
Packit 679830
# Convert path ARG from Cygwin to w32 format.  Returns result in
Packit 679830
# func_to_host_file_result.
Packit 679830
func_convert_path_cygwin_to_w32 ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  func_to_host_path_result=$1
Packit 679830
  if test -n "$1"; then
Packit 679830
    # See func_convert_path_msys_to_w32:
Packit 679830
    func_stripname : : "$1"
Packit 679830
    func_to_host_path_tmp1=$func_stripname_result
Packit 679830
    func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
Packit 679830
    func_convert_path_check : ";" \
Packit 679830
      "$func_to_host_path_tmp1" "$func_to_host_path_result"
Packit 679830
    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
Packit 679830
  fi
Packit 679830
}
Packit 679830
# end func_convert_path_cygwin_to_w32
Packit 679830
Packit 679830
Packit 679830
# func_convert_path_nix_to_w32 ARG
Packit 679830
# Convert path ARG from *nix to w32 format.  Requires a wine environment and
Packit 679830
# a working winepath.  Returns result in func_to_host_file_result.
Packit 679830
func_convert_path_nix_to_w32 ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  func_to_host_path_result=$1
Packit 679830
  if test -n "$1"; then
Packit 679830
    # See func_convert_path_msys_to_w32:
Packit 679830
    func_stripname : : "$1"
Packit 679830
    func_to_host_path_tmp1=$func_stripname_result
Packit 679830
    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
Packit 679830
    func_to_host_path_result=$func_convert_core_path_wine_to_w32_result
Packit 679830
    func_convert_path_check : ";" \
Packit 679830
      "$func_to_host_path_tmp1" "$func_to_host_path_result"
Packit 679830
    func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
Packit 679830
  fi
Packit 679830
}
Packit 679830
# end func_convert_path_nix_to_w32
Packit 679830
Packit 679830
Packit 679830
# func_convert_path_msys_to_cygwin ARG
Packit 679830
# Convert path ARG from MSYS to Cygwin format.  Requires LT_CYGPATH set.
Packit 679830
# Returns result in func_to_host_file_result.
Packit 679830
func_convert_path_msys_to_cygwin ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  func_to_host_path_result=$1
Packit 679830
  if test -n "$1"; then
Packit 679830
    # See func_convert_path_msys_to_w32:
Packit 679830
    func_stripname : : "$1"
Packit 679830
    func_to_host_path_tmp1=$func_stripname_result
Packit 679830
    func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
Packit 679830
    func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
Packit 679830
    func_to_host_path_result=$func_cygpath_result
Packit 679830
    func_convert_path_check : : \
Packit 679830
      "$func_to_host_path_tmp1" "$func_to_host_path_result"
Packit 679830
    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
Packit 679830
  fi
Packit 679830
}
Packit 679830
# end func_convert_path_msys_to_cygwin
Packit 679830
Packit 679830
Packit 679830
# func_convert_path_nix_to_cygwin ARG
Packit 679830
# Convert path ARG from *nix to Cygwin format.  Requires Cygwin installed in a
Packit 679830
# a wine environment, working winepath, and LT_CYGPATH set.  Returns result in
Packit 679830
# func_to_host_file_result.
Packit 679830
func_convert_path_nix_to_cygwin ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  func_to_host_path_result=$1
Packit 679830
  if test -n "$1"; then
Packit 679830
    # Remove leading and trailing path separator characters from
Packit 679830
    # ARG. msys behavior is inconsistent here, cygpath turns them
Packit 679830
    # into '.;' and ';.', and winepath ignores them completely.
Packit 679830
    func_stripname : : "$1"
Packit 679830
    func_to_host_path_tmp1=$func_stripname_result
Packit 679830
    func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
Packit 679830
    func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
Packit 679830
    func_to_host_path_result=$func_cygpath_result
Packit 679830
    func_convert_path_check : : \
Packit 679830
      "$func_to_host_path_tmp1" "$func_to_host_path_result"
Packit 679830
    func_convert_path_front_back_pathsep ":*" "*:" : "$1"
Packit 679830
  fi
Packit 679830
}
Packit 679830
# end func_convert_path_nix_to_cygwin
Packit 679830
Packit 679830
Packit 679830
# func_dll_def_p FILE
Packit 679830
# True iff FILE is a Windows DLL '.def' file.
Packit 679830
# Keep in sync with _LT_DLL_DEF_P in libtool.m4
Packit 679830
func_dll_def_p ()
Packit 679830
{
Packit 679830
  $debug_cmd
Packit 679830
Packit 679830
  func_dll_def_p_tmp=`$SED -n \
Packit 679830
    -e 's/^[	 ]*//' \
Packit 679830
    -e '/^\(;.*\)*$/d' \
Packit 679830
    -e 's/^\(EXPORTS\|LIBRARY\)\([	 ].*\)*$/DEF/p' \
Packit 679830
    -e q \
Packit 679830
    "$1"`
Packit 679830
  test DEF = "$func_dll_def_p_tmp"
Packit 679830
}
Packit 679830
Packit 679830
Packit 679830
# func_mode_compile arg...
Packit 679830
func_mode_compile ()
Packit 679830
{
Packit 679830
    $debug_cmd
Packit 679830
Packit 679830
    # Get the compilation command and the source file.
Packit 679830
    base_compile=
Packit 679830
    srcfile=$nonopt  #  always keep a non-empty value in "srcfile"
Packit 679830
    suppress_opt=yes
Packit 679830
    suppress_output=
Packit 679830
    arg_mode=normal
Packit 679830
    libobj=
Packit 679830
    later=
Packit 679830
    pie_flag=
Packit 679830
Packit 679830
    for arg
Packit 679830
    do
Packit 679830
      case $arg_mode in
Packit 679830
      arg  )
Packit 679830
	# do not "continue".  Instead, add this to base_compile
Packit 679830
	lastarg=$arg
Packit 679830
	arg_mode=normal
Packit 679830
	;;
Packit 679830
Packit 679830
      target )
Packit 679830
	libobj=$arg
Packit 679830
	arg_mode=normal
Packit 679830
	continue
Packit 679830
	;;
Packit 679830
Packit 679830
      normal )
Packit 679830
	# Accept any command-line options.
Packit 679830
	case $arg in
Packit 679830
	-o)
Packit 679830
	  test -n "$libobj" && \
Packit 679830
	    func_fatal_error "you cannot specify '-o' more than once"
Packit 679830
	  arg_mode=target
Packit 679830
	  continue
Packit 679830
	  ;;
Packit 679830
Packit 679830
	-pie | -fpie | -fPIE)
Packit 679830
          func_append pie_flag " $arg"
Packit 679830
	  continue
Packit 679830
	  ;;
Packit 679830
Packit 679830
	-shared | -static | -prefer-pic | -prefer-non-pic)
Packit 679830
	  func_append later " $arg"
Packit 679830
	  continue
Packit 679830
	  ;;
Packit 679830
Packit 679830
	-no-suppress)
Packit 679830
	  suppress_opt=no
Packit 679830
	  continue
Packit 679830
	  ;;
Packit 679830
Packit 679830
	-Xcompiler)
Packit 679830
	  arg_mode=arg  #  the next one goes into the "base_compile" arg list
Packit 679830
	  continue      #  The current "srcfile" will either be retained or
Packit 679830
	  ;;            #  replaced later.  I would guess that would be a bug.
Packit 679830
Packit 679830
	-Wc,*)
Packit 679830
	  func_stripname '-Wc,' '' "$arg"
Packit 679830
	  args=$func_stripname_result
Packit 679830
	  lastarg=
Packit 679830
	  save_ifs=$IFS; IFS=,
Packit 679830
	  for arg in $args; do
Packit 679830
	    IFS=$save_ifs
Packit 679830
	    func_append_quoted lastarg "$arg"
Packit 679830
	  done
Packit 679830
	  IFS=$save_ifs
Packit 679830
	  func_stripname ' ' '' "$lastarg"
Packit 679830
	  lastarg=$func_stripname_result
Packit 679830
Packit 679830
	  # Add the arguments to base_compile.
Packit 679830
	  func_append base_compile " $lastarg"
Packit 679830
	  continue
Packit 679830
	  ;;
Packit 679830
Packit 679830
	*)
Packit 679830
	  # Accept the current argument as the source file.
Packit 679830
	  # The previous "srcfile" becomes the current argument.
Packit 679830
	  #
Packit 679830
	  lastarg=$srcfile
Packit 679830
	  srcfile=$arg
Packit 679830
	  ;;
Packit 679830
	esac  #  case $arg
Packit 679830
	;;
Packit 679830
      esac    #  case $arg_mode
Packit 679830
Packit 679830
      # Aesthetically quote the previous argument.
Packit 679830
      func_append_quoted base_compile "$lastarg"
Packit 679830
    done # for arg
Packit 679830
Packit 679830
    case $arg_mode in
Packit 679830
    arg)
Packit 679830
      func_fatal_error "you must specify an argument for -Xcompile"
Packit 679830
      ;;
Packit 679830
    target)
Packit 679830
      func_fatal_error "you must specify a target with '-o'"
Packit 679830
      ;;
Packit 679830
    *)
Packit 679830
      # Get the name of the library object.
Packit 679830
      test -z "$libobj" && {
Packit 679830
	func_basename "$srcfile"
Packit 679830
	libobj=$func_basename_result
Packit 679830
      }
Packit 679830
      ;;
Packit 679830
    esac
Packit 679830
Packit 679830
    # Recognize several different file suffixes.
Packit 679830
    # If the user specifies -o file.o, it is replaced with file.lo
Packit 679830
    case $libobj in
Packit 679830
    *.[cCFSifmso] | \
Packit 679830
    *.ada | *.adb | *.ads | *.asm | \
Packit 679830
    *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
Packit 679830
    *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
Packit 679830
      func_xform "$libobj"
Packit 679830
      libobj=$func_xform_result
Packit 679830
      ;;
Packit 679830
    esac
Packit 679830
Packit 679830
    case $libobj in
Packit 679830
    *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
Packit 679830
    *)
Packit 679830
      func_fatal_error "cannot determine name of library object from '$libobj'"
Packit 679830
      ;;
Packit 679830
    esac
Packit 679830
Packit 679830
    func_infer_tag $base_compile
Packit 679830
Packit 679830
    for arg in $later; do
Packit 679830
      case $arg in
Packit 679830
      -shared)
Packit 679830
	test yes = "$build_libtool_libs" \
Packit 679830
	  || func_fatal_configuration "cannot build a shared library"
Packit 679830
	build_old_libs=no
Packit 679830
	continue
Packit 679830
	;;
Packit 679830
Packit 679830
      -static)
Packit 679830
	build_libtool_libs=no
Packit 679830
	build_old_libs=yes
Packit 679830
	continue
Packit 679830
	;;
Packit 679830
Packit 679830
      -prefer-pic)
Packit 679830
	pic_mode=yes
Packit 679830
	continue
Packit 679830
	;;
Packit 679830
Packit 679830
      -prefer-non-pic)
Packit 679830
	pic_mode=no
Packit 679830
	continue
Packit 679830
	;;
Packit 679830
      esac
Packit 679830
    done
Packit 679830
Packit 679830
    func_quote_for_eval "$libobj"
Packit 679830
    test "X$libobj" != "X$func_quote_for_eval_result" \
Packit 679830
      && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"'	 &()|`$[]' \
Packit 679830
      && func_warning "libobj name '$libobj' may not contain shell special characters."
Packit 679830
    func_dirname_and_basename "$obj" "/" ""
Packit 679830
    objname=$func_basename_result
Packit 679830
    xdir=$func_dirname_result
Packit 679830
    lobj=$xdir$objdir/$objname
Packit 679830
Packit 679830
    test -z "$base_compile" && \
Packit 679830
      func_fatal_help "you must specify a compilation command"
Packit 679830
Packit 679830
    # Delete any leftover library objects.
Packit 679830
    if test yes = "$build_old_libs"; then
Packit 679830
      removelist="$obj $lobj $libobj ${libobj}T"
Packit 679830
    else
Packit 679830
      removelist="$lobj $libobj ${libobj}T"
Packit 679830
    fi
Packit 679830
Packit 679830
    # On Cygwin there's no "real" PIC flag so we must build both object types
Packit 679830
    case $host_os in
Packit 679830
    cygwin* | mingw* | pw32* | os2* | cegcc*)
Packit 679830
      pic_mode=default
Packit 679830
      ;;
Packit 679830
    esac
Packit 679830
    if test no = "$pic_mode" && test pass_all != "$deplibs_check_method"; then
Packit 679830
      # non-PIC code in shared libraries is not supported
Packit 679830
      pic_mode=default
Packit 679830
    fi
Packit 679830
Packit 679830
    # Calculate the filename of the output object if compiler does
Packit 679830
    # not support -o with -c
Packit 679830
    if test no = "$compiler_c_o"; then
Packit 679830
      output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.$objext
Packit 679830
      lockfile=$output_obj.lock
Packit 679830
    else
Packit 679830
      output_obj=
Packit 679830
      need_locks=no
Packit 679830
      lockfile=
Packit 679830
    fi
Packit 679830
Packit 679830
    # Lock this critical section if it is needed
Packit 679830
    # We use this script file to make the link, it avoids creating a new file
Packit 679830
    if test yes = "$need_locks"; then
Packit 679830
      until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
Packit 679830
	func_echo "Waiting for $lockfile to be removed"
Packit 679830
	sleep 2
Packit 679830
      done
Packit 679830
    elif test warn = "$need_locks"; then
Packit 679830
      if test -f "$lockfile"; then
Packit 679830
	$ECHO "\
Packit 679830
*** ERROR, $lockfile exists and contains:
Packit 679830
`cat $lockfile 2>/dev/null`
Packit 679830
Packit 679830
This indicates that another process is trying to use the same
Packit 679830
temporary object file, and libtool could not work around it because
Packit 679830
your compiler does not support '-c' and '-o' together.  If you
Packit 679830
repeat this compilation, it may succeed, by chance, but you had better
Packit 679830
avoid parallel builds (make -j) in this platform, or get a better
Packit 679830
compiler."
Packit 679830
Packit 679830
	$opt_dry_run || $RM $removelist
Packit 679830
	exit $EXIT_FAILURE
Packit 679830
      fi
Packit 679830
      func_append removelist " $output_obj"
Packit 679830
      $ECHO "$srcfile" > "$lockfile"
Packit 679830
    fi
Packit 679830
Packit 679830
    $opt_dry_run || $RM $removelist
Packit 679830
    func_append removelist " $lockfile"
Packit 679830
    trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
Packit 679830
Packit 679830
    func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
Packit 679830
    srcfile=$func_to_tool_file_result
Packit 679830
    func_quote_for_eval "$srcfile"
Packit 679830
    qsrcfile=$func_quote_for_eval_result
Packit 679830
Packit 679830
    # Only build a PIC object if we are building libtool libraries.
Packit 679830
    if test yes = "$build_libtool_libs"; then
Packit 679830
      # Without this assignment, base_compile gets emptied.
Packit 679830
      fbsd_hideous_sh_bug=$base_compile
Packit 679830
Packit 679830
      if test no != "$pic_mode"; then
Packit 679830
	command="$base_compile $qsrcfile $pic_flag"
Packit 679830
      else
Packit 679830
	# Don't build PIC code
Packit 679830
	command="$base_compile $qsrcfile"
Packit 679830
      fi
Packit 679830
Packit 679830
      func_mkdir_p "$xdir$objdir"
Packit 679830
Packit