Blame libtool

<
Packit 4a16fb
#! /bin/sh
Packit 4a16fb
# Generated automatically by config.status (alsa-lib) 1.2.1.2
Packit 4a16fb
# Libtool was configured on host e010f88cea4a:
Packit 4a16fb
# NOTE: Changes made to this file will be lost: look at ltmain.sh.
Packit 4a16fb
Packit 4a16fb
# Provide generalized library-building support services.
Packit 4a16fb
# Written by Gordon Matzigkeit, 1996
Packit 4a16fb
Packit 4a16fb
# Copyright (C) 2014 Free Software Foundation, Inc.
Packit 4a16fb
# This is free software; see the source for copying conditions.  There is NO
Packit 4a16fb
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Packit 4a16fb
Packit 4a16fb
# GNU Libtool is free software; you can redistribute it and/or modify
Packit 4a16fb
# it under the terms of the GNU General Public License as published by
Packit 4a16fb
# the Free Software Foundation; either version 2 of of the License, or
Packit 4a16fb
# (at your option) any later version.
Packit 4a16fb
#
Packit 4a16fb
# As a special exception to the GNU General Public License, if you
Packit 4a16fb
# distribute this file as part of a program or library that is built
Packit 4a16fb
# using GNU Libtool, you may include this file under the  same
Packit 4a16fb
# distribution terms that you use for the rest of that program.
Packit 4a16fb
#
Packit 4a16fb
# GNU Libtool is distributed in the hope that it will be useful, but
Packit 4a16fb
# WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 4a16fb
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 4a16fb
# GNU General Public License for more details.
Packit 4a16fb
#
Packit 4a16fb
# You should have received a copy of the GNU General Public License
Packit 4a16fb
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# The names of the tagged configurations supported by this script.
Packit 4a16fb
available_tags=''
Packit 4a16fb
Packit 4a16fb
# Configured defaults for sys_lib_dlsearch_path munging.
Packit 4a16fb
: ${LT_SYS_LIBRARY_PATH=""}
Packit 4a16fb
Packit 4a16fb
# ### BEGIN LIBTOOL CONFIG
Packit 4a16fb
Packit 4a16fb
# Whether or not to build static libraries.
Packit 4a16fb
build_old_libs=no
Packit 4a16fb
Packit 4a16fb
# Which release of libtool.m4 was used?
Packit 4a16fb
macro_version=2.4.6
Packit 4a16fb
macro_revision=2.4.6
Packit 4a16fb
Packit 4a16fb
# Whether or not to build shared libraries.
Packit 4a16fb
build_libtool_libs=yes
Packit 4a16fb
Packit 4a16fb
# What type of objects to build.
Packit 4a16fb
pic_mode=default
Packit 4a16fb
Packit 4a16fb
# Whether or not to optimize for fast installation.
Packit 4a16fb
fast_install=yes
Packit 4a16fb
Packit 4a16fb
# Shared archive member basename,for filename based shared library versioning on AIX.
Packit 4a16fb
shared_archive_member_spec=
Packit 4a16fb
Packit 4a16fb
# Shell to use when invoking shell scripts.
Packit 4a16fb
SHELL="/bin/sh"
Packit 4a16fb
Packit 4a16fb
# An echo program that protects backslashes.
Packit 4a16fb
ECHO="printf %s\\n"
Packit 4a16fb
Packit 4a16fb
# The PATH separator for the build system.
Packit 4a16fb
PATH_SEPARATOR=":"
Packit 4a16fb
Packit 4a16fb
# The host system.
Packit 4a16fb
host_alias=
Packit 4a16fb
host=x86_64-pc-linux-gnu
Packit 4a16fb
host_os=linux-gnu
Packit 4a16fb
Packit 4a16fb
# The build system.
Packit 4a16fb
build_alias=
Packit 4a16fb
build=x86_64-pc-linux-gnu
Packit 4a16fb
build_os=linux-gnu
Packit 4a16fb
Packit 4a16fb
# A sed program that does not truncate output.
Packit 4a16fb
SED="/usr/bin/sed"
Packit 4a16fb
Packit 4a16fb
# Sed that helps us avoid accidentally triggering echo(1) options like -n.
Packit 4a16fb
Xsed="$SED -e 1s/^X//"
Packit 4a16fb
Packit 4a16fb
# A grep program that handles long lines.
Packit 4a16fb
GREP="/usr/bin/grep"
Packit 4a16fb
Packit 4a16fb
# An ERE matcher.
Packit 4a16fb
EGREP="/usr/bin/grep -E"
Packit 4a16fb
Packit 4a16fb
# A literal string matcher.
Packit 4a16fb
FGREP="/usr/bin/grep -F"
Packit 4a16fb
Packit 4a16fb
# A BSD- or MS-compatible name lister.
Packit 4a16fb
NM="/usr/bin/nm -B"
Packit 4a16fb
Packit 4a16fb
# Whether we need soft or hard links.
Packit 4a16fb
LN_S="ln -s"
Packit 4a16fb
Packit 4a16fb
# What is the maximum length of a command?
Packit 4a16fb
max_cmd_len=1572864
Packit 4a16fb
Packit 4a16fb
# Object file suffix (normally "o").
Packit 4a16fb
objext=o
Packit 4a16fb
Packit 4a16fb
# Executable file suffix (normally "").
Packit 4a16fb
exeext=
Packit 4a16fb
Packit 4a16fb
# whether the shell understands "unset".
Packit 4a16fb
lt_unset=unset
Packit 4a16fb
Packit 4a16fb
# turn spaces into newlines.
Packit 4a16fb
SP2NL="tr \\040 \\012"
Packit 4a16fb
Packit 4a16fb
# turn newlines into spaces.
Packit 4a16fb
NL2SP="tr \\015\\012 \\040\\040"
Packit 4a16fb
Packit 4a16fb
# convert $build file names to $host format.
Packit 4a16fb
to_host_file_cmd=func_convert_file_noop
Packit 4a16fb
Packit 4a16fb
# convert $build files to toolchain format.
Packit 4a16fb
to_tool_file_cmd=func_convert_file_noop
Packit 4a16fb
Packit 4a16fb
# An object symbol dumper.
Packit 4a16fb
OBJDUMP="objdump"
Packit 4a16fb
Packit 4a16fb
# Method to check whether dependent libraries are shared objects.
Packit 4a16fb
deplibs_check_method="pass_all"
Packit 4a16fb
Packit 4a16fb
# Command to use when deplibs_check_method = "file_magic".
Packit 4a16fb
file_magic_cmd="\$MAGIC_CMD"
Packit 4a16fb
Packit 4a16fb
# How to find potential files when deplibs_check_method = "file_magic".
Packit 4a16fb
file_magic_glob=""
Packit 4a16fb
Packit 4a16fb
# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
Packit 4a16fb
want_nocaseglob="no"
Packit 4a16fb
Packit 4a16fb
# DLL creation program.
Packit 4a16fb
DLLTOOL="false"
Packit 4a16fb
Packit 4a16fb
# Command to associate shared and link libraries.
Packit 4a16fb
sharedlib_from_linklib_cmd="printf %s\\n"
Packit 4a16fb
Packit 4a16fb
# The archiver.
Packit 4a16fb
AR="ar"
Packit 4a16fb
Packit 4a16fb
# Flags to create an archive.
Packit 4a16fb
AR_FLAGS="cru"
Packit 4a16fb
Packit 4a16fb
# How to feed a file listing to the archiver.
Packit 4a16fb
archiver_list_spec="@"
Packit 4a16fb
Packit 4a16fb
# A symbol stripping program.
Packit 4a16fb
STRIP="strip"
Packit 4a16fb
Packit 4a16fb
# Commands used to install an old-style archive.
Packit 4a16fb
RANLIB="ranlib"
Packit 4a16fb
old_postinstall_cmds="chmod 644 \$oldlib~\$RANLIB \$tool_oldlib"
Packit 4a16fb
old_postuninstall_cmds=""
Packit 4a16fb
Packit 4a16fb
# Whether to use a lock for old archive extraction.
Packit 4a16fb
lock_old_archive_extraction=no
Packit 4a16fb
Packit 4a16fb
# A C compiler.
Packit 4a16fb
LTCC="gcc"
Packit 4a16fb
Packit 4a16fb
# LTCC compiler flags.
Packit 4a16fb
LTCFLAGS="-O2 -fomit-frame-pointer -Wall -pipe"
Packit 4a16fb
Packit 4a16fb
# Take the output of nm and produce a listing of raw symbols and C names.
Packit 4a16fb
global_symbol_pipe="sed -n -e 's/^.*[	 ]\\([ABCDGIRSTW][ABCDGIRSTW]*\\)[	 ][	 ]*\\([_A-Za-z][_A-Za-z0-9]*\\)\$/\\1 \\2 \\2/p' | sed '/ __gnu_lto/d'"
Packit 4a16fb
Packit 4a16fb
# Transform the output of nm in a proper C declaration.
Packit 4a16fb
global_symbol_to_cdecl="sed -n -e 's/^T .* \\(.*\\)\$/extern int \\1();/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/extern char \\1;/p'"
Packit 4a16fb
Packit 4a16fb
# Transform the output of nm into a list of symbols to manually relocate.
Packit 4a16fb
global_symbol_to_import=""
Packit 4a16fb
Packit 4a16fb
# Transform the output of nm in a C name address pair.
Packit 4a16fb
global_symbol_to_c_name_address="sed -n -e 's/^: \\(.*\\) .*\$/  {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/  {\"\\1\", (void *) \\&\\1},/p'"
Packit 4a16fb
Packit 4a16fb
# Transform the output of nm in a C name address pair when lib prefix is needed.
Packit 4a16fb
global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \\(.*\\) .*\$/  {\"\\1\", (void *) 0},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(lib.*\\)\$/  {\"\\1\", (void *) \\&\\1},/p' -e 's/^[ABCDGIRSTW][ABCDGIRSTW]* .* \\(.*\\)\$/  {\"lib\\1\", (void *) \\&\\1},/p'"
Packit 4a16fb
Packit 4a16fb
# The name lister interface.
Packit 4a16fb
nm_interface="BSD nm"
Packit 4a16fb
Packit 4a16fb
# Specify filename containing input files for $NM.
Packit 4a16fb
nm_file_list_spec="@"
Packit 4a16fb
Packit 4a16fb
# The root where to search for dependent libraries,and where our libraries should be installed.
Packit 4a16fb
lt_sysroot=
Packit 4a16fb
Packit 4a16fb
# Command to truncate a binary pipe.
Packit 4a16fb
lt_truncate_bin="/usr/bin/dd bs=4096 count=1"
Packit 4a16fb
Packit 4a16fb
# The name of the directory that contains temporary libtool files.
Packit 4a16fb
objdir=.libs
Packit 4a16fb
Packit 4a16fb
# Used to examine libraries when file_magic_cmd begins with "file".
Packit 4a16fb
MAGIC_CMD=file
Packit 4a16fb
Packit 4a16fb
# Must we lock files when doing compilation?
Packit 4a16fb
need_locks="no"
Packit 4a16fb
Packit 4a16fb
# Manifest tool.
Packit 4a16fb
MANIFEST_TOOL=":"
Packit 4a16fb
Packit 4a16fb
# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
Packit 4a16fb
DSYMUTIL=""
Packit 4a16fb
Packit 4a16fb
# Tool to change global to local symbols on Mac OS X.
Packit 4a16fb
NMEDIT=""
Packit 4a16fb
Packit 4a16fb
# Tool to manipulate fat objects and archives on Mac OS X.
Packit 4a16fb
LIPO=""
Packit 4a16fb
Packit 4a16fb
# ldd/readelf like tool for Mach-O binaries on Mac OS X.
Packit 4a16fb
OTOOL=""
Packit 4a16fb
Packit 4a16fb
# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
Packit 4a16fb
OTOOL64=""
Packit 4a16fb
Packit 4a16fb
# Old archive suffix (normally "a").
Packit 4a16fb
libext=a
Packit 4a16fb
Packit 4a16fb
# Shared library suffix (normally ".so").
Packit 4a16fb
shrext_cmds=".so"
Packit 4a16fb
Packit 4a16fb
# The commands to extract the exported symbol list from a shared archive.
Packit 4a16fb
extract_expsyms_cmds=""
Packit 4a16fb
Packit 4a16fb
# Variables whose values should be saved in libtool wrapper scripts and
Packit 4a16fb
# restored at link time.
Packit 4a16fb
variables_saved_for_relink="PATH LD_LIBRARY_PATH LD_RUN_PATH GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH"
Packit 4a16fb
Packit 4a16fb
# Do we need the "lib" prefix for modules?
Packit 4a16fb
need_lib_prefix=no
Packit 4a16fb
Packit 4a16fb
# Do we need a version for libraries?
Packit 4a16fb
need_version=no
Packit 4a16fb
Packit 4a16fb
# Library versioning type.
Packit 4a16fb
version_type=linux
Packit 4a16fb
Packit 4a16fb
# Shared library runtime path variable.
Packit 4a16fb
runpath_var=LD_RUN_PATH
Packit 4a16fb
Packit 4a16fb
# Shared library path variable.
Packit 4a16fb
shlibpath_var=LD_LIBRARY_PATH
Packit 4a16fb
Packit 4a16fb
# Is shlibpath searched before the hard-coded library search path?
Packit 4a16fb
shlibpath_overrides_runpath=no
Packit 4a16fb
Packit 4a16fb
# Format of library name prefix.
Packit 4a16fb
libname_spec="lib\$name"
Packit 4a16fb
Packit 4a16fb
# List of archive names.  First name is the real one, the rest are links.
Packit 4a16fb
# The last name is the one that the linker finds with -lNAME
Packit 4a16fb
library_names_spec="\$libname\$release\$shared_ext\$versuffix \$libname\$release\$shared_ext\$major \$libname\$shared_ext"
Packit 4a16fb
Packit 4a16fb
# The coded name of the library, if different from the real name.
Packit 4a16fb
soname_spec="\$libname\$release\$shared_ext\$major"
Packit 4a16fb
Packit 4a16fb
# Permission mode override for installation of shared libraries.
Packit 4a16fb
install_override_mode=""
Packit 4a16fb
Packit 4a16fb
# Command to use after installation of a shared archive.
Packit 4a16fb
postinstall_cmds=""
Packit 4a16fb
Packit 4a16fb
# Command to use after uninstallation of a shared archive.
Packit 4a16fb
postuninstall_cmds=""
Packit 4a16fb
Packit 4a16fb
# Commands used to finish a libtool library installation in a directory.
Packit 4a16fb
finish_cmds="PATH=\\\"\\\$PATH:/sbin\\\" ldconfig -n \$libdir"
Packit 4a16fb
Packit 4a16fb
# As "finish_cmds", except a single script fragment to be evaled but
Packit 4a16fb
# not shown.
Packit 4a16fb
finish_eval=""
Packit 4a16fb
Packit 4a16fb
# Whether we should hardcode library paths into libraries.
Packit 4a16fb
hardcode_into_libs=yes
Packit 4a16fb
Packit 4a16fb
# Compile-time system search path for libraries.
Packit 4a16fb
sys_lib_search_path_spec="/usr/lib/gcc/x86_64-redhat-linux/8 /usr/lib64 /lib64 /usr/lib /lib "
Packit 4a16fb
Packit 4a16fb
# Detected run-time system search path for libraries.
Packit 4a16fb
sys_lib_dlsearch_path_spec="/lib64 /usr/lib64 /lib /usr/lib /usr/lib64/qt-3.3/lib "
Packit 4a16fb
Packit 4a16fb
# Explicit LT_SYS_LIBRARY_PATH set during ./configure time.
Packit 4a16fb
configure_time_lt_sys_library_path=""
Packit 4a16fb
Packit 4a16fb
# Whether dlopen is supported.
Packit 4a16fb
dlopen_support=yes
Packit 4a16fb
Packit 4a16fb
# Whether dlopen of programs is supported.
Packit 4a16fb
dlopen_self=yes
Packit 4a16fb
Packit 4a16fb
# Whether dlopen of statically linked programs is supported.
Packit 4a16fb
dlopen_self_static=yes
Packit 4a16fb
Packit 4a16fb
# Commands to strip libraries.
Packit 4a16fb
old_striplib="strip --strip-debug"
Packit 4a16fb
striplib="strip --strip-unneeded"
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# The linker used to build libraries.
Packit 4a16fb
LD="/usr/bin/ld -m elf_x86_64"
Packit 4a16fb
Packit 4a16fb
# How to create reloadable object files.
Packit 4a16fb
reload_flag=" -r"
Packit 4a16fb
reload_cmds="\$LD\$reload_flag -o \$output\$reload_objs"
Packit 4a16fb
Packit 4a16fb
# Commands used to build an old-style archive.
Packit 4a16fb
old_archive_cmds="\$AR \$AR_FLAGS \$oldlib\$oldobjs~\$RANLIB \$tool_oldlib"
Packit 4a16fb
Packit 4a16fb
# A language specific compiler.
Packit 4a16fb
CC="gcc"
Packit 4a16fb
Packit 4a16fb
# Is the compiler the GNU compiler?
Packit 4a16fb
with_gcc=yes
Packit 4a16fb
Packit 4a16fb
# Compiler flag to turn off builtin functions.
Packit 4a16fb
no_builtin_flag=" -fno-builtin"
Packit 4a16fb
Packit 4a16fb
# Additional compiler flags for building library objects.
Packit 4a16fb
pic_flag=" -fPIC -DPIC"
Packit 4a16fb
Packit 4a16fb
# How to pass a linker flag through the compiler.
Packit 4a16fb
wl="-Wl,"
Packit 4a16fb
Packit 4a16fb
# Compiler flag to prevent dynamic linking.
Packit 4a16fb
link_static_flag=""
Packit 4a16fb
Packit 4a16fb
# Does compiler simultaneously support -c and -o options?
Packit 4a16fb
compiler_c_o="yes"
Packit 4a16fb
Packit 4a16fb
# Whether or not to add -lc for building shared libraries.
Packit 4a16fb
build_libtool_need_lc=no
Packit 4a16fb
Packit 4a16fb
# Whether or not to disallow shared libs when runtime libs are static.
Packit 4a16fb
allow_libtool_libs_with_static_runtimes=no
Packit 4a16fb
Packit 4a16fb
# Compiler flag to allow reflexive dlopens.
Packit 4a16fb
export_dynamic_flag_spec="\$wl--export-dynamic"
Packit 4a16fb
Packit 4a16fb
# Compiler flag to generate shared objects directly from archives.
Packit 4a16fb
whole_archive_flag_spec="\$wl--whole-archive\$convenience \$wl--no-whole-archive"
Packit 4a16fb
Packit 4a16fb
# Whether the compiler copes with passing no objects directly.
Packit 4a16fb
compiler_needs_object="no"
Packit 4a16fb
Packit 4a16fb
# Create an old-style archive from a shared archive.
Packit 4a16fb
old_archive_from_new_cmds=""
Packit 4a16fb
Packit 4a16fb
# Create a temporary old-style archive to link instead of a shared archive.
Packit 4a16fb
old_archive_from_expsyms_cmds=""
Packit 4a16fb
Packit 4a16fb
# Commands used to build a shared archive.
Packit 4a16fb
archive_cmds="\$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname -o \$lib"
Packit 4a16fb
archive_expsym_cmds="echo \\\"{ global:\\\" > \$output_objdir/\$libname.ver~
Packit 4a16fb
            cat \$export_symbols | sed -e \\\"s/\\\\(.*\\\\)/\\\\1;/\\\" >> \$output_objdir/\$libname.ver~
Packit 4a16fb
            echo \\\"local: *; };\\\" >> \$output_objdir/\$libname.ver~
Packit 4a16fb
            \$CC -shared \$pic_flag \$libobjs \$deplibs \$compiler_flags \$wl-soname \$wl\$soname \$wl-version-script \$wl\$output_objdir/\$libname.ver -o \$lib"
Packit 4a16fb
Packit 4a16fb
# Commands used to build a loadable module if different from building
Packit 4a16fb
# a shared archive.
Packit 4a16fb
module_cmds=""
Packit 4a16fb
module_expsym_cmds=""
Packit 4a16fb
Packit 4a16fb
# Whether we are building with GNU ld or not.
Packit 4a16fb
with_gnu_ld="yes"
Packit 4a16fb
Packit 4a16fb
# Flag that allows shared libraries with undefined symbols to be built.
Packit 4a16fb
allow_undefined_flag=""
Packit 4a16fb
Packit 4a16fb
# Flag that enforces no undefined symbols.
Packit 4a16fb
no_undefined_flag=""
Packit 4a16fb
Packit 4a16fb
# Flag to hardcode $libdir into a binary during linking.
Packit 4a16fb
# This must work even if $libdir does not exist
Packit 4a16fb
hardcode_libdir_flag_spec=" -D__LIBTOOL_IS_A_FOOL__ "
Packit 4a16fb
Packit 4a16fb
# Whether we need a single "-rpath" flag with a separated argument.
Packit 4a16fb
hardcode_libdir_separator=""
Packit 4a16fb
Packit 4a16fb
# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
Packit 4a16fb
# DIR into the resulting binary.
Packit 4a16fb
hardcode_direct=no
Packit 4a16fb
Packit 4a16fb
# Set to "yes" if using DIR/libNAME$shared_ext during linking hardcodes
Packit 4a16fb
# DIR into the resulting binary and the resulting library dependency is
Packit 4a16fb
# "absolute",i.e impossible to change by setting $shlibpath_var if the
Packit 4a16fb
# library is relocated.
Packit 4a16fb
hardcode_direct_absolute=no
Packit 4a16fb
Packit 4a16fb
# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
Packit 4a16fb
# into the resulting binary.
Packit 4a16fb
hardcode_minus_L=no
Packit 4a16fb
Packit 4a16fb
# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
Packit 4a16fb
# into the resulting binary.
Packit 4a16fb
hardcode_shlibpath_var=unsupported
Packit 4a16fb
Packit 4a16fb
# Set to "yes" if building a shared library automatically hardcodes DIR
Packit 4a16fb
# into the library and all subsequent libraries and executables linked
Packit 4a16fb
# against it.
Packit 4a16fb
hardcode_automatic=no
Packit 4a16fb
Packit 4a16fb
# Set to yes if linker adds runtime paths of dependent libraries
Packit 4a16fb
# to runtime path list.
Packit 4a16fb
inherit_rpath=no
Packit 4a16fb
Packit 4a16fb
# Whether libtool must link a program against all its dependency libraries.
Packit 4a16fb
link_all_deplibs=unknown
Packit 4a16fb
Packit 4a16fb
# Set to "yes" if exported symbols are required.
Packit 4a16fb
always_export_symbols=no
Packit 4a16fb
Packit 4a16fb
# The commands to list exported symbols.
Packit 4a16fb
export_symbols_cmds="\$NM \$libobjs \$convenience | \$global_symbol_pipe | \$SED 's/.* //' | sort | uniq > \$export_symbols"
Packit 4a16fb
Packit 4a16fb
# Symbols that should not be listed in the preloaded symbols.
Packit 4a16fb
exclude_expsyms="_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*"
Packit 4a16fb
Packit 4a16fb
# Symbols that must always be exported.
Packit 4a16fb
include_expsyms=""
Packit 4a16fb
Packit 4a16fb
# Commands necessary for linking programs (against libraries) with templates.
Packit 4a16fb
prelink_cmds=""
Packit 4a16fb
Packit 4a16fb
# Commands necessary for finishing linking programs.
Packit 4a16fb
postlink_cmds=""
Packit 4a16fb
Packit 4a16fb
# Specify filename containing input files.
Packit 4a16fb
file_list_spec=""
Packit 4a16fb
Packit 4a16fb
# How to hardcode a shared library path into an executable.
Packit 4a16fb
hardcode_action=immediate
Packit 4a16fb
Packit 4a16fb
# ### END LIBTOOL CONFIG
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# ### BEGIN FUNCTIONS SHARED WITH CONFIGURE
Packit 4a16fb
Packit 4a16fb
# func_munge_path_list VARIABLE PATH
Packit 4a16fb
# -----------------------------------
Packit 4a16fb
# VARIABLE is name of variable containing _space_ separated list of
Packit 4a16fb
# directories to be munged by the contents of PATH, which is string
Packit 4a16fb
# having a format:
Packit 4a16fb
# "DIR[:DIR]:"
Packit 4a16fb
#       string "DIR[ DIR]" will be prepended to VARIABLE
Packit 4a16fb
# ":DIR[:DIR]"
Packit 4a16fb
#       string "DIR[ DIR]" will be appended to VARIABLE
Packit 4a16fb
# "DIRP[:DIRP]::[DIRA:]DIRA"
Packit 4a16fb
#       string "DIRP[ DIRP]" will be prepended to VARIABLE and string
Packit 4a16fb
#       "DIRA[ DIRA]" will be appended to VARIABLE
Packit 4a16fb
# "DIR[:DIR]"
Packit 4a16fb
#       VARIABLE will be replaced by "DIR[ DIR]"
Packit 4a16fb
func_munge_path_list ()
Packit 4a16fb
{
Packit 4a16fb
    case x$2 in
Packit 4a16fb
    x)
Packit 4a16fb
        ;;
Packit 4a16fb
    *:)
Packit 4a16fb
        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'` \$$1\"
Packit 4a16fb
        ;;
Packit 4a16fb
    x:*)
Packit 4a16fb
        eval $1=\"\$$1 `$ECHO $2 | $SED 's/:/ /g'`\"
Packit 4a16fb
        ;;
Packit 4a16fb
    *::*)
Packit 4a16fb
        eval $1=\"\$$1\ `$ECHO $2 | $SED -e 's/.*:://' -e 's/:/ /g'`\"
Packit 4a16fb
        eval $1=\"`$ECHO $2 | $SED -e 's/::.*//' -e 's/:/ /g'`\ \$$1\"
Packit 4a16fb
        ;;
Packit 4a16fb
    *)
Packit 4a16fb
        eval $1=\"`$ECHO $2 | $SED 's/:/ /g'`\"
Packit 4a16fb
        ;;
Packit 4a16fb
    esac
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# Calculate cc_basename.  Skip known compiler wrappers and cross-prefix.
Packit 4a16fb
func_cc_basename ()
Packit 4a16fb
{
Packit 4a16fb
    for cc_temp in $*""; do
Packit 4a16fb
      case $cc_temp in
Packit 4a16fb
        compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
Packit 4a16fb
        distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
Packit 4a16fb
        \-*) ;;
Packit 4a16fb
        *) break;;
Packit 4a16fb
      esac
Packit 4a16fb
    done
Packit 4a16fb
    func_cc_basename_result=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# ### END FUNCTIONS SHARED WITH CONFIGURE
Packit 4a16fb
Packit 4a16fb
#! /bin/sh
Packit 4a16fb
## DO NOT EDIT - This file generated from ./build-aux/ltmain.in
Packit 4a16fb
##               by inline-source v2014-01-03.01
Packit 4a16fb
Packit 4a16fb
# libtool (GNU libtool) 2.4.6
Packit 4a16fb
# Provide generalized library-building support services.
Packit 4a16fb
# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
Packit 4a16fb
Packit 4a16fb
# Copyright (C) 1996-2015 Free Software Foundation, Inc.
Packit 4a16fb
# This is free software; see the source for copying conditions.  There is NO
Packit 4a16fb
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Packit 4a16fb
Packit 4a16fb
# GNU Libtool is free software; you can redistribute it and/or modify
Packit 4a16fb
# it under the terms of the GNU General Public License as published by
Packit 4a16fb
# the Free Software Foundation; either version 2 of the License, or
Packit 4a16fb
# (at your option) any later version.
Packit 4a16fb
#
Packit 4a16fb
# As a special exception to the GNU General Public License,
Packit 4a16fb
# if you distribute this file as part of a program or library that
Packit 4a16fb
# is built using GNU Libtool, you may include this file under the
Packit 4a16fb
# same distribution terms that you use for the rest of that program.
Packit 4a16fb
#
Packit 4a16fb
# GNU Libtool is distributed in the hope that it will be useful, but
Packit 4a16fb
# WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 4a16fb
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 4a16fb
# General Public License for more details.
Packit 4a16fb
#
Packit 4a16fb
# You should have received a copy of the GNU General Public License
Packit 4a16fb
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
PROGRAM=libtool
Packit 4a16fb
PACKAGE=libtool
Packit 4a16fb
VERSION=2.4.6
Packit 4a16fb
package_revision=2.4.6
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
## ------ ##
Packit 4a16fb
## Usage. ##
Packit 4a16fb
## ------ ##
Packit 4a16fb
Packit 4a16fb
# Run './libtool --help' for help with using this script from the
Packit 4a16fb
# command line.
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
## ------------------------------- ##
Packit 4a16fb
## User overridable command paths. ##
Packit 4a16fb
## ------------------------------- ##
Packit 4a16fb
Packit 4a16fb
# After configure completes, it has a better idea of some of the
Packit 4a16fb
# shell tools we need than the defaults used by the functions shared
Packit 4a16fb
# with bootstrap, so set those here where they can still be over-
Packit 4a16fb
# ridden by the user, but otherwise take precedence.
Packit 4a16fb
Packit 4a16fb
: ${AUTOCONF="autoconf"}
Packit 4a16fb
: ${AUTOMAKE="automake"}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
## -------------------------- ##
Packit 4a16fb
## Source external libraries. ##
Packit 4a16fb
## -------------------------- ##
Packit 4a16fb
Packit 4a16fb
# Much of our low-level functionality needs to be sourced from external
Packit 4a16fb
# libraries, which are installed to $pkgauxdir.
Packit 4a16fb
Packit 4a16fb
# Set a version string for this script.
Packit 4a16fb
scriptversion=2015-01-20.17; # UTC
Packit 4a16fb
Packit 4a16fb
# General shell script boiler plate, and helper functions.
Packit 4a16fb
# Written by Gary V. Vaughan, 2004
Packit 4a16fb
Packit 4a16fb
# Copyright (C) 2004-2015 Free Software Foundation, Inc.
Packit 4a16fb
# This is free software; see the source for copying conditions.  There is NO
Packit 4a16fb
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Packit 4a16fb
Packit 4a16fb
# This program is free software; you can redistribute it and/or modify
Packit 4a16fb
# it under the terms of the GNU General Public License as published by
Packit 4a16fb
# the Free Software Foundation; either version 3 of the License, or
Packit 4a16fb
# (at your option) any later version.
Packit 4a16fb
Packit 4a16fb
# As a special exception to the GNU General Public License, if you distribute
Packit 4a16fb
# this file as part of a program or library that is built using GNU Libtool,
Packit 4a16fb
# you may include this file under the same distribution terms that you use
Packit 4a16fb
# for the rest of that program.
Packit 4a16fb
Packit 4a16fb
# This program is distributed in the hope that it will be useful,
Packit 4a16fb
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 4a16fb
# MERCHANTABILITY or FITNES FOR A PARTICULAR PURPOSE. See the GNU
Packit 4a16fb
# General Public License for more details.
Packit 4a16fb
Packit 4a16fb
# You should have received a copy of the GNU General Public License
Packit 4a16fb
# along with this program. If not, see <http://www.gnu.org/licenses/>.
Packit 4a16fb
Packit 4a16fb
# Please report bugs or propose patches to gary@gnu.org.
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
## ------ ##
Packit 4a16fb
## Usage. ##
Packit 4a16fb
## ------ ##
Packit 4a16fb
Packit 4a16fb
# Evaluate this file near the top of your script to gain access to
Packit 4a16fb
# the functions and variables defined here:
Packit 4a16fb
#
Packit 4a16fb
#   . `echo "$0" | ${SED-sed} 's|[^/]*$||'`/build-aux/funclib.sh
Packit 4a16fb
#
Packit 4a16fb
# If you need to override any of the default environment variable
Packit 4a16fb
# settings, do that before evaluating this file.
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
## -------------------- ##
Packit 4a16fb
## Shell normalisation. ##
Packit 4a16fb
## -------------------- ##
Packit 4a16fb
Packit 4a16fb
# Some shells need a little help to be as Bourne compatible as possible.
Packit 4a16fb
# Before doing anything else, make sure all that help has been provided!
Packit 4a16fb
Packit 4a16fb
DUALCASE=1; export DUALCASE # for MKS sh
Packit 4a16fb
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
Packit 4a16fb
  emulate sh
Packit 4a16fb
  NULLCMD=:
Packit 4a16fb
  # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
Packit 4a16fb
  # is contrary to our usage.  Disable this feature.
Packit 4a16fb
  alias -g '${1+"$@"}'='"$@"'
Packit 4a16fb
  setopt NO_GLOB_SUBST
Packit 4a16fb
else
Packit 4a16fb
  case `(set -o) 2>/dev/null` in *posix*) set -o posix ;; esac
Packit 4a16fb
fi
Packit 4a16fb
Packit 4a16fb
# NLS nuisances: We save the old values in case they are required later.
Packit 4a16fb
_G_user_locale=
Packit 4a16fb
_G_safe_locale=
Packit 4a16fb
for _G_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
Packit 4a16fb
do
Packit 4a16fb
  eval "if test set = \"\${$_G_var+set}\"; then
Packit 4a16fb
          save_$_G_var=\$$_G_var
Packit 4a16fb
          $_G_var=C
Packit 4a16fb
	  export $_G_var
Packit 4a16fb
	  _G_user_locale=\"$_G_var=\\\$save_\$_G_var; \$_G_user_locale\"
Packit 4a16fb
	  _G_safe_locale=\"$_G_var=C; \$_G_safe_locale\"
Packit 4a16fb
	fi"
Packit 4a16fb
done
Packit 4a16fb
Packit 4a16fb
# CDPATH.
Packit 4a16fb
(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
Packit 4a16fb
Packit 4a16fb
# Make sure IFS has a sensible default
Packit 4a16fb
sp=' '
Packit 4a16fb
nl='
Packit 4a16fb
'
Packit 4a16fb
IFS="$sp	$nl"
Packit 4a16fb
Packit 4a16fb
# There are apparently some retarded systems that use ';' as a PATH separator!
Packit 4a16fb
if test "${PATH_SEPARATOR+set}" != set; then
Packit 4a16fb
  PATH_SEPARATOR=:
Packit 4a16fb
  (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
Packit 4a16fb
    (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
Packit 4a16fb
      PATH_SEPARATOR=';'
Packit 4a16fb
  }
Packit 4a16fb
fi
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
## ------------------------- ##
Packit 4a16fb
## Locate command utilities. ##
Packit 4a16fb
## ------------------------- ##
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_executable_p FILE
Packit 4a16fb
# ----------------------
Packit 4a16fb
# Check that FILE is an executable regular file.
Packit 4a16fb
func_executable_p ()
Packit 4a16fb
{
Packit 4a16fb
    test -f "$1" && test -x "$1"
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_path_progs PROGS_LIST CHECK_FUNC [PATH]
Packit 4a16fb
# --------------------------------------------
Packit 4a16fb
# Search for either a program that responds to --version with output
Packit 4a16fb
# containing "GNU", or else returned by CHECK_FUNC otherwise, by
Packit 4a16fb
# trying all the directories in PATH with each of the elements of
Packit 4a16fb
# PROGS_LIST.
Packit 4a16fb
#
Packit 4a16fb
# CHECK_FUNC should accept the path to a candidate program, and
Packit 4a16fb
# set $func_check_prog_result if it truncates its output less than
Packit 4a16fb
# $_G_path_prog_max characters.
Packit 4a16fb
func_path_progs ()
Packit 4a16fb
{
Packit 4a16fb
    _G_progs_list=$1
Packit 4a16fb
    _G_check_func=$2
Packit 4a16fb
    _G_PATH=${3-"$PATH"}
Packit 4a16fb
Packit 4a16fb
    _G_path_prog_max=0
Packit 4a16fb
    _G_path_prog_found=false
Packit 4a16fb
    _G_save_IFS=$IFS; IFS=${PATH_SEPARATOR-:}
Packit 4a16fb
    for _G_dir in $_G_PATH; do
Packit 4a16fb
      IFS=$_G_save_IFS
Packit 4a16fb
      test -z "$_G_dir" && _G_dir=.
Packit 4a16fb
      for _G_prog_name in $_G_progs_list; do
Packit 4a16fb
        for _exeext in '' .EXE; do
Packit 4a16fb
          _G_path_prog=$_G_dir/$_G_prog_name$_exeext
Packit 4a16fb
          func_executable_p "$_G_path_prog" || continue
Packit 4a16fb
          case `"$_G_path_prog" --version 2>&1` in
Packit 4a16fb
            *GNU*) func_path_progs_result=$_G_path_prog _G_path_prog_found=: ;;
Packit 4a16fb
            *)     $_G_check_func $_G_path_prog
Packit 4a16fb
		   func_path_progs_result=$func_check_prog_result
Packit 4a16fb
		   ;;
Packit 4a16fb
          esac
Packit 4a16fb
          $_G_path_prog_found && break 3
Packit 4a16fb
        done
Packit 4a16fb
      done
Packit 4a16fb
    done
Packit 4a16fb
    IFS=$_G_save_IFS
Packit 4a16fb
    test -z "$func_path_progs_result" && {
Packit 4a16fb
      echo "no acceptable sed could be found in \$PATH" >&2
Packit 4a16fb
      exit 1
Packit 4a16fb
    }
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# We want to be able to use the functions in this file before configure
Packit 4a16fb
# has figured out where the best binaries are kept, which means we have
Packit 4a16fb
# to search for them ourselves - except when the results are already set
Packit 4a16fb
# where we skip the searches.
Packit 4a16fb
Packit 4a16fb
# Unless the user overrides by setting SED, search the path for either GNU
Packit 4a16fb
# sed, or the sed that truncates its output the least.
Packit 4a16fb
test -z "$SED" && {
Packit 4a16fb
  _G_sed_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
Packit 4a16fb
  for _G_i in 1 2 3 4 5 6 7; do
Packit 4a16fb
    _G_sed_script=$_G_sed_script$nl$_G_sed_script
Packit 4a16fb
  done
Packit 4a16fb
  echo "$_G_sed_script" 2>/dev/null | sed 99q >conftest.sed
Packit 4a16fb
  _G_sed_script=
Packit 4a16fb
Packit 4a16fb
  func_check_prog_sed ()
Packit 4a16fb
  {
Packit 4a16fb
    _G_path_prog=$1
Packit 4a16fb
Packit 4a16fb
    _G_count=0
Packit 4a16fb
    printf 0123456789 >conftest.in
Packit 4a16fb
    while :
Packit 4a16fb
    do
Packit 4a16fb
      cat conftest.in conftest.in >conftest.tmp
Packit 4a16fb
      mv conftest.tmp conftest.in
Packit 4a16fb
      cp conftest.in conftest.nl
Packit 4a16fb
      echo '' >> conftest.nl
Packit 4a16fb
      "$_G_path_prog" -f conftest.sed <conftest.nl >conftest.out 2>/dev/null || break
Packit 4a16fb
      diff conftest.out conftest.nl >/dev/null 2>&1 || break
Packit 4a16fb
      _G_count=`expr $_G_count + 1`
Packit 4a16fb
      if test "$_G_count" -gt "$_G_path_prog_max"; then
Packit 4a16fb
        # Best one so far, save it but keep looking for a better one
Packit 4a16fb
        func_check_prog_result=$_G_path_prog
Packit 4a16fb
        _G_path_prog_max=$_G_count
Packit 4a16fb
      fi
Packit 4a16fb
      # 10*(2^10) chars as input seems more than enough
Packit 4a16fb
      test 10 -lt "$_G_count" && break
Packit 4a16fb
    done
Packit 4a16fb
    rm -f conftest.in conftest.tmp conftest.nl conftest.out
Packit 4a16fb
  }
Packit 4a16fb
Packit 4a16fb
  func_path_progs "sed gsed" func_check_prog_sed $PATH:/usr/xpg4/bin
Packit 4a16fb
  rm -f conftest.sed
Packit 4a16fb
  SED=$func_path_progs_result
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# Unless the user overrides by setting GREP, search the path for either GNU
Packit 4a16fb
# grep, or the grep that truncates its output the least.
Packit 4a16fb
test -z "$GREP" && {
Packit 4a16fb
  func_check_prog_grep ()
Packit 4a16fb
  {
Packit 4a16fb
    _G_path_prog=$1
Packit 4a16fb
Packit 4a16fb
    _G_count=0
Packit 4a16fb
    _G_path_prog_max=0
Packit 4a16fb
    printf 0123456789 >conftest.in
Packit 4a16fb
    while :
Packit 4a16fb
    do
Packit 4a16fb
      cat conftest.in conftest.in >conftest.tmp
Packit 4a16fb
      mv conftest.tmp conftest.in
Packit 4a16fb
      cp conftest.in conftest.nl
Packit 4a16fb
      echo 'GREP' >> conftest.nl
Packit 4a16fb
      "$_G_path_prog" -e 'GREP$' -e '-(cannot match)-' <conftest.nl >conftest.out 2>/dev/null || break
Packit 4a16fb
      diff conftest.out conftest.nl >/dev/null 2>&1 || break
Packit 4a16fb
      _G_count=`expr $_G_count + 1`
Packit 4a16fb
      if test "$_G_count" -gt "$_G_path_prog_max"; then
Packit 4a16fb
        # Best one so far, save it but keep looking for a better one
Packit 4a16fb
        func_check_prog_result=$_G_path_prog
Packit 4a16fb
        _G_path_prog_max=$_G_count
Packit 4a16fb
      fi
Packit 4a16fb
      # 10*(2^10) chars as input seems more than enough
Packit 4a16fb
      test 10 -lt "$_G_count" && break
Packit 4a16fb
    done
Packit 4a16fb
    rm -f conftest.in conftest.tmp conftest.nl conftest.out
Packit 4a16fb
  }
Packit 4a16fb
Packit 4a16fb
  func_path_progs "grep ggrep" func_check_prog_grep $PATH:/usr/xpg4/bin
Packit 4a16fb
  GREP=$func_path_progs_result
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
## ------------------------------- ##
Packit 4a16fb
## User overridable command paths. ##
Packit 4a16fb
## ------------------------------- ##
Packit 4a16fb
Packit 4a16fb
# All uppercase variable names are used for environment variables.  These
Packit 4a16fb
# variables can be overridden by the user before calling a script that
Packit 4a16fb
# uses them if a suitable command of that name is not already available
Packit 4a16fb
# in the command search PATH.
Packit 4a16fb
Packit 4a16fb
: ${CP="cp -f"}
Packit 4a16fb
: ${ECHO="printf %s\n"}
Packit 4a16fb
: ${EGREP="$GREP -E"}
Packit 4a16fb
: ${FGREP="$GREP -F"}
Packit 4a16fb
: ${LN_S="ln -s"}
Packit 4a16fb
: ${MAKE="make"}
Packit 4a16fb
: ${MKDIR="mkdir"}
Packit 4a16fb
: ${MV="mv -f"}
Packit 4a16fb
: ${RM="rm -f"}
Packit 4a16fb
: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
## -------------------- ##
Packit 4a16fb
## Useful sed snippets. ##
Packit 4a16fb
## -------------------- ##
Packit 4a16fb
Packit 4a16fb
sed_dirname='s|/[^/]*$||'
Packit 4a16fb
sed_basename='s|^.*/||'
Packit 4a16fb
Packit 4a16fb
# Sed substitution that helps us do robust quoting.  It backslashifies
Packit 4a16fb
# metacharacters that are still active within double-quoted strings.
Packit 4a16fb
sed_quote_subst='s|\([`"$\\]\)|\\\1|g'
Packit 4a16fb
Packit 4a16fb
# Same as above, but do not quote variable references.
Packit 4a16fb
sed_double_quote_subst='s/\(["`\\]\)/\\\1/g'
Packit 4a16fb
Packit 4a16fb
# Sed substitution that turns a string into a regex matching for the
Packit 4a16fb
# string literally.
Packit 4a16fb
sed_make_literal_regex='s|[].[^$\\*\/]|\\&|g'
Packit 4a16fb
Packit 4a16fb
# Sed substitution that converts a w32 file name or path
Packit 4a16fb
# that contains forward slashes, into one that contains
Packit 4a16fb
# (escaped) backslashes.  A very naive implementation.
Packit 4a16fb
sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
Packit 4a16fb
Packit 4a16fb
# Re-'\' parameter expansions in output of sed_double_quote_subst that
Packit 4a16fb
# were '\'-ed in input to the same.  If an odd number of '\' preceded a
Packit 4a16fb
# '$' in input to sed_double_quote_subst, that '$' was protected from
Packit 4a16fb
# expansion.  Since each input '\' is now two '\'s, look for any number
Packit 4a16fb
# of runs of four '\'s followed by two '\'s and then a '$'.  '\' that '$'.
Packit 4a16fb
_G_bs='\\'
Packit 4a16fb
_G_bs2='\\\\'
Packit 4a16fb
_G_bs4='\\\\\\\\'
Packit 4a16fb
_G_dollar='\$'
Packit 4a16fb
sed_double_backslash="\
Packit 4a16fb
  s/$_G_bs4/&\\
Packit 4a16fb
/g
Packit 4a16fb
  s/^$_G_bs2$_G_dollar/$_G_bs&/
Packit 4a16fb
  s/\\([^$_G_bs]\\)$_G_bs2$_G_dollar/\\1$_G_bs2$_G_bs$_G_dollar/g
Packit 4a16fb
  s/\n//g"
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
## ----------------- ##
Packit 4a16fb
## Global variables. ##
Packit 4a16fb
## ----------------- ##
Packit 4a16fb
Packit 4a16fb
# Except for the global variables explicitly listed below, the following
Packit 4a16fb
# functions in the '^func_' namespace, and the '^require_' namespace
Packit 4a16fb
# variables initialised in the 'Resource management' section, sourcing
Packit 4a16fb
# this file will not pollute your global namespace with anything
Packit 4a16fb
# else. There's no portable way to scope variables in Bourne shell
Packit 4a16fb
# though, so actually running these functions will sometimes place
Packit 4a16fb
# results into a variable named after the function, and often use
Packit 4a16fb
# temporary variables in the '^_G_' namespace. If you are careful to
Packit 4a16fb
# avoid using those namespaces casually in your sourcing script, things
Packit 4a16fb
# should continue to work as you expect. And, of course, you can freely
Packit 4a16fb
# overwrite any of the functions or variables defined here before
Packit 4a16fb
# calling anything to customize them.
Packit 4a16fb
Packit 4a16fb
EXIT_SUCCESS=0
Packit 4a16fb
EXIT_FAILURE=1
Packit 4a16fb
EXIT_MISMATCH=63  # $? = 63 is used to indicate version mismatch to missing.
Packit 4a16fb
EXIT_SKIP=77	  # $? = 77 is used to indicate a skipped test to automake.
Packit 4a16fb
Packit 4a16fb
# Allow overriding, eg assuming that you follow the convention of
Packit 4a16fb
# putting '$debug_cmd' at the start of all your functions, you can get
Packit 4a16fb
# bash to show function call trace with:
Packit 4a16fb
#
Packit 4a16fb
#    debug_cmd='eval echo "${FUNCNAME[0]} $*" >&2' bash your-script-name
Packit 4a16fb
debug_cmd=${debug_cmd-":"}
Packit 4a16fb
exit_cmd=:
Packit 4a16fb
Packit 4a16fb
# By convention, finish your script with:
Packit 4a16fb
#
Packit 4a16fb
#    exit $exit_status
Packit 4a16fb
#
Packit 4a16fb
# so that you can set exit_status to non-zero if you want to indicate
Packit 4a16fb
# something went wrong during execution without actually bailing out at
Packit 4a16fb
# the point of failure.
Packit 4a16fb
exit_status=$EXIT_SUCCESS
Packit 4a16fb
Packit 4a16fb
# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
Packit 4a16fb
# is ksh but when the shell is invoked as "sh" and the current value of
Packit 4a16fb
# the _XPG environment variable is not equal to 1 (one), the special
Packit 4a16fb
# positional parameter $0, within a function call, is the name of the
Packit 4a16fb
# function.
Packit 4a16fb
progpath=$0
Packit 4a16fb
Packit 4a16fb
# The name of this program.
Packit 4a16fb
progname=`$ECHO "$progpath" |$SED "$sed_basename"`
Packit 4a16fb
Packit 4a16fb
# Make sure we have an absolute progpath for reexecution:
Packit 4a16fb
case $progpath in
Packit 4a16fb
  [\\/]*|[A-Za-z]:\\*) ;;
Packit 4a16fb
  *[\\/]*)
Packit 4a16fb
     progdir=`$ECHO "$progpath" |$SED "$sed_dirname"`
Packit 4a16fb
     progdir=`cd "$progdir" && pwd`
Packit 4a16fb
     progpath=$progdir/$progname
Packit 4a16fb
     ;;
Packit 4a16fb
  *)
Packit 4a16fb
     _G_IFS=$IFS
Packit 4a16fb
     IFS=${PATH_SEPARATOR-:}
Packit 4a16fb
     for progdir in $PATH; do
Packit 4a16fb
       IFS=$_G_IFS
Packit 4a16fb
       test -x "$progdir/$progname" && break
Packit 4a16fb
     done
Packit 4a16fb
     IFS=$_G_IFS
Packit 4a16fb
     test -n "$progdir" || progdir=`pwd`
Packit 4a16fb
     progpath=$progdir/$progname
Packit 4a16fb
     ;;
Packit 4a16fb
esac
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
## ----------------- ##
Packit 4a16fb
## Standard options. ##
Packit 4a16fb
## ----------------- ##
Packit 4a16fb
Packit 4a16fb
# The following options affect the operation of the functions defined
Packit 4a16fb
# below, and should be set appropriately depending on run-time para-
Packit 4a16fb
# meters passed on the command line.
Packit 4a16fb
Packit 4a16fb
opt_dry_run=false
Packit 4a16fb
opt_quiet=false
Packit 4a16fb
opt_verbose=false
Packit 4a16fb
Packit 4a16fb
# Categories 'all' and 'none' are always available.  Append any others
Packit 4a16fb
# you will pass as the first argument to func_warning from your own
Packit 4a16fb
# code.
Packit 4a16fb
warning_categories=
Packit 4a16fb
Packit 4a16fb
# By default, display warnings according to 'opt_warning_types'.  Set
Packit 4a16fb
# 'warning_func'  to ':' to elide all warnings, or func_fatal_error to
Packit 4a16fb
# treat the next displayed warning as a fatal error.
Packit 4a16fb
warning_func=func_warn_and_continue
Packit 4a16fb
Packit 4a16fb
# Set to 'all' to display all warnings, 'none' to suppress all
Packit 4a16fb
# warnings, or a space delimited list of some subset of
Packit 4a16fb
# 'warning_categories' to display only the listed warnings.
Packit 4a16fb
opt_warning_types=all
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
## -------------------- ##
Packit 4a16fb
## Resource management. ##
Packit 4a16fb
## -------------------- ##
Packit 4a16fb
Packit 4a16fb
# This section contains definitions for functions that each ensure a
Packit 4a16fb
# particular resource (a file, or a non-empty configuration variable for
Packit 4a16fb
# example) is available, and if appropriate to extract default values
Packit 4a16fb
# from pertinent package files. Call them using their associated
Packit 4a16fb
# 'require_*' variable to ensure that they are executed, at most, once.
Packit 4a16fb
#
Packit 4a16fb
# It's entirely deliberate that calling these functions can set
Packit 4a16fb
# variables that don't obey the namespace limitations obeyed by the rest
Packit 4a16fb
# of this file, in order that that they be as useful as possible to
Packit 4a16fb
# callers.
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# require_term_colors
Packit 4a16fb
# -------------------
Packit 4a16fb
# Allow display of bold text on terminals that support it.
Packit 4a16fb
require_term_colors=func_require_term_colors
Packit 4a16fb
func_require_term_colors ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    test -t 1 && {
Packit 4a16fb
      # COLORTERM and USE_ANSI_COLORS environment variables take
Packit 4a16fb
      # precedence, because most terminfo databases neglect to describe
Packit 4a16fb
      # whether color sequences are supported.
Packit 4a16fb
      test -n "${COLORTERM+set}" && : ${USE_ANSI_COLORS="1"}
Packit 4a16fb
Packit 4a16fb
      if test 1 = "$USE_ANSI_COLORS"; then
Packit 4a16fb
        # Standard ANSI escape sequences
Packit 4a16fb
        tc_reset='?[0m'
Packit 4a16fb
        tc_bold='?[1m';   tc_standout='?[7m'
Packit 4a16fb
        tc_red='?[31m';   tc_green='?[32m'
Packit 4a16fb
        tc_blue='?[34m';  tc_cyan='?[36m'
Packit 4a16fb
      else
Packit 4a16fb
        # Otherwise trust the terminfo database after all.
Packit 4a16fb
        test -n "`tput sgr0 2>/dev/null`" && {
Packit 4a16fb
          tc_reset=`tput sgr0`
Packit 4a16fb
          test -n "`tput bold 2>/dev/null`" && tc_bold=`tput bold`
Packit 4a16fb
          tc_standout=$tc_bold
Packit 4a16fb
          test -n "`tput smso 2>/dev/null`" && tc_standout=`tput smso`
Packit 4a16fb
          test -n "`tput setaf 1 2>/dev/null`" && tc_red=`tput setaf 1`
Packit 4a16fb
          test -n "`tput setaf 2 2>/dev/null`" && tc_green=`tput setaf 2`
Packit 4a16fb
          test -n "`tput setaf 4 2>/dev/null`" && tc_blue=`tput setaf 4`
Packit 4a16fb
          test -n "`tput setaf 5 2>/dev/null`" && tc_cyan=`tput setaf 5`
Packit 4a16fb
        }
Packit 4a16fb
      fi
Packit 4a16fb
    }
Packit 4a16fb
Packit 4a16fb
    require_term_colors=:
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
## ----------------- ##
Packit 4a16fb
## Function library. ##
Packit 4a16fb
## ----------------- ##
Packit 4a16fb
Packit 4a16fb
# This section contains a variety of useful functions to call in your
Packit 4a16fb
# scripts. Take note of the portable wrappers for features provided by
Packit 4a16fb
# some modern shells, which will fall back to slower equivalents on
Packit 4a16fb
# less featureful shells.
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_append VAR VALUE
Packit 4a16fb
# ---------------------
Packit 4a16fb
# Append VALUE onto the existing contents of VAR.
Packit 4a16fb
Packit 4a16fb
  # We should try to minimise forks, especially on Windows where they are
Packit 4a16fb
  # unreasonably slow, so skip the feature probes when bash or zsh are
Packit 4a16fb
  # being used:
Packit 4a16fb
  if test set = "${BASH_VERSION+set}${ZSH_VERSION+set}"; then
Packit 4a16fb
    : ${_G_HAVE_ARITH_OP="yes"}
Packit 4a16fb
    : ${_G_HAVE_XSI_OPS="yes"}
Packit 4a16fb
    # The += operator was introduced in bash 3.1
Packit 4a16fb
    case $BASH_VERSION in
Packit 4a16fb
      [12].* | 3.0 | 3.0*) ;;
Packit 4a16fb
      *)
Packit 4a16fb
        : ${_G_HAVE_PLUSEQ_OP="yes"}
Packit 4a16fb
        ;;
Packit 4a16fb
    esac
Packit 4a16fb
  fi
Packit 4a16fb
Packit 4a16fb
  # _G_HAVE_PLUSEQ_OP
Packit 4a16fb
  # Can be empty, in which case the shell is probed, "yes" if += is
Packit 4a16fb
  # useable or anything else if it does not work.
Packit 4a16fb
  test -z "$_G_HAVE_PLUSEQ_OP" \
Packit 4a16fb
    && (eval 'x=a; x+=" b"; test "a b" = "$x"') 2>/dev/null \
Packit 4a16fb
    && _G_HAVE_PLUSEQ_OP=yes
Packit 4a16fb
Packit 4a16fb
if test yes = "$_G_HAVE_PLUSEQ_OP"
Packit 4a16fb
then
Packit 4a16fb
  # This is an XSI compatible shell, allowing a faster implementation...
Packit 4a16fb
  eval 'func_append ()
Packit 4a16fb
  {
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    eval "$1+=\$2"
Packit 4a16fb
  }'
Packit 4a16fb
else
Packit 4a16fb
  # ...otherwise fall back to using expr, which is often a shell builtin.
Packit 4a16fb
  func_append ()
Packit 4a16fb
  {
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    eval "$1=\$$1\$2"
Packit 4a16fb
  }
Packit 4a16fb
fi
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_append_quoted VAR VALUE
Packit 4a16fb
# ----------------------------
Packit 4a16fb
# Quote VALUE and append to the end of shell variable VAR, separated
Packit 4a16fb
# by a space.
Packit 4a16fb
if test yes = "$_G_HAVE_PLUSEQ_OP"; then
Packit 4a16fb
  eval 'func_append_quoted ()
Packit 4a16fb
  {
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    func_quote_for_eval "$2"
Packit 4a16fb
    eval "$1+=\\ \$func_quote_for_eval_result"
Packit 4a16fb
  }'
Packit 4a16fb
else
Packit 4a16fb
  func_append_quoted ()
Packit 4a16fb
  {
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    func_quote_for_eval "$2"
Packit 4a16fb
    eval "$1=\$$1\\ \$func_quote_for_eval_result"
Packit 4a16fb
  }
Packit 4a16fb
fi
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_append_uniq VAR VALUE
Packit 4a16fb
# --------------------------
Packit 4a16fb
# Append unique VALUE onto the existing contents of VAR, assuming
Packit 4a16fb
# entries are delimited by the first character of VALUE.  For example:
Packit 4a16fb
#
Packit 4a16fb
#   func_append_uniq options " --another-option option-argument"
Packit 4a16fb
#
Packit 4a16fb
# will only append to $options if " --another-option option-argument "
Packit 4a16fb
# is not already present somewhere in $options already (note spaces at
Packit 4a16fb
# each end implied by leading space in second argument).
Packit 4a16fb
func_append_uniq ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    eval _G_current_value='`$ECHO $'$1'`'
Packit 4a16fb
    _G_delim=`expr "$2" : '\(.\)'`
Packit 4a16fb
Packit 4a16fb
    case $_G_delim$_G_current_value$_G_delim in
Packit 4a16fb
      *"$2$_G_delim"*) ;;
Packit 4a16fb
      *) func_append "$@" ;;
Packit 4a16fb
    esac
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_arith TERM...
Packit 4a16fb
# ------------------
Packit 4a16fb
# Set func_arith_result to the result of evaluating TERMs.
Packit 4a16fb
  test -z "$_G_HAVE_ARITH_OP" \
Packit 4a16fb
    && (eval 'test 2 = $(( 1 + 1 ))') 2>/dev/null \
Packit 4a16fb
    && _G_HAVE_ARITH_OP=yes
Packit 4a16fb
Packit 4a16fb
if test yes = "$_G_HAVE_ARITH_OP"; then
Packit 4a16fb
  eval 'func_arith ()
Packit 4a16fb
  {
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    func_arith_result=$(( $* ))
Packit 4a16fb
  }'
Packit 4a16fb
else
Packit 4a16fb
  func_arith ()
Packit 4a16fb
  {
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    func_arith_result=`expr "$@"`
Packit 4a16fb
  }
Packit 4a16fb
fi
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_basename FILE
Packit 4a16fb
# ------------------
Packit 4a16fb
# Set func_basename_result to FILE with everything up to and including
Packit 4a16fb
# the last / stripped.
Packit 4a16fb
if test yes = "$_G_HAVE_XSI_OPS"; then
Packit 4a16fb
  # If this shell supports suffix pattern removal, then use it to avoid
Packit 4a16fb
  # forking. Hide the definitions single quotes in case the shell chokes
Packit 4a16fb
  # on unsupported syntax...
Packit 4a16fb
  _b='func_basename_result=${1##*/}'
Packit 4a16fb
  _d='case $1 in
Packit 4a16fb
        */*) func_dirname_result=${1%/*}$2 ;;
Packit 4a16fb
        *  ) func_dirname_result=$3        ;;
Packit 4a16fb
      esac'
Packit 4a16fb
Packit 4a16fb
else
Packit 4a16fb
  # ...otherwise fall back to using sed.
Packit 4a16fb
  _b='func_basename_result=`$ECHO "$1" |$SED "$sed_basename"`'
Packit 4a16fb
  _d='func_dirname_result=`$ECHO "$1"  |$SED "$sed_dirname"`
Packit 4a16fb
      if test "X$func_dirname_result" = "X$1"; then
Packit 4a16fb
        func_dirname_result=$3
Packit 4a16fb
      else
Packit 4a16fb
        func_append func_dirname_result "$2"
Packit 4a16fb
      fi'
Packit 4a16fb
fi
Packit 4a16fb
Packit 4a16fb
eval 'func_basename ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    '"$_b"'
Packit 4a16fb
}'
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_dirname FILE APPEND NONDIR_REPLACEMENT
Packit 4a16fb
# -------------------------------------------
Packit 4a16fb
# Compute the dirname of FILE.  If nonempty, add APPEND to the result,
Packit 4a16fb
# otherwise set result to NONDIR_REPLACEMENT.
Packit 4a16fb
eval 'func_dirname ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    '"$_d"'
Packit 4a16fb
}'
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_dirname_and_basename FILE APPEND NONDIR_REPLACEMENT
Packit 4a16fb
# --------------------------------------------------------
Packit 4a16fb
# Perform func_basename and func_dirname in a single function
Packit 4a16fb
# call:
Packit 4a16fb
#   dirname:  Compute the dirname of FILE.  If nonempty,
Packit 4a16fb
#             add APPEND to the result, otherwise set result
Packit 4a16fb
#             to NONDIR_REPLACEMENT.
Packit 4a16fb
#             value returned in "$func_dirname_result"
Packit 4a16fb
#   basename: Compute filename of FILE.
Packit 4a16fb
#             value retuned in "$func_basename_result"
Packit 4a16fb
# For efficiency, we do not delegate to the functions above but instead
Packit 4a16fb
# duplicate the functionality here.
Packit 4a16fb
eval 'func_dirname_and_basename ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    '"$_b"'
Packit 4a16fb
    '"$_d"'
Packit 4a16fb
}'
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_echo ARG...
Packit 4a16fb
# ----------------
Packit 4a16fb
# Echo program name prefixed message.
Packit 4a16fb
func_echo ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    _G_message=$*
Packit 4a16fb
Packit 4a16fb
    func_echo_IFS=$IFS
Packit 4a16fb
    IFS=$nl
Packit 4a16fb
    for _G_line in $_G_message; do
Packit 4a16fb
      IFS=$func_echo_IFS
Packit 4a16fb
      $ECHO "$progname: $_G_line"
Packit 4a16fb
    done
Packit 4a16fb
    IFS=$func_echo_IFS
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_echo_all ARG...
Packit 4a16fb
# --------------------
Packit 4a16fb
# Invoke $ECHO with all args, space-separated.
Packit 4a16fb
func_echo_all ()
Packit 4a16fb
{
Packit 4a16fb
    $ECHO "$*"
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_echo_infix_1 INFIX ARG...
Packit 4a16fb
# ------------------------------
Packit 4a16fb
# Echo program name, followed by INFIX on the first line, with any
Packit 4a16fb
# additional lines not showing INFIX.
Packit 4a16fb
func_echo_infix_1 ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    $require_term_colors
Packit 4a16fb
Packit 4a16fb
    _G_infix=$1; shift
Packit 4a16fb
    _G_indent=$_G_infix
Packit 4a16fb
    _G_prefix="$progname: $_G_infix: "
Packit 4a16fb
    _G_message=$*
Packit 4a16fb
Packit 4a16fb
    # Strip color escape sequences before counting printable length
Packit 4a16fb
    for _G_tc in "$tc_reset" "$tc_bold" "$tc_standout" "$tc_red" "$tc_green" "$tc_blue" "$tc_cyan"
Packit 4a16fb
    do
Packit 4a16fb
      test -n "$_G_tc" && {
Packit 4a16fb
        _G_esc_tc=`$ECHO "$_G_tc" | $SED "$sed_make_literal_regex"`
Packit 4a16fb
        _G_indent=`$ECHO "$_G_indent" | $SED "s|$_G_esc_tc||g"`
Packit 4a16fb
      }
Packit 4a16fb
    done
Packit 4a16fb
    _G_indent="$progname: "`echo "$_G_indent" | $SED 's|.| |g'`"  " ## exclude from sc_prohibit_nested_quotes
Packit 4a16fb
Packit 4a16fb
    func_echo_infix_1_IFS=$IFS
Packit 4a16fb
    IFS=$nl
Packit 4a16fb
    for _G_line in $_G_message; do
Packit 4a16fb
      IFS=$func_echo_infix_1_IFS
Packit 4a16fb
      $ECHO "$_G_prefix$tc_bold$_G_line$tc_reset" >&2
Packit 4a16fb
      _G_prefix=$_G_indent
Packit 4a16fb
    done
Packit 4a16fb
    IFS=$func_echo_infix_1_IFS
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_error ARG...
Packit 4a16fb
# -----------------
Packit 4a16fb
# Echo program name prefixed message to standard error.
Packit 4a16fb
func_error ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    $require_term_colors
Packit 4a16fb
Packit 4a16fb
    func_echo_infix_1 "  $tc_standout${tc_red}error$tc_reset" "$*" >&2
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_fatal_error ARG...
Packit 4a16fb
# -----------------------
Packit 4a16fb
# Echo program name prefixed message to standard error, and exit.
Packit 4a16fb
func_fatal_error ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    func_error "$*"
Packit 4a16fb
    exit $EXIT_FAILURE
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_grep EXPRESSION FILENAME
Packit 4a16fb
# -----------------------------
Packit 4a16fb
# Check whether EXPRESSION matches any line of FILENAME, without output.
Packit 4a16fb
func_grep ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    $GREP "$1" "$2" >/dev/null 2>&1
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_len STRING
Packit 4a16fb
# ---------------
Packit 4a16fb
# Set func_len_result to the length of STRING. STRING may not
Packit 4a16fb
# start with a hyphen.
Packit 4a16fb
  test -z "$_G_HAVE_XSI_OPS" \
Packit 4a16fb
    && (eval 'x=a/b/c;
Packit 4a16fb
      test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
Packit 4a16fb
    && _G_HAVE_XSI_OPS=yes
Packit 4a16fb
Packit 4a16fb
if test yes = "$_G_HAVE_XSI_OPS"; then
Packit 4a16fb
  eval 'func_len ()
Packit 4a16fb
  {
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    func_len_result=${#1}
Packit 4a16fb
  }'
Packit 4a16fb
else
Packit 4a16fb
  func_len ()
Packit 4a16fb
  {
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    func_len_result=`expr "$1" : ".*" 2>/dev/null || echo $max_cmd_len`
Packit 4a16fb
  }
Packit 4a16fb
fi
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_mkdir_p DIRECTORY-PATH
Packit 4a16fb
# ---------------------------
Packit 4a16fb
# Make sure the entire path to DIRECTORY-PATH is available.
Packit 4a16fb
func_mkdir_p ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    _G_directory_path=$1
Packit 4a16fb
    _G_dir_list=
Packit 4a16fb
Packit 4a16fb
    if test -n "$_G_directory_path" && test : != "$opt_dry_run"; then
Packit 4a16fb
Packit 4a16fb
      # Protect directory names starting with '-'
Packit 4a16fb
      case $_G_directory_path in
Packit 4a16fb
        -*) _G_directory_path=./$_G_directory_path ;;
Packit 4a16fb
      esac
Packit 4a16fb
Packit 4a16fb
      # While some portion of DIR does not yet exist...
Packit 4a16fb
      while test ! -d "$_G_directory_path"; do
Packit 4a16fb
        # ...make a list in topmost first order.  Use a colon delimited
Packit 4a16fb
	# list incase some portion of path contains whitespace.
Packit 4a16fb
        _G_dir_list=$_G_directory_path:$_G_dir_list
Packit 4a16fb
Packit 4a16fb
        # If the last portion added has no slash in it, the list is done
Packit 4a16fb
        case $_G_directory_path in */*) ;; *) break ;; esac
Packit 4a16fb
Packit 4a16fb
        # ...otherwise throw away the child directory and loop
Packit 4a16fb
        _G_directory_path=`$ECHO "$_G_directory_path" | $SED -e "$sed_dirname"`
Packit 4a16fb
      done
Packit 4a16fb
      _G_dir_list=`$ECHO "$_G_dir_list" | $SED 's|:*$||'`
Packit 4a16fb
Packit 4a16fb
      func_mkdir_p_IFS=$IFS; IFS=:
Packit 4a16fb
      for _G_dir in $_G_dir_list; do
Packit 4a16fb
	IFS=$func_mkdir_p_IFS
Packit 4a16fb
        # mkdir can fail with a 'File exist' error if two processes
Packit 4a16fb
        # try to create one of the directories concurrently.  Don't
Packit 4a16fb
        # stop in that case!
Packit 4a16fb
        $MKDIR "$_G_dir" 2>/dev/null || :
Packit 4a16fb
      done
Packit 4a16fb
      IFS=$func_mkdir_p_IFS
Packit 4a16fb
Packit 4a16fb
      # Bail out if we (or some other process) failed to create a directory.
Packit 4a16fb
      test -d "$_G_directory_path" || \
Packit 4a16fb
        func_fatal_error "Failed to create '$1'"
Packit 4a16fb
    fi
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_mktempdir [BASENAME]
Packit 4a16fb
# -------------------------
Packit 4a16fb
# Make a temporary directory that won't clash with other running
Packit 4a16fb
# libtool processes, and avoids race conditions if possible.  If
Packit 4a16fb
# given, BASENAME is the basename for that directory.
Packit 4a16fb
func_mktempdir ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    _G_template=${TMPDIR-/tmp}/${1-$progname}
Packit 4a16fb
Packit 4a16fb
    if test : = "$opt_dry_run"; then
Packit 4a16fb
      # Return a directory name, but don't create it in dry-run mode
Packit 4a16fb
      _G_tmpdir=$_G_template-$$
Packit 4a16fb
    else
Packit 4a16fb
Packit 4a16fb
      # If mktemp works, use that first and foremost
Packit 4a16fb
      _G_tmpdir=`mktemp -d "$_G_template-XXXXXXXX" 2>/dev/null`
Packit 4a16fb
Packit 4a16fb
      if test ! -d "$_G_tmpdir"; then
Packit 4a16fb
        # Failing that, at least try and use $RANDOM to avoid a race
Packit 4a16fb
        _G_tmpdir=$_G_template-${RANDOM-0}$$
Packit 4a16fb
Packit 4a16fb
        func_mktempdir_umask=`umask`
Packit 4a16fb
        umask 0077
Packit 4a16fb
        $MKDIR "$_G_tmpdir"
Packit 4a16fb
        umask $func_mktempdir_umask
Packit 4a16fb
      fi
Packit 4a16fb
Packit 4a16fb
      # If we're not in dry-run mode, bomb out on failure
Packit 4a16fb
      test -d "$_G_tmpdir" || \
Packit 4a16fb
        func_fatal_error "cannot create temporary directory '$_G_tmpdir'"
Packit 4a16fb
    fi
Packit 4a16fb
Packit 4a16fb
    $ECHO "$_G_tmpdir"
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_normal_abspath PATH
Packit 4a16fb
# ------------------------
Packit 4a16fb
# Remove doubled-up and trailing slashes, "." path components,
Packit 4a16fb
# and cancel out any ".." path components in PATH after making
Packit 4a16fb
# it an absolute path.
Packit 4a16fb
func_normal_abspath ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    # These SED scripts presuppose an absolute path with a trailing slash.
Packit 4a16fb
    _G_pathcar='s|^/\([^/]*\).*$|\1|'
Packit 4a16fb
    _G_pathcdr='s|^/[^/]*||'
Packit 4a16fb
    _G_removedotparts=':dotsl
Packit 4a16fb
		s|/\./|/|g
Packit 4a16fb
		t dotsl
Packit 4a16fb
		s|/\.$|/|'
Packit 4a16fb
    _G_collapseslashes='s|/\{1,\}|/|g'
Packit 4a16fb
    _G_finalslash='s|/*$|/|'
Packit 4a16fb
Packit 4a16fb
    # Start from root dir and reassemble the path.
Packit 4a16fb
    func_normal_abspath_result=
Packit 4a16fb
    func_normal_abspath_tpath=$1
Packit 4a16fb
    func_normal_abspath_altnamespace=
Packit 4a16fb
    case $func_normal_abspath_tpath in
Packit 4a16fb
      "")
Packit 4a16fb
        # Empty path, that just means $cwd.
Packit 4a16fb
        func_stripname '' '/' "`pwd`"
Packit 4a16fb
        func_normal_abspath_result=$func_stripname_result
Packit 4a16fb
        return
Packit 4a16fb
        ;;
Packit 4a16fb
      # The next three entries are used to spot a run of precisely
Packit 4a16fb
      # two leading slashes without using negated character classes;
Packit 4a16fb
      # we take advantage of case's first-match behaviour.
Packit 4a16fb
      ///*)
Packit 4a16fb
        # Unusual form of absolute path, do nothing.
Packit 4a16fb
        ;;
Packit 4a16fb
      //*)
Packit 4a16fb
        # Not necessarily an ordinary path; POSIX reserves leading '//'
Packit 4a16fb
        # and for example Cygwin uses it to access remote file shares
Packit 4a16fb
        # over CIFS/SMB, so we conserve a leading double slash if found.
Packit 4a16fb
        func_normal_abspath_altnamespace=/
Packit 4a16fb
        ;;
Packit 4a16fb
      /*)
Packit 4a16fb
        # Absolute path, do nothing.
Packit 4a16fb
        ;;
Packit 4a16fb
      *)
Packit 4a16fb
        # Relative path, prepend $cwd.
Packit 4a16fb
        func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
Packit 4a16fb
        ;;
Packit 4a16fb
    esac
Packit 4a16fb
Packit 4a16fb
    # Cancel out all the simple stuff to save iterations.  We also want
Packit 4a16fb
    # the path to end with a slash for ease of parsing, so make sure
Packit 4a16fb
    # there is one (and only one) here.
Packit 4a16fb
    func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
Packit 4a16fb
          -e "$_G_removedotparts" -e "$_G_collapseslashes" -e "$_G_finalslash"`
Packit 4a16fb
    while :; do
Packit 4a16fb
      # Processed it all yet?
Packit 4a16fb
      if test / = "$func_normal_abspath_tpath"; then
Packit 4a16fb
        # If we ascended to the root using ".." the result may be empty now.
Packit 4a16fb
        if test -z "$func_normal_abspath_result"; then
Packit 4a16fb
          func_normal_abspath_result=/
Packit 4a16fb
        fi
Packit 4a16fb
        break
Packit 4a16fb
      fi
Packit 4a16fb
      func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
Packit 4a16fb
          -e "$_G_pathcar"`
Packit 4a16fb
      func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
Packit 4a16fb
          -e "$_G_pathcdr"`
Packit 4a16fb
      # Figure out what to do with it
Packit 4a16fb
      case $func_normal_abspath_tcomponent in
Packit 4a16fb
        "")
Packit 4a16fb
          # Trailing empty path component, ignore it.
Packit 4a16fb
          ;;
Packit 4a16fb
        ..)
Packit 4a16fb
          # Parent dir; strip last assembled component from result.
Packit 4a16fb
          func_dirname "$func_normal_abspath_result"
Packit 4a16fb
          func_normal_abspath_result=$func_dirname_result
Packit 4a16fb
          ;;
Packit 4a16fb
        *)
Packit 4a16fb
          # Actual path component, append it.
Packit 4a16fb
          func_append func_normal_abspath_result "/$func_normal_abspath_tcomponent"
Packit 4a16fb
          ;;
Packit 4a16fb
      esac
Packit 4a16fb
    done
Packit 4a16fb
    # Restore leading double-slash if one was found on entry.
Packit 4a16fb
    func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_notquiet ARG...
Packit 4a16fb
# --------------------
Packit 4a16fb
# Echo program name prefixed message only when not in quiet mode.
Packit 4a16fb
func_notquiet ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    $opt_quiet || func_echo ${1+"$@"}
Packit 4a16fb
Packit 4a16fb
    # A bug in bash halts the script if the last line of a function
Packit 4a16fb
    # fails when set -e is in force, so we need another command to
Packit 4a16fb
    # work around that:
Packit 4a16fb
    :
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_relative_path SRCDIR DSTDIR
Packit 4a16fb
# --------------------------------
Packit 4a16fb
# Set func_relative_path_result to the relative path from SRCDIR to DSTDIR.
Packit 4a16fb
func_relative_path ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    func_relative_path_result=
Packit 4a16fb
    func_normal_abspath "$1"
Packit 4a16fb
    func_relative_path_tlibdir=$func_normal_abspath_result
Packit 4a16fb
    func_normal_abspath "$2"
Packit 4a16fb
    func_relative_path_tbindir=$func_normal_abspath_result
Packit 4a16fb
Packit 4a16fb
    # Ascend the tree starting from libdir
Packit 4a16fb
    while :; do
Packit 4a16fb
      # check if we have found a prefix of bindir
Packit 4a16fb
      case $func_relative_path_tbindir in
Packit 4a16fb
        $func_relative_path_tlibdir)
Packit 4a16fb
          # found an exact match
Packit 4a16fb
          func_relative_path_tcancelled=
Packit 4a16fb
          break
Packit 4a16fb
          ;;
Packit 4a16fb
        $func_relative_path_tlibdir*)
Packit 4a16fb
          # found a matching prefix
Packit 4a16fb
          func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
Packit 4a16fb
          func_relative_path_tcancelled=$func_stripname_result
Packit 4a16fb
          if test -z "$func_relative_path_result"; then
Packit 4a16fb
            func_relative_path_result=.
Packit 4a16fb
          fi
Packit 4a16fb
          break
Packit 4a16fb
          ;;
Packit 4a16fb
        *)
Packit 4a16fb
          func_dirname $func_relative_path_tlibdir
Packit 4a16fb
          func_relative_path_tlibdir=$func_dirname_result
Packit 4a16fb
          if test -z "$func_relative_path_tlibdir"; then
Packit 4a16fb
            # Have to descend all the way to the root!
Packit 4a16fb
            func_relative_path_result=../$func_relative_path_result
Packit 4a16fb
            func_relative_path_tcancelled=$func_relative_path_tbindir
Packit 4a16fb
            break
Packit 4a16fb
          fi
Packit 4a16fb
          func_relative_path_result=../$func_relative_path_result
Packit 4a16fb
          ;;
Packit 4a16fb
      esac
Packit 4a16fb
    done
Packit 4a16fb
Packit 4a16fb
    # Now calculate path; take care to avoid doubling-up slashes.
Packit 4a16fb
    func_stripname '' '/' "$func_relative_path_result"
Packit 4a16fb
    func_relative_path_result=$func_stripname_result
Packit 4a16fb
    func_stripname '/' '/' "$func_relative_path_tcancelled"
Packit 4a16fb
    if test -n "$func_stripname_result"; then
Packit 4a16fb
      func_append func_relative_path_result "/$func_stripname_result"
Packit 4a16fb
    fi
Packit 4a16fb
Packit 4a16fb
    # Normalisation. If bindir is libdir, return '.' else relative path.
Packit 4a16fb
    if test -n "$func_relative_path_result"; then
Packit 4a16fb
      func_stripname './' '' "$func_relative_path_result"
Packit 4a16fb
      func_relative_path_result=$func_stripname_result
Packit 4a16fb
    fi
Packit 4a16fb
Packit 4a16fb
    test -n "$func_relative_path_result" || func_relative_path_result=.
Packit 4a16fb
Packit 4a16fb
    :
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_quote_for_eval ARG...
Packit 4a16fb
# --------------------------
Packit 4a16fb
# Aesthetically quote ARGs to be evaled later.
Packit 4a16fb
# This function returns two values:
Packit 4a16fb
#   i) func_quote_for_eval_result
Packit 4a16fb
#      double-quoted, suitable for a subsequent eval
Packit 4a16fb
#  ii) func_quote_for_eval_unquoted_result
Packit 4a16fb
#      has all characters that are still active within double
Packit 4a16fb
#      quotes backslashified.
Packit 4a16fb
func_quote_for_eval ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    func_quote_for_eval_unquoted_result=
Packit 4a16fb
    func_quote_for_eval_result=
Packit 4a16fb
    while test 0 -lt $#; do
Packit 4a16fb
      case $1 in
Packit 4a16fb
        *[\\\`\"\$]*)
Packit 4a16fb
	  _G_unquoted_arg=`printf '%s\n' "$1" |$SED "$sed_quote_subst"` ;;
Packit 4a16fb
        *)
Packit 4a16fb
          _G_unquoted_arg=$1 ;;
Packit 4a16fb
      esac
Packit 4a16fb
      if test -n "$func_quote_for_eval_unquoted_result"; then
Packit 4a16fb
	func_append func_quote_for_eval_unquoted_result " $_G_unquoted_arg"
Packit 4a16fb
      else
Packit 4a16fb
        func_append func_quote_for_eval_unquoted_result "$_G_unquoted_arg"
Packit 4a16fb
      fi
Packit 4a16fb
Packit 4a16fb
      case $_G_unquoted_arg in
Packit 4a16fb
        # Double-quote args containing shell metacharacters to delay
Packit 4a16fb
        # word splitting, command substitution and variable expansion
Packit 4a16fb
        # for a subsequent eval.
Packit 4a16fb
        # Many Bourne shells cannot handle close brackets correctly
Packit 4a16fb
        # in scan sets, so we specify it separately.
Packit 4a16fb
        *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
Packit 4a16fb
          _G_quoted_arg=\"$_G_unquoted_arg\"
Packit 4a16fb
          ;;
Packit 4a16fb
        *)
Packit 4a16fb
          _G_quoted_arg=$_G_unquoted_arg
Packit 4a16fb
	  ;;
Packit 4a16fb
      esac
Packit 4a16fb
Packit 4a16fb
      if test -n "$func_quote_for_eval_result"; then
Packit 4a16fb
	func_append func_quote_for_eval_result " $_G_quoted_arg"
Packit 4a16fb
      else
Packit 4a16fb
        func_append func_quote_for_eval_result "$_G_quoted_arg"
Packit 4a16fb
      fi
Packit 4a16fb
      shift
Packit 4a16fb
    done
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_quote_for_expand ARG
Packit 4a16fb
# -------------------------
Packit 4a16fb
# Aesthetically quote ARG to be evaled later; same as above,
Packit 4a16fb
# but do not quote variable references.
Packit 4a16fb
func_quote_for_expand ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    case $1 in
Packit 4a16fb
      *[\\\`\"]*)
Packit 4a16fb
	_G_arg=`$ECHO "$1" | $SED \
Packit 4a16fb
	    -e "$sed_double_quote_subst" -e "$sed_double_backslash"` ;;
Packit 4a16fb
      *)
Packit 4a16fb
        _G_arg=$1 ;;
Packit 4a16fb
    esac
Packit 4a16fb
Packit 4a16fb
    case $_G_arg in
Packit 4a16fb
      # Double-quote args containing shell metacharacters to delay
Packit 4a16fb
      # word splitting and command substitution for a subsequent eval.
Packit 4a16fb
      # Many Bourne shells cannot handle close brackets correctly
Packit 4a16fb
      # in scan sets, so we specify it separately.
Packit 4a16fb
      *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \	]*|*]*|"")
Packit 4a16fb
        _G_arg=\"$_G_arg\"
Packit 4a16fb
        ;;
Packit 4a16fb
    esac
Packit 4a16fb
Packit 4a16fb
    func_quote_for_expand_result=$_G_arg
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_stripname PREFIX SUFFIX NAME
Packit 4a16fb
# ---------------------------------
Packit 4a16fb
# strip PREFIX and SUFFIX from NAME, and store in func_stripname_result.
Packit 4a16fb
# PREFIX and SUFFIX must not contain globbing or regex special
Packit 4a16fb
# characters, hashes, percent signs, but SUFFIX may contain a leading
Packit 4a16fb
# dot (in which case that matches only a dot).
Packit 4a16fb
if test yes = "$_G_HAVE_XSI_OPS"; then
Packit 4a16fb
  eval 'func_stripname ()
Packit 4a16fb
  {
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
Packit 4a16fb
    # positional parameters, so assign one to ordinary variable first.
Packit 4a16fb
    func_stripname_result=$3
Packit 4a16fb
    func_stripname_result=${func_stripname_result#"$1"}
Packit 4a16fb
    func_stripname_result=${func_stripname_result%"$2"}
Packit 4a16fb
  }'
Packit 4a16fb
else
Packit 4a16fb
  func_stripname ()
Packit 4a16fb
  {
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    case $2 in
Packit 4a16fb
      .*) func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%\\\\$2\$%%"`;;
Packit 4a16fb
      *)  func_stripname_result=`$ECHO "$3" | $SED -e "s%^$1%%" -e "s%$2\$%%"`;;
Packit 4a16fb
    esac
Packit 4a16fb
  }
Packit 4a16fb
fi
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_show_eval CMD [FAIL_EXP]
Packit 4a16fb
# -----------------------------
Packit 4a16fb
# Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
Packit 4a16fb
# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
Packit 4a16fb
# is given, then evaluate it.
Packit 4a16fb
func_show_eval ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    _G_cmd=$1
Packit 4a16fb
    _G_fail_exp=${2-':'}
Packit 4a16fb
Packit 4a16fb
    func_quote_for_expand "$_G_cmd"
Packit 4a16fb
    eval "func_notquiet $func_quote_for_expand_result"
Packit 4a16fb
Packit 4a16fb
    $opt_dry_run || {
Packit 4a16fb
      eval "$_G_cmd"
Packit 4a16fb
      _G_status=$?
Packit 4a16fb
      if test 0 -ne "$_G_status"; then
Packit 4a16fb
	eval "(exit $_G_status); $_G_fail_exp"
Packit 4a16fb
      fi
Packit 4a16fb
    }
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_show_eval_locale CMD [FAIL_EXP]
Packit 4a16fb
# ------------------------------------
Packit 4a16fb
# Unless opt_quiet is true, then output CMD.  Then, if opt_dryrun is
Packit 4a16fb
# not true, evaluate CMD.  If the evaluation of CMD fails, and FAIL_EXP
Packit 4a16fb
# is given, then evaluate it.  Use the saved locale for evaluation.
Packit 4a16fb
func_show_eval_locale ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    _G_cmd=$1
Packit 4a16fb
    _G_fail_exp=${2-':'}
Packit 4a16fb
Packit 4a16fb
    $opt_quiet || {
Packit 4a16fb
      func_quote_for_expand "$_G_cmd"
Packit 4a16fb
      eval "func_echo $func_quote_for_expand_result"
Packit 4a16fb
    }
Packit 4a16fb
Packit 4a16fb
    $opt_dry_run || {
Packit 4a16fb
      eval "$_G_user_locale
Packit 4a16fb
	    $_G_cmd"
Packit 4a16fb
      _G_status=$?
Packit 4a16fb
      eval "$_G_safe_locale"
Packit 4a16fb
      if test 0 -ne "$_G_status"; then
Packit 4a16fb
	eval "(exit $_G_status); $_G_fail_exp"
Packit 4a16fb
      fi
Packit 4a16fb
    }
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_tr_sh
Packit 4a16fb
# ----------
Packit 4a16fb
# Turn $1 into a string suitable for a shell variable name.
Packit 4a16fb
# Result is stored in $func_tr_sh_result.  All characters
Packit 4a16fb
# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
Packit 4a16fb
# if $1 begins with a digit, a '_' is prepended as well.
Packit 4a16fb
func_tr_sh ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    case $1 in
Packit 4a16fb
    [0-9]* | *[!a-zA-Z0-9_]*)
Packit 4a16fb
      func_tr_sh_result=`$ECHO "$1" | $SED -e 's/^\([0-9]\)/_\1/' -e 's/[^a-zA-Z0-9_]/_/g'`
Packit 4a16fb
      ;;
Packit 4a16fb
    * )
Packit 4a16fb
      func_tr_sh_result=$1
Packit 4a16fb
      ;;
Packit 4a16fb
    esac
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_verbose ARG...
Packit 4a16fb
# -------------------
Packit 4a16fb
# Echo program name prefixed message in verbose mode only.
Packit 4a16fb
func_verbose ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    $opt_verbose && func_echo "$*"
Packit 4a16fb
Packit 4a16fb
    :
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_warn_and_continue ARG...
Packit 4a16fb
# -----------------------------
Packit 4a16fb
# Echo program name prefixed warning message to standard error.
Packit 4a16fb
func_warn_and_continue ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    $require_term_colors
Packit 4a16fb
Packit 4a16fb
    func_echo_infix_1 "${tc_red}warning$tc_reset" "$*" >&2
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_warning CATEGORY ARG...
Packit 4a16fb
# ----------------------------
Packit 4a16fb
# Echo program name prefixed warning message to standard error. Warning
Packit 4a16fb
# messages can be filtered according to CATEGORY, where this function
Packit 4a16fb
# elides messages where CATEGORY is not listed in the global variable
Packit 4a16fb
# 'opt_warning_types'.
Packit 4a16fb
func_warning ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    # CATEGORY must be in the warning_categories list!
Packit 4a16fb
    case " $warning_categories " in
Packit 4a16fb
      *" $1 "*) ;;
Packit 4a16fb
      *) func_internal_error "invalid warning category '$1'" ;;
Packit 4a16fb
    esac
Packit 4a16fb
Packit 4a16fb
    _G_category=$1
Packit 4a16fb
    shift
Packit 4a16fb
Packit 4a16fb
    case " $opt_warning_types " in
Packit 4a16fb
      *" $_G_category "*) $warning_func ${1+"$@"} ;;
Packit 4a16fb
    esac
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_sort_ver VER1 VER2
Packit 4a16fb
# -----------------------
Packit 4a16fb
# 'sort -V' is not generally available.
Packit 4a16fb
# Note this deviates from the version comparison in automake
Packit 4a16fb
# in that it treats 1.5 < 1.5.0, and treats 1.4.4a < 1.4-p3a
Packit 4a16fb
# but this should suffice as we won't be specifying old
Packit 4a16fb
# version formats or redundant trailing .0 in bootstrap.conf.
Packit 4a16fb
# If we did want full compatibility then we should probably
Packit 4a16fb
# use m4_version_compare from autoconf.
Packit 4a16fb
func_sort_ver ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    printf '%s\n%s\n' "$1" "$2" \
Packit 4a16fb
      | 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 4a16fb
}
Packit 4a16fb
Packit 4a16fb
# func_lt_ver PREV CURR
Packit 4a16fb
# ---------------------
Packit 4a16fb
# Return true if PREV and CURR are in the correct order according to
Packit 4a16fb
# func_sort_ver, otherwise false.  Use it like this:
Packit 4a16fb
#
Packit 4a16fb
#  func_lt_ver "$prev_ver" "$proposed_ver" || func_fatal_error "..."
Packit 4a16fb
func_lt_ver ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    test "x$1" = x`func_sort_ver "$1" "$2" | $SED 1q`
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# Local variables:
Packit 4a16fb
# mode: shell-script
Packit 4a16fb
# sh-indentation: 2
Packit 4a16fb
# eval: (add-hook 'before-save-hook 'time-stamp)
Packit 4a16fb
# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
Packit 4a16fb
# time-stamp-time-zone: "UTC"
Packit 4a16fb
# End:
Packit 4a16fb
#! /bin/sh
Packit 4a16fb
Packit 4a16fb
# Set a version string for this script.
Packit 4a16fb
scriptversion=2014-01-07.03; # UTC
Packit 4a16fb
Packit 4a16fb
# A portable, pluggable option parser for Bourne shell.
Packit 4a16fb
# Written by Gary V. Vaughan, 2010
Packit 4a16fb
Packit 4a16fb
# Copyright (C) 2010-2015 Free Software Foundation, Inc.
Packit 4a16fb
# This is free software; see the source for copying conditions.  There is NO
Packit 4a16fb
# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Packit 4a16fb
Packit 4a16fb
# This program is free software: you can redistribute it and/or modify
Packit 4a16fb
# it under the terms of the GNU General Public License as published by
Packit 4a16fb
# the Free Software Foundation, either version 3 of the License, or
Packit 4a16fb
# (at your option) any later version.
Packit 4a16fb
Packit 4a16fb
# This program is distributed in the hope that it will be useful,
Packit 4a16fb
# but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 4a16fb
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit 4a16fb
# GNU General Public License for more details.
Packit 4a16fb
Packit 4a16fb
# You should have received a copy of the GNU General Public License
Packit 4a16fb
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
Packit 4a16fb
Packit 4a16fb
# Please report bugs or propose patches to gary@gnu.org.
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
## ------ ##
Packit 4a16fb
## Usage. ##
Packit 4a16fb
## ------ ##
Packit 4a16fb
Packit 4a16fb
# This file is a library for parsing options in your shell scripts along
Packit 4a16fb
# with assorted other useful supporting features that you can make use
Packit 4a16fb
# of too.
Packit 4a16fb
#
Packit 4a16fb
# For the simplest scripts you might need only:
Packit 4a16fb
#
Packit 4a16fb
#   #!/bin/sh
Packit 4a16fb
#   . relative/path/to/funclib.sh
Packit 4a16fb
#   . relative/path/to/options-parser
Packit 4a16fb
#   scriptversion=1.0
Packit 4a16fb
#   func_options ${1+"$@"}
Packit 4a16fb
#   eval set dummy "$func_options_result"; shift
Packit 4a16fb
#   ...rest of your script...
Packit 4a16fb
#
Packit 4a16fb
# In order for the '--version' option to work, you will need to have a
Packit 4a16fb
# suitably formatted comment like the one at the top of this file
Packit 4a16fb
# starting with '# Written by ' and ending with '# warranty; '.
Packit 4a16fb
#
Packit 4a16fb
# For '-h' and '--help' to work, you will also need a one line
Packit 4a16fb
# description of your script's purpose in a comment directly above the
Packit 4a16fb
# '# Written by ' line, like the one at the top of this file.
Packit 4a16fb
#
Packit 4a16fb
# The default options also support '--debug', which will turn on shell
Packit 4a16fb
# execution tracing (see the comment above debug_cmd below for another
Packit 4a16fb
# use), and '--verbose' and the func_verbose function to allow your script
Packit 4a16fb
# to display verbose messages only when your user has specified
Packit 4a16fb
# '--verbose'.
Packit 4a16fb
#
Packit 4a16fb
# After sourcing this file, you can plug processing for additional
Packit 4a16fb
# options by amending the variables from the 'Configuration' section
Packit 4a16fb
# below, and following the instructions in the 'Option parsing'
Packit 4a16fb
# section further down.
Packit 4a16fb
Packit 4a16fb
## -------------- ##
Packit 4a16fb
## Configuration. ##
Packit 4a16fb
## -------------- ##
Packit 4a16fb
Packit 4a16fb
# You should override these variables in your script after sourcing this
Packit 4a16fb
# file so that they reflect the customisations you have added to the
Packit 4a16fb
# option parser.
Packit 4a16fb
Packit 4a16fb
# The usage line for option parsing errors and the start of '-h' and
Packit 4a16fb
# '--help' output messages. You can embed shell variables for delayed
Packit 4a16fb
# expansion at the time the message is displayed, but you will need to
Packit 4a16fb
# quote other shell meta-characters carefully to prevent them being
Packit 4a16fb
# expanded when the contents are evaled.
Packit 4a16fb
usage='$progpath [OPTION]...'
Packit 4a16fb
Packit 4a16fb
# Short help message in response to '-h' and '--help'.  Add to this or
Packit 4a16fb
# override it after sourcing this library to reflect the full set of
Packit 4a16fb
# options your script accepts.
Packit 4a16fb
usage_message="\
Packit 4a16fb
       --debug        enable verbose shell tracing
Packit 4a16fb
   -W, --warnings=CATEGORY
Packit 4a16fb
                      report the warnings falling in CATEGORY [all]
Packit 4a16fb
   -v, --verbose      verbosely report processing
Packit 4a16fb
       --version      print version information and exit
Packit 4a16fb
   -h, --help         print short or long help message and exit
Packit 4a16fb
"
Packit 4a16fb
Packit 4a16fb
# Additional text appended to 'usage_message' in response to '--help'.
Packit 4a16fb
long_help_message="
Packit 4a16fb
Warning categories include:
Packit 4a16fb
       'all'          show all warnings
Packit 4a16fb
       'none'         turn off all the warnings
Packit 4a16fb
       'error'        warnings are treated as fatal errors"
Packit 4a16fb
Packit 4a16fb
# Help message printed before fatal option parsing errors.
Packit 4a16fb
fatal_help="Try '\$progname --help' for more information."
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
## ------------------------- ##
Packit 4a16fb
## Hook function management. ##
Packit 4a16fb
## ------------------------- ##
Packit 4a16fb
Packit 4a16fb
# This section contains functions for adding, removing, and running hooks
Packit 4a16fb
# to the main code.  A hook is just a named list of of function, that can
Packit 4a16fb
# be run in order later on.
Packit 4a16fb
Packit 4a16fb
# func_hookable FUNC_NAME
Packit 4a16fb
# -----------------------
Packit 4a16fb
# Declare that FUNC_NAME will run hooks added with
Packit 4a16fb
# 'func_add_hook FUNC_NAME ...'.
Packit 4a16fb
func_hookable ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    func_append hookable_fns " $1"
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_add_hook FUNC_NAME HOOK_FUNC
Packit 4a16fb
# ---------------------------------
Packit 4a16fb
# Request that FUNC_NAME call HOOK_FUNC before it returns.  FUNC_NAME must
Packit 4a16fb
# first have been declared "hookable" by a call to 'func_hookable'.
Packit 4a16fb
func_add_hook ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    case " $hookable_fns " in
Packit 4a16fb
      *" $1 "*) ;;
Packit 4a16fb
      *) func_fatal_error "'$1' does not accept hook functions." ;;
Packit 4a16fb
    esac
Packit 4a16fb
Packit 4a16fb
    eval func_append ${1}_hooks '" $2"'
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_remove_hook FUNC_NAME HOOK_FUNC
Packit 4a16fb
# ------------------------------------
Packit 4a16fb
# Remove HOOK_FUNC from the list of functions called by FUNC_NAME.
Packit 4a16fb
func_remove_hook ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    eval ${1}_hooks='`$ECHO "\$'$1'_hooks" |$SED "s| '$2'||"`'
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_run_hooks FUNC_NAME [ARG]...
Packit 4a16fb
# ---------------------------------
Packit 4a16fb
# Run all hook functions registered to FUNC_NAME.
Packit 4a16fb
# It is assumed that the list of hook functions contains nothing more
Packit 4a16fb
# than a whitespace-delimited list of legal shell function names, and
Packit 4a16fb
# no effort is wasted trying to catch shell meta-characters or preserve
Packit 4a16fb
# whitespace.
Packit 4a16fb
func_run_hooks ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    case " $hookable_fns " in
Packit 4a16fb
      *" $1 "*) ;;
Packit 4a16fb
      *) func_fatal_error "'$1' does not support hook funcions.n" ;;
Packit 4a16fb
    esac
Packit 4a16fb
Packit 4a16fb
    eval _G_hook_fns=\$$1_hooks; shift
Packit 4a16fb
Packit 4a16fb
    for _G_hook in $_G_hook_fns; do
Packit 4a16fb
      eval $_G_hook '"$@"'
Packit 4a16fb
Packit 4a16fb
      # store returned options list back into positional
Packit 4a16fb
      # parameters for next 'cmd' execution.
Packit 4a16fb
      eval _G_hook_result=\$${_G_hook}_result
Packit 4a16fb
      eval set dummy "$_G_hook_result"; shift
Packit 4a16fb
    done
Packit 4a16fb
Packit 4a16fb
    func_quote_for_eval ${1+"$@"}
Packit 4a16fb
    func_run_hooks_result=$func_quote_for_eval_result
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
## --------------- ##
Packit 4a16fb
## Option parsing. ##
Packit 4a16fb
## --------------- ##
Packit 4a16fb
Packit 4a16fb
# In order to add your own option parsing hooks, you must accept the
Packit 4a16fb
# full positional parameter list in your hook function, remove any
Packit 4a16fb
# options that you action, and then pass back the remaining unprocessed
Packit 4a16fb
# options in '<hooked_function_name>_result', escaped suitably for
Packit 4a16fb
# 'eval'.  Like this:
Packit 4a16fb
#
Packit 4a16fb
#    my_options_prep ()
Packit 4a16fb
#    {
Packit 4a16fb
#        $debug_cmd
Packit 4a16fb
#
Packit 4a16fb
#        # Extend the existing usage message.
Packit 4a16fb
#        usage_message=$usage_message'
Packit 4a16fb
#      -s, --silent       don'\''t print informational messages
Packit 4a16fb
#    '
Packit 4a16fb
#
Packit 4a16fb
#        func_quote_for_eval ${1+"$@"}
Packit 4a16fb
#        my_options_prep_result=$func_quote_for_eval_result
Packit 4a16fb
#    }
Packit 4a16fb
#    func_add_hook func_options_prep my_options_prep
Packit 4a16fb
#
Packit 4a16fb
#
Packit 4a16fb
#    my_silent_option ()
Packit 4a16fb
#    {
Packit 4a16fb
#        $debug_cmd
Packit 4a16fb
#
Packit 4a16fb
#        # Note that for efficiency, we parse as many options as we can
Packit 4a16fb
#        # recognise in a loop before passing the remainder back to the
Packit 4a16fb
#        # caller on the first unrecognised argument we encounter.
Packit 4a16fb
#        while test $# -gt 0; do
Packit 4a16fb
#          opt=$1; shift
Packit 4a16fb
#          case $opt in
Packit 4a16fb
#            --silent|-s) opt_silent=: ;;
Packit 4a16fb
#            # Separate non-argument short options:
Packit 4a16fb
#            -s*)         func_split_short_opt "$_G_opt"
Packit 4a16fb
#                         set dummy "$func_split_short_opt_name" \
Packit 4a16fb
#                             "-$func_split_short_opt_arg" ${1+"$@"}
Packit 4a16fb
#                         shift
Packit 4a16fb
#                         ;;
Packit 4a16fb
#            *)            set dummy "$_G_opt" "$*"; shift; break ;;
Packit 4a16fb
#          esac
Packit 4a16fb
#        done
Packit 4a16fb
#
Packit 4a16fb
#        func_quote_for_eval ${1+"$@"}
Packit 4a16fb
#        my_silent_option_result=$func_quote_for_eval_result
Packit 4a16fb
#    }
Packit 4a16fb
#    func_add_hook func_parse_options my_silent_option
Packit 4a16fb
#
Packit 4a16fb
#
Packit 4a16fb
#    my_option_validation ()
Packit 4a16fb
#    {
Packit 4a16fb
#        $debug_cmd
Packit 4a16fb
#
Packit 4a16fb
#        $opt_silent && $opt_verbose && func_fatal_help "\
Packit 4a16fb
#    '--silent' and '--verbose' options are mutually exclusive."
Packit 4a16fb
#
Packit 4a16fb
#        func_quote_for_eval ${1+"$@"}
Packit 4a16fb
#        my_option_validation_result=$func_quote_for_eval_result
Packit 4a16fb
#    }
Packit 4a16fb
#    func_add_hook func_validate_options my_option_validation
Packit 4a16fb
#
Packit 4a16fb
# You'll alse need to manually amend $usage_message to reflect the extra
Packit 4a16fb
# options you parse.  It's preferable to append if you can, so that
Packit 4a16fb
# multiple option parsing hooks can be added safely.
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_options [ARG]...
Packit 4a16fb
# ---------------------
Packit 4a16fb
# All the functions called inside func_options are hookable. See the
Packit 4a16fb
# individual implementations for details.
Packit 4a16fb
func_hookable func_options
Packit 4a16fb
func_options ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    func_options_prep ${1+"$@"}
Packit 4a16fb
    eval func_parse_options \
Packit 4a16fb
        ${func_options_prep_result+"$func_options_prep_result"}
Packit 4a16fb
    eval func_validate_options \
Packit 4a16fb
        ${func_parse_options_result+"$func_parse_options_result"}
Packit 4a16fb
Packit 4a16fb
    eval func_run_hooks func_options \
Packit 4a16fb
        ${func_validate_options_result+"$func_validate_options_result"}
Packit 4a16fb
Packit 4a16fb
    # save modified positional parameters for caller
Packit 4a16fb
    func_options_result=$func_run_hooks_result
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_options_prep [ARG]...
Packit 4a16fb
# --------------------------
Packit 4a16fb
# All initialisations required before starting the option parse loop.
Packit 4a16fb
# Note that when calling hook functions, we pass through the list of
Packit 4a16fb
# positional parameters.  If a hook function modifies that list, and
Packit 4a16fb
# needs to propogate that back to rest of this script, then the complete
Packit 4a16fb
# modified list must be put in 'func_run_hooks_result' before
Packit 4a16fb
# returning.
Packit 4a16fb
func_hookable func_options_prep
Packit 4a16fb
func_options_prep ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    # Option defaults:
Packit 4a16fb
    opt_verbose=false
Packit 4a16fb
    opt_warning_types=
Packit 4a16fb
Packit 4a16fb
    func_run_hooks func_options_prep ${1+"$@"}
Packit 4a16fb
Packit 4a16fb
    # save modified positional parameters for caller
Packit 4a16fb
    func_options_prep_result=$func_run_hooks_result
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_parse_options [ARG]...
Packit 4a16fb
# ---------------------------
Packit 4a16fb
# The main option parsing loop.
Packit 4a16fb
func_hookable func_parse_options
Packit 4a16fb
func_parse_options ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    func_parse_options_result=
Packit 4a16fb
Packit 4a16fb
    # this just eases exit handling
Packit 4a16fb
    while test $# -gt 0; do
Packit 4a16fb
      # Defer to hook functions for initial option parsing, so they
Packit 4a16fb
      # get priority in the event of reusing an option name.
Packit 4a16fb
      func_run_hooks func_parse_options ${1+"$@"}
Packit 4a16fb
Packit 4a16fb
      # Adjust func_parse_options positional parameters to match
Packit 4a16fb
      eval set dummy "$func_run_hooks_result"; shift
Packit 4a16fb
Packit 4a16fb
      # Break out of the loop if we already parsed every option.
Packit 4a16fb
      test $# -gt 0 || break
Packit 4a16fb
Packit 4a16fb
      _G_opt=$1
Packit 4a16fb
      shift
Packit 4a16fb
      case $_G_opt in
Packit 4a16fb
        --debug|-x)   debug_cmd='set -x'
Packit 4a16fb
                      func_echo "enabling shell trace mode"
Packit 4a16fb
                      $debug_cmd
Packit 4a16fb
                      ;;
Packit 4a16fb
Packit 4a16fb
        --no-warnings|--no-warning|--no-warn)
Packit 4a16fb
                      set dummy --warnings none ${1+"$@"}
Packit 4a16fb
                      shift
Packit 4a16fb
		      ;;
Packit 4a16fb
Packit 4a16fb
        --warnings|--warning|-W)
Packit 4a16fb
                      test $# = 0 && func_missing_arg $_G_opt && break
Packit 4a16fb
                      case " $warning_categories $1" in
Packit 4a16fb
                        *" $1 "*)
Packit 4a16fb
                          # trailing space prevents matching last $1 above
Packit 4a16fb
                          func_append_uniq opt_warning_types " $1"
Packit 4a16fb
                          ;;
Packit 4a16fb
                        *all)
Packit 4a16fb
                          opt_warning_types=$warning_categories
Packit 4a16fb
                          ;;
Packit 4a16fb
                        *none)
Packit 4a16fb
                          opt_warning_types=none
Packit 4a16fb
                          warning_func=:
Packit 4a16fb
                          ;;
Packit 4a16fb
                        *error)
Packit 4a16fb
                          opt_warning_types=$warning_categories
Packit 4a16fb
                          warning_func=func_fatal_error
Packit 4a16fb
                          ;;
Packit 4a16fb
                        *)
Packit 4a16fb
                          func_fatal_error \
Packit 4a16fb
                             "unsupported warning category: '$1'"
Packit 4a16fb
                          ;;
Packit 4a16fb
                      esac
Packit 4a16fb
                      shift
Packit 4a16fb
                      ;;
Packit 4a16fb
Packit 4a16fb
        --verbose|-v) opt_verbose=: ;;
Packit 4a16fb
        --version)    func_version ;;
Packit 4a16fb
        -\?|-h)       func_usage ;;
Packit 4a16fb
        --help)       func_help ;;
Packit 4a16fb
Packit 4a16fb
	# Separate optargs to long options (plugins may need this):
Packit 4a16fb
	--*=*)        func_split_equals "$_G_opt"
Packit 4a16fb
	              set dummy "$func_split_equals_lhs" \
Packit 4a16fb
                          "$func_split_equals_rhs" ${1+"$@"}
Packit 4a16fb
                      shift
Packit 4a16fb
                      ;;
Packit 4a16fb
Packit 4a16fb
       # Separate optargs to short options:
Packit 4a16fb
        -W*)
Packit 4a16fb
                      func_split_short_opt "$_G_opt"
Packit 4a16fb
                      set dummy "$func_split_short_opt_name" \
Packit 4a16fb
                          "$func_split_short_opt_arg" ${1+"$@"}
Packit 4a16fb
                      shift
Packit 4a16fb
                      ;;
Packit 4a16fb
Packit 4a16fb
        # Separate non-argument short options:
Packit 4a16fb
        -\?*|-h*|-v*|-x*)
Packit 4a16fb
                      func_split_short_opt "$_G_opt"
Packit 4a16fb
                      set dummy "$func_split_short_opt_name" \
Packit 4a16fb
                          "-$func_split_short_opt_arg" ${1+"$@"}
Packit 4a16fb
                      shift
Packit 4a16fb
                      ;;
Packit 4a16fb
Packit 4a16fb
        --)           break ;;
Packit 4a16fb
        -*)           func_fatal_help "unrecognised option: '$_G_opt'" ;;
Packit 4a16fb
        *)            set dummy "$_G_opt" ${1+"$@"}; shift; break ;;
Packit 4a16fb
      esac
Packit 4a16fb
    done
Packit 4a16fb
Packit 4a16fb
    # save modified positional parameters for caller
Packit 4a16fb
    func_quote_for_eval ${1+"$@"}
Packit 4a16fb
    func_parse_options_result=$func_quote_for_eval_result
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_validate_options [ARG]...
Packit 4a16fb
# ------------------------------
Packit 4a16fb
# Perform any sanity checks on option settings and/or unconsumed
Packit 4a16fb
# arguments.
Packit 4a16fb
func_hookable func_validate_options
Packit 4a16fb
func_validate_options ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    # Display all warnings if -W was not given.
Packit 4a16fb
    test -n "$opt_warning_types" || opt_warning_types=" $warning_categories"
Packit 4a16fb
Packit 4a16fb
    func_run_hooks func_validate_options ${1+"$@"}
Packit 4a16fb
Packit 4a16fb
    # Bail if the options were screwed!
Packit 4a16fb
    $exit_cmd $EXIT_FAILURE
Packit 4a16fb
Packit 4a16fb
    # save modified positional parameters for caller
Packit 4a16fb
    func_validate_options_result=$func_run_hooks_result
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
## ----------------- ##
Packit 4a16fb
## Helper functions. ##
Packit 4a16fb
## ----------------- ##
Packit 4a16fb
Packit 4a16fb
# This section contains the helper functions used by the rest of the
Packit 4a16fb
# hookable option parser framework in ascii-betical order.
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_fatal_help ARG...
Packit 4a16fb
# ----------------------
Packit 4a16fb
# Echo program name prefixed message to standard error, followed by
Packit 4a16fb
# a help hint, and exit.
Packit 4a16fb
func_fatal_help ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    eval \$ECHO \""Usage: $usage"\"
Packit 4a16fb
    eval \$ECHO \""$fatal_help"\"
Packit 4a16fb
    func_error ${1+"$@"}
Packit 4a16fb
    exit $EXIT_FAILURE
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_help
Packit 4a16fb
# ---------
Packit 4a16fb
# Echo long help message to standard output and exit.
Packit 4a16fb
func_help ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    func_usage_message
Packit 4a16fb
    $ECHO "$long_help_message"
Packit 4a16fb
    exit 0
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_missing_arg ARGNAME
Packit 4a16fb
# ------------------------
Packit 4a16fb
# Echo program name prefixed message to standard error and set global
Packit 4a16fb
# exit_cmd.
Packit 4a16fb
func_missing_arg ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    func_error "Missing argument for '$1'."
Packit 4a16fb
    exit_cmd=exit
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_split_equals STRING
Packit 4a16fb
# ------------------------
Packit 4a16fb
# Set func_split_equals_lhs and func_split_equals_rhs shell variables after
Packit 4a16fb
# splitting STRING at the '=' sign.
Packit 4a16fb
test -z "$_G_HAVE_XSI_OPS" \
Packit 4a16fb
    && (eval 'x=a/b/c;
Packit 4a16fb
      test 5aa/bb/cc = "${#x}${x%%/*}${x%/*}${x#*/}${x##*/}"') 2>/dev/null \
Packit 4a16fb
    && _G_HAVE_XSI_OPS=yes
Packit 4a16fb
Packit 4a16fb
if test yes = "$_G_HAVE_XSI_OPS"
Packit 4a16fb
then
Packit 4a16fb
  # This is an XSI compatible shell, allowing a faster implementation...
Packit 4a16fb
  eval 'func_split_equals ()
Packit 4a16fb
  {
Packit 4a16fb
      $debug_cmd
Packit 4a16fb
Packit 4a16fb
      func_split_equals_lhs=${1%%=*}
Packit 4a16fb
      func_split_equals_rhs=${1#*=}
Packit 4a16fb
      test "x$func_split_equals_lhs" = "x$1" \
Packit 4a16fb
        && func_split_equals_rhs=
Packit 4a16fb
  }'
Packit 4a16fb
else
Packit 4a16fb
  # ...otherwise fall back to using expr, which is often a shell builtin.
Packit 4a16fb
  func_split_equals ()
Packit 4a16fb
  {
Packit 4a16fb
      $debug_cmd
Packit 4a16fb
Packit 4a16fb
      func_split_equals_lhs=`expr "x$1" : 'x\([^=]*\)'`
Packit 4a16fb
      func_split_equals_rhs=
Packit 4a16fb
      test "x$func_split_equals_lhs" = "x$1" \
Packit 4a16fb
        || func_split_equals_rhs=`expr "x$1" : 'x[^=]*=\(.*\)$'`
Packit 4a16fb
  }
Packit 4a16fb
fi #func_split_equals
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_split_short_opt SHORTOPT
Packit 4a16fb
# -----------------------------
Packit 4a16fb
# Set func_split_short_opt_name and func_split_short_opt_arg shell
Packit 4a16fb
# variables after splitting SHORTOPT after the 2nd character.
Packit 4a16fb
if test yes = "$_G_HAVE_XSI_OPS"
Packit 4a16fb
then
Packit 4a16fb
  # This is an XSI compatible shell, allowing a faster implementation...
Packit 4a16fb
  eval 'func_split_short_opt ()
Packit 4a16fb
  {
Packit 4a16fb
      $debug_cmd
Packit 4a16fb
Packit 4a16fb
      func_split_short_opt_arg=${1#??}
Packit 4a16fb
      func_split_short_opt_name=${1%"$func_split_short_opt_arg"}
Packit 4a16fb
  }'
Packit 4a16fb
else
Packit 4a16fb
  # ...otherwise fall back to using expr, which is often a shell builtin.
Packit 4a16fb
  func_split_short_opt ()
Packit 4a16fb
  {
Packit 4a16fb
      $debug_cmd
Packit 4a16fb
Packit 4a16fb
      func_split_short_opt_name=`expr "x$1" : 'x-\(.\)'`
Packit 4a16fb
      func_split_short_opt_arg=`expr "x$1" : 'x-.\(.*\)$'`
Packit 4a16fb
  }
Packit 4a16fb
fi #func_split_short_opt
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_usage
Packit 4a16fb
# ----------
Packit 4a16fb
# Echo short help message to standard output and exit.
Packit 4a16fb
func_usage ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    func_usage_message
Packit 4a16fb
    $ECHO "Run '$progname --help |${PAGER-more}' for full usage"
Packit 4a16fb
    exit 0
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_usage_message
Packit 4a16fb
# ------------------
Packit 4a16fb
# Echo short help message to standard output.
Packit 4a16fb
func_usage_message ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    eval \$ECHO \""Usage: $usage"\"
Packit 4a16fb
    echo
Packit 4a16fb
    $SED -n 's|^# ||
Packit 4a16fb
        /^Written by/{
Packit 4a16fb
          x;p;x
Packit 4a16fb
        }
Packit 4a16fb
	h
Packit 4a16fb
	/^Written by/q' < "$progpath"
Packit 4a16fb
    echo
Packit 4a16fb
    eval \$ECHO \""$usage_message"\"
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_version
Packit 4a16fb
# ------------
Packit 4a16fb
# Echo version message to standard output and exit.
Packit 4a16fb
func_version ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    printf '%s\n' "$progname $scriptversion"
Packit 4a16fb
    $SED -n '
Packit 4a16fb
        /(C)/!b go
Packit 4a16fb
        :more
Packit 4a16fb
        /\./!{
Packit 4a16fb
          N
Packit 4a16fb
          s|\n# | |
Packit 4a16fb
          b more
Packit 4a16fb
        }
Packit 4a16fb
        :go
Packit 4a16fb
        /^# Written by /,/# warranty; / {
Packit 4a16fb
          s|^# ||
Packit 4a16fb
          s|^# *$||
Packit 4a16fb
          s|\((C)\)[ 0-9,-]*[ ,-]\([1-9][0-9]* \)|\1 \2|
Packit 4a16fb
          p
Packit 4a16fb
        }
Packit 4a16fb
        /^# Written by / {
Packit 4a16fb
          s|^# ||
Packit 4a16fb
          p
Packit 4a16fb
        }
Packit 4a16fb
        /^warranty; /q' < "$progpath"
Packit 4a16fb
Packit 4a16fb
    exit $?
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# Local variables:
Packit 4a16fb
# mode: shell-script
Packit 4a16fb
# sh-indentation: 2
Packit 4a16fb
# eval: (add-hook 'before-save-hook 'time-stamp)
Packit 4a16fb
# time-stamp-pattern: "10/scriptversion=%:y-%02m-%02d.%02H; # UTC"
Packit 4a16fb
# time-stamp-time-zone: "UTC"
Packit 4a16fb
# End:
Packit 4a16fb
Packit 4a16fb
# Set a version string.
Packit 4a16fb
scriptversion='(GNU libtool) 2.4.6'
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_echo ARG...
Packit 4a16fb
# ----------------
Packit 4a16fb
# Libtool also displays the current mode in messages, so override
Packit 4a16fb
# funclib.sh func_echo with this custom definition.
Packit 4a16fb
func_echo ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    _G_message=$*
Packit 4a16fb
Packit 4a16fb
    func_echo_IFS=$IFS
Packit 4a16fb
    IFS=$nl
Packit 4a16fb
    for _G_line in $_G_message; do
Packit 4a16fb
      IFS=$func_echo_IFS
Packit 4a16fb
      $ECHO "$progname${opt_mode+: $opt_mode}: $_G_line"
Packit 4a16fb
    done
Packit 4a16fb
    IFS=$func_echo_IFS
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_warning ARG...
Packit 4a16fb
# -------------------
Packit 4a16fb
# Libtool warnings are not categorized, so override funclib.sh
Packit 4a16fb
# func_warning with this simpler definition.
Packit 4a16fb
func_warning ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    $warning_func ${1+"$@"}
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
## ---------------- ##
Packit 4a16fb
## Options parsing. ##
Packit 4a16fb
## ---------------- ##
Packit 4a16fb
Packit 4a16fb
# Hook in the functions to make sure our own options are parsed during
Packit 4a16fb
# the option parsing loop.
Packit 4a16fb
Packit 4a16fb
usage='$progpath [OPTION]... [MODE-ARG]...'
Packit 4a16fb
Packit 4a16fb
# Short help message in response to '-h'.
Packit 4a16fb
usage_message="Options:
Packit 4a16fb
       --config             show all configuration variables
Packit 4a16fb
       --debug              enable verbose shell tracing
Packit 4a16fb
   -n, --dry-run            display commands without modifying any files
Packit 4a16fb
       --features           display basic configuration information and exit
Packit 4a16fb
       --mode=MODE          use operation mode MODE
Packit 4a16fb
       --no-warnings        equivalent to '-Wnone'
Packit 4a16fb
       --preserve-dup-deps  don't remove duplicate dependency libraries
Packit 4a16fb
       --quiet, --silent    don't print informational messages
Packit 4a16fb
       --tag=TAG            use configuration variables from tag TAG
Packit 4a16fb
   -v, --verbose            print more informational messages than default
Packit 4a16fb
       --version            print version information
Packit 4a16fb
   -W, --warnings=CATEGORY  report the warnings falling in CATEGORY [all]
Packit 4a16fb
   -h, --help, --help-all   print short, long, or detailed help message
Packit 4a16fb
"
Packit 4a16fb
Packit 4a16fb
# Additional text appended to 'usage_message' in response to '--help'.
Packit 4a16fb
func_help ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    func_usage_message
Packit 4a16fb
    $ECHO "$long_help_message
Packit 4a16fb
Packit 4a16fb
MODE must be one of the following:
Packit 4a16fb
Packit 4a16fb
       clean           remove files from the build directory
Packit 4a16fb
       compile         compile a source file into a libtool object
Packit 4a16fb
       execute         automatically set library path, then run a program
Packit 4a16fb
       finish          complete the installation of libtool libraries
Packit 4a16fb
       install         install libraries or executables
Packit 4a16fb
       link            create a library or an executable
Packit 4a16fb
       uninstall       remove libraries from an installed directory
Packit 4a16fb
Packit 4a16fb
MODE-ARGS vary depending on the MODE.  When passed as first option,
Packit 4a16fb
'--mode=MODE' may be abbreviated as 'MODE' or a unique abbreviation of that.
Packit 4a16fb
Try '$progname --help --mode=MODE' for a more detailed description of MODE.
Packit 4a16fb
Packit 4a16fb
When reporting a bug, please describe a test case to reproduce it and
Packit 4a16fb
include the following information:
Packit 4a16fb
Packit 4a16fb
       host-triplet:   $host
Packit 4a16fb
       shell:          $SHELL
Packit 4a16fb
       compiler:       $LTCC
Packit 4a16fb
       compiler flags: $LTCFLAGS
Packit 4a16fb
       linker:         $LD (gnu? $with_gnu_ld)
Packit 4a16fb
       version:        $progname (GNU libtool) 2.4.6
Packit 4a16fb
       automake:       `($AUTOMAKE --version) 2>/dev/null |$SED 1q`
Packit 4a16fb
       autoconf:       `($AUTOCONF --version) 2>/dev/null |$SED 1q`
Packit 4a16fb
Packit 4a16fb
Report bugs to <bug-libtool@gnu.org>.
Packit 4a16fb
GNU libtool home page: <http://www.gnu.org/software/libtool/>.
Packit 4a16fb
General help using GNU software: <http://www.gnu.org/gethelp/>."
Packit 4a16fb
    exit 0
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_lo2o OBJECT-NAME
Packit 4a16fb
# ---------------------
Packit 4a16fb
# Transform OBJECT-NAME from a '.lo' suffix to the platform specific
Packit 4a16fb
# object suffix.
Packit 4a16fb
Packit 4a16fb
lo2o=s/\\.lo\$/.$objext/
Packit 4a16fb
o2lo=s/\\.$objext\$/.lo/
Packit 4a16fb
Packit 4a16fb
if test yes = "$_G_HAVE_XSI_OPS"; then
Packit 4a16fb
  eval 'func_lo2o ()
Packit 4a16fb
  {
Packit 4a16fb
    case $1 in
Packit 4a16fb
      *.lo) func_lo2o_result=${1%.lo}.$objext ;;
Packit 4a16fb
      *   ) func_lo2o_result=$1               ;;
Packit 4a16fb
    esac
Packit 4a16fb
  }'
Packit 4a16fb
Packit 4a16fb
  # func_xform LIBOBJ-OR-SOURCE
Packit 4a16fb
  # ---------------------------
Packit 4a16fb
  # Transform LIBOBJ-OR-SOURCE from a '.o' or '.c' (or otherwise)
Packit 4a16fb
  # suffix to a '.lo' libtool-object suffix.
Packit 4a16fb
  eval 'func_xform ()
Packit 4a16fb
  {
Packit 4a16fb
    func_xform_result=${1%.*}.lo
Packit 4a16fb
  }'
Packit 4a16fb
else
Packit 4a16fb
  # ...otherwise fall back to using sed.
Packit 4a16fb
  func_lo2o ()
Packit 4a16fb
  {
Packit 4a16fb
    func_lo2o_result=`$ECHO "$1" | $SED "$lo2o"`
Packit 4a16fb
  }
Packit 4a16fb
Packit 4a16fb
  func_xform ()
Packit 4a16fb
  {
Packit 4a16fb
    func_xform_result=`$ECHO "$1" | $SED 's|\.[^.]*$|.lo|'`
Packit 4a16fb
  }
Packit 4a16fb
fi
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_fatal_configuration ARG...
Packit 4a16fb
# -------------------------------
Packit 4a16fb
# Echo program name prefixed message to standard error, followed by
Packit 4a16fb
# a configuration failure hint, and exit.
Packit 4a16fb
func_fatal_configuration ()
Packit 4a16fb
{
Packit 4a16fb
    func_fatal_error ${1+"$@"} \
Packit 4a16fb
      "See the $PACKAGE documentation for more information." \
Packit 4a16fb
      "Fatal configuration error."
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_config
Packit 4a16fb
# -----------
Packit 4a16fb
# Display the configuration for all the tags in this script.
Packit 4a16fb
func_config ()
Packit 4a16fb
{
Packit 4a16fb
    re_begincf='^# ### BEGIN LIBTOOL'
Packit 4a16fb
    re_endcf='^# ### END LIBTOOL'
Packit 4a16fb
Packit 4a16fb
    # Default configuration.
Packit 4a16fb
    $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
Packit 4a16fb
Packit 4a16fb
    # Now print the configurations for the tags.
Packit 4a16fb
    for tagname in $taglist; do
Packit 4a16fb
      $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
Packit 4a16fb
    done
Packit 4a16fb
Packit 4a16fb
    exit $?
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_features
Packit 4a16fb
# -------------
Packit 4a16fb
# Display the features supported by this script.
Packit 4a16fb
func_features ()
Packit 4a16fb
{
Packit 4a16fb
    echo "host: $host"
Packit 4a16fb
    if test yes = "$build_libtool_libs"; then
Packit 4a16fb
      echo "enable shared libraries"
Packit 4a16fb
    else
Packit 4a16fb
      echo "disable shared libraries"
Packit 4a16fb
    fi
Packit 4a16fb
    if test yes = "$build_old_libs"; then
Packit 4a16fb
      echo "enable static libraries"
Packit 4a16fb
    else
Packit 4a16fb
      echo "disable static libraries"
Packit 4a16fb
    fi
Packit 4a16fb
Packit 4a16fb
    exit $?
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_enable_tag TAGNAME
Packit 4a16fb
# -----------------------
Packit 4a16fb
# Verify that TAGNAME is valid, and either flag an error and exit, or
Packit 4a16fb
# enable the TAGNAME tag.  We also add TAGNAME to the global $taglist
Packit 4a16fb
# variable here.
Packit 4a16fb
func_enable_tag ()
Packit 4a16fb
{
Packit 4a16fb
    # Global variable:
Packit 4a16fb
    tagname=$1
Packit 4a16fb
Packit 4a16fb
    re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
Packit 4a16fb
    re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
Packit 4a16fb
    sed_extractcf=/$re_begincf/,/$re_endcf/p
Packit 4a16fb
Packit 4a16fb
    # Validate tagname.
Packit 4a16fb
    case $tagname in
Packit 4a16fb
      *[!-_A-Za-z0-9,/]*)
Packit 4a16fb
        func_fatal_error "invalid tag name: $tagname"
Packit 4a16fb
        ;;
Packit 4a16fb
    esac
Packit 4a16fb
Packit 4a16fb
    # Don't test for the "default" C tag, as we know it's
Packit 4a16fb
    # there but not specially marked.
Packit 4a16fb
    case $tagname in
Packit 4a16fb
        CC) ;;
Packit 4a16fb
    *)
Packit 4a16fb
        if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
Packit 4a16fb
	  taglist="$taglist $tagname"
Packit 4a16fb
Packit 4a16fb
	  # Evaluate the configuration.  Be careful to quote the path
Packit 4a16fb
	  # and the sed script, to avoid splitting on whitespace, but
Packit 4a16fb
	  # also don't use non-portable quotes within backquotes within
Packit 4a16fb
	  # quotes we have to do it in 2 steps:
Packit 4a16fb
	  extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
Packit 4a16fb
	  eval "$extractedcf"
Packit 4a16fb
        else
Packit 4a16fb
	  func_error "ignoring unknown tag $tagname"
Packit 4a16fb
        fi
Packit 4a16fb
        ;;
Packit 4a16fb
    esac
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_check_version_match
Packit 4a16fb
# ------------------------
Packit 4a16fb
# Ensure that we are using m4 macros, and libtool script from the same
Packit 4a16fb
# release of libtool.
Packit 4a16fb
func_check_version_match ()
Packit 4a16fb
{
Packit 4a16fb
    if test "$package_revision" != "$macro_revision"; then
Packit 4a16fb
      if test "$VERSION" != "$macro_version"; then
Packit 4a16fb
        if test -z "$macro_version"; then
Packit 4a16fb
          cat >&2 <<_LT_EOF
Packit 4a16fb
$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
Packit 4a16fb
$progname: definition of this LT_INIT comes from an older release.
Packit 4a16fb
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
Packit 4a16fb
$progname: and run autoconf again.
Packit 4a16fb
_LT_EOF
Packit 4a16fb
        else
Packit 4a16fb
          cat >&2 <<_LT_EOF
Packit 4a16fb
$progname: Version mismatch error.  This is $PACKAGE $VERSION, but the
Packit 4a16fb
$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
Packit 4a16fb
$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
Packit 4a16fb
$progname: and run autoconf again.
Packit 4a16fb
_LT_EOF
Packit 4a16fb
        fi
Packit 4a16fb
      else
Packit 4a16fb
        cat >&2 <<_LT_EOF
Packit 4a16fb
$progname: Version mismatch error.  This is $PACKAGE $VERSION, revision $package_revision,
Packit 4a16fb
$progname: but the definition of this LT_INIT comes from revision $macro_revision.
Packit 4a16fb
$progname: You should recreate aclocal.m4 with macros from revision $package_revision
Packit 4a16fb
$progname: of $PACKAGE $VERSION and run autoconf again.
Packit 4a16fb
_LT_EOF
Packit 4a16fb
      fi
Packit 4a16fb
Packit 4a16fb
      exit $EXIT_MISMATCH
Packit 4a16fb
    fi
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# libtool_options_prep [ARG]...
Packit 4a16fb
# -----------------------------
Packit 4a16fb
# Preparation for options parsed by libtool.
Packit 4a16fb
libtool_options_prep ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_mode
Packit 4a16fb
Packit 4a16fb
    # Option defaults:
Packit 4a16fb
    opt_config=false
Packit 4a16fb
    opt_dlopen=
Packit 4a16fb
    opt_dry_run=false
Packit 4a16fb
    opt_help=false
Packit 4a16fb
    opt_mode=
Packit 4a16fb
    opt_preserve_dup_deps=false
Packit 4a16fb
    opt_quiet=false
Packit 4a16fb
Packit 4a16fb
    nonopt=
Packit 4a16fb
    preserve_args=
Packit 4a16fb
Packit 4a16fb
    # Shorthand for --mode=foo, only valid as the first argument
Packit 4a16fb
    case $1 in
Packit 4a16fb
    clean|clea|cle|cl)
Packit 4a16fb
      shift; set dummy --mode clean ${1+"$@"}; shift
Packit 4a16fb
      ;;
Packit 4a16fb
    compile|compil|compi|comp|com|co|c)
Packit 4a16fb
      shift; set dummy --mode compile ${1+"$@"}; shift
Packit 4a16fb
      ;;
Packit 4a16fb
    execute|execut|execu|exec|exe|ex|e)
Packit 4a16fb
      shift; set dummy --mode execute ${1+"$@"}; shift
Packit 4a16fb
      ;;
Packit 4a16fb
    finish|finis|fini|fin|fi|f)
Packit 4a16fb
      shift; set dummy --mode finish ${1+"$@"}; shift
Packit 4a16fb
      ;;
Packit 4a16fb
    install|instal|insta|inst|ins|in|i)
Packit 4a16fb
      shift; set dummy --mode install ${1+"$@"}; shift
Packit 4a16fb
      ;;
Packit 4a16fb
    link|lin|li|l)
Packit 4a16fb
      shift; set dummy --mode link ${1+"$@"}; shift
Packit 4a16fb
      ;;
Packit 4a16fb
    uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
Packit 4a16fb
      shift; set dummy --mode uninstall ${1+"$@"}; shift
Packit 4a16fb
      ;;
Packit 4a16fb
    esac
Packit 4a16fb
Packit 4a16fb
    # Pass back the list of options.
Packit 4a16fb
    func_quote_for_eval ${1+"$@"}
Packit 4a16fb
    libtool_options_prep_result=$func_quote_for_eval_result
Packit 4a16fb
}
Packit 4a16fb
func_add_hook func_options_prep libtool_options_prep
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# libtool_parse_options [ARG]...
Packit 4a16fb
# ---------------------------------
Packit 4a16fb
# Provide handling for libtool specific options.
Packit 4a16fb
libtool_parse_options ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    # Perform our own loop to consume as many options as possible in
Packit 4a16fb
    # each iteration.
Packit 4a16fb
    while test $# -gt 0; do
Packit 4a16fb
      _G_opt=$1
Packit 4a16fb
      shift
Packit 4a16fb
      case $_G_opt in
Packit 4a16fb
        --dry-run|--dryrun|-n)
Packit 4a16fb
                        opt_dry_run=:
Packit 4a16fb
                        ;;
Packit 4a16fb
Packit 4a16fb
        --config)       func_config ;;
Packit 4a16fb
Packit 4a16fb
        --dlopen|-dlopen)
Packit 4a16fb
                        opt_dlopen="${opt_dlopen+$opt_dlopen
Packit 4a16fb
}$1"
Packit 4a16fb
                        shift
Packit 4a16fb
                        ;;
Packit 4a16fb
Packit 4a16fb
        --preserve-dup-deps)
Packit 4a16fb
                        opt_preserve_dup_deps=: ;;
Packit 4a16fb
Packit 4a16fb
        --features)     func_features ;;
Packit 4a16fb
Packit 4a16fb
        --finish)       set dummy --mode finish ${1+"$@"}; shift ;;
Packit 4a16fb
Packit 4a16fb
        --help)         opt_help=: ;;
Packit 4a16fb
Packit 4a16fb
        --help-all)     opt_help=': help-all' ;;
Packit 4a16fb
Packit 4a16fb
        --mode)         test $# = 0 && func_missing_arg $_G_opt && break
Packit 4a16fb
                        opt_mode=$1
Packit 4a16fb
                        case $1 in
Packit 4a16fb
                          # Valid mode arguments:
Packit 4a16fb
                          clean|compile|execute|finish|install|link|relink|uninstall) ;;
Packit 4a16fb
Packit 4a16fb
                          # Catch anything else as an error
Packit 4a16fb
                          *) func_error "invalid argument for $_G_opt"
Packit 4a16fb
                             exit_cmd=exit
Packit 4a16fb
                             break
Packit 4a16fb
                             ;;
Packit 4a16fb
                        esac
Packit 4a16fb
                        shift
Packit 4a16fb
                        ;;
Packit 4a16fb
Packit 4a16fb
        --no-silent|--no-quiet)
Packit 4a16fb
                        opt_quiet=false
Packit 4a16fb
                        func_append preserve_args " $_G_opt"
Packit 4a16fb
                        ;;
Packit 4a16fb
Packit 4a16fb
        --no-warnings|--no-warning|--no-warn)
Packit 4a16fb
                        opt_warning=false
Packit 4a16fb
                        func_append preserve_args " $_G_opt"
Packit 4a16fb
                        ;;
Packit 4a16fb
Packit 4a16fb
        --no-verbose)
Packit 4a16fb
                        opt_verbose=false
Packit 4a16fb
                        func_append preserve_args " $_G_opt"
Packit 4a16fb
                        ;;
Packit 4a16fb
Packit 4a16fb
        --silent|--quiet)
Packit 4a16fb
                        opt_quiet=:
Packit 4a16fb
                        opt_verbose=false
Packit 4a16fb
                        func_append preserve_args " $_G_opt"
Packit 4a16fb
                        ;;
Packit 4a16fb
Packit 4a16fb
        --tag)          test $# = 0 && func_missing_arg $_G_opt && break
Packit 4a16fb
                        opt_tag=$1
Packit 4a16fb
                        func_append preserve_args " $_G_opt $1"
Packit 4a16fb
                        func_enable_tag "$1"
Packit 4a16fb
                        shift
Packit 4a16fb
                        ;;
Packit 4a16fb
Packit 4a16fb
        --verbose|-v)   opt_quiet=false
Packit 4a16fb
                        opt_verbose=:
Packit 4a16fb
                        func_append preserve_args " $_G_opt"
Packit 4a16fb
                        ;;
Packit 4a16fb
Packit 4a16fb
	# An option not handled by this hook function:
Packit 4a16fb
        *)		set dummy "$_G_opt" ${1+"$@"};	shift; break  ;;
Packit 4a16fb
      esac
Packit 4a16fb
    done
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
    # save modified positional parameters for caller
Packit 4a16fb
    func_quote_for_eval ${1+"$@"}
Packit 4a16fb
    libtool_parse_options_result=$func_quote_for_eval_result
Packit 4a16fb
}
Packit 4a16fb
func_add_hook func_parse_options libtool_parse_options
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# libtool_validate_options [ARG]...
Packit 4a16fb
# ---------------------------------
Packit 4a16fb
# Perform any sanity checks on option settings and/or unconsumed
Packit 4a16fb
# arguments.
Packit 4a16fb
libtool_validate_options ()
Packit 4a16fb
{
Packit 4a16fb
    # save first non-option argument
Packit 4a16fb
    if test 0 -lt $#; then
Packit 4a16fb
      nonopt=$1
Packit 4a16fb
      shift
Packit 4a16fb
    fi
Packit 4a16fb
Packit 4a16fb
    # preserve --debug
Packit 4a16fb
    test : = "$debug_cmd" || func_append preserve_args " --debug"
Packit 4a16fb
Packit 4a16fb
    case $host in
Packit 4a16fb
      # Solaris2 added to fix http://debbugs.gnu.org/cgi/bugreport.cgi?bug=16452
Packit 4a16fb
      # see also: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59788
Packit 4a16fb
      *cygwin* | *mingw* | *pw32* | *cegcc* | *solaris2* | *os2*)
Packit 4a16fb
        # don't eliminate duplications in $postdeps and $predeps
Packit 4a16fb
        opt_duplicate_compiler_generated_deps=:
Packit 4a16fb
        ;;
Packit 4a16fb
      *)
Packit 4a16fb
        opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
Packit 4a16fb
        ;;
Packit 4a16fb
    esac
Packit 4a16fb
Packit 4a16fb
    $opt_help || {
Packit 4a16fb
      # Sanity checks first:
Packit 4a16fb
      func_check_version_match
Packit 4a16fb
Packit 4a16fb
      test yes != "$build_libtool_libs" \
Packit 4a16fb
        && test yes != "$build_old_libs" \
Packit 4a16fb
        && func_fatal_configuration "not configured to build any kind of library"
Packit 4a16fb
Packit 4a16fb
      # Darwin sucks
Packit 4a16fb
      eval std_shrext=\"$shrext_cmds\"
Packit 4a16fb
Packit 4a16fb
      # Only execute mode is allowed to have -dlopen flags.
Packit 4a16fb
      if test -n "$opt_dlopen" && test execute != "$opt_mode"; then
Packit 4a16fb
        func_error "unrecognized option '-dlopen'"
Packit 4a16fb
        $ECHO "$help" 1>&2
Packit 4a16fb
        exit $EXIT_FAILURE
Packit 4a16fb
      fi
Packit 4a16fb
Packit 4a16fb
      # Change the help message to a mode-specific one.
Packit 4a16fb
      generic_help=$help
Packit 4a16fb
      help="Try '$progname --help --mode=$opt_mode' for more information."
Packit 4a16fb
    }
Packit 4a16fb
Packit 4a16fb
    # Pass back the unparsed argument list
Packit 4a16fb
    func_quote_for_eval ${1+"$@"}
Packit 4a16fb
    libtool_validate_options_result=$func_quote_for_eval_result
Packit 4a16fb
}
Packit 4a16fb
func_add_hook func_validate_options libtool_validate_options
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# Process options as early as possible so that --help and --version
Packit 4a16fb
# can return quickly.
Packit 4a16fb
func_options ${1+"$@"}
Packit 4a16fb
eval set dummy "$func_options_result"; shift
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
## ----------- ##
Packit 4a16fb
##    Main.    ##
Packit 4a16fb
## ----------- ##
Packit 4a16fb
Packit 4a16fb
magic='%%%MAGIC variable%%%'
Packit 4a16fb
magic_exe='%%%MAGIC EXE variable%%%'
Packit 4a16fb
Packit 4a16fb
# Global variables.
Packit 4a16fb
extracted_archives=
Packit 4a16fb
extracted_serial=0
Packit 4a16fb
Packit 4a16fb
# If this variable is set in any of the actions, the command in it
Packit 4a16fb
# will be execed at the end.  This prevents here-documents from being
Packit 4a16fb
# left over by shells.
Packit 4a16fb
exec_cmd=
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# A function that is used when there is no print builtin or printf.
Packit 4a16fb
func_fallback_echo ()
Packit 4a16fb
{
Packit 4a16fb
  eval 'cat <<_LTECHO_EOF
Packit 4a16fb
$1
Packit 4a16fb
_LTECHO_EOF'
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
# func_generated_by_libtool
Packit 4a16fb
# True iff stdin has been generated by Libtool. This function is only
Packit 4a16fb
# a basic sanity check; it will hardly flush out determined imposters.
Packit 4a16fb
func_generated_by_libtool_p ()
Packit 4a16fb
{
Packit 4a16fb
  $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
# func_lalib_p file
Packit 4a16fb
# True iff FILE is a libtool '.la' library or '.lo' object file.
Packit 4a16fb
# This function is only a basic sanity check; it will hardly flush out
Packit 4a16fb
# determined imposters.
Packit 4a16fb
func_lalib_p ()
Packit 4a16fb
{
Packit 4a16fb
    test -f "$1" &&
Packit 4a16fb
      $SED -e 4q "$1" 2>/dev/null | func_generated_by_libtool_p
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
# func_lalib_unsafe_p file
Packit 4a16fb
# True iff FILE is a libtool '.la' library or '.lo' object file.
Packit 4a16fb
# This function implements the same check as func_lalib_p without
Packit 4a16fb
# resorting to external programs.  To this end, it redirects stdin and
Packit 4a16fb
# closes it afterwards, without saving the original file descriptor.
Packit 4a16fb
# As a safety measure, use it only where a negative result would be
Packit 4a16fb
# fatal anyway.  Works if 'file' does not exist.
Packit 4a16fb
func_lalib_unsafe_p ()
Packit 4a16fb
{
Packit 4a16fb
    lalib_p=no
Packit 4a16fb
    if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
Packit 4a16fb
	for lalib_p_l in 1 2 3 4
Packit 4a16fb
	do
Packit 4a16fb
	    read lalib_p_line
Packit 4a16fb
	    case $lalib_p_line in
Packit 4a16fb
		\#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
Packit 4a16fb
	    esac
Packit 4a16fb
	done
Packit 4a16fb
	exec 0<&5 5<&-
Packit 4a16fb
    fi
Packit 4a16fb
    test yes = "$lalib_p"
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
# func_ltwrapper_script_p file
Packit 4a16fb
# True iff FILE is a libtool wrapper script
Packit 4a16fb
# This function is only a basic sanity check; it will hardly flush out
Packit 4a16fb
# determined imposters.
Packit 4a16fb
func_ltwrapper_script_p ()
Packit 4a16fb
{
Packit 4a16fb
    test -f "$1" &&
Packit 4a16fb
      $lt_truncate_bin < "$1" 2>/dev/null | func_generated_by_libtool_p
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
# func_ltwrapper_executable_p file
Packit 4a16fb
# True iff FILE is a libtool wrapper executable
Packit 4a16fb
# This function is only a basic sanity check; it will hardly flush out
Packit 4a16fb
# determined imposters.
Packit 4a16fb
func_ltwrapper_executable_p ()
Packit 4a16fb
{
Packit 4a16fb
    func_ltwrapper_exec_suffix=
Packit 4a16fb
    case $1 in
Packit 4a16fb
    *.exe) ;;
Packit 4a16fb
    *) func_ltwrapper_exec_suffix=.exe ;;
Packit 4a16fb
    esac
Packit 4a16fb
    $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
# func_ltwrapper_scriptname file
Packit 4a16fb
# Assumes file is an ltwrapper_executable
Packit 4a16fb
# uses $file to determine the appropriate filename for a
Packit 4a16fb
# temporary ltwrapper_script.
Packit 4a16fb
func_ltwrapper_scriptname ()
Packit 4a16fb
{
Packit 4a16fb
    func_dirname_and_basename "$1" "" "."
Packit 4a16fb
    func_stripname '' '.exe' "$func_basename_result"
Packit 4a16fb
    func_ltwrapper_scriptname_result=$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
# func_ltwrapper_p file
Packit 4a16fb
# True iff FILE is a libtool wrapper script or wrapper executable
Packit 4a16fb
# This function is only a basic sanity check; it will hardly flush out
Packit 4a16fb
# determined imposters.
Packit 4a16fb
func_ltwrapper_p ()
Packit 4a16fb
{
Packit 4a16fb
    func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_execute_cmds commands fail_cmd
Packit 4a16fb
# Execute tilde-delimited COMMANDS.
Packit 4a16fb
# If FAIL_CMD is given, eval that upon failure.
Packit 4a16fb
# FAIL_CMD may read-access the current command in variable CMD!
Packit 4a16fb
func_execute_cmds ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    save_ifs=$IFS; IFS='~'
Packit 4a16fb
    for cmd in $1; do
Packit 4a16fb
      IFS=$sp$nl
Packit 4a16fb
      eval cmd=\"$cmd\"
Packit 4a16fb
      IFS=$save_ifs
Packit 4a16fb
      func_show_eval "$cmd" "${2-:}"
Packit 4a16fb
    done
Packit 4a16fb
    IFS=$save_ifs
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_source file
Packit 4a16fb
# Source FILE, adding directory component if necessary.
Packit 4a16fb
# Note that it is not necessary on cygwin/mingw to append a dot to
Packit 4a16fb
# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
Packit 4a16fb
# behavior happens only for exec(3), not for open(2)!  Also, sourcing
Packit 4a16fb
# 'FILE.' does not work on cygwin managed mounts.
Packit 4a16fb
func_source ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    case $1 in
Packit 4a16fb
    */* | *\\*)	. "$1" ;;
Packit 4a16fb
    *)		. "./$1" ;;
Packit 4a16fb
    esac
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_resolve_sysroot PATH
Packit 4a16fb
# Replace a leading = in PATH with a sysroot.  Store the result into
Packit 4a16fb
# func_resolve_sysroot_result
Packit 4a16fb
func_resolve_sysroot ()
Packit 4a16fb
{
Packit 4a16fb
  func_resolve_sysroot_result=$1
Packit 4a16fb
  case $func_resolve_sysroot_result in
Packit 4a16fb
  =*)
Packit 4a16fb
    func_stripname '=' '' "$func_resolve_sysroot_result"
Packit 4a16fb
    func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
Packit 4a16fb
    ;;
Packit 4a16fb
  esac
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
# func_replace_sysroot PATH
Packit 4a16fb
# If PATH begins with the sysroot, replace it with = and
Packit 4a16fb
# store the result into func_replace_sysroot_result.
Packit 4a16fb
func_replace_sysroot ()
Packit 4a16fb
{
Packit 4a16fb
  case $lt_sysroot:$1 in
Packit 4a16fb
  ?*:"$lt_sysroot"*)
Packit 4a16fb
    func_stripname "$lt_sysroot" '' "$1"
Packit 4a16fb
    func_replace_sysroot_result='='$func_stripname_result
Packit 4a16fb
    ;;
Packit 4a16fb
  *)
Packit 4a16fb
    # Including no sysroot.
Packit 4a16fb
    func_replace_sysroot_result=$1
Packit 4a16fb
    ;;
Packit 4a16fb
  esac
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
# func_infer_tag arg
Packit 4a16fb
# Infer tagged configuration to use if any are available and
Packit 4a16fb
# if one wasn't chosen via the "--tag" command line option.
Packit 4a16fb
# Only attempt this if the compiler in the base compile
Packit 4a16fb
# command doesn't match the default compiler.
Packit 4a16fb
# arg is usually of the form 'gcc ...'
Packit 4a16fb
func_infer_tag ()
Packit 4a16fb
{
Packit 4a16fb
    $debug_cmd
Packit 4a16fb
Packit 4a16fb
    if test -n "$available_tags" && test -z "$tagname"; then
Packit 4a16fb
      CC_quoted=
Packit 4a16fb
      for arg in $CC; do
Packit 4a16fb
	func_append_quoted CC_quoted "$arg"
Packit 4a16fb
      done
Packit 4a16fb
      CC_expanded=`func_echo_all $CC`
Packit 4a16fb
      CC_quoted_expanded=`func_echo_all $CC_quoted`
Packit 4a16fb
      case $@ in
Packit 4a16fb
      # Blanks in the command may have been stripped by the calling shell,
Packit 4a16fb
      # but not from the CC environment variable when configure was run.
Packit 4a16fb
      " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
Packit 4a16fb
      " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
Packit 4a16fb
      # Blanks at the start of $base_compile will cause this to fail
Packit 4a16fb
      # if we don't check for them as well.
Packit 4a16fb
      *)
Packit 4a16fb
	for z in $available_tags; do
Packit 4a16fb
	  if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
Packit 4a16fb
	    # Evaluate the configuration.
Packit 4a16fb
	    eval "`$SED -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
Packit 4a16fb
	    CC_quoted=
Packit 4a16fb
	    for arg in $CC; do
Packit 4a16fb
	      # Double-quote args containing other shell metacharacters.
Packit 4a16fb
	      func_append_quoted CC_quoted "$arg"
Packit 4a16fb
	    done
Packit 4a16fb
	    CC_expanded=`func_echo_all $CC`
Packit 4a16fb
	    CC_quoted_expanded=`func_echo_all $CC_quoted`
Packit 4a16fb
	    case "$@ " in
Packit 4a16fb
	    " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
Packit 4a16fb
	    " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
Packit 4a16fb
	      # The compiler in the base compile command matches
Packit 4a16fb
	      # the one in the tagged configuration.
Packit 4a16fb
	      # Assume this is the tagged configuration we want.
Packit 4a16fb
	      tagname=$z
Packit 4a16fb
	      break
Packit 4a16fb
	      ;;
Packit 4a16fb
	    esac
Packit 4a16fb
	  fi
Packit 4a16fb
	done
Packit 4a16fb
	# If $tagname still isn't set, then no tagged configuration
Packit 4a16fb
	# was found and let the user know that the "--tag" command
Packit 4a16fb
	# line option must be used.
Packit 4a16fb
	if test -z "$tagname"; then
Packit 4a16fb
	  func_echo "unable to infer tagged configuration"
Packit 4a16fb
	  func_fatal_error "specify a tag with '--tag'"
Packit 4a16fb
#	else
Packit 4a16fb
#	  func_verbose "using $tagname tagged configuration"
Packit 4a16fb
	fi
Packit 4a16fb
	;;
Packit 4a16fb
      esac
Packit 4a16fb
    fi
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_write_libtool_object output_name pic_name nonpic_name
Packit 4a16fb
# Create a libtool object file (analogous to a ".la" file),
Packit 4a16fb
# but don't create it if we're doing a dry run.
Packit 4a16fb
func_write_libtool_object ()
Packit 4a16fb
{
Packit 4a16fb
    write_libobj=$1
Packit 4a16fb
    if test yes = "$build_libtool_libs"; then
Packit 4a16fb
      write_lobj=\'$2\'
Packit 4a16fb
    else
Packit 4a16fb
      write_lobj=none
Packit 4a16fb
    fi
Packit 4a16fb
Packit 4a16fb
    if test yes = "$build_old_libs"; then
Packit 4a16fb
      write_oldobj=\'$3\'
Packit 4a16fb
    else
Packit 4a16fb
      write_oldobj=none
Packit 4a16fb
    fi
Packit 4a16fb
Packit 4a16fb
    $opt_dry_run || {
Packit 4a16fb
      cat >${write_libobj}T <
Packit 4a16fb
# $write_libobj - a libtool object file
Packit 4a16fb
# Generated by $PROGRAM (GNU $PACKAGE) $VERSION
Packit 4a16fb
#
Packit 4a16fb
# Please DO NOT delete this file!
Packit 4a16fb
# It is necessary for linking the library.
Packit 4a16fb
Packit 4a16fb
# Name of the PIC object.
Packit 4a16fb
pic_object=$write_lobj
Packit 4a16fb
Packit 4a16fb
# Name of the non-PIC object
Packit 4a16fb
non_pic_object=$write_oldobj
Packit 4a16fb
Packit 4a16fb
EOF
Packit 4a16fb
      $MV "${write_libobj}T" "$write_libobj"
Packit 4a16fb
    }
Packit 4a16fb
}
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
##################################################
Packit 4a16fb
# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
Packit 4a16fb
##################################################
Packit 4a16fb
Packit 4a16fb
# func_convert_core_file_wine_to_w32 ARG
Packit 4a16fb
# Helper function used by file name conversion functions when $build is *nix,
Packit 4a16fb
# and $host is mingw, cygwin, or some other w32 environment. Relies on a
Packit 4a16fb
# correctly configured wine environment available, with the winepath program
Packit 4a16fb
# in $build's $PATH.
Packit 4a16fb
#
Packit 4a16fb
# ARG is the $build file name to be converted to w32 format.
Packit 4a16fb
# Result is available in $func_convert_core_file_wine_to_w32_result, and will
Packit 4a16fb
# be empty on error (or when ARG is empty)
Packit 4a16fb
func_convert_core_file_wine_to_w32 ()
Packit 4a16fb
{
Packit 4a16fb
  $debug_cmd
Packit 4a16fb
Packit 4a16fb
  func_convert_core_file_wine_to_w32_result=$1
Packit 4a16fb
  if test -n "$1"; then
Packit 4a16fb
    # Unfortunately, winepath does not exit with a non-zero error code, so we
Packit 4a16fb
    # are forced to check the contents of stdout. On the other hand, if the
Packit 4a16fb
    # command is not found, the shell will set an exit code of 127 and print
Packit 4a16fb
    # *an error message* to stdout. So we must check for both error code of
Packit 4a16fb
    # zero AND non-empty stdout, which explains the odd construction:
Packit 4a16fb
    func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
Packit 4a16fb
    if test "$?" -eq 0 && test -n "$func_convert_core_file_wine_to_w32_tmp"; then
Packit 4a16fb
      func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
Packit 4a16fb
        $SED -e "$sed_naive_backslashify"`
Packit 4a16fb
    else
Packit 4a16fb
      func_convert_core_file_wine_to_w32_result=
Packit 4a16fb
    fi
Packit 4a16fb
  fi
Packit 4a16fb
}
Packit 4a16fb
# end: func_convert_core_file_wine_to_w32
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_convert_core_path_wine_to_w32 ARG
Packit 4a16fb
# Helper function used by path conversion functions when $build is *nix, and
Packit 4a16fb
# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
Packit 4a16fb
# configured wine environment available, with the winepath program in $build's
Packit 4a16fb
# $PATH. Assumes ARG has no leading or trailing path separator characters.
Packit 4a16fb
#
Packit 4a16fb
# ARG is path to be converted from $build format to win32.
Packit 4a16fb
# Result is available in $func_convert_core_path_wine_to_w32_result.
Packit 4a16fb
# Unconvertible file (directory) names in ARG are skipped; if no directory names
Packit 4a16fb
# are convertible, then the result may be empty.
Packit 4a16fb
func_convert_core_path_wine_to_w32 ()
Packit 4a16fb
{
Packit 4a16fb
  $debug_cmd
Packit 4a16fb
Packit 4a16fb
  # unfortunately, winepath doesn't convert paths, only file names
Packit 4a16fb
  func_convert_core_path_wine_to_w32_result=
Packit 4a16fb
  if test -n "$1"; then
Packit 4a16fb
    oldIFS=$IFS
Packit 4a16fb
    IFS=:
Packit 4a16fb
    for func_convert_core_path_wine_to_w32_f in $1; do
Packit 4a16fb
      IFS=$oldIFS
Packit 4a16fb
      func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
Packit 4a16fb
      if test -n "$func_convert_core_file_wine_to_w32_result"; then
Packit 4a16fb
        if test -z "$func_convert_core_path_wine_to_w32_result"; then
Packit 4a16fb
          func_convert_core_path_wine_to_w32_result=$func_convert_core_file_wine_to_w32_result
Packit 4a16fb
        else
Packit 4a16fb
          func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
Packit 4a16fb
        fi
Packit 4a16fb
      fi
Packit 4a16fb
    done
Packit 4a16fb
    IFS=$oldIFS
Packit 4a16fb
  fi
Packit 4a16fb
}
Packit 4a16fb
# end: func_convert_core_path_wine_to_w32
Packit 4a16fb
Packit 4a16fb
Packit 4a16fb
# func_cygpath ARGS...
Packit 4a16fb
# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
Packit 4a16fb
# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
Packit 4a16fb
# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
Packit 4a16fb
# (2), returns the Cygwin file name or path in func_cygpath_result (input
Packit 4a16fb
# file name or path is assumed to be in w32 format, as previously converted
Packit 4a16fb
# from $build's *nix or MSYS format). In case (3), returns the w32 file name
Packit 4a16fb
# or path in func_cygpath_result (input file name or path is assumed to be in
Packit 4a16fb
# Cygwin format). Returns an empty string on error.
Packit 4a16fb
#
Packit 4a16fb
# ARGS are passed to cygpath, with the last one being the file name or path to
Packit 4a16fb
# be converted.
Packit 4a16fb
#
Packit 4a16fb
# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
Packit 4a16fb
# environment variable; do not put it in $PATH.
Packit 4a16fb
func_cygpath ()
Packit 4a16fb
{
Packit 4a16fb
  $debug_cmd
Packit 4a16fb
Packit 4a16fb
  if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
Packit 4a16fb
    func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
Packit 4a16fb
    if test "$?" -ne 0; then
Packit 4a16fb
      # on failure, ensure result is empty
Packit 4a16fb
      func_cygpath_result=
Packit 4a16fb
    fi
Packit