Blame ltmain.sh

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