Blame ltmain.sh

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