Blame ltmain.sh

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